@bitseek/claw 1.3.9 → 1.3.10-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accounts-UZBaDk40.js → accounts-CAdzApsy.js} +7 -7
- package/dist/{accounts-C9SoQRlD.js → accounts-CuCtdH3C.js} +1 -1
- package/dist/{accounts-MEuVJDoB.js → accounts-Cz3RQNdH.js} +1 -1
- package/dist/{acp-cli-BW0Dvkhh.js → acp-cli-BKsxHhdT.js} +2 -2
- package/dist/{acp-cli-Bt83My-G.js → acp-cli-Cpn_hxPA.js} +8 -8
- package/dist/{agent-scope-YUWhK3d-.js → agent-scope-BSkZamWK.js} +1 -1
- package/dist/{agents-DyoF_f3J.js → agents-CTTYn76G.js} +15 -15
- package/dist/{agents.config-DlsoquZH.js → agents.config-Dzz_a9Mp.js} +1 -1
- package/dist/{agents.config-D-pjQl0a.js → agents.config-P4PAeT4_.js} +2 -2
- package/dist/{api-key-rotation-D7ptHGeX.js → api-key-rotation-KLYtCoCN.js} +1 -1
- package/dist/{audio-preflight-Be5qvEQA.js → audio-preflight-B1d3Otlb.js} +36 -36
- package/dist/{audio-preflight-CRllHcyv.js → audio-preflight-COA5tnZv.js} +3 -3
- package/dist/{audio-preflight-BxZJpmRQ.js → audio-preflight-CoLgRr1u.js} +3 -3
- package/dist/{audio-preflight-UJQ0M6Hl.js → audio-preflight-q7ZFguqv.js} +3 -3
- package/dist/{audio-transcription-runner-Dnkt3gmf.js → audio-transcription-runner-BEtb5Jme.js} +22 -22
- package/dist/{audio-transcription-runner-_HLf10kW.js → audio-transcription-runner-BLpgvFWB.js} +1 -1
- package/dist/{audio-transcription-runner-DVI-SHAn.js → audio-transcription-runner-CrM5-5xi.js} +1 -1
- package/dist/{audio-transcription-runner-WwCG9VCF.js → audio-transcription-runner-s4TXhBuF.js} +1 -1
- package/dist/{audit-Ct605ugr.js → audit-D013ewlH.js} +3 -3
- package/dist/{audit-D-QnHZqm.js → audit-DG0miQ3A.js} +29 -29
- package/dist/{auth-DeS7F6Hd.js → auth-CVxYkRFJ.js} +1 -1
- package/dist/{auth-choice-BnlfU4y1.js → auth-choice-BRVQOSOG.js} +2 -2
- package/dist/{auth-choice-BtNLcXFy.js → auth-choice-CV8rLyb8.js} +12 -12
- package/dist/{auth-choice-jr1JhZAd.js → auth-choice-Cmq6GQD8.js} +14 -14
- package/dist/{auth-choice.apply-helpers-Cjj-3bz6.js → auth-choice.apply-helpers-CDB_05Fx.js} +1 -1
- package/dist/{auth-profiles-Dgxwr8Sa.js → auth-profiles-DNfjfFON.js} +16 -16
- package/dist/{auth-token-BYBDbosA.js → auth-token-CBowgXcm.js} +1 -1
- package/dist/{banner-Dl-V7Ptt.js → banner-CzgAzM1q.js} +2 -2
- package/dist/{bindings-BDScuSfd.js → bindings-B8U0BrYk.js} +1 -1
- package/dist/{bonjour-discovery-Cr9ghR-L.js → bonjour-discovery-CvAov_o2.js} +1 -1
- package/dist/{browser-cli-DGLAbUwi.js → browser-cli-CBBjI2Mu.js} +12 -12
- package/dist/{browser-cli-D2wMcHia.js → browser-cli-VBhMcj3d.js} +3 -3
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +5 -5
- package/dist/bundled/session-memory/handler.js +5 -5
- package/dist/{call-BdLuBL48.js → call-DU_f0KMj.js} +1 -1
- package/dist/{call-Dx2aHVrt.js → call-Da49LtVk.js} +10 -10
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-account-context-D__SZrX3.js → channel-account-context-8QkfoueX.js} +5 -5
- package/dist/{channel-options-BYE1VHBo.js → channel-options-CiMiQ1Q5.js} +3 -3
- package/dist/{channel-options-DbFmOvel.js → channel-options-CwgtYRMM.js} +1 -1
- package/dist/{channel-selection-ZJlD8RW_.js → channel-selection-BuY5iEbg.js} +1 -1
- package/dist/{channel-web-COoUoCJ1.js → channel-web-DNpAAGVd.js} +18 -18
- package/dist/{channel-web-DI8CzqrG.js → channel-web-DekWEF-x.js} +2 -2
- package/dist/{channels-cli-a630SQK6.js → channels-cli-DxMc7DH5.js} +95 -95
- package/dist/{channels-cli-CnwFvDuq.js → channels-cli-d0TsshWJ.js} +13 -13
- package/dist/{channels-status-issues-Ccr7cxgt.js → channels-status-issues-C3zPqi31.js} +1 -1
- package/dist/{chrome-F8yPeLCk.js → chrome-BosxOvwr.js} +4 -4
- package/dist/{clawbot-cli-CFFhJyHO.js → clawbot-cli-Cq5MLCVY.js} +5 -5
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/{cli-Dyjp2Eb9.js → cli-BN9QyJ2t.js} +76 -76
- package/dist/{cli-CSvBbD4L.js → cli-H2qqzBh-.js} +8 -8
- package/dist/{client-DVME2dNA.js → client-CbO7FTeL.js} +3 -2
- package/dist/{client-CluJsNRo.js → client-zj7haqMb.js} +1 -0
- package/dist/{command-registry-CiiKLf7K.js → command-registry-CZeXdavX.js} +13 -13
- package/dist/{commands-NkZDaV9a.js → commands-pIMTT07J.js} +1 -1
- package/dist/{commands-registry-BEOnewEO.js → commands-registry-DsvOsTTF.js} +3 -3
- package/dist/{completion-cli-A-7_BOG8.js → completion-cli-CtFPrLVk.js} +13 -13
- package/dist/{completion-cli-Cf-BVW55.js → completion-cli-CtlUQOU1.js} +1 -1
- package/dist/{config-cli-B8b1tCQT.js → config-cli-7YppRhHT.js} +1 -1
- package/dist/{config-cli-DKp1_Q2a.js → config-cli-CFOqOvdY.js} +7 -7
- package/dist/{config-guard-B9fTWjXL.js → config-guard-_F29cfDV.js} +3 -3
- package/dist/{config-validation-CA4J--dN.js → config-validation-DJiuTGa9.js} +3 -3
- package/dist/{configure-BFAj-ANy.js → configure-CyZK-h8l.js} +6 -6
- package/dist/{configure-C0LdxD84.js → configure-u6SJdWUT.js} +17 -17
- package/dist/control-ui/assets/{index-ixU5putu.js → index-BX-BH831.js} +408 -362
- package/dist/control-ui/assets/index-BX-BH831.js.map +1 -0
- package/dist/control-ui/assets/{index-EvU5ZebS.css → index-CG7TGGhP.css} +1 -1
- package/dist/control-ui/index.html +2 -2
- package/dist/{control-ui-assets-hAbiBedq.js → control-ui-assets-CWYG-y7n.js} +1 -1
- package/dist/{cron-cli-GqIWWgiC.js → cron-cli-9N0CgRKB.js} +12 -12
- package/dist/{cron-cli-CDE1OFDG.js → cron-cli-CF5BP-n7.js} +3 -3
- package/dist/{daemon-cli-D73VJA_5.js → daemon-cli-0g2nkiie.js} +2 -2
- package/dist/{daemon-cli-CEmNv817.js → daemon-cli-BMq2D7sp.js} +15 -15
- package/dist/daemon-cli.js +1 -0
- package/dist/{daemon-install-BmfoXdXy.js → daemon-install-C570xWh0.js} +4 -4
- package/dist/{daemon-install-helpers-BsUgG6nU.js → daemon-install-helpers-BHTLKVCH.js} +11 -11
- package/dist/{dashboard-DTlNIb75.js → dashboard-ChRtpalJ.js} +2 -2
- package/dist/{dashboard-DvN1mA5u.js → dashboard-EG5nMcy-.js} +1 -1
- package/dist/{deliver-CeItj33i.js → deliver-BCX2HRzP.js} +7 -7
- package/dist/{deliver-UlKfF5ki.js → deliver-CjCvs92K.js} +1 -1
- package/dist/{deliver-BR94HzGu.js → deliver-DvxmGKU7.js} +1 -1
- package/dist/{deliver-Ed6oj5Hr.js → deliver-nnwtUHe4.js} +1 -1
- package/dist/{devices-cli-BE_t6kEW.js → devices-cli-BRo35VQ8.js} +8 -8
- package/dist/{devices-cli-DolMfE77.js → devices-cli-DhkpGf9W.js} +2 -2
- package/dist/{diagnostic-BS_rmYNQ.js → diagnostic-CgNDbdut.js} +1 -1
- package/dist/{diagnostics-DCUyr8cM.js → diagnostics-DFZTmuFB.js} +5 -5
- package/dist/{directory-cli-CRSmIysH.js → directory-cli-BKfV5rcs.js} +8 -8
- package/dist/{dns-cli-CSAjz7bt.js → dns-cli--O5ugFD3.js} +5 -5
- package/dist/{dock-CslXtXH_.js → dock-Cki7hMDN.js} +4 -4
- package/dist/{docs-cli-BRb3xAC4.js → docs-cli-o8TMQTn6.js} +4 -4
- package/dist/{doctor-completion-DDa8Rj_C.js → doctor-completion-D1YQPRLZ.js} +1 -1
- package/dist/{doctor-completion-CqdGtWOU.js → doctor-completion-DdOKH1q8.js} +2 -2
- package/dist/{doctor-config-flow-BEveSr6U.js → doctor-config-flow-C2SyrY1V.js} +15 -15
- package/dist/{enable-rsx0VIgO.js → enable-mI_Pnmyk.js} +1 -1
- package/dist/entry.js +2 -2
- package/dist/{exec-approvals-allowlist-Dgb12MXc.js → exec-approvals-allowlist-Bdtmhwgj.js} +1 -1
- package/dist/{exec-approvals-cli-qbLlzazr.js → exec-approvals-cli-Cfh3OhWq.js} +4 -4
- package/dist/{exec-approvals-cli-xVv5uofa.js → exec-approvals-cli-U6R3GXsh.js} +16 -16
- package/dist/{exec-safe-bin-runtime-policy-BfybDm-q.js → exec-safe-bin-runtime-policy-DfgvmbZG.js} +2 -2
- package/dist/extensionAPI.js +5 -5
- package/dist/{fetch-BZWXCGP2.js → fetch-Dp9uG2qN.js} +3 -3
- package/dist/{fetch-guard-BplMfPrm.js → fetch-guard-ClzGpvFK.js} +1 -1
- package/dist/{fs-safe-nXGqHBF8.js → fs-safe-BtSQvuQn.js} +24 -24
- package/dist/{gateway-cli-CKOUY2y1.js → gateway-cli-D6K1V3Bk.js} +175 -167
- package/dist/{gateway-cli-D7OOfzP7.js → gateway-cli-RrWvU33e.js} +33 -25
- package/dist/{gateway-rpc-CEueWk1E.js → gateway-rpc-ByQgck-k.js} +1 -1
- package/dist/{gateway-rpc-yBoALaWH.js → gateway-rpc-DiWvH8Pq.js} +1 -1
- package/dist/{health-D7FO50c6.js → health-BEGEjMAH.js} +3 -3
- package/dist/{health-Dyd4RpCM.js → health-CgHjmUFQ.js} +14 -14
- package/dist/{hooks-cli-C0ESoNa0.js → hooks-cli-BqCZdnvb.js} +84 -84
- package/dist/{hooks-cli-DufRHJ0v.js → hooks-cli-Cigd_Wfj.js} +9 -9
- package/dist/{hooks-status-DC5Ls265.js → hooks-status-DLAFiQoD.js} +1 -1
- package/dist/{image-XqGcCt9q.js → image-5kjT0Ifv.js} +1 -1
- package/dist/{image-BKHeF2sO.js → image-Cboo5_y3.js} +1 -1
- package/dist/{image-DcfdUryQ.js → image-Cj831azd.js} +1 -1
- package/dist/{image-HyFl8MrD.js → image-CrLgaJde.js} +5 -5
- package/dist/{image-ops-_2-6WZ4r.js → image-ops-Cv4BHtyC.js} +10 -10
- package/dist/index.js +13 -13
- package/dist/{inspect-DRNo1VIP.js → inspect-BB0gFSLo.js} +4 -4
- package/dist/{install-safe-path-DBJEsbCp.js → install-safe-path-CSglDbi-.js} +25 -25
- package/dist/{installs-B2Z4DyUY.js → installs-D6ND4ZY7.js} +9 -9
- package/dist/{ipv4-BMbKD3zl.js → ipv4-Dw9v4ItT.js} +1 -1
- package/dist/{ir-DaZ8ITYK.js → ir-Bov3hbIf.js} +6 -6
- package/dist/{issue-format-BK98Hpx-.js → issue-format-Bnj64obT.js} +1 -1
- package/dist/{json-files-DrZ4qfxw.js → json-files-1hhV5hS6.js} +8 -8
- package/dist/{lifecycle-core-BrIHPmUB.js → lifecycle-core-_8xJF_9z.js} +5 -5
- package/dist/llm-slug-generator.js +5 -5
- package/dist/{login--V3ibRWJ.js → login-D-Js3AvX.js} +3 -3
- package/dist/{login-qr-TavUzvgE.js → login-qr-DzUhzJq4.js} +6 -6
- package/dist/{logs-cli-p5kAh0qi.js → logs-cli-Clchi69N.js} +3 -3
- package/dist/{logs-cli-Dv8TRwyI.js → logs-cli-DVtjPLN7.js} +9 -9
- package/dist/{manager-B74jUC6O.js → manager-ZjJ9M2x6.js} +14 -14
- package/dist/{manifest-registry-D1Y5hoq2.js → manifest-registry-InPIGvqe.js} +1 -1
- package/dist/{markdown-tables-BDe192Ai.js → markdown-tables-DoeNp6Yw.js} +1 -1
- package/dist/{memory-cli-BMul3CV1.js → memory-cli-C0hNuh-t.js} +12 -12
- package/dist/{model-BUgU1YvD.js → model-Cun06SAF.js} +2 -2
- package/dist/{model-catalog-D4hoiCav.js → model-catalog-BoIN1v0Q.js} +3 -3
- package/dist/{model-picker-C52jOYls.js → model-picker-HEDcBXIB.js} +4 -4
- package/dist/{models-Cdge-yuv.js → models-Xv17f3vZ.js} +18 -18
- package/dist/{models-cli-B3Xw4zlc.js → models-cli-BXyi6SWU.js} +81 -81
- package/dist/{models-cli-BfSKbP6r.js → models-cli-DUzbk_7x.js} +9 -9
- package/dist/{models-config-BUq1pLs3.js → models-config-BjTFyv9Z.js} +6 -6
- package/dist/{net-B1yWST2Q.js → net-Dsab06Rf.js} +2 -2
- package/dist/{node-cli-BabqC8Zy.js → node-cli-B15fr-qS.js} +33 -33
- package/dist/{node-cli-Do62XUPs.js → node-cli-Bw3p8-Sf.js} +1 -1
- package/dist/{node-command-policy-CcKer6vK.js → node-command-policy-B6a4rlIk.js} +1 -1
- package/dist/{node-command-policy-Dk_UuHKt.js → node-command-policy-CtLbfZ7S.js} +1 -1
- package/dist/{node-service-BNRDY7GU.js → node-service-Dc_k2bXh.js} +1 -1
- package/dist/{nodes-cli-pFODdHtG.js → nodes-cli-Cd4bT0G_.js} +3 -3
- package/dist/{nodes-cli-Dpzu3xiW.js → nodes-cli-DxNXbAjA.js} +16 -16
- package/dist/{nodes-screen-9RT6NG41.js → nodes-screen-BfHQppAv.js} +7 -7
- package/dist/{npm-pack-install-dRUKCY1x.js → npm-pack-install-BAwUbntz.js} +18 -18
- package/dist/{npm-resolution-CIbDK6N6.js → npm-resolution-B-kbVjrb.js} +1 -1
- package/dist/{npm-resolution-CEMLdRCK.js → npm-resolution-BAviHHRA.js} +5 -5
- package/dist/{onboard-D7KozrLf.js → onboard-Cu0G7EAR.js} +3 -3
- package/dist/{onboard-CMEmzKLW.js → onboard-RamoqBQh.js} +6 -6
- package/dist/{onboard-channels-BfnzcJrR.js → onboard-channels-DHx-uZCo.js} +2 -2
- package/dist/{onboard-channels-Bw9YbUzP.js → onboard-channels-xMJXbWfp.js} +20 -20
- package/dist/{onboard-custom-CtmSA7Ih.js → onboard-custom-Bdm0AEOf.js} +3 -3
- package/dist/{onboard-custom.shared-DGA1AopE.js → onboard-custom.shared-BJ1NdBPQ.js} +2 -2
- package/dist/{onboard-helpers-DLQ_XMs1.js → onboard-helpers-BS_bPZKe.js} +11 -11
- package/dist/{onboard-helpers-Oi4C_OMX.js → onboard-helpers-DEzzN6tA.js} +1 -1
- package/dist/{onboard-hooks-kJZEQTda.js → onboard-hooks-BKIWvalG.js} +4 -4
- package/dist/{onboard-remote-XXaOoJYC.js → onboard-remote-C_jBXm-z.js} +1 -1
- package/dist/{onboard-remote-C1-vrrIn.js → onboard-remote-St2_FGbe.js} +3 -3
- package/dist/{onboard-skills-C8Mue7Px.js → onboard-skills-D7ZRTLs3.js} +1 -1
- package/dist/{onboard-skills-BxC5udud.js → onboard-skills-m9oH0mp4.js} +4 -4
- package/dist/{onboarding-BLcdYzEJ.js → onboarding-I5wAbpKA.js} +13 -13
- package/dist/{onboarding-C1mU33hA.js → onboarding-VPTSOvzr.js} +7 -7
- package/dist/{onboarding.finalize-2exVy-pf.js → onboarding.finalize-DfoOvZxa.js} +13 -13
- package/dist/{onboarding.finalize-BP0DKBAn.js → onboarding.finalize-Dvd8Uqat.js} +89 -89
- package/dist/{onboarding.gateway-config-CsSayEFl.js → onboarding.gateway-config-BZkfmBr7.js} +18 -18
- package/dist/{onboarding.gateway-config-DImrb8_4.js → onboarding.gateway-config-DYozawla.js} +4 -4
- package/dist/{openai-model-default-DYxdi5ZX.js → openai-model-default-Dbn33YX3.js} +2 -2
- package/dist/{outbound-DhEQ9Uxy.js → outbound-SGcz-hQs.js} +4 -4
- package/dist/{outbound-attachment-Dhx3-Gcn.js → outbound-attachment-BLl9Vid0.js} +2 -2
- package/dist/{pairing-cli-CvCRXsUM.js → pairing-cli-6-9woWGC.js} +9 -9
- package/dist/{pairing-labels-BUGAt7vg.js → pairing-labels-RbKVJQq5.js} +1 -1
- package/dist/{pairing-store-B27cuhBQ.js → pairing-store-BBxShFYa.js} +3 -3
- package/dist/{path-alias-guards-BQRm9WIp.js → path-alias-guards-DCVgvjo3.js} +3 -3
- package/dist/{path-safety-DDHmx5YW.js → path-safety-DmE3pKqe.js} +1 -1
- package/dist/{paths-B0fezTQW.js → paths-ufuDrRZO.js} +9 -9
- package/dist/{pi-embedded-Dr2npoTx.js → pi-embedded-CLpkFzke.js} +58 -17
- package/dist/{pi-embedded-DzJti3AT.js → pi-embedded-JvXxFqT7.js} +58 -17
- package/dist/{pi-embedded-helpers-J2caGJww.js → pi-embedded-helpers-CKEoEHoe.js} +13 -1
- package/dist/{pi-embedded-helpers-DeshJQRZ.js → pi-embedded-helpers-CYvB-mUe.js} +13 -1
- package/dist/{pi-embedded-helpers-BvHlsuFU.js → pi-embedded-helpers-DQudcPte.js} +13 -1
- package/dist/{pi-embedded-helpers-C6qtvkzL.js → pi-embedded-helpers-YXFiUfat.js} +19 -7
- package/dist/{pi-model-discovery-P149vq2k.js → pi-model-discovery-BnW942uP.js} +1 -1
- package/dist/{pi-tools.policy-DwPGGCBG.js → pi-tools.policy-ClPMGEq4.js} +5 -5
- package/dist/{plugin-auto-enable-C4EhTu_y.js → plugin-auto-enable-MtcFdE6T.js} +3 -3
- package/dist/{plugin-registry-htTOE5ts.js → plugin-registry-BlrQgW0D.js} +3 -3
- package/dist/{plugin-registry-C6E8urZI.js → plugin-registry-gZUfqcq8.js} +1 -1
- package/dist/plugin-sdk/{accounts-CK8a9UID.js → accounts-B0MGFQ0N.js} +1 -1
- package/dist/plugin-sdk/{accounts-lwmUYGUE.js → accounts-C6gCLKxD.js} +3 -3
- package/dist/plugin-sdk/{accounts-CS3X-w75.js → accounts-CtdUkArQ.js} +1 -1
- package/dist/plugin-sdk/{active-listener-BWmkk9uJ.js → active-listener-B4jWKHgp.js} +1 -1
- package/dist/plugin-sdk/{agent-scope-hbikmG29.js → agent-scope-C86F9PtR.js} +3 -3
- package/dist/plugin-sdk/agents/pi-embedded-helpers/errors.d.ts +6 -0
- package/dist/plugin-sdk/agents/pi-embedded-helpers.d.ts +1 -1
- package/dist/plugin-sdk/agents/pi-embedded-subscribe.handlers.messages.d.ts +8 -0
- package/dist/plugin-sdk/{api-key-rotation-CRkGVkaE.js → api-key-rotation-Ckeuk7ma.js} +2 -2
- package/dist/plugin-sdk/{audio-preflight-CnShZx3d.js → audio-preflight-bn_-lI6T.js} +33 -33
- package/dist/plugin-sdk/{audio-transcription-runner-02Kf0QEw.js → audio-transcription-runner-B7Y82C4Z.js} +10 -10
- package/dist/plugin-sdk/{bindings-nNuMY2YM.js → bindings-ChmACL7A.js} +2 -2
- package/dist/plugin-sdk/{channel-activity-Bqbt4eXH.js → channel-activity-BmpQZg2e.js} +3 -3
- package/dist/plugin-sdk/{channel-web-g5RnVnVc.js → channel-web-DWi8zvvE.js} +23 -23
- package/dist/plugin-sdk/{chrome-2cewsnu1.js → chrome-DuBOBfOM.js} +7 -7
- package/dist/plugin-sdk/{chunk-BYCmTLPZ.js → chunk-C0X4iaGn.js} +1 -1
- package/dist/plugin-sdk/{command-format-BlehDg53.js → command-format-CElfSn4A.js} +1 -1
- package/dist/plugin-sdk/{commands-registry-BOYYhfZ3.js → commands-registry-B1R1u0Ef.js} +5 -5
- package/dist/plugin-sdk/{config-QlwvRinO.js → config-BIceFM4q.js} +10 -10
- package/dist/plugin-sdk/{deliver-TLuU1nrG.js → deliver-B8tQybg3.js} +11 -11
- package/dist/plugin-sdk/{diagnostic-Qi8YtEBS.js → diagnostic-BbwhaVH5.js} +2 -2
- package/dist/plugin-sdk/{dock-kzzjqc23.js → dock-ofKZIPvX.js} +6 -6
- package/dist/plugin-sdk/{errors-DVIIAWgf.js → errors-D1n_xg5Q.js} +1 -1
- package/dist/plugin-sdk/{fetch-guard-DBpNRDsE.js → fetch-guard-JfIUTAXW.js} +2 -2
- package/dist/plugin-sdk/{fs-safe-m9IoJqSI.js → fs-safe-C32W4lb9.js} +3 -3
- package/dist/plugin-sdk/gateway/protocol/schema/logs-chat.d.ts +1 -0
- package/dist/plugin-sdk/gateway/protocol/schema/protocol-schemas.d.ts +1 -0
- package/dist/plugin-sdk/{image-DthA-2Bt.js → image-C6HhIJq-.js} +6 -6
- package/dist/plugin-sdk/{image-ops-DZf5e0hi.js → image-ops-DgyVTXxr.js} +1 -1
- package/dist/plugin-sdk/index.js +64 -64
- package/dist/plugin-sdk/{ir-DqRMrArF.js → ir-CUJX2XmF.js} +6 -6
- package/dist/plugin-sdk/{local-roots-D45XofHa.js → local-roots-PQBdjF5V.js} +4 -4
- package/dist/plugin-sdk/{logger-DfvFauG1.js → logger-BnDVA5Pn.js} +1 -1
- package/dist/plugin-sdk/{login-jCR1wiz5.js → login-fF45LyM7.js} +6 -6
- package/dist/plugin-sdk/{login-qr-yj8Ns7nC.js → login-qr-IMrHS0CU.js} +9 -9
- package/dist/plugin-sdk/{manager-Cm_A6m9L.js → manager-B0SAEWzU.js} +10 -10
- package/dist/plugin-sdk/{markdown-tables-CBEW0AEz.js → markdown-tables-BTRy5g54.js} +1 -1
- package/dist/plugin-sdk/{message-channel-CettmQxR.js → message-channel-BBGSgNfZ.js} +1 -1
- package/dist/plugin-sdk/{outbound-Bciu0j21.js → outbound-CsQhMb1t.js} +7 -7
- package/dist/plugin-sdk/{outbound-attachment-JlTOABiQ.js → outbound-attachment-PV4MNgO7.js} +2 -2
- package/dist/plugin-sdk/{path-alias-guards-DJzjOH6k.js → path-alias-guards-CtvHdXkF.js} +1 -1
- package/dist/plugin-sdk/{pi-embedded-helpers-5SLsxaPD.js → pi-embedded-helpers-BHnEYKw0.js} +30 -18
- package/dist/plugin-sdk/{pi-model-discovery-D69omnZ4.js → pi-model-discovery-CeMr9qlX.js} +1 -1
- package/dist/plugin-sdk/{plugins-PXEjTi0a.js → plugins-DoosFTlv.js} +6 -6
- package/dist/plugin-sdk/{proxy-BJHqiC33.js → proxy-BC7TfAei.js} +1 -1
- package/dist/plugin-sdk/{proxy-fetch-nIK8JZcG.js → proxy-fetch-D7xNZwMz.js} +1 -1
- package/dist/plugin-sdk/{pw-ai-BYRY2b8b.js → pw-ai-COCVSS3S.js} +13 -13
- package/dist/plugin-sdk/{qmd-manager-BDZK_TQ2.js → qmd-manager-Dy2i7Yk2.js} +8 -8
- package/dist/plugin-sdk/{query-expansion-BbG3wPsu.js → query-expansion-Ce600EN-.js} +2 -2
- package/dist/plugin-sdk/{redact-CJpp3pJZ.js → redact-DR57Khnb.js} +1 -1
- package/dist/plugin-sdk/{registry-DZtlIW2B.js → registry-CoOCMLwt.js} +2 -2
- package/dist/plugin-sdk/{replies-EKccD3Vq.js → replies-DrAmBEev.js} +3 -3
- package/dist/plugin-sdk/{reply-Bn7G66m2.js → reply-UD3RANYz.js} +139 -98
- package/dist/plugin-sdk/{reply-prefix-DSjz9ex2.js → reply-prefix-S61xcDq5.js} +1 -1
- package/dist/plugin-sdk/{resolve-outbound-target-BWnhQoZm.js → resolve-outbound-target-CHbuy5MW.js} +2 -2
- package/dist/plugin-sdk/{resolve-route-f4hKLSdv.js → resolve-route-D17tpQod.js} +4 -4
- package/dist/plugin-sdk/{retry-WkwmuOq5.js → retry-BCP_IcXF.js} +1 -1
- package/dist/plugin-sdk/{send-By6LXMdT.js → send-4oPoqu-k.js} +8 -8
- package/dist/plugin-sdk/{send-D6q7DSEd.js → send-B-OjHj4t.js} +7 -7
- package/dist/plugin-sdk/{send-wah5ag3x.js → send-BnUKf8wg.js} +10 -10
- package/dist/plugin-sdk/{send-CLmu_bs1.js → send-DXz49rIh.js} +6 -6
- package/dist/plugin-sdk/{send-DVH_jqoJ.js → send-DfA6vCVP.js} +15 -15
- package/dist/plugin-sdk/{session-BfaJDj55.js → session-B_TxDBeW.js} +5 -5
- package/dist/plugin-sdk/{session-meta-CtcszwHp.js → session-meta-Cs9Hy3rA.js} +1 -1
- package/dist/plugin-sdk/{sessions-CCrnhL0f.js → sessions-D0O4NXJE.js} +6 -6
- package/dist/plugin-sdk/{skill-commands-BbZ5VC2j.js → skill-commands-Cq3lRmFA.js} +5 -5
- package/dist/plugin-sdk/{skills-DhjFSX9k.js → skills-CKk6dkB7.js} +8 -8
- package/dist/plugin-sdk/{ssrf-yJVFBwP_.js → ssrf-DWKS2l1Z.js} +1 -1
- package/dist/plugin-sdk/{store-B49PVNHw.js → store-D-KJbO1K.js} +2 -2
- package/dist/plugin-sdk/{subsystem-BSS_Lti_.js → subsystem-BOTkxxI1.js} +2 -2
- package/dist/plugin-sdk/{tables-B2ndgibI.js → tables-iAM0v6UL.js} +1 -1
- package/dist/plugin-sdk/{target-errors-3PJA_VbO.js → target-errors-Di5oh5b0.js} +2 -2
- package/dist/plugin-sdk/{tokens-CYf5ZhLm.js → tokens-DUELMaP-.js} +1 -1
- package/dist/plugin-sdk/{tool-images-DzNHghBZ.js → tool-images-4TDsVJHN.js} +2 -2
- package/dist/plugin-sdk/{tool-loop-detection-paUegJmP.js → tool-loop-detection-BooG-g5v.js} +2 -2
- package/dist/plugin-sdk/{utils-DaD2HGTy.js → utils-B7zMI7Td.js} +1 -1
- package/dist/plugin-sdk/web-UMF3rhRY.js +72 -0
- package/dist/plugin-sdk/{whatsapp-actions-fOVsMKWU.js → whatsapp-actions-CntfyIDF.js} +25 -25
- package/dist/{plugins-DPspmGax.js → plugins-B9LVNfXo.js} +2 -2
- package/dist/{plugins-cli-Bh8rE7t6.js → plugins-cli-BT_YdHlo.js} +9 -9
- package/dist/{plugins-cli-NTdICagm.js → plugins-cli-Dowiu6KT.js} +86 -86
- package/dist/{ports-Do_Plo8C.js → ports-BKC_uvax.js} +2 -2
- package/dist/{ports-BNwHSlzK.js → ports-TfIbPY8z.js} +1 -1
- package/dist/{program-BzrloeUd.js → program-BA-5175y.js} +84 -84
- package/dist/{program-context-Dj2_qoie.js → program-context-DFXBN0ZY.js} +31 -31
- package/dist/{prompt-select-styled-CRUyZ8Zn.js → prompt-select-styled-BcZ8H5DI.js} +39 -39
- package/dist/{prompt-select-styled-CRpJTxEn.js → prompt-select-styled-D6W6ZbLn.js} +6 -6
- package/dist/{provider-auth-helpers-CTHHzB9d.js → provider-auth-helpers-BEYTbEO-.js} +1 -1
- package/dist/{provider-auth-helpers-CGlrXlEv.js → provider-auth-helpers-Bu2aZSnq.js} +5 -5
- package/dist/{proxy-env-B9lqcBfU.js → proxy-env-DQluNeAy.js} +1 -1
- package/dist/{push-apns-CfIOYv6I.js → push-apns-8_4x3QDX.js} +5 -5
- package/dist/{push-apns-D6P4wyMo.js → push-apns-Cr1-03ZS.js} +1 -1
- package/dist/{pw-ai-B4CY-RXZ.js → pw-ai-CgRxvnyo.js} +15 -15
- package/dist/{qmd-manager-CoaYK3NS.js → qmd-manager-ZEPpjdm5.js} +20 -20
- package/dist/{qr-cli-tns16Dij.js → qr-cli-UOH4AqoB.js} +1 -1
- package/dist/{query-expansion-BOhTMSRT.js → query-expansion-DmsmrMjB.js} +12 -12
- package/dist/{redact-snapshot-Cx6qYiIY.js → redact-snapshot-BGusjTY9.js} +1 -1
- package/dist/{register.agent-CbbtPCTG.js → register.agent-CHE7Qalv.js} +97 -97
- package/dist/{register.agent-tUHan7i6.js → register.agent-FsyQ2Nm4.js} +13 -13
- package/dist/register.configure-CXDvAw-s.js +175 -0
- package/dist/{register.configure-H6uG1A19.js → register.configure-DS8ihv8X.js} +16 -16
- package/dist/{register.init-B2cwbe39.js → register.init-DY3iSz8Y.js} +16 -16
- package/dist/{register.maintenance-B4zbpuqh.js → register.maintenance-Dnr1w5A1.js} +15 -15
- package/dist/{register.maintenance-C4vUOdVb.js → register.maintenance-yrpKG5iB.js} +99 -99
- package/dist/{register.message-BNLwGPS-.js → register.message-DH4rUSVi.js} +77 -77
- package/dist/{register.message-BmweIh8D.js → register.message-p-nIqAYY.js} +9 -9
- package/dist/{register.onboard-B_CVsLWL.js → register.onboard-CC50fpnA.js} +5 -5
- package/dist/{register.onboard-DElUgwoa.js → register.onboard-maBvm3Rf.js} +18 -18
- package/dist/{register.setup-BF5BjQQE.js → register.setup-CwMkpOf-.js} +5 -5
- package/dist/{register.setup-DWIO5nY-.js → register.setup-igARJvnk.js} +21 -21
- package/dist/{register.start-BKHJP2Is.js → register.start-K1LpFGp0.js} +4 -4
- package/dist/{register.start-csWISzdo.js → register.start-nNZtIOVx.js} +17 -17
- package/dist/{register.status-health-sessions-CGnHeuq9.js → register.status-health-sessions-C3RoepIh.js} +12 -12
- package/dist/{register.status-health-sessions-DVQycJyO.js → register.status-health-sessions-TaLuKSkg.js} +91 -91
- package/dist/{register.subclis-CXCp9MIN.js → register.subclis-DscBnK86.js} +31 -31
- package/dist/{replies-9B0e_W0H.js → replies-Cnwwqegi.js} +1 -1
- package/dist/{reply-Cmqwu6vZ.js → reply-Cm66z0-z.js} +61 -21
- package/dist/{reply-prefix-CqTNlEbX.js → reply-prefix-BwXX5Jk8.js} +1 -1
- package/dist/{resolve-route-rhGDrrKc.js → resolve-route-BAFZr0AD.js} +2 -2
- package/dist/{rpc-Ca9dlA9v.js → rpc-CeTMYkun.js} +1 -1
- package/dist/{rpc-CI7SPdeS.js → rpc-rTqBtgDp.js} +1 -1
- package/dist/{run-main-LIh93d7b.js → run-main-w6C2SiYG.js} +95 -95
- package/dist/{runtime-vnX4kz3-.js → runtime-uZw9qW6d.js} +2 -2
- package/dist/{sandbox-ClasEjRW.js → sandbox-GZ80o0rN.js} +18 -18
- package/dist/{sandbox-cli-BxLxr8Ov.js → sandbox-cli-BdzWh2X7.js} +26 -26
- package/dist/{secrets-cli-DEGkMLrT.js → secrets-cli-DroWvA-9.js} +10 -10
- package/dist/{secrets-cli-DVRKrzox.js → secrets-cli-i2YWj3kH.js} +3 -3
- package/dist/{security-cli-D4O7OC12.js → security-cli-B-t3jhRM.js} +4 -4
- package/dist/{security-cli-608Hrkk0.js → security-cli-VJf80mpc.js} +43 -43
- package/dist/{send-BUqXYyi5.js → send-B3N6ed5I.js} +11 -11
- package/dist/{send-BLyXZjPe.js → send-CUhKEB1L.js} +8 -8
- package/dist/{send-DLfPZ3_F.js → send-D52tAxa7.js} +6 -6
- package/dist/{send-CwHSY0pB.js → send-DyQvZx-9.js} +6 -6
- package/dist/{send-BLv3U-2N.js → send-ofq5TYCm.js} +5 -5
- package/dist/{server-context-3YhieMNo.js → server-context-BIKTw3k8.js} +12 -12
- package/dist/{server-lifecycle-DE7bHlKs.js → server-lifecycle-N5bU8mjm.js} +2 -2
- package/dist/{server-middleware-hZnQvs4T.js → server-middleware-Q0-cjKBA.js} +1 -1
- package/dist/{server-node-events-DhzgyreJ.js → server-node-events-DIZCYbQS.js} +9 -9
- package/dist/{server-node-events-SLHkUEcI.js → server-node-events-DgNEG1Jq.js} +77 -77
- package/dist/{server-BAuP980-.js → server-si15CkOB.js} +19 -19
- package/dist/{service-DdLDWk4F.js → service-Bdwg8-MP.js} +15 -15
- package/dist/{session-D8FUKdiW.js → session-Cjlyc-CV.js} +1 -1
- package/dist/{session-meta-Cyjw6vgH.js → session-meta-Dofh28uR.js} +1 -1
- package/dist/{session-utils-BSsFceEN.js → session-utils-dcEiC-U5.js} +6 -6
- package/dist/{sessions-DugDYFTs.js → sessions-BUvaIZVg.js} +15 -15
- package/dist/{sessions-D0PiwO3b.js → sessions-DupNmVK4.js} +4 -4
- package/dist/{shared-fKlvovu7.js → shared-CDevUk3t.js} +1 -1
- package/dist/{shared-D96SvIQZ.js → shared-haEHGkpf.js} +3 -3
- package/dist/{skill-commands-KfP9rDJM.js → skill-commands-Do5yZvPn.js} +5 -5
- package/dist/{skill-scanner-D7WuF5Sb.js → skill-scanner-DiC9yuOY.js} +6 -6
- package/dist/{skills-CDZAo2Sd.js → skills-cQZqFYZM.js} +3 -3
- package/dist/{skills-cli-DaSd8Xc2.js → skills-cli-BXNcPNTR.js} +5 -5
- package/dist/{skills-install-Ba_1ws_H.js → skills-install-BASrKfvX.js} +6 -6
- package/dist/{skills-status-CV1r9Fs_.js → skills-status-DLQ7pr9r.js} +1 -1
- package/dist/{status-06d3zhTb.js → status-DeOsbp6k.js} +5 -5
- package/dist/{status-B8I9eCIt.js → status-EvQ73B8e.js} +26 -26
- package/dist/{status.update-CbAiJIbB.js → status.update-DUDM6iUC.js} +2 -2
- package/dist/{store-GKlw8Qa-.js → store-D1eSPAL7.js} +5 -5
- package/dist/{subagent-registry-CU894Q5r.js → subagent-registry-DxueEkqw.js} +203 -163
- package/dist/{system-cli-CFkPJfOG.js → system-cli-BXGiTYVZ.js} +9 -9
- package/dist/{system-cli-C0Ed85zv.js → system-cli-im47tHnN.js} +3 -3
- package/dist/{system-run-command-Pd55ipfO.js → system-run-command-BkdvGhnZ.js} +1 -1
- package/dist/{systemd-DVgFh5bF.js → systemd-CTamqs8u.js} +9 -9
- package/dist/{systemd-hints-BC7wmmDb.js → systemd-hints-D4VSR4gB.js} +6 -6
- package/dist/{systemd-linger-C0GrW0si.js → systemd-linger-BbxFU05t.js} +1 -1
- package/dist/{tables-B6wgQqYN.js → tables-CTFvIcTQ.js} +1 -1
- package/dist/{tailnet-D67wyPIH.js → tailnet-CQxQNgt6.js} +1 -1
- package/dist/{target-errors-AeE93vdq.js → target-errors-8-urss_s.js} +4 -4
- package/dist/{tool-images-rmLnTSxP.js → tool-images-hL7SizLq.js} +1 -1
- package/dist/{tui-B7dzJD1I.js → tui-DExFltkR.js} +6 -6
- package/dist/{tui-BRtGtxGi.js → tui-DhEGvFT0.js} +3 -3
- package/dist/{tui-cli-CjdbITUY.js → tui-cli-Bjx0DKT6.js} +4 -4
- package/dist/{tui-cli-q5z-00Hw.js → tui-cli-oM2kNbdj.js} +33 -33
- package/dist/{update-BPBo5wB4.js → update-Bifl3Vpi.js} +3 -3
- package/dist/{update-cli-Bq0E6UWE.js → update-cli-By-XQR0X.js} +107 -107
- package/dist/{update-cli-CL5aaHct.js → update-cli-CGZx-QNj.js} +15 -15
- package/dist/{update-runner-CDmAZF8g.js → update-runner-D3Dqz9wz.js} +16 -16
- package/dist/{update-runner-jAwo79K3.js → update-runner-meF3Yj68.js} +1 -1
- package/dist/{web-_WxgxGh7.js → web-C8qeseGa.js} +5 -5
- package/dist/{web-CadeCgho.js → web-CUoANEo6.js} +5 -5
- package/dist/{web-CGIjjBC-.js → web-pvjSSXiL.js} +9 -9
- package/dist/web-yRXxasJ5.js +127 -0
- package/dist/{webhooks-cli-Dov_rqUg.js → webhooks-cli-BsZ0IIku.js} +6 -6
- package/dist/{whatsapp-actions-COrqjCys.js → whatsapp-actions-DZxeDPhI.js} +19 -19
- package/dist/{with-timeout-DUosdGNq.js → with-timeout-CojHmZpl.js} +3 -3
- package/dist/{workspace-CoIrgiMR.js → workspace-BxNxoapu.js} +1 -1
- package/dist/{workspace-D3Bd1Wd-.js → workspace-CZCYGcgM.js} +23 -23
- package/dist/{workspace-dirs-x94RXrLL.js → workspace-dirs-CksYiwHf.js} +1 -1
- package/dist/{wsl-KDz114y6.js → wsl-CiVud8tt.js} +2 -2
- package/docs/install/installer.md +1 -0
- package/docs/plans/2026-03-27-bitseek-topup-modal-design.md +52 -0
- package/package.json +1 -1
- package/dist/control-ui/assets/index-ixU5putu.js.map +0 -1
- package/dist/plugin-sdk/web-BapRq5np.js +0 -72
- package/dist/register.configure-CurF_EBC.js +0 -175
- package/dist/web-B8lEM5aa.js +0 -127
|
@@ -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 o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const
|
|
2
|
-
\f\r]`,_n=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Jr=/'/g,Qr=/"/g,Wl=/^(?:script|style|textarea|title)$/i,ql=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),c=ql(1),Mt=ql(2),wt=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Yr=new WeakMap,Kt=Gt.createTreeWalker(Gt,129);function Gl(e,t){if(!Fo(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return qr!==void 0?qr.createHTML(t):t}const ju=(e,t)=>{const n=e.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",r=_n;for(let l=0;l<n;l++){const a=e[l];let d,g,u=-1,f=0;for(;f<a.length&&(r.lastIndex=f,g=r.exec(a),g!==null);)f=r.lastIndex,r===_n?g[1]==="!--"?r=Gr:g[1]!==void 0?r=Vr:g[2]!==void 0?(Wl.test(g[2])&&(i=RegExp("</"+g[2],"g")),r=Rt):g[3]!==void 0&&(r=Rt):r===Rt?g[0]===">"?(r=i??_n,u=-1):g[1]===void 0?u=-2:(u=r.lastIndex-g[2].length,d=g[1],r=g[3]===void 0?Rt:g[3]==='"'?Qr:Jr):r===Qr||r===Jr?r=Rt:r===Gr||r===Vr?r=_n:(r=Rt,i=void 0);const v=r===Rt&&e[l+1].startsWith("/>")?" ":"";o+=r===_n?a+Hu:u>=0?(s.push(d),a.slice(0,u)+jl+a.slice(u)+ht+v):a+ht+(u===-2?l:v)}return[Gl(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class Vn{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let o=0,r=0;const l=t.length-1,a=this.parts,[d,g]=ju(t,n);if(this.el=Vn.createElement(d,s),Kt.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Kt.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(jl)){const f=g[r++],v=i.getAttribute(u).split(ht),m=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:m[2],strings:v,ctor:m[1]==="."?Wu:m[1]==="?"?qu:m[1]==="@"?Gu:Zs}),i.removeAttribute(u)}else u.startsWith(ht)&&(a.push({type:6,index:o}),i.removeAttribute(u));if(Wl.test(i.tagName)){const u=i.textContent.split(ht),f=u.length-1;if(f>0){i.textContent=Fs?Fs.emptyScript:"";for(let v=0;v<f;v++)i.append(u[v],qn()),Kt.nextNode(),a.push({type:2,index:++o});i.append(u[f],qn())}}}else if(i.nodeType===8)if(i.data===Kl)a.push({type:2,index:o});else{let u=-1;for(;(u=i.data.indexOf(ht,u+1))!==-1;)a.push({type:7,index:o}),u+=ht.length-1}o++}}static createElement(t,n){const s=Gt.createElement("template");return s.innerHTML=t,s}}function yn(e,t,n=e,s){if(t===wt)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const o=Gn(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=yn(e,i._$AS(e,t.values),i,s)),t}class Ku{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);Kt.currentNode=i;let o=Kt.nextNode(),r=0,l=0,a=s[0];for(;a!==void 0;){if(r===a.index){let d;a.type===2?d=new Xs(o,o.nextSibling,this,t):a.type===1?d=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(d=new Vu(o,this,t)),this._$AV.push(d),a=s[++l]}r!==a?.index&&(o=Kt.nextNode(),r++)}return Kt.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 Xs=class Vl{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=h,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=yn(this,t,n),Gn(t)?t===h||t==null||t===""?(this._$AH!==h&&this._$AR(),this._$AH=h):t!==this._$AH&&t!==wt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):zu(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!==h&&Gn(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=Vn.createElement(Gl(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const o=new Ku(i,this),r=o.u(this.options);o.p(n),this.T(r),this._$AH=o}}_$AC(t){let n=Yr.get(t.strings);return n===void 0&&Yr.set(t.strings,n=new Vn(t)),n}k(t){Fo(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const o of t)i===n.length?n.push(s=new Vl(this.O(qn()),this.O(qn()),this,this.options)):s=n[i],s._$AI(o),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=Wr(t).nextSibling;Wr(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Zs=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,o){this.type=1,this._$AH=h,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=h}_$AI(t,n=this,s,i){const o=this.strings;let r=!1;if(o===void 0)t=yn(this,t,n,0),r=!Gn(t)||t!==this._$AH&&t!==wt,r&&(this._$AH=t);else{const l=t;let a,d;for(t=o[0],a=0;a<o.length-1;a++)d=yn(this,l[s+a],n,a),d===wt&&(d=this._$AH[a]),r||=!Gn(d)||d!==this._$AH[a],d===h?t=h:t!==h&&(t+=(d??"")+o[a+1]),this._$AH[a]=d}r&&!i&&this.j(t)}j(t){t===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Wu=class extends Zs{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===h?void 0:t}},qu=class extends Zs{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==h)}},Gu=class extends Zs{constructor(t,n,s,i,o){super(t,n,s,i,o),this.type=5}_$AI(t,n=this){if((t=yn(this,t,n,0)??h)===wt)return;const s=this._$AH,i=t===h&&s!==h||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==h&&(s===h||i);i&&this.element.removeEventListener(this.name,this,s),o&&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)}},Vu=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){yn(this,t)}};const Ju={I:Xs},Qu=Po.litHtmlPolyfillSupport;Qu?.(Vn,Xs),(Po.litHtmlVersions??=[]).push("3.3.2");const Yu=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const o=n?.renderBefore??null;s._$litPart$=i=new Xs(t.insertBefore(qn(),o),o,void 0,n??{})}return i._$AI(e),i};const No=globalThis;let mn=class extends cn{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=Yu(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return wt}};mn._$litElement$=!0,mn.finalized=!0,No.litElementHydrateSupport?.({LitElement:mn});const Xu=No.litElementPolyfillSupport;Xu?.({LitElement:mn});(No.litElementVersions??=[]).push("4.2.2");const Jl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const Zu={attribute:!0,type:String,converter:Ps,reflect:!1,hasChanged:Do},eg=(e=Zu,t,n)=>{const{kind:s,metadata:i}=n;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(n.name,e),s==="accessor"){const{name:r}=n;return{set(l){const a=t.get.call(this);t.set.call(this,l),this.requestUpdate(r,a,e,!0,l)},init(l){return l!==void 0&&this.C(r,void 0,e,l),l}}}if(s==="setter"){const{name:r}=n;return function(l){const a=this[r];t.call(this,l),this.requestUpdate(r,a,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function ei(e){return(t,n)=>typeof n=="object"?eg(e,t,n):((s,i,o)=>{const r=i.hasOwnProperty(o);return i.constructor.createProperty(o,s),r?Object.getOwnPropertyDescriptor(i,o):void 0})(e,t,n)}function x(e){return ei({...e,state:!0,attribute:!1})}const tg={common:{version:"Version",health:"Health",ok:"OK",offline:"Offline",connect:"Connect",refresh:"Refresh",enabled:"Enabled",disabled:"Disabled",na:"n/a",docs:"Docs",resources:"Resources"},nav:{chat:"Chat",control:"Control",agent:"Agent",settings:"Settings",expand:"Expand sidebar",collapse:"Collapse sidebar"},tabs:{agents:"Agents",overview:"Overview",channels:"Channels",instances:"Instances",sessions:"Sessions",usage:"Usage",cron:"Cron Jobs",skills:"Skills",market:"Skills Market",nodes:"Nodes",chat:"Chat",models:"Models",config:"Config",debug:"Debug",logs:"Logs"},subtitles:{agents:"Manage agent workspaces, tools, and identities.",overview:"Gateway status, entry points, and a fast health read.",channels:"Manage channels and settings.",instances:"Presence beacons from connected clients and nodes.",sessions:"Inspect active sessions and adjust per-session defaults.",usage:"Monitor API usage and costs.",cron:"Schedule wakeups and recurring agent runs.",skills:"Manage skill availability and API key injection.",market:"Install and enable Web3 skills from BitSeek.",nodes:"Paired devices, capabilities, and command exposure.",chat:"Direct gateway chat session for quick interventions.",models:"Manage the default model and OpenAI-compatible providers.",config:"Edit ~/.openclaw/openclaw.json safely.",debug:"Gateway snapshots, events, and manual RPC calls.",logs:"Live tail of the gateway file logs."},overview:{access:{title:"Gateway Access",subtitle:"Where the dashboard connects and how it authenticates.",wsUrl:"WebSocket URL",token:"Gateway Token",password:"Password (not stored)",sessionKey:"Default Session Key",language:"Language",connectHint:"Click Connect to apply connection changes.",trustedProxy:"Authenticated via trusted proxy."},snapshot:{title:"Snapshot",subtitle:"Latest gateway handshake information.",status:"Status",uptime:"Uptime",tickInterval:"Tick Interval",lastChannelsRefresh:"Last Channels Refresh",channelsHint:"Use Channels to link WhatsApp, Telegram, Discord, Signal, or iMessage."},stats:{instances:"Instances",instancesHint:"Presence beacons in the last 5 minutes.",sessions:"Sessions",sessionsHint:"Recent session keys tracked by the gateway.",cron:"Cron",cronNext:"Next wake {time}"},notes:{title:"Notes",subtitle:"Quick reminders for remote control setups.",tailscaleTitle:"Tailscale serve",tailscaleText:"Prefer serve mode to keep the gateway on loopback with tailnet auth.",sessionTitle:"Session hygiene",sessionText:"Use /new or sessions.patch to reset context.",cronTitle:"Cron reminders",cronText:"Use isolated sessions for recurring runs."},auth:{required:"This gateway requires auth. Add a token or password, then click Connect.",failed:"Auth failed. Re-copy a tokenized URL with {command}, or update the token, then click Connect."},pairing:{hint:"This device needs pairing approval from the gateway host.",mobileHint:"On mobile? Copy the full URL (including #token=...) from openclaw dashboard --no-open on your desktop."},insecure:{hint:"This page is HTTP, so the browser blocks device identity. Use HTTPS (Tailscale Serve) or open {url} on the gateway host.",stayHttp:"If you must stay on HTTP, set {config} (token-only)."}},chat:{disconnected:"Disconnected from gateway.",refreshTitle:"Refresh chat data",thinkingToggle:"Toggle assistant thinking/working output",focusToggle:"Toggle focus mode (hide sidebar + page header)",hideCronSessions:"Hide cron sessions",showCronSessions:"Show cron sessions",showCronSessionsHidden:"Show cron sessions ({count} hidden)",onboardingDisabled:"Disabled during onboarding"},languages:{en:"English",zhCN:"简体中文 (Simplified Chinese)",zhTW:"繁體中文 (Traditional Chinese)",ptBR:"Português (Brazilian Portuguese)",de:"Deutsch (German)"},cron:{summary:{enabled:"Enabled",yes:"Yes",no:"No",jobs:"Jobs",nextWake:"Next wake",refreshing:"Refreshing...",refresh:"Refresh"},jobs:{title:"Jobs",subtitle:"All scheduled jobs stored in the gateway.",shownOf:"{shown} shown of {total}",searchJobs:"Search jobs",searchPlaceholder:"Name, description, or agent",enabled:"Enabled",schedule:"Schedule",lastRun:"Last run",all:"All",sort:"Sort",nextRun:"Next run",recentlyUpdated:"Recently updated",name:"Name",direction:"Direction",ascending:"Ascending",descending:"Descending",reset:"Reset",noMatching:"No matching jobs.",loading:"Loading...",loadMore:"Load more jobs"},runs:{title:"Run history",subtitleAll:"Latest runs across all jobs.",subtitleJob:"Latest runs for {title}.",scope:"Scope",allJobs:"All jobs",selectedJob:"Selected job",searchRuns:"Search runs",searchPlaceholder:"Summary, error, or job",newestFirst:"Newest first",oldestFirst:"Oldest first",status:"Status",delivery:"Delivery",clear:"Clear",allStatuses:"All statuses",allDelivery:"All delivery",selectJobHint:"Select a job to inspect run history.",noMatching:"No matching runs.",loadMore:"Load more runs",runStatusOk:"OK",runStatusError:"Error",runStatusSkipped:"Skipped",runStatusUnknown:"Unknown",deliveryDelivered:"Delivered",deliveryNotDelivered:"Not delivered",deliveryUnknown:"Unknown",deliveryNotRequested:"Not requested"},form:{editJob:"Edit Job",newJob:"New Job",updateSubtitle:"Update the selected scheduled job.",createSubtitle:"Create a scheduled wakeup or agent run.",required:"Required",requiredSr:"required",basics:"Basics",basicsSub:"Name it, choose the assistant, and set enabled state.",fieldName:"Name",description:"Description",agentId:"Agent ID",namePlaceholder:"Morning brief",descriptionPlaceholder:"Optional context for this job",agentPlaceholder:"main or ops",agentHelp:"Start typing to pick a known agent, or enter a custom one.",schedule:"Schedule",scheduleSub:"Control when this job runs.",every:"Every",at:"At",cronOption:"Cron",runAt:"Run at",unit:"Unit",minutes:"Minutes",hours:"Hours",days:"Days",expression:"Expression",expressionPlaceholder:"0 7 * * *",everyAmountPlaceholder:"30",timezoneOptional:"Timezone (optional)",timezonePlaceholder:"America/Los_Angeles",timezoneHelp:"Pick a common timezone or enter any valid IANA timezone.",jitterHelp:"Need jitter? Use Advanced → Stagger window / Stagger unit.",execution:"Execution",executionSub:"Choose when to wake, and what this job should do.",session:"Session",main:"Main",isolated:"Isolated",sessionHelp:"Main posts a system event. Isolated runs a dedicated agent turn.",wakeMode:"Wake mode",now:"Now",nextHeartbeat:"Next heartbeat",wakeModeHelp:"Now triggers immediately. Next heartbeat waits for the next cycle.",payloadKind:"What should run?",systemEvent:"Post message to main timeline",agentTurn:"Run assistant task (isolated)",systemEventHelp:"Sends your text to the gateway main timeline (good for reminders/triggers).",agentTurnHelp:"Starts an assistant run in its own session using your prompt.",timeoutSeconds:"Timeout (seconds)",timeoutPlaceholder:"Optional, e.g. 90",timeoutHelp:"Optional. Leave blank to use the gateway default timeout behavior for this run.",mainTimelineMessage:"Main timeline message",assistantTaskPrompt:"Assistant task prompt",deliverySection:"Delivery",deliverySub:"Choose where run summaries are sent.",resultDelivery:"Result delivery",announceDefault:"Announce summary (default)",webhookPost:"Webhook POST",noneInternal:"None (internal)",deliveryHelp:"Announce posts a summary to chat. None keeps execution internal.",webhookUrl:"Webhook URL",channel:"Channel",webhookPlaceholder:"https://example.com/cron",channelHelp:"Choose which connected channel receives the summary.",webhookHelp:"Send run summaries to a webhook endpoint.",to:"To",toPlaceholder:"+1555... or chat id",toHelp:"Optional recipient override (chat id, phone, or user id).",advanced:"Advanced",advancedHelp:"Optional overrides for delivery guarantees, schedule jitter, and model controls.",deleteAfterRun:"Delete after run",deleteAfterRunHelp:"Best for one-shot reminders that should auto-clean up.",clearAgentOverride:"Clear agent override",clearAgentHelp:"Force this job to use the gateway default assistant.",exactTiming:"Exact timing (no stagger)",exactTimingHelp:"Run on exact cron boundaries with no spread.",staggerWindow:"Stagger window",staggerUnit:"Stagger unit",staggerPlaceholder:"30",seconds:"Seconds",model:"Model",modelPlaceholder:"openai/gpt-5.2",modelHelp:"Start typing to pick a known model, or enter a custom one.",thinking:"Thinking",thinkingPlaceholder:"low",thinkingHelp:"Use a suggested level or enter a provider-specific value.",bestEffortDelivery:"Best effort delivery",bestEffortHelp:"Do not fail the job if delivery itself fails.",cantAddYet:"Can't add job yet",fillRequired:"Fill the required fields below to enable submit.",fixFields:"Fix {count} field to continue.",fixFieldsPlural:"Fix {count} fields to continue.",saving:"Saving...",saveChanges:"Save changes",addJob:"Add job",cancel:"Cancel"},jobList:{allJobs:"all jobs",selectJob:"(select a job)",enabled:"enabled",disabled:"disabled",edit:"Edit",clone:"Clone",disable:"Disable",enable:"Enable",run:"Run",history:"History",remove:"Remove"},jobDetail:{system:"System",prompt:"Prompt",delivery:"Delivery",agent:"Agent"},jobState:{status:"Status",next:"Next",last:"Last"},runEntry:{noSummary:"No summary.",runAt:"Run at",openRunChat:"Open run chat",next:"Next {rel}",due:"Due {rel}"},errors:{nameRequired:"Name is required.",scheduleAtInvalid:"Enter a valid date/time.",everyAmountInvalid:"Interval must be greater than 0.",cronExprRequired:"Cron expression is required.",staggerAmountInvalid:"Stagger must be greater than 0.",systemTextRequired:"System text is required.",agentMessageRequired:"Agent message is required.",timeoutInvalid:"If set, timeout must be greater than 0 seconds.",webhookUrlRequired:"Webhook URL is required.",webhookUrlInvalid:"Webhook URL must start with http:// or https://.",invalidRunTime:"Invalid run time.",invalidIntervalAmount:"Invalid interval amount.",cronExprRequiredShort:"Cron expression required.",invalidStaggerAmount:"Invalid stagger amount.",systemEventTextRequired:"System event text required.",agentMessageRequiredShort:"Agent message required.",nameRequiredShort:"Name required."}}},ng="modulepreload",sg=function(e,t){return new URL(e,t).href},Xr={},fs=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let d=function(g){return Promise.all(g.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const r=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),a=l?.nonce||l?.getAttribute("nonce");i=d(n.map(g=>{if(g=sg(g,s),g in Xr)return;Xr[g]=!0;const u=g.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(s)for(let m=r.length-1;m>=0;m--){const S=r[m];if(S.href===g&&(!u||S.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${g}"]${f}`))return;const v=document.createElement("link");if(v.rel=u?"stylesheet":ng,u||(v.as="script"),v.crossOrigin="",v.href=g,a&&v.setAttribute("nonce",a),document.head.appendChild(v),u)return new Promise((m,S)=>{v.addEventListener("load",m),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function o(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return i.then(r=>{for(const l of r||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},Nt="en",Ql=["zh-CN","zh-TW","pt-BR","de"],ig={"zh-CN":{exportName:"zh_CN",loader:()=>fs(()=>import("./zh-CN-DpcDfKwj.js"),[],import.meta.url)},"zh-TW":{exportName:"zh_TW",loader:()=>fs(()=>import("./zh-TW-CrXJRxS8.js"),[],import.meta.url)},"pt-BR":{exportName:"pt_BR",loader:()=>fs(()=>import("./pt-BR-DtCy1Iqj.js"),[],import.meta.url)},de:{exportName:"de",loader:()=>fs(()=>import("./de-DCndbITT.js"),[],import.meta.url)}},Yl=[Nt,...Ql];function Xl(e){return e!=null&&Yl.includes(e)}function og(e){return Ql.includes(e)}async function rg(e){if(!og(e))return null;const t=ig[e];return(await t.loader())[t.exportName]??null}class ag{constructor(){this.locale=Nt,this.translations={[Nt]:tg},this.subscribers=new Set}getLocale(){return this.locale}async setLocale(t){const n=t!==Nt&&!this.translations[t];if(!(this.locale===t&&!n)){if(n)try{const s=await rg(t);if(!s)return;this.translations[t]=s}catch(s){console.error(`Failed to load locale: ${t}`,s);return}this.locale=t,this.notify()}}registerTranslation(t,n){this.translations[t]=n}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}notify(){this.subscribers.forEach(t=>t(this.locale))}t(t,n){const s=t.split(".");let i=this.translations[this.locale]||this.translations[Nt];for(const o of s)if(i&&typeof i=="object")i=i[o];else{i=void 0;break}if(i===void 0&&this.locale!==Nt){i=this.translations[Nt];for(const o of s)if(i&&typeof i=="object")i=i[o];else{i=void 0;break}}return typeof i!="string"?t:n?i.replace(/\{(\w+)\}/g,(o,r)=>n[r]||`{${r}}`):i}}const Jn=new ag,p=(e,t)=>Jn.t(e,t);class lg{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){this.unsubscribe=Jn.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){this.unsubscribe?.()}}async function Me(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 cg(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 dg(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 ug(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 ve(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function Zl(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(ve(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function Oo(e){return e.filter(t=>typeof t=="string").join(".")}function bt(e,t){const n=Oo(e),s=t[n];if(s)return s;const i=n.split(".");for(const[o,r]of Object.entries(t)){if(!o.includes("*"))continue;const l=o.split(".");if(l.length!==i.length)continue;let a=!0;for(let d=0;d<i.length;d+=1)if(l[d]!=="*"&&l[d]!==i[d]){a=!1;break}if(a)return r}}function ti(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Zr(e,t){const n=e.trim();if(n==="")return;const s=Number(n);return!Number.isFinite(s)||t&&!Number.isInteger(s)?e:s}function ea(e){const t=e.trim();return t==="true"?!0:t==="false"?!1:e}function pt(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let s=e;for(const i of t.allOf)s=pt(s,i);return s}const n=ve(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 pt(e,s[0]);if(typeof e=="string")for(const i of s){const o=ve(i);if(o==="number"||o==="integer"){const r=Zr(e,o==="integer");if(r===void 0||typeof r=="number")return r}if(o==="boolean"){const r=ea(e);if(typeof r=="boolean")return r}}for(const i of s){const o=ve(i);if(o==="object"&&typeof e=="object"&&!Array.isArray(e)||o==="array"&&Array.isArray(e))return pt(e,i)}return e}if(n==="number"||n==="integer"){if(typeof e=="string"){const s=Zr(e,n==="integer");if(s===void 0||typeof s=="number")return s}return e}if(n==="boolean"){if(typeof e=="string"){const s=ea(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??{},o=t.additionalProperties&&typeof t.additionalProperties=="object"?t.additionalProperties:null,r={};for(const[l,a]of Object.entries(s)){const d=i[l]??o,g=d?pt(a,d):a;g!==void 0&&(r[l]=g)}return r}if(n==="array"){if(!Array.isArray(e))return e;if(Array.isArray(t.items)){const i=t.items;return e.map((o,r)=>{const l=r<i.length?i[r]:void 0;return l?pt(o,l):o})}const s=t.items;return s?e.map(i=>pt(i,s)).filter(i=>i!==void 0):e}return e}function St(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function $n(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 o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const As=globalThis,Ro=As.ShadowRoot&&(As.ShadyCSS===void 0||As.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Mo=Symbol(),Br=new WeakMap;let Hl=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==Mo)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(Ro&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Br.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Br.set(n,t))}return t}toString(){return this.cssText}};const Ru=e=>new Hl(typeof e=="string"?e:e+"",void 0,Mo),Mu=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,o)=>s+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[o+1],e[0]);return new Hl(n,e,Mo)},Lu=(e,t)=>{if(Ro)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=As.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},Hr=Ro?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Ru(n)})(e):e;const{is:Du,defineProperty:Pu,getOwnPropertyDescriptor:Fu,getOwnPropertyNames:Nu,getOwnPropertySymbols:Ou,getPrototypeOf:Uu}=Object,Qs=globalThis,zr=Qs.trustedTypes,Bu=zr?zr.emptyScript:"",Hu=Qs.reactiveElementPolyfillSupport,Bn=(e,t)=>e,Ds={toAttribute(e,t){switch(t){case Boolean:e=e?Bu: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}},Lo=(e,t)=>!Du(e,t),jr={attribute:!0,type:String,converter:Ds,reflect:!1,useDefault:!1,hasChanged:Lo};Symbol.metadata??=Symbol("metadata"),Qs.litPropertyMetadata??=new WeakMap;let cn=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=jr){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&&Pu(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:o}=Fu(this.prototype,t)??{get(){return this[n]},set(r){this[n]=r}};return{get:i,set(r){const l=i?.call(this);o?.call(this,r),this.requestUpdate(t,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??jr}static _$Ei(){if(this.hasOwnProperty(Bn("elementProperties")))return;const t=Uu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Bn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Bn("properties"))){const n=this.properties,s=[...Nu(n),...Ou(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(Hr(i))}else t!==void 0&&n.push(Hr(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 Lu(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 o=(s.converter?.toAttribute!==void 0?s.converter:Ds).toAttribute(n,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,n){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),r=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Ds;this._$Em=i;const l=r.fromAttribute(n,o.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(t,n,s,i=!1,o){if(t!==void 0){const r=this.constructor;if(i===!1&&(o=this[t]),s??=r.getPropertyOptions(t),!((s.hasChanged??Lo)(o,n)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:o},r){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??n??this[t]),o!==!0||r!==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,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){const{wrapped:r}=o,l=this[i];r!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,o,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){}};cn.elementStyles=[],cn.shadowRootOptions={mode:"open"},cn[Bn("elementProperties")]=new Map,cn[Bn("finalized")]=new Map,Hu?.({ReactiveElement:cn}),(Qs.reactiveElementVersions??=[]).push("2.1.2");const Do=globalThis,Kr=e=>e,Ps=Do.trustedTypes,Wr=Ps?Ps.createPolicy("lit-html",{createHTML:e=>e}):void 0,zl="$lit$",ht=`lit$${Math.random().toFixed(9).slice(2)}$`,jl="?"+ht,zu=`<${jl}>`,Gt=document,qn=()=>Gt.createComment(""),Gn=e=>e===null||typeof e!="object"&&typeof e!="function",Po=Array.isArray,ju=e=>Po(e)||typeof e?.[Symbol.iterator]=="function",Ai=`[
|
|
2
|
+
\f\r]`,_n=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,qr=/-->/g,Gr=/>/g,Rt=RegExp(`>|${Ai}(?:([^\\s"'>=/]+)(${Ai}*=${Ai}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vr=/'/g,Jr=/"/g,Kl=/^(?:script|style|textarea|title)$/i,Wl=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),c=Wl(1),Mt=Wl(2),wt=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Qr=new WeakMap,Kt=Gt.createTreeWalker(Gt,129);function ql(e,t){if(!Po(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wr!==void 0?Wr.createHTML(t):t}const Ku=(e,t)=>{const n=e.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",r=_n;for(let l=0;l<n;l++){const a=e[l];let d,g,u=-1,f=0;for(;f<a.length&&(r.lastIndex=f,g=r.exec(a),g!==null);)f=r.lastIndex,r===_n?g[1]==="!--"?r=qr:g[1]!==void 0?r=Gr:g[2]!==void 0?(Kl.test(g[2])&&(i=RegExp("</"+g[2],"g")),r=Rt):g[3]!==void 0&&(r=Rt):r===Rt?g[0]===">"?(r=i??_n,u=-1):g[1]===void 0?u=-2:(u=r.lastIndex-g[2].length,d=g[1],r=g[3]===void 0?Rt:g[3]==='"'?Jr:Vr):r===Jr||r===Vr?r=Rt:r===qr||r===Gr?r=_n:(r=Rt,i=void 0);const v=r===Rt&&e[l+1].startsWith("/>")?" ":"";o+=r===_n?a+zu:u>=0?(s.push(d),a.slice(0,u)+zl+a.slice(u)+ht+v):a+ht+(u===-2?l:v)}return[ql(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class Vn{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let o=0,r=0;const l=t.length-1,a=this.parts,[d,g]=Ku(t,n);if(this.el=Vn.createElement(d,s),Kt.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Kt.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(zl)){const f=g[r++],v=i.getAttribute(u).split(ht),m=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:m[2],strings:v,ctor:m[1]==="."?qu:m[1]==="?"?Gu:m[1]==="@"?Vu:Xs}),i.removeAttribute(u)}else u.startsWith(ht)&&(a.push({type:6,index:o}),i.removeAttribute(u));if(Kl.test(i.tagName)){const u=i.textContent.split(ht),f=u.length-1;if(f>0){i.textContent=Ps?Ps.emptyScript:"";for(let v=0;v<f;v++)i.append(u[v],qn()),Kt.nextNode(),a.push({type:2,index:++o});i.append(u[f],qn())}}}else if(i.nodeType===8)if(i.data===jl)a.push({type:2,index:o});else{let u=-1;for(;(u=i.data.indexOf(ht,u+1))!==-1;)a.push({type:7,index:o}),u+=ht.length-1}o++}}static createElement(t,n){const s=Gt.createElement("template");return s.innerHTML=t,s}}function yn(e,t,n=e,s){if(t===wt)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const o=Gn(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=yn(e,i._$AS(e,t.values),i,s)),t}class Wu{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);Kt.currentNode=i;let o=Kt.nextNode(),r=0,l=0,a=s[0];for(;a!==void 0;){if(r===a.index){let d;a.type===2?d=new Ys(o,o.nextSibling,this,t):a.type===1?d=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(d=new Ju(o,this,t)),this._$AV.push(d),a=s[++l]}r!==a?.index&&(o=Kt.nextNode(),r++)}return Kt.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 Ys=class Gl{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=h,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=yn(this,t,n),Gn(t)?t===h||t==null||t===""?(this._$AH!==h&&this._$AR(),this._$AH=h):t!==this._$AH&&t!==wt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ju(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!==h&&Gn(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=Vn.createElement(ql(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const o=new Wu(i,this),r=o.u(this.options);o.p(n),this.T(r),this._$AH=o}}_$AC(t){let n=Qr.get(t.strings);return n===void 0&&Qr.set(t.strings,n=new Vn(t)),n}k(t){Po(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const o of t)i===n.length?n.push(s=new Gl(this.O(qn()),this.O(qn()),this,this.options)):s=n[i],s._$AI(o),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=Kr(t).nextSibling;Kr(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Xs=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,o){this.type=1,this._$AH=h,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=h}_$AI(t,n=this,s,i){const o=this.strings;let r=!1;if(o===void 0)t=yn(this,t,n,0),r=!Gn(t)||t!==this._$AH&&t!==wt,r&&(this._$AH=t);else{const l=t;let a,d;for(t=o[0],a=0;a<o.length-1;a++)d=yn(this,l[s+a],n,a),d===wt&&(d=this._$AH[a]),r||=!Gn(d)||d!==this._$AH[a],d===h?t=h:t!==h&&(t+=(d??"")+o[a+1]),this._$AH[a]=d}r&&!i&&this.j(t)}j(t){t===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},qu=class extends Xs{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===h?void 0:t}},Gu=class extends Xs{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==h)}},Vu=class extends Xs{constructor(t,n,s,i,o){super(t,n,s,i,o),this.type=5}_$AI(t,n=this){if((t=yn(this,t,n,0)??h)===wt)return;const s=this._$AH,i=t===h&&s!==h||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==h&&(s===h||i);i&&this.element.removeEventListener(this.name,this,s),o&&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)}},Ju=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){yn(this,t)}};const Qu={I:Ys},Yu=Do.litHtmlPolyfillSupport;Yu?.(Vn,Ys),(Do.litHtmlVersions??=[]).push("3.3.2");const Xu=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const o=n?.renderBefore??null;s._$litPart$=i=new Ys(t.insertBefore(qn(),o),o,void 0,n??{})}return i._$AI(e),i};const Fo=globalThis;let mn=class extends cn{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=Xu(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return wt}};mn._$litElement$=!0,mn.finalized=!0,Fo.litElementHydrateSupport?.({LitElement:mn});const Zu=Fo.litElementPolyfillSupport;Zu?.({LitElement:mn});(Fo.litElementVersions??=[]).push("4.2.2");const Vl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const eg={attribute:!0,type:String,converter:Ds,reflect:!1,hasChanged:Lo},tg=(e=eg,t,n)=>{const{kind:s,metadata:i}=n;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(n.name,e),s==="accessor"){const{name:r}=n;return{set(l){const a=t.get.call(this);t.set.call(this,l),this.requestUpdate(r,a,e,!0,l)},init(l){return l!==void 0&&this.C(r,void 0,e,l),l}}}if(s==="setter"){const{name:r}=n;return function(l){const a=this[r];t.call(this,l),this.requestUpdate(r,a,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Zs(e){return(t,n)=>typeof n=="object"?tg(e,t,n):((s,i,o)=>{const r=i.hasOwnProperty(o);return i.constructor.createProperty(o,s),r?Object.getOwnPropertyDescriptor(i,o):void 0})(e,t,n)}function x(e){return Zs({...e,state:!0,attribute:!1})}const ng={common:{version:"Version",health:"Health",ok:"OK",offline:"Offline",connect:"Connect",refresh:"Refresh",enabled:"Enabled",disabled:"Disabled",na:"n/a",docs:"Docs",resources:"Resources"},nav:{chat:"Chat",control:"Control",agent:"Agent",settings:"Settings",expand:"Expand sidebar",collapse:"Collapse sidebar"},tabs:{agents:"Agents",overview:"Overview",channels:"Channels",instances:"Instances",sessions:"Sessions",usage:"Usage",cron:"Cron Jobs",skills:"Skills",market:"Skills Market",nodes:"Nodes",chat:"Chat",models:"Models",config:"Config",debug:"Debug",logs:"Logs"},subtitles:{agents:"Manage agent workspaces, tools, and identities.",overview:"Gateway status, entry points, and a fast health read.",channels:"Manage channels and settings.",instances:"Presence beacons from connected clients and nodes.",sessions:"Inspect active sessions and adjust per-session defaults.",usage:"Monitor API usage and costs.",cron:"Schedule wakeups and recurring agent runs.",skills:"Manage skill availability and API key injection.",market:"Install and enable Web3 skills from BitSeek.",nodes:"Paired devices, capabilities, and command exposure.",chat:"Direct gateway chat session for quick interventions.",models:"Manage the default model and OpenAI-compatible providers.",config:"Edit ~/.openclaw/openclaw.json safely.",debug:"Gateway snapshots, events, and manual RPC calls.",logs:"Live tail of the gateway file logs."},overview:{access:{title:"Gateway Access",subtitle:"Where the dashboard connects and how it authenticates.",wsUrl:"WebSocket URL",token:"Gateway Token",password:"Password (not stored)",sessionKey:"Default Session Key",language:"Language",connectHint:"Click Connect to apply connection changes.",trustedProxy:"Authenticated via trusted proxy."},snapshot:{title:"Snapshot",subtitle:"Latest gateway handshake information.",status:"Status",uptime:"Uptime",tickInterval:"Tick Interval",lastChannelsRefresh:"Last Channels Refresh",channelsHint:"Use Channels to link WhatsApp, Telegram, Discord, Signal, or iMessage."},stats:{instances:"Instances",instancesHint:"Presence beacons in the last 5 minutes.",sessions:"Sessions",sessionsHint:"Recent session keys tracked by the gateway.",cron:"Cron",cronNext:"Next wake {time}"},notes:{title:"Notes",subtitle:"Quick reminders for remote control setups.",tailscaleTitle:"Tailscale serve",tailscaleText:"Prefer serve mode to keep the gateway on loopback with tailnet auth.",sessionTitle:"Session hygiene",sessionText:"Use /new or sessions.patch to reset context.",cronTitle:"Cron reminders",cronText:"Use isolated sessions for recurring runs."},auth:{required:"This gateway requires auth. Add a token or password, then click Connect.",failed:"Auth failed. Re-copy a tokenized URL with {command}, or update the token, then click Connect."},pairing:{hint:"This device needs pairing approval from the gateway host.",mobileHint:"On mobile? Copy the full URL (including #token=...) from openclaw dashboard --no-open on your desktop."},insecure:{hint:"This page is HTTP, so the browser blocks device identity. Use HTTPS (Tailscale Serve) or open {url} on the gateway host.",stayHttp:"If you must stay on HTTP, set {config} (token-only)."}},chat:{disconnected:"Disconnected from gateway.",refreshTitle:"Refresh chat data",thinkingToggle:"Toggle assistant thinking/working output",focusToggle:"Toggle focus mode (hide sidebar + page header)",hideCronSessions:"Hide cron sessions",showCronSessions:"Show cron sessions",showCronSessionsHidden:"Show cron sessions ({count} hidden)",onboardingDisabled:"Disabled during onboarding"},languages:{en:"English",zhCN:"简体中文 (Simplified Chinese)",zhTW:"繁體中文 (Traditional Chinese)",ptBR:"Português (Brazilian Portuguese)",de:"Deutsch (German)"},cron:{summary:{enabled:"Enabled",yes:"Yes",no:"No",jobs:"Jobs",nextWake:"Next wake",refreshing:"Refreshing...",refresh:"Refresh"},jobs:{title:"Jobs",subtitle:"All scheduled jobs stored in the gateway.",shownOf:"{shown} shown of {total}",searchJobs:"Search jobs",searchPlaceholder:"Name, description, or agent",enabled:"Enabled",schedule:"Schedule",lastRun:"Last run",all:"All",sort:"Sort",nextRun:"Next run",recentlyUpdated:"Recently updated",name:"Name",direction:"Direction",ascending:"Ascending",descending:"Descending",reset:"Reset",noMatching:"No matching jobs.",loading:"Loading...",loadMore:"Load more jobs"},runs:{title:"Run history",subtitleAll:"Latest runs across all jobs.",subtitleJob:"Latest runs for {title}.",scope:"Scope",allJobs:"All jobs",selectedJob:"Selected job",searchRuns:"Search runs",searchPlaceholder:"Summary, error, or job",newestFirst:"Newest first",oldestFirst:"Oldest first",status:"Status",delivery:"Delivery",clear:"Clear",allStatuses:"All statuses",allDelivery:"All delivery",selectJobHint:"Select a job to inspect run history.",noMatching:"No matching runs.",loadMore:"Load more runs",runStatusOk:"OK",runStatusError:"Error",runStatusSkipped:"Skipped",runStatusUnknown:"Unknown",deliveryDelivered:"Delivered",deliveryNotDelivered:"Not delivered",deliveryUnknown:"Unknown",deliveryNotRequested:"Not requested"},form:{editJob:"Edit Job",newJob:"New Job",updateSubtitle:"Update the selected scheduled job.",createSubtitle:"Create a scheduled wakeup or agent run.",required:"Required",requiredSr:"required",basics:"Basics",basicsSub:"Name it, choose the assistant, and set enabled state.",fieldName:"Name",description:"Description",agentId:"Agent ID",namePlaceholder:"Morning brief",descriptionPlaceholder:"Optional context for this job",agentPlaceholder:"main or ops",agentHelp:"Start typing to pick a known agent, or enter a custom one.",schedule:"Schedule",scheduleSub:"Control when this job runs.",every:"Every",at:"At",cronOption:"Cron",runAt:"Run at",unit:"Unit",minutes:"Minutes",hours:"Hours",days:"Days",expression:"Expression",expressionPlaceholder:"0 7 * * *",everyAmountPlaceholder:"30",timezoneOptional:"Timezone (optional)",timezonePlaceholder:"America/Los_Angeles",timezoneHelp:"Pick a common timezone or enter any valid IANA timezone.",jitterHelp:"Need jitter? Use Advanced → Stagger window / Stagger unit.",execution:"Execution",executionSub:"Choose when to wake, and what this job should do.",session:"Session",main:"Main",isolated:"Isolated",sessionHelp:"Main posts a system event. Isolated runs a dedicated agent turn.",wakeMode:"Wake mode",now:"Now",nextHeartbeat:"Next heartbeat",wakeModeHelp:"Now triggers immediately. Next heartbeat waits for the next cycle.",payloadKind:"What should run?",systemEvent:"Post message to main timeline",agentTurn:"Run assistant task (isolated)",systemEventHelp:"Sends your text to the gateway main timeline (good for reminders/triggers).",agentTurnHelp:"Starts an assistant run in its own session using your prompt.",timeoutSeconds:"Timeout (seconds)",timeoutPlaceholder:"Optional, e.g. 90",timeoutHelp:"Optional. Leave blank to use the gateway default timeout behavior for this run.",mainTimelineMessage:"Main timeline message",assistantTaskPrompt:"Assistant task prompt",deliverySection:"Delivery",deliverySub:"Choose where run summaries are sent.",resultDelivery:"Result delivery",announceDefault:"Announce summary (default)",webhookPost:"Webhook POST",noneInternal:"None (internal)",deliveryHelp:"Announce posts a summary to chat. None keeps execution internal.",webhookUrl:"Webhook URL",channel:"Channel",webhookPlaceholder:"https://example.com/cron",channelHelp:"Choose which connected channel receives the summary.",webhookHelp:"Send run summaries to a webhook endpoint.",to:"To",toPlaceholder:"+1555... or chat id",toHelp:"Optional recipient override (chat id, phone, or user id).",advanced:"Advanced",advancedHelp:"Optional overrides for delivery guarantees, schedule jitter, and model controls.",deleteAfterRun:"Delete after run",deleteAfterRunHelp:"Best for one-shot reminders that should auto-clean up.",clearAgentOverride:"Clear agent override",clearAgentHelp:"Force this job to use the gateway default assistant.",exactTiming:"Exact timing (no stagger)",exactTimingHelp:"Run on exact cron boundaries with no spread.",staggerWindow:"Stagger window",staggerUnit:"Stagger unit",staggerPlaceholder:"30",seconds:"Seconds",model:"Model",modelPlaceholder:"openai/gpt-5.2",modelHelp:"Start typing to pick a known model, or enter a custom one.",thinking:"Thinking",thinkingPlaceholder:"low",thinkingHelp:"Use a suggested level or enter a provider-specific value.",bestEffortDelivery:"Best effort delivery",bestEffortHelp:"Do not fail the job if delivery itself fails.",cantAddYet:"Can't add job yet",fillRequired:"Fill the required fields below to enable submit.",fixFields:"Fix {count} field to continue.",fixFieldsPlural:"Fix {count} fields to continue.",saving:"Saving...",saveChanges:"Save changes",addJob:"Add job",cancel:"Cancel"},jobList:{allJobs:"all jobs",selectJob:"(select a job)",enabled:"enabled",disabled:"disabled",edit:"Edit",clone:"Clone",disable:"Disable",enable:"Enable",run:"Run",history:"History",remove:"Remove"},jobDetail:{system:"System",prompt:"Prompt",delivery:"Delivery",agent:"Agent"},jobState:{status:"Status",next:"Next",last:"Last"},runEntry:{noSummary:"No summary.",runAt:"Run at",openRunChat:"Open run chat",next:"Next {rel}",due:"Due {rel}"},errors:{nameRequired:"Name is required.",scheduleAtInvalid:"Enter a valid date/time.",everyAmountInvalid:"Interval must be greater than 0.",cronExprRequired:"Cron expression is required.",staggerAmountInvalid:"Stagger must be greater than 0.",systemTextRequired:"System text is required.",agentMessageRequired:"Agent message is required.",timeoutInvalid:"If set, timeout must be greater than 0 seconds.",webhookUrlRequired:"Webhook URL is required.",webhookUrlInvalid:"Webhook URL must start with http:// or https://.",invalidRunTime:"Invalid run time.",invalidIntervalAmount:"Invalid interval amount.",cronExprRequiredShort:"Cron expression required.",invalidStaggerAmount:"Invalid stagger amount.",systemEventTextRequired:"System event text required.",agentMessageRequiredShort:"Agent message required.",nameRequiredShort:"Name required."}}},sg="modulepreload",ig=function(e,t){return new URL(e,t).href},Yr={},gs=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let d=function(g){return Promise.all(g.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const r=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),a=l?.nonce||l?.getAttribute("nonce");i=d(n.map(g=>{if(g=ig(g,s),g in Yr)return;Yr[g]=!0;const u=g.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(s)for(let m=r.length-1;m>=0;m--){const S=r[m];if(S.href===g&&(!u||S.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${g}"]${f}`))return;const v=document.createElement("link");if(v.rel=u?"stylesheet":sg,u||(v.as="script"),v.crossOrigin="",v.href=g,a&&v.setAttribute("nonce",a),document.head.appendChild(v),u)return new Promise((m,S)=>{v.addEventListener("load",m),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function o(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return i.then(r=>{for(const l of r||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},Nt="en",Jl=["zh-CN","zh-TW","pt-BR","de"],og={"zh-CN":{exportName:"zh_CN",loader:()=>gs(()=>import("./zh-CN-DpcDfKwj.js"),[],import.meta.url)},"zh-TW":{exportName:"zh_TW",loader:()=>gs(()=>import("./zh-TW-CrXJRxS8.js"),[],import.meta.url)},"pt-BR":{exportName:"pt_BR",loader:()=>gs(()=>import("./pt-BR-DtCy1Iqj.js"),[],import.meta.url)},de:{exportName:"de",loader:()=>gs(()=>import("./de-DCndbITT.js"),[],import.meta.url)}},Ql=[Nt,...Jl];function Yl(e){return e!=null&&Ql.includes(e)}function rg(e){return Jl.includes(e)}async function ag(e){if(!rg(e))return null;const t=og[e];return(await t.loader())[t.exportName]??null}class lg{constructor(){this.locale=Nt,this.translations={[Nt]:ng},this.subscribers=new Set}getLocale(){return this.locale}async setLocale(t){const n=t!==Nt&&!this.translations[t];if(!(this.locale===t&&!n)){if(n)try{const s=await ag(t);if(!s)return;this.translations[t]=s}catch(s){console.error(`Failed to load locale: ${t}`,s);return}this.locale=t,this.notify()}}registerTranslation(t,n){this.translations[t]=n}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}notify(){this.subscribers.forEach(t=>t(this.locale))}t(t,n){const s=t.split(".");let i=this.translations[this.locale]||this.translations[Nt];for(const o of s)if(i&&typeof i=="object")i=i[o];else{i=void 0;break}if(i===void 0&&this.locale!==Nt){i=this.translations[Nt];for(const o of s)if(i&&typeof i=="object")i=i[o];else{i=void 0;break}}return typeof i!="string"?t:n?i.replace(/\{(\w+)\}/g,(o,r)=>n[r]||`{${r}}`):i}}const Jn=new lg,p=(e,t)=>Jn.t(e,t);class cg{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){this.unsubscribe=Jn.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){this.unsubscribe?.()}}async function Me(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 dg(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 ug(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 gg(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 ve(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function Xl(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(ve(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function No(e){return e.filter(t=>typeof t=="string").join(".")}function bt(e,t){const n=No(e),s=t[n];if(s)return s;const i=n.split(".");for(const[o,r]of Object.entries(t)){if(!o.includes("*"))continue;const l=o.split(".");if(l.length!==i.length)continue;let a=!0;for(let d=0;d<i.length;d+=1)if(l[d]!=="*"&&l[d]!==i[d]){a=!1;break}if(a)return r}}function ei(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Xr(e,t){const n=e.trim();if(n==="")return;const s=Number(n);return!Number.isFinite(s)||t&&!Number.isInteger(s)?e:s}function Zr(e){const t=e.trim();return t==="true"?!0:t==="false"?!1:e}function pt(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let s=e;for(const i of t.allOf)s=pt(s,i);return s}const n=ve(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 pt(e,s[0]);if(typeof e=="string")for(const i of s){const o=ve(i);if(o==="number"||o==="integer"){const r=Xr(e,o==="integer");if(r===void 0||typeof r=="number")return r}if(o==="boolean"){const r=Zr(e);if(typeof r=="boolean")return r}}for(const i of s){const o=ve(i);if(o==="object"&&typeof e=="object"&&!Array.isArray(e)||o==="array"&&Array.isArray(e))return pt(e,i)}return e}if(n==="number"||n==="integer"){if(typeof e=="string"){const s=Xr(e,n==="integer");if(s===void 0||typeof s=="number")return s}return e}if(n==="boolean"){if(typeof e=="string"){const s=Zr(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??{},o=t.additionalProperties&&typeof t.additionalProperties=="object"?t.additionalProperties:null,r={};for(const[l,a]of Object.entries(s)){const d=i[l]??o,g=d?pt(a,d):a;g!==void 0&&(r[l]=g)}return r}if(n==="array"){if(!Array.isArray(e))return e;if(Array.isArray(t.items)){const i=t.items;return e.map((o,r)=>{const l=r<i.length?i[r]:void 0;return l?pt(o,l):o})}const s=t.items;return s?e.map(i=>pt(i,s)).filter(i=>i!==void 0):e}return e}function St(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function $n(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
4
|
+
`}function Zl(e,t,n){if(t.length===0)return;let s=e;for(let o=0;o<t.length-1;o+=1){const r=t[o],l=t[o+1];if(typeof r=="number"){if(!Array.isArray(s))return;s[r]==null&&(s[r]=typeof l=="number"?[]:{}),s=s[r]}else{if(typeof s!="object"||s==null)return;const a=s;a[r]==null&&(a[r]=typeof l=="number"?[]:{}),s=a[r]}}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 ec(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const o=t[i];if(typeof o=="number"){if(!Array.isArray(n))return;n=n[o]}else{if(typeof n!="object"||n==null)return;n=n[o]}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 Ae(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});pg(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function tc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});fg(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function fg(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function pg(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?$n(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=$n(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=St(t.config??{}),e.configFormOriginal=St(t.config??{}),e.configRawOriginal=n)}function hg(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function nc(e){if(e.configFormMode!=="form"||!e.configForm)return e.configRaw;const t=hg(e.configSchema),n=t?pt(e.configForm,t):e.configForm;return $n(n)}async function On(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=nc(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 Ae(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function mg(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=nc(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 Ae(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function ea(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 Re(e,t,n){const s=St(e.configForm??e.configSnapshot?.config??{});Zl(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=$n(s))}function qe(e,t){const n=St(e.configForm??e.configSnapshot?.config??{});ec(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=$n(n))}function vg(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 bg(e){const{state:t,callbacks:n,accountId:s}=e,i=vg(t),o=(l,a,d={})=>{const{type:g="text",placeholder:u,maxLength:f,help:v}=d,m=t.values[l]??"",S=t.fieldErrors[l],T=`nostr-profile-${l}`;return g==="textarea"?c`
|
|
5
5
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
6
6
|
<label for="${T}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
7
7
|
${a}
|
|
@@ -121,23 +121,23 @@
|
|
|
121
121
|
</div>
|
|
122
122
|
`:h}
|
|
123
123
|
</div>
|
|
124
|
-
`}function
|
|
124
|
+
`}function yg(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 $g(e,t){await dg(e,t),await Me(e,!0)}async function xg(e){await ug(e),await Me(e,!0)}async function wg(e){await gg(e),await Me(e,!0)}async function Sg(e){await On(e),await Ae(e),await Me(e,!0)}async function kg(e){await Ae(e),await Me(e,!0)}function Ag(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 o=s.trim(),r=i.join(":").trim();o&&r&&(t[o]=r)}return t}function sc(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function ic(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Cg(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 oc(e){const t=Cg(e);return t?{Authorization:t}:{}}function Tg(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=yg(n??void 0)}function Eg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function _g(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Ig(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Rg(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=sc(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(ic(n),{method:"PUT",headers:{"Content-Type":"application/json",...oc(e)},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const o=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Ag(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 Me(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Mg(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=sc(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(ic(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json",...oc(e)},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:a,success:null};return}const o=i.merged??i.imported??null,r=o?{...t.values,...o}:t.values,l=!!(r.banner||r.website||r.nip05||r.lud16);e.nostrProfileFormState={...t,importing:!1,values:r,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await Me(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function Lg(e){const t=(e??"").trim().toLowerCase();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 Zi=450;function ts(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 o=getComputedStyle(i).overflowY;if(o==="auto"||o==="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 o=i.scrollHeight-i.scrollTop-i.clientHeight,r=t&&!e.chatHasAutoScrolled;if(!(r||e.chatUserNearBottom||o<Zi)){e.chatNewMessagesBelow=!0;return}r&&(e.chatHasAutoScrolled=!0);const a=n&&(typeof window>"u"||typeof window.matchMedia!="function"||!window.matchMedia("(prefers-reduced-motion: reduce)").matches),d=i.scrollHeight;typeof i.scrollTo=="function"?i.scrollTo({top:d,behavior:a?"smooth":"auto"}):i.scrollTop=d,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1;const g=r?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const u=s();if(!u)return;const f=u.scrollHeight-u.scrollTop-u.clientHeight;(r||e.chatUserNearBottom||f<Zi)&&(u.scrollTop=u.scrollHeight,e.chatUserNearBottom=!0)},g)})})}function rc(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 Dg(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<Zi,e.chatUserNearBottom&&(e.chatNewMessagesBelow=!1)}function Pg(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function ta(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1}function Fg(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"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${o}.log`,i.click(),URL.revokeObjectURL(s)}function Fg(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 ni(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 o=s;e.debugModels=Array.isArray(o?.models)?o?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Ng(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 Og=2e3,Ug=new Set(["trace","debug","info","warn","error","fatal"]);function Bg(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 Hg(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Ug.has(t)?t:null}function zg(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=Hg(n?.logLevelName??n?.level),o=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,r=Bg(o);let l=null;r&&(typeof r.subsystem=="string"?l=r.subsystem:typeof r.module=="string"&&(l=r.module)),!l&&o&&o.length<120&&(l=o);let a=null;return typeof t[1]=="string"?a=t[1]:!r&&typeof t[0]=="string"?a=t[0]:typeof t.message=="string"&&(a=t.message),{raw:e,time:s,level:i,subsystem:l,message:a??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Uo(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}),o=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(zg),r=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-Og),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 si(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 jg(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{si(e,{quiet:!0})},5e3))}function Kg(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function lc(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Uo(e,{quiet:!0})},2e3))}function cc(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function dc(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&ni(e)},3e3))}function uc(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function gc(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 fc(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 Ts(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 Bo(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}}}async function Hn(e,t){if(!(!e.client||!e.connected)&&!e.toolsCatalogLoading){e.toolsCatalogLoading=!0,e.toolsCatalogError=null;try{const n=await e.client.request("tools.catalog",{agentId:t??e.agentsSelectedId??void 0,includePlugins:!0});n&&(e.toolsCatalogResult=n)}catch(n){e.toolsCatalogError=String(n)}finally{e.toolsCatalogLoading=!1}}}const Wg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Ns={name:"",description:"",agentId:"",sessionKey:"",clearAgent:!1,enabled:!0,deleteAfterRun:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds",sessionTarget:"isolated",wakeMode:"now",payloadKind:"agentTurn",payloadText:"",payloadModel:"",payloadThinking:"",payloadLightContext:!1,deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",deliveryAccountId:"",deliveryBestEffort:!1,failureAlertMode:"inherit",failureAlertAfter:"2",failureAlertCooldownSeconds:"3600",failureAlertChannel:"last",failureAlertTo:"",failureAlertDeliveryMode:"announce",failureAlertAccountId:"",timeoutSeconds:""};function Ho(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),o=Math.floor(s%3600/60),r=s%60;if(i>=24){const l=Math.floor(i/24),a=i%24;return a>0?`${l}d${n}${a}h`:`${l}d`}return i>0?o>0?`${i}h${n}${o}m`:`${i}h`:o>0?r>0?`${o}m${n}${r}s`:`${o}m`:`${r}s`}function zo(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 ne(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),o=s>=0,r=Math.round(i/1e3);if(r<60)return o?"just now":"in <1m";const l=Math.round(r/60);if(l<60)return o?`${l}m ago`:`in ${l}m`;const a=Math.round(l/60);if(a<48)return o?`${a}h ago`:`in ${a}h`;const d=Math.round(a/24);return o?`${d}d ago`:`in ${d}d`}function eo(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const o=(i.index??0)+i[1].length;t.push({start:o,end:o+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const o=i.index??0,r=o+i[0].length;t.some(a=>o>=a.start&&r<=a.end)||t.push({start:o,end:r})}return t.sort((i,o)=>i.start-o.start),t}function to(e,t){return t.some(n=>e>=n.start&&e<n.end)}const qg=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,ps=/<\s*\/?\s*final\b[^<>]*>/gi,sa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Gg(e,t){return e.trimStart()}function Vg(e,t){if(!e||!qg.test(e))return e;let n=e;if(ps.test(n)){ps.lastIndex=0;const l=[],a=eo(n);for(const d of n.matchAll(ps)){const g=d.index??0;l.push({start:g,length:d[0].length,inCode:to(g,a)})}for(let d=l.length-1;d>=0;d--){const g=l[d];g.inCode||(n=n.slice(0,g.start)+n.slice(g.start+g.length))}}else ps.lastIndex=0;const s=eo(n);sa.lastIndex=0;let i="",o=0,r=!1;for(const l of n.matchAll(sa)){const a=l.index??0,d=l[1]==="/";to(a,s)||(r?d&&(r=!1):(i+=n.slice(o,a),d||(r=!0)),o=a+l[0].length)}return i+=n.slice(o),Gg(i)}const ia=/<\s*(\/?)\s*relevant[-_]memories\b[^<>]*>/gi,Jg=/<\s*\/?\s*relevant[-_]memories\b/i;function Qg(e){if(!e||!Jg.test(e))return e;ia.lastIndex=0;const t=eo(e);let n="",s=0,i=!1;for(const o of e.matchAll(ia)){const r=o.index??0;if(to(r,t))continue;const l=o[1]==="/";i?l&&(i=!1):(n+=e.slice(s,r),l||(i=!0)),s=r+o[0].length}return i||(n+=e.slice(s)),n}function Yg(e){const t=Vg(e);return Qg(t).trimStart()}function kt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function no(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function so(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function pc(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 Ne(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Xg(e){return Yg(e)}const Es="last";function Zg(e){return e.sessionTarget==="isolated"&&e.payloadKind==="agentTurn"}function jo(e){return e.deliveryMode!=="announce"||Zg(e)?e:{...e,deliveryMode:"none"}}function ss(e){const t={};if(e.name.trim()||(t.name="cron.errors.nameRequired"),e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);Number.isFinite(n)||(t.scheduleAt="cron.errors.scheduleAtInvalid")}else if(e.scheduleKind==="every")Ne(e.everyAmount,0)<=0&&(t.everyAmount="cron.errors.everyAmountInvalid");else if(e.cronExpr.trim()||(t.cronExpr="cron.errors.cronExprRequired"),!e.scheduleExact){const n=e.staggerAmount.trim();n&&Ne(n,0)<=0&&(t.staggerAmount="cron.errors.staggerAmountInvalid")}if(e.payloadText.trim()||(t.payloadText=e.payloadKind==="systemEvent"?"cron.errors.systemTextRequired":"cron.errors.agentMessageRequired"),e.payloadKind==="agentTurn"){const n=e.timeoutSeconds.trim();n&&Ne(n,0)<=0&&(t.timeoutSeconds="cron.errors.timeoutInvalid")}if(e.deliveryMode==="webhook"){const n=e.deliveryTo.trim();n?/^https?:\/\//i.test(n)||(t.deliveryTo="cron.errors.webhookUrlInvalid"):t.deliveryTo="cron.errors.webhookUrlRequired"}if(e.failureAlertMode==="custom"){const n=e.failureAlertAfter.trim();if(n){const i=Ne(n,0);(!Number.isFinite(i)||i<=0)&&(t.failureAlertAfter="Failure alert threshold must be greater than 0.")}const s=e.failureAlertCooldownSeconds.trim();if(s){const i=Ne(s,-1);(!Number.isFinite(i)||i<0)&&(t.failureAlertCooldownSeconds="Cooldown must be 0 or greater.")}}return t}function hc(e){return Object.keys(e).length>0}async function is(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 ef(e){if(!(!e.client||!e.connected))try{const n=(await e.client.request("models.list",{}))?.models;if(!Array.isArray(n)){e.cronModelSuggestions=[];return}const s=n.map(i=>{if(!i||typeof i!="object")return"";const o=i.id;return typeof o=="string"?o.trim():""}).filter(Boolean);e.cronModelSuggestions=Array.from(new Set(s)).toSorted((i,o)=>i.localeCompare(o))}catch{e.cronModelSuggestions=[]}}async function ii(e){return await Ko(e,{append:!1})}function mc(e){const t=typeof e.totalRaw=="number"&&Number.isFinite(e.totalRaw)?Math.max(0,Math.floor(e.totalRaw)):e.pageCount,n=typeof e.limitRaw=="number"&&Number.isFinite(e.limitRaw)?Math.max(1,Math.floor(e.limitRaw)):Math.max(1,e.pageCount),s=typeof e.offsetRaw=="number"&&Number.isFinite(e.offsetRaw)?Math.max(0,Math.floor(e.offsetRaw)):0,i=typeof e.hasMoreRaw=="boolean"?e.hasMoreRaw:s+e.pageCount<Math.max(t,s+e.pageCount),o=typeof e.nextOffsetRaw=="number"&&Number.isFinite(e.nextOffsetRaw)?Math.max(0,Math.floor(e.nextOffsetRaw)):i?s+e.pageCount:null;return{total:t,limit:n,offset:s,hasMore:i,nextOffset:o}}async function Ko(e,t){if(!e.client||!e.connected||e.cronLoading||e.cronJobsLoadingMore)return;const n=t?.append===!0;if(n){if(!e.cronJobsHasMore)return;e.cronJobsLoadingMore=!0}else e.cronLoading=!0;e.cronError=null;try{const s=n?Math.max(0,e.cronJobsNextOffset??e.cronJobs.length):0,i=await e.client.request("cron.list",{includeDisabled:e.cronJobsEnabledFilter==="all",limit:e.cronJobsLimit,offset:s,query:e.cronJobsQuery.trim()||void 0,enabled:e.cronJobsEnabledFilter,sortBy:e.cronJobsSortBy,sortDir:e.cronJobsSortDir}),o=Array.isArray(i.jobs)?i.jobs:[];e.cronJobs=n?[...e.cronJobs,...o]:o;const r=mc({totalRaw:i.total,limitRaw:i.limit,offsetRaw:i.offset,nextOffsetRaw:i.nextOffset,hasMoreRaw:i.hasMore,pageCount:o.length});e.cronJobsTotal=Math.max(r.total,e.cronJobs.length),e.cronJobsHasMore=r.hasMore,e.cronJobsNextOffset=r.nextOffset,e.cronEditingJobId&&!e.cronJobs.some(l=>l.id===e.cronEditingJobId)&&os(e)}catch(s){e.cronError=String(s)}finally{n?e.cronJobsLoadingMore=!1:e.cronLoading=!1}}async function tf(e){await Ko(e,{append:!0})}async function oa(e){await Ko(e,{append:!1})}function ra(e,t){typeof t.cronJobsQuery=="string"&&(e.cronJobsQuery=t.cronJobsQuery),t.cronJobsEnabledFilter&&(e.cronJobsEnabledFilter=t.cronJobsEnabledFilter),t.cronJobsScheduleKindFilter&&(e.cronJobsScheduleKindFilter=t.cronJobsScheduleKindFilter),t.cronJobsLastStatusFilter&&(e.cronJobsLastStatusFilter=t.cronJobsLastStatusFilter),t.cronJobsSortBy&&(e.cronJobsSortBy=t.cronJobsSortBy),t.cronJobsSortDir&&(e.cronJobsSortDir=t.cronJobsSortDir)}function nf(e){return e.cronJobs.filter(t=>!(e.cronJobsScheduleKindFilter!=="all"&&t.schedule.kind!==e.cronJobsScheduleKindFilter||e.cronJobsLastStatusFilter!=="all"&&t.state?.lastStatus!==e.cronJobsLastStatusFilter))}function os(e){e.cronEditingJobId=null}function vc(e){e.cronForm={...Ns},e.cronFieldErrors=ss(e.cronForm)}function sf(e){const t=Date.parse(e);if(!Number.isFinite(t))return"";const n=new Date(t),s=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0"),r=String(n.getHours()).padStart(2,"0"),l=String(n.getMinutes()).padStart(2,"0");return`${s}-${i}-${o}T${r}:${l}`}function of(e){if(e%864e5===0)return{everyAmount:String(Math.max(1,e/864e5)),everyUnit:"days"};if(e%36e5===0)return{everyAmount:String(Math.max(1,e/36e5)),everyUnit:"hours"};const t=Math.max(1,Math.ceil(e/6e4));return{everyAmount:String(t),everyUnit:"minutes"}}function rf(e){return e===0?{scheduleExact:!0,staggerAmount:"",staggerUnit:"seconds"}:typeof e!="number"||!Number.isFinite(e)||e<0?{scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds"}:e%6e4===0?{scheduleExact:!1,staggerAmount:String(Math.max(1,e/6e4)),staggerUnit:"minutes"}:{scheduleExact:!1,staggerAmount:String(Math.max(1,Math.ceil(e/1e3))),staggerUnit:"seconds"}}function bc(e,t){const n=e.failureAlert,s={...t,name:e.name,description:e.description??"",agentId:e.agentId??"",sessionKey:e.sessionKey??"",clearAgent:!1,enabled:e.enabled,deleteAfterRun:e.deleteAfterRun??!1,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:t.everyAmount,everyUnit:t.everyUnit,cronExpr:t.cronExpr,cronTz:"",scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds",sessionTarget:e.sessionTarget,wakeMode:e.wakeMode,payloadKind:e.payload.kind,payloadText:e.payload.kind==="systemEvent"?e.payload.text:e.payload.message,payloadModel:e.payload.kind==="agentTurn"?e.payload.model??"":"",payloadThinking:e.payload.kind==="agentTurn"?e.payload.thinking??"":"",payloadLightContext:e.payload.kind==="agentTurn"?e.payload.lightContext===!0:!1,deliveryMode:e.delivery?.mode??"none",deliveryChannel:e.delivery?.channel??Es,deliveryTo:e.delivery?.to??"",deliveryAccountId:e.delivery?.accountId??"",deliveryBestEffort:e.delivery?.bestEffort??!1,failureAlertMode:n===!1?"disabled":n&&typeof n=="object"?"custom":"inherit",failureAlertAfter:n&&typeof n=="object"&&typeof n.after=="number"?String(n.after):Ns.failureAlertAfter,failureAlertCooldownSeconds:n&&typeof n=="object"&&typeof n.cooldownMs=="number"?String(Math.floor(n.cooldownMs/1e3)):Ns.failureAlertCooldownSeconds,failureAlertChannel:n&&typeof n=="object"?n.channel??Es:Es,failureAlertTo:n&&typeof n=="object"?n.to??"":"",failureAlertDeliveryMode:n&&typeof n=="object"?n.mode??"announce":"announce",failureAlertAccountId:n&&typeof n=="object"?n.accountId??"":"",timeoutSeconds:e.payload.kind==="agentTurn"&&typeof e.payload.timeoutSeconds=="number"?String(e.payload.timeoutSeconds):""};if(e.schedule.kind==="at")s.scheduleAt=sf(e.schedule.at);else if(e.schedule.kind==="every"){const i=of(e.schedule.everyMs);s.everyAmount=i.everyAmount,s.everyUnit=i.everyUnit}else{s.cronExpr=e.schedule.expr,s.cronTz=e.schedule.tz??"";const i=rf(e.schedule.staggerMs);s.scheduleExact=i.scheduleExact,s.staggerAmount=i.staggerAmount,s.staggerUnit=i.staggerUnit}return jo(s)}function af(e){if(e.scheduleKind==="at"){const o=Date.parse(e.scheduleAt);if(!Number.isFinite(o))throw new Error(p("cron.errors.invalidRunTime"));return{kind:"at",at:new Date(o).toISOString()}}if(e.scheduleKind==="every"){const o=Ne(e.everyAmount,0);if(o<=0)throw new Error(p("cron.errors.invalidIntervalAmount"));const r=e.everyUnit;return{kind:"every",everyMs:o*(r==="minutes"?6e4:r==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error(p("cron.errors.cronExprRequiredShort"));if(e.scheduleExact)return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0,staggerMs:0};const n=e.staggerAmount.trim();if(!n)return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0};const s=Ne(n,0);if(s<=0)throw new Error(p("cron.errors.invalidStaggerAmount"));const i=e.staggerUnit==="minutes"?s*6e4:s*1e3;return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0,staggerMs:i}}function lf(e){if(e.payloadKind==="systemEvent"){const r=e.payloadText.trim();if(!r)throw new Error(p("cron.errors.systemEventTextRequired"));return{kind:"systemEvent",text:r}}const t=e.payloadText.trim();if(!t)throw new Error(p("cron.errors.agentMessageRequiredShort"));const n={kind:"agentTurn",message:t},s=e.payloadModel.trim();s&&(n.model=s);const i=e.payloadThinking.trim();i&&(n.thinking=i);const o=Ne(e.timeoutSeconds,0);return o>0&&(n.timeoutSeconds=o),e.payloadLightContext&&(n.lightContext=!0),n}function cf(e){if(e.failureAlertMode==="disabled")return!1;if(e.failureAlertMode!=="custom")return;const t=Ne(e.failureAlertAfter.trim(),0),n=e.failureAlertCooldownSeconds.trim(),s=n.length>0?Ne(n,0):void 0,i=s!==void 0&&Number.isFinite(s)&&s>=0?Math.floor(s*1e3):void 0,o=e.failureAlertDeliveryMode,r=e.failureAlertAccountId.trim(),l={after:t>0?Math.floor(t):void 0,channel:e.failureAlertChannel.trim()||Es,to:e.failureAlertTo.trim()||void 0,...i!==void 0?{cooldownMs:i}:{}};return o&&(l.mode=o),l.accountId=r||void 0,l}async function df(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=jo(e.cronForm);t!==e.cronForm&&(e.cronForm=t);const n=ss(t);if(e.cronFieldErrors=n,hc(n))return;const s=af(t),i=lf(t),o=e.cronEditingJobId?e.cronJobs.find(v=>v.id===e.cronEditingJobId):void 0;if(i.kind==="agentTurn"){const v=o?.payload.kind==="agentTurn"?o.payload.lightContext:void 0;!t.payloadLightContext&&e.cronEditingJobId&&v!==void 0&&(i.lightContext=!1)}const r=t.deliveryMode,l=r&&r!=="none"?{mode:r,channel:r==="announce"?t.deliveryChannel.trim()||"last":void 0,to:t.deliveryTo.trim()||void 0,accountId:r==="announce"?t.deliveryAccountId.trim():void 0,bestEffort:t.deliveryBestEffort}:r==="none"?{mode:"none"}:void 0,a=cf(t),d=t.clearAgent?null:t.agentId.trim(),u=t.sessionKey.trim()||(o?.sessionKey?null:void 0),f={name:t.name.trim(),description:t.description.trim(),agentId:d===null?null:d||void 0,sessionKey:u,enabled:t.enabled,deleteAfterRun:t.deleteAfterRun,schedule:s,sessionTarget:t.sessionTarget,wakeMode:t.wakeMode,payload:i,delivery:l,failureAlert:a};if(!f.name)throw new Error(p("cron.errors.nameRequiredShort"));e.cronEditingJobId?(await e.client.request("cron.update",{id:e.cronEditingJobId,patch:f}),os(e)):(await e.client.request("cron.add",f),vc(e)),await ii(e),await is(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function uf(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 ii(e),await is(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function gf(e,t,n="force"){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:n}),e.cronRunsScope==="all"?await yt(e,null):await yt(e,t.id)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function ff(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.cronEditingJobId===t.id&&os(e),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null),await ii(e),await is(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function yt(e,t,n){if(!e.client||!e.connected)return;const s=e.cronRunsScope,i=t??e.cronRunsJobId;if(s==="job"&&!i){e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null;return}const o=n?.append===!0;if(!(o&&!e.cronRunsHasMore))try{o&&(e.cronRunsLoadingMore=!0);const r=o?Math.max(0,e.cronRunsNextOffset??e.cronRuns.length):0,l=await e.client.request("cron.runs",{scope:s,id:s==="job"?i??void 0:void 0,limit:e.cronRunsLimit,offset:r,statuses:e.cronRunsStatuses.length>0?e.cronRunsStatuses:void 0,status:e.cronRunsStatusFilter,deliveryStatuses:e.cronRunsDeliveryStatuses.length>0?e.cronRunsDeliveryStatuses:void 0,query:e.cronRunsQuery.trim()||void 0,sortDir:e.cronRunsSortDir}),a=Array.isArray(l.entries)?l.entries:[];e.cronRuns=o&&(s==="all"||e.cronRunsJobId===i)?[...e.cronRuns,...a]:a,s==="job"&&(e.cronRunsJobId=i??null);const d=mc({totalRaw:l.total,limitRaw:l.limit,offsetRaw:l.offset,nextOffsetRaw:l.nextOffset,hasMoreRaw:l.hasMore,pageCount:a.length});e.cronRunsTotal=Math.max(d.total,e.cronRuns.length),e.cronRunsHasMore=d.hasMore,e.cronRunsNextOffset=d.nextOffset}catch(r){e.cronError=String(r)}finally{o&&(e.cronRunsLoadingMore=!1)}}async function pf(e){e.cronRunsScope==="job"&&!e.cronRunsJobId||await yt(e,e.cronRunsJobId,{append:!0})}function aa(e,t){t.cronRunsScope&&(e.cronRunsScope=t.cronRunsScope),Array.isArray(t.cronRunsStatuses)&&(e.cronRunsStatuses=t.cronRunsStatuses,e.cronRunsStatusFilter=t.cronRunsStatuses.length===1?t.cronRunsStatuses[0]:"all"),Array.isArray(t.cronRunsDeliveryStatuses)&&(e.cronRunsDeliveryStatuses=t.cronRunsDeliveryStatuses),t.cronRunsStatusFilter&&(e.cronRunsStatusFilter=t.cronRunsStatusFilter,e.cronRunsStatuses=t.cronRunsStatusFilter==="all"?[]:[t.cronRunsStatusFilter]),typeof t.cronRunsQuery=="string"&&(e.cronRunsQuery=t.cronRunsQuery),t.cronRunsSortDir&&(e.cronRunsSortDir=t.cronRunsSortDir)}function hf(e,t){e.cronEditingJobId=t.id,e.cronRunsJobId=t.id,e.cronForm=bc(t,e.cronForm),e.cronFieldErrors=ss(e.cronForm)}function mf(e,t){const n=e.trim()||"Job",s=`${n} copy`;if(!t.has(s.toLowerCase()))return s;let i=2;for(;i<1e3;){const o=`${n} copy ${i}`;if(!t.has(o.toLowerCase()))return o;i+=1}return`${n} copy ${Date.now()}`}function vf(e,t){os(e),e.cronRunsJobId=t.id;const n=new Set(e.cronJobs.map(i=>i.name.trim().toLowerCase())),s=bc(t,e.cronForm);s.name=mf(t.name,n),e.cronForm=s,e.cronFieldErrors=ss(e.cronForm)}function bf(e){os(e),vc(e)}function Wo(e){return e.trim()}function yf(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 $f(e){const t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return null;const n=Wo(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function xf(e){const t=Wo(e.role),n=e.adapter.readStore(),s={version:1,deviceId:e.deviceId,tokens:n&&n.deviceId===e.deviceId&&n.tokens?{...n.tokens}:{}},i={token:e.token,role:t,scopes:yf(e.scopes),updatedAtMs:Date.now()};return s.tokens[t]=i,e.adapter.writeStore(s),i}function wf(e){const t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return;const n=Wo(e.role);if(!t.tokens[n])return;const s={version:1,deviceId:t.deviceId,tokens:{...t.tokens}};delete s.tokens[n],e.adapter.writeStore(s)}const yc="openclaw.device.auth.v1";function qo(){try{const e=window.localStorage.getItem(yc);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 Go(e){try{window.localStorage.setItem(yc,JSON.stringify(e))}catch{}}function Sf(e){return $f({adapter:{readStore:qo,writeStore:Go},deviceId:e.deviceId,role:e.role})}function $c(e){return xf({adapter:{readStore:qo,writeStore:Go},deviceId:e.deviceId,role:e.role,token:e.token,scopes:e.scopes})}function xc(e){wf({adapter:{readStore:qo,writeStore:Go},deviceId:e.deviceId,role:e.role})}const wc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:Se,n:_s,Gx:la,Gy:ca,a:Ci,d:Ti,h:kf}=wc,Vt=32,Vo=64,Af=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},me=(e="")=>{const t=new Error(e);throw Af(t,me),t},Cf=e=>typeof e=="bigint",Tf=e=>typeof e=="string",Ef=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Tt=(e,t,n="")=>{const s=Ef(e),i=e?.length,o=t!==void 0;if(!s||o&&i!==t){const r=n&&`"${n}" `,l=o?` of length ${t}`:"",a=s?`length=${i}`:`type=${typeof e}`;me(r+"expected Uint8Array"+l+", got "+a)}return e},oi=e=>new Uint8Array(e),Sc=e=>Uint8Array.from(e),kc=(e,t)=>e.toString(16).padStart(t,"0"),Ac=e=>Array.from(Tt(e)).map(t=>kc(t,2)).join(""),ot={_0:48,_9:57,A:65,F:70,a:97,f:102},da=e=>{if(e>=ot._0&&e<=ot._9)return e-ot._0;if(e>=ot.A&&e<=ot.F)return e-(ot.A-10);if(e>=ot.a&&e<=ot.f)return e-(ot.a-10)},Cc=e=>{const t="hex invalid";if(!Tf(e))return me(t);const n=e.length,s=n/2;if(n%2)return me(t);const i=oi(s);for(let o=0,r=0;o<s;o++,r+=2){const l=da(e.charCodeAt(r)),a=da(e.charCodeAt(r+1));if(l===void 0||a===void 0)return me(t);i[o]=l*16+a}return i},Tc=()=>globalThis?.crypto,_f=()=>Tc()?.subtle??me("crypto.subtle must be defined, consider polyfill"),Qn=(...e)=>{const t=oi(e.reduce((s,i)=>s+Tt(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},If=(e=Vt)=>Tc().getRandomValues(oi(e)),Os=BigInt,Ot=(e,t,n,s="bad number: out of range")=>Cf(e)&&t<=e&&e<n?e:me(s),U=(e,t=Se)=>{const n=e%t;return n>=0n?n:t+n},Ec=e=>U(e,_s),Rf=(e,t)=>{(e===0n||t<=0n)&&me("no inverse n="+e+" mod="+t);let n=U(e,t),s=t,i=0n,o=1n;for(;n!==0n;){const r=s/n,l=s%n,a=i-o*r;s=n,n=l,i=o,o=a}return s===1n?U(i,t):me("no inverse")},Mf=e=>{const t=Mc[e];return typeof t!="function"&&me("hashes."+e+" not set"),t},Ei=e=>e instanceof Fe?e:me("Point expected"),io=2n**256n;class Fe{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const o=io;this.X=Ot(t,0n,o),this.Y=Ot(n,0n,o),this.Z=Ot(s,1n,o),this.T=Ot(i,0n,o),Object.freeze(this)}static CURVE(){return wc}static fromAffine(t){return new Fe(t.x,t.y,1n,U(t.x*t.y))}static fromBytes(t,n=!1){const s=Ti,i=Sc(Tt(t,Vt)),o=t[31];i[31]=o&-129;const r=Ic(i);Ot(r,0n,n?io:Se);const a=U(r*r),d=U(a-1n),g=U(s*a+1n);let{isValid:u,value:f}=Df(d,g);u||me("bad point: y not sqrt");const v=(f&1n)===1n,m=(o&128)!==0;return!n&&f===0n&&m&&me("bad point: x==0, isLastByteOdd"),m!==v&&(f=U(-f)),new Fe(f,r,1n,U(f*r))}static fromHex(t,n){return Fe.fromBytes(Cc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Ci,n=Ti,s=this;if(s.is0())return me("bad point: ZERO");const{X:i,Y:o,Z:r,T:l}=s,a=U(i*i),d=U(o*o),g=U(r*r),u=U(g*g),f=U(a*t),v=U(g*U(f+d)),m=U(u+U(n*U(a*d)));if(v!==m)return me("bad point: equation left != right (1)");const S=U(i*o),T=U(r*l);return S!==T?me("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:o,Y:r,Z:l}=Ei(t),a=U(n*l),d=U(o*i),g=U(s*l),u=U(r*i);return a===d&&g===u}is0(){return this.equals(fn)}negate(){return new Fe(U(-this.X),this.Y,this.Z,U(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Ci,o=U(t*t),r=U(n*n),l=U(2n*U(s*s)),a=U(i*o),d=t+n,g=U(U(d*d)-o-r),u=a+r,f=u-l,v=a-r,m=U(g*f),S=U(u*v),T=U(g*v),M=U(f*u);return new Fe(m,S,M,T)}add(t){const{X:n,Y:s,Z:i,T:o}=this,{X:r,Y:l,Z:a,T:d}=Ei(t),g=Ci,u=Ti,f=U(n*r),v=U(s*l),m=U(o*u*d),S=U(i*a),T=U((n+s)*(r+l)-f-v),M=U(S-m),I=U(S+m),A=U(v-g*f),w=U(T*M),L=U(I*A),E=U(T*A),R=U(M*I);return new Fe(w,L,R,E)}subtract(t){return this.add(Ei(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return fn;if(Ot(t,1n,_s),t===1n)return this;if(this.equals(Jt))return Wf(t).p;let s=fn,i=Jt;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?s=s.add(o):n&&(i=i.add(o));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(fn))return{x:0n,y:1n};const i=Rf(s,Se);U(s*i)!==1n&&me("invalid inverse");const o=U(t*i),r=U(n*i);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=_c(n);return s[31]|=t&1n?128:0,s}toHex(){return Ac(this.toBytes())}clearCofactor(){return this.multiply(Os(kf),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(_s/2n,!1).double();return _s%2n&&(t=t.add(this)),t.is0()}}const Jt=new Fe(la,ca,1n,U(la*ca)),fn=new Fe(0n,1n,1n,0n);Fe.BASE=Jt;Fe.ZERO=fn;const _c=e=>Cc(kc(Ot(e,0n,io),Vo)).reverse(),Ic=e=>Os("0x"+Ac(Sc(Tt(e)).reverse())),Ge=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=Se;return n},Lf=e=>{const n=e*e%Se*e%Se,s=Ge(n,2n)*n%Se,i=Ge(s,1n)*e%Se,o=Ge(i,5n)*i%Se,r=Ge(o,10n)*o%Se,l=Ge(r,20n)*r%Se,a=Ge(l,40n)*l%Se,d=Ge(a,80n)*a%Se,g=Ge(d,80n)*a%Se,u=Ge(g,10n)*o%Se;return{pow_p_5_8:Ge(u,2n)*e%Se,b2:n}},ua=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Df=(e,t)=>{const n=U(t*t*t),s=U(n*n*t),i=Lf(e*s).pow_p_5_8;let o=U(e*n*i);const r=U(t*o*o),l=o,a=U(o*ua),d=r===e,g=r===U(-e),u=r===U(-e*ua);return d&&(o=l),(g||u)&&(o=a),(U(o)&1n)===1n&&(o=U(-o)),{isValid:d||g,value:o}},oo=e=>Ec(Ic(e)),Jo=(...e)=>Mc.sha512Async(Qn(...e)),Pf=(...e)=>Mf("sha512")(Qn(...e)),Rc=e=>{const t=e.slice(0,Vt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Vt,Vo),s=oo(t),i=Jt.multiply(s),o=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:o}},Qo=e=>Jo(Tt(e,Vt)).then(Rc),Ff=e=>Rc(Pf(Tt(e,Vt))),Nf=e=>Qo(e).then(t=>t.pointBytes),Of=e=>Jo(e.hashable).then(e.finish),Uf=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,o=oo(t),r=Jt.multiply(o).toBytes();return{hashable:Qn(r,s,n),finish:d=>{const g=Ec(o+oo(d)*i);return Tt(Qn(r,_c(g)),Vo)}}},Bf=async(e,t)=>{const n=Tt(e),s=await Qo(t),i=await Jo(s.prefix,n);return Of(Uf(s,i,n))},Mc={sha512Async:async e=>{const t=_f(),n=Qn(e);return oi(await t.digest("SHA-512",n.buffer))},sha512:void 0},Hf=(e=If(Vt))=>e,zf={getExtendedPublicKeyAsync:Qo,getExtendedPublicKey:Ff,randomSecretKey:Hf},Us=8,jf=256,Lc=Math.ceil(jf/Us)+1,ro=2**(Us-1),Kf=()=>{const e=[];let t=Jt,n=t;for(let s=0;s<Lc;s++){n=t,e.push(n);for(let i=1;i<ro;i++)n=n.add(t),e.push(n);t=n.double()}return e};let ga;const fa=(e,t)=>{const n=t.negate();return e?n:t},Wf=e=>{const t=ga||(ga=Kf());let n=fn,s=Jt;const i=2**Us,o=i,r=Os(i-1),l=Os(Us);for(let a=0;a<Lc;a++){let d=Number(e&r);e>>=l,d>ro&&(d-=o,e+=1n);const g=a*ro,u=g,f=g+Math.abs(d)-1,v=a%2!==0,m=d<0;d===0?s=s.add(fa(v,t[u])):n=n.add(fa(m,t[f]))}return e!==0n&&me("invalid wnaf"),{p:n,f:s}},_i="openclaw-device-identity-v1";function ao(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Dc(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let o=0;o<s.length;o+=1)i[o]=s.charCodeAt(o);return i}function qf(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Pc(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return qf(new Uint8Array(t))}async function Gf(){const e=zf.randomSecretKey(),t=await Nf(e);return{deviceId:await Pc(t),publicKey:ao(t),privateKey:ao(e)}}async function Yo(){try{const n=localStorage.getItem(_i);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 Pc(Dc(s.publicKey));if(i!==s.deviceId){const o={...s,deviceId:i};return localStorage.setItem(_i,JSON.stringify(o)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Gf(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(_i,JSON.stringify(t)),e}async function Vf(e,t){const n=Dc(e),s=new TextEncoder().encode(t),i=await Bf(s,n);return ao(i)}async function Et(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 Jf(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Et(e)}catch(n){e.devicesError=String(n)}}async function Qf(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 Et(e)}catch(s){e.devicesError=String(s)}}async function Yf(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Yo(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&$c({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 Et(e)}catch(n){e.devicesError=String(n)}}async function Xf(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 Yo();t.deviceId===s.deviceId&&xc({deviceId:s.deviceId,role:t.role}),await Et(e)}catch(s){e.devicesError=String(s)}}function Zf(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 ep(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 Xo(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Zf(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);tp(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function tp(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=St(t.file??{}))}async function np(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=ep(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 Xo(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function sp(e,t,n){const s=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});ec(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function ip(e,t){const n=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});tc(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}function Fc(e){return e instanceof Error?e.message:String(e)}function pa(e,t,n){const s=t.trim();if(!s)return;const i={...e.marketMessages};n?i[s]=n:delete i[s],e.marketMessages=i}function xn(e){return e.state.installed?e.state.enabled?{kind:"disable",enabled:!1,successMessage:"Skill disabled."}:{kind:"enable",enabled:!0,successMessage:"Skill enabled."}:{kind:"install",successMessage:"Installed."}}async function Zo(e){if(!(!e.client||!e.connected||e.marketLoading)){e.marketLoading=!0,e.marketError=null;try{const t=await e.client.request("skills.market.catalog",{});e.marketCatalog=Array.isArray(t?.catalog)?t.catalog:[]}catch(t){e.marketError=Fc(t)}finally{e.marketLoading=!1}}}async function op(e,t){if(!e.client||!e.connected)return;const n=e.marketCatalog.find(i=>i.skillKey===t);if(!n)return;const s=xn(n);e.marketBusyKey=t,e.marketError=null;try{let i=s.successMessage;if(s.kind==="install"){const o=await e.client.request("skills.market.installOrEnable",{skillKey:t});i=o?.action==="already-installed"?"Already installed.":o?.message?.trim()||s.successMessage}else await e.client.request("skills.update",{skillKey:t,enabled:s.enabled});await Zo(e),pa(e,t,{kind:"success",message:i})}catch(i){const o=Fc(i);e.marketError=o,pa(e,t,{kind:"error",message:o})}finally{e.marketBusyKey=null}}function rp(e){return typeof e=="string"?e.trim()||void 0:!e||typeof e!="object"?void 0:e.primary?.trim()||void 0}const lo=2e5,ap=128e3,Bs="bitseek",lp="bitseek/AUTO",cp=32e3,dp=4096,up={"gpt-5.1-codex":4e5,"gpt-5.1-codex-mini":4e5,"gpt-5.1-codex-max":4e5,"gpt-5.1":4e5,"gpt-5.2":4e5,"claude-opus-4-6":1048576,"claude-opus-4-5":2e5,"gemini-3-pro":1048576,"gemini-3-flash":1048576,"glm-4.7":204800,"minimax-m2.5":2e5,"minimax-m2.5-highspeed":2e5,"minimax-m2.5-lightning":2e5};function co(e,t){return`${e}/${t}`}function gp(e){if(typeof e=="string")return e.trim()||void 0;if(!e||typeof e!="object")return;const t=e.primary;return typeof t!="string"?void 0:t.trim()||void 0}function fp(e){if(!e||typeof e!="object")return[];const t=e.fallbacks;return Array.isArray(t)?t.map(n=>typeof n=="string"?n.trim():"").filter(Boolean):[]}function er(e,t){const n=e.agents?.defaults,s=n?.model,i=n?.models,o=typeof s=="object"&&s!==null&&"fallbacks"in s?s.fallbacks:void 0;return{...e,agents:{...e.agents,defaults:{...n,model:{...o?{fallbacks:o}:{},primary:t},models:{...i,[t]:i?.[t]??{}}}}}}function pp(e){const t=e.trim();if(!t)return null;const n=t.indexOf("/");return n<=0||n>=t.length-1?null:{providerId:t.slice(0,n).trim(),modelId:t.slice(n+1).trim()}}function ri(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t>0?t:null}function hp(e){const t=e?.trim()??"";if(!t)return null;if(!/^\d+$/.test(t))throw new Error("Context window must be a positive integer.");const n=Number.parseInt(t,10);if(!Number.isFinite(n)||n<=0)throw new Error("Context window must be a positive integer.");return n}function mp(e){const t=e.config.models?.providers??{};let n=null;for(const[s,i]of Object.entries(t))if(!(!i||!Array.isArray(i.models)||s===e.selectedProviderId))for(const o of i.models){if(o.id!==e.modelId)continue;const r=ri(o.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function vp(e){if(!Array.isArray(e.catalogModels)||e.catalogModels.length===0)return null;const t=e.selectedProviderId.trim().toLowerCase();let n=null;for(const s of e.catalogModels){if((typeof s?.id=="string"?s.id.trim():"")!==e.modelId)continue;const o=typeof s?.provider=="string"?s.provider.trim().toLowerCase():"";if(o&&o===t)continue;const r=ri(s?.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function bp(e){const t=e.trim().toLowerCase();return t?up[t]??null:null}function Nc(e){const t=pp(e.modelRef);if(!t)return e.config;const n=e.config.models?.providers??{},s=n[t.providerId];if(!s||!Array.isArray(s.models))return e.config;let i=!1;const o=s.models.map(r=>{if(r.id!==t.modelId)return r;const l=ri(r.contextWindow);let a;if(t.providerId===Bs)a=ap;else{const d=mp({config:e.config,selectedProviderId:t.providerId,modelId:t.modelId}),g=vp({selectedProviderId:t.providerId,modelId:t.modelId,catalogModels:e.catalogModels}),u=bp(t.modelId),f=d??g??u,v=e.preferResolvedHint===!0&&f!=null;a=e.replaceCurrentContextWindow!==!0&&l!=null&&l!==cp&&!v?l:f??lo}return a===r.contextWindow?r:(i=!0,{...r,contextWindow:a})});return i?{...e.config,models:{...e.config.models,providers:{...n,[t.providerId]:{...s,models:o}}}}:e.config}function uo(e){const t=e.trim().toLowerCase();return t?t.replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,""):""}function Oc(e){try{const t=new URL(e),n=t.hostname.replace(/[^a-z0-9]+/gi,"-").toLowerCase(),s=t.port?`-${t.port}`:"",i=`custom-${n}${s}`;return uo(i)||"custom"}catch{return"custom"}}function yp(e){const t=e.config.models?.providers??{},n=uo(e.requestedProviderId?.trim()||"");if(n)return n;const s=Oc(e.baseUrl),i=uo(s)||"custom",o=t[i];if(!o?.baseUrl||o.baseUrl===e.baseUrl)return i;let r=2,l=`${i}-${r}`;for(;t[l];)r+=1,l=`${i}-${r}`;return l}function $p(e){try{new URL(e)}catch{throw new Error("Custom provider base URL must be a valid URL.")}}function xp(e){const t=e.alias.trim();if(!t)return;const n=e.cfg.agents?.defaults?.models??{},s=t.toLowerCase(),i=new Set((e.ignoreModelRefs??[]).map(o=>o.trim()).filter(Boolean));for(const[o,r]of Object.entries(n)){if(o===e.modelRef||i.has(o))continue;const l=r.alias,a=typeof l=="string"?l.trim().toLowerCase():"";if(a&&a===s)throw new Error(`Alias ${t} already points to ${o}.`)}}function wp(e){const t=e.baseUrl.trim();$p(t);const n=e.modelId.trim();if(!n)throw new Error("Custom provider model ID is required.");const s=hp(e.contextWindow),i=yp({config:e.config,baseUrl:t,requestedProviderId:e.providerId}),o=e.config.models?.providers??{},r=o[i],l=Array.isArray(r?.models)?r.models:[],a=e.previousModelId?.trim(),d=a?l.filter(E=>E.id!==a):l,g=d.some(E=>E.id===n),u={id:n,name:`${n} (Custom Provider)`,contextWindow:s??lo,maxTokens:dp,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!1},f=g?d.map(E=>E.id===n?{...E,contextWindow:s??ri(E.contextWindow)??lo}:E):[...d,u],v=e.replaceApiKey===!0?e.apiKey?.trim():void 0,m={...r??{baseUrl:t,models:[],api:"openai-completions"},baseUrl:t,api:"openai-completions",models:f.length>0?f:[u]};e.replaceApiKey===!0&&(v?m.apiKey=v:delete m.apiKey);const S=co(i,n),T=e.providerId?.trim()||i,M=a?co(T,a):void 0,I=e.alias?.trim()??"";xp({cfg:e.config,alias:I,modelRef:S,ignoreModelRefs:M?[M]:[]});const A={...e.config.agents?.defaults?.models};M&&M!==S&&delete A[M];const w={...A[S]};return I?w.alias=I:delete w.alias,A[S]=w,{config:{...e.config,models:{...e.config.models,mode:e.config.models?.mode??"merge",providers:{...o,[i]:m}},agents:{...e.config.agents,defaults:{...e.config.agents?.defaults,models:A}}},providerId:i,modelId:n}}function ha(e,t){const n=t?[[t,e[t]]]:Object.entries(e),s=[];for(const[i,o]of n)if(!(!o||!Array.isArray(o.models)))for(const r of o.models){const l=typeof r?.id=="string"?r.id.trim():"";l&&s.push(co(i,l))}return s}function Sp(e){const t=ha(e,Bs);return t.length>0?t[0]:e[Bs]?lp:ha(e)[0]}function kp(e){const t=e.providerId.trim();if(!t||t===Bs)return e.config;const n=e.config.models?.providers??{};if(!n[t])return e.config;const s={...n};delete s[t];const i=`${t}/`,o=e.config.agents?.defaults,r=o?.models??{},l={};for(const[m,S]of Object.entries(r))m.startsWith(i)||(l[m]=S);const a=gp(o?.model),d=fp(o?.model).filter(m=>!m.startsWith(i)),u=(a&&!a.startsWith(i)?a:void 0)??Sp(s);let f={...e.config,models:{...e.config.models,providers:s},agents:{...e.config.agents,defaults:{...o,...Object.keys(l).length>0?{models:l}:{}}}};if(Object.keys(l).length===0&&(f={...f,agents:{...f.agents,defaults:{...f.agents?.defaults,models:void 0}}}),!u)return f;f=er(f,u);const v=d.filter(m=>m!==u);return v.length===0?f:{...f,agents:{...f.agents,defaults:{...f.agents?.defaults,model:{primary:u,fallbacks:v}}}}}const pn="__new__",Yn="bitseek",Ap=4e3,Hs=new WeakMap;function Cp(e){const t=Hs.get(e);t&&(clearTimeout(t),Hs.delete(e))}function hn(e,t){if(e.modelsVerifyState=t,Cp(e),t?.tone!=="success")return;const n=t,s=setTimeout(()=>{e.modelsVerifyState===n&&(e.modelsVerifyState=null),Hs.delete(e)},Ap);Hs.set(e,s)}function Tp(e){const t=e instanceof Error?e.message:String(e);return/invalid models\.verify params/i.test(t)&&/providerId/i.test(t)}function rs(e){return St(e?.config??{})}function Ep(e){return!!(e&&e.api==="openai-completions"&&typeof e.baseUrl=="string"&&e.baseUrl.trim()&&Array.isArray(e.models)&&e.models.some(t=>typeof t?.id=="string"&&t.id.trim()))}function tr(e,t,n){return e.agents?.defaults?.models?.[`${t}/${n}`]?.alias?.trim()??""}function Uc(e){return e===Yn?"BitSeek":e}function _p(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t>0?t:null}function Bc(e){const t=e.models?.providers??{};return Object.entries(t).filter(([,n])=>Ep(n)).map(([n,s])=>[n,s]).toSorted(([n],[s])=>n===Yn?-1:s===Yn?1:n.localeCompare(s))}function Ip(e,t,n,s){const i=typeof s?.id=="string"?s.id.trim():"";if(!i)throw new Error(`Missing model id for provider ${t}.`);const o=tr(e,t,i),r=t===Yn?"bitseek":"custom",l=typeof s?.name=="string"?s.name.trim():"",a=Uc(t);return{modelRef:`${t}/${i}`,providerId:t,kind:r,title:o||l||i,subtitle:r==="bitseek"?"Built-in provider":a,modelId:i,contextWindow:_p(s.contextWindow),baseUrl:n.baseUrl,apiKeyConfigured:n.apiKey!==void 0}}function Hc(e){const t=[];for(const[n,s]of Bc(e))for(const i of s.models)typeof i?.id=="string"&&i.id.trim()&&t.push(Ip(e,n,s,i));return t}function Rp(e){const t=[];for(const[n,s]of Bc(e)){const i=Uc(n);for(const o of s.models){const r=typeof o?.id=="string"?o.id.trim():"";if(!r)continue;const l=`${n}/${r}`,a=tr(e,n,r),d=typeof o?.name=="string"?o.name.trim():"",g=a||d||r;t.push({modelRef:l,providerId:n,modelId:r,providerLabel:i,modelLabel:g,label:`${i} · ${g} (${l})`})}}return t}function zc(e,t){const n=t.kind==="bitseek";return{kind:t.kind,originalProviderId:t.providerId,originalModelId:t.modelId,providerIdHint:t.providerId,displayName:tr(e,t.providerId,t.modelId),baseUrl:t.baseUrl,apiKey:"",apiKeyConfigured:t.apiKeyConfigured,apiKeyChanged:!1,modelId:t.modelId,contextWindow:t.contextWindow!=null?String(t.contextWindow):"",contextWindowChanged:!1,saved:!0,canDelete:t.kind==="custom",readonlyModelIdentity:n}}function zs(){return{kind:"custom",originalProviderId:null,originalModelId:null,providerIdHint:"custom",displayName:"",baseUrl:"",apiKey:"",apiKeyConfigured:!1,apiKeyChanged:!1,modelId:"",contextWindow:"",contextWindowChanged:!1,saved:!1,canDelete:!1,readonlyModelIdentity:!1}}function ai(e){const t=rs(e.configSnapshot),n=Hc(t),s=Rp(t),i=rp(t.agents?.defaults?.model)??"",r=s.some(d=>d.modelRef===i)?i:s[0]?.modelRef??i,l=e.modelsSelectedProviderId===pn?pn:n.some(d=>d.modelRef===e.modelsSelectedProviderId)?e.modelsSelectedProviderId:n[0]?.modelRef??pn;if(e.modelsProviders=n,e.modelsSwitchableModels=s,e.modelsSelectedDefault=r,e.modelsSelectedProviderId=l,l===pn){e.modelsDraft=zs();return}const a=n.find(d=>d.modelRef===l);e.modelsDraft=a?zc(t,a):zs()}async function nr(e,t){const n=e.configSnapshot?.hash;return n?(await e.client?.request("config.set",{raw:$n(t),baseHash:n}),await Ae(e),ai(e),!0):(e.modelsError="Config hash missing; reload and retry.",!1)}async function jc(e){if(!(!e.client||!e.connected)){e.modelsLoading=!0,e.modelsError=null,e.modelsDefaultState=null;try{e.configSnapshot?.hash||await Ae(e),ai(e)}catch(t){e.modelsError=String(t)}finally{e.modelsLoading=!1}}}function ma(e,t){e.modelsSelectedProviderId=t,hn(e,null);const n=rs(e.configSnapshot);if(t===pn){e.modelsDraft=zs();return}const s=Hc(n).find(i=>i.modelRef===t);e.modelsDraft=s?zc(n,s):zs()}function Mp(e,t,n){if(!e.modelsDraft||t!=="apiKey"&&e.modelsDraft.readonlyModelIdentity)return;const s={...e.modelsDraft,[t]:n};t==="baseUrl"&&!s.originalProviderId&&(s.providerIdHint=Oc(n.trim())||"custom"),t==="apiKey"&&(s.apiKeyChanged=!0),t==="contextWindow"&&(s.contextWindowChanged=!0),e.modelsDraft=s,hn(e,null)}async function Lp(e){if(!(!e.client||!e.connected||!e.modelsDraft)){e.modelsSaving=!0,e.modelsError=null;try{const t=e.modelsDraft;if(t.kind==="bitseek"){if(!t.apiKeyChanged)return;const v=t.apiKey.trim();if(!v)throw new Error("BitSeek API key cannot be empty.");await e.client.request("models.auth.set",{providerId:Yn,apiKey:v}),e.modelsDraft={...t,apiKey:"",apiKeyChanged:!1,apiKeyConfigured:!0},e.modelsVerifyState={tone:"success",message:"BitSeek API key saved."};return}const n=rs(e.configSnapshot),s=t.originalProviderId&&t.originalModelId?`${t.originalProviderId}/${t.originalModelId}`:"",i=wp({config:n,baseUrl:t.baseUrl,modelId:t.modelId,contextWindow:t.contextWindow,providerId:t.originalProviderId??void 0,alias:t.displayName,apiKey:t.apiKeyChanged?t.apiKey:void 0,replaceApiKey:t.apiKeyChanged,previousModelId:t.originalModelId??void 0}),o=`${i.providerId}/${i.modelId}`;let r=[];try{const v=await e.client.request("models.list",{});r=Array.isArray(v?.models)?v.models:[]}catch{r=[]}const l=t.contextWindow.trim()==="",d=l||!t.contextWindowChanged?Nc({config:i.config,modelRef:o,catalogModels:r,preferResolvedHint:!0,replaceCurrentContextWindow:l}):i.config,g=e.modelsSelectedDefault===s?o:e.modelsSelectedDefault,u=er(d,g||o);if(!await nr(e,u))return;e.modelsSelectedProviderId=o,ai(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Dp(e){if(!(!e.client||!e.connected||!e.modelsSelectedDefault.trim())){e.modelsDefaultSaving=!0,e.modelsError=null,e.modelsDefaultState=null;try{const t=e.modelsSelectedDefault.trim();let n=[];try{const o=await e.client.request("models.list",{});n=Array.isArray(o?.models)?o.models:[]}catch{n=[]}const s=Nc({config:rs(e.configSnapshot),modelRef:t,catalogModels:n,preferResolvedHint:!0}),i=er(s,t);await nr(e,i),e.modelsDefaultState={tone:"success",message:"Default model saved."}}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsDefaultSaving=!1}}}async function Pp(e){if(!(!e.client||!e.connected||!e.modelsDraft?.originalProviderId)&&e.modelsDraft.kind==="custom"){e.modelsSaving=!0,e.modelsError=null;try{const t=kp({config:rs(e.configSnapshot),providerId:e.modelsDraft.originalProviderId});await nr(e,t),e.modelsSelectedProviderId=null,ai(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Fp(e){if(!e.client||!e.connected||!e.modelsDraft)return;const t=e.modelsDraft.apiKey.trim();e.modelsVerifyBusy=!0,hn(e,null),e.modelsError=null;try{const n={baseUrl:e.modelsDraft.baseUrl.trim(),modelId:e.modelsDraft.modelId.trim(),...e.modelsDraft.originalProviderId?{providerId:e.modelsDraft.originalProviderId}:{},...t?{apiKey:t}:{}};let s;try{s=await e.client.request("models.verify",n)}catch(i){if(!n.providerId||!Tp(i))throw i;const{providerId:o,...r}=n;s=await e.client.request("models.verify",r)}if(s.ok){hn(e,{tone:"success",message:s.status!==void 0?`Verification successful (HTTP ${s.status}).`:"Verification successful."});return}hn(e,{tone:"danger",message:s.status!==void 0?`Verification failed (HTTP ${s.status}).`:s.error||"Verification failed."})}catch(n){hn(e,{tone:"danger",message:n instanceof Error?n.message:String(n)})}finally{e.modelsVerifyBusy=!1}}function Np(e,t){e.modelsSelectedDefault=t,e.modelsDefaultState=null}function Op(){return pn}async function sr(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??Ne(e.sessionsFilterActive,0),o=t?.limit??Ne(e.sessionsFilterLimit,0),r={includeGlobal:n,includeUnknown:s};i>0&&(r.activeMinutes=i),o>0&&(r.limit=o);const l=await e.client.request("sessions.list",r);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Up(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 Bp(e,t){if(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
127
|
-
|
|
128
|
-
Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoading=!0,e.sessionsError=null;try{return await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),!0}catch(s){return e.sessionsError=String(s),!1}finally{e.sessionsLoading=!1}}async function Hp(e,t){return await Bp(e,t)?(await Yt(e),!0):!1}function wn(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function li(e){return e instanceof Error?e.message:String(e)}async function as(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=li(n)}finally{e.skillsLoading=!1}}}function zp(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function jp(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 as(e),wn(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=li(s);e.skillsError=i,wn(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Kp(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 as(e),wn(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=li(n);e.skillsError=s,wn(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Wp(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 as(e),wn(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const o=li(i);e.skillsError=o,wn(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const qp=[{label:"chat",tabs:["chat"]},{label:"control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"agent",tabs:["agents","skills","market","nodes"]},{label:"settings",tabs:["models","config","debug","logs"]}],Kc={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",market:"/market",nodes:"/nodes",chat:"/chat",models:"/models",config:"/config",debug:"/debug",logs:"/logs"},Wc=new Map(Object.entries(Kc).map(([e,t])=>[t,e]));function Xt(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Xn(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 ci(e,t=""){const n=Xt(t),s=Kc[e];return n?`${n}${s}`:s}function qc(e,t=""){const n=Xt(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=Xn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Wc.get(i)??null}function Gc(e){let t=Xn(e);if(t.endsWith("/index.html")&&(t=Xn(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(Wc.has(i)){const o=n.slice(0,s);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function Gp(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"market":return"puzzle";case"nodes":return"monitor";case"models":return"folder";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function go(e){return p(`tabs.${e}`)}function Vp(e){return p(`subtitles.${e}`)}const Vc="openclaw.control.settings.v1";function Jp(){const t={gatewayUrl:(()=>{const n=location.protocol==="https:"?"wss":"ws",s=typeof window<"u"&&typeof window.__OPENCLAW_CONTROL_UI_BASE_PATH__=="string"&&window.__OPENCLAW_CONTROL_UI_BASE_PATH__.trim(),i=s?Xt(s):Gc(location.pathname);return`${n}://${location.host}${i}`})(),token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"light",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(Vc);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,locale:Xl(s.locale)?s.locale:void 0}}catch{return t}}function Qp(e){localStorage.setItem(Vc,JSON.stringify(e))}const hs=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Yp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,ms=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Xp=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const o=i.documentElement,r=i,l=Yp();if(!!r.startViewTransition&&!l){let d=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")d=hs(n.pointerClientX/window.innerWidth),g=hs(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(d=hs((u.left+u.width/2)/window.innerWidth),g=hs((u.top+u.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${d*100}%`),o.style.setProperty("--theme-switch-y",`${g*100}%`),o.classList.add("theme-transition");try{const u=r.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>ms(o)):ms(o)}catch{ms(o),t()}return}t(),ms(o)};function Zp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ir(e){return e==="system"?Zp():e}function At(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,Qp(n),t.theme!==e.theme&&(e.theme=t.theme,di(e,ir(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Jc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&At(e,{...e.settings,lastActiveSessionKey:n})}function eh(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"),o=n.get("password")??s.get("password"),r=n.get("session")??s.get("session"),l=n.get("gatewayUrl")??s.get("gatewayUrl");let a=!1;if(i!=null){const g=i.trim();g&&g!==e.settings.token&&At(e,{...e.settings,token:g}),n.delete("token"),s.delete("token"),a=!0}if(o!=null&&(n.delete("password"),s.delete("password"),a=!0),r!=null){const g=r.trim();g&&(e.sessionKey=g,At(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"),a=!0}if(!a)return;t.search=n.toString();const d=s.toString();t.hash=d?`#${d}`:"",window.history.replaceState({},"",t.toString())}function th(e,t){Xc(e,t,{refreshPolicy:"always",syncUrl:!0})}function nh(e,t,n){Xp({nextTheme:t,applyTheme:()=>{e.theme=t,At(e,{...e.settings,theme:t}),di(e,ir(t))},context:n,currentTheme:e.theme})}async function Qc(e){if(e.tab==="overview"&&await ed(e),e.tab==="channels"&&await dh(e),e.tab==="instances"&&await sr(e),e.tab==="sessions"&&await Yt(e),e.tab==="cron"&&await js(e),e.tab==="skills"&&await as(e),e.tab==="market"&&await Zo(e),e.tab==="agents"){await Bo(e),await Hn(e),await Ae(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&fc(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(gc(e,n),e.agentsPanel==="skills"&&Ts(e,n),e.agentsPanel==="channels"&&Me(e,!1),e.agentsPanel==="cron"&&js(e))}e.tab==="models"&&await jc(e),e.tab==="nodes"&&(await si(e),await Et(e),await Ae(e),await Xo(e)),e.tab==="chat"&&(await fd(e),ns(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await nc(e),await Ae(e)),e.tab==="debug"&&(await ni(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Uo(e,{reset:!0}),ac(e,!0))}function sh(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Xt(e):Gc(window.location.pathname)}function ih(e){e.theme=e.settings.theme??"system",di(e,ir(e.theme))}function di(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function oh(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"&&di(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function rh(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 ah(e,t){if(typeof window>"u")return;const n=qc(window.location.pathname,e.basePath)??"chat";Yc(e,n),Zc(e,n,t)}function lh(e){if(typeof window>"u")return;const t=qc(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,At(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Yc(e,t)}function Yc(e,t){Xc(e,t,{refreshPolicy:"connected"})}function Xc(e,t,n){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?lc(e):cc(e),t==="debug"?dc(e):uc(e),(n.refreshPolicy==="always"||e.connected)&&Qc(e),n.syncUrl&&Zc(e,t,!1)}function Zc(e,t,n){if(typeof window>"u")return;const s=Xn(ci(t,e.basePath)),i=Xn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),i!==s&&(o.pathname=s),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}function ch(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 ed(e){await Promise.all([Me(e,!1),sr(e),Yt(e),is(e),ni(e)])}async function dh(e){await Promise.all([Me(e,!0),nc(e),Ae(e)])}async function js(e){const t=e;if(await Promise.all([Me(e,!1),is(t),ii(t),ef(t)]),t.cronRunsScope==="all"){await yt(t,null);return}t.cronRunsJobId&&await yt(t,t.cronRunsJobId)}const va=50,uh=80,gh=12e4;function Oe(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function an(e,t){const n=Oe(t);if(!n)return null;const s=Oe(e);if(s){const o=`${s}/`;if(n.toLowerCase().startsWith(o.toLowerCase())){const r=n.slice(o.length).trim();if(r)return`${s}/${r}`}return`${s}/${n}`}const i=n.indexOf("/");if(i>0){const o=n.slice(0,i).trim(),r=n.slice(i+1).trim();if(o&&r)return`${o}/${r}`}return n}function fh(e){return Array.isArray(e)?e.map(t=>Oe(t)).filter(t=>!!t):[]}function ph(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const s=n,i=Oe(s.provider),o=Oe(s.model);if(!i||!o)continue;const r=Oe(s.reason)?.replace(/_/g," ")??Oe(s.code)??(typeof s.status=="number"?`HTTP ${s.status}`:null)??Oe(s.error)??"error";t.push({provider:i,model:o,reason:r})}return t}function hh(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 o=i;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
129
|
-
`)}function
|
|
130
|
-
|
|
131
|
-
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function
|
|
132
|
-
`);return/<<<EXTERNAL_UNTRUSTED_CONTENT|UNTRUSTED channel metadata \(|Source:\s+/.test(n)}function
|
|
133
|
-
`),n=[];let s=!1,i=!1;for(let o=0;o<t.length;o++){const r=t[o];if(!s&&
|
|
134
|
-
`).replace(/^\n+/,"").replace(/\n+$/,"")}const
|
|
135
|
-
`);const i=
|
|
136
|
-
`):null}function
|
|
137
|
-
`)}return typeof t.text=="string"?t.text:null}function
|
|
138
|
-
`):""}let xa=!1;function wa(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 Dh(){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 Ph(){xa||(xa=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function gi(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),wa(t)}return Ph(),wa(Dh())}const Fh=/^\s*NO_REPLY\s*$/;function zn(e){return Fh.test(e)}function Is(e){if(!e||typeof e!="object")return!1;const t=e;if((typeof t.role=="string"?t.role.toLowerCase():"")!=="assistant")return!1;if(typeof t.text=="string")return zn(t.text);const s=Ks(e);return typeof s=="string"&&zn(s)}async function Zn(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}),n=Array.isArray(t.messages)?t.messages:[];e.chatMessages=n.filter(s=>!Is(s)),e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Nh(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}function ad(e,t){if(!e||typeof e!="object")return null;const n=e,s=n.role;if(typeof s=="string"){if((t.roleCaseSensitive?s:s.toLowerCase())!=="assistant")return null}else if(t.roleRequirement==="required")return null;return t.requireContentArray?Array.isArray(n.content)?n:null:!("content"in n)&&!(t.allowTextField&&"text"in n)?null:n}function Oh(e){return ad(e,{roleRequirement:"required",roleCaseSensitive:!0,requireContentArray:!0})}function Sa(e){return ad(e,{roleRequirement:"optional",allowTextField:!0})}async function Uh(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 o=Date.now(),r=[];if(s&&r.push({type:"text",text:s}),i)for(const d of n)r.push({type:"image",source:{type:"base64",media_type:d.mimeType,data:d.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:r,timestamp:o}],e.chatSending=!0,e.lastError=null;const l=gi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=o;const a=i?n.map(d=>{const g=Nh(d.dataUrl);return g?{type:"image",mimeType:g.mimeType,content:g.content}:null}).filter(d=>d!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:a}),l}catch(d){const g=String(d);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 Bh(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 Hh(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId){if(t.state==="final"){const n=Sa(t.message);return n&&!Is(n)?(e.chatMessages=[...e.chatMessages,n],null):"final"}return null}if(t.state==="delta"){const n=Ks(t.message);if(typeof n=="string"&&!zn(n)){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else if(t.state==="final"){const n=Sa(t.message);n&&!Is(n)?e.chatMessages=[...e.chatMessages,n]:e.chatStream?.trim()&&!zn(e.chatStream)&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:e.chatStream}],timestamp:Date.now()}]),e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else if(t.state==="aborted"){const n=Oh(t.message);if(n&&!Is(n))e.chatMessages=[...e.chatMessages,n];else{const s=e.chatStream??"";s.trim()&&!zn(s)&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:s}],timestamp:Date.now()}])}e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const ld=120;function cd(e){return e.chatSending||!!e.chatRunId}function zh(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 jh(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 dd(e){e.connected&&(e.chatMessage="",await Bh(e))}function Kh(e,t,n,s){const i=t.trim(),o=!!(n&&n.length>0);!i&&!o||(e.chatQueue=[...e.chatQueue,{id:gi(),text:i,createdAt:Date.now(),attachments:o?n?.map(r=>({...r})):void 0,refreshSessions:s}])}async function ud(e,t,n){ui(e);const s=await Uh(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Jc(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),ns(e),i&&!e.chatRunId&&gd(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function gd(e){if(!e.connected||cd(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await ud(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function Wh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function qh(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],l=r.length>0;if(!i&&!l)return;if(zh(i)){await dd(e);return}const a=jh(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),cd(e)){Kh(e,i,r,a);return}await ud(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:a})}async function fd(e,t){await Promise.all([Zn(e),Yt(e,{activeMinutes:ld}),po(e)]),t?.scheduleScroll!==!1&&ns(e)}const Gh=gd;function Vh(e){const t=Mg(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Jh(e,t){const n=Xt(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function po(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Vh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Jh(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),o=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const Qh="update.available";function Yh(e){if(!e||e.state!=="final")return!1;if(!e.message||typeof e.message!="object")return!0;const t=e.message,n=typeof t.role=="string"?t.role.toLowerCase():"";return!!(n&&n!=="assistant")}function ka(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}const Xh=50,Zh=200,em="Assistant";function or(e){const t=ka(e?.name,Xh)??em,n=ka(e?.avatar??void 0,Zh)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}async function pd(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 o=or(i);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function ho(e){return typeof e=="object"&&e!==null}function tm(e){if(!ho(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!ho(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,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!o?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:o}}function nm(e){if(!ho(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 hd(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function sm(e,t){const n=hd(e).filter(s=>s.id!==t.id);return n.push(t),n}function Aa(e,t){return hd(e).filter(n=>n.id!==t)}function im(e){const t=e.scopes.join(","),n=e.token??"";return["v2",e.deviceId,e.clientId,e.clientMode,e.role,t,String(e.signedAtMs),n,e.nonce].join("|")}const md={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"},Ca=md,mo={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(md));new Set(Object.values(mo));const xe={AUTH_REQUIRED:"AUTH_REQUIRED",AUTH_UNAUTHORIZED:"AUTH_UNAUTHORIZED",AUTH_TOKEN_MISSING:"AUTH_TOKEN_MISSING",AUTH_TOKEN_MISMATCH:"AUTH_TOKEN_MISMATCH",AUTH_TOKEN_NOT_CONFIGURED:"AUTH_TOKEN_NOT_CONFIGURED",AUTH_PASSWORD_MISSING:"AUTH_PASSWORD_MISSING",AUTH_PASSWORD_MISMATCH:"AUTH_PASSWORD_MISMATCH",AUTH_PASSWORD_NOT_CONFIGURED:"AUTH_PASSWORD_NOT_CONFIGURED",AUTH_DEVICE_TOKEN_MISMATCH:"AUTH_DEVICE_TOKEN_MISMATCH",AUTH_RATE_LIMITED:"AUTH_RATE_LIMITED",AUTH_TAILSCALE_IDENTITY_MISSING:"AUTH_TAILSCALE_IDENTITY_MISSING",AUTH_TAILSCALE_PROXY_MISSING:"AUTH_TAILSCALE_PROXY_MISSING",AUTH_TAILSCALE_WHOIS_FAILED:"AUTH_TAILSCALE_WHOIS_FAILED",AUTH_TAILSCALE_IDENTITY_MISMATCH:"AUTH_TAILSCALE_IDENTITY_MISMATCH",CONTROL_UI_DEVICE_IDENTITY_REQUIRED:"CONTROL_UI_DEVICE_IDENTITY_REQUIRED",DEVICE_IDENTITY_REQUIRED:"DEVICE_IDENTITY_REQUIRED",PAIRING_REQUIRED:"PAIRING_REQUIRED"};function om(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.code;return typeof t=="string"&&t.trim().length>0?t:null}class Ta extends Error{constructor(t){super(t.message),this.name="GatewayRequestError",this.gatewayCode=t.code,this.details=t.details}}function rm(e){return om(e?.details)}const am=4008;class lm{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.pendingConnectError=void 0,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??""),s=this.pendingConnectError;this.pendingConnectError=void 0,this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n,error:s}),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,o=!1,r=this.opts.token;if(t){i=await Yo();const g=Sf({deviceId:i.deviceId,role:s})?.token;r=g??this.opts.token,o=!!(g&&this.opts.token)}const l=r||this.opts.password?{token:r,password:this.opts.password}:void 0;let a;if(t&&i){const g=Date.now(),u=this.connectNonce??"",f=im({deviceId:i.deviceId,clientId:this.opts.clientName??Ca.CONTROL_UI,clientMode:this.opts.mode??mo.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:r??null,nonce:u}),v=await Vf(i.privateKey,f);a={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:g,nonce:u}}const d={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ca.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??mo.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:a,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",d).then(g=>{g?.auth?.deviceToken&&i&&$c({deviceId:i.deviceId,role:g.auth.role??s,token:g.auth.deviceToken,scopes:g.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(g)}).catch(g=>{g instanceof Ta?this.pendingConnectError={code:g.gatewayCode,message:g.message,details:g.details}:this.pendingConnectError=void 0,o&&i&&xc({deviceId:i.deviceId,role:s}),this.ws?.close(am,"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 r=i.payload,l=r&&typeof r.nonce=="string"?r.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const o=typeof i.seq=="number"?i.seq:null;o!==null&&(this.lastSeq!==null&&o>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:o}),this.lastSeq=o);try{this.opts.onEvent?.(i)}catch(r){console.error("[gateway] event handler error:",r)}return}if(s.type==="res"){const i=n,o=this.pending.get(i.id);if(!o)return;this.pending.delete(i.id),i.ok?o.resolve(i.payload):o.reject(new Ta({code:i.error?.code??"UNAVAILABLE",message:i.error?.message??"request failed",details:i.error?.details}));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=gi(),i={type:"req",id:s,method:t,params:n},o=new Promise((r,l)=>{this.pending.set(s,{resolve:a=>r(a),reject:l})});return this.ws.send(JSON.stringify(i)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Mi(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",o=t.defaultAgentId?.trim();return n==="main"||n===i||o&&(n===`agent:${o}:main`||n===`agent:${o}:${i}`)?s:n}function cm(e,t){if(!t?.mainSessionKey)return;const n=Mi(e.sessionKey,t),s=Mi(e.settings.sessionKey,t),i=Mi(e.settings.lastActiveSessionKey,t),o=n||s||e.sessionKey,r={...e.settings,sessionKey:s||o,lastActiveSessionKey:i||o},l=r.sessionKey!==e.settings.sessionKey||r.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),l&&At(e,r)}function vd(e){e.lastError=null,e.lastErrorCode=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=e.client,n=new lm({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",instanceId:e.clientInstanceId,onHello:s=>{e.client===n&&(e.connected=!0,e.lastError=null,e.lastErrorCode=null,e.hello=s,pm(e,s),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,ui(e),pd(e),Bo(e),Hn(e),Ae(e),si(e,{quiet:!0}),Et(e,{quiet:!0}),Qc(e))},onClose:({code:s,reason:i,error:o})=>{if(e.client===n)if(e.connected=!1,e.lastErrorCode=rm(o)??(typeof o?.code=="string"?o.code:null),s!==1012){if(o?.message){e.lastError=o.message;return}e.lastError=`disconnected (${s}): ${i||"no reason"}`}else e.lastError=null,e.lastErrorCode=null},onEvent:s=>{e.client===n&&dm(e,s)},onGap:({expected:s,received:i})=>{e.client===n&&(e.lastError=`event gap detected (expected seq ${s}, got ${i}); refresh recommended`,e.lastErrorCode=null)}});e.client=n,t?.stop(),n.start()}function dm(e,t){try{fm(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function um(e,t,n){if(n!=="final"&&n!=="error"&&n!=="aborted")return;ui(e),Gh(e);const s=t?.runId;!s||!e.refreshSessionsAfterChat.has(s)||(e.refreshSessionsAfterChat.delete(s),n==="final"&&Yt(e,{activeMinutes:ld}))}function gm(e,t){t?.sessionKey&&Jc(e,t.sessionKey);const n=Hh(e,t);um(e,t,n),n==="final"&&Yh(t)&&Zn(e)}function fm(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;kh(e,t.payload);return}if(t.event==="chat"){gm(e,t.payload);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"&&js(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Et(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=tm(t.payload);if(n){e.execApprovalQueue=sm(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Aa(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=nm(t.payload);n&&(e.execApprovalQueue=Aa(e.execApprovalQueue,n.id));return}if(t.event===Qh){const n=t.payload;e.updateAvailable=n?.updateAvailable??null}}function pm(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&cm(e,n.sessionDefaults),e.updateAvailable=n?.updateAvailable??null}const Ea="/__openclaw/control-ui-config.json";async function hm(e){if(typeof window>"u"||typeof fetch!="function")return;const t=Xt(e.basePath??""),n=t?`${t}${Ea}`:Ea;try{const s=await fetch(n,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin"});if(!s.ok)return;const i=await s.json(),o=or({agentId:i.assistantAgentId??null,name:i.assistantName,avatar:i.assistantAvatar??null});e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function mm(e){e.basePath=sh(),hm(e),eh(e),ah(e,!0),ih(e),oh(e),window.addEventListener("popstate",e.popStateHandler),vd(e),jg(e),e.tab==="logs"&&lc(e),e.tab==="debug"&&dc(e)}function vm(e){Fg(e)}function bm(e){window.removeEventListener("popstate",e.popStateHandler),Kg(e),cc(e),uc(e),e.client?.stop(),e.client=null,e.connected=!1,rh(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function ym(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;ns(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&ac(e,t.has("tab")||t.has("logsAutoFollow"))}}const bd="openclaw.control.usage.date-params.v1",$m="__default__",xm=/unexpected property ['"]mode['"]/i,wm=/unexpected property ['"]utcoffset['"]/i,Sm=/invalid sessions\.usage params/i;let Li=null;function yd(){return typeof window<"u"&&window.localStorage?window.localStorage:typeof localStorage<"u"?localStorage:null}function km(){const e=yd();if(!e)return new Set;try{const t=e.getItem(bd);if(!t)return new Set;const n=JSON.parse(t);return!n||!Array.isArray(n.unsupportedGatewayKeys)?new Set:new Set(n.unsupportedGatewayKeys.filter(s=>typeof s=="string").map(s=>s.trim()).filter(Boolean))}catch{return new Set}}function Am(e){const t=yd();if(t)try{t.setItem(bd,JSON.stringify({unsupportedGatewayKeys:Array.from(e)}))}catch{}}function $d(){return Li||(Li=km()),Li}function Cm(e){const t=e?.trim();if(!t)return $m;try{const n=new URL(t),s=n.pathname==="/"?"":n.pathname;return`${n.protocol}//${n.host}${s}`.toLowerCase()}catch{return t.toLowerCase()}}function xd(e){return Cm(e.settings?.gatewayUrl)}function Tm(e){return!$d().has(xd(e))}function Em(e){const t=$d();t.add(xd(e)),Am(t)}function _m(e){const t=wd(e);return Sm.test(t)&&(xm.test(t)||wm.test(t))}const Im=e=>{const t=-e,n=t>=0?"+":"-",s=Math.abs(t),i=Math.floor(s/60),o=s%60;return o===0?`UTC${n}${i}`:`UTC${n}${i}:${o.toString().padStart(2,"0")}`},Rm=(e,t)=>{if(t)return e==="utc"?{mode:"utc"}:{mode:"specific",utcOffset:Im(new Date().getTimezoneOffset())}};function wd(e){if(typeof e=="string")return e;if(e instanceof Error&&typeof e.message=="string"&&e.message.trim())return e.message;if(e&&typeof e=="object")try{const t=JSON.stringify(e);if(t)return t}catch{}return"request failed"}async function vo(e,t){const n=e.client;if(!(!n||!e.connected)&&!e.usageLoading){e.usageLoading=!0,e.usageError=null;try{const s=t?.startDate??e.usageStartDate,i=t?.endDate??e.usageEndDate,o=async a=>{const d=Rm(e.usageTimeZone,a);return await Promise.all([n.request("sessions.usage",{startDate:s,endDate:i,...d,limit:1e3,includeContextWeight:!0}),n.request("usage.cost",{startDate:s,endDate:i,...d})])},r=(a,d)=>{a&&(e.usageResult=a),d&&(e.usageCostSummary=d)},l=Tm(e);try{const[a,d]=await o(l);r(a,d)}catch(a){if(l&&_m(a)){Em(e);const[d,g]=await o(!1);r(d,g)}else throw a}}catch(s){e.usageError=wd(s)}finally{e.usageLoading=!1}}}async function Mm(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 Lm(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:1e3});n&&Array.isArray(n.logs)&&(e.usageSessionLogs=n.logs)}catch{e.usageSessionLogs=null}finally{e.usageSessionLogsLoading=!1}}}const Dm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),Ws=e=>e.trim().toLowerCase(),Pm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},Ut=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},rr=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const o=s.slice(0,i),r=s.slice(i+1);return{key:o,value:r,raw:s}}return{value:s,raw:s}}),Fm=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),_a=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)},Ia=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)},Nm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),Om=(e,t)=>{const n=Ws(t.value??"");if(!n)return!0;if(!t.key)return Fm(e).some(i=>i.includes(n));switch(Ws(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 _a(e).some(i=>i.includes(n));case"model":return Ia(e).some(i=>i.includes(n));case"tool":return Nm(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=Pm(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 Ia(e).length>0;case"provider":return _a(e).length>0;default:return!0}case"mintokens":{const i=Ut(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=Ut(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=Ut(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=Ut(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=Ut(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=Ut(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},Um=(e,t)=>{const n=rr(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const o of n){if(!o.key)continue;const r=Ws(o.key);if(!Dm.has(r)){s.push(`Unknown filter: ${o.key}`);continue}if(o.value===""&&s.push(`Missing value for ${o.key}`),r==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);o.value&&!l.has(Ws(o.value))&&s.push(`Unknown has:${o.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(r)&&o.value&&Ut(o.value)===null&&s.push(`Invalid number for ${o.key}`)}return{sessions:e.filter(o=>n.every(r=>Om(o,r))),warnings:s}};function Sd(e){const t=e.split(`
|
|
126
|
+
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${o}.log`,i.click(),URL.revokeObjectURL(s)}function Ng(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 ti(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 o=s;e.debugModels=Array.isArray(o?.models)?o?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Og(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 Ug=2e3,Bg=new Set(["trace","debug","info","warn","error","fatal"]);function Hg(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 zg(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Bg.has(t)?t:null}function jg(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=zg(n?.logLevelName??n?.level),o=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,r=Hg(o);let l=null;r&&(typeof r.subsystem=="string"?l=r.subsystem:typeof r.module=="string"&&(l=r.module)),!l&&o&&o.length<120&&(l=o);let a=null;return typeof t[1]=="string"?a=t[1]:!r&&typeof t[0]=="string"?a=t[0]:typeof t.message=="string"&&(a=t.message),{raw:e,time:s,level:i,subsystem:l,message:a??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Oo(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}),o=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(jg),r=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-Ug),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 ni(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 Kg(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{ni(e,{quiet:!0})},5e3))}function Wg(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function ac(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Oo(e,{quiet:!0})},2e3))}function lc(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function cc(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&ti(e)},3e3))}function dc(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function uc(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 gc(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 Cs(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 Uo(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}}}async function Hn(e,t){if(!(!e.client||!e.connected)&&!e.toolsCatalogLoading){e.toolsCatalogLoading=!0,e.toolsCatalogError=null;try{const n=await e.client.request("tools.catalog",{agentId:t??e.agentsSelectedId??void 0,includePlugins:!0});n&&(e.toolsCatalogResult=n)}catch(n){e.toolsCatalogError=String(n)}finally{e.toolsCatalogLoading=!1}}}const qg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Fs={name:"",description:"",agentId:"",sessionKey:"",clearAgent:!1,enabled:!0,deleteAfterRun:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds",sessionTarget:"isolated",wakeMode:"now",payloadKind:"agentTurn",payloadText:"",payloadModel:"",payloadThinking:"",payloadLightContext:!1,deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",deliveryAccountId:"",deliveryBestEffort:!1,failureAlertMode:"inherit",failureAlertAfter:"2",failureAlertCooldownSeconds:"3600",failureAlertChannel:"last",failureAlertTo:"",failureAlertDeliveryMode:"announce",failureAlertAccountId:"",timeoutSeconds:""};function Bo(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),o=Math.floor(s%3600/60),r=s%60;if(i>=24){const l=Math.floor(i/24),a=i%24;return a>0?`${l}d${n}${a}h`:`${l}d`}return i>0?o>0?`${i}h${n}${o}m`:`${i}h`:o>0?r>0?`${o}m${n}${r}s`:`${o}m`:`${r}s`}function Ho(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 ne(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),o=s>=0,r=Math.round(i/1e3);if(r<60)return o?"just now":"in <1m";const l=Math.round(r/60);if(l<60)return o?`${l}m ago`:`in ${l}m`;const a=Math.round(l/60);if(a<48)return o?`${a}h ago`:`in ${a}h`;const d=Math.round(a/24);return o?`${d}d ago`:`in ${d}d`}function eo(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const o=(i.index??0)+i[1].length;t.push({start:o,end:o+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const o=i.index??0,r=o+i[0].length;t.some(a=>o>=a.start&&r<=a.end)||t.push({start:o,end:r})}return t.sort((i,o)=>i.start-o.start),t}function to(e,t){return t.some(n=>e>=n.start&&e<n.end)}const Gg=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,fs=/<\s*\/?\s*final\b[^<>]*>/gi,na=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Vg(e,t){return e.trimStart()}function Jg(e,t){if(!e||!Gg.test(e))return e;let n=e;if(fs.test(n)){fs.lastIndex=0;const l=[],a=eo(n);for(const d of n.matchAll(fs)){const g=d.index??0;l.push({start:g,length:d[0].length,inCode:to(g,a)})}for(let d=l.length-1;d>=0;d--){const g=l[d];g.inCode||(n=n.slice(0,g.start)+n.slice(g.start+g.length))}}else fs.lastIndex=0;const s=eo(n);na.lastIndex=0;let i="",o=0,r=!1;for(const l of n.matchAll(na)){const a=l.index??0,d=l[1]==="/";to(a,s)||(r?d&&(r=!1):(i+=n.slice(o,a),d||(r=!0)),o=a+l[0].length)}return i+=n.slice(o),Vg(i)}const sa=/<\s*(\/?)\s*relevant[-_]memories\b[^<>]*>/gi,Qg=/<\s*\/?\s*relevant[-_]memories\b/i;function Yg(e){if(!e||!Qg.test(e))return e;sa.lastIndex=0;const t=eo(e);let n="",s=0,i=!1;for(const o of e.matchAll(sa)){const r=o.index??0;if(to(r,t))continue;const l=o[1]==="/";i?l&&(i=!1):(n+=e.slice(s,r),l||(i=!0)),s=r+o[0].length}return i||(n+=e.slice(s)),n}function Xg(e){const t=Jg(e);return Yg(t).trimStart()}function kt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function no(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function so(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function fc(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 Ne(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Zg(e){return Xg(e)}const Ts="last";function ef(e){return e.sessionTarget==="isolated"&&e.payloadKind==="agentTurn"}function zo(e){return e.deliveryMode!=="announce"||ef(e)?e:{...e,deliveryMode:"none"}}function ns(e){const t={};if(e.name.trim()||(t.name="cron.errors.nameRequired"),e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);Number.isFinite(n)||(t.scheduleAt="cron.errors.scheduleAtInvalid")}else if(e.scheduleKind==="every")Ne(e.everyAmount,0)<=0&&(t.everyAmount="cron.errors.everyAmountInvalid");else if(e.cronExpr.trim()||(t.cronExpr="cron.errors.cronExprRequired"),!e.scheduleExact){const n=e.staggerAmount.trim();n&&Ne(n,0)<=0&&(t.staggerAmount="cron.errors.staggerAmountInvalid")}if(e.payloadText.trim()||(t.payloadText=e.payloadKind==="systemEvent"?"cron.errors.systemTextRequired":"cron.errors.agentMessageRequired"),e.payloadKind==="agentTurn"){const n=e.timeoutSeconds.trim();n&&Ne(n,0)<=0&&(t.timeoutSeconds="cron.errors.timeoutInvalid")}if(e.deliveryMode==="webhook"){const n=e.deliveryTo.trim();n?/^https?:\/\//i.test(n)||(t.deliveryTo="cron.errors.webhookUrlInvalid"):t.deliveryTo="cron.errors.webhookUrlRequired"}if(e.failureAlertMode==="custom"){const n=e.failureAlertAfter.trim();if(n){const i=Ne(n,0);(!Number.isFinite(i)||i<=0)&&(t.failureAlertAfter="Failure alert threshold must be greater than 0.")}const s=e.failureAlertCooldownSeconds.trim();if(s){const i=Ne(s,-1);(!Number.isFinite(i)||i<0)&&(t.failureAlertCooldownSeconds="Cooldown must be 0 or greater.")}}return t}function pc(e){return Object.keys(e).length>0}async function ss(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 tf(e){if(!(!e.client||!e.connected))try{const n=(await e.client.request("models.list",{}))?.models;if(!Array.isArray(n)){e.cronModelSuggestions=[];return}const s=n.map(i=>{if(!i||typeof i!="object")return"";const o=i.id;return typeof o=="string"?o.trim():""}).filter(Boolean);e.cronModelSuggestions=Array.from(new Set(s)).toSorted((i,o)=>i.localeCompare(o))}catch{e.cronModelSuggestions=[]}}async function si(e){return await jo(e,{append:!1})}function hc(e){const t=typeof e.totalRaw=="number"&&Number.isFinite(e.totalRaw)?Math.max(0,Math.floor(e.totalRaw)):e.pageCount,n=typeof e.limitRaw=="number"&&Number.isFinite(e.limitRaw)?Math.max(1,Math.floor(e.limitRaw)):Math.max(1,e.pageCount),s=typeof e.offsetRaw=="number"&&Number.isFinite(e.offsetRaw)?Math.max(0,Math.floor(e.offsetRaw)):0,i=typeof e.hasMoreRaw=="boolean"?e.hasMoreRaw:s+e.pageCount<Math.max(t,s+e.pageCount),o=typeof e.nextOffsetRaw=="number"&&Number.isFinite(e.nextOffsetRaw)?Math.max(0,Math.floor(e.nextOffsetRaw)):i?s+e.pageCount:null;return{total:t,limit:n,offset:s,hasMore:i,nextOffset:o}}async function jo(e,t){if(!e.client||!e.connected||e.cronLoading||e.cronJobsLoadingMore)return;const n=t?.append===!0;if(n){if(!e.cronJobsHasMore)return;e.cronJobsLoadingMore=!0}else e.cronLoading=!0;e.cronError=null;try{const s=n?Math.max(0,e.cronJobsNextOffset??e.cronJobs.length):0,i=await e.client.request("cron.list",{includeDisabled:e.cronJobsEnabledFilter==="all",limit:e.cronJobsLimit,offset:s,query:e.cronJobsQuery.trim()||void 0,enabled:e.cronJobsEnabledFilter,sortBy:e.cronJobsSortBy,sortDir:e.cronJobsSortDir}),o=Array.isArray(i.jobs)?i.jobs:[];e.cronJobs=n?[...e.cronJobs,...o]:o;const r=hc({totalRaw:i.total,limitRaw:i.limit,offsetRaw:i.offset,nextOffsetRaw:i.nextOffset,hasMoreRaw:i.hasMore,pageCount:o.length});e.cronJobsTotal=Math.max(r.total,e.cronJobs.length),e.cronJobsHasMore=r.hasMore,e.cronJobsNextOffset=r.nextOffset,e.cronEditingJobId&&!e.cronJobs.some(l=>l.id===e.cronEditingJobId)&&is(e)}catch(s){e.cronError=String(s)}finally{n?e.cronJobsLoadingMore=!1:e.cronLoading=!1}}async function nf(e){await jo(e,{append:!0})}async function ia(e){await jo(e,{append:!1})}function oa(e,t){typeof t.cronJobsQuery=="string"&&(e.cronJobsQuery=t.cronJobsQuery),t.cronJobsEnabledFilter&&(e.cronJobsEnabledFilter=t.cronJobsEnabledFilter),t.cronJobsScheduleKindFilter&&(e.cronJobsScheduleKindFilter=t.cronJobsScheduleKindFilter),t.cronJobsLastStatusFilter&&(e.cronJobsLastStatusFilter=t.cronJobsLastStatusFilter),t.cronJobsSortBy&&(e.cronJobsSortBy=t.cronJobsSortBy),t.cronJobsSortDir&&(e.cronJobsSortDir=t.cronJobsSortDir)}function sf(e){return e.cronJobs.filter(t=>!(e.cronJobsScheduleKindFilter!=="all"&&t.schedule.kind!==e.cronJobsScheduleKindFilter||e.cronJobsLastStatusFilter!=="all"&&t.state?.lastStatus!==e.cronJobsLastStatusFilter))}function is(e){e.cronEditingJobId=null}function mc(e){e.cronForm={...Fs},e.cronFieldErrors=ns(e.cronForm)}function of(e){const t=Date.parse(e);if(!Number.isFinite(t))return"";const n=new Date(t),s=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0"),r=String(n.getHours()).padStart(2,"0"),l=String(n.getMinutes()).padStart(2,"0");return`${s}-${i}-${o}T${r}:${l}`}function rf(e){if(e%864e5===0)return{everyAmount:String(Math.max(1,e/864e5)),everyUnit:"days"};if(e%36e5===0)return{everyAmount:String(Math.max(1,e/36e5)),everyUnit:"hours"};const t=Math.max(1,Math.ceil(e/6e4));return{everyAmount:String(t),everyUnit:"minutes"}}function af(e){return e===0?{scheduleExact:!0,staggerAmount:"",staggerUnit:"seconds"}:typeof e!="number"||!Number.isFinite(e)||e<0?{scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds"}:e%6e4===0?{scheduleExact:!1,staggerAmount:String(Math.max(1,e/6e4)),staggerUnit:"minutes"}:{scheduleExact:!1,staggerAmount:String(Math.max(1,Math.ceil(e/1e3))),staggerUnit:"seconds"}}function vc(e,t){const n=e.failureAlert,s={...t,name:e.name,description:e.description??"",agentId:e.agentId??"",sessionKey:e.sessionKey??"",clearAgent:!1,enabled:e.enabled,deleteAfterRun:e.deleteAfterRun??!1,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:t.everyAmount,everyUnit:t.everyUnit,cronExpr:t.cronExpr,cronTz:"",scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds",sessionTarget:e.sessionTarget,wakeMode:e.wakeMode,payloadKind:e.payload.kind,payloadText:e.payload.kind==="systemEvent"?e.payload.text:e.payload.message,payloadModel:e.payload.kind==="agentTurn"?e.payload.model??"":"",payloadThinking:e.payload.kind==="agentTurn"?e.payload.thinking??"":"",payloadLightContext:e.payload.kind==="agentTurn"?e.payload.lightContext===!0:!1,deliveryMode:e.delivery?.mode??"none",deliveryChannel:e.delivery?.channel??Ts,deliveryTo:e.delivery?.to??"",deliveryAccountId:e.delivery?.accountId??"",deliveryBestEffort:e.delivery?.bestEffort??!1,failureAlertMode:n===!1?"disabled":n&&typeof n=="object"?"custom":"inherit",failureAlertAfter:n&&typeof n=="object"&&typeof n.after=="number"?String(n.after):Fs.failureAlertAfter,failureAlertCooldownSeconds:n&&typeof n=="object"&&typeof n.cooldownMs=="number"?String(Math.floor(n.cooldownMs/1e3)):Fs.failureAlertCooldownSeconds,failureAlertChannel:n&&typeof n=="object"?n.channel??Ts:Ts,failureAlertTo:n&&typeof n=="object"?n.to??"":"",failureAlertDeliveryMode:n&&typeof n=="object"?n.mode??"announce":"announce",failureAlertAccountId:n&&typeof n=="object"?n.accountId??"":"",timeoutSeconds:e.payload.kind==="agentTurn"&&typeof e.payload.timeoutSeconds=="number"?String(e.payload.timeoutSeconds):""};if(e.schedule.kind==="at")s.scheduleAt=of(e.schedule.at);else if(e.schedule.kind==="every"){const i=rf(e.schedule.everyMs);s.everyAmount=i.everyAmount,s.everyUnit=i.everyUnit}else{s.cronExpr=e.schedule.expr,s.cronTz=e.schedule.tz??"";const i=af(e.schedule.staggerMs);s.scheduleExact=i.scheduleExact,s.staggerAmount=i.staggerAmount,s.staggerUnit=i.staggerUnit}return zo(s)}function lf(e){if(e.scheduleKind==="at"){const o=Date.parse(e.scheduleAt);if(!Number.isFinite(o))throw new Error(p("cron.errors.invalidRunTime"));return{kind:"at",at:new Date(o).toISOString()}}if(e.scheduleKind==="every"){const o=Ne(e.everyAmount,0);if(o<=0)throw new Error(p("cron.errors.invalidIntervalAmount"));const r=e.everyUnit;return{kind:"every",everyMs:o*(r==="minutes"?6e4:r==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error(p("cron.errors.cronExprRequiredShort"));if(e.scheduleExact)return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0,staggerMs:0};const n=e.staggerAmount.trim();if(!n)return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0};const s=Ne(n,0);if(s<=0)throw new Error(p("cron.errors.invalidStaggerAmount"));const i=e.staggerUnit==="minutes"?s*6e4:s*1e3;return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0,staggerMs:i}}function cf(e){if(e.payloadKind==="systemEvent"){const r=e.payloadText.trim();if(!r)throw new Error(p("cron.errors.systemEventTextRequired"));return{kind:"systemEvent",text:r}}const t=e.payloadText.trim();if(!t)throw new Error(p("cron.errors.agentMessageRequiredShort"));const n={kind:"agentTurn",message:t},s=e.payloadModel.trim();s&&(n.model=s);const i=e.payloadThinking.trim();i&&(n.thinking=i);const o=Ne(e.timeoutSeconds,0);return o>0&&(n.timeoutSeconds=o),e.payloadLightContext&&(n.lightContext=!0),n}function df(e){if(e.failureAlertMode==="disabled")return!1;if(e.failureAlertMode!=="custom")return;const t=Ne(e.failureAlertAfter.trim(),0),n=e.failureAlertCooldownSeconds.trim(),s=n.length>0?Ne(n,0):void 0,i=s!==void 0&&Number.isFinite(s)&&s>=0?Math.floor(s*1e3):void 0,o=e.failureAlertDeliveryMode,r=e.failureAlertAccountId.trim(),l={after:t>0?Math.floor(t):void 0,channel:e.failureAlertChannel.trim()||Ts,to:e.failureAlertTo.trim()||void 0,...i!==void 0?{cooldownMs:i}:{}};return o&&(l.mode=o),l.accountId=r||void 0,l}async function uf(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=zo(e.cronForm);t!==e.cronForm&&(e.cronForm=t);const n=ns(t);if(e.cronFieldErrors=n,pc(n))return;const s=lf(t),i=cf(t),o=e.cronEditingJobId?e.cronJobs.find(v=>v.id===e.cronEditingJobId):void 0;if(i.kind==="agentTurn"){const v=o?.payload.kind==="agentTurn"?o.payload.lightContext:void 0;!t.payloadLightContext&&e.cronEditingJobId&&v!==void 0&&(i.lightContext=!1)}const r=t.deliveryMode,l=r&&r!=="none"?{mode:r,channel:r==="announce"?t.deliveryChannel.trim()||"last":void 0,to:t.deliveryTo.trim()||void 0,accountId:r==="announce"?t.deliveryAccountId.trim():void 0,bestEffort:t.deliveryBestEffort}:r==="none"?{mode:"none"}:void 0,a=df(t),d=t.clearAgent?null:t.agentId.trim(),u=t.sessionKey.trim()||(o?.sessionKey?null:void 0),f={name:t.name.trim(),description:t.description.trim(),agentId:d===null?null:d||void 0,sessionKey:u,enabled:t.enabled,deleteAfterRun:t.deleteAfterRun,schedule:s,sessionTarget:t.sessionTarget,wakeMode:t.wakeMode,payload:i,delivery:l,failureAlert:a};if(!f.name)throw new Error(p("cron.errors.nameRequiredShort"));e.cronEditingJobId?(await e.client.request("cron.update",{id:e.cronEditingJobId,patch:f}),is(e)):(await e.client.request("cron.add",f),mc(e)),await si(e),await ss(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function gf(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 si(e),await ss(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function ff(e,t,n="force"){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:n}),e.cronRunsScope==="all"?await yt(e,null):await yt(e,t.id)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function pf(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.cronEditingJobId===t.id&&is(e),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null),await si(e),await ss(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function yt(e,t,n){if(!e.client||!e.connected)return;const s=e.cronRunsScope,i=t??e.cronRunsJobId;if(s==="job"&&!i){e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null;return}const o=n?.append===!0;if(!(o&&!e.cronRunsHasMore))try{o&&(e.cronRunsLoadingMore=!0);const r=o?Math.max(0,e.cronRunsNextOffset??e.cronRuns.length):0,l=await e.client.request("cron.runs",{scope:s,id:s==="job"?i??void 0:void 0,limit:e.cronRunsLimit,offset:r,statuses:e.cronRunsStatuses.length>0?e.cronRunsStatuses:void 0,status:e.cronRunsStatusFilter,deliveryStatuses:e.cronRunsDeliveryStatuses.length>0?e.cronRunsDeliveryStatuses:void 0,query:e.cronRunsQuery.trim()||void 0,sortDir:e.cronRunsSortDir}),a=Array.isArray(l.entries)?l.entries:[];e.cronRuns=o&&(s==="all"||e.cronRunsJobId===i)?[...e.cronRuns,...a]:a,s==="job"&&(e.cronRunsJobId=i??null);const d=hc({totalRaw:l.total,limitRaw:l.limit,offsetRaw:l.offset,nextOffsetRaw:l.nextOffset,hasMoreRaw:l.hasMore,pageCount:a.length});e.cronRunsTotal=Math.max(d.total,e.cronRuns.length),e.cronRunsHasMore=d.hasMore,e.cronRunsNextOffset=d.nextOffset}catch(r){e.cronError=String(r)}finally{o&&(e.cronRunsLoadingMore=!1)}}async function hf(e){e.cronRunsScope==="job"&&!e.cronRunsJobId||await yt(e,e.cronRunsJobId,{append:!0})}function ra(e,t){t.cronRunsScope&&(e.cronRunsScope=t.cronRunsScope),Array.isArray(t.cronRunsStatuses)&&(e.cronRunsStatuses=t.cronRunsStatuses,e.cronRunsStatusFilter=t.cronRunsStatuses.length===1?t.cronRunsStatuses[0]:"all"),Array.isArray(t.cronRunsDeliveryStatuses)&&(e.cronRunsDeliveryStatuses=t.cronRunsDeliveryStatuses),t.cronRunsStatusFilter&&(e.cronRunsStatusFilter=t.cronRunsStatusFilter,e.cronRunsStatuses=t.cronRunsStatusFilter==="all"?[]:[t.cronRunsStatusFilter]),typeof t.cronRunsQuery=="string"&&(e.cronRunsQuery=t.cronRunsQuery),t.cronRunsSortDir&&(e.cronRunsSortDir=t.cronRunsSortDir)}function mf(e,t){e.cronEditingJobId=t.id,e.cronRunsJobId=t.id,e.cronForm=vc(t,e.cronForm),e.cronFieldErrors=ns(e.cronForm)}function vf(e,t){const n=e.trim()||"Job",s=`${n} copy`;if(!t.has(s.toLowerCase()))return s;let i=2;for(;i<1e3;){const o=`${n} copy ${i}`;if(!t.has(o.toLowerCase()))return o;i+=1}return`${n} copy ${Date.now()}`}function bf(e,t){is(e),e.cronRunsJobId=t.id;const n=new Set(e.cronJobs.map(i=>i.name.trim().toLowerCase())),s=vc(t,e.cronForm);s.name=vf(t.name,n),e.cronForm=s,e.cronFieldErrors=ns(e.cronForm)}function yf(e){is(e),mc(e)}function Ko(e){return e.trim()}function $f(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 xf(e){const t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return null;const n=Ko(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function wf(e){const t=Ko(e.role),n=e.adapter.readStore(),s={version:1,deviceId:e.deviceId,tokens:n&&n.deviceId===e.deviceId&&n.tokens?{...n.tokens}:{}},i={token:e.token,role:t,scopes:$f(e.scopes),updatedAtMs:Date.now()};return s.tokens[t]=i,e.adapter.writeStore(s),i}function Sf(e){const t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return;const n=Ko(e.role);if(!t.tokens[n])return;const s={version:1,deviceId:t.deviceId,tokens:{...t.tokens}};delete s.tokens[n],e.adapter.writeStore(s)}const bc="openclaw.device.auth.v1";function Wo(){try{const e=window.localStorage.getItem(bc);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 qo(e){try{window.localStorage.setItem(bc,JSON.stringify(e))}catch{}}function kf(e){return xf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role})}function yc(e){return wf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role,token:e.token,scopes:e.scopes})}function $c(e){Sf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role})}const xc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:Se,n:Es,Gx:aa,Gy:la,a:Ci,d:Ti,h:Af}=xc,Vt=32,Go=64,Cf=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},me=(e="")=>{const t=new Error(e);throw Cf(t,me),t},Tf=e=>typeof e=="bigint",Ef=e=>typeof e=="string",_f=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Tt=(e,t,n="")=>{const s=_f(e),i=e?.length,o=t!==void 0;if(!s||o&&i!==t){const r=n&&`"${n}" `,l=o?` of length ${t}`:"",a=s?`length=${i}`:`type=${typeof e}`;me(r+"expected Uint8Array"+l+", got "+a)}return e},ii=e=>new Uint8Array(e),wc=e=>Uint8Array.from(e),Sc=(e,t)=>e.toString(16).padStart(t,"0"),kc=e=>Array.from(Tt(e)).map(t=>Sc(t,2)).join(""),ot={_0:48,_9:57,A:65,F:70,a:97,f:102},ca=e=>{if(e>=ot._0&&e<=ot._9)return e-ot._0;if(e>=ot.A&&e<=ot.F)return e-(ot.A-10);if(e>=ot.a&&e<=ot.f)return e-(ot.a-10)},Ac=e=>{const t="hex invalid";if(!Ef(e))return me(t);const n=e.length,s=n/2;if(n%2)return me(t);const i=ii(s);for(let o=0,r=0;o<s;o++,r+=2){const l=ca(e.charCodeAt(r)),a=ca(e.charCodeAt(r+1));if(l===void 0||a===void 0)return me(t);i[o]=l*16+a}return i},Cc=()=>globalThis?.crypto,If=()=>Cc()?.subtle??me("crypto.subtle must be defined, consider polyfill"),Qn=(...e)=>{const t=ii(e.reduce((s,i)=>s+Tt(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},Rf=(e=Vt)=>Cc().getRandomValues(ii(e)),Ns=BigInt,Ot=(e,t,n,s="bad number: out of range")=>Tf(e)&&t<=e&&e<n?e:me(s),U=(e,t=Se)=>{const n=e%t;return n>=0n?n:t+n},Tc=e=>U(e,Es),Mf=(e,t)=>{(e===0n||t<=0n)&&me("no inverse n="+e+" mod="+t);let n=U(e,t),s=t,i=0n,o=1n;for(;n!==0n;){const r=s/n,l=s%n,a=i-o*r;s=n,n=l,i=o,o=a}return s===1n?U(i,t):me("no inverse")},Lf=e=>{const t=Rc[e];return typeof t!="function"&&me("hashes."+e+" not set"),t},Ei=e=>e instanceof Fe?e:me("Point expected"),io=2n**256n;class Fe{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const o=io;this.X=Ot(t,0n,o),this.Y=Ot(n,0n,o),this.Z=Ot(s,1n,o),this.T=Ot(i,0n,o),Object.freeze(this)}static CURVE(){return xc}static fromAffine(t){return new Fe(t.x,t.y,1n,U(t.x*t.y))}static fromBytes(t,n=!1){const s=Ti,i=wc(Tt(t,Vt)),o=t[31];i[31]=o&-129;const r=_c(i);Ot(r,0n,n?io:Se);const a=U(r*r),d=U(a-1n),g=U(s*a+1n);let{isValid:u,value:f}=Pf(d,g);u||me("bad point: y not sqrt");const v=(f&1n)===1n,m=(o&128)!==0;return!n&&f===0n&&m&&me("bad point: x==0, isLastByteOdd"),m!==v&&(f=U(-f)),new Fe(f,r,1n,U(f*r))}static fromHex(t,n){return Fe.fromBytes(Ac(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Ci,n=Ti,s=this;if(s.is0())return me("bad point: ZERO");const{X:i,Y:o,Z:r,T:l}=s,a=U(i*i),d=U(o*o),g=U(r*r),u=U(g*g),f=U(a*t),v=U(g*U(f+d)),m=U(u+U(n*U(a*d)));if(v!==m)return me("bad point: equation left != right (1)");const S=U(i*o),T=U(r*l);return S!==T?me("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:o,Y:r,Z:l}=Ei(t),a=U(n*l),d=U(o*i),g=U(s*l),u=U(r*i);return a===d&&g===u}is0(){return this.equals(fn)}negate(){return new Fe(U(-this.X),this.Y,this.Z,U(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Ci,o=U(t*t),r=U(n*n),l=U(2n*U(s*s)),a=U(i*o),d=t+n,g=U(U(d*d)-o-r),u=a+r,f=u-l,v=a-r,m=U(g*f),S=U(u*v),T=U(g*v),M=U(f*u);return new Fe(m,S,M,T)}add(t){const{X:n,Y:s,Z:i,T:o}=this,{X:r,Y:l,Z:a,T:d}=Ei(t),g=Ci,u=Ti,f=U(n*r),v=U(s*l),m=U(o*u*d),S=U(i*a),T=U((n+s)*(r+l)-f-v),M=U(S-m),I=U(S+m),A=U(v-g*f),w=U(T*M),L=U(I*A),E=U(T*A),R=U(M*I);return new Fe(w,L,R,E)}subtract(t){return this.add(Ei(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return fn;if(Ot(t,1n,Es),t===1n)return this;if(this.equals(Jt))return qf(t).p;let s=fn,i=Jt;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?s=s.add(o):n&&(i=i.add(o));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(fn))return{x:0n,y:1n};const i=Mf(s,Se);U(s*i)!==1n&&me("invalid inverse");const o=U(t*i),r=U(n*i);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Ec(n);return s[31]|=t&1n?128:0,s}toHex(){return kc(this.toBytes())}clearCofactor(){return this.multiply(Ns(Af),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Es/2n,!1).double();return Es%2n&&(t=t.add(this)),t.is0()}}const Jt=new Fe(aa,la,1n,U(aa*la)),fn=new Fe(0n,1n,1n,0n);Fe.BASE=Jt;Fe.ZERO=fn;const Ec=e=>Ac(Sc(Ot(e,0n,io),Go)).reverse(),_c=e=>Ns("0x"+kc(wc(Tt(e)).reverse())),Ge=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=Se;return n},Df=e=>{const n=e*e%Se*e%Se,s=Ge(n,2n)*n%Se,i=Ge(s,1n)*e%Se,o=Ge(i,5n)*i%Se,r=Ge(o,10n)*o%Se,l=Ge(r,20n)*r%Se,a=Ge(l,40n)*l%Se,d=Ge(a,80n)*a%Se,g=Ge(d,80n)*a%Se,u=Ge(g,10n)*o%Se;return{pow_p_5_8:Ge(u,2n)*e%Se,b2:n}},da=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Pf=(e,t)=>{const n=U(t*t*t),s=U(n*n*t),i=Df(e*s).pow_p_5_8;let o=U(e*n*i);const r=U(t*o*o),l=o,a=U(o*da),d=r===e,g=r===U(-e),u=r===U(-e*da);return d&&(o=l),(g||u)&&(o=a),(U(o)&1n)===1n&&(o=U(-o)),{isValid:d||g,value:o}},oo=e=>Tc(_c(e)),Vo=(...e)=>Rc.sha512Async(Qn(...e)),Ff=(...e)=>Lf("sha512")(Qn(...e)),Ic=e=>{const t=e.slice(0,Vt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Vt,Go),s=oo(t),i=Jt.multiply(s),o=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:o}},Jo=e=>Vo(Tt(e,Vt)).then(Ic),Nf=e=>Ic(Ff(Tt(e,Vt))),Of=e=>Jo(e).then(t=>t.pointBytes),Uf=e=>Vo(e.hashable).then(e.finish),Bf=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,o=oo(t),r=Jt.multiply(o).toBytes();return{hashable:Qn(r,s,n),finish:d=>{const g=Tc(o+oo(d)*i);return Tt(Qn(r,Ec(g)),Go)}}},Hf=async(e,t)=>{const n=Tt(e),s=await Jo(t),i=await Vo(s.prefix,n);return Uf(Bf(s,i,n))},Rc={sha512Async:async e=>{const t=If(),n=Qn(e);return ii(await t.digest("SHA-512",n.buffer))},sha512:void 0},zf=(e=Rf(Vt))=>e,jf={getExtendedPublicKeyAsync:Jo,getExtendedPublicKey:Nf,randomSecretKey:zf},Os=8,Kf=256,Mc=Math.ceil(Kf/Os)+1,ro=2**(Os-1),Wf=()=>{const e=[];let t=Jt,n=t;for(let s=0;s<Mc;s++){n=t,e.push(n);for(let i=1;i<ro;i++)n=n.add(t),e.push(n);t=n.double()}return e};let ua;const ga=(e,t)=>{const n=t.negate();return e?n:t},qf=e=>{const t=ua||(ua=Wf());let n=fn,s=Jt;const i=2**Os,o=i,r=Ns(i-1),l=Ns(Os);for(let a=0;a<Mc;a++){let d=Number(e&r);e>>=l,d>ro&&(d-=o,e+=1n);const g=a*ro,u=g,f=g+Math.abs(d)-1,v=a%2!==0,m=d<0;d===0?s=s.add(ga(v,t[u])):n=n.add(ga(m,t[f]))}return e!==0n&&me("invalid wnaf"),{p:n,f:s}},_i="openclaw-device-identity-v1";function ao(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Lc(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let o=0;o<s.length;o+=1)i[o]=s.charCodeAt(o);return i}function Gf(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Dc(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Gf(new Uint8Array(t))}async function Vf(){const e=jf.randomSecretKey(),t=await Of(e);return{deviceId:await Dc(t),publicKey:ao(t),privateKey:ao(e)}}async function Qo(){try{const n=localStorage.getItem(_i);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 Dc(Lc(s.publicKey));if(i!==s.deviceId){const o={...s,deviceId:i};return localStorage.setItem(_i,JSON.stringify(o)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Vf(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(_i,JSON.stringify(t)),e}async function Jf(e,t){const n=Lc(e),s=new TextEncoder().encode(t),i=await Hf(s,n);return ao(i)}async function Et(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 Qf(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Et(e)}catch(n){e.devicesError=String(n)}}async function Yf(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 Et(e)}catch(s){e.devicesError=String(s)}}async function Xf(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Qo(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&yc({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 Et(e)}catch(n){e.devicesError=String(n)}}async function Zf(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 Qo();t.deviceId===s.deviceId&&$c({deviceId:s.deviceId,role:t.role}),await Et(e)}catch(s){e.devicesError=String(s)}}function ep(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 tp(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 Yo(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=ep(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);np(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function np(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=St(t.file??{}))}async function sp(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=tp(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 Yo(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function ip(e,t,n){const s=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});Zl(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function op(e,t){const n=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});ec(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}function Pc(e){return e instanceof Error?e.message:String(e)}function fa(e,t,n){const s=t.trim();if(!s)return;const i={...e.marketMessages};n?i[s]=n:delete i[s],e.marketMessages=i}function xn(e){return e.state.installed?e.state.enabled?{kind:"disable",enabled:!1,successMessage:"Skill disabled."}:{kind:"enable",enabled:!0,successMessage:"Skill enabled."}:{kind:"install",successMessage:"Installed."}}async function Xo(e){if(!(!e.client||!e.connected||e.marketLoading)){e.marketLoading=!0,e.marketError=null;try{const t=await e.client.request("skills.market.catalog",{});e.marketCatalog=Array.isArray(t?.catalog)?t.catalog:[]}catch(t){e.marketError=Pc(t)}finally{e.marketLoading=!1}}}async function rp(e,t){if(!e.client||!e.connected)return;const n=e.marketCatalog.find(i=>i.skillKey===t);if(!n)return;const s=xn(n);e.marketBusyKey=t,e.marketError=null;try{let i=s.successMessage;if(s.kind==="install"){const o=await e.client.request("skills.market.installOrEnable",{skillKey:t});i=o?.action==="already-installed"?"Already installed.":o?.message?.trim()||s.successMessage}else await e.client.request("skills.update",{skillKey:t,enabled:s.enabled});await Xo(e),fa(e,t,{kind:"success",message:i})}catch(i){const o=Pc(i);e.marketError=o,fa(e,t,{kind:"error",message:o})}finally{e.marketBusyKey=null}}function ap(e){return typeof e=="string"?e.trim()||void 0:!e||typeof e!="object"?void 0:e.primary?.trim()||void 0}const lo=2e5,lp=128e3,Us="bitseek",cp="bitseek/AUTO",dp=32e3,up=4096,gp={"gpt-5.1-codex":4e5,"gpt-5.1-codex-mini":4e5,"gpt-5.1-codex-max":4e5,"gpt-5.1":4e5,"gpt-5.2":4e5,"claude-opus-4-6":1048576,"claude-opus-4-5":2e5,"gemini-3-pro":1048576,"gemini-3-flash":1048576,"glm-4.7":204800,"minimax-m2.5":2e5,"minimax-m2.5-highspeed":2e5,"minimax-m2.5-lightning":2e5};function co(e,t){return`${e}/${t}`}function fp(e){if(typeof e=="string")return e.trim()||void 0;if(!e||typeof e!="object")return;const t=e.primary;return typeof t!="string"?void 0:t.trim()||void 0}function pp(e){if(!e||typeof e!="object")return[];const t=e.fallbacks;return Array.isArray(t)?t.map(n=>typeof n=="string"?n.trim():"").filter(Boolean):[]}function Zo(e,t){const n=e.agents?.defaults,s=n?.model,i=n?.models,o=typeof s=="object"&&s!==null&&"fallbacks"in s?s.fallbacks:void 0;return{...e,agents:{...e.agents,defaults:{...n,model:{...o?{fallbacks:o}:{},primary:t},models:{...i,[t]:i?.[t]??{}}}}}}function hp(e){const t=e.trim();if(!t)return null;const n=t.indexOf("/");return n<=0||n>=t.length-1?null:{providerId:t.slice(0,n).trim(),modelId:t.slice(n+1).trim()}}function oi(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t>0?t:null}function mp(e){const t=e?.trim()??"";if(!t)return null;if(!/^\d+$/.test(t))throw new Error("Context window must be a positive integer.");const n=Number.parseInt(t,10);if(!Number.isFinite(n)||n<=0)throw new Error("Context window must be a positive integer.");return n}function vp(e){const t=e.config.models?.providers??{};let n=null;for(const[s,i]of Object.entries(t))if(!(!i||!Array.isArray(i.models)||s===e.selectedProviderId))for(const o of i.models){if(o.id!==e.modelId)continue;const r=oi(o.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function bp(e){if(!Array.isArray(e.catalogModels)||e.catalogModels.length===0)return null;const t=e.selectedProviderId.trim().toLowerCase();let n=null;for(const s of e.catalogModels){if((typeof s?.id=="string"?s.id.trim():"")!==e.modelId)continue;const o=typeof s?.provider=="string"?s.provider.trim().toLowerCase():"";if(o&&o===t)continue;const r=oi(s?.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function yp(e){const t=e.trim().toLowerCase();return t?gp[t]??null:null}function Fc(e){const t=hp(e.modelRef);if(!t)return e.config;const n=e.config.models?.providers??{},s=n[t.providerId];if(!s||!Array.isArray(s.models))return e.config;let i=!1;const o=s.models.map(r=>{if(r.id!==t.modelId)return r;const l=oi(r.contextWindow);let a;if(t.providerId===Us)a=lp;else{const d=vp({config:e.config,selectedProviderId:t.providerId,modelId:t.modelId}),g=bp({selectedProviderId:t.providerId,modelId:t.modelId,catalogModels:e.catalogModels}),u=yp(t.modelId),f=d??g??u,v=e.preferResolvedHint===!0&&f!=null;a=e.replaceCurrentContextWindow!==!0&&l!=null&&l!==dp&&!v?l:f??lo}return a===r.contextWindow?r:(i=!0,{...r,contextWindow:a})});return i?{...e.config,models:{...e.config.models,providers:{...n,[t.providerId]:{...s,models:o}}}}:e.config}function uo(e){const t=e.trim().toLowerCase();return t?t.replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,""):""}function Nc(e){try{const t=new URL(e),n=t.hostname.replace(/[^a-z0-9]+/gi,"-").toLowerCase(),s=t.port?`-${t.port}`:"",i=`custom-${n}${s}`;return uo(i)||"custom"}catch{return"custom"}}function $p(e){const t=e.config.models?.providers??{},n=uo(e.requestedProviderId?.trim()||"");if(n)return n;const s=Nc(e.baseUrl),i=uo(s)||"custom",o=t[i];if(!o?.baseUrl||o.baseUrl===e.baseUrl)return i;let r=2,l=`${i}-${r}`;for(;t[l];)r+=1,l=`${i}-${r}`;return l}function xp(e){try{new URL(e)}catch{throw new Error("Custom provider base URL must be a valid URL.")}}function wp(e){const t=e.alias.trim();if(!t)return;const n=e.cfg.agents?.defaults?.models??{},s=t.toLowerCase(),i=new Set((e.ignoreModelRefs??[]).map(o=>o.trim()).filter(Boolean));for(const[o,r]of Object.entries(n)){if(o===e.modelRef||i.has(o))continue;const l=r.alias,a=typeof l=="string"?l.trim().toLowerCase():"";if(a&&a===s)throw new Error(`Alias ${t} already points to ${o}.`)}}function Sp(e){const t=e.baseUrl.trim();xp(t);const n=e.modelId.trim();if(!n)throw new Error("Custom provider model ID is required.");const s=mp(e.contextWindow),i=$p({config:e.config,baseUrl:t,requestedProviderId:e.providerId}),o=e.config.models?.providers??{},r=o[i],l=Array.isArray(r?.models)?r.models:[],a=e.previousModelId?.trim(),d=a?l.filter(E=>E.id!==a):l,g=d.some(E=>E.id===n),u={id:n,name:`${n} (Custom Provider)`,contextWindow:s??lo,maxTokens:up,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!1},f=g?d.map(E=>E.id===n?{...E,contextWindow:s??oi(E.contextWindow)??lo}:E):[...d,u],v=e.replaceApiKey===!0?e.apiKey?.trim():void 0,m={...r??{baseUrl:t,models:[],api:"openai-completions"},baseUrl:t,api:"openai-completions",models:f.length>0?f:[u]};e.replaceApiKey===!0&&(v?m.apiKey=v:delete m.apiKey);const S=co(i,n),T=e.providerId?.trim()||i,M=a?co(T,a):void 0,I=e.alias?.trim()??"";wp({cfg:e.config,alias:I,modelRef:S,ignoreModelRefs:M?[M]:[]});const A={...e.config.agents?.defaults?.models};M&&M!==S&&delete A[M];const w={...A[S]};return I?w.alias=I:delete w.alias,A[S]=w,{config:{...e.config,models:{...e.config.models,mode:e.config.models?.mode??"merge",providers:{...o,[i]:m}},agents:{...e.config.agents,defaults:{...e.config.agents?.defaults,models:A}}},providerId:i,modelId:n}}function pa(e,t){const n=t?[[t,e[t]]]:Object.entries(e),s=[];for(const[i,o]of n)if(!(!o||!Array.isArray(o.models)))for(const r of o.models){const l=typeof r?.id=="string"?r.id.trim():"";l&&s.push(co(i,l))}return s}function kp(e){const t=pa(e,Us);return t.length>0?t[0]:e[Us]?cp:pa(e)[0]}function Ap(e){const t=e.providerId.trim();if(!t||t===Us)return e.config;const n=e.config.models?.providers??{};if(!n[t])return e.config;const s={...n};delete s[t];const i=`${t}/`,o=e.config.agents?.defaults,r=o?.models??{},l={};for(const[m,S]of Object.entries(r))m.startsWith(i)||(l[m]=S);const a=fp(o?.model),d=pp(o?.model).filter(m=>!m.startsWith(i)),u=(a&&!a.startsWith(i)?a:void 0)??kp(s);let f={...e.config,models:{...e.config.models,providers:s},agents:{...e.config.agents,defaults:{...o,...Object.keys(l).length>0?{models:l}:{}}}};if(Object.keys(l).length===0&&(f={...f,agents:{...f.agents,defaults:{...f.agents?.defaults,models:void 0}}}),!u)return f;f=Zo(f,u);const v=d.filter(m=>m!==u);return v.length===0?f:{...f,agents:{...f.agents,defaults:{...f.agents?.defaults,model:{primary:u,fallbacks:v}}}}}const pn="__new__",Yn="bitseek",Cp=4e3,Bs=new WeakMap;function Tp(e){const t=Bs.get(e);t&&(clearTimeout(t),Bs.delete(e))}function hn(e,t){if(e.modelsVerifyState=t,Tp(e),t?.tone!=="success")return;const n=t,s=setTimeout(()=>{e.modelsVerifyState===n&&(e.modelsVerifyState=null),Bs.delete(e)},Cp);Bs.set(e,s)}function Ep(e){const t=e instanceof Error?e.message:String(e);return/invalid models\.verify params/i.test(t)&&/providerId/i.test(t)}function os(e){return St(e?.config??{})}function _p(e){return!!(e&&e.api==="openai-completions"&&typeof e.baseUrl=="string"&&e.baseUrl.trim()&&Array.isArray(e.models)&&e.models.some(t=>typeof t?.id=="string"&&t.id.trim()))}function er(e,t,n){return e.agents?.defaults?.models?.[`${t}/${n}`]?.alias?.trim()??""}function Oc(e){return e===Yn?"BitSeek":e}function Ip(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t>0?t:null}function Uc(e){const t=e.models?.providers??{};return Object.entries(t).filter(([,n])=>_p(n)).map(([n,s])=>[n,s]).toSorted(([n],[s])=>n===Yn?-1:s===Yn?1:n.localeCompare(s))}function Rp(e,t,n,s){const i=typeof s?.id=="string"?s.id.trim():"";if(!i)throw new Error(`Missing model id for provider ${t}.`);const o=er(e,t,i),r=t===Yn?"bitseek":"custom",l=typeof s?.name=="string"?s.name.trim():"",a=Oc(t);return{modelRef:`${t}/${i}`,providerId:t,kind:r,title:o||l||i,subtitle:r==="bitseek"?"Built-in provider":a,modelId:i,contextWindow:Ip(s.contextWindow),baseUrl:n.baseUrl,apiKeyConfigured:n.apiKey!==void 0}}function Bc(e){const t=[];for(const[n,s]of Uc(e))for(const i of s.models)typeof i?.id=="string"&&i.id.trim()&&t.push(Rp(e,n,s,i));return t}function Mp(e){const t=[];for(const[n,s]of Uc(e)){const i=Oc(n);for(const o of s.models){const r=typeof o?.id=="string"?o.id.trim():"";if(!r)continue;const l=`${n}/${r}`,a=er(e,n,r),d=typeof o?.name=="string"?o.name.trim():"",g=a||d||r;t.push({modelRef:l,providerId:n,modelId:r,providerLabel:i,modelLabel:g,label:`${i} · ${g} (${l})`})}}return t}function Hc(e,t){const n=t.kind==="bitseek";return{kind:t.kind,originalProviderId:t.providerId,originalModelId:t.modelId,providerIdHint:t.providerId,displayName:er(e,t.providerId,t.modelId),baseUrl:t.baseUrl,apiKey:"",apiKeyConfigured:t.apiKeyConfigured,apiKeyChanged:!1,modelId:t.modelId,contextWindow:t.contextWindow!=null?String(t.contextWindow):"",contextWindowChanged:!1,saved:!0,canDelete:t.kind==="custom",readonlyModelIdentity:n}}function Hs(){return{kind:"custom",originalProviderId:null,originalModelId:null,providerIdHint:"custom",displayName:"",baseUrl:"",apiKey:"",apiKeyConfigured:!1,apiKeyChanged:!1,modelId:"",contextWindow:"",contextWindowChanged:!1,saved:!1,canDelete:!1,readonlyModelIdentity:!1}}function ri(e){const t=os(e.configSnapshot),n=Bc(t),s=Mp(t),i=ap(t.agents?.defaults?.model)??"",r=s.some(d=>d.modelRef===i)?i:s[0]?.modelRef??i,l=e.modelsSelectedProviderId===pn?pn:n.some(d=>d.modelRef===e.modelsSelectedProviderId)?e.modelsSelectedProviderId:n[0]?.modelRef??pn;if(e.modelsProviders=n,e.modelsSwitchableModels=s,e.modelsSelectedDefault=r,e.modelsSelectedProviderId=l,l===pn){e.modelsDraft=Hs();return}const a=n.find(d=>d.modelRef===l);e.modelsDraft=a?Hc(t,a):Hs()}async function tr(e,t){const n=e.configSnapshot?.hash;return n?(await e.client?.request("config.set",{raw:$n(t),baseHash:n}),await Ae(e),ri(e),!0):(e.modelsError="Config hash missing; reload and retry.",!1)}async function zc(e){if(!(!e.client||!e.connected)){e.modelsLoading=!0,e.modelsError=null,e.modelsDefaultState=null;try{e.configSnapshot?.hash||await Ae(e),ri(e)}catch(t){e.modelsError=String(t)}finally{e.modelsLoading=!1}}}function ha(e,t){e.modelsSelectedProviderId=t,hn(e,null);const n=os(e.configSnapshot);if(t===pn){e.modelsDraft=Hs();return}const s=Bc(n).find(i=>i.modelRef===t);e.modelsDraft=s?Hc(n,s):Hs()}function Lp(e,t,n){if(!e.modelsDraft||t!=="apiKey"&&e.modelsDraft.readonlyModelIdentity)return;const s={...e.modelsDraft,[t]:n};t==="baseUrl"&&!s.originalProviderId&&(s.providerIdHint=Nc(n.trim())||"custom"),t==="apiKey"&&(s.apiKeyChanged=!0),t==="contextWindow"&&(s.contextWindowChanged=!0),e.modelsDraft=s,hn(e,null)}async function Dp(e){if(!(!e.client||!e.connected||!e.modelsDraft)){e.modelsSaving=!0,e.modelsError=null;try{const t=e.modelsDraft;if(t.kind==="bitseek"){if(!t.apiKeyChanged)return;const v=t.apiKey.trim();if(!v)throw new Error("BitSeek API key cannot be empty.");await e.client.request("models.auth.set",{providerId:Yn,apiKey:v}),e.modelsDraft={...t,apiKey:"",apiKeyChanged:!1,apiKeyConfigured:!0},e.modelsVerifyState={tone:"success",message:"BitSeek API key saved."};return}const n=os(e.configSnapshot),s=t.originalProviderId&&t.originalModelId?`${t.originalProviderId}/${t.originalModelId}`:"",i=Sp({config:n,baseUrl:t.baseUrl,modelId:t.modelId,contextWindow:t.contextWindow,providerId:t.originalProviderId??void 0,alias:t.displayName,apiKey:t.apiKeyChanged?t.apiKey:void 0,replaceApiKey:t.apiKeyChanged,previousModelId:t.originalModelId??void 0}),o=`${i.providerId}/${i.modelId}`;let r=[];try{const v=await e.client.request("models.list",{});r=Array.isArray(v?.models)?v.models:[]}catch{r=[]}const l=t.contextWindow.trim()==="",d=l||!t.contextWindowChanged?Fc({config:i.config,modelRef:o,catalogModels:r,preferResolvedHint:!0,replaceCurrentContextWindow:l}):i.config,g=e.modelsSelectedDefault===s?o:e.modelsSelectedDefault,u=Zo(d,g||o);if(!await tr(e,u))return;e.modelsSelectedProviderId=o,ri(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Pp(e){if(!(!e.client||!e.connected||!e.modelsSelectedDefault.trim())){e.modelsDefaultSaving=!0,e.modelsError=null,e.modelsDefaultState=null;try{const t=e.modelsSelectedDefault.trim();let n=[];try{const o=await e.client.request("models.list",{});n=Array.isArray(o?.models)?o.models:[]}catch{n=[]}const s=Fc({config:os(e.configSnapshot),modelRef:t,catalogModels:n,preferResolvedHint:!0}),i=Zo(s,t);await tr(e,i),e.modelsDefaultState={tone:"success",message:"Default model saved."}}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsDefaultSaving=!1}}}async function Fp(e){if(!(!e.client||!e.connected||!e.modelsDraft?.originalProviderId)&&e.modelsDraft.kind==="custom"){e.modelsSaving=!0,e.modelsError=null;try{const t=Ap({config:os(e.configSnapshot),providerId:e.modelsDraft.originalProviderId});await tr(e,t),e.modelsSelectedProviderId=null,ri(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Np(e){if(!e.client||!e.connected||!e.modelsDraft)return;const t=e.modelsDraft.apiKey.trim();e.modelsVerifyBusy=!0,hn(e,null),e.modelsError=null;try{const n={baseUrl:e.modelsDraft.baseUrl.trim(),modelId:e.modelsDraft.modelId.trim(),...e.modelsDraft.originalProviderId?{providerId:e.modelsDraft.originalProviderId}:{},...t?{apiKey:t}:{}};let s;try{s=await e.client.request("models.verify",n)}catch(i){if(!n.providerId||!Ep(i))throw i;const{providerId:o,...r}=n;s=await e.client.request("models.verify",r)}if(s.ok){hn(e,{tone:"success",message:s.status!==void 0?`Verification successful (HTTP ${s.status}).`:"Verification successful."});return}hn(e,{tone:"danger",message:s.status!==void 0?`Verification failed (HTTP ${s.status}).`:s.error||"Verification failed."})}catch(n){hn(e,{tone:"danger",message:n instanceof Error?n.message:String(n)})}finally{e.modelsVerifyBusy=!1}}function Op(e,t){e.modelsSelectedDefault=t,e.modelsDefaultState=null}function Up(){return pn}async function nr(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??Ne(e.sessionsFilterActive,0),o=t?.limit??Ne(e.sessionsFilterLimit,0),r={includeGlobal:n,includeUnknown:s};i>0&&(r.activeMinutes=i),o>0&&(r.limit=o);const l=await e.client.request("sessions.list",r);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Bp(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 Hp(e,t){if(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
127
|
+
|
|
128
|
+
Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoading=!0,e.sessionsError=null;try{return await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),!0}catch(s){return e.sessionsError=String(s),!1}finally{e.sessionsLoading=!1}}async function zp(e,t){return await Hp(e,t)?(await Yt(e),!0):!1}function wn(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ai(e){return e instanceof Error?e.message:String(e)}async function rs(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=ai(n)}finally{e.skillsLoading=!1}}}function jp(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Kp(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 rs(e),wn(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ai(s);e.skillsError=i,wn(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Wp(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 rs(e),wn(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ai(n);e.skillsError=s,wn(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function qp(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 rs(e),wn(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const o=ai(i);e.skillsError=o,wn(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const Gp=[{label:"chat",tabs:["chat"]},{label:"control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"agent",tabs:["agents","skills","market","nodes"]},{label:"settings",tabs:["models","config","debug","logs"]}],jc={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",market:"/market",nodes:"/nodes",chat:"/chat",models:"/models",config:"/config",debug:"/debug",logs:"/logs"},Kc=new Map(Object.entries(jc).map(([e,t])=>[t,e]));function Xt(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Xn(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 li(e,t=""){const n=Xt(t),s=jc[e];return n?`${n}${s}`:s}function Wc(e,t=""){const n=Xt(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=Xn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Kc.get(i)??null}function qc(e){let t=Xn(e);if(t.endsWith("/index.html")&&(t=Xn(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(Kc.has(i)){const o=n.slice(0,s);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function Vp(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"market":return"puzzle";case"nodes":return"monitor";case"models":return"folder";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function go(e){return p(`tabs.${e}`)}function Jp(e){return p(`subtitles.${e}`)}const Gc="openclaw.control.settings.v1";function Qp(){const t={gatewayUrl:(()=>{const n=location.protocol==="https:"?"wss":"ws",s=typeof window<"u"&&typeof window.__OPENCLAW_CONTROL_UI_BASE_PATH__=="string"&&window.__OPENCLAW_CONTROL_UI_BASE_PATH__.trim(),i=s?Xt(s):qc(location.pathname);return`${n}://${location.host}${i}`})(),token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"light",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(Gc);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,locale:Yl(s.locale)?s.locale:void 0}}catch{return t}}function Yp(e){localStorage.setItem(Gc,JSON.stringify(e))}const ps=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Xp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,hs=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Zp=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const o=i.documentElement,r=i,l=Xp();if(!!r.startViewTransition&&!l){let d=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")d=ps(n.pointerClientX/window.innerWidth),g=ps(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(d=ps((u.left+u.width/2)/window.innerWidth),g=ps((u.top+u.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${d*100}%`),o.style.setProperty("--theme-switch-y",`${g*100}%`),o.classList.add("theme-transition");try{const u=r.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>hs(o)):hs(o)}catch{hs(o),t()}return}t(),hs(o)};function eh(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function sr(e){return e==="system"?eh():e}function At(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,Yp(n),t.theme!==e.theme&&(e.theme=t.theme,ci(e,sr(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Vc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&At(e,{...e.settings,lastActiveSessionKey:n})}function th(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"),o=n.get("password")??s.get("password"),r=n.get("session")??s.get("session"),l=n.get("gatewayUrl")??s.get("gatewayUrl");let a=!1;if(i!=null){const g=i.trim();g&&g!==e.settings.token&&At(e,{...e.settings,token:g}),n.delete("token"),s.delete("token"),a=!0}if(o!=null&&(n.delete("password"),s.delete("password"),a=!0),r!=null){const g=r.trim();g&&(e.sessionKey=g,At(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"),a=!0}if(!a)return;t.search=n.toString();const d=s.toString();t.hash=d?`#${d}`:"",window.history.replaceState({},"",t.toString())}function nh(e,t){Yc(e,t,{refreshPolicy:"always",syncUrl:!0})}function sh(e,t,n){Zp({nextTheme:t,applyTheme:()=>{e.theme=t,At(e,{...e.settings,theme:t}),ci(e,sr(t))},context:n,currentTheme:e.theme})}async function Jc(e){if(e.tab==="overview"&&await Zc(e),e.tab==="channels"&&await uh(e),e.tab==="instances"&&await nr(e),e.tab==="sessions"&&await Yt(e),e.tab==="cron"&&await zs(e),e.tab==="skills"&&await rs(e),e.tab==="market"&&await Xo(e),e.tab==="agents"){await Uo(e),await Hn(e),await Ae(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&gc(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(uc(e,n),e.agentsPanel==="skills"&&Cs(e,n),e.agentsPanel==="channels"&&Me(e,!1),e.agentsPanel==="cron"&&zs(e))}e.tab==="models"&&await zc(e),e.tab==="nodes"&&(await ni(e),await Et(e),await Ae(e),await Yo(e)),e.tab==="chat"&&(await gd(e),ts(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await tc(e),await Ae(e)),e.tab==="debug"&&(await ti(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Oo(e,{reset:!0}),rc(e,!0))}function ih(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Xt(e):qc(window.location.pathname)}function oh(e){e.theme=e.settings.theme??"system",ci(e,sr(e.theme))}function ci(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function rh(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"&&ci(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function ah(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 lh(e,t){if(typeof window>"u")return;const n=Wc(window.location.pathname,e.basePath)??"chat";Qc(e,n),Xc(e,n,t)}function ch(e){if(typeof window>"u")return;const t=Wc(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,At(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Qc(e,t)}function Qc(e,t){Yc(e,t,{refreshPolicy:"connected"})}function Yc(e,t,n){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?ac(e):lc(e),t==="debug"?cc(e):dc(e),(n.refreshPolicy==="always"||e.connected)&&Jc(e),n.syncUrl&&Xc(e,t,!1)}function Xc(e,t,n){if(typeof window>"u")return;const s=Xn(li(t,e.basePath)),i=Xn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),i!==s&&(o.pathname=s),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}function dh(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 Zc(e){await Promise.all([Me(e,!1),nr(e),Yt(e),ss(e),ti(e)])}async function uh(e){await Promise.all([Me(e,!0),tc(e),Ae(e)])}async function zs(e){const t=e;if(await Promise.all([Me(e,!1),ss(t),si(t),tf(t)]),t.cronRunsScope==="all"){await yt(t,null);return}t.cronRunsJobId&&await yt(t,t.cronRunsJobId)}const ma=50,gh=80,fh=12e4;function Oe(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function an(e,t){const n=Oe(t);if(!n)return null;const s=Oe(e);if(s){const o=`${s}/`;if(n.toLowerCase().startsWith(o.toLowerCase())){const r=n.slice(o.length).trim();if(r)return`${s}/${r}`}return`${s}/${n}`}const i=n.indexOf("/");if(i>0){const o=n.slice(0,i).trim(),r=n.slice(i+1).trim();if(o&&r)return`${o}/${r}`}return n}function ph(e){return Array.isArray(e)?e.map(t=>Oe(t)).filter(t=>!!t):[]}function hh(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const s=n,i=Oe(s.provider),o=Oe(s.model);if(!i||!o)continue;const r=Oe(s.reason)?.replace(/_/g," ")??Oe(s.code)??(typeof s.status=="number"?`HTTP ${s.status}`:null)??Oe(s.error)??"error";t.push({provider:i,model:o,reason:r})}return t}function mh(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 o=i;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
129
|
+
`)}function va(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=mh(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=fc(n,fh);return s.truncated?`${s.text}
|
|
130
|
+
|
|
131
|
+
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function vh(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 bh(e){if(e.toolStreamOrder.length<=ma)return;const t=e.toolStreamOrder.length-ma,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function yh(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function fo(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),yh(e)}function $h(e,t=!1){if(t){fo(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>fo(e),gh))}function di(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],fo(e)}const xh=5e3,wh=8e3;function Sh(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},xh))}function ed(e,t,n){const s=typeof t.sessionKey=="string"?t.sessionKey:void 0;return s&&s!==e.sessionKey?{accepted:!1}:!e.chatRunId&&n?.allowSessionScopedWhenIdle&&s?{accepted:!0,sessionKey:s}:!s&&e.chatRunId&&t.runId!==e.chatRunId?{accepted:!1}:e.chatRunId&&t.runId!==e.chatRunId?{accepted:!1}:e.chatRunId?{accepted:!0,sessionKey:s}:{accepted:!1}}function kh(e,t){const n=t.data??{},s=t.stream==="fallback"?"fallback":Oe(n.phase);if(t.stream==="lifecycle"&&s!=="fallback"&&s!=="fallback_cleared"||!ed(e,t,{allowSessionScopedWhenIdle:!0}).accepted)return;const o=an(n.selectedProvider,n.selectedModel)??an(n.fromProvider,n.fromModel),r=an(n.activeProvider,n.activeModel)??an(n.toProvider,n.toModel),l=an(n.previousActiveProvider,n.previousActiveModel)??Oe(n.previousActiveModel);if(!o||!r||s==="fallback"&&o===r)return;const a=Oe(n.reasonSummary)??Oe(n.reason),d=(()=>{const g=ph(n.attemptSummaries);return g.length>0?g:hh(n.attempts).map(u=>`${an(u.provider,u.model)??`${u.provider}/${u.model}`}: ${u.reason}`)})();e.fallbackClearTimer!=null&&(window.clearTimeout(e.fallbackClearTimer),e.fallbackClearTimer=null),e.fallbackStatus={phase:s==="fallback_cleared"?"cleared":"active",selected:o,active:s==="fallback_cleared"?o:r,previous:s==="fallback_cleared"?l??(r!==o?r:void 0):void 0,reason:a??void 0,attempts:d,occurredAt:Date.now()},e.fallbackClearTimer=window.setTimeout(()=>{e.fallbackStatus=null,e.fallbackClearTimer=null},wh)}function Ah(e,t){if(!t)return;if(t.stream==="compaction"){Sh(e,t);return}if(t.stream==="lifecycle"||t.stream==="fallback"){kh(e,t);return}if(t.stream!=="tool")return;const n=ed(e,t);if(!n.accepted)return;const s=n.sessionKey,i=t.data??{},o=typeof i.toolCallId=="string"?i.toolCallId:"";if(!o)return;const r=typeof i.name=="string"?i.name:"tool",l=typeof i.phase=="string"?i.phase:"",a=l==="start"?i.args:void 0,d=l==="update"?va(i.partialResult):l==="result"?va(i.result):void 0,g=Date.now();let u=e.toolStreamById.get(o);u?(u.name=r,a!==void 0&&(u.args=a),d!==void 0&&(u.output=d||void 0),u.updatedAt=g):(u={toolCallId:o,runId:t.runId,sessionKey:s,name:r,args:a,output:d||void 0,startedAt:typeof t.ts=="number"?t.ts:g,updatedAt:g,message:{}},e.toolStreamById.set(o,u),e.toolStreamOrder.push(o)),u.message=vh(u),bh(e),$h(e,l==="result")}const td=["Conversation info (untrusted metadata):","Sender (untrusted metadata):","Thread starter (untrusted, for context):","Replied message (untrusted, for context):","Forwarded message context (untrusted metadata):","Chat history since last reply (untrusted, for context):"],nd="Untrusted context (metadata, do not treat as instructions or commands):",Ch=new RegExp([...td,nd].map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"));function Th(e){const t=e.trim();return td.some(n=>n===t)}function Eh(e,t){if(e[t]?.trim()!==nd)return!1;const n=e.slice(t+1,Math.min(e.length,t+8)).join(`
|
|
132
|
+
`);return/<<<EXTERNAL_UNTRUSTED_CONTENT|UNTRUSTED channel metadata \(|Source:\s+/.test(n)}function sd(e){if(!e||!Ch.test(e))return e;const t=e.split(`
|
|
133
|
+
`),n=[];let s=!1,i=!1;for(let o=0;o<t.length;o++){const r=t[o];if(!s&&Eh(t,o))break;if(!s&&Th(r)){if(t[o+1]?.trim()!=="```json"){n.push(r);continue}s=!0,i=!1;continue}if(s){if(!i&&r.trim()==="```json"){i=!0;continue}if(i){r.trim()==="```"&&(s=!1,i=!1);continue}if(r.trim()==="")continue;s=!1}n.push(r)}return n.join(`
|
|
134
|
+
`).replace(/^\n+/,"").replace(/\n+$/,"")}const _h=/^\[([^\]]+)\]\s*/,Ih=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","Google Chat","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"];function Rh(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:Ih.some(t=>e.startsWith(`${t} `))}function ba(e){const t=e.match(_h);if(!t)return e;const n=t[1]??"";return Rh(n)?e.slice(t[0].length):e}const Ii=new WeakMap,Ri=new WeakMap;function Mh(e,t){const n=t.toLowerCase()==="user";return t==="assistant"?Zg(e):n?sd(ba(e)):ba(e)}function js(e){const t=e,n=typeof t.role=="string"?t.role:"",s=od(e);return s?Mh(s,n):null}function id(e){if(!e||typeof e!="object")return js(e);const t=e;if(Ii.has(t))return Ii.get(t)??null;const n=js(e);return Ii.set(t,n),n}function ya(e){const n=e.content,s=[];if(Array.isArray(n))for(const l of n){const a=l;if(a.type==="thinking"&&typeof a.thinking=="string"){const d=a.thinking.trim();d&&s.push(d)}}if(s.length>0)return s.join(`
|
|
135
|
+
`);const i=od(e);if(!i)return null;const r=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(l=>(l[1]??"").trim()).filter(Boolean);return r.length>0?r.join(`
|
|
136
|
+
`):null}function Lh(e){if(!e||typeof e!="object")return ya(e);const t=e;if(Ri.has(t))return Ri.get(t)??null;const n=ya(e);return Ri.set(t,n),n}function od(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const o=i;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
|
|
137
|
+
`)}return typeof t.text=="string"?t.text:null}function Dh(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(`
|
|
138
|
+
`):""}let $a=!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 Ph(){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 Fh(){$a||($a=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function ui(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 Fh(),xa(Ph())}const Nh=/^\s*NO_REPLY\s*$/,Oh="bitseek_topup_required",Uh="https://bitseek.ai/api-settings",Bh="API Prompts Exhausted",Hh="Manage your subscription to resume local intelligence.",zh="Your BitSeek Claw instance has insufficient prompts to process this request. Please visit API Settings to view your usage or upgrade your plan.",jh="View in API Settings";function zn(e){return Nh.test(e)}function _s(e){if(!e||typeof e!="object")return!1;const t=e;if((typeof t.role=="string"?t.role.toLowerCase():"")!=="assistant")return!1;if(typeof t.text=="string")return zn(t.text);const s=js(e);return typeof s=="string"&&zn(s)}function Kh(e){return{id:e,title:Bh,subtitle:Hh,message:zh,primaryActionLabel:jh,url:Uh}}function Wh(e,t){if(t.uiHint!==Oh)return;const n=typeof t.runId=="string"&&t.runId.trim()?t.runId.trim():`error-${Date.now()}`;e.chatBitSeekTopUpLastRunId!==n&&(e.chatBitSeekTopUpLastRunId=n,e.chatBitSeekTopUpPrompt=Kh(n))}function qh(e){e.chatBitSeekTopUpPrompt=null}async function gi(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}),n=Array.isArray(t.messages)?t.messages:[];e.chatMessages=n.filter(s=>!_s(s)),e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Gh(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}function rd(e,t){if(!e||typeof e!="object")return null;const n=e,s=n.role;if(typeof s=="string"){if((t.roleCaseSensitive?s:s.toLowerCase())!=="assistant")return null}else if(t.roleRequirement==="required")return null;return t.requireContentArray?Array.isArray(n.content)?n:null:!("content"in n)&&!(t.allowTextField&&"text"in n)?null:n}function Vh(e){return rd(e,{roleRequirement:"required",roleCaseSensitive:!0,requireContentArray:!0})}function wa(e){return rd(e,{roleRequirement:"optional",allowTextField:!0})}async function Jh(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 o=Date.now(),r=[];if(s&&r.push({type:"text",text:s}),i)for(const d of n)r.push({type:"image",source:{type:"base64",media_type:d.mimeType,data:d.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:r,timestamp:o}],e.chatSending=!0,e.lastError=null;const l=ui();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=o;const a=i?n.map(d=>{const g=Gh(d.dataUrl);return g?{type:"image",mimeType:g.mimeType,content:g.content}:null}).filter(d=>d!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:a}),l}catch(d){const g=String(d);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 Qh(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 Yh(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId){if(t.state==="final"){const n=wa(t.message);return n&&!_s(n)?(e.chatMessages=[...e.chatMessages,n],null):"final"}return null}if(t.state==="delta"){const n=js(t.message);if(typeof n=="string"&&!zn(n)){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else if(t.state==="final"){const n=wa(t.message);n&&!_s(n)?e.chatMessages=[...e.chatMessages,n]:e.chatStream?.trim()&&!zn(e.chatStream)&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:e.chatStream}],timestamp:Date.now()}]),e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else if(t.state==="aborted"){const n=Vh(t.message);if(n&&!_s(n))e.chatMessages=[...e.chatMessages,n];else{const s=e.chatStream??"";s.trim()&&!zn(s)&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:s}],timestamp:Date.now()}])}e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error",Wh(e,t));return t.state}const ad=120;function ld(e){return e.chatSending||!!e.chatRunId}function Xh(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 Zh(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 cd(e){e.connected&&(e.chatMessage="",await Qh(e))}function em(e,t,n,s){const i=t.trim(),o=!!(n&&n.length>0);!i&&!o||(e.chatQueue=[...e.chatQueue,{id:ui(),text:i,createdAt:Date.now(),attachments:o?n?.map(r=>({...r})):void 0,refreshSessions:s}])}async function dd(e,t,n){di(e);const s=await Jh(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Vc(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),ts(e),i&&!e.chatRunId&&ud(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function ud(e){if(!e.connected||ld(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await dd(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function tm(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function nm(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],l=r.length>0;if(!i&&!l)return;if(Xh(i)){await cd(e);return}const a=Zh(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),ld(e)){em(e,i,r,a);return}await dd(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:a})}async function gd(e,t){await Promise.all([gi(e),Yt(e,{activeMinutes:ad}),fd(e)]),t?.scheduleScroll!==!1&&ts(e)}const sm=ud;function im(e){const t=Lg(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function om(e,t){const n=Xt(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function fd(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=im(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=om(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),o=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const rm="update.available";function am(e){if(!e||e.state!=="final")return!1;if(!e.message||typeof e.message!="object")return!0;const t=e.message,n=typeof t.role=="string"?t.role.toLowerCase():"";return!!(n&&n!=="assistant")}function Sa(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}const lm=50,cm=200,dm="Assistant";function ir(e){const t=Sa(e?.name,lm)??dm,n=Sa(e?.avatar??void 0,cm)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}async function pd(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 o=ir(i);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function po(e){return typeof e=="object"&&e!==null}function um(e){if(!po(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!po(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,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!o?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:o}}function gm(e){if(!po(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 hd(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function fm(e,t){const n=hd(e).filter(s=>s.id!==t.id);return n.push(t),n}function ka(e,t){return hd(e).filter(n=>n.id!==t)}function pm(e){const t=e.scopes.join(","),n=e.token??"";return["v2",e.deviceId,e.clientId,e.clientMode,e.role,t,String(e.signedAtMs),n,e.nonce].join("|")}const md={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"},Aa=md,ho={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(md));new Set(Object.values(ho));const xe={AUTH_REQUIRED:"AUTH_REQUIRED",AUTH_UNAUTHORIZED:"AUTH_UNAUTHORIZED",AUTH_TOKEN_MISSING:"AUTH_TOKEN_MISSING",AUTH_TOKEN_MISMATCH:"AUTH_TOKEN_MISMATCH",AUTH_TOKEN_NOT_CONFIGURED:"AUTH_TOKEN_NOT_CONFIGURED",AUTH_PASSWORD_MISSING:"AUTH_PASSWORD_MISSING",AUTH_PASSWORD_MISMATCH:"AUTH_PASSWORD_MISMATCH",AUTH_PASSWORD_NOT_CONFIGURED:"AUTH_PASSWORD_NOT_CONFIGURED",AUTH_DEVICE_TOKEN_MISMATCH:"AUTH_DEVICE_TOKEN_MISMATCH",AUTH_RATE_LIMITED:"AUTH_RATE_LIMITED",AUTH_TAILSCALE_IDENTITY_MISSING:"AUTH_TAILSCALE_IDENTITY_MISSING",AUTH_TAILSCALE_PROXY_MISSING:"AUTH_TAILSCALE_PROXY_MISSING",AUTH_TAILSCALE_WHOIS_FAILED:"AUTH_TAILSCALE_WHOIS_FAILED",AUTH_TAILSCALE_IDENTITY_MISMATCH:"AUTH_TAILSCALE_IDENTITY_MISMATCH",CONTROL_UI_DEVICE_IDENTITY_REQUIRED:"CONTROL_UI_DEVICE_IDENTITY_REQUIRED",DEVICE_IDENTITY_REQUIRED:"DEVICE_IDENTITY_REQUIRED",PAIRING_REQUIRED:"PAIRING_REQUIRED"};function hm(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.code;return typeof t=="string"&&t.trim().length>0?t:null}class Ca extends Error{constructor(t){super(t.message),this.name="GatewayRequestError",this.gatewayCode=t.code,this.details=t.details}}function mm(e){return hm(e?.details)}const vm=4008;class bm{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.pendingConnectError=void 0,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??""),s=this.pendingConnectError;this.pendingConnectError=void 0,this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n,error:s}),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,o=!1,r=this.opts.token;if(t){i=await Qo();const g=kf({deviceId:i.deviceId,role:s})?.token;r=g??this.opts.token,o=!!(g&&this.opts.token)}const l=r||this.opts.password?{token:r,password:this.opts.password}:void 0;let a;if(t&&i){const g=Date.now(),u=this.connectNonce??"",f=pm({deviceId:i.deviceId,clientId:this.opts.clientName??Aa.CONTROL_UI,clientMode:this.opts.mode??ho.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:r??null,nonce:u}),v=await Jf(i.privateKey,f);a={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:g,nonce:u}}const d={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Aa.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??ho.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:a,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",d).then(g=>{g?.auth?.deviceToken&&i&&yc({deviceId:i.deviceId,role:g.auth.role??s,token:g.auth.deviceToken,scopes:g.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(g)}).catch(g=>{g instanceof Ca?this.pendingConnectError={code:g.gatewayCode,message:g.message,details:g.details}:this.pendingConnectError=void 0,o&&i&&$c({deviceId:i.deviceId,role:s}),this.ws?.close(vm,"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 r=i.payload,l=r&&typeof r.nonce=="string"?r.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const o=typeof i.seq=="number"?i.seq:null;o!==null&&(this.lastSeq!==null&&o>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:o}),this.lastSeq=o);try{this.opts.onEvent?.(i)}catch(r){console.error("[gateway] event handler error:",r)}return}if(s.type==="res"){const i=n,o=this.pending.get(i.id);if(!o)return;this.pending.delete(i.id),i.ok?o.resolve(i.payload):o.reject(new Ca({code:i.error?.code??"UNAVAILABLE",message:i.error?.message??"request failed",details:i.error?.details}));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=ui(),i={type:"req",id:s,method:t,params:n},o=new Promise((r,l)=>{this.pending.set(s,{resolve:a=>r(a),reject:l})});return this.ws.send(JSON.stringify(i)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Mi(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",o=t.defaultAgentId?.trim();return n==="main"||n===i||o&&(n===`agent:${o}:main`||n===`agent:${o}:${i}`)?s:n}function ym(e,t){if(!t?.mainSessionKey)return;const n=Mi(e.sessionKey,t),s=Mi(e.settings.sessionKey,t),i=Mi(e.settings.lastActiveSessionKey,t),o=n||s||e.sessionKey,r={...e.settings,sessionKey:s||o,lastActiveSessionKey:i||o},l=r.sessionKey!==e.settings.sessionKey||r.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),l&&At(e,r)}function vd(e){e.lastError=null,e.lastErrorCode=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=e.client,n=new bm({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",instanceId:e.clientInstanceId,onHello:s=>{e.client===n&&(e.connected=!0,e.lastError=null,e.lastErrorCode=null,e.hello=s,km(e,s),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,di(e),pd(e),Uo(e),Hn(e),Ae(e),ni(e,{quiet:!0}),Et(e,{quiet:!0}),Jc(e))},onClose:({code:s,reason:i,error:o})=>{if(e.client===n)if(e.connected=!1,e.lastErrorCode=mm(o)??(typeof o?.code=="string"?o.code:null),s!==1012){if(o?.message){e.lastError=o.message;return}e.lastError=`disconnected (${s}): ${i||"no reason"}`}else e.lastError=null,e.lastErrorCode=null},onEvent:s=>{e.client===n&&$m(e,s)},onGap:({expected:s,received:i})=>{e.client===n&&(e.lastError=`event gap detected (expected seq ${s}, got ${i}); refresh recommended`,e.lastErrorCode=null)}});e.client=n,t?.stop(),n.start()}function $m(e,t){try{Sm(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function xm(e,t,n){if(n!=="final"&&n!=="error"&&n!=="aborted")return;di(e),sm(e);const s=t?.runId;!s||!e.refreshSessionsAfterChat.has(s)||(e.refreshSessionsAfterChat.delete(s),n==="final"&&Yt(e,{activeMinutes:ad}))}function wm(e,t){t?.sessionKey&&Vc(e,t.sessionKey);const n=Yh(e,t);xm(e,t,n),n==="final"&&am(t)&&gi(e)}function Sm(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;Ah(e,t.payload);return}if(t.event==="chat"){wm(e,t.payload);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"&&zs(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Et(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=um(t.payload);if(n){e.execApprovalQueue=fm(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=ka(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=gm(t.payload);n&&(e.execApprovalQueue=ka(e.execApprovalQueue,n.id));return}if(t.event===rm){const n=t.payload;e.updateAvailable=n?.updateAvailable??null}}function km(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&ym(e,n.sessionDefaults),e.updateAvailable=n?.updateAvailable??null}const Ta="/__openclaw/control-ui-config.json";async function Am(e){if(typeof window>"u"||typeof fetch!="function")return;const t=Xt(e.basePath??""),n=t?`${t}${Ta}`:Ta;try{const s=await fetch(n,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin"});if(!s.ok)return;const i=await s.json(),o=ir({agentId:i.assistantAgentId??null,name:i.assistantName,avatar:i.assistantAvatar??null});e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function Cm(e){e.basePath=ih(),Am(e),th(e),lh(e,!0),oh(e),rh(e),window.addEventListener("popstate",e.popStateHandler),vd(e),Kg(e),e.tab==="logs"&&ac(e),e.tab==="debug"&&cc(e)}function Tm(e){Ng(e)}function Em(e){window.removeEventListener("popstate",e.popStateHandler),Wg(e),lc(e),dc(e),e.client?.stop(),e.client=null,e.connected=!1,ah(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function _m(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;ts(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&rc(e,t.has("tab")||t.has("logsAutoFollow"))}}const bd="openclaw.control.usage.date-params.v1",Im="__default__",Rm=/unexpected property ['"]mode['"]/i,Mm=/unexpected property ['"]utcoffset['"]/i,Lm=/invalid sessions\.usage params/i;let Li=null;function yd(){return typeof window<"u"&&window.localStorage?window.localStorage:typeof localStorage<"u"?localStorage:null}function Dm(){const e=yd();if(!e)return new Set;try{const t=e.getItem(bd);if(!t)return new Set;const n=JSON.parse(t);return!n||!Array.isArray(n.unsupportedGatewayKeys)?new Set:new Set(n.unsupportedGatewayKeys.filter(s=>typeof s=="string").map(s=>s.trim()).filter(Boolean))}catch{return new Set}}function Pm(e){const t=yd();if(t)try{t.setItem(bd,JSON.stringify({unsupportedGatewayKeys:Array.from(e)}))}catch{}}function $d(){return Li||(Li=Dm()),Li}function Fm(e){const t=e?.trim();if(!t)return Im;try{const n=new URL(t),s=n.pathname==="/"?"":n.pathname;return`${n.protocol}//${n.host}${s}`.toLowerCase()}catch{return t.toLowerCase()}}function xd(e){return Fm(e.settings?.gatewayUrl)}function Nm(e){return!$d().has(xd(e))}function Om(e){const t=$d();t.add(xd(e)),Pm(t)}function Um(e){const t=wd(e);return Lm.test(t)&&(Rm.test(t)||Mm.test(t))}const Bm=e=>{const t=-e,n=t>=0?"+":"-",s=Math.abs(t),i=Math.floor(s/60),o=s%60;return o===0?`UTC${n}${i}`:`UTC${n}${i}:${o.toString().padStart(2,"0")}`},Hm=(e,t)=>{if(t)return e==="utc"?{mode:"utc"}:{mode:"specific",utcOffset:Bm(new Date().getTimezoneOffset())}};function wd(e){if(typeof e=="string")return e;if(e instanceof Error&&typeof e.message=="string"&&e.message.trim())return e.message;if(e&&typeof e=="object")try{const t=JSON.stringify(e);if(t)return t}catch{}return"request failed"}async function mo(e,t){const n=e.client;if(!(!n||!e.connected)&&!e.usageLoading){e.usageLoading=!0,e.usageError=null;try{const s=t?.startDate??e.usageStartDate,i=t?.endDate??e.usageEndDate,o=async a=>{const d=Hm(e.usageTimeZone,a);return await Promise.all([n.request("sessions.usage",{startDate:s,endDate:i,...d,limit:1e3,includeContextWeight:!0}),n.request("usage.cost",{startDate:s,endDate:i,...d})])},r=(a,d)=>{a&&(e.usageResult=a),d&&(e.usageCostSummary=d)},l=Nm(e);try{const[a,d]=await o(l);r(a,d)}catch(a){if(l&&Um(a)){Om(e);const[d,g]=await o(!1);r(d,g)}else throw a}}catch(s){e.usageError=wd(s)}finally{e.usageLoading=!1}}}async function zm(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 jm(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:1e3});n&&Array.isArray(n.logs)&&(e.usageSessionLogs=n.logs)}catch{e.usageSessionLogs=null}finally{e.usageSessionLogsLoading=!1}}}const Km=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),Ks=e=>e.trim().toLowerCase(),Wm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},Ut=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},or=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const o=s.slice(0,i),r=s.slice(i+1);return{key:o,value:r,raw:s}}return{value:s,raw:s}}),qm=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),Ea=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)},_a=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)},Gm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),Vm=(e,t)=>{const n=Ks(t.value??"");if(!n)return!0;if(!t.key)return qm(e).some(i=>i.includes(n));switch(Ks(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 Ea(e).some(i=>i.includes(n));case"model":return _a(e).some(i=>i.includes(n));case"tool":return Gm(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=Wm(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 _a(e).length>0;case"provider":return Ea(e).length>0;default:return!0}case"mintokens":{const i=Ut(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=Ut(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=Ut(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=Ut(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=Ut(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=Ut(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},Jm=(e,t)=>{const n=or(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const o of n){if(!o.key)continue;const r=Ks(o.key);if(!Km.has(r)){s.push(`Unknown filter: ${o.key}`);continue}if(o.value===""&&s.push(`Missing value for ${o.key}`),r==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);o.value&&!l.has(Ks(o.value))&&s.push(`Unknown has:${o.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(r)&&o.value&&Ut(o.value)===null&&s.push(`Invalid number for ${o.key}`)}return{sessions:e.filter(o=>n.every(r=>Vm(o,r))),warnings:s}};function Sd(e){const t=e.split(`
|
|
139
139
|
`),n=new Map,s=[];for(const l of t){const a=/^\[Tool:\s*([^\]]+)\]/.exec(l.trim());if(a){const d=a[1];n.set(d,(n.get(d)??0)+1);continue}l.trim().startsWith("[Tool Result]")||s.push(l)}const i=Array.from(n.entries()).toSorted((l,a)=>a[1]-l[1]),o=i.reduce((l,[,a])=>l+a,0),r=i.length>0?`Tools: ${i.map(([l,a])=>`${l}×${a}`).join(", ")} (${o} calls)`:"";return{tools:i,summary:r,cleanContent:s.join(`
|
|
140
|
-
`).trim()}}function
|
|
140
|
+
`).trim()}}function Qm(e,t){!t||t.count<=0||(e.count+=t.count,e.sum+=t.avgMs*t.count,e.min=Math.min(e.min,t.minMs),e.max=Math.max(e.max,t.maxMs),e.p95Max=Math.max(e.p95Max,t.p95Ms))}function Ym(e,t){for(const n of t??[]){const s=e.get(n.date)??{date:n.date,count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};s.count+=n.count,s.sum+=n.avgMs*n.count,s.min=Math.min(s.min,n.minMs),s.max=Math.max(s.max,n.maxMs),s.p95Max=Math.max(s.p95Max,n.p95Ms),e.set(n.date,s)}}function Xm(e){return{byChannel:Array.from(e.byChannelMap.entries()).map(([t,n])=>({channel:t,totals:n})).toSorted((t,n)=>n.totals.totalCost-t.totals.totalCost),latency:e.latencyTotals.count>0?{count:e.latencyTotals.count,avgMs:e.latencyTotals.sum/e.latencyTotals.count,minMs:e.latencyTotals.min===Number.POSITIVE_INFINITY?0:e.latencyTotals.min,maxMs:e.latencyTotals.max,p95Ms:e.latencyTotals.p95Max}:void 0,dailyLatency:Array.from(e.dailyLatencyMap.values()).map(t=>({date:t.date,count:t.count,avgMs:t.count?t.sum/t.count:0,minMs:t.min===Number.POSITIVE_INFINITY?0:t.min,maxMs:t.max,p95Ms:t.p95Max})).toSorted((t,n)=>t.date.localeCompare(n.date)),modelDaily:Array.from(e.modelDailyMap.values()).toSorted((t,n)=>t.date.localeCompare(n.date)||n.cost-t.cost),daily:Array.from(e.dailyMap.values()).toSorted((t,n)=>t.date.localeCompare(n.date))}}const Zm=4;function Lt(e){return Math.round(e/Zm)}function H(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function ev(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function tv(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:24},()=>0);for(const i of e){const o=i.usage;if(!o?.messageCounts||o.messageCounts.total===0)continue;const r=o.firstActivity??i.updatedAt,l=o.lastActivity??i.updatedAt;if(!r||!l)continue;const a=Math.min(r,l),d=Math.max(r,l),u=Math.max(d-a,1)/6e4;let f=a;for(;f<d;){const v=new Date(f),m=rr(v,t),S=ar(v,t),T=Math.min(S.getTime(),d),I=Math.max((T-f)/6e4,0)/u;n[m]+=o.messageCounts.errors*I,s[m]+=o.messageCounts.total*I,f=T+1}}return s.map((i,o)=>{const r=n[o],l=i>0?r/i:0;return{hour:o,rate:l,errors:r,msgs:i}}).filter(i=>i.msgs>0&&i.errors>0).toSorted((i,o)=>o.rate-i.rate).slice(0,5).map(i=>({label:ev(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const nv=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function rr(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function sv(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function ar(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function iv(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:7},()=>0);let i=0,o=!1;for(const l of e){const a=l.usage;if(!a||!a.totalTokens||a.totalTokens<=0)continue;i+=a.totalTokens;const d=a.firstActivity??l.updatedAt,g=a.lastActivity??l.updatedAt;if(!d||!g)continue;o=!0;const u=Math.min(d,g),f=Math.max(d,g),m=Math.max(f-u,1)/6e4;let S=u;for(;S<f;){const T=new Date(S),M=rr(T,t),I=sv(T,t),A=ar(T,t),w=Math.min(A.getTime(),f),E=Math.max((w-S)/6e4,0)/m;n[M]+=a.totalTokens*E,s[I]+=a.totalTokens*E,S=w+1}}const r=nv.map((l,a)=>({label:l,tokens:s[a]}));return{hasData:o,totalTokens:i,hourTotals:n,weekdayTotals:r}}function ov(e,t,n,s){const i=iv(e,t);if(!i.hasData)return c`
|
|
141
141
|
<div class="card usage-mosaic">
|
|
142
142
|
<div class="usage-mosaic-header">
|
|
143
143
|
<div>
|
|
@@ -201,9 +201,9 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
201
201
|
</div>
|
|
202
202
|
</div>
|
|
203
203
|
</div>
|
|
204
|
-
`}function se(e,t=2){return`$${e.toFixed(t)}`}function Di(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function kd(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const[,n,s,i]=t,o=new Date(Date.UTC(Number(n),Number(s)-1,Number(i)));return Number.isNaN(o.valueOf())?null:o}function Ad(e){const t=kd(e);return t?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e}function
|
|
205
|
-
`)},
|
|
206
|
-
`)},
|
|
204
|
+
`}function se(e,t=2){return`$${e.toFixed(t)}`}function Di(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function kd(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const[,n,s,i]=t,o=new Date(Date.UTC(Number(n),Number(s)-1,Number(i)));return Number.isNaN(o.valueOf())?null:o}function Ad(e){const t=kd(e);return t?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e}function rv(e){const t=kd(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):e}const ms=()=>({input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),vs=(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},av=(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,o=new Map,r=new Map,l=new Map,a=new Map,d=new Map,g=new Map,u={count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};for(const v of e){const m=v.usage;if(m){if(m.messageCounts&&(n.total+=m.messageCounts.total,n.user+=m.messageCounts.user,n.assistant+=m.messageCounts.assistant,n.toolCalls+=m.messageCounts.toolCalls,n.toolResults+=m.messageCounts.toolResults,n.errors+=m.messageCounts.errors),m.toolUsage)for(const S of m.toolUsage.tools)s.set(S.name,(s.get(S.name)??0)+S.count);if(m.modelUsage)for(const S of m.modelUsage){const T=`${S.provider??"unknown"}::${S.model??"unknown"}`,M=i.get(T)??{provider:S.provider,model:S.model,count:0,totals:ms()};M.count+=S.count,vs(M.totals,S.totals),i.set(T,M);const I=S.provider??"unknown",A=o.get(I)??{provider:S.provider,model:void 0,count:0,totals:ms()};A.count+=S.count,vs(A.totals,S.totals),o.set(I,A)}if(Qm(u,m.latency),v.agentId){const S=r.get(v.agentId)??ms();vs(S,m),r.set(v.agentId,S)}if(v.channel){const S=l.get(v.channel)??ms();vs(S,m),l.set(v.channel,S)}for(const S of m.dailyBreakdown??[]){const T=a.get(S.date)??{date:S.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};T.tokens+=S.tokens,T.cost+=S.cost,a.set(S.date,T)}for(const S of m.dailyMessageCounts??[]){const T=a.get(S.date)??{date:S.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};T.messages+=S.total,T.toolCalls+=S.toolCalls,T.errors+=S.errors,a.set(S.date,T)}Ym(d,m.dailyLatency);for(const S of m.dailyModelUsage??[]){const T=`${S.date}::${S.provider??"unknown"}::${S.model??"unknown"}`,M=g.get(T)??{date:S.date,provider:S.provider,model:S.model,tokens:0,cost:0,count:0};M.tokens+=S.tokens,M.cost+=S.cost,M.count+=S.count,g.set(T,M)}}}const f=Xm({byChannelMap:l,latencyTotals:u,dailyLatencyMap:d,modelDailyMap:g,dailyMap:a});return{messages:n,tools:{totalCalls:Array.from(s.values()).reduce((v,m)=>v+m,0),uniqueTools:s.size,tools:Array.from(s.entries()).map(([v,m])=>({name:v,count:m})).toSorted((v,m)=>m.count-v.count)},byModel:Array.from(i.values()).toSorted((v,m)=>m.totals.totalCost-v.totals.totalCost),byProvider:Array.from(o.values()).toSorted((v,m)=>m.totals.totalCost-v.totals.totalCost),byAgent:Array.from(r.entries()).map(([v,m])=>({agentId:v,totals:m})).toSorted((v,m)=>m.totals.totalCost-v.totals.totalCost),...f}},lv=(e,t,n)=>{let s=0,i=0;for(const g of e){const u=g.usage?.durationMs??0;u>0&&(s+=u,i+=1)}const o=i?s/i:0,r=t&&s>0?t.totalTokens/(s/6e4):void 0,l=t&&s>0?t.totalCost/(s/6e4):void 0,a=n.messages.total?n.messages.errors/n.messages.total:0,d=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,u)=>u.rate-g.rate||u.errors-g.errors)[0];return{durationSumMs:s,durationCount:i,avgDurationMs:o,throughputTokensPerMin:r,throughputCostPerMin:l,errorRate:a,peakErrorDay:d}};function Pi(e,t,n="text/plain"){const s=new Blob([t],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e,o.click(),URL.revokeObjectURL(i)}function cv(e){return/[",\n]/.test(e)?`"${e.replaceAll('"','""')}"`:e}function Ws(e){return e.map(t=>t==null?"":cv(String(t))).join(",")}const dv=e=>{const t=[Ws(["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(Ws([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(`
|
|
205
|
+
`)},uv=e=>{const t=[Ws(["date","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","inputCost","outputCost","cacheReadCost","cacheWriteCost","totalCost"])];for(const n of e)t.push(Ws([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(`
|
|
206
|
+
`)},gv=(e,t,n)=>{const s=e.trim();if(!s)return[];const i=s.length?s.split(/\s+/):[],o=i.length?i[i.length-1]:"",[r,l]=o.includes(":")?[o.slice(0,o.indexOf(":")),o.slice(o.indexOf(":")+1)]:["",""],a=r.toLowerCase(),d=l.toLowerCase(),g=I=>{const A=new Set;for(const w of I)w&&A.add(w);return Array.from(A)},u=g(t.map(I=>I.agentId)).slice(0,6),f=g(t.map(I=>I.channel)).slice(0,6),v=g([...t.map(I=>I.modelProvider),...t.map(I=>I.providerOverride),...n?.byProvider.map(I=>I.provider)??[]]).slice(0,6),m=g([...t.map(I=>I.model),...n?.byModel.map(I=>I.model)??[]]).slice(0,6),S=g(n?.tools.tools.map(I=>I.name)??[]).slice(0,6);if(!a)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 T=[],M=(I,A)=>{for(const w of A)(!d||w.toLowerCase().includes(d))&&T.push({label:`${I}:${w}`,value:`${I}:${w}`})};switch(a){case"agent":M("agent",u);break;case"channel":M("channel",f);break;case"provider":M("provider",v);break;case"model":M("model",m);break;case"tool":M("tool",S);break;case"has":["errors","tools","context","usage","model","provider"].forEach(I=>{(!d||I.includes(d))&&T.push({label:`has:${I}`,value:`has:${I}`})});break}return T},fv=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/);return s[s.length-1]=t,`${s.join(" ")} `},Ht=e=>e.trim().toLowerCase(),pv=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/),i=s[s.length-1]??"",o=t.includes(":")?t.split(":")[0]:null,r=i.includes(":")?i.split(":")[0]:null;return i.endsWith(":")&&o&&r===o?(s[s.length-1]=t,`${s.join(" ")} `):s.includes(t)?`${s.join(" ")} `:`${s.join(" ")} ${t} `},Ia=(e,t)=>{const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>i!==t);return s.length?`${s.join(" ")} `:""},Ra=(e,t,n)=>{const s=Ht(t),o=[...or(e).filter(r=>Ht(r.key??"")!==s).map(r=>r.raw),...n.map(r=>`${t}:${r}`)];return o.length?`${o.join(" ")} `:""};function mt(e,t){return t===0?0:e/t*100}function hv(e){const t=e.totalCost||0;return{input:{tokens:e.input,cost:e.inputCost||0,pct:mt(e.inputCost||0,t)},output:{tokens:e.output,cost:e.outputCost||0,pct:mt(e.outputCost||0,t)},cacheRead:{tokens:e.cacheRead,cost:e.cacheReadCost||0,pct:mt(e.cacheReadCost||0,t)},cacheWrite:{tokens:e.cacheWrite,cost:e.cacheWriteCost||0,pct:mt(e.cacheWriteCost||0,t)},totalCost:t}}function mv(e,t,n,s,i,o,r,l){if(!(e.length>0||t.length>0||n.length>0))return h;const d=n.length===1?s.find(m=>m.key===n[0]):null,g=d?(d.label||d.key).slice(0,20)+((d.label||d.key).length>20?"…":""):n.length===1?n[0].slice(0,8)+"…":`${n.length} sessions`,u=d?d.label||d.key:n.length===1?n[0]:n.join(", "),f=e.length===1?e[0]:`${e.length} days`,v=t.length===1?`${t[0]}:00`:`${t.length} hours`;return c`
|
|
207
207
|
<div class="active-filters">
|
|
208
208
|
${e.length>0?c`
|
|
209
209
|
<div class="filter-chip">
|
|
@@ -229,7 +229,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
229
229
|
</button>
|
|
230
230
|
`:h}
|
|
231
231
|
</div>
|
|
232
|
-
`}function
|
|
232
|
+
`}function vv(e,t,n,s,i,o){if(!e.length)return c`
|
|
233
233
|
<div class="daily-chart-compact">
|
|
234
234
|
<div class="sessions-panel-title">Daily Usage</div>
|
|
235
235
|
<div class="muted" style="padding: 20px; text-align: center">No data</div>
|
|
@@ -278,7 +278,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
278
278
|
${g?c`<div class="daily-bar-total">${L}</div>`:h}
|
|
279
279
|
<div class="daily-bar-label" style="${I}">${M}</div>
|
|
280
280
|
<div class="daily-bar-tooltip">
|
|
281
|
-
<strong>${
|
|
281
|
+
<strong>${rv(u.date)}</strong><br />
|
|
282
282
|
${H(u.totalTokens)} tokens<br />
|
|
283
283
|
${se(u.totalCost)}
|
|
284
284
|
${w.length?c`${w.map(E=>c`<div>${E}</div>`)}`:h}
|
|
@@ -288,7 +288,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
288
288
|
</div>
|
|
289
289
|
</div>
|
|
290
290
|
</div>
|
|
291
|
-
`}function
|
|
291
|
+
`}function bv(e,t){const n=hv(e),s=t==="tokens",i=e.totalTokens||1,o={output:mt(e.output,i),input:mt(e.input,i),cacheWrite:mt(e.cacheWrite,i),cacheRead:mt(e.cacheRead,i)};return c`
|
|
292
292
|
<div class="cost-breakdown cost-breakdown-compact">
|
|
293
293
|
<div class="cost-breakdown-header">${s?"Tokens":"Cost"} by Type</div>
|
|
294
294
|
<div class="cost-breakdown-bar">
|
|
@@ -328,7 +328,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
328
328
|
</div>
|
|
329
329
|
`}
|
|
330
330
|
</div>
|
|
331
|
-
`}function
|
|
331
|
+
`}function Ma(e,t,n){return c`
|
|
332
332
|
<div class="usage-insight-card">
|
|
333
333
|
<div class="usage-insight-title">${e}</div>
|
|
334
334
|
${t.length===0?c`<div class="muted">${n}</div>`:c`
|
|
@@ -343,7 +343,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
343
343
|
</div>
|
|
344
344
|
`}
|
|
345
345
|
</div>
|
|
346
|
-
`}function
|
|
346
|
+
`}function yv(e,t,n,s,i,o,r){if(!e)return h;const l=t.messages.total?Math.round(e.totalTokens/t.messages.total):0,a=t.messages.total?e.totalCost/t.messages.total:0,d=e.input+e.cacheRead,g=d>0?e.cacheRead/d:0,u=d>0?`${(g*100).toFixed(1)}%`:"—",f=n.errorRate*100,v=n.throughputTokensPerMin!==void 0?`${H(Math.round(n.throughputTokensPerMin))} tok/min`:"—",m=n.throughputCostPerMin!==void 0?`${se(n.throughputCostPerMin,4)} / min`:"—",S=n.durationCount>0?Bo(n.avgDurationMs,{spaced:!0})??"—":"—",T="Cache hit rate = cache read / (input + cache read). Higher is better.",M="Error rate = errors / total messages. Lower is better.",I="Throughput shows tokens per minute over active time. Higher is better.",A="Average tokens per message in this range.",w=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.",L=t.daily.filter(C=>C.messages>0&&C.errors>0).map(C=>{const N=C.errors/C.messages;return{label:Ad(C.date),value:`${(N*100).toFixed(2)}%`,sub:`${C.errors} errors · ${C.messages} msgs · ${H(C.tokens)}`,rate:N}}).toSorted((C,N)=>N.rate-C.rate).slice(0,5).map(({rate:C,...N})=>N),E=t.byModel.slice(0,5).map(C=>({label:C.model??"unknown",value:se(C.totals.totalCost),sub:`${H(C.totals.totalTokens)} · ${C.count} msgs`})),R=t.byProvider.slice(0,5).map(C=>({label:C.provider??"unknown",value:se(C.totals.totalCost),sub:`${H(C.totals.totalTokens)} · ${C.count} msgs`})),K=t.tools.tools.slice(0,6).map(C=>({label:C.name,value:`${C.count}`,sub:"calls"})),G=t.byAgent.slice(0,5).map(C=>({label:C.agentId,value:se(C.totals.totalCost),sub:H(C.totals.totalTokens)})),b=t.byChannel.slice(0,5).map(C=>({label:C.channel,value:se(C.totals.totalCost),sub:H(C.totals.totalTokens)}));return c`
|
|
347
347
|
<section class="card" style="margin-top: 16px;">
|
|
348
348
|
<div class="card-title">Usage Overview</div>
|
|
349
349
|
<div class="usage-summary-grid">
|
|
@@ -432,11 +432,11 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
432
432
|
${zt("Top Tools",K,"No tool calls")}
|
|
433
433
|
${zt("Top Agents",G,"No agent data")}
|
|
434
434
|
${zt("Top Channels",b,"No channel data")}
|
|
435
|
-
${
|
|
436
|
-
${
|
|
435
|
+
${Ma("Peak Error Days",L,"No error data")}
|
|
436
|
+
${Ma("Peak Error Hours",i,"No error data")}
|
|
437
437
|
</div>
|
|
438
438
|
</section>
|
|
439
|
-
`}function
|
|
439
|
+
`}function $v(e,t,n,s,i,o,r,l,a,d,g,u,f,v,m){const S=_=>f.includes(_),T=_=>{const O=_.label||_.key;return O.startsWith("agent:")&&O.includes("?token=")?O.slice(0,O.indexOf("?token=")):O},M=async _=>{const O=T(_);try{await navigator.clipboard.writeText(O)}catch{}},I=_=>{const O=[];return S("channel")&&_.channel&&O.push(`channel:${_.channel}`),S("agent")&&_.agentId&&O.push(`agent:${_.agentId}`),S("provider")&&(_.modelProvider||_.providerOverride)&&O.push(`provider:${_.modelProvider??_.providerOverride}`),S("model")&&_.model&&O.push(`model:${_.model}`),S("messages")&&_.usage?.messageCounts&&O.push(`msgs:${_.usage.messageCounts.total}`),S("tools")&&_.usage?.toolUsage&&O.push(`tools:${_.usage.toolUsage.totalCalls}`),S("errors")&&_.usage?.messageCounts&&O.push(`errors:${_.usage.messageCounts.errors}`),S("duration")&&_.usage?.durationMs&&O.push(`dur:${Bo(_.usage.durationMs,{spaced:!0})??"—"}`),O},A=_=>{const O=_.usage;if(!O)return 0;if(n.length>0&&O.dailyBreakdown&&O.dailyBreakdown.length>0){const q=O.dailyBreakdown.filter(oe=>n.includes(oe.date));return s?q.reduce((oe,re)=>oe+re.tokens,0):q.reduce((oe,re)=>oe+re.cost,0)}return s?O.totalTokens??0:O.totalCost??0},w=[...e].toSorted((_,O)=>{switch(i){case"recent":return(O.updatedAt??0)-(_.updatedAt??0);case"messages":return(O.usage?.messageCounts?.total??0)-(_.usage?.messageCounts?.total??0);case"errors":return(O.usage?.messageCounts?.errors??0)-(_.usage?.messageCounts?.errors??0);case"cost":return A(O)-A(_);default:return A(O)-A(_)}}),L=o==="asc"?w.toReversed():w,E=L.reduce((_,O)=>_+A(O),0),R=L.length?E/L.length:0,K=L.reduce((_,O)=>_+(O.usage?.messageCounts?.errors??0),0),G=(_,O)=>{const q=A(_),oe=T(_),re=I(_);return c`
|
|
440
440
|
<div
|
|
441
441
|
class="session-bar-row ${O?"selected":""}"
|
|
442
442
|
@click=${D=>a(_.key,D.shiftKey)}
|
|
@@ -533,7 +533,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
533
533
|
</div>
|
|
534
534
|
`:h}
|
|
535
535
|
</div>
|
|
536
|
-
`}const
|
|
536
|
+
`}const xv=.75,wv=8,Sv=.06,bs=5,Pe=12,ft=.7;function vt(e,t){return!t||t<=0?0:e/t*100}function kv(){return h}function Cd(e){return e<1e12?e*1e3:e}function Av(e,t,n){const s=Math.min(t,n),i=Math.max(t,n);return e.filter(o=>{if(o.timestamp<=0)return!0;const r=Cd(o.timestamp);return r>=s&&r<=i})}function Cv(e,t,n){const s=t||e.usage;if(!s)return c`
|
|
537
537
|
<div class="muted">No usage data for this session.</div>
|
|
538
538
|
`;const i=u=>u?new Date(u).toLocaleString():"—",o=[];e.channel&&o.push(`channel:${e.channel}`),e.agentId&&o.push(`agent:${e.agentId}`),(e.modelProvider||e.providerOverride)&&o.push(`provider:${e.modelProvider??e.providerOverride}`),e.model&&o.push(`model:${e.model}`);const r=s.toolUsage?.tools.slice(0,6)??[];let l,a,d;if(n){const u=new Map;for(const f of n){const{tools:v}=Sd(f.content);for(const[m]of v)u.set(m,(u.get(m)||0)+1)}d=r.map(f=>({label:f.name,value:`${u.get(f.name)??0}`,sub:"calls"})),l=[...u.values()].reduce((f,v)=>f+v,0),a=u.size}else d=r.map(u=>({label:u.name,value:`${u.count}`,sub:"calls"})),l=s.toolUsage?.totalCalls??0,a=s.toolUsage?.uniqueTools??0;const g=s.modelUsage?.slice(0,6).map(u=>({label:u.model??"unknown",value:se(u.totals.totalCost),sub:H(u.totals.totalTokens)}))??[];return c`
|
|
539
539
|
${o.length>0?c`<div class="usage-badges">${o.map(u=>c`<span class="usage-badge">${u}</span>`)}</div>`:h}
|
|
@@ -555,7 +555,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
555
555
|
</div>
|
|
556
556
|
<div class="session-summary-card">
|
|
557
557
|
<div class="session-summary-title">Duration</div>
|
|
558
|
-
<div class="session-summary-value">${
|
|
558
|
+
<div class="session-summary-value">${Bo(s.durationMs,{spaced:!0})??"—"}</div>
|
|
559
559
|
<div class="session-summary-meta">${i(s.firstActivity)} → ${i(s.lastActivity)}</div>
|
|
560
560
|
</div>
|
|
561
561
|
</div>
|
|
@@ -563,7 +563,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
563
563
|
${zt("Top Tools",d,"No tool calls")}
|
|
564
564
|
${zt("Model Mix",g,"No model data")}
|
|
565
565
|
</div>
|
|
566
|
-
`}function
|
|
566
|
+
`}function Tv(e,t,n,s){const i=Math.min(n,s),o=Math.max(n,s),r=t.filter(S=>S.timestamp>=i&&S.timestamp<=o);if(r.length===0)return;let l=0,a=0,d=0,g=0,u=0,f=0,v=0,m=0;for(const S of r)l+=S.totalTokens||0,a+=S.cost||0,u+=S.input||0,f+=S.output||0,v+=S.cacheRead||0,m+=S.cacheWrite||0,S.output>0&&g++,S.input>0&&d++;return{...e,totalTokens:l,totalCost:a,input:u,output:f,cacheRead:v,cacheWrite:m,durationMs:r[r.length-1].timestamp-r[0].timestamp,firstActivity:r[0].timestamp,lastActivity:r[r.length-1].timestamp,messageCounts:{total:r.length,user:d,assistant:g,toolCalls:0,toolResults:0,errors:0}}}function Ev(e,t,n,s,i,o,r,l,a,d,g,u,f,v,m,S,T,M,I,A,w,L,E,R,K,G){const b=e.label||e.key,C=b.length>50?b.slice(0,50)+"…":b,N=e.usage,W=l!==null&&a!==null,V=l!==null&&a!==null&&t?.points&&N?Tv(N,t.points,l,a):void 0,_=V?{totalTokens:V.totalTokens,totalCost:V.totalCost}:{totalTokens:N?.totalTokens??0,totalCost:N?.totalCost??0},O=V?" (filtered)":"";return c`
|
|
567
567
|
<div class="card session-detail-panel">
|
|
568
568
|
<div class="session-detail-header">
|
|
569
569
|
<div class="session-detail-header-left">
|
|
@@ -581,17 +581,17 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
581
581
|
<button class="session-close-btn" @click=${G} title="Close session details">×</button>
|
|
582
582
|
</div>
|
|
583
583
|
<div class="session-detail-content">
|
|
584
|
-
${
|
|
584
|
+
${Cv(e,V,l!=null&&a!=null&&v?Av(v,l,a):void 0)}
|
|
585
585
|
<div class="session-detail-row">
|
|
586
|
-
${
|
|
586
|
+
${_v(t,n,s,i,o,r,g,u,f,l,a,d)}
|
|
587
587
|
</div>
|
|
588
588
|
<div class="session-detail-bottom">
|
|
589
|
-
${
|
|
590
|
-
${
|
|
589
|
+
${Rv(v,m,S,T,M,I,A,w,L,E,W?l:null,W?a:null)}
|
|
590
|
+
${Iv(e.contextWeight,N,R,K)}
|
|
591
591
|
</div>
|
|
592
592
|
</div>
|
|
593
593
|
</div>
|
|
594
|
-
`}function
|
|
594
|
+
`}function _v(e,t,n,s,i,o,r,l,a,d,g,u){if(t)return c`
|
|
595
595
|
<div class="session-timeseries-compact">
|
|
596
596
|
<div class="muted" style="padding: 20px; text-align: center">Loading...</div>
|
|
597
597
|
</div>
|
|
@@ -603,7 +603,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
603
603
|
<div class="session-timeseries-compact">
|
|
604
604
|
<div class="muted" style="padding: 20px; text-align: center">No data in range</div>
|
|
605
605
|
</div>
|
|
606
|
-
`;let v=0,m=0,S=0,T=0,M=0,I=0;f=f.map(z=>(v+=z.totalTokens,m+=z.cost,S+=z.output,T+=z.input,M+=z.cacheRead,I+=z.cacheWrite,{...z,cumulativeTokens:v,cumulativeCost:m}));const A=d!=null&&g!=null,w=A?Math.min(d,g):0,L=A?Math.max(d,g):1/0;let E=0,R=f.length;if(A){E=f.findIndex(le=>le.timestamp>=w),E===-1&&(E=f.length);const z=f.findIndex(le=>le.timestamp>L);R=z===-1?f.length:z}const K=A?f.slice(E,R):f;let G=0,b=0,C=0,N=0;for(const z of K)G+=z.output,b+=z.input,C+=z.cacheRead,N+=z.cacheWrite;const W=400,V=100,_={top:8,right:4,bottom:14,left:30},O=W-_.left-_.right,q=V-_.top-_.bottom,oe=n==="cumulative",re=n==="per-turn"&&i==="by-type",D=G+b+C+N,F=f.map(z=>oe?z.cumulativeTokens:re?z.input+z.output+z.cacheRead+z.cacheWrite:z.totalTokens),J=Math.max(...F,1),Y=O/f.length,ue=Math.min(
|
|
606
|
+
`;let v=0,m=0,S=0,T=0,M=0,I=0;f=f.map(z=>(v+=z.totalTokens,m+=z.cost,S+=z.output,T+=z.input,M+=z.cacheRead,I+=z.cacheWrite,{...z,cumulativeTokens:v,cumulativeCost:m}));const A=d!=null&&g!=null,w=A?Math.min(d,g):0,L=A?Math.max(d,g):1/0;let E=0,R=f.length;if(A){E=f.findIndex(le=>le.timestamp>=w),E===-1&&(E=f.length);const z=f.findIndex(le=>le.timestamp>L);R=z===-1?f.length:z}const K=A?f.slice(E,R):f;let G=0,b=0,C=0,N=0;for(const z of K)G+=z.output,b+=z.input,C+=z.cacheRead,N+=z.cacheWrite;const W=400,V=100,_={top:8,right:4,bottom:14,left:30},O=W-_.left-_.right,q=V-_.top-_.bottom,oe=n==="cumulative",re=n==="per-turn"&&i==="by-type",D=G+b+C+N,F=f.map(z=>oe?z.cumulativeTokens:re?z.input+z.output+z.cacheRead+z.cacheWrite:z.totalTokens),J=Math.max(...F,1),Y=O/f.length,ue=Math.min(wv,Math.max(1,Y*xv)),ee=Y-ue,ae=_.left+E*(ue+ee),X=R>=f.length?_.left+(f.length-1)*(ue+ee)+ue:_.left+(R-1)*(ue+ee)+ue;return c`
|
|
607
607
|
<div class="session-timeseries-compact">
|
|
608
608
|
<div class="timeseries-header-row">
|
|
609
609
|
<div class="card-title" style="font-size: 12px; color: var(--text);">Usage Over Time</div>
|
|
@@ -675,21 +675,21 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
675
675
|
width="${Math.max(1,X-ae)}"
|
|
676
676
|
height="${q}"
|
|
677
677
|
fill="var(--accent)"
|
|
678
|
-
opacity="${
|
|
678
|
+
opacity="${Sv}"
|
|
679
679
|
pointer-events="none"
|
|
680
680
|
/>
|
|
681
681
|
`}
|
|
682
682
|
<!-- Left cursor line + handle -->
|
|
683
683
|
${Mt`
|
|
684
684
|
<line x1="${ae}" y1="${_.top}" x2="${ae}" y2="${_.top+q}" stroke="var(--accent)" stroke-width="0.8" opacity="0.7" />
|
|
685
|
-
<rect x="${ae-
|
|
685
|
+
<rect x="${ae-bs/2}" y="${_.top+q/2-Pe/2}" width="${bs}" height="${Pe}" rx="1.5" fill="var(--accent)" class="cursor-handle" />
|
|
686
686
|
<line x1="${ae-ft}" y1="${_.top+q/2-Pe/5}" x2="${ae-ft}" y2="${_.top+q/2+Pe/5}" stroke="var(--bg)" stroke-width="0.4" pointer-events="none" />
|
|
687
687
|
<line x1="${ae+ft}" y1="${_.top+q/2-Pe/5}" x2="${ae+ft}" y2="${_.top+q/2+Pe/5}" stroke="var(--bg)" stroke-width="0.4" pointer-events="none" />
|
|
688
688
|
`}
|
|
689
689
|
<!-- Right cursor line + handle -->
|
|
690
690
|
${Mt`
|
|
691
691
|
<line x1="${X}" y1="${_.top}" x2="${X}" y2="${_.top+q}" stroke="var(--accent)" stroke-width="0.8" opacity="0.7" />
|
|
692
|
-
<rect x="${X-
|
|
692
|
+
<rect x="${X-bs/2}" y="${_.top+q/2-Pe/2}" width="${bs}" height="${Pe}" rx="1.5" fill="var(--accent)" class="cursor-handle" />
|
|
693
693
|
<line x1="${X-ft}" y1="${_.top+q/2-Pe/5}" x2="${X-ft}" y2="${_.top+q/2+Pe/5}" stroke="var(--bg)" stroke-width="0.4" pointer-events="none" />
|
|
694
694
|
<line x1="${X+ft}" y1="${_.top+q/2-Pe/5}" x2="${X+ft}" y2="${_.top+q/2+Pe/5}" stroke="var(--bg)" stroke-width="0.4" pointer-events="none" />
|
|
695
695
|
`}
|
|
@@ -739,7 +739,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
739
739
|
</div>
|
|
740
740
|
`:h}
|
|
741
741
|
</div>
|
|
742
|
-
`}function
|
|
742
|
+
`}function Iv(e,t,n,s){if(!e)return c`
|
|
743
743
|
<div class="context-details-panel">
|
|
744
744
|
<div class="muted" style="padding: 20px; text-align: center">No context data</div>
|
|
745
745
|
</div>
|
|
@@ -812,7 +812,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
812
812
|
`})():h}
|
|
813
813
|
</div>
|
|
814
814
|
</div>
|
|
815
|
-
`}function
|
|
815
|
+
`}function Rv(e,t,n,s,i,o,r,l,a,d,g,u){if(t)return c`
|
|
816
816
|
<div class="session-logs-compact">
|
|
817
817
|
<div class="session-logs-header">Conversation</div>
|
|
818
818
|
<div class="muted" style="padding: 20px; text-align: center">Loading...</div>
|
|
@@ -892,7 +892,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
892
892
|
`:h}
|
|
893
893
|
</div>
|
|
894
894
|
</div>
|
|
895
|
-
`}const
|
|
895
|
+
`}const Mv=`
|
|
896
896
|
.usage-page-header {
|
|
897
897
|
margin: 4px 0 12px;
|
|
898
898
|
}
|
|
@@ -1592,7 +1592,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
1592
1592
|
.usage-list-item.button:hover {
|
|
1593
1593
|
color: var(--text-strong);
|
|
1594
1594
|
}
|
|
1595
|
-
`,
|
|
1595
|
+
`,Lv=`
|
|
1596
1596
|
.usage-list-item .muted {
|
|
1597
1597
|
font-size: 11px;
|
|
1598
1598
|
}
|
|
@@ -2293,7 +2293,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2293
2293
|
font-size: 14px;
|
|
2294
2294
|
margin-bottom: 12px;
|
|
2295
2295
|
}
|
|
2296
|
-
`,
|
|
2296
|
+
`,Dv=`
|
|
2297
2297
|
|
|
2298
2298
|
/* ===== COMPACT DAILY CHART ===== */
|
|
2299
2299
|
.daily-chart-compact {
|
|
@@ -2843,8 +2843,8 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2843
2843
|
color: var(--text);
|
|
2844
2844
|
border-color: var(--border-strong);
|
|
2845
2845
|
}
|
|
2846
|
-
`,
|
|
2847
|
-
`);function
|
|
2846
|
+
`,Pv=[Mv,Lv,Dv].join(`
|
|
2847
|
+
`);function La(){return{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}}function Da(e,t){return e.input+=t.input,e.output+=t.output,e.cacheRead+=t.cacheRead,e.cacheWrite+=t.cacheWrite,e.totalTokens+=t.totalTokens,e.totalCost+=t.totalCost,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,e}function Fv(e){if(e.loading&&!e.totals)return c`
|
|
2848
2848
|
<style>
|
|
2849
2849
|
@keyframes initial-spin {
|
|
2850
2850
|
to { transform: rotate(360deg); }
|
|
@@ -2890,7 +2890,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2890
2890
|
</div>
|
|
2891
2891
|
</div>
|
|
2892
2892
|
</section>
|
|
2893
|
-
`;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((D,F)=>{const J=t?D.usage?.totalTokens??0:D.usage?.totalCost??0;return(t?F.usage?.totalTokens??0:F.usage?.totalCost??0)-J}),o=e.selectedDays.length>0?i.filter(D=>{if(D.usage?.activityDates?.length)return D.usage.activityDates.some(Y=>e.selectedDays.includes(Y));if(!D.updatedAt)return!1;const F=new Date(D.updatedAt),J=`${F.getFullYear()}-${String(F.getMonth()+1).padStart(2,"0")}-${String(F.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(J)}):i,r=(D,F)=>{if(F.length===0)return!0;const J=D.usage,Y=J?.firstActivity??D.updatedAt,ue=J?.lastActivity??D.updatedAt;if(!Y||!ue)return!1;const ee=Math.min(Y,ue),ae=Math.max(Y,ue);let X=ee;for(;X<=ae;){const z=new Date(X),le=
|
|
2893
|
+
`;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((D,F)=>{const J=t?D.usage?.totalTokens??0:D.usage?.totalCost??0;return(t?F.usage?.totalTokens??0:F.usage?.totalCost??0)-J}),o=e.selectedDays.length>0?i.filter(D=>{if(D.usage?.activityDates?.length)return D.usage.activityDates.some(Y=>e.selectedDays.includes(Y));if(!D.updatedAt)return!1;const F=new Date(D.updatedAt),J=`${F.getFullYear()}-${String(F.getMonth()+1).padStart(2,"0")}-${String(F.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(J)}):i,r=(D,F)=>{if(F.length===0)return!0;const J=D.usage,Y=J?.firstActivity??D.updatedAt,ue=J?.lastActivity??D.updatedAt;if(!Y||!ue)return!1;const ee=Math.min(Y,ue),ae=Math.max(Y,ue);let X=ee;for(;X<=ae;){const z=new Date(X),le=rr(z,e.timeZone);if(F.includes(le))return!0;const de=ar(z,e.timeZone);X=Math.min(de.getTime(),ae)+1}return!1},l=e.selectedHours.length>0?o.filter(D=>r(D,e.selectedHours)):o,a=Jm(l,e.query),d=a.sessions,g=a.warnings,u=gv(e.queryDraft,i,e.aggregates),f=or(e.query),v=D=>{const F=Ht(D);return f.filter(J=>Ht(J.key??"")===F).map(J=>J.value).filter(Boolean)},m=D=>{const F=new Set;for(const J of D)J&&F.add(J);return Array.from(F)},S=m(i.map(D=>D.agentId)).slice(0,12),T=m(i.map(D=>D.channel)).slice(0,12),M=m([...i.map(D=>D.modelProvider),...i.map(D=>D.providerOverride),...e.aggregates?.byProvider.map(D=>D.provider)??[]]).slice(0,12),I=m([...i.map(D=>D.model),...e.aggregates?.byModel.map(D=>D.model)??[]]).slice(0,12),A=m(e.aggregates?.tools.tools.map(D=>D.name)??[]).slice(0,12),w=e.selectedSessions.length===1?e.sessions.find(D=>D.key===e.selectedSessions[0])??d.find(D=>D.key===e.selectedSessions[0]):null,L=D=>D.reduce((F,J)=>J.usage?Da(F,J.usage):F,La()),E=D=>e.costDaily.filter(J=>D.includes(J.date)).reduce((J,Y)=>Da(J,Y),La());let R,K;const G=i.length;if(e.selectedSessions.length>0){const D=d.filter(F=>e.selectedSessions.includes(F.key));R=L(D),K=D.length}else e.selectedDays.length>0&&e.selectedHours.length===0?(R=E(e.selectedDays),K=d.length):e.selectedHours.length>0||n?(R=L(d),K=d.length):(R=e.totals,K=G);const b=e.selectedSessions.length>0?d.filter(D=>e.selectedSessions.includes(D.key)):n||e.selectedHours.length>0?d:e.selectedDays.length>0?o:i,C=av(b,e.aggregates),N=e.selectedSessions.length>0?(()=>{const D=d.filter(J=>e.selectedSessions.includes(J.key)),F=new Set;for(const J of D)for(const Y of J.usage?.activityDates??[])F.add(Y);return F.size>0?e.costDaily.filter(J=>F.has(J.date)):e.costDaily})():e.costDaily,W=lv(b,R,C),V=!e.loading&&!e.totals&&e.sessions.length===0,_=(R?.missingCostEntries??0)>0||(R?R.totalTokens>0&&R.totalCost===0&&R.input+R.output+R.cacheRead+R.cacheWrite>0:!1),O=[{label:"Today",days:1},{label:"7d",days:7},{label:"30d",days:30}],q=D=>{const F=new Date,J=new Date;J.setDate(J.getDate()-(D-1)),e.onStartDateChange(Di(J)),e.onEndDateChange(Di(F))},oe=(D,F,J)=>{if(J.length===0)return h;const Y=v(D),ue=new Set(Y.map(X=>Ht(X))),ee=J.length>0&&J.every(X=>ue.has(Ht(X))),ae=Y.length;return c`
|
|
2894
2894
|
<details
|
|
2895
2895
|
class="usage-filter-select"
|
|
2896
2896
|
@toggle=${X=>{const z=X.currentTarget;if(!z.open)return;const le=de=>{de.composedPath().includes(z)||(z.open=!1,window.removeEventListener("click",le,!0))};window.addEventListener("click",le,!0)}}
|
|
@@ -2905,14 +2905,14 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2905
2905
|
<div class="usage-filter-actions">
|
|
2906
2906
|
<button
|
|
2907
2907
|
class="btn btn-sm"
|
|
2908
|
-
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(
|
|
2908
|
+
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(Ra(e.queryDraft,D,J))}}
|
|
2909
2909
|
?disabled=${ee}
|
|
2910
2910
|
>
|
|
2911
2911
|
Select All
|
|
2912
2912
|
</button>
|
|
2913
2913
|
<button
|
|
2914
2914
|
class="btn btn-sm"
|
|
2915
|
-
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(
|
|
2915
|
+
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(Ra(e.queryDraft,D,[]))}}
|
|
2916
2916
|
?disabled=${ae===0}
|
|
2917
2917
|
>
|
|
2918
2918
|
Clear
|
|
@@ -2924,7 +2924,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2924
2924
|
<input
|
|
2925
2925
|
type="checkbox"
|
|
2926
2926
|
.checked=${z}
|
|
2927
|
-
@change=${le=>{const de=le.target,be=`${D}:${X}`;e.onQueryDraftChange(de.checked?
|
|
2927
|
+
@change=${le=>{const de=le.target,be=`${D}:${X}`;e.onQueryDraftChange(de.checked?pv(e.queryDraft,be):Ia(e.queryDraft,be))}}
|
|
2928
2928
|
/>
|
|
2929
2929
|
<span>${X}</span>
|
|
2930
2930
|
</label>
|
|
@@ -2933,7 +2933,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2933
2933
|
</div>
|
|
2934
2934
|
</details>
|
|
2935
2935
|
`},re=Di(new Date);return c`
|
|
2936
|
-
<style>${
|
|
2936
|
+
<style>${Pv}</style>
|
|
2937
2937
|
|
|
2938
2938
|
<section class="usage-page-header">
|
|
2939
2939
|
<div class="usage-page-title">Usage</div>
|
|
@@ -2980,14 +2980,14 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2980
2980
|
<div class="usage-export-list">
|
|
2981
2981
|
<button
|
|
2982
2982
|
class="usage-export-item"
|
|
2983
|
-
@click=${()=>Pi(`openclaw-usage-sessions-${re}.csv`,
|
|
2983
|
+
@click=${()=>Pi(`openclaw-usage-sessions-${re}.csv`,dv(d),"text/csv")}
|
|
2984
2984
|
?disabled=${d.length===0}
|
|
2985
2985
|
>
|
|
2986
2986
|
Sessions CSV
|
|
2987
2987
|
</button>
|
|
2988
2988
|
<button
|
|
2989
2989
|
class="usage-export-item"
|
|
2990
|
-
@click=${()=>Pi(`openclaw-usage-daily-${re}.csv`,
|
|
2990
|
+
@click=${()=>Pi(`openclaw-usage-daily-${re}.csv`,uv(N),"text/csv")}
|
|
2991
2991
|
?disabled=${N.length===0}
|
|
2992
2992
|
>
|
|
2993
2993
|
Daily CSV
|
|
@@ -3006,7 +3006,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3006
3006
|
</div>
|
|
3007
3007
|
<div class="usage-header-row">
|
|
3008
3008
|
<div class="usage-controls">
|
|
3009
|
-
${
|
|
3009
|
+
${mv(e.selectedDays,e.selectedHours,e.selectedSessions,e.sessions,e.onClearDays,e.onClearHours,e.onClearSessions,e.onClearFilters)}
|
|
3010
3010
|
<div class="usage-presets">
|
|
3011
3011
|
${O.map(D=>c`
|
|
3012
3012
|
<button class="btn btn-sm" @click=${()=>q(D.days)}>
|
|
@@ -3101,7 +3101,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3101
3101
|
${F}
|
|
3102
3102
|
<button
|
|
3103
3103
|
title="Remove filter"
|
|
3104
|
-
@click=${()=>e.onQueryDraftChange(
|
|
3104
|
+
@click=${()=>e.onQueryDraftChange(Ia(e.queryDraft,F))}
|
|
3105
3105
|
>
|
|
3106
3106
|
×
|
|
3107
3107
|
</button>
|
|
@@ -3114,7 +3114,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3114
3114
|
${u.map(D=>c`
|
|
3115
3115
|
<button
|
|
3116
3116
|
class="usage-query-suggestion"
|
|
3117
|
-
@click=${()=>e.onQueryDraftChange(
|
|
3117
|
+
@click=${()=>e.onQueryDraftChange(fv(e.queryDraft,D.value))}
|
|
3118
3118
|
>
|
|
3119
3119
|
${D.label}
|
|
3120
3120
|
</button>
|
|
@@ -3137,26 +3137,26 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3137
3137
|
`:h}
|
|
3138
3138
|
</section>
|
|
3139
3139
|
|
|
3140
|
-
${
|
|
3140
|
+
${yv(R,C,W,_,tv(b,e.timeZone),K,G)}
|
|
3141
3141
|
|
|
3142
|
-
${
|
|
3142
|
+
${ov(b,e.timeZone,e.selectedHours,e.onSelectHour)}
|
|
3143
3143
|
|
|
3144
3144
|
<!-- Two-column layout: Daily+Breakdown on left, Sessions on right -->
|
|
3145
3145
|
<div class="usage-grid">
|
|
3146
3146
|
<div class="usage-grid-left">
|
|
3147
3147
|
<div class="card usage-left-card">
|
|
3148
|
-
${
|
|
3149
|
-
${R?
|
|
3148
|
+
${vv(N,e.selectedDays,e.chartMode,e.dailyChartMode,e.onDailyChartModeChange,e.onSelectDay)}
|
|
3149
|
+
${R?bv(R,e.chartMode):h}
|
|
3150
3150
|
</div>
|
|
3151
3151
|
</div>
|
|
3152
3152
|
<div class="usage-grid-right">
|
|
3153
|
-
${
|
|
3153
|
+
${$v(d,e.selectedSessions,e.selectedDays,t,e.sessionSort,e.sessionSortDir,e.recentSessions,e.sessionsTab,e.onSelectSession,e.onSessionSortChange,e.onSessionSortDirChange,e.onSessionsTabChange,e.visibleColumns,G,e.onClearSessions)}
|
|
3154
3154
|
</div>
|
|
3155
3155
|
</div>
|
|
3156
3156
|
|
|
3157
3157
|
<!-- Session Detail Panel (when selected) or Empty State -->
|
|
3158
|
-
${w?
|
|
3159
|
-
`}let Fi=null;const
|
|
3158
|
+
${w?Ev(w,e.timeSeries,e.timeSeriesLoading,e.timeSeriesMode,e.onTimeSeriesModeChange,e.timeSeriesBreakdownMode,e.onTimeSeriesBreakdownChange,e.timeSeriesCursorStart,e.timeSeriesCursorEnd,e.onTimeSeriesCursorRangeChange,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):kv()}
|
|
3159
|
+
`}let Fi=null;const Pa=e=>{Fi&&clearTimeout(Fi),Fi=window.setTimeout(()=>{mo(e)},400)};function Nv(e){return e.tab!=="usage"?h:Fv({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,timeSeriesCursorStart:e.usageTimeSeriesCursorStart,timeSeriesCursorEnd:e.usageTimeSeriesCursorEnd,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:t=>{e.usageStartDate=t,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],Pa(e)},onEndDateChange:t=>{e.usageEndDate=t,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],Pa(e)},onRefresh:()=>mo(e),onTimeZoneChange:t=>{e.usageTimeZone=t,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],mo(e)},onToggleContextExpanded:()=>{e.usageContextExpanded=!e.usageContextExpanded},onToggleSessionLogsExpanded:()=>{e.usageSessionLogsExpanded=!e.usageSessionLogsExpanded},onLogFilterRolesChange:t=>{e.usageLogFilterRoles=t},onLogFilterToolsChange:t=>{e.usageLogFilterTools=t},onLogFilterHasToolsChange:t=>{e.usageLogFilterHasTools=t},onLogFilterQueryChange:t=>{e.usageLogFilterQuery=t},onLogFilterClear:()=>{e.usageLogFilterRoles=[],e.usageLogFilterTools=[],e.usageLogFilterHasTools=!1,e.usageLogFilterQuery=""},onToggleHeaderPinned:()=>{e.usageHeaderPinned=!e.usageHeaderPinned},onSelectHour:(t,n)=>{if(n&&e.usageSelectedHours.length>0){const s=Array.from({length:24},(l,a)=>a),i=e.usageSelectedHours[e.usageSelectedHours.length-1],o=s.indexOf(i),r=s.indexOf(t);if(o!==-1&&r!==-1){const[l,a]=o<r?[o,r]:[r,o],d=s.slice(l,a+1);e.usageSelectedHours=[...new Set([...e.usageSelectedHours,...d])]}}else e.usageSelectedHours.includes(t)?e.usageSelectedHours=e.usageSelectedHours.filter(s=>s!==t):e.usageSelectedHours=[...e.usageSelectedHours,t]},onQueryDraftChange:t=>{e.usageQueryDraft=t,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:t=>{e.usageSessionSort=t},onSessionSortDirChange:t=>{e.usageSessionSortDir=t},onSessionsTabChange:t=>{e.usageSessionsTab=t},onToggleColumn:t=>{e.usageVisibleColumns.includes(t)?e.usageVisibleColumns=e.usageVisibleColumns.filter(n=>n!==t):e.usageVisibleColumns=[...e.usageVisibleColumns,t]},onSelectSession:(t,n)=>{if(e.usageTimeSeries=null,e.usageSessionLogs=null,e.usageRecentSessions=[t,...e.usageRecentSessions.filter(s=>s!==t)].slice(0,8),n&&e.usageSelectedSessions.length>0){const s=e.usageChartMode==="tokens",o=[...e.usageResult?.sessions??[]].toSorted((d,g)=>{const u=s?d.usage?.totalTokens??0:d.usage?.totalCost??0;return(s?g.usage?.totalTokens??0:g.usage?.totalCost??0)-u}).map(d=>d.key),r=e.usageSelectedSessions[e.usageSelectedSessions.length-1],l=o.indexOf(r),a=o.indexOf(t);if(l!==-1&&a!==-1){const[d,g]=l<a?[l,a]:[a,l],u=o.slice(d,g+1),f=[...new Set([...e.usageSelectedSessions,...u])];e.usageSelectedSessions=f}}else e.usageSelectedSessions.length===1&&e.usageSelectedSessions[0]===t?e.usageSelectedSessions=[]:e.usageSelectedSessions=[t];e.usageTimeSeriesCursorStart=null,e.usageTimeSeriesCursorEnd=null,e.usageSelectedSessions.length===1&&(zm(e,e.usageSelectedSessions[0]),jm(e,e.usageSelectedSessions[0]))},onSelectDay:(t,n)=>{if(n&&e.usageSelectedDays.length>0){const s=(e.usageCostSummary?.daily??[]).map(l=>l.date),i=e.usageSelectedDays[e.usageSelectedDays.length-1],o=s.indexOf(i),r=s.indexOf(t);if(o!==-1&&r!==-1){const[l,a]=o<r?[o,r]:[r,o],d=s.slice(l,a+1),g=[...new Set([...e.usageSelectedDays,...d])];e.usageSelectedDays=g}}else e.usageSelectedDays.includes(t)?e.usageSelectedDays=e.usageSelectedDays.filter(s=>s!==t):e.usageSelectedDays=[t]},onChartModeChange:t=>{e.usageChartMode=t},onDailyChartModeChange:t=>{e.usageDailyChartMode=t},onTimeSeriesModeChange:t=>{e.usageTimeSeriesMode=t},onTimeSeriesBreakdownChange:t=>{e.usageTimeSeriesBreakdownMode=t},onTimeSeriesCursorRangeChange:(t,n)=>{e.usageTimeSeriesCursorStart=t,e.usageTimeSeriesCursorEnd=n},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}})}const lr={CHILD:2},cr=e=>(...t)=>({_$litDirective$:e,values:t});let dr=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:Ov}=Qu,Fa=e=>e,Uv=e=>e.strings===void 0,Na=()=>document.createComment(""),In=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=s.insertBefore(Na(),i),r=s.insertBefore(Na(),i);n=new Ov(o,r,e,e.options)}else{const o=n._$AB.nextSibling,r=n._$AM,l=r!==e;if(l){let a;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(a=e._$AU)!==r._$AU&&n._$AP(a)}if(o!==i||l){let a=n._$AA;for(;a!==o;){const d=Fa(a).nextSibling;Fa(s).insertBefore(a,i),a=d}}}return n},Dt=(e,t,n=e)=>(e._$AI(t,n),e),Bv={},Hv=(e,t=Bv)=>e._$AH=t,zv=e=>e._$AH,Ni=e=>{e._$AR(),e._$AA.remove()};const Oa=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Td=cr(class extends dr{constructor(e){if(super(e),e.type!==lr.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=[],o=[];let r=0;for(const l of e)i[r]=s?s(l,r):r,o[r]=n(l,r),r++;return{values:o,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=zv(e),{values:o,keys:r}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=r,o;const l=this.ut??=[],a=[];let d,g,u=0,f=i.length-1,v=0,m=o.length-1;for(;u<=f&&v<=m;)if(i[u]===null)u++;else if(i[f]===null)f--;else if(l[u]===r[v])a[v]=Dt(i[u],o[v]),u++,v++;else if(l[f]===r[m])a[m]=Dt(i[f],o[m]),f--,m--;else if(l[u]===r[m])a[m]=Dt(i[u],o[m]),In(e,a[m+1],i[u]),u++,m--;else if(l[f]===r[v])a[v]=Dt(i[f],o[v]),In(e,i[u],i[f]),f--,v++;else if(d===void 0&&(d=Oa(r,v,m),g=Oa(l,u,f)),d.has(l[u]))if(d.has(l[f])){const S=g.get(r[v]),T=S!==void 0?i[S]:null;if(T===null){const M=In(e,i[u]);Dt(M,o[v]),a[v]=M}else a[v]=Dt(T,o[v]),In(e,i[u],T),i[S]=null;v++}else Ni(i[f]),f--;else Ni(i[u]),u++;for(;v<=m;){const S=In(e,a[m+1]);Dt(S,o[v]),a[v++]=S}for(;u<=f;){const S=i[u++];S!==null&&Ni(S)}return this.ut=r,Hv(e,a),wt}}),pe={messageSquare:c`
|
|
3160
3160
|
<svg viewBox="0 0 24 24">
|
|
3161
3161
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
3162
3162
|
</svg>
|
|
@@ -3344,17 +3344,17 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3344
3344
|
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"
|
|
3345
3345
|
/>
|
|
3346
3346
|
</svg>
|
|
3347
|
-
`};function
|
|
3347
|
+
`};function jv(e){const t=e.hello?.snapshot,n=t?.sessionDefaults?.mainSessionKey?.trim();if(n)return n;const s=t?.sessionDefaults?.mainKey?.trim();return s||"main"}function Kv(e,t){e.sessionKey=t,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:t,lastActiveSessionKey:t})}function Wv(e,t){const n=li(t,e.basePath);return c`
|
|
3348
3348
|
<a
|
|
3349
3349
|
href=${n}
|
|
3350
3350
|
class="nav-item ${e.tab===t?"active":""}"
|
|
3351
|
-
@click=${s=>{if(!(s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey)){if(s.preventDefault(),t==="chat"){const i=
|
|
3351
|
+
@click=${s=>{if(!(s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey)){if(s.preventDefault(),t==="chat"){const i=jv(e);e.sessionKey!==i&&(Kv(e,i),e.loadAssistantIdentity())}e.setTab(t)}}}
|
|
3352
3352
|
title=${go(t)}
|
|
3353
3353
|
>
|
|
3354
|
-
<span class="nav-item__icon" aria-hidden="true">${
|
|
3354
|
+
<span class="nav-item__icon" aria-hidden="true">${pe[Vp(t)]}</span>
|
|
3355
3355
|
<span class="nav-item__text">${go(t)}</span>
|
|
3356
3356
|
</a>
|
|
3357
|
-
`}function
|
|
3357
|
+
`}function qv(e){return c`
|
|
3358
3358
|
<span style="position: relative; display: inline-flex; align-items: center;">
|
|
3359
3359
|
<svg
|
|
3360
3360
|
width="16"
|
|
@@ -3386,7 +3386,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3386
3386
|
>${e}</span
|
|
3387
3387
|
>`:""}
|
|
3388
3388
|
</span>
|
|
3389
|
-
`}function
|
|
3389
|
+
`}function Gv(e){const t=Vv(e.hello,e.sessionsResult),n=e.sessionsHideCron??!0,s=n?Xv(e.sessionKey,e.sessionsResult):0,i=Yv(e.sessionKey,e.sessionsResult,t,n),o=e.onboarding,r=e.onboarding,l=e.onboarding?!1:e.settings.chatShowThinking,a=e.onboarding?!0:e.settings.chatFocusMode,d=c`
|
|
3390
3390
|
<svg
|
|
3391
3391
|
width="18"
|
|
3392
3392
|
height="18"
|
|
@@ -3423,7 +3423,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3423
3423
|
<select
|
|
3424
3424
|
.value=${e.sessionKey}
|
|
3425
3425
|
?disabled=${!e.connected}
|
|
3426
|
-
@change=${u=>{const f=u.target.value;e.sessionKey=f,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:f,lastActiveSessionKey:f}),e.loadAssistantIdentity(),
|
|
3426
|
+
@change=${u=>{const f=u.target.value;e.sessionKey=f,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:f,lastActiveSessionKey:f}),e.loadAssistantIdentity(),dh(e,f),gi(e)}}
|
|
3427
3427
|
>
|
|
3428
3428
|
${Td(i,u=>u.key,u=>c`<option value=${u.key} title=${u.key}>
|
|
3429
3429
|
${u.displayName??u.key}
|
|
@@ -3433,7 +3433,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3433
3433
|
<button
|
|
3434
3434
|
class="btn btn--sm btn--icon"
|
|
3435
3435
|
?disabled=${e.chatLoading||!e.connected}
|
|
3436
|
-
@click=${async()=>{const u=e;u.chatManualRefreshInFlight=!0,u.chatNewMessagesBelow=!1,await u.updateComplete,u.resetToolStream();try{await
|
|
3436
|
+
@click=${async()=>{const u=e;u.chatManualRefreshInFlight=!0,u.chatNewMessagesBelow=!1,await u.updateComplete,u.resetToolStream();try{await gd(e,{scheduleScroll:!1}),u.scrollToBottom({smooth:!0})}finally{requestAnimationFrame(()=>{u.chatManualRefreshInFlight=!1,u.chatNewMessagesBelow=!1})}}}
|
|
3437
3437
|
title=${p("chat.refreshTitle")}
|
|
3438
3438
|
>
|
|
3439
3439
|
${d}
|
|
@@ -3446,7 +3446,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3446
3446
|
aria-pressed=${l}
|
|
3447
3447
|
title=${p(o?"chat.onboardingDisabled":"chat.thinkingToggle")}
|
|
3448
3448
|
>
|
|
3449
|
-
${
|
|
3449
|
+
${pe.brain}
|
|
3450
3450
|
</button>
|
|
3451
3451
|
<button
|
|
3452
3452
|
class="btn btn--sm btn--icon ${a?"active":""}"
|
|
@@ -3463,10 +3463,10 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3463
3463
|
aria-pressed=${n}
|
|
3464
3464
|
title=${n?s>0?p("chat.showCronSessionsHidden",{count:String(s)}):p("chat.showCronSessions"):p("chat.hideCronSessions")}
|
|
3465
3465
|
>
|
|
3466
|
-
${
|
|
3466
|
+
${qv(s)}
|
|
3467
3467
|
</button>
|
|
3468
3468
|
</div>
|
|
3469
|
-
`}function
|
|
3469
|
+
`}function Vv(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(o=>o.key==="main")?"main":null)}const Is={bluebubbles:"iMessage",telegram:"Telegram",discord:"Discord",signal:"Signal",slack:"Slack",whatsapp:"WhatsApp",matrix:"Matrix",email:"Email",sms:"SMS"},Jv=Object.keys(Is);function Ua(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Qv(e){const t=e.toLowerCase();if(e==="main"||e==="agent:main:main")return{prefix:"",fallbackName:"Main Session"};if(e.includes(":subagent:"))return{prefix:"Subagent:",fallbackName:"Subagent:"};if(t.startsWith("cron:")||e.includes(":cron:"))return{prefix:"Cron:",fallbackName:"Cron Job:"};const n=e.match(/^agent:[^:]+:([^:]+):direct:(.+)$/);if(n){const i=n[1],o=n[2];return{prefix:"",fallbackName:`${Is[i]??Ua(i)} · ${o}`}}const s=e.match(/^agent:[^:]+:([^:]+):group:(.+)$/);if(s){const i=s[1];return{prefix:"",fallbackName:`${Is[i]??Ua(i)} Group`}}for(const i of Jv)if(e===i||e.startsWith(`${i}:`))return{prefix:"",fallbackName:`${Is[i]} Session`};return{prefix:"",fallbackName:e}}function Oi(e,t){const n=t?.label?.trim()||"",s=t?.displayName?.trim()||"",{prefix:i,fallbackName:o}=Qv(e),r=l=>i?new RegExp(`^${i.replace(/[.*+?^${}()|[\\]\\]/g,"\\$&")}\\s*`,"i").test(l)?l:`${i} ${l}`:l;return n&&n!==e?r(n):s&&s!==e?r(s):o}function Ed(e){const t=e.trim().toLowerCase();if(!t)return!1;if(t.startsWith("cron:"))return!0;if(!t.startsWith("agent:"))return!1;const n=t.split(":").filter(Boolean);return n.length<3?!1:n.slice(2).join(":").startsWith("cron:")}function Yv(e,t,n,s=!1){const i=new Set,o=[],r=n&&t?.sessions?.find(a=>a.key===n),l=t?.sessions?.find(a=>a.key===e);if(n&&(i.add(n),o.push({key:n,displayName:Oi(n,r||void 0)})),i.has(e)||(i.add(e),o.push({key:e,displayName:Oi(e,l)})),t?.sessions)for(const a of t.sessions)!i.has(a.key)&&!(s&&Ed(a.key))&&(i.add(a.key),o.push({key:a.key,displayName:Oi(a.key,a)}));return o}function Xv(e,t){return t?.sessions?t.sessions.filter(n=>Ed(n.key)&&n.key!==e).length:0}const Zv=["system","light","dark"];function eb(e){const t=Math.max(0,Zv.indexOf(e.theme)),n=s=>i=>{const r={element:i.currentTarget};(i.clientX||i.clientY)&&(r.pointerClientX=i.clientX,r.pointerClientY=i.clientY),e.setTheme(s,r)};return c`
|
|
3470
3470
|
<div class="theme-toggle" style="--theme-index: ${t};">
|
|
3471
3471
|
<div class="theme-toggle__track" role="group" aria-label="Theme">
|
|
3472
3472
|
<span class="theme-toggle__indicator"></span>
|
|
@@ -3477,7 +3477,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3477
3477
|
aria-label="System theme"
|
|
3478
3478
|
title="System"
|
|
3479
3479
|
>
|
|
3480
|
-
${
|
|
3480
|
+
${sb()}
|
|
3481
3481
|
</button>
|
|
3482
3482
|
<button
|
|
3483
3483
|
class="theme-toggle__button ${e.theme==="light"?"active":""}"
|
|
@@ -3486,7 +3486,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3486
3486
|
aria-label="Light theme"
|
|
3487
3487
|
title="Light"
|
|
3488
3488
|
>
|
|
3489
|
-
${
|
|
3489
|
+
${tb()}
|
|
3490
3490
|
</button>
|
|
3491
3491
|
<button
|
|
3492
3492
|
class="theme-toggle__button ${e.theme==="dark"?"active":""}"
|
|
@@ -3495,11 +3495,11 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3495
3495
|
aria-label="Dark theme"
|
|
3496
3496
|
title="Dark"
|
|
3497
3497
|
>
|
|
3498
|
-
${
|
|
3498
|
+
${nb()}
|
|
3499
3499
|
</button>
|
|
3500
3500
|
</div>
|
|
3501
3501
|
</div>
|
|
3502
|
-
`}function
|
|
3502
|
+
`}function tb(){return c`
|
|
3503
3503
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3504
3504
|
<circle cx="12" cy="12" r="4"></circle>
|
|
3505
3505
|
<path d="M12 2v2"></path>
|
|
@@ -3511,21 +3511,21 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3511
3511
|
<path d="m6.34 17.66-1.41 1.41"></path>
|
|
3512
3512
|
<path d="m19.07 4.93-1.41 1.41"></path>
|
|
3513
3513
|
</svg>
|
|
3514
|
-
`}function
|
|
3514
|
+
`}function nb(){return c`
|
|
3515
3515
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3516
3516
|
<path
|
|
3517
3517
|
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"
|
|
3518
3518
|
></path>
|
|
3519
3519
|
</svg>
|
|
3520
|
-
`}function
|
|
3520
|
+
`}function sb(){return c`
|
|
3521
3521
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3522
3522
|
<rect width="20" height="14" x="2" y="3" rx="2"></rect>
|
|
3523
3523
|
<line x1="8" x2="16" y1="21" y2="21"></line>
|
|
3524
3524
|
<line x1="12" x2="12" y1="17" y2="21"></line>
|
|
3525
3525
|
</svg>
|
|
3526
|
-
`}function _d(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 Ui(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 Vv(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 o=i.file.content??"",r=e.agentFileContents[n]??"",l=e.agentFileDrafts[n],a=s?.preserveDraft??!0;e.agentFilesList=_d(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:o},(!a||!Object.hasOwn(e.agentFileDrafts,n)||l===r)&&(e.agentFileDrafts={...e.agentFileDrafts,[n]:o})}}catch(i){e.agentFilesError=String(i)}finally{e.agentFilesLoading=!1}}}async function Jv(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=_d(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}}}const Ha=["noopener","noreferrer"],dn="_blank";function un(e){const t=[],n=new Set(Ha);for(const s of"".split(/\s+/)){const i=s.trim().toLowerCase();!i||n.has(i)||(n.add(i),t.push(i))}return[...Ha,...t].join(" ")}const Qv=[{id:"fs",label:"Files"},{id:"runtime",label:"Runtime"},{id:"web",label:"Web"},{id:"memory",label:"Memory"},{id:"sessions",label:"Sessions"},{id:"ui",label:"UI"},{id:"messaging",label:"Messaging"},{id:"automation",label:"Automation"},{id:"nodes",label:"Nodes"},{id:"agents",label:"Agents"},{id:"media",label:"Media"}],es=[{id:"read",label:"read",description:"Read file contents",sectionId:"fs",profiles:["coding"]},{id:"write",label:"write",description:"Create or overwrite files",sectionId:"fs",profiles:["coding"]},{id:"edit",label:"edit",description:"Make precise edits",sectionId:"fs",profiles:["coding"]},{id:"apply_patch",label:"apply_patch",description:"Patch files (OpenAI)",sectionId:"fs",profiles:["coding"]},{id:"exec",label:"exec",description:"Run shell commands",sectionId:"runtime",profiles:["coding"]},{id:"process",label:"process",description:"Manage background processes",sectionId:"runtime",profiles:["coding"]},{id:"web_search",label:"web_search",description:"Search the web",sectionId:"web",profiles:[],includeInOpenClawGroup:!0},{id:"web_fetch",label:"web_fetch",description:"Fetch web content",sectionId:"web",profiles:[],includeInOpenClawGroup:!0},{id:"memory_search",label:"memory_search",description:"Semantic search",sectionId:"memory",profiles:["coding"],includeInOpenClawGroup:!0},{id:"memory_get",label:"memory_get",description:"Read memory files",sectionId:"memory",profiles:["coding"],includeInOpenClawGroup:!0},{id:"sessions_list",label:"sessions_list",description:"List sessions",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_history",label:"sessions_history",description:"Session history",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_send",label:"sessions_send",description:"Send to session",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_spawn",label:"sessions_spawn",description:"Spawn sub-agent",sectionId:"sessions",profiles:["coding"],includeInOpenClawGroup:!0},{id:"subagents",label:"subagents",description:"Manage sub-agents",sectionId:"sessions",profiles:["coding"],includeInOpenClawGroup:!0},{id:"session_status",label:"session_status",description:"Session status",sectionId:"sessions",profiles:["minimal","coding","messaging"],includeInOpenClawGroup:!0},{id:"browser",label:"browser",description:"Control web browser",sectionId:"ui",profiles:[],includeInOpenClawGroup:!0},{id:"canvas",label:"canvas",description:"Control canvases",sectionId:"ui",profiles:[],includeInOpenClawGroup:!0},{id:"message",label:"message",description:"Send messages",sectionId:"messaging",profiles:["messaging"],includeInOpenClawGroup:!0},{id:"cron",label:"cron",description:"Schedule tasks",sectionId:"automation",profiles:["coding"],includeInOpenClawGroup:!0},{id:"gateway",label:"gateway",description:"Gateway control",sectionId:"automation",profiles:[],includeInOpenClawGroup:!0},{id:"nodes",label:"nodes",description:"Nodes + devices",sectionId:"nodes",profiles:[],includeInOpenClawGroup:!0},{id:"agents_list",label:"agents_list",description:"List agents",sectionId:"agents",profiles:[],includeInOpenClawGroup:!0},{id:"image",label:"image",description:"Image understanding",sectionId:"media",profiles:["coding"],includeInOpenClawGroup:!0},{id:"tts",label:"tts",description:"Text-to-speech conversion",sectionId:"media",profiles:[],includeInOpenClawGroup:!0}];new Map(es.map(e=>[e.id,e]));function Bi(e){return es.filter(t=>t.profiles.includes(e)).map(t=>t.id)}const Yv={minimal:{allow:Bi("minimal")},coding:{allow:Bi("coding")},messaging:{allow:Bi("messaging")},full:{}};function Xv(){const e=new Map;for(const n of es){const s=`group:${n.sectionId}`,i=e.get(s)??[];i.push(n.id),e.set(s,i)}return{"group:openclaw":es.filter(n=>n.includeInOpenClawGroup).map(n=>n.id),...Object.fromEntries(e.entries())}}const Zv=Xv(),eb=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function tb(e){if(!e)return;const t=Yv[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function nb(){return Qv.map(e=>({id:e.id,label:e.label,tools:es.filter(t=>t.sectionId===e.id).map(t=>({id:t.id,label:t.label,description:t.description}))})).filter(e=>e.tools.length>0)}const sb={bash:"exec","apply-patch":"apply_patch"},ib={...Zv};function Ye(e){const t=e.trim().toLowerCase();return sb[t]??t}function ob(e){return e?e.map(Ye).filter(Boolean):[]}function rb(e){const t=ob(e),n=[];for(const s of t){const i=ib[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function ab(e){return tb(e)}const lb=nb(),cb=eb;function bo(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function $s(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 fi(e,t){const n=t?.emoji?.trim();if(n&&$s(n))return n;const s=e.identity?.emoji?.trim();if(s&&$s(s))return s;const i=t?.avatar?.trim();if(i&&$s(i))return i;const o=e.identity?.avatar?.trim();return o&&$s(o)?o:""}function Id(e,t){return t&&e===t?"default":null}function db(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 pi(e,t){const n=e;return{entry:(n?.agents?.list??[]).find(o=>o?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function za(e,t,n,s,i){const o=pi(t,e.id),l=(n&&n.agentId===e.id?n.workspace:null)||o.entry?.workspace||o.defaults?.workspace||"default",a=o.entry?.model?jn(o.entry?.model):jn(o.defaults?.model),d=i?.name?.trim()||e.identity?.name?.trim()||e.name?.trim()||o.entry?.name||e.id,g=fi(e,i)||"-",u=Array.isArray(o.entry?.skills)?o.entry?.skills:null,f=u?.length??null;return{workspace:l,model:a,identityName:d,identityEmoji:g,skillsLabel:u?`${f} selected`:"all skills",isDefault:!!(s&&e.id===s)}}function jn(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 ja(e){const t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function Ka(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 Wa(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 ub(e,t){return Wa(e)??Wa(t)}function Bt(e,t){if(typeof t!="string")return;const n=t.trim();n&&e.add(n)}function qa(e,t){if(!t)return;if(typeof t=="string"){Bt(e,t);return}if(typeof t!="object")return;const n=t;Bt(e,n.primary),Bt(e,n.model),Bt(e,n.id),Bt(e,n.value);const s=Array.isArray(n.fallbacks)?n.fallbacks:Array.isArray(n.fallback)?n.fallback:[];for(const i of s)Bt(e,i)}function yo(e){const t=Array.from(e),n=Array.from({length:t.length},()=>""),s=(o,r,l)=>{let a=o,d=r,g=o;for(;a<r&&d<l;)n[g++]=t[a].localeCompare(t[d])<=0?t[a++]:t[d++];for(;a<r;)n[g++]=t[a++];for(;d<l;)n[g++]=t[d++];for(let u=o;u<l;u+=1)t[u]=n[u]},i=(o,r)=>{if(r-o<=1)return;const l=o+r>>>1;i(o,l),i(l,r),s(o,l,r)};return i(0,t.length),t}function gb(e){if(!e||typeof e!="object")return[];const t=e.agents;if(!t||typeof t!="object")return[];const n=new Set,s=t.defaults;if(s&&typeof s=="object"){const o=s;qa(n,o.model);const r=o.models;if(r&&typeof r=="object")for(const l of Object.keys(r))Bt(n,l)}const i=t.list;if(i&&typeof i=="object")for(const o of Object.values(i))!o||typeof o!="object"||qa(n,o.model);return yo(n)}function fb(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function pb(e){const n=e?.agents?.defaults?.models;if(!n||typeof n!="object")return[];const s=[];for(const[i,o]of Object.entries(n)){const r=i.trim();if(!r)continue;const l=o&&typeof o=="object"&&"alias"in o&&typeof o.alias=="string"?o.alias?.trim():void 0,a=l&&l!==r?`${l} (${r})`:r;s.push({value:r,label:a})}return s}function hb(e,t){const n=pb(e),s=t?n.some(i=>i.value===t):!1;return t&&!s&&n.unshift({value:t,label:`Current (${t})`}),n.length===0?c`
|
|
3526
|
+
`}function _d(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 Ui(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 ib(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 o=i.file.content??"",r=e.agentFileContents[n]??"",l=e.agentFileDrafts[n],a=s?.preserveDraft??!0;e.agentFilesList=_d(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:o},(!a||!Object.hasOwn(e.agentFileDrafts,n)||l===r)&&(e.agentFileDrafts={...e.agentFileDrafts,[n]:o})}}catch(i){e.agentFilesError=String(i)}finally{e.agentFilesLoading=!1}}}async function ob(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=_d(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}}}const Ba=["noopener","noreferrer"],dn="_blank";function un(e){const t=[],n=new Set(Ba);for(const s of"".split(/\s+/)){const i=s.trim().toLowerCase();!i||n.has(i)||(n.add(i),t.push(i))}return[...Ba,...t].join(" ")}const rb=[{id:"fs",label:"Files"},{id:"runtime",label:"Runtime"},{id:"web",label:"Web"},{id:"memory",label:"Memory"},{id:"sessions",label:"Sessions"},{id:"ui",label:"UI"},{id:"messaging",label:"Messaging"},{id:"automation",label:"Automation"},{id:"nodes",label:"Nodes"},{id:"agents",label:"Agents"},{id:"media",label:"Media"}],Zn=[{id:"read",label:"read",description:"Read file contents",sectionId:"fs",profiles:["coding"]},{id:"write",label:"write",description:"Create or overwrite files",sectionId:"fs",profiles:["coding"]},{id:"edit",label:"edit",description:"Make precise edits",sectionId:"fs",profiles:["coding"]},{id:"apply_patch",label:"apply_patch",description:"Patch files (OpenAI)",sectionId:"fs",profiles:["coding"]},{id:"exec",label:"exec",description:"Run shell commands",sectionId:"runtime",profiles:["coding"]},{id:"process",label:"process",description:"Manage background processes",sectionId:"runtime",profiles:["coding"]},{id:"web_search",label:"web_search",description:"Search the web",sectionId:"web",profiles:[],includeInOpenClawGroup:!0},{id:"web_fetch",label:"web_fetch",description:"Fetch web content",sectionId:"web",profiles:[],includeInOpenClawGroup:!0},{id:"memory_search",label:"memory_search",description:"Semantic search",sectionId:"memory",profiles:["coding"],includeInOpenClawGroup:!0},{id:"memory_get",label:"memory_get",description:"Read memory files",sectionId:"memory",profiles:["coding"],includeInOpenClawGroup:!0},{id:"sessions_list",label:"sessions_list",description:"List sessions",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_history",label:"sessions_history",description:"Session history",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_send",label:"sessions_send",description:"Send to session",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_spawn",label:"sessions_spawn",description:"Spawn sub-agent",sectionId:"sessions",profiles:["coding"],includeInOpenClawGroup:!0},{id:"subagents",label:"subagents",description:"Manage sub-agents",sectionId:"sessions",profiles:["coding"],includeInOpenClawGroup:!0},{id:"session_status",label:"session_status",description:"Session status",sectionId:"sessions",profiles:["minimal","coding","messaging"],includeInOpenClawGroup:!0},{id:"browser",label:"browser",description:"Control web browser",sectionId:"ui",profiles:[],includeInOpenClawGroup:!0},{id:"canvas",label:"canvas",description:"Control canvases",sectionId:"ui",profiles:[],includeInOpenClawGroup:!0},{id:"message",label:"message",description:"Send messages",sectionId:"messaging",profiles:["messaging"],includeInOpenClawGroup:!0},{id:"cron",label:"cron",description:"Schedule tasks",sectionId:"automation",profiles:["coding"],includeInOpenClawGroup:!0},{id:"gateway",label:"gateway",description:"Gateway control",sectionId:"automation",profiles:[],includeInOpenClawGroup:!0},{id:"nodes",label:"nodes",description:"Nodes + devices",sectionId:"nodes",profiles:[],includeInOpenClawGroup:!0},{id:"agents_list",label:"agents_list",description:"List agents",sectionId:"agents",profiles:[],includeInOpenClawGroup:!0},{id:"image",label:"image",description:"Image understanding",sectionId:"media",profiles:["coding"],includeInOpenClawGroup:!0},{id:"tts",label:"tts",description:"Text-to-speech conversion",sectionId:"media",profiles:[],includeInOpenClawGroup:!0}];new Map(Zn.map(e=>[e.id,e]));function Bi(e){return Zn.filter(t=>t.profiles.includes(e)).map(t=>t.id)}const ab={minimal:{allow:Bi("minimal")},coding:{allow:Bi("coding")},messaging:{allow:Bi("messaging")},full:{}};function lb(){const e=new Map;for(const n of Zn){const s=`group:${n.sectionId}`,i=e.get(s)??[];i.push(n.id),e.set(s,i)}return{"group:openclaw":Zn.filter(n=>n.includeInOpenClawGroup).map(n=>n.id),...Object.fromEntries(e.entries())}}const cb=lb(),db=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function ub(e){if(!e)return;const t=ab[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function gb(){return rb.map(e=>({id:e.id,label:e.label,tools:Zn.filter(t=>t.sectionId===e.id).map(t=>({id:t.id,label:t.label,description:t.description}))})).filter(e=>e.tools.length>0)}const fb={bash:"exec","apply-patch":"apply_patch"},pb={...cb};function Ye(e){const t=e.trim().toLowerCase();return fb[t]??t}function hb(e){return e?e.map(Ye).filter(Boolean):[]}function mb(e){const t=hb(e),n=[];for(const s of t){const i=pb[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function vb(e){return ub(e)}const bb=gb(),yb=db;function vo(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function ys(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 fi(e,t){const n=t?.emoji?.trim();if(n&&ys(n))return n;const s=e.identity?.emoji?.trim();if(s&&ys(s))return s;const i=t?.avatar?.trim();if(i&&ys(i))return i;const o=e.identity?.avatar?.trim();return o&&ys(o)?o:""}function Id(e,t){return t&&e===t?"default":null}function $b(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 pi(e,t){const n=e;return{entry:(n?.agents?.list??[]).find(o=>o?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function Ha(e,t,n,s,i){const o=pi(t,e.id),l=(n&&n.agentId===e.id?n.workspace:null)||o.entry?.workspace||o.defaults?.workspace||"default",a=o.entry?.model?jn(o.entry?.model):jn(o.defaults?.model),d=i?.name?.trim()||e.identity?.name?.trim()||e.name?.trim()||o.entry?.name||e.id,g=fi(e,i)||"-",u=Array.isArray(o.entry?.skills)?o.entry?.skills:null,f=u?.length??null;return{workspace:l,model:a,identityName:d,identityEmoji:g,skillsLabel:u?`${f} selected`:"all skills",isDefault:!!(s&&e.id===s)}}function jn(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 za(e){const t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function ja(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 Ka(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 xb(e,t){return Ka(e)??Ka(t)}function Bt(e,t){if(typeof t!="string")return;const n=t.trim();n&&e.add(n)}function Wa(e,t){if(!t)return;if(typeof t=="string"){Bt(e,t);return}if(typeof t!="object")return;const n=t;Bt(e,n.primary),Bt(e,n.model),Bt(e,n.id),Bt(e,n.value);const s=Array.isArray(n.fallbacks)?n.fallbacks:Array.isArray(n.fallback)?n.fallback:[];for(const i of s)Bt(e,i)}function bo(e){const t=Array.from(e),n=Array.from({length:t.length},()=>""),s=(o,r,l)=>{let a=o,d=r,g=o;for(;a<r&&d<l;)n[g++]=t[a].localeCompare(t[d])<=0?t[a++]:t[d++];for(;a<r;)n[g++]=t[a++];for(;d<l;)n[g++]=t[d++];for(let u=o;u<l;u+=1)t[u]=n[u]},i=(o,r)=>{if(r-o<=1)return;const l=o+r>>>1;i(o,l),i(l,r),s(o,l,r)};return i(0,t.length),t}function wb(e){if(!e||typeof e!="object")return[];const t=e.agents;if(!t||typeof t!="object")return[];const n=new Set,s=t.defaults;if(s&&typeof s=="object"){const o=s;Wa(n,o.model);const r=o.models;if(r&&typeof r=="object")for(const l of Object.keys(r))Bt(n,l)}const i=t.list;if(i&&typeof i=="object")for(const o of Object.values(i))!o||typeof o!="object"||Wa(n,o.model);return bo(n)}function Sb(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function kb(e){const n=e?.agents?.defaults?.models;if(!n||typeof n!="object")return[];const s=[];for(const[i,o]of Object.entries(n)){const r=i.trim();if(!r)continue;const l=o&&typeof o=="object"&&"alias"in o&&typeof o.alias=="string"?o.alias?.trim():void 0,a=l&&l!==r?`${l} (${r})`:r;s.push({value:r,label:a})}return s}function Ab(e,t){const n=kb(e),s=t?n.some(i=>i.value===t):!1;return t&&!s&&n.unshift({value:t,label:`Current (${t})`}),n.length===0?c`
|
|
3527
3527
|
<option value="" disabled>No configured models</option>
|
|
3528
|
-
`:n.map(i=>c`<option value=${i.value}>${i.label}</option>`)}function
|
|
3528
|
+
`:n.map(i=>c`<option value=${i.value}>${i.label}</option>`)}function Cb(e){const t=Ye(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 yo(e){return Array.isArray(e)?mb(e).map(Cb).filter(t=>t.kind!=="exact"||t.value.length>0):[]}function Kn(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 Tb(e,t){if(!t)return!0;const n=Ye(e),s=yo(t.deny);if(Kn(n,s))return!1;const i=yo(t.allow);return!!(i.length===0||Kn(n,i)||n==="apply_patch"&&Kn("exec",i))}function qa(e,t){if(!Array.isArray(t)||t.length===0)return!1;const n=Ye(e),s=yo(t);return!!(Kn(n,s)||n==="apply_patch"&&Kn("exec",s))}function Eb(e){return vb(e)??void 0}function _b(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function Ib(e){const t=e.ts??null;return t?ne(t):"n/a"}function ur(e){return e?`${new Date(e).toLocaleDateString(void 0,{weekday:"short"})}, ${kt(e)} (${ne(e)})`:"n/a"}function Rb(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function Mb(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Lb(e){const t=e.state??{},n=t.nextRunAtMs?kt(t.nextRunAtMs):"n/a",s=t.lastRunAtMs?kt(t.lastRunAtMs):"n/a";return`${t.lastStatus??"n/a"} · next ${n} · last ${s}`}function Rd(e){const t=e.schedule;if(t.kind==="at"){const n=Date.parse(t.at);return Number.isFinite(n)?`At ${kt(n)}`:`At ${t.at}`}return t.kind==="every"?`Every ${Ho(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function Db(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.mode==="webhook"?s.to?` (${s.to})`:"":s.channel||s.to?` (${s.channel??"last"}${s.to?` -> ${s.to}`:""})`:"";return`${n} · ${s.mode}${i}`}return n}function Md(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 Ld(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 Pb(e){const t=Md(e.configForm,e.channelId);return t?e.fields.flatMap(n=>n in t?[{label:n,value:Ld(t[n])}]:[]):[]}function Dd(e,t){return c`
|
|
3529
3529
|
<section class="card">
|
|
3530
3530
|
<div class="card-title">Agent Context</div>
|
|
3531
3531
|
<div class="card-sub">${t}</div>
|
|
@@ -3556,7 +3556,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3556
3556
|
</div>
|
|
3557
3557
|
</div>
|
|
3558
3558
|
</section>
|
|
3559
|
-
`}function
|
|
3559
|
+
`}function Fb(e,t){const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function Nb(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:Fb(e,i),accounts:e.channelAccounts?.[i]??[]}))}const Ob=["groupPolicy","streamMode","dmPolicy"];function Ub(e){let t=0,n=0,s=0;for(const i of e){const o=i.probe&&typeof i.probe=="object"&&"ok"in i.probe?!!i.probe.ok:!1;(i.connected===!0||i.running===!0||o)&&(t+=1),i.configured&&(n+=1),i.enabled&&(s+=1)}return{total:e.length,connected:t,configured:n,enabled:s}}function Bb(e){const t=Nb(e.snapshot),n=e.lastSuccess?ne(e.lastSuccess):"never";return c`
|
|
3560
3560
|
<section class="grid grid-cols-2">
|
|
3561
3561
|
${Dd(e.context,"Workspace, identity, and model configuration.")}
|
|
3562
3562
|
<section class="card">
|
|
@@ -3580,7 +3580,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3580
3580
|
<div class="muted" style="margin-top: 16px">No channels found.</div>
|
|
3581
3581
|
`:c`
|
|
3582
3582
|
<div class="list" style="margin-top: 16px;">
|
|
3583
|
-
${t.map(s=>{const i=
|
|
3583
|
+
${t.map(s=>{const i=Ub(s.accounts),o=i.total?`${i.connected}/${i.total} connected`:"no accounts",r=i.configured?`${i.configured} configured`:"not configured",l=i.total?`${i.enabled} enabled`:"disabled",a=Pb({configForm:e.configForm,channelId:s.id,fields:Ob});return c`
|
|
3584
3584
|
<div class="list-item">
|
|
3585
3585
|
<div class="list-main">
|
|
3586
3586
|
<div class="list-title">${s.label}</div>
|
|
@@ -3598,7 +3598,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3598
3598
|
`}
|
|
3599
3599
|
</section>
|
|
3600
3600
|
</section>
|
|
3601
|
-
`}function
|
|
3601
|
+
`}function Hb(e){const t=e.jobs.filter(n=>n.agentId===e.agentId);return c`
|
|
3602
3602
|
<section class="grid grid-cols-2">
|
|
3603
3603
|
${Dd(e.context,"Workspace and scheduling targets.")}
|
|
3604
3604
|
<section class="card">
|
|
@@ -3624,7 +3624,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3624
3624
|
</div>
|
|
3625
3625
|
<div class="stat">
|
|
3626
3626
|
<div class="stat-label">Next wake</div>
|
|
3627
|
-
<div class="stat-value">${
|
|
3627
|
+
<div class="stat-value">${ur(e.status?.nextWakeAtMs??null)}</div>
|
|
3628
3628
|
</div>
|
|
3629
3629
|
</div>
|
|
3630
3630
|
${e.error?c`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:h}
|
|
@@ -3651,15 +3651,15 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3651
3651
|
</div>
|
|
3652
3652
|
</div>
|
|
3653
3653
|
<div class="list-meta">
|
|
3654
|
-
<div class="mono">${
|
|
3655
|
-
<div class="muted">${
|
|
3654
|
+
<div class="mono">${Lb(n)}</div>
|
|
3655
|
+
<div class="muted">${Db(n)}</div>
|
|
3656
3656
|
</div>
|
|
3657
3657
|
</div>
|
|
3658
3658
|
`)}
|
|
3659
3659
|
</div>
|
|
3660
3660
|
`}
|
|
3661
3661
|
</section>
|
|
3662
|
-
`}function
|
|
3662
|
+
`}function zb(e){const t=e.agentFilesList?.agentId===e.agentId?e.agentFilesList:null,n=t?.files??[],s=e.agentFileActive??null,i=s?n.find(a=>a.name===s)??null:null,o=s?e.agentFileContents[s]??"":"",r=s?e.agentFileDrafts[s]??o:"",l=s?r!==o:!1;return c`
|
|
3663
3663
|
<section class="card">
|
|
3664
3664
|
<div class="row" style="justify-content: space-between;">
|
|
3665
3665
|
<div>
|
|
@@ -3681,7 +3681,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3681
3681
|
<div class="agent-files-list">
|
|
3682
3682
|
${n.length===0?c`
|
|
3683
3683
|
<div class="muted">No files found.</div>
|
|
3684
|
-
`:n.map(a=>
|
|
3684
|
+
`:n.map(a=>jb(a,s,()=>e.onSelectFile(a.name)))}
|
|
3685
3685
|
</div>
|
|
3686
3686
|
<div class="agent-files-editor">
|
|
3687
3687
|
${i?c`
|
|
@@ -3730,7 +3730,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3730
3730
|
</div>
|
|
3731
3731
|
`}
|
|
3732
3732
|
</section>
|
|
3733
|
-
`}function
|
|
3733
|
+
`}function jb(e,t,n){const s=e.missing?"Missing":`${$b(e.size)} · ${ne(e.updatedAtMs??null)}`;return c`
|
|
3734
3734
|
<button
|
|
3735
3735
|
type="button"
|
|
3736
3736
|
class="agent-file-row ${t===e.name?"active":""}"
|
|
@@ -3744,7 +3744,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3744
3744
|
<span class="agent-pill warn">missing</span>
|
|
3745
3745
|
`:h}
|
|
3746
3746
|
</button>
|
|
3747
|
-
`}const
|
|
3747
|
+
`}const $s=[{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 Pd(e){const t=new Map;for(const o of $s)t.set(o.id,{id:o.id,label:o.label,skills:[]});const n=$s.find(o=>o.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const o of e){const r=o.bundled?n:$s.find(l=>l.sources.includes(o.source));r?t.get(r.id)?.skills.push(o):s.skills.push(o)}const i=$s.map(o=>t.get(o.id)).filter(o=>!!(o&&o.skills.length>0));return s.skills.length>0&&i.push(s),i}function Fd(e){return[...e.missing.bins.map(t=>`bin:${t}`),...e.missing.env.map(t=>`env:${t}`),...e.missing.config.map(t=>`config:${t}`),...e.missing.os.map(t=>`os:${t}`)]}function Nd(e){const t=[];return e.disabled&&t.push("disabled"),e.blockedByAllowlist&&t.push("blocked by allowlist"),t}function Od(e){const t=e.skill,n=!!e.showBundledBadge;return c`
|
|
3748
3748
|
<div class="chip-row" style="margin-top: 6px;">
|
|
3749
3749
|
<span class="chip">${t.source}</span>
|
|
3750
3750
|
${n?c`
|
|
@@ -3757,7 +3757,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3757
3757
|
<span class="chip chip-warn">disabled</span>
|
|
3758
3758
|
`:h}
|
|
3759
3759
|
</div>
|
|
3760
|
-
`}function
|
|
3760
|
+
`}function Kb(e){const t=pi(e.configForm,e.agentId),n=t.entry?.tools??{},s=t.globalTools??{},i=n.profile??s.profile??"full",o=n.profile?"agent override":s.profile?"global default":"default",r=Array.isArray(n.allow)&&n.allow.length>0,l=Array.isArray(s.allow)&&s.allow.length>0,a=!!e.configForm&&!e.configLoading&&!e.configSaving&&!r,d=r?[]:Array.isArray(n.alsoAllow)?n.alsoAllow:[],g=r?[]:Array.isArray(n.deny)?n.deny:[],u=r?{allow:n.allow??[],deny:n.deny??[]}:Eb(i)??void 0,f=e.toolsCatalogResult?.groups?.length&&e.toolsCatalogResult.agentId===e.agentId?e.toolsCatalogResult.groups:bb,v=e.toolsCatalogResult?.profiles?.length&&e.toolsCatalogResult.agentId===e.agentId?e.toolsCatalogResult.profiles:yb,m=f.flatMap(A=>A.tools.map(w=>w.id)),S=A=>{const w=Tb(A,u),L=qa(A,d),E=qa(A,g);return{allowed:(w||L)&&!E,baseAllowed:w,denied:E}},T=m.filter(A=>S(A).allowed).length,M=(A,w)=>{const L=new Set(d.map(G=>Ye(G)).filter(G=>G.length>0)),E=new Set(g.map(G=>Ye(G)).filter(G=>G.length>0)),R=S(A).baseAllowed,K=Ye(A);w?(E.delete(K),R||L.add(K)):(L.delete(K),E.add(K)),e.onOverridesChange(e.agentId,[...L],[...E])},I=A=>{const w=new Set(d.map(E=>Ye(E)).filter(E=>E.length>0)),L=new Set(g.map(E=>Ye(E)).filter(E=>E.length>0));for(const E of m){const R=S(E).baseAllowed,K=Ye(E);A?(L.delete(K),R||w.add(K)):(w.delete(K),L.add(K))}e.onOverridesChange(e.agentId,[...w],[...L])};return c`
|
|
3761
3761
|
<section class="card">
|
|
3762
3762
|
<div class="row" style="justify-content: space-between;">
|
|
3763
3763
|
<div>
|
|
@@ -3888,7 +3888,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3888
3888
|
<div class="card-sub" style="margin-top: 10px">Refreshing tool catalog…</div>
|
|
3889
3889
|
`:h}
|
|
3890
3890
|
</section>
|
|
3891
|
-
`}function
|
|
3891
|
+
`}function Wb(e){const t=!!e.configForm&&!e.configLoading&&!e.configSaving,n=pi(e.configForm,e.agentId),s=Array.isArray(n.entry?.skills)?n.entry?.skills:void 0,i=new Set((s??[]).map(v=>v.trim()).filter(Boolean)),o=s!==void 0,r=!!(e.report&&e.activeAgentId===e.agentId),l=r?e.report?.skills??[]:[],a=e.filter.trim().toLowerCase(),d=a?l.filter(v=>[v.name,v.description,v.source].join(" ").toLowerCase().includes(a)):l,g=Pd(d),u=o?l.filter(v=>i.has(v.name)).length:l.length,f=l.length;return c`
|
|
3892
3892
|
<section class="card">
|
|
3893
3893
|
<div class="row" style="justify-content: space-between;">
|
|
3894
3894
|
<div>
|
|
@@ -3960,21 +3960,21 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3960
3960
|
<div class="muted" style="margin-top: 16px">No skills found.</div>
|
|
3961
3961
|
`:c`
|
|
3962
3962
|
<div class="agent-skills-groups" style="margin-top: 16px;">
|
|
3963
|
-
${g.map(v=>
|
|
3963
|
+
${g.map(v=>qb(v,{agentId:e.agentId,allowSet:i,usingAllowlist:o,editable:t,onToggle:e.onToggle}))}
|
|
3964
3964
|
</div>
|
|
3965
3965
|
`}
|
|
3966
3966
|
</section>
|
|
3967
|
-
`}function
|
|
3967
|
+
`}function qb(e,t){const n=e.id==="workspace"||e.id==="built-in";return c`
|
|
3968
3968
|
<details class="agent-skills-group" ?open=${!n}>
|
|
3969
3969
|
<summary class="agent-skills-header">
|
|
3970
3970
|
<span>${e.label}</span>
|
|
3971
3971
|
<span class="muted">${e.skills.length}</span>
|
|
3972
3972
|
</summary>
|
|
3973
3973
|
<div class="list skills-grid">
|
|
3974
|
-
${e.skills.map(s=>
|
|
3974
|
+
${e.skills.map(s=>Gb(s,{agentId:t.agentId,allowSet:t.allowSet,usingAllowlist:t.usingAllowlist,editable:t.editable,onToggle:t.onToggle}))}
|
|
3975
3975
|
</div>
|
|
3976
3976
|
</details>
|
|
3977
|
-
`}function
|
|
3977
|
+
`}function Gb(e,t){const n=t.usingAllowlist?t.allowSet.has(e.name):!0,s=Fd(e),i=Nd(e);return c`
|
|
3978
3978
|
<div class="list-item agent-skill-row">
|
|
3979
3979
|
<div class="list-main">
|
|
3980
3980
|
<div class="list-title">${e.emoji?`${e.emoji} `:""}${e.name}</div>
|
|
@@ -3995,7 +3995,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3995
3995
|
</label>
|
|
3996
3996
|
</div>
|
|
3997
3997
|
</div>
|
|
3998
|
-
`}function
|
|
3998
|
+
`}function Vb(e){const t=e.agentsList?.agents??[],n=e.agentsList?.defaultId??null,s=e.selectedAgentId??n??t[0]?.id??null,i=s?t.find(o=>o.id===s)??null:null;return c`
|
|
3999
3999
|
<div class="agents-layout">
|
|
4000
4000
|
<section class="card agents-sidebar">
|
|
4001
4001
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -4011,13 +4011,13 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4011
4011
|
<div class="agent-list" style="margin-top: 12px;">
|
|
4012
4012
|
${t.length===0?c`
|
|
4013
4013
|
<div class="muted">No agents found.</div>
|
|
4014
|
-
`:t.map(o=>{const r=Id(o.id,n),l=fi(o,e.agentIdentityById[o.id]??null),a=
|
|
4014
|
+
`:t.map(o=>{const r=Id(o.id,n),l=fi(o,e.agentIdentityById[o.id]??null),a=vo(o),{primary:d,secondary:g}=Jb(a);return c`
|
|
4015
4015
|
<button
|
|
4016
4016
|
type="button"
|
|
4017
4017
|
class="agent-row ${s===o.id?"active":""}"
|
|
4018
4018
|
@click=${()=>e.onSelectAgent(o.id)}
|
|
4019
4019
|
>
|
|
4020
|
-
<div class="agent-avatar">${l||
|
|
4020
|
+
<div class="agent-avatar">${l||vo(o).slice(0,1)}</div>
|
|
4021
4021
|
<div class="agent-info">
|
|
4022
4022
|
<div class="agent-title">${d}</div>
|
|
4023
4023
|
${g?c`<div class="agent-sub">${g}</div>`:h}
|
|
@@ -4029,14 +4029,14 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4029
4029
|
</section>
|
|
4030
4030
|
<section class="agents-main">
|
|
4031
4031
|
${i?c`
|
|
4032
|
-
${
|
|
4033
|
-
${
|
|
4034
|
-
${e.activePanel==="overview"?
|
|
4035
|
-
${e.activePanel==="files"?
|
|
4036
|
-
${e.activePanel==="tools"?
|
|
4037
|
-
${e.activePanel==="skills"?
|
|
4038
|
-
${e.activePanel==="channels"?
|
|
4039
|
-
${e.activePanel==="cron"?
|
|
4032
|
+
${Qb(i,n,e.agentIdentityById[i.id]??null)}
|
|
4033
|
+
${Yb(e.activePanel,o=>e.onSelectPanel(o))}
|
|
4034
|
+
${e.activePanel==="overview"?Xb({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}):h}
|
|
4035
|
+
${e.activePanel==="files"?zb({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}):h}
|
|
4036
|
+
${e.activePanel==="tools"?Kb({agentId:i.id,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,toolsCatalogLoading:e.toolsCatalogLoading,toolsCatalogError:e.toolsCatalogError,toolsCatalogResult:e.toolsCatalogResult,onProfileChange:e.onToolsProfileChange,onOverridesChange:e.onToolsOverridesChange,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):h}
|
|
4037
|
+
${e.activePanel==="skills"?Wb({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}):h}
|
|
4038
|
+
${e.activePanel==="channels"?Bb({context:Ha(i,e.configForm,e.agentFilesList,n,e.agentIdentityById[i.id]??null),configForm:e.configForm,snapshot:e.channelsSnapshot,loading:e.channelsLoading,error:e.channelsError,lastSuccess:e.channelsLastSuccess,onRefresh:e.onChannelsRefresh}):h}
|
|
4039
|
+
${e.activePanel==="cron"?Hb({context:Ha(i,e.configForm,e.agentFilesList,n,e.agentIdentityById[i.id]??null),agentId:i.id,jobs:e.cronJobs,status:e.cronStatus,loading:e.cronLoading,error:e.cronError,onRefresh:e.onCronRefresh}):h}
|
|
4040
4040
|
`:c`
|
|
4041
4041
|
<div class="card">
|
|
4042
4042
|
<div class="card-title">Select an agent</div>
|
|
@@ -4045,7 +4045,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4045
4045
|
`}
|
|
4046
4046
|
</section>
|
|
4047
4047
|
</div>
|
|
4048
|
-
`}function
|
|
4048
|
+
`}function Jb(e){const t=e.trim();if(!t)return{primary:"-",secondary:null};const n=" · ",s=t.indexOf(n);if(s===-1)return{primary:t,secondary:null};const i=t.slice(0,s).trim(),o=t.slice(s+n.length).trim();return{primary:i||t,secondary:o||null}}function Qb(e,t,n){const s=Id(e.id,t),i=vo(e),o=e.identity?.theme?.trim()||"Agent workspace and routing.",r=fi(e,n);return c`
|
|
4049
4049
|
<section class="card agent-header">
|
|
4050
4050
|
<div class="agent-header-main">
|
|
4051
4051
|
<div class="agent-avatar agent-avatar--lg">${r||i.slice(0,1)}</div>
|
|
@@ -4059,7 +4059,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4059
4059
|
${s?c`<span class="agent-pill">${s}</span>`:h}
|
|
4060
4060
|
</div>
|
|
4061
4061
|
</section>
|
|
4062
|
-
`}function
|
|
4062
|
+
`}function Yb(e,t){return c`
|
|
4063
4063
|
<div class="agent-tabs">
|
|
4064
4064
|
${[{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=>c`
|
|
4065
4065
|
<button
|
|
@@ -4071,7 +4071,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4071
4071
|
</button>
|
|
4072
4072
|
`)}
|
|
4073
4073
|
</div>
|
|
4074
|
-
`}function
|
|
4074
|
+
`}function Xb(e){const{agent:t,configForm:n,agentFilesList:s,agentIdentity:i,agentIdentityLoading:o,agentIdentityError:r,configLoading:l,configSaving:a,configDirty:d,onConfigReload:g,onConfigSave:u,onModelChange:f,onModelFallbacksChange:v}=e,m=pi(n,t.id),T=(s&&s.agentId===t.id?s.workspace:null)||m.entry?.workspace||m.defaults?.workspace||"default",M=m.entry?.model?jn(m.entry?.model):jn(m.defaults?.model),I=jn(m.defaults?.model),A=ja(m.entry?.model)||(M!=="-"?za(M):null),w=ja(m.defaults?.model)||(I!=="-"?za(I):null),L=A??w??null,E=xb(m.entry?.model,m.defaults?.model),R=E?E.join(", "):"",K=i?.name?.trim()||t.identity?.name?.trim()||t.name?.trim()||m.entry?.name||"-",b=fi(t,i)||"-",C=Array.isArray(m.entry?.skills)?m.entry?.skills:null,N=C?.length??null,W=o?"Loading…":r?"Unavailable":"",V=!!(e.defaultId&&t.id===e.defaultId);return c`
|
|
4075
4075
|
<section class="card">
|
|
4076
4076
|
<div class="card-title">Overview</div>
|
|
4077
4077
|
<div class="card-sub">Workspace paths and identity metadata.</div>
|
|
@@ -4118,7 +4118,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4118
4118
|
${w?`Inherit default (${w})`:"Inherit default"}
|
|
4119
4119
|
</option>
|
|
4120
4120
|
`}
|
|
4121
|
-
${
|
|
4121
|
+
${Ab(n,L??void 0)}
|
|
4122
4122
|
</select>
|
|
4123
4123
|
</label>
|
|
4124
4124
|
<label class="field" style="min-width: 260px; flex: 1;">
|
|
@@ -4127,7 +4127,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4127
4127
|
.value=${R}
|
|
4128
4128
|
?disabled=${!n||l||a}
|
|
4129
4129
|
placeholder="provider/model, provider/model"
|
|
4130
|
-
@input=${_=>v(t.id,
|
|
4130
|
+
@input=${_=>v(t.id,Sb(_.target.value))}
|
|
4131
4131
|
/>
|
|
4132
4132
|
</label>
|
|
4133
4133
|
</div>
|
|
@@ -4145,7 +4145,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4145
4145
|
</div>
|
|
4146
4146
|
</div>
|
|
4147
4147
|
</section>
|
|
4148
|
-
`}const
|
|
4148
|
+
`}const Zb=new Set(["title","description","default","nullable","tags","x-tags"]);function ey(e){return Object.keys(e??{}).filter(n=>!Zb.has(n)).length===0}function ty(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const es={chevronDown:c`
|
|
4149
4149
|
<svg
|
|
4150
4150
|
viewBox="0 0 24 24"
|
|
4151
4151
|
fill="none"
|
|
@@ -4203,11 +4203,11 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4203
4203
|
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
|
|
4204
4204
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
|
|
4205
4205
|
</svg>
|
|
4206
|
-
`};function kn(e){return!!(e&&(e.text.length>0||e.tags.length>0))}function Ud(e){const t=[],n=new Set;return{text:e.trim().replace(/(^|\s)tag:([^\s]+)/gi,(o,r,l)=>{const a=l.trim().toLowerCase();return a&&!n.has(a)&&(n.add(a),t.push(a)),r}).trim().toLowerCase(),tags:t}}function
|
|
4206
|
+
`};function kn(e){return!!(e&&(e.text.length>0||e.tags.length>0))}function Ud(e){const t=[],n=new Set;return{text:e.trim().replace(/(^|\s)tag:([^\s]+)/gi,(o,r,l)=>{const a=l.trim().toLowerCase();return a&&!n.has(a)&&(n.add(a),t.push(a)),r}).trim().toLowerCase(),tags:t}}function Ga(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const s of e){if(typeof s!="string")continue;const i=s.trim();if(!i)continue;const o=i.toLowerCase();t.has(o)||(t.add(o),n.push(i))}return n}function Zt(e,t,n){const s=bt(e,n),i=s?.label??t.title??ei(String(e.at(-1))),o=s?.help??t.description,r=Ga(t["x-tags"]??t.tags),l=Ga(s?.tags);return{label:i,help:o,tags:l.length>0?l:r}}function ny(e,t){if(!e)return!0;for(const n of t)if(n&&n.toLowerCase().includes(e))return!0;return!1}function sy(e,t){if(e.length===0)return!0;const n=new Set(t.map(s=>s.toLowerCase()));return e.every(s=>n.has(s))}function gr(e){const{schema:t,path:n,hints:s,criteria:i}=e;if(!kn(i))return!0;const{label:o,help:r,tags:l}=Zt(n,t,s);if(!sy(i.tags,l))return!1;if(!i.text)return!0;const a=n.filter(g=>typeof g=="string").join("."),d=t.enum&&t.enum.length>0?t.enum.map(g=>String(g)).join(" "):"";return ny(i.text,[o,r,t.title,t.description,a,d])}function vn(e){const{schema:t,value:n,path:s,hints:i,criteria:o}=e;if(!kn(o)||gr({schema:t,path:s,hints:i,criteria:o}))return!0;const r=ve(t);if(r==="object"){const l=n??t.default,a=l&&typeof l=="object"&&!Array.isArray(l)?l:{},d=t.properties??{};for(const[u,f]of Object.entries(d))if(vn({schema:f,value:a[u],path:[...s,u],hints:i,criteria:o}))return!0;const g=t.additionalProperties;if(g&&typeof g=="object"){const u=new Set(Object.keys(d));for(const[f,v]of Object.entries(a))if(!u.has(f)&&vn({schema:g,value:v,path:[...s,f],hints:i,criteria:o}))return!0}return!1}if(r==="array"){const l=Array.isArray(t.items)?t.items[0]:t.items;if(!l)return!1;const a=Array.isArray(n)?n:Array.isArray(t.default)?t.default:[];if(a.length===0)return!1;for(let d=0;d<a.length;d+=1)if(vn({schema:l,value:a[d],path:[...s,d],hints:i,criteria:o}))return!0}return!1}function $t(e){return e.length===0?h:c`
|
|
4207
4207
|
<div class="cfg-tags">
|
|
4208
4208
|
${e.map(t=>c`<span class="cfg-tag">${t}</span>`)}
|
|
4209
4209
|
</div>
|
|
4210
|
-
`}function Ct(e){const{schema:t,value:n,path:s,hints:i,unsupported:o,disabled:r,onPatch:l}=e,a=e.showLabel??!0,d=ve(t),{label:g,help:u,tags:f}=Zt(s,t,i),v=
|
|
4210
|
+
`}function Ct(e){const{schema:t,value:n,path:s,hints:i,unsupported:o,disabled:r,onPatch:l}=e,a=e.showLabel??!0,d=ve(t),{label:g,help:u,tags:f}=Zt(s,t,i),v=No(s),m=e.searchCriteria;if(o.has(v))return c`<div class="cfg-field cfg-field--error">
|
|
4211
4211
|
<div class="cfg-field__label">${g}</div>
|
|
4212
4212
|
<div class="cfg-field__error">Unsupported schema node. Use Raw mode.</div>
|
|
4213
4213
|
</div>`;if(m&&kn(m)&&!vn({schema:t,value:n,path:s,hints:i,criteria:m}))return h;if(t.anyOf||t.oneOf){const T=(t.anyOf??t.oneOf??[]).filter(E=>!(E.type==="null"||Array.isArray(E.type)&&E.type.includes("null")));if(T.length===1)return Ct({...e,schema:T[0]});const M=E=>{if(E.const!==void 0)return E.const;if(E.enum&&E.enum.length===1)return E.enum[0]},I=T.map(M),A=I.every(E=>E!==void 0);if(A&&I.length>0&&I.length<=5){const E=n??t.default;return c`
|
|
@@ -4228,7 +4228,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4228
4228
|
`)}
|
|
4229
4229
|
</div>
|
|
4230
4230
|
</div>
|
|
4231
|
-
`}if(A&&I.length>5)return
|
|
4231
|
+
`}if(A&&I.length>5)return Ja({...e,options:I,value:n??t.default});const w=new Set(T.map(E=>ve(E)).filter(Boolean)),L=new Set([...w].map(E=>E==="integer"?"number":E));if([...L].every(E=>["string","number","boolean"].includes(E))){const E=L.has("string"),R=L.has("number");if(L.has("boolean")&&L.size===1)return Ct({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(E||R)return Va({...e,inputType:R&&!E?"number":"text"})}}if(t.enum){const S=t.enum;if(S.length<=5){const T=n??t.default;return c`
|
|
4232
4232
|
<div class="cfg-field">
|
|
4233
4233
|
${a?c`<label class="cfg-field__label">${g}</label>`:h}
|
|
4234
4234
|
${u?c`<div class="cfg-field__help">${u}</div>`:h}
|
|
@@ -4246,7 +4246,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4246
4246
|
`)}
|
|
4247
4247
|
</div>
|
|
4248
4248
|
</div>
|
|
4249
|
-
`}return
|
|
4249
|
+
`}return Ja({...e,options:S,value:n??t.default})}if(d==="object")return oy(e);if(d==="array")return ry(e);if(d==="boolean"){const S=typeof n=="boolean"?n:typeof t.default=="boolean"?t.default:!1;return c`
|
|
4250
4250
|
<label class="cfg-toggle-row ${r?"disabled":""}">
|
|
4251
4251
|
<div class="cfg-toggle-row__content">
|
|
4252
4252
|
<span class="cfg-toggle-row__label">${g}</span>
|
|
@@ -4263,12 +4263,12 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4263
4263
|
<span class="cfg-toggle__track"></span>
|
|
4264
4264
|
</div>
|
|
4265
4265
|
</label>
|
|
4266
|
-
`}return d==="number"||d==="integer"?
|
|
4266
|
+
`}return d==="number"||d==="integer"?iy(e):d==="string"?Va({...e,inputType:"text"}):c`
|
|
4267
4267
|
<div class="cfg-field cfg-field--error">
|
|
4268
4268
|
<div class="cfg-field__label">${g}</div>
|
|
4269
4269
|
<div class="cfg-field__error">Unsupported type: ${d}. Use Raw mode.</div>
|
|
4270
4270
|
</div>
|
|
4271
|
-
`}function
|
|
4271
|
+
`}function Va(e){const{schema:t,value:n,path:s,hints:i,disabled:o,onPatch:r,inputType:l}=e,a=e.showLabel??!0,d=bt(s,i),{label:g,help:u,tags:f}=Zt(s,t,i),v=(d?.sensitive??!1)&&!/^\$\{[^}]*\}$/.test(String(n??"").trim()),m=d?.placeholder??(v?"••••":t.default!==void 0?`Default: ${String(t.default)}`:""),S=n??"";return c`
|
|
4272
4272
|
<div class="cfg-field">
|
|
4273
4273
|
${a?c`<label class="cfg-field__label">${g}</label>`:h}
|
|
4274
4274
|
${u?c`<div class="cfg-field__help">${u}</div>`:h}
|
|
@@ -4294,7 +4294,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4294
4294
|
`:h}
|
|
4295
4295
|
</div>
|
|
4296
4296
|
</div>
|
|
4297
|
-
`}function
|
|
4297
|
+
`}function iy(e){const{schema:t,value:n,path:s,hints:i,disabled:o,onPatch:r}=e,l=e.showLabel??!0,{label:a,help:d,tags:g}=Zt(s,t,i),u=n??t.default??"",f=typeof u=="number"?u:0;return c`
|
|
4298
4298
|
<div class="cfg-field">
|
|
4299
4299
|
${l?c`<label class="cfg-field__label">${a}</label>`:h}
|
|
4300
4300
|
${d?c`<div class="cfg-field__help">${d}</div>`:h}
|
|
@@ -4321,7 +4321,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4321
4321
|
>+</button>
|
|
4322
4322
|
</div>
|
|
4323
4323
|
</div>
|
|
4324
|
-
`}function
|
|
4324
|
+
`}function Ja(e){const{schema:t,value:n,path:s,hints:i,disabled:o,options:r,onPatch:l}=e,a=e.showLabel??!0,{label:d,help:g,tags:u}=Zt(s,t,i),f=n??t.default,v=r.findIndex(S=>S===f||String(S)===String(f)),m="__unset__";return c`
|
|
4325
4325
|
<div class="cfg-field">
|
|
4326
4326
|
${a?c`<label class="cfg-field__label">${d}</label>`:h}
|
|
4327
4327
|
${g?c`<div class="cfg-field__help">${g}</div>`:h}
|
|
@@ -4338,9 +4338,9 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4338
4338
|
`)}
|
|
4339
4339
|
</select>
|
|
4340
4340
|
</div>
|
|
4341
|
-
`}function
|
|
4341
|
+
`}function oy(e){const{schema:t,value:n,path:s,hints:i,unsupported:o,disabled:r,onPatch:l,searchCriteria:a}=e,d=e.showLabel??!0,{label:g,help:u,tags:f}=Zt(s,t,i),m=(a&&kn(a)?gr({schema:t,path:s,hints:i,criteria:a}):!1)?void 0:a,S=n??t.default,T=S&&typeof S=="object"&&!Array.isArray(S)?S:{},M=t.properties??{},A=Object.entries(M).toSorted((K,G)=>{const b=bt([...s,K[0]],i)?.order??0,C=bt([...s,G[0]],i)?.order??0;return b!==C?b-C:K[0].localeCompare(G[0])}),w=new Set(Object.keys(M)),L=t.additionalProperties,E=!!L&&typeof L=="object",R=c`
|
|
4342
4342
|
${A.map(([K,G])=>Ct({schema:G,value:T[K],path:[...s,K],hints:i,unsupported:o,disabled:r,searchCriteria:m,onPatch:l}))}
|
|
4343
|
-
${E?
|
|
4343
|
+
${E?ay({schema:L,value:T,path:s,hints:i,unsupported:o,disabled:r,reservedKeys:w,searchCriteria:m,onPatch:l}):h}
|
|
4344
4344
|
`;return s.length===1?c`
|
|
4345
4345
|
<div class="cfg-fields">
|
|
4346
4346
|
${R}
|
|
@@ -4352,7 +4352,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4352
4352
|
<span class="cfg-object__title">${g}</span>
|
|
4353
4353
|
${$t(f)}
|
|
4354
4354
|
</span>
|
|
4355
|
-
<span class="cfg-object__chevron">${
|
|
4355
|
+
<span class="cfg-object__chevron">${es.chevronDown}</span>
|
|
4356
4356
|
</summary>
|
|
4357
4357
|
${u?c`<div class="cfg-object__help">${u}</div>`:h}
|
|
4358
4358
|
<div class="cfg-object__content">
|
|
@@ -4363,7 +4363,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4363
4363
|
<div class="cfg-fields cfg-fields--inline">
|
|
4364
4364
|
${R}
|
|
4365
4365
|
</div>
|
|
4366
|
-
`}function
|
|
4366
|
+
`}function ry(e){const{schema:t,value:n,path:s,hints:i,unsupported:o,disabled:r,onPatch:l,searchCriteria:a}=e,d=e.showLabel??!0,{label:g,help:u,tags:f}=Zt(s,t,i),m=(a&&kn(a)?gr({schema:t,path:s,hints:i,criteria:a}):!1)?void 0:a,S=Array.isArray(t.items)?t.items[0]:t.items;if(!S)return c`
|
|
4367
4367
|
<div class="cfg-field cfg-field--error">
|
|
4368
4368
|
<div class="cfg-field__label">${g}</div>
|
|
4369
4369
|
<div class="cfg-field__error">Unsupported array schema. Use Raw mode.</div>
|
|
@@ -4380,9 +4380,9 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4380
4380
|
type="button"
|
|
4381
4381
|
class="cfg-array__add"
|
|
4382
4382
|
?disabled=${r}
|
|
4383
|
-
@click=${()=>{const M=[...T,
|
|
4383
|
+
@click=${()=>{const M=[...T,Xl(S)];l(s,M)}}
|
|
4384
4384
|
>
|
|
4385
|
-
<span class="cfg-array__add-icon">${
|
|
4385
|
+
<span class="cfg-array__add-icon">${es.plus}</span>
|
|
4386
4386
|
Add
|
|
4387
4387
|
</button>
|
|
4388
4388
|
</div>
|
|
@@ -4403,7 +4403,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4403
4403
|
?disabled=${r}
|
|
4404
4404
|
@click=${()=>{const A=[...T];A.splice(I,1),l(s,A)}}
|
|
4405
4405
|
>
|
|
4406
|
-
${
|
|
4406
|
+
${es.trash}
|
|
4407
4407
|
</button>
|
|
4408
4408
|
</div>
|
|
4409
4409
|
<div class="cfg-array__item-content">
|
|
@@ -4414,7 +4414,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4414
4414
|
</div>
|
|
4415
4415
|
`}
|
|
4416
4416
|
</div>
|
|
4417
|
-
`}function
|
|
4417
|
+
`}function ay(e){const{schema:t,value:n,path:s,hints:i,unsupported:o,disabled:r,reservedKeys:l,onPatch:a,searchCriteria:d}=e,g=ey(t),u=Object.entries(n??{}).filter(([v])=>!l.has(v)),f=d&&kn(d)?u.filter(([v,m])=>vn({schema:t,value:m,path:[...s,v],hints:i,criteria:d})):u;return c`
|
|
4418
4418
|
<div class="cfg-map">
|
|
4419
4419
|
<div class="cfg-map__header">
|
|
4420
4420
|
<span class="cfg-map__label">Custom entries</span>
|
|
@@ -4422,9 +4422,9 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4422
4422
|
type="button"
|
|
4423
4423
|
class="cfg-map__add"
|
|
4424
4424
|
?disabled=${r}
|
|
4425
|
-
@click=${()=>{const v={...n};let m=1,S=`custom-${m}`;for(;S in v;)m+=1,S=`custom-${m}`;v[S]=g?{}:
|
|
4425
|
+
@click=${()=>{const v={...n};let m=1,S=`custom-${m}`;for(;S in v;)m+=1,S=`custom-${m}`;v[S]=g?{}:Xl(t),a(s,v)}}
|
|
4426
4426
|
>
|
|
4427
|
-
<span class="cfg-map__add-icon">${
|
|
4427
|
+
<span class="cfg-map__add-icon">${es.plus}</span>
|
|
4428
4428
|
Add Entry
|
|
4429
4429
|
</button>
|
|
4430
4430
|
</div>
|
|
@@ -4433,7 +4433,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4433
4433
|
<div class="cfg-map__empty">No custom entries.</div>
|
|
4434
4434
|
`:c`
|
|
4435
4435
|
<div class="cfg-map__items">
|
|
4436
|
-
${f.map(([v,m])=>{const S=[...s,v],T=
|
|
4436
|
+
${f.map(([v,m])=>{const S=[...s,v],T=ty(m);return c`
|
|
4437
4437
|
<div class="cfg-map__item">
|
|
4438
4438
|
<div class="cfg-map__item-header">
|
|
4439
4439
|
<div class="cfg-map__item-key">
|
|
@@ -4453,7 +4453,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4453
4453
|
?disabled=${r}
|
|
4454
4454
|
@click=${()=>{const M={...n};delete M[v],a(s,M)}}
|
|
4455
4455
|
>
|
|
4456
|
-
${
|
|
4456
|
+
${es.trash}
|
|
4457
4457
|
</button>
|
|
4458
4458
|
</div>
|
|
4459
4459
|
<div class="cfg-map__item-value">
|
|
@@ -4473,7 +4473,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4473
4473
|
</div>
|
|
4474
4474
|
`}
|
|
4475
4475
|
</div>
|
|
4476
|
-
`}const
|
|
4476
|
+
`}const Qa={env:c`
|
|
4477
4477
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
4478
4478
|
<circle cx="12" cy="12" r="3"></circle>
|
|
4479
4479
|
<path
|
|
@@ -4660,23 +4660,23 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4660
4660
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
4661
4661
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
4662
4662
|
</svg>
|
|
4663
|
-
`},
|
|
4663
|
+
`},fr={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 Ya(e){return Qa[e]??Qa.default}function ly(e){if(!e.query)return!0;const t=Ud(e.query),n=t.text,s=fr[e.key];return n&&e.key.toLowerCase().includes(n)||n&&s&&(s.label.toLowerCase().includes(n)||s.description.toLowerCase().includes(n))?!0:vn({schema:e.schema,value:e.sectionValue,path:[e.key],hints:e.uiHints,criteria:t})}function cy(e){if(!e.schema)return c`
|
|
4664
4664
|
<div class="muted">Schema unavailable.</div>
|
|
4665
4665
|
`;const t=e.schema,n=e.value??{};if(ve(t)!=="object"||!t.properties)return c`
|
|
4666
4666
|
<div class="callout danger">Unsupported schema. Use Raw.</div>
|
|
4667
|
-
`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,o=e.searchQuery??"",r=Ud(o),l=e.activeSection,a=e.activeSubsection??null,g=Object.entries(i).toSorted((f,v)=>{const m=bt([f[0]],e.uiHints)?.order??50,S=bt([v[0]],e.uiHints)?.order??50;return m!==S?m-S:f[0].localeCompare(v[0])}).filter(([f,v])=>!(l&&f!==l||o&&!
|
|
4667
|
+
`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,o=e.searchQuery??"",r=Ud(o),l=e.activeSection,a=e.activeSubsection??null,g=Object.entries(i).toSorted((f,v)=>{const m=bt([f[0]],e.uiHints)?.order??50,S=bt([v[0]],e.uiHints)?.order??50;return m!==S?m-S:f[0].localeCompare(v[0])}).filter(([f,v])=>!(l&&f!==l||o&&!ly({key:f,schema:v,sectionValue:n[f],uiHints:e.uiHints,query:o})));let u=null;if(l&&a&&g.length===1){const f=g[0]?.[1];f&&ve(f)==="object"&&f.properties&&f.properties[a]&&(u={sectionKey:l,subsectionKey:a,schema:f.properties[a]})}return g.length===0?c`
|
|
4668
4668
|
<div class="config-empty">
|
|
4669
|
-
<div class="config-empty__icon">${
|
|
4669
|
+
<div class="config-empty__icon">${pe.search}</div>
|
|
4670
4670
|
<div class="config-empty__text">
|
|
4671
4671
|
${o?`No settings match "${o}"`:"No settings in this section"}
|
|
4672
4672
|
</div>
|
|
4673
4673
|
</div>
|
|
4674
4674
|
`:c`
|
|
4675
4675
|
<div class="config-form config-form--modern">
|
|
4676
|
-
${u?(()=>{const{sectionKey:f,subsectionKey:v,schema:m}=u,S=bt([f,v],e.uiHints),T=S?.label??m.title??
|
|
4676
|
+
${u?(()=>{const{sectionKey:f,subsectionKey:v,schema:m}=u,S=bt([f,v],e.uiHints),T=S?.label??m.title??ei(v),M=S?.help??m.description??"",I=n[f],A=I&&typeof I=="object"?I[v]:void 0,w=`config-section-${f}-${v}`;return c`
|
|
4677
4677
|
<section class="config-section-card" id=${w}>
|
|
4678
4678
|
<div class="config-section-card__header">
|
|
4679
|
-
<span class="config-section-card__icon">${
|
|
4679
|
+
<span class="config-section-card__icon">${Ya(f)}</span>
|
|
4680
4680
|
<div class="config-section-card__titles">
|
|
4681
4681
|
<h3 class="config-section-card__title">${T}</h3>
|
|
4682
4682
|
${M?c`<p class="config-section-card__desc">${M}</p>`:h}
|
|
@@ -4686,10 +4686,10 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4686
4686
|
${Ct({schema:m,value:A,path:[f,v],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,searchCriteria:r,onPatch:e.onPatch})}
|
|
4687
4687
|
</div>
|
|
4688
4688
|
</section>
|
|
4689
|
-
`})():g.map(([f,v])=>{const m=
|
|
4689
|
+
`})():g.map(([f,v])=>{const m=fr[f]??{label:f.charAt(0).toUpperCase()+f.slice(1),description:v.description??""};return c`
|
|
4690
4690
|
<section class="config-section-card" id="config-section-${f}">
|
|
4691
4691
|
<div class="config-section-card__header">
|
|
4692
|
-
<span class="config-section-card__icon">${
|
|
4692
|
+
<span class="config-section-card__icon">${Ya(f)}</span>
|
|
4693
4693
|
<div class="config-section-card__titles">
|
|
4694
4694
|
<h3 class="config-section-card__title">${m.label}</h3>
|
|
4695
4695
|
${m.description?c`<p class="config-section-card__desc">${m.description}</p>`:h}
|
|
@@ -4701,7 +4701,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4701
4701
|
</section>
|
|
4702
4702
|
`})}
|
|
4703
4703
|
</div>
|
|
4704
|
-
`}const
|
|
4704
|
+
`}const dy=new Set(["title","description","default","nullable"]);function uy(e){return Object.keys(e??{}).filter(n=>!dy.has(n)).length===0}function Bd(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(o=>Object.is(o,i))||s.push(i);return{enumValues:s,nullable:n}}function Hd(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:bn(e,[])}function bn(e,t){const n=new Set,s={...e},i=No(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const l=hy(e,t);return l||{schema:e,unsupportedPaths:[i]}}const o=Array.isArray(e.type)&&e.type.includes("null"),r=ve(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=r??e.type,s.nullable=o||e.nullable,s.enum){const{enumValues:l,nullable:a}=Bd(s.enum);s.enum=l,a&&(s.nullable=!0),l.length===0&&n.add(i)}if(r==="object"){const l=e.properties??{},a={};for(const[d,g]of Object.entries(l)){const u=bn(g,[...t,d]);u.schema&&(a[d]=u.schema);for(const f of u.unsupportedPaths)n.add(f)}if(s.properties=a,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!uy(e.additionalProperties)){const d=bn(e.additionalProperties,[...t,"*"]);s.additionalProperties=d.schema??e.additionalProperties,d.unsupportedPaths.length>0&&n.add(i)}}else if(r==="array"){const l=Array.isArray(e.items)?e.items[0]:e.items;if(!l)n.add(i);else{const a=bn(l,[...t,"*"]);s.items=a.schema??l,a.unsupportedPaths.length>0&&n.add(i)}}else r!=="string"&&r!=="number"&&r!=="integer"&&r!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function gy(e){if(ve(e)!=="object")return!1;const t=e.properties?.source,n=e.properties?.provider,s=e.properties?.id;return!t||!n||!s?!1:typeof t.const=="string"&&ve(n)==="string"&&ve(s)==="string"}function fy(e){const t=e.oneOf??e.anyOf;return!t||t.length===0?!1:t.every(n=>gy(n))}function py(e,t,n,s){const i=n.findIndex(r=>ve(r)==="string");if(i<0)return null;const o=n.filter((r,l)=>l!==i);return o.length!==1||!fy(o[0])?null:bn({...e,...n[i],nullable:s,anyOf:void 0,oneOf:void 0,allOf:void 0},t)}function hy(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let o=!1;for(const a of n){if(!a||typeof a!="object")return null;if(Array.isArray(a.enum)){const{enumValues:d,nullable:g}=Bd(a.enum);s.push(...d),g&&(o=!0);continue}if("const"in a){if(a.const==null){o=!0;continue}s.push(a.const);continue}if(ve(a)==="null"){o=!0;continue}i.push(a)}const r=py(e,t,i,o);if(r)return r;if(s.length>0&&i.length===0){const a=[];for(const d of s)a.some(g=>Object.is(g,d))||a.push(d);return{schema:{...e,enum:a,nullable:o,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const a=bn(i[0],t);return a.schema&&(a.schema.nullable=o||a.schema.nullable),a}const l=new Set(["string","number","integer","boolean"]);return i.length>0&&s.length===0&&i.every(a=>a.type&&l.has(String(a.type)))?{schema:{...e,nullable:o},unsupportedPaths:[]}:null}function my(e,t){let n=e;for(const s of t){if(!n)return null;const i=ve(n);if(i==="object"){const o=n.properties??{};if(typeof s=="string"&&o[s]){n=o[s];continue}const r=n.additionalProperties;if(typeof s=="string"&&r&&typeof r=="object"){n=r;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 vy(e,t){return Md(e,t)??{}}const by=["groupPolicy","streamMode","dmPolicy"];function yy(e){const t=by.flatMap(n=>n in e?[[n,e[n]]]:[]);return t.length===0?null:c`
|
|
4705
4705
|
<div class="status-list" style="margin-top: 12px;">
|
|
4706
4706
|
${t.map(([n,s])=>c`
|
|
4707
4707
|
<div>
|
|
@@ -4710,20 +4710,20 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4710
4710
|
</div>
|
|
4711
4711
|
`)}
|
|
4712
4712
|
</div>
|
|
4713
|
-
`}function
|
|
4713
|
+
`}function $y(e){const t=Hd(e.schema),n=t.schema;if(!n)return c`
|
|
4714
4714
|
<div class="callout danger">Schema unavailable. Use Raw.</div>
|
|
4715
|
-
`;const s=
|
|
4715
|
+
`;const s=my(n,["channels",e.channelId]);if(!s)return c`
|
|
4716
4716
|
<div class="callout danger">Channel config schema unavailable.</div>
|
|
4717
|
-
`;const i=e.configValue??{},o=
|
|
4717
|
+
`;const i=e.configValue??{},o=vy(i,e.channelId);return c`
|
|
4718
4718
|
<div class="config-form">
|
|
4719
4719
|
${Ct({schema:s,value:o,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
|
|
4720
4720
|
</div>
|
|
4721
|
-
${
|
|
4721
|
+
${yy(o)}
|
|
4722
4722
|
`}function at(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return c`
|
|
4723
4723
|
<div style="margin-top: 16px;">
|
|
4724
4724
|
${n.configSchemaLoading?c`
|
|
4725
4725
|
<div class="muted">Loading config schema…</div>
|
|
4726
|
-
|
|
4726
|
+
`:$y({channelId:t,configValue:n.configForm,schema:n.configSchema,uiHints:n.configUiHints,disabled:s,onPatch:n.onConfigPatch})}
|
|
4727
4727
|
<div class="row" style="margin-top: 12px;">
|
|
4728
4728
|
<button
|
|
4729
4729
|
class="btn primary"
|
|
@@ -4741,7 +4741,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4741
4741
|
</button>
|
|
4742
4742
|
</div>
|
|
4743
4743
|
</div>
|
|
4744
|
-
`}function
|
|
4744
|
+
`}function xy(e){const{props:t,discord:n,accountCountLabel:s}=e;return c`
|
|
4745
4745
|
<div class="card">
|
|
4746
4746
|
<div class="card-title">Discord</div>
|
|
4747
4747
|
<div class="card-sub">Bot status and channel configuration.</div>
|
|
@@ -4783,7 +4783,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4783
4783
|
</button>
|
|
4784
4784
|
</div>
|
|
4785
4785
|
</div>
|
|
4786
|
-
`}function
|
|
4786
|
+
`}function wy(e){const{props:t,googleChat:n,accountCountLabel:s}=e;return c`
|
|
4787
4787
|
<div class="card">
|
|
4788
4788
|
<div class="card-title">Google Chat</div>
|
|
4789
4789
|
<div class="card-sub">Chat API webhook status and channel configuration.</div>
|
|
@@ -4835,7 +4835,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4835
4835
|
</button>
|
|
4836
4836
|
</div>
|
|
4837
4837
|
</div>
|
|
4838
|
-
`}function
|
|
4838
|
+
`}function Sy(e){const{props:t,imessage:n,accountCountLabel:s}=e;return c`
|
|
4839
4839
|
<div class="card">
|
|
4840
4840
|
<div class="card-title">iMessage</div>
|
|
4841
4841
|
<div class="card-sub">macOS bridge status and channel configuration.</div>
|
|
@@ -4877,7 +4877,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4877
4877
|
</button>
|
|
4878
4878
|
</div>
|
|
4879
4879
|
</div>
|
|
4880
|
-
`}function
|
|
4880
|
+
`}function Xa(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:"n/a"}function ky(e){const{props:t,nostr:n,nostrAccounts:s,accountCountLabel:i,profileFormState:o,profileFormCallbacks:r,onEditProfile:l}=e,a=s[0],d=n?.configured??a?.configured??!1,g=n?.running??a?.running??!1,u=n?.publicKey??a?.publicKey,f=n?.lastStartAt??a?.lastStartAt??null,v=n?.lastError??a?.lastError??null,m=s.length>1,S=o!=null,T=I=>{const A=I.publicKey,w=I.profile,L=w?.displayName??w?.name??I.name??I.accountId;return c`
|
|
4881
4881
|
<div class="account-card">
|
|
4882
4882
|
<div class="account-card-header">
|
|
4883
4883
|
<div class="account-card-title">${L}</div>
|
|
@@ -4894,7 +4894,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4894
4894
|
</div>
|
|
4895
4895
|
<div>
|
|
4896
4896
|
<span class="label">Public Key</span>
|
|
4897
|
-
<span class="monospace" title="${A??""}">${
|
|
4897
|
+
<span class="monospace" title="${A??""}">${Xa(A)}</span>
|
|
4898
4898
|
</div>
|
|
4899
4899
|
<div>
|
|
4900
4900
|
<span class="label">Last inbound</span>
|
|
@@ -4905,7 +4905,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4905
4905
|
`:h}
|
|
4906
4906
|
</div>
|
|
4907
4907
|
</div>
|
|
4908
|
-
`},M=()=>{if(S&&r)return
|
|
4908
|
+
`},M=()=>{if(S&&r)return bg({state:o,callbacks:r,accountId:s[0]?.accountId??"default"});const I=a?.profile??n?.profile,{name:A,displayName:w,about:L,picture:E,nip05:R}=I??{},K=A||w||L||E||R;return c`
|
|
4909
4909
|
<div style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
|
|
4910
4910
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
|
4911
4911
|
<div style="font-weight: 500;">Profile</div>
|
|
@@ -4965,7 +4965,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4965
4965
|
<div>
|
|
4966
4966
|
<span class="label">Public Key</span>
|
|
4967
4967
|
<span class="monospace" title="${u??""}"
|
|
4968
|
-
>${
|
|
4968
|
+
>${Xa(u)}</span
|
|
4969
4969
|
>
|
|
4970
4970
|
</div>
|
|
4971
4971
|
<div>
|
|
@@ -4985,7 +4985,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4985
4985
|
<button class="btn" @click=${()=>t.onRefresh(!1)}>Refresh</button>
|
|
4986
4986
|
</div>
|
|
4987
4987
|
</div>
|
|
4988
|
-
`}function
|
|
4988
|
+
`}function Ay(e,t){const n=t.snapshot,s=n?.channels;if(!n||!s)return!1;const i=s[e],o=typeof i?.configured=="boolean"&&i.configured,r=typeof i?.running=="boolean"&&i.running,l=typeof i?.connected=="boolean"&&i.connected,d=(n.channelAccounts?.[e]??[]).some(g=>g.configured||g.running||g.connected);return o||r||l||d}function Cy(e,t){return t?.[e]?.length??0}function zd(e,t){const n=Cy(e,t);return n<2?h:c`<div class="account-count">Accounts (${n})</div>`}function Ty(e){const{props:t,signal:n,accountCountLabel:s}=e;return c`
|
|
4989
4989
|
<div class="card">
|
|
4990
4990
|
<div class="card-title">Signal</div>
|
|
4991
4991
|
<div class="card-sub">signal-cli status and channel configuration.</div>
|
|
@@ -5031,7 +5031,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
5031
5031
|
</button>
|
|
5032
5032
|
</div>
|
|
5033
5033
|
</div>
|
|
5034
|
-
`}function
|
|
5034
|
+
`}function Ey(e){const{props:t,slack:n,accountCountLabel:s}=e;return c`
|
|
5035
5035
|
<div class="card">
|
|
5036
5036
|
<div class="card-title">Slack</div>
|
|
5037
5037
|
<div class="card-sub">Socket mode status and channel configuration.</div>
|
|
@@ -5073,7 +5073,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
5073
5073
|
</button>
|
|
5074
5074
|
</div>
|
|
5075
5075
|
</div>
|
|
5076
|
-
`}function
|
|
5076
|
+
`}function _y(e){const{props:t,telegram:n,telegramAccounts:s,accountCountLabel:i}=e,o=s.length>1,r=l=>{const d=l.probe?.bot?.username,g=l.name||l.accountId;return c`
|
|
5077
5077
|
<div class="account-card">
|
|
5078
5078
|
<div class="account-card-header">
|
|
5079
5079
|
<div class="account-card-title">
|
|
@@ -5153,7 +5153,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
5153
5153
|
</button>
|
|
5154
5154
|
</div>
|
|
5155
5155
|
</div>
|
|
5156
|
-
`}function
|
|
5156
|
+
`}function Iy(e){const{props:t,whatsapp:n,accountCountLabel:s}=e;return c`
|
|
5157
5157
|
<div class="card">
|
|
5158
5158
|
<div class="card-title">WhatsApp</div>
|
|
5159
5159
|
<div class="card-sub">Link WhatsApp Web and monitor connection health.</div>
|
|
@@ -5191,7 +5191,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
5191
5191
|
<div>
|
|
5192
5192
|
<span class="label">Auth age</span>
|
|
5193
5193
|
<span>
|
|
5194
|
-
${n?.authAgeMs!=null?
|
|
5194
|
+
${n?.authAgeMs!=null?Ho(n.authAgeMs):"n/a"}
|
|
5195
5195
|
</span>
|
|
5196
5196
|
</div>
|
|
5197
5197
|
</div>
|
|
@@ -5244,9 +5244,9 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
5244
5244
|
|
|
5245
5245
|
${at({channelId:"whatsapp",props:t})}
|
|
5246
5246
|
</div>
|
|
5247
|
-
`}function
|
|
5247
|
+
`}function Ry(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null,o=t?.googlechat??null,r=t?.slack??null,l=t?.signal??null,a=t?.imessage??null,d=t?.nostr??null,u=My(e.snapshot).map((f,v)=>({key:f,enabled:Ay(f,e),order:v})).toSorted((f,v)=>f.enabled!==v.enabled?f.enabled?-1:1:f.order-v.order);return c`
|
|
5248
5248
|
<section class="grid grid-cols-2">
|
|
5249
|
-
${u.map(f=>
|
|
5249
|
+
${u.map(f=>Ly(f.key,e,{whatsapp:n,telegram:s,discord:i,googlechat:o,slack:r,signal:l,imessage:a,nostr:d,channelAccounts:e.snapshot?.channelAccounts??null}))}
|
|
5250
5250
|
</section>
|
|
5251
5251
|
|
|
5252
5252
|
<section class="card" style="margin-top: 18px;">
|
|
@@ -5264,7 +5264,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
5264
5264
|
${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
5265
5265
|
</pre>
|
|
5266
5266
|
</section>
|
|
5267
|
-
`}function
|
|
5267
|
+
`}function My(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 Ly(e,t,n){const s=zd(e,n.channelAccounts);switch(e){case"whatsapp":return Iy({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return _y({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return xy({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return wy({props:t,googleChat:n.googlechat,accountCountLabel:s});case"slack":return Ey({props:t,slack:n.slack,accountCountLabel:s});case"signal":return Ty({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return Sy({props:t,imessage:n.imessage,accountCountLabel:s});case"nostr":{const i=n.channelAccounts?.nostr??[],o=i[0],r=o?.accountId??"default",l=o?.profile??null,a=t.nostrProfileAccountId===r?t.nostrProfileFormState:null,d=a?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return ky({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:a,profileFormCallbacks:d,onEditProfile:()=>t.onNostrProfileEdit(r,l)})}default:return Dy(e,t,n.channelAccounts??{})}}function Dy(e,t,n){const s=Fy(t.snapshot,e),i=t.snapshot?.channels?.[e],o=typeof i?.configured=="boolean"?i.configured:void 0,r=typeof i?.running=="boolean"?i.running:void 0,l=typeof i?.connected=="boolean"?i.connected:void 0,a=typeof i?.lastError=="string"?i.lastError:void 0,d=n[e]??[],g=zd(e,n);return c`
|
|
5268
5268
|
<div class="card">
|
|
5269
5269
|
<div class="card-title">${s}</div>
|
|
5270
5270
|
<div class="card-sub">Channel status and configuration.</div>
|
|
@@ -5272,7 +5272,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
5272
5272
|
|
|
5273
5273
|
${d.length>0?c`
|
|
5274
5274
|
<div class="account-card-list">
|
|
5275
|
-
${d.map(u=>
|
|
5275
|
+
${d.map(u=>By(u))}
|
|
5276
5276
|
</div>
|
|
5277
5277
|
`:c`
|
|
5278
5278
|
<div class="status-list" style="margin-top: 16px;">
|
|
@@ -5297,7 +5297,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
5297
5297
|
|
|
5298
5298
|
${at({channelId:e,props:t})}
|
|
5299
5299
|
</div>
|
|
5300
|
-
`}function
|
|
5300
|
+
`}function Py(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Fy(e,t){return Py(e)[t]?.label??e?.channelLabels?.[t]??t}const Ny=600*1e3;function jd(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<Ny:!1}function Oy(e){return e.running?"Yes":jd(e)?"Active":"No"}function Uy(e){return e.connected===!0?"Yes":e.connected===!1?"No":jd(e)?"Active":"n/a"}function By(e){const t=Oy(e),n=Uy(e);return c`
|
|
5301
5301
|
<div class="account-card">
|
|
5302
5302
|
<div class="account-card-header">
|
|
5303
5303
|
<div class="account-card-title">${e.name||e.accountId}</div>
|
|
@@ -5327,12 +5327,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
5327
5327
|
`:h}
|
|
5328
5328
|
</div>
|
|
5329
5329
|
</div>
|
|
5330
|
-
`}const Wn=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Wn(s,t);return!0},Gs=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},Kd=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),Ly(t)}};function Ry(e){this._$AN!==void 0?(Gs(this),this._$AM=e,Kd(this)):this._$AM=e}function My(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 o=n;o<s.length;o++)Wn(s[o],!1),Gs(s[o]);else s!=null&&(Wn(s,!1),Gs(s));else Wn(this,e)}const Ly=e=>{e.type==cr.CHILD&&(e._$AP??=My,e._$AQ??=Ry)};class Dy extends ur{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),Kd(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Wn(this,t),Gs(this))}setValue(t){if(_v(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 Hi=new WeakMap,Py=dr(class extends Dy{render(e){return h}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)),h}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Hi.get(t);n===void 0&&(n=new WeakMap,Hi.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"?Hi.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 xo extends ur{constructor(t){if(super(t),this.it=h,t.type!==cr.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===h||t==null)return this._t=void 0,this.it=t;if(t===wt)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:[]}}}xo.directiveName="unsafeHTML",xo.resultType=1;const wo=dr(xo);const{entries:Wd,setPrototypeOf:el,isFrozen:Fy,getPrototypeOf:Ny,getOwnPropertyDescriptor:Oy}=Object;let{freeze:Te,seal:Ue,create:Ms}=Object,{apply:So,construct:ko}=typeof Reflect<"u"&&Reflect;Te||(Te=function(t){return t});Ue||(Ue=function(t){return t});So||(So=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;o<s;o++)i[o-2]=arguments[o];return t.apply(n,i)});ko||(ko=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 ws=Ee(Array.prototype.forEach),Uy=Ee(Array.prototype.lastIndexOf),tl=Ee(Array.prototype.pop),Rn=Ee(Array.prototype.push),By=Ee(Array.prototype.splice),Ls=Ee(String.prototype.toLowerCase),zi=Ee(String.prototype.toString),ji=Ee(String.prototype.match),Mn=Ee(String.prototype.replace),Hy=Ee(String.prototype.indexOf),zy=Ee(String.prototype.trim),De=Ee(Object.prototype.hasOwnProperty),ke=Ee(RegExp.prototype.test),Ln=jy(TypeError);function Ee(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 So(e,t,s)}}function jy(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return ko(e,n)}}function Q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ls;el&&el(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const o=n(i);o!==i&&(Fy(t)||(t[s]=o),i=o)}e[i]=!0}return e}function Ky(e){for(let t=0;t<e.length;t++)De(e,t)||(e[t]=null);return e}function Ve(e){const t=Ms(null);for(const[n,s]of Wd(e))De(e,n)&&(Array.isArray(s)?t[n]=Ky(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Ve(s):t[n]=s);return t}function Dn(e,t){for(;e!==null;){const s=Oy(e,t);if(s){if(s.get)return Ee(s.get);if(typeof s.value=="function")return Ee(s.value)}e=Ny(e)}function n(){return null}return n}const nl=Te(["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"]),Ki=Te(["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"]),Wi=Te(["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"]),Wy=Te(["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"]),qi=Te(["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"]),qy=Te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sl=Te(["#text"]),il=Te(["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"]),Gi=Te(["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"]),ol=Te(["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"]),Ss=Te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gy=Ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Vy=Ue(/<%[\w\W]*|[\w\W]*%>/gm),Jy=Ue(/\$\{[\w\W]*/gm),Qy=Ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),Yy=Ue(/^aria-[\-\w]+$/),qd=Ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Xy=Ue(/^(?:\w+script|data):/i),Zy=Ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Gd=Ue(/^html$/i),e0=Ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var rl=Object.freeze({__proto__:null,ARIA_ATTR:Yy,ATTR_WHITESPACE:Zy,CUSTOM_ELEMENT:e0,DATA_ATTR:Qy,DOCTYPE_NAME:Gd,ERB_EXPR:Vy,IS_ALLOWED_URI:qd,IS_SCRIPT_OR_DATA:Xy,MUSTACHE_EXPR:Gy,TMPLIT_EXPR:Jy});const Pn={element:1,text:3,progressingInstruction:7,comment:8,document:9},t0=function(){return typeof window>"u"?null:window},n0=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 o="dompurify"+(s?"#"+s:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},al=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Vd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:t0();const t=j=>Vd(j);if(t.version="3.3.3",t.removed=[],!e||!e.document||e.document.nodeType!==Pn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:l,Element:a,NodeFilter:d,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:v}=e,m=a.prototype,S=Dn(m,"cloneNode"),T=Dn(m,"remove"),M=Dn(m,"nextSibling"),I=Dn(m,"childNodes"),A=Dn(m,"parentNode");if(typeof r=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let w,L="";const{implementation:E,createNodeIterator:R,createDocumentFragment:K,getElementsByTagName:G}=n,{importNode:b}=s;let C=al();t.isSupported=typeof Wd=="function"&&typeof A=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:W,TMPLIT_EXPR:V,DATA_ATTR:_,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:q,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:re}=rl;let{IS_ALLOWED_URI:D}=rl,F=null;const J=Q({},[...nl,...Ki,...Wi,...qi,...sl]);let Y=null;const ue=Q({},[...il,...Gi,...ol,...Ss]);let ee=Object.seal(Ms(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}})),ae=null,X=null;const z=Object.seal(Ms(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,de=!0,be=!1,Le=!0,Xe=!1,lt=!0,ye=!1,je=!1,Ze=!1,et=!1,tt=!1,ct=!1,dt=!0,_t=!1;const bi="user-content-";let tn=!0,ut=!1,Ke={},_e=null;const Tn=Q({},["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 nn=null;const gt=Q({},["audio","video","img","source","image","track"]);let yi=null;const Er=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),cs="http://www.w3.org/1998/Math/MathML",ds="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let sn=nt,$i=!1,xi=null;const Su=Q({},[cs,ds,nt],zi);let us=Q({},["mi","mo","mn","ms","mtext"]),gs=Q({},["annotation-xml"]);const ku=Q({},["title","style","font","a","script"]);let En=null;const Au=["application/xhtml+xml","text/html"],Cu="text/html";let pe=null,on=null;const Tu=n.createElement("form"),_r=function(k){return k instanceof RegExp||k instanceof Function},wi=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(on&&on===k)){if((!k||typeof k!="object")&&(k={}),k=Ve(k),En=Au.indexOf(k.PARSER_MEDIA_TYPE)===-1?Cu:k.PARSER_MEDIA_TYPE,pe=En==="application/xhtml+xml"?zi:Ls,F=De(k,"ALLOWED_TAGS")?Q({},k.ALLOWED_TAGS,pe):J,Y=De(k,"ALLOWED_ATTR")?Q({},k.ALLOWED_ATTR,pe):ue,xi=De(k,"ALLOWED_NAMESPACES")?Q({},k.ALLOWED_NAMESPACES,zi):Su,yi=De(k,"ADD_URI_SAFE_ATTR")?Q(Ve(Er),k.ADD_URI_SAFE_ATTR,pe):Er,nn=De(k,"ADD_DATA_URI_TAGS")?Q(Ve(gt),k.ADD_DATA_URI_TAGS,pe):gt,_e=De(k,"FORBID_CONTENTS")?Q({},k.FORBID_CONTENTS,pe):Tn,ae=De(k,"FORBID_TAGS")?Q({},k.FORBID_TAGS,pe):Ve({}),X=De(k,"FORBID_ATTR")?Q({},k.FORBID_ATTR,pe):Ve({}),Ke=De(k,"USE_PROFILES")?k.USE_PROFILES:!1,le=k.ALLOW_ARIA_ATTR!==!1,de=k.ALLOW_DATA_ATTR!==!1,be=k.ALLOW_UNKNOWN_PROTOCOLS||!1,Le=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Xe=k.SAFE_FOR_TEMPLATES||!1,lt=k.SAFE_FOR_XML!==!1,ye=k.WHOLE_DOCUMENT||!1,et=k.RETURN_DOM||!1,tt=k.RETURN_DOM_FRAGMENT||!1,ct=k.RETURN_TRUSTED_TYPE||!1,Ze=k.FORCE_BODY||!1,dt=k.SANITIZE_DOM!==!1,_t=k.SANITIZE_NAMED_PROPS||!1,tn=k.KEEP_CONTENT!==!1,ut=k.IN_PLACE||!1,D=k.ALLOWED_URI_REGEXP||qd,sn=k.NAMESPACE||nt,us=k.MATHML_TEXT_INTEGRATION_POINTS||us,gs=k.HTML_INTEGRATION_POINTS||gs,ee=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&_r(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&_r(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Xe&&(de=!1),tt&&(et=!0),Ke&&(F=Q({},sl),Y=Ms(null),Ke.html===!0&&(Q(F,nl),Q(Y,il)),Ke.svg===!0&&(Q(F,Ki),Q(Y,Gi),Q(Y,Ss)),Ke.svgFilters===!0&&(Q(F,Wi),Q(Y,Gi),Q(Y,Ss)),Ke.mathMl===!0&&(Q(F,qi),Q(Y,ol),Q(Y,Ss))),De(k,"ADD_TAGS")||(z.tagCheck=null),De(k,"ADD_ATTR")||(z.attributeCheck=null),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?z.tagCheck=k.ADD_TAGS:(F===J&&(F=Ve(F)),Q(F,k.ADD_TAGS,pe))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?z.attributeCheck=k.ADD_ATTR:(Y===ue&&(Y=Ve(Y)),Q(Y,k.ADD_ATTR,pe))),k.ADD_URI_SAFE_ATTR&&Q(yi,k.ADD_URI_SAFE_ATTR,pe),k.FORBID_CONTENTS&&(_e===Tn&&(_e=Ve(_e)),Q(_e,k.FORBID_CONTENTS,pe)),k.ADD_FORBID_CONTENTS&&(_e===Tn&&(_e=Ve(_e)),Q(_e,k.ADD_FORBID_CONTENTS,pe)),tn&&(F["#text"]=!0),ye&&Q(F,["html","head","body"]),F.table&&(Q(F,["tbody"]),delete ae.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ln('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ln('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=k.TRUSTED_TYPES_POLICY,L=w.createHTML("")}else w===void 0&&(w=n0(v,i)),w!==null&&typeof L=="string"&&(L=w.createHTML(""));Te&&Te(k),on=k}},Ir=Q({},[...Ki,...Wi,...Wy]),Rr=Q({},[...qi,...qy]),Eu=function(k){let P=A(k);(!P||!P.tagName)&&(P={namespaceURI:sn,tagName:"template"});const B=Ls(k.tagName),ce=Ls(P.tagName);return xi[k.namespaceURI]?k.namespaceURI===ds?P.namespaceURI===nt?B==="svg":P.namespaceURI===cs?B==="svg"&&(ce==="annotation-xml"||us[ce]):!!Ir[B]:k.namespaceURI===cs?P.namespaceURI===nt?B==="math":P.namespaceURI===ds?B==="math"&&gs[ce]:!!Rr[B]:k.namespaceURI===nt?P.namespaceURI===ds&&!gs[ce]||P.namespaceURI===cs&&!us[ce]?!1:!Rr[B]&&(ku[B]||!Ir[B]):!!(En==="application/xhtml+xml"&&xi[k.namespaceURI]):!1},We=function(k){Rn(t.removed,{element:k});try{A(k).removeChild(k)}catch{T(k)}},It=function(k,P){try{Rn(t.removed,{attribute:P.getAttributeNode(k),from:P})}catch{Rn(t.removed,{attribute:null,from:P})}if(P.removeAttribute(k),k==="is")if(et||tt)try{We(P)}catch{}else try{P.setAttribute(k,"")}catch{}},Mr=function(k){let P=null,B=null;if(Ze)k="<remove></remove>"+k;else{const ge=ji(k,/^[\r\n\t ]+/);B=ge&&ge[0]}En==="application/xhtml+xml"&&sn===nt&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const ce=w?w.createHTML(k):k;if(sn===nt)try{P=new f().parseFromString(ce,En)}catch{}if(!P||!P.documentElement){P=E.createDocument(sn,"template",null);try{P.documentElement.innerHTML=$i?L:ce}catch{}}const we=P.body||P.documentElement;return k&&B&&we.insertBefore(n.createTextNode(B),we.childNodes[0]||null),sn===nt?G.call(P,ye?"html":"body")[0]:ye?P.documentElement:we},Lr=function(k){return R.call(k.ownerDocument||k,k,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Si=function(k){return k instanceof u&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof g)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Dr=function(k){return typeof l=="function"&&k instanceof l};function st(j,k,P){ws(j,B=>{B.call(t,k,P,on)})}const Pr=function(k){let P=null;if(st(C.beforeSanitizeElements,k,null),Si(k))return We(k),!0;const B=pe(k.nodeName);if(st(C.uponSanitizeElement,k,{tagName:B,allowedTags:F}),lt&&k.hasChildNodes()&&!Dr(k.firstElementChild)&&ke(/<[/\w!]/g,k.innerHTML)&&ke(/<[/\w!]/g,k.textContent)||k.nodeType===Pn.progressingInstruction||lt&&k.nodeType===Pn.comment&&ke(/<[/\w]/g,k.data))return We(k),!0;if(!(z.tagCheck instanceof Function&&z.tagCheck(B))&&(!F[B]||ae[B])){if(!ae[B]&&Nr(B)&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,B)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(B)))return!1;if(tn&&!_e[B]){const ce=A(k)||k.parentNode,we=I(k)||k.childNodes;if(we&&ce){const ge=we.length;for(let Ie=ge-1;Ie>=0;--Ie){const it=S(we[Ie],!0);it.__removalCount=(k.__removalCount||0)+1,ce.insertBefore(it,M(k))}}}return We(k),!0}return k instanceof a&&!Eu(k)||(B==="noscript"||B==="noembed"||B==="noframes")&&ke(/<\/no(script|embed|frames)/i,k.innerHTML)?(We(k),!0):(Xe&&k.nodeType===Pn.text&&(P=k.textContent,ws([N,W,V],ce=>{P=Mn(P,ce," ")}),k.textContent!==P&&(Rn(t.removed,{element:k.cloneNode()}),k.textContent=P)),st(C.afterSanitizeElements,k,null),!1)},Fr=function(k,P,B){if(X[P]||dt&&(P==="id"||P==="name")&&(B in n||B in Tu))return!1;if(!(de&&!X[P]&&ke(_,P))){if(!(le&&ke(O,P))){if(!(z.attributeCheck instanceof Function&&z.attributeCheck(P,k))){if(!Y[P]||X[P]){if(!(Nr(k)&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,k)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(k))&&(ee.attributeNameCheck instanceof RegExp&&ke(ee.attributeNameCheck,P)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(P,k))||P==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,B)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(B))))return!1}else if(!yi[P]){if(!ke(D,Mn(B,oe,""))){if(!((P==="src"||P==="xlink:href"||P==="href")&&k!=="script"&&Hy(B,"data:")===0&&nn[k])){if(!(be&&!ke(q,Mn(B,oe,"")))){if(B)return!1}}}}}}}return!0},Nr=function(k){return k!=="annotation-xml"&&ji(k,re)},Or=function(k){st(C.beforeSanitizeAttributes,k,null);const{attributes:P}=k;if(!P||Si(k))return;const B={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let ce=P.length;for(;ce--;){const we=P[ce],{name:ge,namespaceURI:Ie,value:it}=we,rn=pe(ge),ki=it;let $e=ge==="value"?ki:zy(ki);if(B.attrName=rn,B.attrValue=$e,B.keepAttr=!0,B.forceKeepAttr=void 0,st(C.uponSanitizeAttribute,k,B),$e=B.attrValue,_t&&(rn==="id"||rn==="name")&&(It(ge,k),$e=bi+$e),lt&&ke(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$e)){It(ge,k);continue}if(rn==="attributename"&&ji($e,"href")){It(ge,k);continue}if(B.forceKeepAttr)continue;if(!B.keepAttr){It(ge,k);continue}if(!Le&&ke(/\/>/i,$e)){It(ge,k);continue}Xe&&ws([N,W,V],Br=>{$e=Mn($e,Br," ")});const Ur=pe(k.nodeName);if(!Fr(Ur,rn,$e)){It(ge,k);continue}if(w&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Ie)switch(v.getAttributeType(Ur,rn)){case"TrustedHTML":{$e=w.createHTML($e);break}case"TrustedScriptURL":{$e=w.createScriptURL($e);break}}if($e!==ki)try{Ie?k.setAttributeNS(Ie,ge,$e):k.setAttribute(ge,$e),Si(k)?We(k):tl(t.removed)}catch{It(ge,k)}}st(C.afterSanitizeAttributes,k,null)},_u=function j(k){let P=null;const B=Lr(k);for(st(C.beforeSanitizeShadowDOM,k,null);P=B.nextNode();)st(C.uponSanitizeShadowNode,P,null),Pr(P),Or(P),P.content instanceof o&&j(P.content);st(C.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(j){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=null,B=null,ce=null,we=null;if($i=!j,$i&&(j="<!-->"),typeof j!="string"&&!Dr(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Ln("dirty is not a string, aborting")}else throw Ln("toString is not a function");if(!t.isSupported)return j;if(je||wi(k),t.removed=[],typeof j=="string"&&(ut=!1),ut){if(j.nodeName){const it=pe(j.nodeName);if(!F[it]||ae[it])throw Ln("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof l)P=Mr("<!---->"),B=P.ownerDocument.importNode(j,!0),B.nodeType===Pn.element&&B.nodeName==="BODY"||B.nodeName==="HTML"?P=B:P.appendChild(B);else{if(!et&&!Xe&&!ye&&j.indexOf("<")===-1)return w&&ct?w.createHTML(j):j;if(P=Mr(j),!P)return et?null:ct?L:""}P&&Ze&&We(P.firstChild);const ge=Lr(ut?j:P);for(;ce=ge.nextNode();)Pr(ce),Or(ce),ce.content instanceof o&&_u(ce.content);if(ut)return j;if(et){if(tt)for(we=K.call(P.ownerDocument);P.firstChild;)we.appendChild(P.firstChild);else we=P;return(Y.shadowroot||Y.shadowrootmode)&&(we=b.call(s,we,!0)),we}let Ie=ye?P.outerHTML:P.innerHTML;return ye&&F["!doctype"]&&P.ownerDocument&&P.ownerDocument.doctype&&P.ownerDocument.doctype.name&&ke(Gd,P.ownerDocument.doctype.name)&&(Ie="<!DOCTYPE "+P.ownerDocument.doctype.name+`>
|
|
5331
|
-
`+Ie),Xe&&
|
|
5332
|
-
]`).replace("lheading",Yd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},
|
|
5330
|
+
`}const Wn=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Wn(s,t);return!0},qs=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},Kd=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),jy(t)}};function Hy(e){this._$AN!==void 0?(qs(this),this._$AM=e,Kd(this)):this._$AM=e}function zy(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 o=n;o<s.length;o++)Wn(s[o],!1),qs(s[o]);else s!=null&&(Wn(s,!1),qs(s));else Wn(this,e)}const jy=e=>{e.type==lr.CHILD&&(e._$AP??=zy,e._$AQ??=Hy)};class Ky extends dr{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),Kd(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Wn(this,t),qs(this))}setValue(t){if(Uv(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 Hi=new WeakMap,Wy=cr(class extends Ky{render(e){return h}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)),h}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Hi.get(t);n===void 0&&(n=new WeakMap,Hi.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"?Hi.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 $o extends dr{constructor(t){if(super(t),this.it=h,t.type!==lr.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===h||t==null)return this._t=void 0,this.it=t;if(t===wt)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:[]}}}$o.directiveName="unsafeHTML",$o.resultType=1;const xo=cr($o);const{entries:Wd,setPrototypeOf:Za,isFrozen:qy,getPrototypeOf:Gy,getOwnPropertyDescriptor:Vy}=Object;let{freeze:Te,seal:Ue,create:Rs}=Object,{apply:wo,construct:So}=typeof Reflect<"u"&&Reflect;Te||(Te=function(t){return t});Ue||(Ue=function(t){return t});wo||(wo=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;o<s;o++)i[o-2]=arguments[o];return t.apply(n,i)});So||(So=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 xs=Ee(Array.prototype.forEach),Jy=Ee(Array.prototype.lastIndexOf),el=Ee(Array.prototype.pop),Rn=Ee(Array.prototype.push),Qy=Ee(Array.prototype.splice),Ms=Ee(String.prototype.toLowerCase),zi=Ee(String.prototype.toString),ji=Ee(String.prototype.match),Mn=Ee(String.prototype.replace),Yy=Ee(String.prototype.indexOf),Xy=Ee(String.prototype.trim),De=Ee(Object.prototype.hasOwnProperty),ke=Ee(RegExp.prototype.test),Ln=Zy(TypeError);function Ee(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 wo(e,t,s)}}function Zy(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return So(e,n)}}function Q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ms;Za&&Za(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const o=n(i);o!==i&&(qy(t)||(t[s]=o),i=o)}e[i]=!0}return e}function e0(e){for(let t=0;t<e.length;t++)De(e,t)||(e[t]=null);return e}function Ve(e){const t=Rs(null);for(const[n,s]of Wd(e))De(e,n)&&(Array.isArray(s)?t[n]=e0(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Ve(s):t[n]=s);return t}function Dn(e,t){for(;e!==null;){const s=Vy(e,t);if(s){if(s.get)return Ee(s.get);if(typeof s.value=="function")return Ee(s.value)}e=Gy(e)}function n(){return null}return n}const tl=Te(["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"]),Ki=Te(["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"]),Wi=Te(["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"]),t0=Te(["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"]),qi=Te(["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"]),n0=Te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),nl=Te(["#text"]),sl=Te(["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"]),Gi=Te(["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"]),il=Te(["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"]),ws=Te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),s0=Ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),i0=Ue(/<%[\w\W]*|[\w\W]*%>/gm),o0=Ue(/\$\{[\w\W]*/gm),r0=Ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),a0=Ue(/^aria-[\-\w]+$/),qd=Ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),l0=Ue(/^(?:\w+script|data):/i),c0=Ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Gd=Ue(/^html$/i),d0=Ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var ol=Object.freeze({__proto__:null,ARIA_ATTR:a0,ATTR_WHITESPACE:c0,CUSTOM_ELEMENT:d0,DATA_ATTR:r0,DOCTYPE_NAME:Gd,ERB_EXPR:i0,IS_ALLOWED_URI:qd,IS_SCRIPT_OR_DATA:l0,MUSTACHE_EXPR:s0,TMPLIT_EXPR:o0});const Pn={element:1,text:3,progressingInstruction:7,comment:8,document:9},u0=function(){return typeof window>"u"?null:window},g0=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 o="dompurify"+(s?"#"+s:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},rl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Vd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:u0();const t=j=>Vd(j);if(t.version="3.3.3",t.removed=[],!e||!e.document||e.document.nodeType!==Pn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:l,Element:a,NodeFilter:d,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:v}=e,m=a.prototype,S=Dn(m,"cloneNode"),T=Dn(m,"remove"),M=Dn(m,"nextSibling"),I=Dn(m,"childNodes"),A=Dn(m,"parentNode");if(typeof r=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let w,L="";const{implementation:E,createNodeIterator:R,createDocumentFragment:K,getElementsByTagName:G}=n,{importNode:b}=s;let C=rl();t.isSupported=typeof Wd=="function"&&typeof A=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:W,TMPLIT_EXPR:V,DATA_ATTR:_,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:q,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:re}=ol;let{IS_ALLOWED_URI:D}=ol,F=null;const J=Q({},[...tl,...Ki,...Wi,...qi,...nl]);let Y=null;const ue=Q({},[...sl,...Gi,...il,...ws]);let ee=Object.seal(Rs(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}})),ae=null,X=null;const z=Object.seal(Rs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,de=!0,be=!1,Le=!0,Xe=!1,lt=!0,ye=!1,je=!1,Ze=!1,et=!1,tt=!1,ct=!1,dt=!0,_t=!1;const bi="user-content-";let tn=!0,ut=!1,Ke={},_e=null;const Tn=Q({},["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 nn=null;const gt=Q({},["audio","video","img","source","image","track"]);let yi=null;const Tr=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ls="http://www.w3.org/1998/Math/MathML",cs="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let sn=nt,$i=!1,xi=null;const ku=Q({},[ls,cs,nt],zi);let ds=Q({},["mi","mo","mn","ms","mtext"]),us=Q({},["annotation-xml"]);const Au=Q({},["title","style","font","a","script"]);let En=null;const Cu=["application/xhtml+xml","text/html"],Tu="text/html";let he=null,on=null;const Eu=n.createElement("form"),Er=function(k){return k instanceof RegExp||k instanceof Function},wi=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(on&&on===k)){if((!k||typeof k!="object")&&(k={}),k=Ve(k),En=Cu.indexOf(k.PARSER_MEDIA_TYPE)===-1?Tu:k.PARSER_MEDIA_TYPE,he=En==="application/xhtml+xml"?zi:Ms,F=De(k,"ALLOWED_TAGS")?Q({},k.ALLOWED_TAGS,he):J,Y=De(k,"ALLOWED_ATTR")?Q({},k.ALLOWED_ATTR,he):ue,xi=De(k,"ALLOWED_NAMESPACES")?Q({},k.ALLOWED_NAMESPACES,zi):ku,yi=De(k,"ADD_URI_SAFE_ATTR")?Q(Ve(Tr),k.ADD_URI_SAFE_ATTR,he):Tr,nn=De(k,"ADD_DATA_URI_TAGS")?Q(Ve(gt),k.ADD_DATA_URI_TAGS,he):gt,_e=De(k,"FORBID_CONTENTS")?Q({},k.FORBID_CONTENTS,he):Tn,ae=De(k,"FORBID_TAGS")?Q({},k.FORBID_TAGS,he):Ve({}),X=De(k,"FORBID_ATTR")?Q({},k.FORBID_ATTR,he):Ve({}),Ke=De(k,"USE_PROFILES")?k.USE_PROFILES:!1,le=k.ALLOW_ARIA_ATTR!==!1,de=k.ALLOW_DATA_ATTR!==!1,be=k.ALLOW_UNKNOWN_PROTOCOLS||!1,Le=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Xe=k.SAFE_FOR_TEMPLATES||!1,lt=k.SAFE_FOR_XML!==!1,ye=k.WHOLE_DOCUMENT||!1,et=k.RETURN_DOM||!1,tt=k.RETURN_DOM_FRAGMENT||!1,ct=k.RETURN_TRUSTED_TYPE||!1,Ze=k.FORCE_BODY||!1,dt=k.SANITIZE_DOM!==!1,_t=k.SANITIZE_NAMED_PROPS||!1,tn=k.KEEP_CONTENT!==!1,ut=k.IN_PLACE||!1,D=k.ALLOWED_URI_REGEXP||qd,sn=k.NAMESPACE||nt,ds=k.MATHML_TEXT_INTEGRATION_POINTS||ds,us=k.HTML_INTEGRATION_POINTS||us,ee=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&Er(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&Er(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Xe&&(de=!1),tt&&(et=!0),Ke&&(F=Q({},nl),Y=Rs(null),Ke.html===!0&&(Q(F,tl),Q(Y,sl)),Ke.svg===!0&&(Q(F,Ki),Q(Y,Gi),Q(Y,ws)),Ke.svgFilters===!0&&(Q(F,Wi),Q(Y,Gi),Q(Y,ws)),Ke.mathMl===!0&&(Q(F,qi),Q(Y,il),Q(Y,ws))),De(k,"ADD_TAGS")||(z.tagCheck=null),De(k,"ADD_ATTR")||(z.attributeCheck=null),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?z.tagCheck=k.ADD_TAGS:(F===J&&(F=Ve(F)),Q(F,k.ADD_TAGS,he))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?z.attributeCheck=k.ADD_ATTR:(Y===ue&&(Y=Ve(Y)),Q(Y,k.ADD_ATTR,he))),k.ADD_URI_SAFE_ATTR&&Q(yi,k.ADD_URI_SAFE_ATTR,he),k.FORBID_CONTENTS&&(_e===Tn&&(_e=Ve(_e)),Q(_e,k.FORBID_CONTENTS,he)),k.ADD_FORBID_CONTENTS&&(_e===Tn&&(_e=Ve(_e)),Q(_e,k.ADD_FORBID_CONTENTS,he)),tn&&(F["#text"]=!0),ye&&Q(F,["html","head","body"]),F.table&&(Q(F,["tbody"]),delete ae.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ln('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ln('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=k.TRUSTED_TYPES_POLICY,L=w.createHTML("")}else w===void 0&&(w=g0(v,i)),w!==null&&typeof L=="string"&&(L=w.createHTML(""));Te&&Te(k),on=k}},_r=Q({},[...Ki,...Wi,...t0]),Ir=Q({},[...qi,...n0]),_u=function(k){let P=A(k);(!P||!P.tagName)&&(P={namespaceURI:sn,tagName:"template"});const B=Ms(k.tagName),ce=Ms(P.tagName);return xi[k.namespaceURI]?k.namespaceURI===cs?P.namespaceURI===nt?B==="svg":P.namespaceURI===ls?B==="svg"&&(ce==="annotation-xml"||ds[ce]):!!_r[B]:k.namespaceURI===ls?P.namespaceURI===nt?B==="math":P.namespaceURI===cs?B==="math"&&us[ce]:!!Ir[B]:k.namespaceURI===nt?P.namespaceURI===cs&&!us[ce]||P.namespaceURI===ls&&!ds[ce]?!1:!Ir[B]&&(Au[B]||!_r[B]):!!(En==="application/xhtml+xml"&&xi[k.namespaceURI]):!1},We=function(k){Rn(t.removed,{element:k});try{A(k).removeChild(k)}catch{T(k)}},It=function(k,P){try{Rn(t.removed,{attribute:P.getAttributeNode(k),from:P})}catch{Rn(t.removed,{attribute:null,from:P})}if(P.removeAttribute(k),k==="is")if(et||tt)try{We(P)}catch{}else try{P.setAttribute(k,"")}catch{}},Rr=function(k){let P=null,B=null;if(Ze)k="<remove></remove>"+k;else{const ge=ji(k,/^[\r\n\t ]+/);B=ge&&ge[0]}En==="application/xhtml+xml"&&sn===nt&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const ce=w?w.createHTML(k):k;if(sn===nt)try{P=new f().parseFromString(ce,En)}catch{}if(!P||!P.documentElement){P=E.createDocument(sn,"template",null);try{P.documentElement.innerHTML=$i?L:ce}catch{}}const we=P.body||P.documentElement;return k&&B&&we.insertBefore(n.createTextNode(B),we.childNodes[0]||null),sn===nt?G.call(P,ye?"html":"body")[0]:ye?P.documentElement:we},Mr=function(k){return R.call(k.ownerDocument||k,k,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Si=function(k){return k instanceof u&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof g)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Lr=function(k){return typeof l=="function"&&k instanceof l};function st(j,k,P){xs(j,B=>{B.call(t,k,P,on)})}const Dr=function(k){let P=null;if(st(C.beforeSanitizeElements,k,null),Si(k))return We(k),!0;const B=he(k.nodeName);if(st(C.uponSanitizeElement,k,{tagName:B,allowedTags:F}),lt&&k.hasChildNodes()&&!Lr(k.firstElementChild)&&ke(/<[/\w!]/g,k.innerHTML)&&ke(/<[/\w!]/g,k.textContent)||k.nodeType===Pn.progressingInstruction||lt&&k.nodeType===Pn.comment&&ke(/<[/\w]/g,k.data))return We(k),!0;if(!(z.tagCheck instanceof Function&&z.tagCheck(B))&&(!F[B]||ae[B])){if(!ae[B]&&Fr(B)&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,B)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(B)))return!1;if(tn&&!_e[B]){const ce=A(k)||k.parentNode,we=I(k)||k.childNodes;if(we&&ce){const ge=we.length;for(let Ie=ge-1;Ie>=0;--Ie){const it=S(we[Ie],!0);it.__removalCount=(k.__removalCount||0)+1,ce.insertBefore(it,M(k))}}}return We(k),!0}return k instanceof a&&!_u(k)||(B==="noscript"||B==="noembed"||B==="noframes")&&ke(/<\/no(script|embed|frames)/i,k.innerHTML)?(We(k),!0):(Xe&&k.nodeType===Pn.text&&(P=k.textContent,xs([N,W,V],ce=>{P=Mn(P,ce," ")}),k.textContent!==P&&(Rn(t.removed,{element:k.cloneNode()}),k.textContent=P)),st(C.afterSanitizeElements,k,null),!1)},Pr=function(k,P,B){if(X[P]||dt&&(P==="id"||P==="name")&&(B in n||B in Eu))return!1;if(!(de&&!X[P]&&ke(_,P))){if(!(le&&ke(O,P))){if(!(z.attributeCheck instanceof Function&&z.attributeCheck(P,k))){if(!Y[P]||X[P]){if(!(Fr(k)&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,k)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(k))&&(ee.attributeNameCheck instanceof RegExp&&ke(ee.attributeNameCheck,P)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(P,k))||P==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,B)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(B))))return!1}else if(!yi[P]){if(!ke(D,Mn(B,oe,""))){if(!((P==="src"||P==="xlink:href"||P==="href")&&k!=="script"&&Yy(B,"data:")===0&&nn[k])){if(!(be&&!ke(q,Mn(B,oe,"")))){if(B)return!1}}}}}}}return!0},Fr=function(k){return k!=="annotation-xml"&&ji(k,re)},Nr=function(k){st(C.beforeSanitizeAttributes,k,null);const{attributes:P}=k;if(!P||Si(k))return;const B={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let ce=P.length;for(;ce--;){const we=P[ce],{name:ge,namespaceURI:Ie,value:it}=we,rn=he(ge),ki=it;let $e=ge==="value"?ki:Xy(ki);if(B.attrName=rn,B.attrValue=$e,B.keepAttr=!0,B.forceKeepAttr=void 0,st(C.uponSanitizeAttribute,k,B),$e=B.attrValue,_t&&(rn==="id"||rn==="name")&&(It(ge,k),$e=bi+$e),lt&&ke(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$e)){It(ge,k);continue}if(rn==="attributename"&&ji($e,"href")){It(ge,k);continue}if(B.forceKeepAttr)continue;if(!B.keepAttr){It(ge,k);continue}if(!Le&&ke(/\/>/i,$e)){It(ge,k);continue}Xe&&xs([N,W,V],Ur=>{$e=Mn($e,Ur," ")});const Or=he(k.nodeName);if(!Pr(Or,rn,$e)){It(ge,k);continue}if(w&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Ie)switch(v.getAttributeType(Or,rn)){case"TrustedHTML":{$e=w.createHTML($e);break}case"TrustedScriptURL":{$e=w.createScriptURL($e);break}}if($e!==ki)try{Ie?k.setAttributeNS(Ie,ge,$e):k.setAttribute(ge,$e),Si(k)?We(k):el(t.removed)}catch{It(ge,k)}}st(C.afterSanitizeAttributes,k,null)},Iu=function j(k){let P=null;const B=Mr(k);for(st(C.beforeSanitizeShadowDOM,k,null);P=B.nextNode();)st(C.uponSanitizeShadowNode,P,null),Dr(P),Nr(P),P.content instanceof o&&j(P.content);st(C.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(j){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=null,B=null,ce=null,we=null;if($i=!j,$i&&(j="<!-->"),typeof j!="string"&&!Lr(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Ln("dirty is not a string, aborting")}else throw Ln("toString is not a function");if(!t.isSupported)return j;if(je||wi(k),t.removed=[],typeof j=="string"&&(ut=!1),ut){if(j.nodeName){const it=he(j.nodeName);if(!F[it]||ae[it])throw Ln("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof l)P=Rr("<!---->"),B=P.ownerDocument.importNode(j,!0),B.nodeType===Pn.element&&B.nodeName==="BODY"||B.nodeName==="HTML"?P=B:P.appendChild(B);else{if(!et&&!Xe&&!ye&&j.indexOf("<")===-1)return w&&ct?w.createHTML(j):j;if(P=Rr(j),!P)return et?null:ct?L:""}P&&Ze&&We(P.firstChild);const ge=Mr(ut?j:P);for(;ce=ge.nextNode();)Dr(ce),Nr(ce),ce.content instanceof o&&Iu(ce.content);if(ut)return j;if(et){if(tt)for(we=K.call(P.ownerDocument);P.firstChild;)we.appendChild(P.firstChild);else we=P;return(Y.shadowroot||Y.shadowrootmode)&&(we=b.call(s,we,!0)),we}let Ie=ye?P.outerHTML:P.innerHTML;return ye&&F["!doctype"]&&P.ownerDocument&&P.ownerDocument.doctype&&P.ownerDocument.doctype.name&&ke(Gd,P.ownerDocument.doctype.name)&&(Ie="<!DOCTYPE "+P.ownerDocument.doctype.name+`>
|
|
5331
|
+
`+Ie),Xe&&xs([N,W,V],it=>{Ie=Mn(Ie,it," ")}),w&&ct?w.createHTML(Ie):Ie},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};wi(j),je=!0},t.clearConfig=function(){on=null,je=!1},t.isValidAttribute=function(j,k,P){on||wi({});const B=he(j),ce=he(k);return Pr(B,ce,P)},t.addHook=function(j,k){typeof k=="function"&&Rn(C[j],k)},t.removeHook=function(j,k){if(k!==void 0){const P=Jy(C[j],k);return P===-1?void 0:Qy(C[j],P,1)[0]}return el(C[j])},t.removeHooks=function(j){C[j]=[]},t.removeAllHooks=function(){C=rl()},t}var ko=Vd();function pr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var en=pr();function Jd(e){en=e}var jt={exec:()=>null};function Z(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(Ce.caret,"$1"),n=n.replace(i,r),s},getRegex:()=>new RegExp(n,t)};return s}var f0=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ce={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,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"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},p0=/^(?:[ \t]*(?:\n|$))+/,h0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,m0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,as=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,v0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Qd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yd=Z(Qd).replace(/bull/g,hr).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(),b0=Z(Qd).replace(/bull/g,hr).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(),mr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,y0=/^[^\n]+/,vr=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$0=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",vr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),x0=Z(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,hr).getRegex(),hi="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",br=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,w0=Z("^ {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",br).replace("tag",hi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xd=Z(mr).replace("hr",as).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hi).getRegex(),S0=Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Xd).getRegex(),yr={blockquote:S0,code:h0,def:$0,fences:m0,heading:v0,hr:as,html:w0,lheading:Yd,list:x0,newline:p0,paragraph:Xd,table:jt,text:y0},al=Z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",as).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hi).getRegex(),k0={...yr,lheading:b0,table:al,paragraph:Z(mr).replace("hr",as).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",al).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hi).getRegex()},A0={...yr,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",br).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:Z(mr).replace("hr",as).replace("heading",` *#{1,6} *[^
|
|
5332
|
+
]`).replace("lheading",Yd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},C0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,T0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Zd=/^( {2,}|\\)\n(?!\s*$)/,E0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,mi=/[\p{P}\p{S}]/u,$r=/[\s\p{P}\p{S}]/u,eu=/[^\s\p{P}\p{S}]/u,_0=Z(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,$r).getRegex(),tu=/(?!~)[\p{P}\p{S}]/u,I0=/(?!~)[\s\p{P}\p{S}]/u,R0=/(?:[^\s\p{P}\p{S}]|~)/u,nu=/(?![*_])[\p{P}\p{S}]/u,M0=/(?![*_])[\s\p{P}\p{S}]/u,L0=/(?:[^\s\p{P}\p{S}]|[*_])/u,D0=Z(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",f0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),su=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,P0=Z(su,"u").replace(/punct/g,mi).getRegex(),F0=Z(su,"u").replace(/punct/g,tu).getRegex(),iu="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",N0=Z(iu,"gu").replace(/notPunctSpace/g,eu).replace(/punctSpace/g,$r).replace(/punct/g,mi).getRegex(),O0=Z(iu,"gu").replace(/notPunctSpace/g,R0).replace(/punctSpace/g,I0).replace(/punct/g,tu).getRegex(),U0=Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,eu).replace(/punctSpace/g,$r).replace(/punct/g,mi).getRegex(),B0=Z(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,nu).getRegex(),H0="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",z0=Z(H0,"gu").replace(/notPunctSpace/g,L0).replace(/punctSpace/g,M0).replace(/punct/g,nu).getRegex(),j0=Z(/\\(punct)/,"gu").replace(/punct/g,mi).getRegex(),K0=Z(/^<(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(),W0=Z(br).replace("(?:-->|$)","-->").getRegex(),q0=Z("^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",W0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gs=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,G0=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Gs).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ou=Z(/^!?\[(label)\]\[(ref)\]/).replace("label",Gs).replace("ref",vr).getRegex(),ru=Z(/^!?\[(ref)\](?:\[\])?/).replace("ref",vr).getRegex(),V0=Z("reflink|nolink(?!\\()","g").replace("reflink",ou).replace("nolink",ru).getRegex(),ll=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,xr={_backpedal:jt,anyPunctuation:j0,autolink:K0,blockSkip:D0,br:Zd,code:T0,del:jt,delLDelim:jt,delRDelim:jt,emStrongLDelim:P0,emStrongRDelimAst:N0,emStrongRDelimUnd:U0,escape:C0,link:G0,nolink:ru,punctuation:_0,reflink:ou,reflinkSearch:V0,tag:q0,text:E0,url:jt},J0={...xr,link:Z(/^!?\[(label)\]\((.*?)\)/).replace("label",Gs).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Gs).getRegex()},Ao={...xr,emStrongRDelimAst:O0,emStrongLDelim:F0,delLDelim:B0,delRDelim:z0,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ll).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:Z(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ll).getRegex()},Q0={...Ao,br:Z(Zd).replace("{2,}","*").getRegex(),text:Z(Ao.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ss={normal:yr,gfm:k0,pedantic:A0},Fn={normal:xr,gfm:Ao,breaks:Q0,pedantic:J0},Y0={"&":"&","<":"<",">":">",'"':""","'":"'"},cl=e=>Y0[e];function Je(e,t){if(t){if(Ce.escapeTest.test(e))return e.replace(Ce.escapeReplace,cl)}else if(Ce.escapeTestNoEncode.test(e))return e.replace(Ce.escapeReplaceNoEncode,cl);return e}function dl(e){try{e=encodeURI(e).replace(Ce.percentDecode,"%")}catch{return null}return e}function ul(e,t){let n=e.replace(Ce.findPipe,(o,r,l)=>{let a=!1,d=r;for(;--d>=0&&l[d]==="\\";)a=!a;return a?"|":" |"}),s=n.split(Ce.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(Ce.slashPipe,"|");return s}function Nn(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 X0(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 Z0(e,t=0){let n=t,s="";for(let i of e)if(i===" "){let o=4-n%4;s+=" ".repeat(o),n+=o}else s+=i,n++;return s}function gl(e,t,n,s,i){let o=t.href,r=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:r,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,a}function e$(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
|
|
5333
5333
|
`).map(o=>{let r=o.match(n.other.beginningSpace);if(r===null)return o;let[l]=r;return l.length>=i.length?o.slice(i.length):o}).join(`
|
|
5334
|
-
`)}var
|
|
5335
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=
|
|
5334
|
+
`)}var Vs=class{options;rules;lexer;constructor(e){this.options=e||en}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:Nn(n,`
|
|
5335
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=e$(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=Nn(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:Nn(t[0],`
|
|
5336
5336
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Nn(t[0],`
|
|
5337
5337
|
`).split(`
|
|
5338
5338
|
`),s="",i="",o=[];for(;n.length>0;){let r=!1,l=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))l.push(n[a]),r=!0;else if(!r)l.push(n[a]);else break;n=n.slice(a);let d=l.join(`
|
|
@@ -5344,16 +5344,16 @@ ${g}`:g;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
5344
5344
|
`),S=this.blockquote(m);o[o.length-1]=S,s=s.substring(0,s.length-v.raw.length)+S.raw,i=i.substring(0,i.length-v.text.length)+S.text;break}else if(f?.type==="list"){let v=f,m=v.raw+`
|
|
5345
5345
|
`+n.join(`
|
|
5346
5346
|
`),S=this.list(m);o[o.length-1]=S,s=s.substring(0,s.length-f.raw.length)+S.raw,i=i.substring(0,i.length-v.raw.length)+S.raw,n=m.substring(o.at(-1).raw.length).split(`
|
|
5347
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:o,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let o=this.rules.other.listItemRegex(n),r=!1;for(;e;){let a=!1,d="",g="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let u=
|
|
5347
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:o,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let o=this.rules.other.listItemRegex(n),r=!1;for(;e;){let a=!1,d="",g="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let u=Z0(t[2].split(`
|
|
5348
5348
|
`,1)[0],t[1].length),f=e.split(`
|
|
5349
5349
|
`,1)[0],v=!u.trim(),m=0;if(this.options.pedantic?(m=2,g=u.trimStart()):v?m=t[1].length+1:(m=u.search(this.rules.other.nonSpaceChar),m=m>4?1:m,g=u.slice(m),m+=t[1].length),v&&this.rules.other.blankLine.test(f)&&(d+=f+`
|
|
5350
5350
|
`,e=e.substring(f.length+1),a=!0),!a){let S=this.rules.other.nextBulletRegex(m),T=this.rules.other.hrRegex(m),M=this.rules.other.fencesBeginRegex(m),I=this.rules.other.headingBeginRegex(m),A=this.rules.other.htmlBeginRegex(m),w=this.rules.other.blockquoteBeginRegex(m);for(;e;){let L=e.split(`
|
|
5351
5351
|
`,1)[0],E;if(f=L,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),E=f):E=f.replace(this.rules.other.tabCharGlobal," "),M.test(f)||I.test(f)||A.test(f)||w.test(f)||S.test(f)||T.test(f))break;if(E.search(this.rules.other.nonSpaceChar)>=m||!f.trim())g+=`
|
|
5352
5352
|
`+E.slice(m);else{if(v||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(u)||I.test(u)||T.test(u))break;g+=`
|
|
5353
5353
|
`+f}v=!f.trim(),d+=L+`
|
|
5354
|
-
`,e=e.substring(L.length+1),u=E.slice(m)}}i.loose||(r?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(r=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),i.raw+=d}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 a of i.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.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 d=this.rules.other.listTaskCheckbox.exec(a.raw);if(d){let g={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};a.checked=g.checked,i.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=g.raw+a.tokens[0].raw,a.tokens[0].text=g.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(g)):a.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):a.tokens.unshift(g)}}if(!i.loose){let d=a.tokens.filter(u=>u.type==="space"),g=d.length>0&&d.some(u=>this.rules.other.anyLine.test(u.raw));i.loose=g}}if(i.loose)for(let a of i.items){a.loose=!0;for(let d of a.tokens)d.type==="text"&&(d.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=
|
|
5355
|
-
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let r of s)this.rules.other.tableAlignRight.test(r)?o.align.push("right"):this.rules.other.tableAlignCenter.test(r)?o.align.push("center"):this.rules.other.tableAlignLeft.test(r)?o.align.push("left"):o.align.push(null);for(let r=0;r<n.length;r++)o.header.push({text:n[r],tokens:this.lexer.inline(n[r]),header:!0,align:o.align[r]});for(let r of i)o.rows.push(
|
|
5356
|
-
`?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 o=Nn(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=
|
|
5354
|
+
`,e=e.substring(L.length+1),u=E.slice(m)}}i.loose||(r?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(r=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),i.raw+=d}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 a of i.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.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 d=this.rules.other.listTaskCheckbox.exec(a.raw);if(d){let g={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};a.checked=g.checked,i.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=g.raw+a.tokens[0].raw,a.tokens[0].text=g.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(g)):a.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):a.tokens.unshift(g)}}if(!i.loose){let d=a.tokens.filter(u=>u.type==="space"),g=d.length>0&&d.some(u=>this.rules.other.anyLine.test(u.raw));i.loose=g}}if(i.loose)for(let a of i.items){a.loose=!0;for(let d of a.tokens)d.type==="text"&&(d.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=ul(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
5355
|
+
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let r of s)this.rules.other.tableAlignRight.test(r)?o.align.push("right"):this.rules.other.tableAlignCenter.test(r)?o.align.push("center"):this.rules.other.tableAlignLeft.test(r)?o.align.push("left"):o.align.push(null);for(let r=0;r<n.length;r++)o.header.push({text:n[r],tokens:this.lexer.inline(n[r]),header:!0,align:o.align[r]});for(let r of i)o.rows.push(ul(r,o.header.length).map((l,a)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[a]})));return o}}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)===`
|
|
5356
|
+
`?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 o=Nn(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=X0(t[2],"()");if(o===-2)return;if(o>-1){let r=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],i=o[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)),gl(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 o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return gl(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,o,r,l=i,a=0,d=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(s=d.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){l+=r;continue}else if((s[5]||s[6])&&i%3&&!((i+r)%3)){a+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+a);let g=[...s[0]][0].length,u=e.slice(0,i+s.index+g+r);if(Math.min(i,r)%2){let v=u.slice(1,-1);return{type:"em",raw:u,text:v,tokens:this.lexer.inlineTokens(v)}}let f=u.slice(2,-2);return{type:"strong",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}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,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,o,r,l=i,a=this.rules.inline.delRDelim;for(a.lastIndex=0,t=t.slice(-1*e.length+i);(s=a.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o||(r=[...o].length,r!==i))continue;if(s[3]||s[4]){l+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l);let d=[...s[0]][0].length,g=e.slice(0,i+s.index+d+r),u=g.slice(i,-i);return{type:"del",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}}}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}}}},He=class Co{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||en,this.options.tokenizer=this.options.tokenizer||new Vs,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:Ce,block:Ss.normal,inline:Fn.normal};this.options.pedantic?(n.block=Ss.pedantic,n.inline=Fn.pedantic):this.options.gfm&&(n.block=Ss.gfm,this.options.breaks?n.inline=Fn.breaks:n.inline=Fn.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ss,inline:Fn}}static lex(t,n){return new Co(n).lex(t)}static lexInline(t,n){return new Co(n).inlineTokens(t)}lex(t){t=t.replace(Ce.carriageReturn,`
|
|
5357
5357
|
`),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(Ce.tabCharGlobal," ").replace(Ce.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(r=>(i=r.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 r=n.at(-1);i.raw.length===1&&r!==void 0?r.raw+=`
|
|
5358
5358
|
`:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let r=n.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(`
|
|
5359
5359
|
`)?"":`
|
|
@@ -5367,7 +5367,7 @@ ${g}`:g;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
5367
5367
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):n.push(i),s=o.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let r=n.at(-1);r?.type==="text"?(r.raw+=(r.raw.endsWith(`
|
|
5368
5368
|
`)?"":`
|
|
5369
5369
|
`)+i.raw,r.text+=`
|
|
5370
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):n.push(i);continue}if(t){let r="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}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 a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.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 o;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)o=i[2]?i[2].length:0,s=s.slice(0,i.index+o)+"["+"a".repeat(i[0].length-o-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,l="";for(;t;){r||(l=""),r=!1;let a;if(this.options.extensions?.inline?.some(g=>(a=g.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.escape(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.tag(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.link(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(a.raw.length);let g=n.at(-1);a.type==="text"&&g?.type==="text"?(g.raw+=a.raw,g.text+=a.text):n.push(a);continue}if(a=this.tokenizer.emStrong(t,s,l)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.codespan(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.br(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.del(t,s,l)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.autolink(t)){t=t.substring(a.raw.length),n.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(t))){t=t.substring(a.raw.length),n.push(a);continue}let d=t;if(this.options.extensions?.startInline){let g=1/0,u=t.slice(1),f;this.options.extensions.startInline.forEach(v=>{f=v.call({lexer:this},u),typeof f=="number"&&f>=0&&(g=Math.min(g,f))}),g<1/0&&g>=0&&(d=t.substring(0,g+1))}if(a=this.tokenizer.inlineText(d)){t=t.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(l=a.raw.slice(-1)),r=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=a.raw,g.text+=a.text):n.push(a);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}},
|
|
5370
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):n.push(i);continue}if(t){let r="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}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 a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.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 o;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)o=i[2]?i[2].length:0,s=s.slice(0,i.index+o)+"["+"a".repeat(i[0].length-o-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,l="";for(;t;){r||(l=""),r=!1;let a;if(this.options.extensions?.inline?.some(g=>(a=g.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.escape(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.tag(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.link(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(a.raw.length);let g=n.at(-1);a.type==="text"&&g?.type==="text"?(g.raw+=a.raw,g.text+=a.text):n.push(a);continue}if(a=this.tokenizer.emStrong(t,s,l)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.codespan(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.br(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.del(t,s,l)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.autolink(t)){t=t.substring(a.raw.length),n.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(t))){t=t.substring(a.raw.length),n.push(a);continue}let d=t;if(this.options.extensions?.startInline){let g=1/0,u=t.slice(1),f;this.options.extensions.startInline.forEach(v=>{f=v.call({lexer:this},u),typeof f=="number"&&f>=0&&(g=Math.min(g,f))}),g<1/0&&g>=0&&(d=t.substring(0,g+1))}if(a=this.tokenizer.inlineText(d)){t=t.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(l=a.raw.slice(-1)),r=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=a.raw,g.text+=a.text):n.push(a);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}},Js=class{options;parser;constructor(e){this.options=e||en}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(Ce.notSpaceStart)?.[0],i=e.replace(Ce.endingNewline,"")+`
|
|
5371
5371
|
`;return s?'<pre><code class="language-'+Je(s)+'">'+(n?i:Je(i,!0))+`</code></pre>
|
|
5372
5372
|
`:"<pre><code>"+(n?i:Je(i,!0))+`</code></pre>
|
|
5373
5373
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
@@ -5385,32 +5385,32 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
5385
5385
|
`}tablerow({text:e}){return`<tr>
|
|
5386
5386
|
${e}</tr>
|
|
5387
5387
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
5388
|
-
`}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=
|
|
5389
|
-
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}}},Qt=new
|
|
5388
|
+
`}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=dl(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+Je(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=dl(e);if(i===null)return Je(n);e=i;let o=`<img src="${e}" alt="${Je(n)}"`;return t&&(o+=` title="${Je(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Je(e.text)}},wr=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}},ze=class To{options;renderer;textRenderer;constructor(t){this.options=t||en,this.options.renderer=this.options.renderer||new Js,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new wr}static parse(t,n){return new To(n).parse(t)}static parseInline(t,n){return new To(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 r=i,l=this.options.extensions.renderers[r.type].call({parser:this},r);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(r.type)){n+=l||"";continue}}let o=i;switch(o.type){case"space":{n+=this.renderer.space(o);break}case"hr":{n+=this.renderer.hr(o);break}case"heading":{n+=this.renderer.heading(o);break}case"code":{n+=this.renderer.code(o);break}case"table":{n+=this.renderer.table(o);break}case"blockquote":{n+=this.renderer.blockquote(o);break}case"list":{n+=this.renderer.list(o);break}case"checkbox":{n+=this.renderer.checkbox(o);break}case"html":{n+=this.renderer.html(o);break}case"def":{n+=this.renderer.def(o);break}case"paragraph":{n+=this.renderer.paragraph(o);break}case"text":{n+=this.renderer.text(o);break}default:{let r='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let o=t[i];if(this.options.extensions?.renderers?.[o.type]){let l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){s+=l||"";continue}}let r=o;switch(r.type){case"escape":{s+=n.text(r);break}case"html":{s+=n.html(r);break}case"link":{s+=n.link(r);break}case"image":{s+=n.image(r);break}case"checkbox":{s+=n.checkbox(r);break}case"strong":{s+=n.strong(r);break}case"em":{s+=n.em(r);break}case"codespan":{s+=n.codespan(r);break}case"br":{s+=n.br(r);break}case"del":{s+=n.del(r);break}case"text":{s+=n.text(r);break}default:{let l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},Un=class{options;block;constructor(e){this.options=e||en}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?He.lex:He.lexInline}provideParser(){return this.block?ze.parse:ze.parseInline}},t$=class{defaults=pr();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ze;Renderer=Js;TextRenderer=wr;Lexer=He;Tokenizer=Vs;Hooks=Un;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 o of i.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of i.rows)for(let r of o)n=n.concat(this.walkTokens(r.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(o=>{let r=i[o].flat(1/0);n=n.concat(this.walkTokens(r,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 o=t.renderers[i.name];o?t.renderers[i.name]=function(...r){let l=i.renderer.apply(this,r);return l===!1&&(l=o.apply(this,r)),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 o=t[i.level];o?o.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 Js(this.defaults);for(let o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let r=o,l=n.renderer[r],a=i[r];i[r]=(...d)=>{let g=l.apply(i,d);return g===!1&&(g=a.apply(i,d)),g||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Vs(this.defaults);for(let o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let r=o,l=n.tokenizer[r],a=i[r];i[r]=(...d)=>{let g=l.apply(i,d);return g===!1&&(g=a.apply(i,d)),g}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Un;for(let o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let r=o,l=n.hooks[r],a=i[r];Un.passThroughHooks.has(o)?i[r]=d=>{if(this.defaults.async&&Un.passThroughHooksRespectAsync.has(o))return(async()=>{let u=await l.call(i,d);return a.call(i,u)})();let g=l.call(i,d);return a.call(i,g)}:i[r]=(...d)=>{if(this.defaults.async)return(async()=>{let u=await l.apply(i,d);return u===!1&&(u=await a.apply(i,d)),u})();let g=l.apply(i,d);return g===!1&&(g=a.apply(i,d)),g}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,o=n.walkTokens;s.walkTokens=function(r){let l=[];return l.push(o.call(this,r)),i&&(l=l.concat(i.call(this,r))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return He.lex(e,t??this.defaults)}parser(e,t){return ze.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(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 o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(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 r=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?He.lex:He.lexInline)(r,i),a=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser():e?ze.parse:ze.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let r=(i.hooks?i.hooks.provideLexer():e?He.lex:He.lexInline)(t,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?ze.parse:ze.parseInline)(r,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(r){return o(r)}}}onError(e,t){return n=>{if(n.message+=`
|
|
5389
|
+
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}}},Qt=new t$;function te(e,t){return Qt.parse(e,t)}te.options=te.setOptions=function(e){return Qt.setOptions(e),te.defaults=Qt.defaults,Jd(te.defaults),te};te.getDefaults=pr;te.defaults=en;te.use=function(...e){return Qt.use(...e),te.defaults=Qt.defaults,Jd(te.defaults),te};te.walkTokens=function(e,t){return Qt.walkTokens(e,t)};te.parseInline=Qt.parseInline;te.Parser=ze;te.parser=ze.parse;te.Renderer=Js;te.TextRenderer=wr;te.Lexer=He;te.lexer=He.lex;te.Tokenizer=Vs;te.Hooks=Un;te.parse=te;te.options;te.setOptions;te.use;te.walkTokens;te.parseInline;ze.parse;He.lex;const n$=["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","img"],s$=["class","href","rel","target","title","start","src","alt"],fl={ALLOWED_TAGS:n$,ALLOWED_ATTR:s$,ADD_DATA_URI_TAGS:["img"]};let pl=!1;const i$=14e4,o$=4e4,r$=200,Vi=5e4,Wt=new Map;function a$(e){const t=Wt.get(e);return t===void 0?null:(Wt.delete(e),Wt.set(e,t),t)}function hl(e,t){if(Wt.set(e,t),Wt.size<=r$)return;const n=Wt.keys().next().value;n&&Wt.delete(n)}function l$(){pl||(pl=!0,ko.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function Eo(e){const t=e.trim();if(!t)return"";if(l$(),t.length<=Vi){const r=a$(t);if(r!==null)return r}const n=fc(t,i$),s=n.truncated?`
|
|
5390
5390
|
|
|
5391
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>
|
|
5391
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>o$){const l=`<pre class="code-block">${lu(`${n.text}${s}`)}</pre>`,a=ko.sanitize(l,fl);return t.length<=Vi&&hl(t,a),a}const i=te.parse(`${n.text}${s}`,{renderer:au,gfm:!0,breaks:!0}),o=ko.sanitize(i,fl);return t.length<=Vi&&hl(t,o),o}const au=new te.Renderer;au.html=({text:e})=>lu(e);function lu(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Ls="data:",c$=new Set(["http:","https:","blob:"]),d$=new Set(["image/svg+xml"]);function u$(e){if(!e.toLowerCase().startsWith(Ls))return!1;const t=e.indexOf(",");if(t<Ls.length)return!1;const s=e.slice(Ls.length,t).split(";")[0]?.trim().toLowerCase()??"";return s.startsWith("image/")?!d$.has(s):!1}function g$(e,t,n={}){const s=e.trim();if(!s)return null;if(n.allowDataImage===!0&&u$(s))return s;if(s.toLowerCase().startsWith(Ls))return null;try{const i=new URL(s,t);return c$.has(i.protocol.toLowerCase())?i.toString():null}catch{return null}}function cu(e,t={}){const n=t.baseHref??window.location.href,s=g$(e,n,t);if(!s)return null;const i=window.open(s,"_blank","noopener,noreferrer");return i&&(i.opener=null),i}const f$=new RegExp("\\p{Script=Hebrew}|\\p{Script=Arabic}|\\p{Script=Syriac}|\\p{Script=Thaana}|\\p{Script=Nko}|\\p{Script=Samaritan}|\\p{Script=Mandaic}|\\p{Script=Adlam}|\\p{Script=Phoenician}|\\p{Script=Lydian}","u");function du(e,t=/[\s\p{P}\p{S}]/u){if(!e)return"ltr";for(const n of e)if(!t.test(n))return f$.test(n)?"rtl":"ltr";return"ltr"}const p$=1500,h$=2e3,uu="Copy as markdown",m$="Copied",v$="Copy failed";async function b$(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function ks(e,t){e.title=t,e.setAttribute("aria-label",t)}function y$(e){const t=e.label??uu;return c`
|
|
5392
5392
|
<button
|
|
5393
5393
|
class="chat-copy-btn"
|
|
5394
5394
|
type="button"
|
|
5395
5395
|
title=${t}
|
|
5396
5396
|
aria-label=${t}
|
|
5397
|
-
@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
|
|
5397
|
+
@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 b$(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",ks(s,v$),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,ks(s,t))},h$);return}s.dataset.copied="1",ks(s,m$),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,ks(s,t))},p$)}}}
|
|
5398
5398
|
>
|
|
5399
5399
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
5400
|
-
<span class="chat-copy-btn__icon-copy">${
|
|
5401
|
-
<span class="chat-copy-btn__icon-check">${
|
|
5400
|
+
<span class="chat-copy-btn__icon-copy">${pe.copy}</span>
|
|
5401
|
+
<span class="chat-copy-btn__icon-check">${pe.check}</span>
|
|
5402
5402
|
</span>
|
|
5403
5403
|
</button>
|
|
5404
|
-
`}function u$(e){return d$({text:()=>e,label:du})}function uu(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,o=Array.isArray(i)?i:null,r=Array.isArray(o)&&o.some(u=>{const f=u,v=(typeof f.type=="string"?f.type:"").toLowerCase();return v==="toolresult"||v==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||r||l)&&(n="toolResult");let a=[];typeof t.content=="string"?a=[{type:"text",text:t.content}]:Array.isArray(t.content)?a=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(a=[{type:"text",text:t.text}]);const d=typeof t.timestamp=="number"?t.timestamp:Date.now(),g=typeof t.id=="string"?t.id:void 0;return(n==="user"||n==="User")&&(a=a.map(u=>u.type==="text"&&typeof u.text=="string"?{...u,text:id(u.text)}:u)),{role:n,content:a,timestamp:d,id:g}}function kr(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 gu(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const g$={emoji:"🧩",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},f$={bash:{emoji:"🛠️",title:"Bash",detailKeys:["command"]},process:{emoji:"🧰",title:"Process",detailKeys:["sessionId"]},read:{emoji:"📖",title:"Read",detailKeys:["path"]},write:{emoji:"✍️",title:"Write",detailKeys:["path"]},edit:{emoji:"📝",title:"Edit",detailKeys:["path"]},attach:{emoji:"📎",title:"Attach",detailKeys:["path","url","fileName"]},browser:{emoji:"🌐",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:{emoji:"🖼️",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:{emoji:"📱",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:{emoji:"⏰",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:{emoji:"🔌",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]}}},whatsapp_login:{emoji:"🟢",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{emoji:"💬",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"]}}}},p$={fallback:g$,tools:f$};function An(e){return e&&typeof e=="object"?e:void 0}function h$(e){return(e??"tool").trim()}function m$(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 v$(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function b$(e){if(!e||typeof e!="object")return;const t=e.action;return typeof t!="string"?void 0:t.trim()||void 0}function y$(e){return N$({toolKey:e.toolKey,args:e.args,meta:e.meta,action:b$(e.args),spec:e.spec,fallbackDetailKeys:e.fallbackDetailKeys,detailMode:e.detailMode,detailCoerce:e.detailCoerce,detailMaxEntries:e.detailMaxEntries,detailFormatKey:e.detailFormatKey})}function Io(e,t={}){const n=t.maxStringChars??160,s=t.maxArrayEntries??3;if(e!=null){if(typeof e=="string"){const i=e.trim();if(!i)return;const o=i.split(/\r?\n/)[0]?.trim()??"";return o?o.length>n?`${o.slice(0,Math.max(0,n-3))}…`:o:void 0}if(typeof e=="boolean")return!e&&!t.includeFalse?void 0:e?"true":"false";if(typeof e=="number")return Number.isFinite(e)?e===0&&!t.includeZero?void 0:String(e):t.includeNonFinite?String(e):void 0;if(Array.isArray(e)){const i=e.map(r=>Io(r,t)).filter(r=>!!r);if(i.length===0)return;const o=i.slice(0,s).join(", ");return i.length>s?`${o}…`:o}}}function vl(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 fu(e){const t=An(e);if(t)for(const n of[t.path,t.file_path,t.filePath]){if(typeof n!="string")continue;const s=n.trim();if(s)return s}}function $$(e){const t=An(e);if(!t)return;const n=fu(t);if(!n)return;const s=typeof t.offset=="number"&&Number.isFinite(t.offset)?Math.floor(t.offset):void 0,i=typeof t.limit=="number"&&Number.isFinite(t.limit)?Math.floor(t.limit):void 0,o=s!==void 0?Math.max(1,s):void 0,r=i!==void 0?Math.max(1,i):void 0;return o!==void 0&&r!==void 0?`${r===1?"line":"lines"} ${o}-${o+r-1} from ${n}`:o!==void 0?`from line ${o} in ${n}`:r!==void 0?`first ${r} ${r===1?"line":"lines"} of ${n}`:`from ${n}`}function x$(e,t){const n=An(t);if(!n)return;const s=fu(n)??(typeof n.url=="string"?n.url.trim():void 0);if(!s)return;if(e==="attach")return`from ${s}`;const i=e==="edit"?"in":"to",o=typeof n.content=="string"?n.content:typeof n.newText=="string"?n.newText:typeof n.new_string=="string"?n.new_string:void 0;return o&&o.length>0?`${i} ${s} (${o.length} chars)`:`${i} ${s}`}function w$(e){const t=An(e);if(!t)return;const n=typeof t.query=="string"?t.query.trim():void 0,s=typeof t.count=="number"&&Number.isFinite(t.count)&&t.count>0?Math.floor(t.count):void 0;if(n)return s!==void 0?`for "${n}" (top ${s})`:`for "${n}"`}function S$(e){const t=An(e);if(!t)return;const n=typeof t.url=="string"?t.url.trim():void 0;if(!n)return;const s=typeof t.extractMode=="string"?t.extractMode.trim():void 0,i=typeof t.maxChars=="number"&&Number.isFinite(t.maxChars)&&t.maxChars>0?Math.floor(t.maxChars):void 0,o=[s?`mode ${s}`:void 0,i!==void 0?`max ${i} chars`:void 0].filter(r=>!!r).join(", ");return o?`from ${n} (${o})`:`from ${n}`}function Ar(e){if(!e)return e;const t=e.trim();return t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))?t.slice(1,-1).trim():t}function qt(e,t=48){if(!e)return[];const n=[];let s="",i,o=!1;for(let r=0;r<e.length;r+=1){const l=e[r];if(o){s+=l,o=!1;continue}if(l==="\\"){o=!0;continue}if(i){l===i?i=void 0:s+=l;continue}if(l==='"'||l==="'"){i=l;continue}if(/\s/.test(l)){if(!s)continue;if(n.push(s),n.length>=t)return n;s="";continue}s+=l}return s&&n.push(s),n}function Cn(e){if(!e)return;const t=Ar(e)??e;return(t.split(/[/]/).at(-1)??t).trim().toLowerCase()}function Pt(e,t){const n=new Set(t);for(let s=0;s<e.length;s+=1){const i=e[s];if(i){if(n.has(i)){const o=e[s+1];if(o&&!o.startsWith("-"))return o;continue}for(const o of t)if(o.startsWith("--")&&i.startsWith(`${o}=`))return i.slice(o.length+1)}}}function gn(e,t=1,n=[]){const s=[],i=new Set(n);for(let o=t;o<e.length;o+=1){const r=e[o];if(r){if(r==="--"){for(let l=o+1;l<e.length;l+=1){const a=e[l];a&&s.push(a)}break}if(r.startsWith("--")){if(r.includes("="))continue;i.has(r)&&(o+=1);continue}if(r.startsWith("-")){i.has(r)&&(o+=1);continue}s.push(r)}}return s}function rt(e,t=1,n=[]){return gn(e,t,n)[0]}function Ji(e){if(e.length===0)return e;let t=0;if(Cn(e[0])==="env"){for(t=1;t<e.length;){const n=e[t];if(!n)break;if(n.startsWith("-")){t+=1;continue}if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(n)){t+=1;continue}break}return e.slice(t)}for(;t<e.length&&/^[A-Za-z_][A-Za-z0-9_]*=/.test(e[t]);)t+=1;return e.slice(t)}function k$(e){const t=qt(e,10);if(t.length<3)return e;const n=Cn(t[0]);if(!(n==="bash"||n==="sh"||n==="zsh"||n==="fish"))return e;const s=t.findIndex((o,r)=>r>0&&(o==="-c"||o==="-lc"||o==="-ic"));if(s===-1)return e;const i=t.slice(s+1).join(" ").trim();return i?Ar(i)??e:e}function Cr(e,t){let n,s=!1;for(let i=0;i<e.length;i+=1){const o=e[i];if(s){s=!1;continue}if(o==="\\"){s=!0;continue}if(n){o===n&&(n=void 0);continue}if(o==='"'||o==="'"){n=o;continue}if(t(o,i)===!1)return}}function A$(e){const t=[];let n=0;return Cr(e,(s,i)=>s===";"?(t.push(e.slice(n,i)),n=i+1,!0):((s==="&"||s==="|")&&e[i+1]===s&&(t.push(e.slice(n,i)),n=i+2),!0)),t.push(e.slice(n)),t.map(s=>s.trim()).filter(s=>s.length>0)}function C$(e){const t=[];let n=0;return Cr(e,(s,i)=>(s==="|"&&e[i-1]!=="|"&&e[i+1]!=="|"&&(t.push(e.slice(n,i)),n=i+1),!0)),t.push(e.slice(n)),t.map(s=>s.trim()).filter(s=>s.length>0)}function T$(e){const t=qt(e,3),n=Cn(t[0]);if(n==="cd"||n==="pushd")return t[1]||void 0}function E$(e){const t=Cn(qt(e,2)[0]);return t==="cd"||t==="pushd"||t==="popd"}function _$(e){return Cn(qt(e,2)[0])==="popd"}function I$(e){let t=e.trim(),n;for(let s=0;s<4;s+=1){let i;Cr(t,(a,d)=>{if(a==="&"&&t[d+1]==="&")return i={index:d,length:2},!1;if(a==="|"&&t[d+1]==="|")return i={index:d,length:2,isOr:!0},!1;if(a===";"||a===`
|
|
5405
|
-
`)return i={index:d,length:1},!1});const o=(i?t.slice(0,i.index):t).trim(),r=(i?!i.isOr:s>0)&&
|
|
5404
|
+
`}function $$(e){return y$({text:()=>e,label:uu})}function gu(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,o=Array.isArray(i)?i:null,r=Array.isArray(o)&&o.some(u=>{const f=u,v=(typeof f.type=="string"?f.type:"").toLowerCase();return v==="toolresult"||v==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||r||l)&&(n="toolResult");let a=[];typeof t.content=="string"?a=[{type:"text",text:t.content}]:Array.isArray(t.content)?a=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(a=[{type:"text",text:t.text}]);const d=typeof t.timestamp=="number"?t.timestamp:Date.now(),g=typeof t.id=="string"?t.id:void 0;return(n==="user"||n==="User")&&(a=a.map(u=>u.type==="text"&&typeof u.text=="string"?{...u,text:sd(u.text)}:u)),{role:n,content:a,timestamp:d,id:g}}function Sr(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 fu(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const x$={emoji:"🧩",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},w$={bash:{emoji:"🛠️",title:"Bash",detailKeys:["command"]},process:{emoji:"🧰",title:"Process",detailKeys:["sessionId"]},read:{emoji:"📖",title:"Read",detailKeys:["path"]},write:{emoji:"✍️",title:"Write",detailKeys:["path"]},edit:{emoji:"📝",title:"Edit",detailKeys:["path"]},attach:{emoji:"📎",title:"Attach",detailKeys:["path","url","fileName"]},browser:{emoji:"🌐",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:{emoji:"🖼️",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:{emoji:"📱",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:{emoji:"⏰",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:{emoji:"🔌",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]}}},whatsapp_login:{emoji:"🟢",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{emoji:"💬",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"]}}}},S$={fallback:x$,tools:w$};function An(e){return e&&typeof e=="object"?e:void 0}function k$(e){return(e??"tool").trim()}function A$(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 C$(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function T$(e){if(!e||typeof e!="object")return;const t=e.action;return typeof t!="string"?void 0:t.trim()||void 0}function E$(e){return q$({toolKey:e.toolKey,args:e.args,meta:e.meta,action:T$(e.args),spec:e.spec,fallbackDetailKeys:e.fallbackDetailKeys,detailMode:e.detailMode,detailCoerce:e.detailCoerce,detailMaxEntries:e.detailMaxEntries,detailFormatKey:e.detailFormatKey})}function _o(e,t={}){const n=t.maxStringChars??160,s=t.maxArrayEntries??3;if(e!=null){if(typeof e=="string"){const i=e.trim();if(!i)return;const o=i.split(/\r?\n/)[0]?.trim()??"";return o?o.length>n?`${o.slice(0,Math.max(0,n-3))}…`:o:void 0}if(typeof e=="boolean")return!e&&!t.includeFalse?void 0:e?"true":"false";if(typeof e=="number")return Number.isFinite(e)?e===0&&!t.includeZero?void 0:String(e):t.includeNonFinite?String(e):void 0;if(Array.isArray(e)){const i=e.map(r=>_o(r,t)).filter(r=>!!r);if(i.length===0)return;const o=i.slice(0,s).join(", ");return i.length>s?`${o}…`:o}}}function ml(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 pu(e){const t=An(e);if(t)for(const n of[t.path,t.file_path,t.filePath]){if(typeof n!="string")continue;const s=n.trim();if(s)return s}}function _$(e){const t=An(e);if(!t)return;const n=pu(t);if(!n)return;const s=typeof t.offset=="number"&&Number.isFinite(t.offset)?Math.floor(t.offset):void 0,i=typeof t.limit=="number"&&Number.isFinite(t.limit)?Math.floor(t.limit):void 0,o=s!==void 0?Math.max(1,s):void 0,r=i!==void 0?Math.max(1,i):void 0;return o!==void 0&&r!==void 0?`${r===1?"line":"lines"} ${o}-${o+r-1} from ${n}`:o!==void 0?`from line ${o} in ${n}`:r!==void 0?`first ${r} ${r===1?"line":"lines"} of ${n}`:`from ${n}`}function I$(e,t){const n=An(t);if(!n)return;const s=pu(n)??(typeof n.url=="string"?n.url.trim():void 0);if(!s)return;if(e==="attach")return`from ${s}`;const i=e==="edit"?"in":"to",o=typeof n.content=="string"?n.content:typeof n.newText=="string"?n.newText:typeof n.new_string=="string"?n.new_string:void 0;return o&&o.length>0?`${i} ${s} (${o.length} chars)`:`${i} ${s}`}function R$(e){const t=An(e);if(!t)return;const n=typeof t.query=="string"?t.query.trim():void 0,s=typeof t.count=="number"&&Number.isFinite(t.count)&&t.count>0?Math.floor(t.count):void 0;if(n)return s!==void 0?`for "${n}" (top ${s})`:`for "${n}"`}function M$(e){const t=An(e);if(!t)return;const n=typeof t.url=="string"?t.url.trim():void 0;if(!n)return;const s=typeof t.extractMode=="string"?t.extractMode.trim():void 0,i=typeof t.maxChars=="number"&&Number.isFinite(t.maxChars)&&t.maxChars>0?Math.floor(t.maxChars):void 0,o=[s?`mode ${s}`:void 0,i!==void 0?`max ${i} chars`:void 0].filter(r=>!!r).join(", ");return o?`from ${n} (${o})`:`from ${n}`}function kr(e){if(!e)return e;const t=e.trim();return t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))?t.slice(1,-1).trim():t}function qt(e,t=48){if(!e)return[];const n=[];let s="",i,o=!1;for(let r=0;r<e.length;r+=1){const l=e[r];if(o){s+=l,o=!1;continue}if(l==="\\"){o=!0;continue}if(i){l===i?i=void 0:s+=l;continue}if(l==='"'||l==="'"){i=l;continue}if(/\s/.test(l)){if(!s)continue;if(n.push(s),n.length>=t)return n;s="";continue}s+=l}return s&&n.push(s),n}function Cn(e){if(!e)return;const t=kr(e)??e;return(t.split(/[/]/).at(-1)??t).trim().toLowerCase()}function Pt(e,t){const n=new Set(t);for(let s=0;s<e.length;s+=1){const i=e[s];if(i){if(n.has(i)){const o=e[s+1];if(o&&!o.startsWith("-"))return o;continue}for(const o of t)if(o.startsWith("--")&&i.startsWith(`${o}=`))return i.slice(o.length+1)}}}function gn(e,t=1,n=[]){const s=[],i=new Set(n);for(let o=t;o<e.length;o+=1){const r=e[o];if(r){if(r==="--"){for(let l=o+1;l<e.length;l+=1){const a=e[l];a&&s.push(a)}break}if(r.startsWith("--")){if(r.includes("="))continue;i.has(r)&&(o+=1);continue}if(r.startsWith("-")){i.has(r)&&(o+=1);continue}s.push(r)}}return s}function rt(e,t=1,n=[]){return gn(e,t,n)[0]}function Ji(e){if(e.length===0)return e;let t=0;if(Cn(e[0])==="env"){for(t=1;t<e.length;){const n=e[t];if(!n)break;if(n.startsWith("-")){t+=1;continue}if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(n)){t+=1;continue}break}return e.slice(t)}for(;t<e.length&&/^[A-Za-z_][A-Za-z0-9_]*=/.test(e[t]);)t+=1;return e.slice(t)}function L$(e){const t=qt(e,10);if(t.length<3)return e;const n=Cn(t[0]);if(!(n==="bash"||n==="sh"||n==="zsh"||n==="fish"))return e;const s=t.findIndex((o,r)=>r>0&&(o==="-c"||o==="-lc"||o==="-ic"));if(s===-1)return e;const i=t.slice(s+1).join(" ").trim();return i?kr(i)??e:e}function Ar(e,t){let n,s=!1;for(let i=0;i<e.length;i+=1){const o=e[i];if(s){s=!1;continue}if(o==="\\"){s=!0;continue}if(n){o===n&&(n=void 0);continue}if(o==='"'||o==="'"){n=o;continue}if(t(o,i)===!1)return}}function D$(e){const t=[];let n=0;return Ar(e,(s,i)=>s===";"?(t.push(e.slice(n,i)),n=i+1,!0):((s==="&"||s==="|")&&e[i+1]===s&&(t.push(e.slice(n,i)),n=i+2),!0)),t.push(e.slice(n)),t.map(s=>s.trim()).filter(s=>s.length>0)}function P$(e){const t=[];let n=0;return Ar(e,(s,i)=>(s==="|"&&e[i-1]!=="|"&&e[i+1]!=="|"&&(t.push(e.slice(n,i)),n=i+1),!0)),t.push(e.slice(n)),t.map(s=>s.trim()).filter(s=>s.length>0)}function F$(e){const t=qt(e,3),n=Cn(t[0]);if(n==="cd"||n==="pushd")return t[1]||void 0}function N$(e){const t=Cn(qt(e,2)[0]);return t==="cd"||t==="pushd"||t==="popd"}function O$(e){return Cn(qt(e,2)[0])==="popd"}function U$(e){let t=e.trim(),n;for(let s=0;s<4;s+=1){let i;Ar(t,(a,d)=>{if(a==="&"&&t[d+1]==="&")return i={index:d,length:2},!1;if(a==="|"&&t[d+1]==="|")return i={index:d,length:2,isOr:!0},!1;if(a===";"||a===`
|
|
5405
|
+
`)return i={index:d,length:1},!1});const o=(i?t.slice(0,i.index):t).trim(),r=(i?!i.isOr:s>0)&&N$(o);if(!(o.startsWith("set ")||o.startsWith("export ")||o.startsWith("unset ")||r)||(r&&(O$(o)?n=void 0:n=F$(o)??n),t=i?t.slice(i.index+i.length).trimStart():"",!t))break}return{command:t.trim(),chdirPath:n}}function Qi(e){if(e.length===0)return"run command";const t=Cn(e[0])??"command";if(t==="git"){const s=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--config-env"]),i=Pt(e,["-C"]);let o;for(let l=1;l<e.length;l+=1){const a=e[l];if(a){if(a==="--"){o=rt(e,l+1);break}if(a.startsWith("--")){if(a.includes("="))continue;s.has(a)&&(l+=1);continue}if(a.startsWith("-")){s.has(a)&&(l+=1);continue}o=a;break}}const r={status:"check git status",diff:"check git diff",log:"view git history",show:"show git object",branch:"list git branches",checkout:"switch git branch",switch:"switch git branch",commit:"create git commit",pull:"pull git changes",push:"push git changes",fetch:"fetch git changes",merge:"merge git changes",rebase:"rebase git branch",add:"stage git changes",restore:"restore git files",reset:"reset git state",stash:"stash git changes"};return o&&r[o]?r[o]:!o||o.startsWith("/")||o.startsWith("~")||o.includes("/")?i?`run git command in ${i}`:"run git command":`run git ${o}`}if(t==="grep"||t==="rg"||t==="ripgrep"){const s=gn(e,1,["-e","--regexp","-f","--file","-m","--max-count","-A","--after-context","-B","--before-context","-C","--context"]),i=Pt(e,["-e","--regexp"])??s[0],o=s.length>1?s.at(-1):void 0;return i?o?`search "${i}" in ${o}`:`search "${i}"`:"search text"}if(t==="find"){const s=e[1]&&!e[1].startsWith("-")?e[1]:".",i=Pt(e,["-name","-iname"]);return i?`find files named "${i}" in ${s}`:`find files in ${s}`}if(t==="ls"){const s=rt(e,1);return s?`list files in ${s}`:"list files"}if(t==="head"||t==="tail"){const s=Pt(e,["-n","--lines"])??e.slice(1).find(a=>/^-\d+$/.test(a))?.slice(1),i=gn(e,1,["-n","--lines"]);let o=i.at(-1);o&&/^\d+$/.test(o)&&i.length===1&&(o=void 0);const r=t==="head"?"first":"last",l=s==="1"?"line":"lines";return s&&o?`show ${r} ${s} ${l} of ${o}`:s?`show ${r} ${s} ${l}`:o?`show ${o}`:`show ${t} output`}if(t==="cat"){const s=rt(e,1);return s?`show ${s}`:"show output"}if(t==="sed"){const s=Pt(e,["-e","--expression"]),i=gn(e,1,["-e","--expression","-f","--file"]),o=s??i[0],r=s?i[0]:i[1];if(o){const l=(kr(o)??o).replace(/\s+/g,""),a=l.match(/^([0-9]+),([0-9]+)p$/);if(a)return r?`print lines ${a[1]}-${a[2]} from ${r}`:`print lines ${a[1]}-${a[2]}`;const d=l.match(/^([0-9]+)p$/);if(d)return r?`print line ${d[1]} from ${r}`:`print line ${d[1]}`}return r?`run sed on ${r}`:"run sed transform"}if(t==="printf"||t==="echo")return"print text";if(t==="cp"||t==="mv"){const s=gn(e,1,["-t","--target-directory","-S","--suffix"]),i=s[0],o=s[1],r=t==="cp"?"copy":"move";return i&&o?`${r} ${i} to ${o}`:i?`${r} ${i}`:`${r} files`}if(t==="rm"){const s=rt(e,1);return s?`remove ${s}`:"remove files"}if(t==="mkdir"){const s=rt(e,1);return s?`create folder ${s}`:"create folder"}if(t==="touch"){const s=rt(e,1);return s?`create file ${s}`:"create file"}if(t==="curl"||t==="wget"){const s=e.find(i=>/^https?:\/\//i.test(i));return s?`fetch ${s}`:"fetch url"}if(t==="npm"||t==="pnpm"||t==="yarn"||t==="bun"){const s=gn(e,1,["--prefix","-C","--cwd","--config"]),i=s[0]??"command";return{install:"install dependencies",test:"run tests",build:"run build",start:"start app",lint:"run lint",run:s[1]?`run ${s[1]}`:"run script"}[i]??`run ${t} ${i}`}if(t==="node"||t==="python"||t==="python3"||t==="ruby"||t==="php"){if(e.slice(1).find(a=>a.startsWith("<<")))return`run ${t} inline script (heredoc)`;if((t==="node"?Pt(e,["-e","--eval"]):t==="python"||t==="python3"?Pt(e,["-c"]):void 0)!==void 0)return`run ${t} inline script`;const l=rt(e,1,t==="node"?["-e","--eval","-m"]:["-c","-e","--eval","-m"]);return l?t==="node"?`${e.includes("--check")||e.includes("-c")?"check js syntax for":"run node script"} ${l}`:`run ${t} ${l}`:`run ${t}`}if(t==="openclaw"){const s=rt(e,1);return s?`run openclaw ${s}`:"run openclaw"}const n=rt(e,1);return!n||n.length>48?`run ${t}`:/^[A-Za-z0-9._/-]+$/.test(n)?`run ${t} ${n}`:`run ${t}`}function B$(e){const t=P$(e);if(t.length>1){const n=Qi(Ji(qt(t[0]))),s=Qi(Ji(qt(t[t.length-1]))),i=t.length>2?` (+${t.length-2} steps)`:"";return`${n} -> ${s}${i}`}return Qi(Ji(qt(e)))}function vl(e){const{command:t,chdirPath:n}=U$(e);if(!t)return n?{text:"",chdirPath:n}:void 0;const s=D$(t);if(s.length===0)return;const i=s.map(l=>B$(l)),o=i.length===1?i[0]:i.join(" → "),r=i.every(l=>hu(l));return{text:o,chdirPath:n,allGeneric:r}}const H$=["check git","view git","show git","list git","switch git","create git","pull git","push git","fetch git","merge git","rebase git","stage git","restore git","reset git","stash git","search ","find files","list files","show first","show last","print line","print text","copy ","move ","remove ","create folder","create file","fetch http","install dependencies","run tests","run build","start app","run lint","run openclaw","run node script","run node ","run python","run ruby","run php","run sed","run git ","run npm ","run pnpm ","run yarn ","run bun ","check js syntax"];function hu(e){return e==="run command"?!0:e.startsWith("run ")?!H$.some(t=>e.startsWith(t)):!1}function z$(e,t=120){const n=e.replace(/\s*\n\s*/g," ").replace(/\s{2,}/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function j$(e){const t=An(e);if(!t)return;const n=typeof t.command=="string"?t.command.trim():void 0;if(!n)return;const s=L$(n),i=vl(s)??vl(n),o=i?.text||"run command",l=(typeof t.workdir=="string"?t.workdir:typeof t.cwd=="string"?t.cwd:void 0)?.trim()||i?.chdirPath||void 0,a=z$(s);if(i?.allGeneric!==!1&&hu(o))return l?`${a} (in ${l})`:a;const d=l?`${o} (in ${l})`:o;return a&&a!==d&&a!==o?`${d}
|
|
5406
5406
|
|
|
5407
|
-
\`${a}\``:d}function
|
|
5408
|
-
`),n=t.slice(0,
|
|
5409
|
-
`);return s.length
|
|
5407
|
+
\`${a}\``:d}function K$(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function W$(e,t,n){if(n.mode==="first"){for(const r of t){const l=ml(e,r),a=_o(l,n.coerce);if(a)return a}return}const s=[];for(const r of t){const l=ml(e,r),a=_o(l,n.coerce);a&&s.push({label:n.formatKey?n.formatKey(r):r,value:a})}if(s.length===0)return;if(s.length===1)return s[0].value;const i=new Set,o=[];for(const r of s){const l=`${r.label}:${r.value}`;i.has(l)||(i.add(l),o.push(r))}if(o.length!==0)return o.slice(0,n.maxEntries??8).map(r=>`${r.label} ${r.value}`).join(" · ")}function q$(e){const t=K$(e.spec,e.action),n=e.toolKey==="web_search"?"search":e.toolKey==="web_fetch"?"fetch":e.toolKey.replace(/_/g," ").replace(/\./g," "),s=C$(t?.label??e.action??n);let i;e.toolKey==="exec"&&(i=j$(e.args)),!i&&e.toolKey==="read"&&(i=_$(e.args)),!i&&(e.toolKey==="write"||e.toolKey==="edit"||e.toolKey==="attach")&&(i=I$(e.toolKey,e.args)),!i&&e.toolKey==="web_search"&&(i=R$(e.args)),!i&&e.toolKey==="web_fetch"&&(i=M$(e.args));const o=t?.detailKeys??e.spec?.detailKeys??e.fallbackDetailKeys??[];return!i&&o.length>0&&(i=W$(e.args,o,{mode:e.detailMode,coerce:e.detailCoerce,maxEntries:e.detailMaxEntries,formatKey:e.detailFormatKey})),!i&&e.meta&&(i=e.meta),{verb:s,detail:i}}function G$(e,t={}){if(!e)return;const n=e.includes(" · ")?e.split(" · ").map(s=>s.trim()).filter(s=>s.length>0).join(", "):e;if(n)return t.prefixWithWith?`with ${n}`:n}const V$={"🧩":"puzzle","🛠️":"wrench","🧰":"wrench","📖":"fileText","✍️":"edit","📝":"penLine","📎":"paperclip","🌐":"globe","📺":"monitor","🧾":"fileText","🔐":"settings","💻":"monitor","🔌":"plug","💬":"messageSquare"},J$={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"}}};function Q$(e){return e?V$[e]??"puzzle":"puzzle"}function mu(e){return{icon:Q$(e?.emoji),title:e?.title,label:e?.label,detailKeys:e?.detailKeys,actions:e?.actions}}const vu=S$,bl=mu(vu.fallback??{emoji:"🧩"}),bu=Object.fromEntries(Object.entries(vu.tools??{}).map(([e,t])=>[e,mu(t)]));bu.slack=J$;function Y$(e){if(!e)return e;const t=[{re:/^\/Users\/[^/]+(\/|$)/,replacement:"~$1"},{re:/^\/home\/[^/]+(\/|$)/,replacement:"~$1"},{re:/^C:\\Users\\[^\\]+(\\|$)/i,replacement:"~$1"}];for(const n of t)if(n.re.test(e))return e.replace(n.re,n.replacement);return e}function X$(e){const t=k$(e.name),n=t.toLowerCase(),s=bu[n],i=s?.icon??bl.icon??"puzzle",o=s?.title??A$(t),r=s?.label??o;let{verb:l,detail:a}=E$({toolKey:n,args:e.args,meta:e.meta,spec:s,fallbackDetailKeys:bl.detailKeys,detailMode:"first",detailCoerce:{includeFalse:!0,includeZero:!0}});return a&&(a=Y$(a)),{name:t,icon:i,title:o,label:r,verb:l,detail:a}}function Z$(e){return G$(e.detail,{prefixWithWith:!0})}const ex=80,tx=2,yl=100;function nx(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 sx(e){const t=e.split(`
|
|
5408
|
+
`),n=t.slice(0,tx),s=n.join(`
|
|
5409
|
+
`);return s.length>yl?s.slice(0,yl)+"…":n.length<t.length?s+"…":s}function ix(e){const t=e,n=ox(t.content),s=[];for(const i of n){const o=(typeof i.type=="string"?i.type:"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(o)||typeof i.name=="string"&&i.arguments!=null)&&s.push({kind:"call",name:i.name??"tool",args:rx(i.arguments??i.args)})}for(const i of n){const o=(typeof i.type=="string"?i.type:"").toLowerCase();if(o!=="toolresult"&&o!=="tool_result")continue;const r=ax(i),l=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:l,text:r})}if(fu(e)&&!s.some(i=>i.kind==="result")){const i=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",o=id(e)??void 0;s.push({kind:"result",name:i,text:o})}return s}function $l(e,t){const n=X$({name:e.name,args:e.args}),s=Z$(n),i=!!e.text?.trim(),o=!!t,r=o?()=>{if(i){t(nx(e.text));return}const u=`## ${n.label}
|
|
5410
5410
|
|
|
5411
5411
|
${s?`**Command:** \`${s}\`
|
|
5412
5412
|
|
|
5413
|
-
`:""}*No output — tool completed successfully.*`;t(u)}:void 0,l=i&&(e.text?.length??0)<=
|
|
5413
|
+
`:""}*No output — tool completed successfully.*`;t(u)}:void 0,l=i&&(e.text?.length??0)<=ex,a=i&&!l,d=i&&l,g=!i;return c`
|
|
5414
5414
|
<div
|
|
5415
5415
|
class="chat-tool-card ${o?"chat-tool-card--clickable":""}"
|
|
5416
5416
|
@click=${r}
|
|
@@ -5420,22 +5420,22 @@ ${s?`**Command:** \`${s}\`
|
|
|
5420
5420
|
>
|
|
5421
5421
|
<div class="chat-tool-card__header">
|
|
5422
5422
|
<div class="chat-tool-card__title">
|
|
5423
|
-
<span class="chat-tool-card__icon">${
|
|
5423
|
+
<span class="chat-tool-card__icon">${pe[n.icon]}</span>
|
|
5424
5424
|
<span>${n.label}</span>
|
|
5425
5425
|
</div>
|
|
5426
|
-
${o?c`<span class="chat-tool-card__action">${i?"View":""} ${
|
|
5427
|
-
${g&&!o?c`<span class="chat-tool-card__status">${
|
|
5426
|
+
${o?c`<span class="chat-tool-card__action">${i?"View":""} ${pe.check}</span>`:h}
|
|
5427
|
+
${g&&!o?c`<span class="chat-tool-card__status">${pe.check}</span>`:h}
|
|
5428
5428
|
</div>
|
|
5429
5429
|
${s?c`<div class="chat-tool-card__detail">${s}</div>`:h}
|
|
5430
5430
|
${g?c`
|
|
5431
5431
|
<div class="chat-tool-card__status-text muted">Completed</div>
|
|
5432
5432
|
`:h}
|
|
5433
|
-
${a?c`<div class="chat-tool-card__preview mono">${
|
|
5433
|
+
${a?c`<div class="chat-tool-card__preview mono">${sx(e.text)}</div>`:h}
|
|
5434
5434
|
${d?c`<div class="chat-tool-card__inline mono">${e.text}</div>`:h}
|
|
5435
5435
|
</div>
|
|
5436
|
-
`}function
|
|
5436
|
+
`}function ox(e){return Array.isArray(e)?e.filter(Boolean):[]}function rx(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 ax(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function lx(e){const n=e.content,s=[];if(Array.isArray(n))for(const i of n){if(typeof i!="object"||i===null)continue;const o=i;if(o.type==="image"){const r=o.source;if(r?.type==="base64"&&typeof r.data=="string"){const l=r.data,a=r.media_type||"image/png",d=l.startsWith("data:")?l:`data:${a};base64,${l}`;s.push({url:d})}else typeof o.url=="string"&&s.push({url:o.url})}else if(o.type==="image_url"){const r=o.image_url;typeof r?.url=="string"&&s.push({url:r.url})}}return s}function cx(e){return c`
|
|
5437
5437
|
<div class="chat-group assistant">
|
|
5438
|
-
${
|
|
5438
|
+
${Cr("assistant",e)}
|
|
5439
5439
|
<div class="chat-group-messages">
|
|
5440
5440
|
<div class="chat-bubble chat-reading-indicator" aria-hidden="true">
|
|
5441
5441
|
<span class="chat-reading-indicator__dots">
|
|
@@ -5444,33 +5444,33 @@ ${s?`**Command:** \`${s}\`
|
|
|
5444
5444
|
</div>
|
|
5445
5445
|
</div>
|
|
5446
5446
|
</div>
|
|
5447
|
-
`}function
|
|
5447
|
+
`}function dx(e,t,n,s){const i=new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),o=s?.name??"Assistant";return c`
|
|
5448
5448
|
<div class="chat-group assistant">
|
|
5449
|
-
${
|
|
5449
|
+
${Cr("assistant",s)}
|
|
5450
5450
|
<div class="chat-group-messages">
|
|
5451
|
-
${
|
|
5451
|
+
${yu({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!0,showReasoning:!1},n)}
|
|
5452
5452
|
<div class="chat-group-footer">
|
|
5453
5453
|
<span class="chat-sender-name">${o}</span>
|
|
5454
5454
|
<span class="chat-group-timestamp">${i}</span>
|
|
5455
5455
|
</div>
|
|
5456
5456
|
</div>
|
|
5457
5457
|
</div>
|
|
5458
|
-
`}function
|
|
5458
|
+
`}function ux(e,t){const n=Sr(e.role),s=t.assistantName??"Assistant",i=n==="user"?"You":n==="assistant"?s:n,o=n==="user"?"user":n==="assistant"?"assistant":"other",r=new Date(e.timestamp).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return c`
|
|
5459
5459
|
<div class="chat-group ${o}">
|
|
5460
|
-
${
|
|
5460
|
+
${Cr(e.role,{name:s,avatar:t.assistantAvatar??null})}
|
|
5461
5461
|
<div class="chat-group-messages">
|
|
5462
|
-
${e.messages.map((l,a)=>
|
|
5462
|
+
${e.messages.map((l,a)=>yu(l.message,{isStreaming:e.isStreaming&&a===e.messages.length-1,showReasoning:t.showReasoning},t.onOpenSidebar))}
|
|
5463
5463
|
<div class="chat-group-footer">
|
|
5464
5464
|
<span class="chat-sender-name">${i}</span>
|
|
5465
5465
|
<span class="chat-group-timestamp">${r}</span>
|
|
5466
5466
|
</div>
|
|
5467
5467
|
</div>
|
|
5468
5468
|
</div>
|
|
5469
|
-
`}function
|
|
5469
|
+
`}function Cr(e,t){const n=Sr(e),s=t?.name?.trim()||"Assistant",i=t?.avatar?.trim()||"",o=n==="user"?"U":n==="assistant"?s.charAt(0).toUpperCase()||"A":n==="tool"?"⚙":"?",r=n==="user"?"user":n==="assistant"?"assistant":n==="tool"?"tool":"other";return i&&n==="assistant"?gx(i)?c`<img
|
|
5470
5470
|
class="chat-avatar ${r}"
|
|
5471
5471
|
src="${i}"
|
|
5472
5472
|
alt="${s}"
|
|
5473
|
-
/>`:c`<div class="chat-avatar ${r}">${i}</div>`:c`<div class="chat-avatar ${r}">${o}</div>`}function
|
|
5473
|
+
/>`:c`<div class="chat-avatar ${r}">${i}</div>`:c`<div class="chat-avatar ${r}">${o}</div>`}function gx(e){return/^https?:\/\//i.test(e)||/^data:image\//i.test(e)||e.startsWith("/")}function fx(e){if(e.length===0)return h;const t=n=>{cu(n,{allowDataImage:!0})};return c`
|
|
5474
5474
|
<div class="chat-message-images">
|
|
5475
5475
|
${e.map(n=>c`
|
|
5476
5476
|
<img
|
|
@@ -5481,20 +5481,20 @@ ${s?`**Command:** \`${s}\`
|
|
|
5481
5481
|
/>
|
|
5482
5482
|
`)}
|
|
5483
5483
|
</div>
|
|
5484
|
-
`}function
|
|
5484
|
+
`}function yu(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",o=fu(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",r=ix(e),l=r.length>0,a=lx(e),d=a.length>0,g=id(e),u=t.showReasoning&&i==="assistant"?Lh(e):null,f=g?.trim()?g:null,v=u?Dh(u):null,m=f,S=i==="assistant"&&!!m?.trim(),T=["chat-bubble",S?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!m&&l&&o?c`${r.map(M=>$l(M,n))}`:!m&&!l&&!d?h:c`
|
|
5485
5485
|
<div class="${T}">
|
|
5486
|
-
${S
|
|
5487
|
-
${
|
|
5488
|
-
${v?c`<div class="chat-thinking">${
|
|
5489
|
-
${m?c`<div class="chat-text" dir="${
|
|
5490
|
-
${r.map(M
|
|
5486
|
+
${S?$$(m):h}
|
|
5487
|
+
${fx(a)}
|
|
5488
|
+
${v?c`<div class="chat-thinking">${xo(Eo(v))}</div>`:h}
|
|
5489
|
+
${m?c`<div class="chat-text" dir="${du(m)}">${xo(Eo(m))}</div>`:h}
|
|
5490
|
+
${r.map(M=>$l(M,n))}
|
|
5491
5491
|
</div>
|
|
5492
|
-
`}function
|
|
5492
|
+
`}function px(e){return c`
|
|
5493
5493
|
<div class="sidebar-panel">
|
|
5494
5494
|
<div class="sidebar-header">
|
|
5495
5495
|
<div class="sidebar-title">Tool Output</div>
|
|
5496
5496
|
<button @click=${e.onClose} class="btn" title="Close sidebar">
|
|
5497
|
-
${
|
|
5497
|
+
${pe.x}
|
|
5498
5498
|
</button>
|
|
5499
5499
|
</div>
|
|
5500
5500
|
<div class="sidebar-content">
|
|
@@ -5503,12 +5503,12 @@ ${s?`**Command:** \`${s}\`
|
|
|
5503
5503
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
5504
5504
|
View Raw Text
|
|
5505
5505
|
</button>
|
|
5506
|
-
`:e.content?c`<div class="sidebar-markdown">${
|
|
5506
|
+
`:e.content?c`<div class="sidebar-markdown">${xo(Eo(e.content))}</div>`:c`
|
|
5507
5507
|
<div class="muted">No content available</div>
|
|
5508
5508
|
`}
|
|
5509
5509
|
</div>
|
|
5510
5510
|
</div>
|
|
5511
|
-
`}var
|
|
5511
|
+
`}var hx=Object.defineProperty,mx=Object.getOwnPropertyDescriptor,vi=(e,t,n,s)=>{for(var i=s>1?void 0:s?mx(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(i=(s?r(t,n,i):r(i))||i);return s&&i&&hx(t,n,i),i};let Sn=class extends mn{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 o=this.startRatio+i;o=Math.max(this.minRatio,Math.min(this.maxRatio,o)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:o},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 h}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)}};Sn.styles=Mu`
|
|
5512
5512
|
:host {
|
|
5513
5513
|
width: 4px;
|
|
5514
5514
|
cursor: col-resize;
|
|
@@ -5531,15 +5531,15 @@ ${s?`**Command:** \`${s}\`
|
|
|
5531
5531
|
:host(.dragging) {
|
|
5532
5532
|
background: var(--accent, #007bff);
|
|
5533
5533
|
}
|
|
5534
|
-
`;vi([
|
|
5534
|
+
`;vi([Zs({type:Number})],Sn.prototype,"splitRatio",2);vi([Zs({type:Number})],Sn.prototype,"minRatio",2);vi([Zs({type:Number})],Sn.prototype,"maxRatio",2);Sn=vi([Vl("resizable-divider")],Sn);const vx=5e3,bx=8e3;function xl(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function yx(e){return e?e.active?c`
|
|
5535
5535
|
<div class="compaction-indicator compaction-indicator--active" role="status" aria-live="polite">
|
|
5536
|
-
${
|
|
5536
|
+
${pe.loader} Compacting context...
|
|
5537
5537
|
</div>
|
|
5538
|
-
`:e.completedAt&&Date.now()-e.completedAt<
|
|
5538
|
+
`:e.completedAt&&Date.now()-e.completedAt<vx?c`
|
|
5539
5539
|
<div class="compaction-indicator compaction-indicator--complete" role="status" aria-live="polite">
|
|
5540
|
-
${
|
|
5540
|
+
${pe.check} Context compacted
|
|
5541
5541
|
</div>
|
|
5542
|
-
`:h:h}function
|
|
5542
|
+
`:h:h}function $x(e){if(!e)return h;const t=e.phase??"active";if(Date.now()-e.occurredAt>=bx)return h;const s=[`Selected: ${e.selected}`,t==="cleared"?`Active: ${e.selected}`:`Active: ${e.active}`,t==="cleared"&&e.previous?`Previous fallback: ${e.previous}`:null,e.reason?`Reason: ${e.reason}`:null,e.attempts.length>0?`Attempts: ${e.attempts.slice(0,3).join(" | ")}`:null].filter(Boolean).join(" • "),i=t==="cleared"?`Fallback cleared: ${e.selected}`:`Fallback active: ${e.active}`,o=t==="cleared"?"compaction-indicator compaction-indicator--fallback-cleared":"compaction-indicator compaction-indicator--fallback",r=t==="cleared"?pe.check:pe.brain;return c`
|
|
5543
5543
|
<div
|
|
5544
5544
|
class=${o}
|
|
5545
5545
|
role="status"
|
|
@@ -5548,7 +5548,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
5548
5548
|
>
|
|
5549
5549
|
${r} ${i}
|
|
5550
5550
|
</div>
|
|
5551
|
-
`}function
|
|
5551
|
+
`}function xx(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function wx(e,t){const n=e.clipboardData?.items;if(!n||!t.onAttachmentsChange)return;const s=[];for(let i=0;i<n.length;i++){const o=n[i];o.type.startsWith("image/")&&s.push(o)}if(s.length!==0){e.preventDefault();for(const i of s){const o=i.getAsFile();if(!o)continue;const r=new FileReader;r.addEventListener("load",()=>{const l=r.result,a={id:xx(),dataUrl:l,mimeType:o.type},d=t.attachments??[];t.onAttachmentsChange?.([...d,a])}),r.readAsDataURL(o)}}}function Sx(e){const t=e.attachments??[];return t.length===0?h:c`
|
|
5552
5552
|
<div class="chat-attachments">
|
|
5553
5553
|
${t.map(n=>c`
|
|
5554
5554
|
<div class="chat-attachment">
|
|
@@ -5563,18 +5563,62 @@ ${s?`**Command:** \`${s}\`
|
|
|
5563
5563
|
aria-label="Remove attachment"
|
|
5564
5564
|
@click=${()=>{const s=(e.attachments??[]).filter(i=>i.id!==n.id);e.onAttachmentsChange?.(s)}}
|
|
5565
5565
|
>
|
|
5566
|
-
${
|
|
5566
|
+
${pe.x}
|
|
5567
5567
|
</button>
|
|
5568
5568
|
</div>
|
|
5569
5569
|
`)}
|
|
5570
5570
|
</div>
|
|
5571
|
-
`}function
|
|
5571
|
+
`}function kx(e){const t=e.connected?"Start a conversation":"Gateway offline",n=e.connected?"Send a message below to start a new BitSeek Claw chat.":"Reconnect the gateway, then send a message to start chatting.";return c`
|
|
5572
5572
|
<div class="chat-empty" role="status" aria-live="polite">
|
|
5573
5573
|
<img class="chat-empty__icon" src=${e.brandAvatarUrl} alt="BitSeek Claw" />
|
|
5574
5574
|
<div class="chat-empty__title">${t}</div>
|
|
5575
5575
|
<p class="chat-empty__body">${n}</p>
|
|
5576
5576
|
</div>
|
|
5577
|
-
`}function
|
|
5577
|
+
`}function Ax(e){const t=e.bitSeekTopUpPrompt;return t?c`
|
|
5578
|
+
<div
|
|
5579
|
+
class="exec-approval-overlay chat-topup-overlay"
|
|
5580
|
+
role="dialog"
|
|
5581
|
+
aria-modal="true"
|
|
5582
|
+
aria-labelledby="bitseek-topup-title"
|
|
5583
|
+
aria-live="polite"
|
|
5584
|
+
>
|
|
5585
|
+
<div class="exec-approval-card chat-topup-card">
|
|
5586
|
+
<div class="exec-approval-header">
|
|
5587
|
+
<div>
|
|
5588
|
+
<div id="bitseek-topup-title" class="exec-approval-title">${t.title}</div>
|
|
5589
|
+
<div class="exec-approval-sub">${t.subtitle}</div>
|
|
5590
|
+
</div>
|
|
5591
|
+
<button
|
|
5592
|
+
class="chat-topup-close"
|
|
5593
|
+
type="button"
|
|
5594
|
+
aria-label="Close"
|
|
5595
|
+
@click=${()=>e.onDismissBitSeekTopUpPrompt?.()}
|
|
5596
|
+
>
|
|
5597
|
+
${pe.x}
|
|
5598
|
+
</button>
|
|
5599
|
+
</div>
|
|
5600
|
+
<p class="chat-topup-body">${t.message}</p>
|
|
5601
|
+
<div class="exec-approval-command mono">Link: ${t.url}</div>
|
|
5602
|
+
<div class="chat-topup-divider" role="presentation"></div>
|
|
5603
|
+
<div class="exec-approval-actions">
|
|
5604
|
+
<button
|
|
5605
|
+
class="btn primary"
|
|
5606
|
+
type="button"
|
|
5607
|
+
@click=${()=>{cu(t.url),e.onDismissBitSeekTopUpPrompt?.()}}
|
|
5608
|
+
>
|
|
5609
|
+
${t.primaryActionLabel}
|
|
5610
|
+
</button>
|
|
5611
|
+
<button
|
|
5612
|
+
class="btn"
|
|
5613
|
+
type="button"
|
|
5614
|
+
@click=${()=>e.onDismissBitSeekTopUpPrompt?.()}
|
|
5615
|
+
>
|
|
5616
|
+
Close
|
|
5617
|
+
</button>
|
|
5618
|
+
</div>
|
|
5619
|
+
</div>
|
|
5620
|
+
</div>
|
|
5621
|
+
`:h}function Cx(e){const t=e.connected,n=e.sending||e.stream!==null,s=!!(e.canAbort&&e.onAbort),o=e.sessions?.sessions?.find(m=>m.key===e.sessionKey)?.reasoningLevel??"off",r=e.showThinking&&o!=="off",l=Ex(e),a={name:e.assistantName,avatar:e.brandAvatarUrl},d=(e.attachments?.length??0)>0,g=e.connected?d?"Add a message or paste more images...":"Message (↩ to send, Shift+↩ for line breaks, paste images)":"Connect to the gateway to start chatting…",u=e.splitRatio??.6,f=!!(e.sidebarOpen&&e.onCloseSidebar),v=c`
|
|
5578
5622
|
<div
|
|
5579
5623
|
class="chat-thread"
|
|
5580
5624
|
role="log"
|
|
@@ -5583,14 +5627,14 @@ ${s?`**Command:** \`${s}\`
|
|
|
5583
5627
|
>
|
|
5584
5628
|
${e.loading?c`
|
|
5585
5629
|
<div class="muted">Loading chat…</div>
|
|
5586
|
-
`:l.length===0?
|
|
5630
|
+
`:l.length===0?kx(e):h}
|
|
5587
5631
|
${Td(l,m=>m.key,m=>m.kind==="divider"?c`
|
|
5588
5632
|
<div class="chat-divider" role="separator" data-ts=${String(m.timestamp)}>
|
|
5589
5633
|
<span class="chat-divider__line"></span>
|
|
5590
5634
|
<span class="chat-divider__label">${m.label}</span>
|
|
5591
5635
|
<span class="chat-divider__line"></span>
|
|
5592
5636
|
</div>
|
|
5593
|
-
`:m.kind==="reading-indicator"?
|
|
5637
|
+
`:m.kind==="reading-indicator"?cx(a):m.kind==="stream"?dx(m.text,m.startedAt,e.onOpenSidebar,a):m.kind==="group"?ux(m,{onOpenSidebar:e.onOpenSidebar,showReasoning:r,assistantName:e.assistantName,assistantAvatar:e.brandAvatarUrl}):h)}
|
|
5594
5638
|
</div>
|
|
5595
5639
|
`;return c`
|
|
5596
5640
|
<section class="card chat">
|
|
@@ -5606,7 +5650,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
5606
5650
|
aria-label="Exit focus mode"
|
|
5607
5651
|
title="Exit focus mode"
|
|
5608
5652
|
>
|
|
5609
|
-
${
|
|
5653
|
+
${pe.x}
|
|
5610
5654
|
</button>
|
|
5611
5655
|
`:h}
|
|
5612
5656
|
|
|
@@ -5626,7 +5670,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
5626
5670
|
@resize=${m=>e.onSplitRatioChange?.(m.detail.splitRatio)}
|
|
5627
5671
|
></resizable-divider>
|
|
5628
5672
|
<div class="chat-sidebar">
|
|
5629
|
-
${
|
|
5673
|
+
${px({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
|
|
5630
5674
|
${e.sidebarContent}
|
|
5631
5675
|
\`\`\``)}})}
|
|
5632
5676
|
</div>
|
|
@@ -5648,7 +5692,7 @@ ${e.sidebarContent}
|
|
|
5648
5692
|
aria-label="Remove queued message"
|
|
5649
5693
|
@click=${()=>e.onQueueRemove(m.id)}
|
|
5650
5694
|
>
|
|
5651
|
-
${
|
|
5695
|
+
${pe.x}
|
|
5652
5696
|
</button>
|
|
5653
5697
|
</div>
|
|
5654
5698
|
`)}
|
|
@@ -5656,8 +5700,8 @@ ${e.sidebarContent}
|
|
|
5656
5700
|
</div>
|
|
5657
5701
|
`:h}
|
|
5658
5702
|
|
|
5659
|
-
${
|
|
5660
|
-
${
|
|
5703
|
+
${$x(e.fallbackStatus)}
|
|
5704
|
+
${yx(e.compactionStatus)}
|
|
5661
5705
|
|
|
5662
5706
|
${e.showNewMessages?c`
|
|
5663
5707
|
<button
|
|
@@ -5665,23 +5709,23 @@ ${e.sidebarContent}
|
|
|
5665
5709
|
type="button"
|
|
5666
5710
|
@click=${e.onScrollToBottom}
|
|
5667
5711
|
>
|
|
5668
|
-
New messages ${
|
|
5712
|
+
New messages ${pe.arrowDown}
|
|
5669
5713
|
</button>
|
|
5670
5714
|
`:h}
|
|
5671
5715
|
|
|
5672
5716
|
<div class="chat-compose">
|
|
5673
|
-
${
|
|
5717
|
+
${Sx(e)}
|
|
5674
5718
|
<div class="chat-compose__row">
|
|
5675
5719
|
<label class="field chat-compose__field">
|
|
5676
5720
|
<span>Message</span>
|
|
5677
5721
|
<textarea
|
|
5678
|
-
${
|
|
5722
|
+
${Wy(m=>m&&xl(m))}
|
|
5679
5723
|
.value=${e.draft}
|
|
5680
|
-
dir=${
|
|
5724
|
+
dir=${du(e.draft)}
|
|
5681
5725
|
?disabled=${!e.connected}
|
|
5682
5726
|
@keydown=${m=>{m.key==="Enter"&&(m.isComposing||m.keyCode===229||m.shiftKey||e.connected&&(m.preventDefault(),t&&e.onSend()))}}
|
|
5683
|
-
@input=${m=>{const S=m.target;
|
|
5684
|
-
@paste=${m=>
|
|
5727
|
+
@input=${m=>{const S=m.target;xl(S),e.onDraftChange(S.value)}}
|
|
5728
|
+
@paste=${m=>wx(m,e)}
|
|
5685
5729
|
placeholder=${g}
|
|
5686
5730
|
></textarea>
|
|
5687
5731
|
</label>
|
|
@@ -5703,8 +5747,10 @@ ${e.sidebarContent}
|
|
|
5703
5747
|
</div>
|
|
5704
5748
|
</div>
|
|
5705
5749
|
</div>
|
|
5750
|
+
|
|
5751
|
+
${Ax(e)}
|
|
5706
5752
|
</section>
|
|
5707
|
-
`}const
|
|
5753
|
+
`}const wl=200;function Tx(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=gu(s.message),o=Sr(i.role),r=i.timestamp||Date.now();!n||n.role!==o?(n&&t.push(n),n={kind:"group",key:`group:${o}:${s.key}`,role:o,messages:[{message:s.message,key:s.key}],timestamp:r,isStreaming:!1}):n.messages.push({message:s.message,key:s.key})}return n&&t.push(n),t}function Ex(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-wl);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${wl} messages (${i} hidden).`,timestamp:Date.now()}});for(let o=i;o<n.length;o++){const r=n[o],l=gu(r),d=r.__openclaw;if(d&&d.kind==="compaction"){t.push({kind:"divider",key:typeof d.id=="string"?`divider:compaction:${d.id}`:`divider:compaction:${l.timestamp}:${o}`,label:"Compaction",timestamp:l.timestamp??Date.now()});continue}!e.showThinking&&l.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:Sl(r,o),message:r})}if(e.showThinking)for(let o=0;o<s.length;o++)t.push({kind:"message",key:Sl(s[o],o+n.length),message:s[o]});if(e.stream!==null){const o=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:o,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:o})}return Tx(t)}function Sl(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 o=typeof n.messageId=="string"?n.messageId:"";if(o)return`msg:${o}`;const r=typeof n.timestamp=="number"?n.timestamp:null,l=typeof n.role=="string"?n.role:"unknown";return r!=null?`msg:${l}:${r}:${t}`:`msg:${l}:${t}`}function $u(e){return e.trim().toLowerCase()}function _x(e){const t=new Set,n=[],s=/(^|\s)tag:([^\s]+)/gi,i=e.trim();let o=s.exec(i);for(;o;){const r=$u(o[2]??"");r&&!t.has(r)&&(t.add(r),n.push(r)),o=s.exec(i)}return n}function Ix(e,t){const n=[],s=new Set;for(const l of t){const a=$u(l);!a||s.has(a)||(s.add(a),n.push(a))}const o=e.trim().replace(/(^|\s)tag:([^\s]+)/gi," ").replace(/\s+/g," ").trim(),r=n.map(l=>`tag:${l}`).join(" ");return o&&r?`${o} ${r}`:o||r}const Rx=["security","auth","network","access","privacy","observability","performance","reliability","storage","models","media","automation","channels","tools","advanced"],Io={all:c`
|
|
5708
5754
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
5709
5755
|
<rect x="3" y="3" width="7" height="7"></rect>
|
|
5710
5756
|
<rect x="14" y="3" width="7" height="7"></rect>
|
|
@@ -5898,7 +5944,7 @@ ${e.sidebarContent}
|
|
|
5898
5944
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
5899
5945
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
5900
5946
|
</svg>
|
|
5901
|
-
`},
|
|
5947
|
+
`},kl=[{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"}],Al="__all__";function Cl(e){return Io[e]??Io.default}function Mx(e,t){const n=fr[e];return n||{label:t?.title??ei(e),description:t?.description??""}}function Lx(e){const{key:t,schema:n,uiHints:s}=e;if(!n||ve(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([o,r])=>{const l=bt([t,o],s),a=l?.label??r.title??ei(o),d=l?.help??r.description??"",g=l?.order??50;return{key:o,label:a,description:d,order:g}});return i.sort((o,r)=>o.order!==r.order?o.order-r.order:o.key.localeCompare(r.key)),i}function Dx(e,t){if(!e||!t)return[];const n=[];function s(i,o,r){if(i===o)return;if(typeof i!=typeof o){n.push({path:r,from:i,to:o});return}if(typeof i!="object"||i===null||o===null){i!==o&&n.push({path:r,from:i,to:o});return}if(Array.isArray(i)&&Array.isArray(o)){JSON.stringify(i)!==JSON.stringify(o)&&n.push({path:r,from:i,to:o});return}const l=i,a=o,d=new Set([...Object.keys(l),...Object.keys(a)]);for(const g of d)s(l[g],a[g],r?`${r}.${g}`:g)}return s(e,t,""),n}function Tl(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 Px(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=Hd(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},o=kl.filter(R=>R.key in i),r=new Set(kl.map(R=>R.key)),l=Object.keys(i).filter(R=>!r.has(R)).map(R=>({key:R,label:R.charAt(0).toUpperCase()+R.slice(1)})),a=[...o,...l],d=e.activeSection&&n.schema&&ve(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,g=e.activeSection?Mx(e.activeSection,d):null,u=e.activeSection?Lx({key:e.activeSection,schema:d,uiHints:e.uiHints}):[],f=e.formMode==="form"&&!!e.activeSection&&u.length>0,v=e.activeSubsection===Al,m=e.searchQuery||v?null:e.activeSubsection??u[0]?.key??null,S=e.formMode==="form"?Dx(e.originalValue,e.formValue):[],T=e.formMode==="raw"&&e.raw!==e.originalRaw,M=e.formMode==="form"?S.length>0:T,I=!!e.formValue&&!e.loading&&!!n.schema,A=e.connected&&!e.saving&&M&&(e.formMode==="raw"?!0:I),w=e.connected&&!e.applying&&!e.updating&&M&&(e.formMode==="raw"?!0:I),L=e.connected&&!e.applying&&!e.updating,E=new Set(_x(e.searchQuery));return c`
|
|
5902
5948
|
<div class="config-layout">
|
|
5903
5949
|
<!-- Sidebar -->
|
|
5904
5950
|
<aside class="config-sidebar">
|
|
@@ -5958,13 +6004,13 @@ ${e.sidebarContent}
|
|
|
5958
6004
|
<span class="config-search__tag-caret" aria-hidden="true">▾</span>
|
|
5959
6005
|
</summary>
|
|
5960
6006
|
<div class="config-search__tag-menu">
|
|
5961
|
-
${
|
|
6007
|
+
${Rx.map(R=>{const K=E.has(R);return c`
|
|
5962
6008
|
<button
|
|
5963
6009
|
type="button"
|
|
5964
6010
|
class="config-search__tag-option ${K?"active":""}"
|
|
5965
6011
|
data-tag="${R}"
|
|
5966
6012
|
aria-pressed=${K?"true":"false"}
|
|
5967
|
-
@click=${()=>{const G=K?Array.from(E).filter(b=>b!==R):[...E,R];e.onSearchChange(
|
|
6013
|
+
@click=${()=>{const G=K?Array.from(E).filter(b=>b!==R):[...E,R];e.onSearchChange(Ix(e.searchQuery,G))}}
|
|
5968
6014
|
>
|
|
5969
6015
|
tag:${R}
|
|
5970
6016
|
</button>
|
|
@@ -5980,7 +6026,7 @@ ${e.sidebarContent}
|
|
|
5980
6026
|
class="config-nav__item ${e.activeSection===null?"active":""}"
|
|
5981
6027
|
@click=${()=>e.onSectionChange(null)}
|
|
5982
6028
|
>
|
|
5983
|
-
<span class="config-nav__icon">${
|
|
6029
|
+
<span class="config-nav__icon">${Io.all}</span>
|
|
5984
6030
|
<span class="config-nav__label">All Settings</span>
|
|
5985
6031
|
</button>
|
|
5986
6032
|
${a.map(R=>c`
|
|
@@ -5989,7 +6035,7 @@ ${e.sidebarContent}
|
|
|
5989
6035
|
@click=${()=>e.onSectionChange(R.key)}
|
|
5990
6036
|
>
|
|
5991
6037
|
<span class="config-nav__icon"
|
|
5992
|
-
>${
|
|
6038
|
+
>${Cl(R.key)}</span
|
|
5993
6039
|
>
|
|
5994
6040
|
<span class="config-nav__label">${R.label}</span>
|
|
5995
6041
|
</button>
|
|
@@ -6085,11 +6131,11 @@ ${e.sidebarContent}
|
|
|
6085
6131
|
<div class="config-diff__path">${R.path}</div>
|
|
6086
6132
|
<div class="config-diff__values">
|
|
6087
6133
|
<span class="config-diff__from"
|
|
6088
|
-
>${
|
|
6134
|
+
>${Tl(R.from)}</span
|
|
6089
6135
|
>
|
|
6090
6136
|
<span class="config-diff__arrow">→</span>
|
|
6091
6137
|
<span class="config-diff__to"
|
|
6092
|
-
>${
|
|
6138
|
+
>${Tl(R.to)}</span
|
|
6093
6139
|
>
|
|
6094
6140
|
</div>
|
|
6095
6141
|
</div>
|
|
@@ -6100,7 +6146,7 @@ ${e.sidebarContent}
|
|
|
6100
6146
|
${g&&e.formMode==="form"?c`
|
|
6101
6147
|
<div class="config-section-hero">
|
|
6102
6148
|
<div class="config-section-hero__icon">
|
|
6103
|
-
${
|
|
6149
|
+
${Cl(e.activeSection??"")}
|
|
6104
6150
|
</div>
|
|
6105
6151
|
<div class="config-section-hero__text">
|
|
6106
6152
|
<div class="config-section-hero__title">
|
|
@@ -6116,7 +6162,7 @@ ${e.sidebarContent}
|
|
|
6116
6162
|
<div class="config-subnav">
|
|
6117
6163
|
<button
|
|
6118
6164
|
class="config-subnav__item ${m===null?"active":""}"
|
|
6119
|
-
@click=${()=>e.onSubsectionChange(
|
|
6165
|
+
@click=${()=>e.onSubsectionChange(Al)}
|
|
6120
6166
|
>
|
|
6121
6167
|
All
|
|
6122
6168
|
</button>
|
|
@@ -6140,7 +6186,7 @@ ${e.sidebarContent}
|
|
|
6140
6186
|
<div class="config-loading__spinner"></div>
|
|
6141
6187
|
<span>Loading schema…</span>
|
|
6142
6188
|
</div>
|
|
6143
|
-
`:
|
|
6189
|
+
`:cy({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:m})}
|
|
6144
6190
|
${s?c`
|
|
6145
6191
|
<div class="callout danger" style="margin-top: 12px">
|
|
6146
6192
|
Form view can't safely edit some fields. Use Raw to avoid losing config entries.
|
|
@@ -6164,7 +6210,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6164
6210
|
</div>`:h}
|
|
6165
6211
|
</main>
|
|
6166
6212
|
</div>
|
|
6167
|
-
`}const Be=e=>e??h;function
|
|
6213
|
+
`}const Be=e=>e??h;function Fx(){return[{value:"ok",label:p("cron.runs.runStatusOk")},{value:"error",label:p("cron.runs.runStatusError")},{value:"skipped",label:p("cron.runs.runStatusSkipped")}]}function Nx(){return[{value:"delivered",label:p("cron.runs.deliveryDelivered")},{value:"not-delivered",label:p("cron.runs.deliveryNotDelivered")},{value:"unknown",label:p("cron.runs.deliveryUnknown")},{value:"not-requested",label:p("cron.runs.deliveryNotRequested")}]}function El(e,t,n){const s=new Set(e);return n?s.add(t):s.delete(t),Array.from(s)}function _l(e,t){return e.length===0?t:e.length<=2?e.join(", "):`${e[0]} +${e.length-1}`}function Ox(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 Il(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 Rl(e){return c`
|
|
6168
6214
|
<div class="field cron-filter-dropdown" data-filter=${e.id}>
|
|
6169
6215
|
<span>${e.title}</span>
|
|
6170
6216
|
<details class="cron-filter-dropdown__details">
|
|
@@ -6193,13 +6239,13 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6193
6239
|
</div>
|
|
6194
6240
|
`}function ln(e,t){const n=Array.from(new Set(t.map(s=>s.trim()).filter(Boolean)));return n.length===0?h:c`<datalist id=${e}>
|
|
6195
6241
|
${n.map(s=>c`<option value=${s}></option> `)}
|
|
6196
|
-
</datalist>`}function fe(e){return`cron-error-${e}`}function
|
|
6242
|
+
</datalist>`}function fe(e){return`cron-error-${e}`}function Ux(e){return e==="name"?"cron-name":e==="scheduleAt"?"cron-schedule-at":e==="everyAmount"?"cron-every-amount":e==="cronExpr"?"cron-cron-expr":e==="staggerAmount"?"cron-stagger-amount":e==="payloadText"?"cron-payload-text":e==="payloadModel"?"cron-payload-model":e==="payloadThinking"?"cron-payload-thinking":e==="timeoutSeconds"?"cron-timeout-seconds":e==="failureAlertAfter"?"cron-failure-alert-after":e==="failureAlertCooldownSeconds"?"cron-failure-alert-cooldown-seconds":"cron-delivery-to"}function Bx(e,t,n){return e==="payloadText"?t.payloadKind==="systemEvent"?p("cron.form.mainTimelineMessage"):p("cron.form.assistantTaskPrompt"):e==="deliveryTo"?p(n==="webhook"?"cron.form.webhookUrl":"cron.form.to"):{name:p("cron.form.fieldName"),scheduleAt:p("cron.form.runAt"),everyAmount:p("cron.form.every"),cronExpr:p("cron.form.expression"),staggerAmount:p("cron.form.staggerWindow"),payloadText:p("cron.form.assistantTaskPrompt"),payloadModel:p("cron.form.model"),payloadThinking:p("cron.form.thinking"),timeoutSeconds:p("cron.form.timeoutSeconds"),deliveryTo:p("cron.form.to"),failureAlertAfter:"Failure alert after",failureAlertCooldownSeconds:"Failure alert cooldown"}[e]}function Hx(e,t,n){const s=["name","scheduleAt","everyAmount","cronExpr","staggerAmount","payloadText","payloadModel","payloadThinking","timeoutSeconds","deliveryTo","failureAlertAfter","failureAlertCooldownSeconds"],i=[];for(const o of s){const r=e[o];r&&i.push({key:o,label:Bx(o,t,n),message:r,inputId:Ux(o)})}return i}function zx(e){const t=document.getElementById(e);t instanceof HTMLElement&&(typeof t.scrollIntoView=="function"&&t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus())}function ie(e,t=!1){return c`<span>
|
|
6197
6243
|
${e}
|
|
6198
6244
|
${t?c`
|
|
6199
6245
|
<span class="cron-required-marker" aria-hidden="true">*</span>
|
|
6200
6246
|
<span class="cron-required-sr">${p("cron.form.requiredSr")}</span>
|
|
6201
6247
|
`:h}
|
|
6202
|
-
</span>`}function
|
|
6248
|
+
</span>`}function jx(e){const t=!!e.editingJobId,n=e.form.payloadKind==="agentTurn",s=e.form.scheduleKind==="cron",i=Ox(e),o=e.runsJobId==null?void 0:e.jobs.find(w=>w.id===e.runsJobId),r=e.runsScope==="all"?p("cron.jobList.allJobs"):o?.name??e.runsJobId??p("cron.jobList.selectJob"),l=e.runs,a=Fx(),d=Nx(),g=a.filter(w=>e.runsStatuses.includes(w.value)).map(w=>w.label),u=d.filter(w=>e.runsDeliveryStatuses.includes(w.value)).map(w=>w.label),f=_l(g,p("cron.runs.allStatuses")),v=_l(u,p("cron.runs.allDelivery")),m=e.form.sessionTarget==="isolated"&&e.form.payloadKind==="agentTurn",S=e.form.deliveryMode==="announce"&&!m?"none":e.form.deliveryMode,T=Hx(e.fieldErrors,e.form,S),M=!e.busy&&T.length>0,I=e.jobsQuery.trim().length>0||e.jobsEnabledFilter!=="all"||e.jobsScheduleKindFilter!=="all"||e.jobsLastStatusFilter!=="all"||e.jobsSortBy!=="nextRunAtMs"||e.jobsSortDir!=="asc",A=M&&!e.canSubmit?T.length===1?p("cron.form.fixFields",{count:String(T.length)}):p("cron.form.fixFieldsPlural",{count:String(T.length)}):"";return c`
|
|
6203
6249
|
<section class="card cron-summary-strip">
|
|
6204
6250
|
<div class="cron-summary-strip__left">
|
|
6205
6251
|
<div class="cron-summary-item">
|
|
@@ -6216,7 +6262,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6216
6262
|
</div>
|
|
6217
6263
|
<div class="cron-summary-item cron-summary-item--wide">
|
|
6218
6264
|
<div class="cron-summary-label">${p("cron.summary.nextWake")}</div>
|
|
6219
|
-
<div class="cron-summary-value">${
|
|
6265
|
+
<div class="cron-summary-value">${ur(e.status?.nextWakeAtMs??null)}</div>
|
|
6220
6266
|
</div>
|
|
6221
6267
|
</div>
|
|
6222
6268
|
<div class="cron-summary-strip__actions">
|
|
@@ -6320,7 +6366,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6320
6366
|
<div class="muted" style="margin-top: 12px">${p("cron.jobs.noMatching")}</div>
|
|
6321
6367
|
`:c`
|
|
6322
6368
|
<div class="list" style="margin-top: 12px;">
|
|
6323
|
-
${e.jobs.map(w=>
|
|
6369
|
+
${e.jobs.map(w=>Wx(w,e))}
|
|
6324
6370
|
</div>
|
|
6325
6371
|
`}
|
|
6326
6372
|
${e.jobsHasMore?c`
|
|
@@ -6378,8 +6424,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6378
6424
|
</label>
|
|
6379
6425
|
</div>
|
|
6380
6426
|
<div class="cron-run-filters__row cron-run-filters__row--secondary">
|
|
6381
|
-
${
|
|
6382
|
-
${
|
|
6427
|
+
${Rl({id:"status",title:p("cron.runs.status"),summary:f,options:a,selected:e.runsStatuses,onToggle:(w,L)=>{const E=El(e.runsStatuses,w,L);e.onRunsFiltersChange({cronRunsStatuses:E})},onClear:()=>{e.onRunsFiltersChange({cronRunsStatuses:[]})}})}
|
|
6428
|
+
${Rl({id:"delivery",title:p("cron.runs.delivery"),summary:v,options:d,selected:e.runsDeliveryStatuses,onToggle:(w,L)=>{const E=El(e.runsDeliveryStatuses,w,L);e.onRunsFiltersChange({cronRunsDeliveryStatuses:E})},onClear:()=>{e.onRunsFiltersChange({cronRunsDeliveryStatuses:[]})}})}
|
|
6383
6429
|
</div>
|
|
6384
6430
|
</div>
|
|
6385
6431
|
${e.runsScope==="job"&&e.runsJobId==null?c`
|
|
@@ -6388,7 +6434,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6388
6434
|
<div class="muted" style="margin-top: 12px">${p("cron.runs.noMatching")}</div>
|
|
6389
6435
|
`:c`
|
|
6390
6436
|
<div class="list" style="margin-top: 12px;">
|
|
6391
|
-
${l.map(w=>
|
|
6437
|
+
${l.map(w=>Yx(w,e.basePath))}
|
|
6392
6438
|
</div>
|
|
6393
6439
|
`}
|
|
6394
6440
|
${(e.runsScope==="all"||e.runsJobId!=null)&&e.runsHasMore?c`
|
|
@@ -6478,7 +6524,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6478
6524
|
</select>
|
|
6479
6525
|
</label>
|
|
6480
6526
|
</div>
|
|
6481
|
-
${
|
|
6527
|
+
${Kx(e)}
|
|
6482
6528
|
</section>
|
|
6483
6529
|
|
|
6484
6530
|
<section class="cron-form-section">
|
|
@@ -6592,7 +6638,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6592
6638
|
@change=${w=>e.onFormChange({deliveryChannel:w.target.value})}
|
|
6593
6639
|
>
|
|
6594
6640
|
${i.map(w=>c`<option value=${w}>
|
|
6595
|
-
${
|
|
6641
|
+
${Il(e,w)}
|
|
6596
6642
|
</option>`)}
|
|
6597
6643
|
</select>
|
|
6598
6644
|
`}
|
|
@@ -6789,7 +6835,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6789
6835
|
@change=${w=>e.onFormChange({failureAlertChannel:w.target.value})}
|
|
6790
6836
|
>
|
|
6791
6837
|
${i.map(w=>c`<option value=${w}>
|
|
6792
|
-
${
|
|
6838
|
+
${Il(e,w)}
|
|
6793
6839
|
</option>`)}
|
|
6794
6840
|
</select>
|
|
6795
6841
|
</label>
|
|
@@ -6849,7 +6895,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6849
6895
|
<button
|
|
6850
6896
|
type="button"
|
|
6851
6897
|
class="cron-form-status__link"
|
|
6852
|
-
@click=${()=>
|
|
6898
|
+
@click=${()=>zx(w.inputId)}
|
|
6853
6899
|
>
|
|
6854
6900
|
${w.label}: ${p(w.message)}
|
|
6855
6901
|
</button>
|
|
@@ -6878,7 +6924,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6878
6924
|
${ln("cron-tz-suggestions",e.timezoneSuggestions)}
|
|
6879
6925
|
${ln("cron-delivery-to-suggestions",e.deliveryToSuggestions)}
|
|
6880
6926
|
${ln("cron-delivery-account-suggestions",e.accountSuggestions)}
|
|
6881
|
-
`}function
|
|
6927
|
+
`}function Kx(e){const t=e.form;return t.scheduleKind==="at"?c`
|
|
6882
6928
|
<label class="field cron-span-2" style="margin-top: 12px;">
|
|
6883
6929
|
${ie(p("cron.form.runAt"),!0)}
|
|
6884
6930
|
<input
|
|
@@ -6943,16 +6989,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6943
6989
|
</label>
|
|
6944
6990
|
<div class="cron-help cron-span-2">${p("cron.form.jitterHelp")}</div>
|
|
6945
6991
|
</div>
|
|
6946
|
-
`}function Qe(e,t){return e?c`<div id=${Be(t)} class="cron-help cron-error">${p(e)}</div>`:h}function
|
|
6992
|
+
`}function Qe(e,t){return e?c`<div id=${Be(t)} class="cron-help cron-error">${p(e)}</div>`:h}function Wx(e,t){const s=`list-item list-item-clickable cron-job${t.runsJobId===e.id?" list-item-selected":""}`,i=o=>{t.onLoadRuns(e.id),o()};return c`
|
|
6947
6993
|
<div class=${s} @click=${()=>t.onLoadRuns(e.id)}>
|
|
6948
6994
|
<div class="list-main">
|
|
6949
6995
|
<div class="list-title">${e.name}</div>
|
|
6950
6996
|
<div class="list-sub">${Rd(e)}</div>
|
|
6951
|
-
${
|
|
6997
|
+
${qx(e)}
|
|
6952
6998
|
${e.agentId?c`<div class="muted cron-job-agent">${p("cron.jobDetail.agent")}: ${e.agentId}</div>`:h}
|
|
6953
6999
|
</div>
|
|
6954
7000
|
<div class="list-meta">
|
|
6955
|
-
${
|
|
7001
|
+
${Vx(e)}
|
|
6956
7002
|
</div>
|
|
6957
7003
|
<div class="cron-job-footer">
|
|
6958
7004
|
<div class="chip-row cron-job-chips">
|
|
@@ -7015,7 +7061,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7015
7061
|
</div>
|
|
7016
7062
|
</div>
|
|
7017
7063
|
</div>
|
|
7018
|
-
`}function
|
|
7064
|
+
`}function qx(e){if(e.payload.kind==="systemEvent")return c`<div class="cron-job-detail">
|
|
7019
7065
|
<span class="cron-job-detail-label">${p("cron.jobDetail.system")}</span>
|
|
7020
7066
|
<span class="muted cron-job-detail-value">${e.payload.text}</span>
|
|
7021
7067
|
</div>`;const t=e.delivery,n=t?.mode==="webhook"?t.to?` (${t.to})`:"":t?.channel||t?.to?` (${t.channel??"last"}${t.to?` -> ${t.to}`:""})`:"";return c`
|
|
@@ -7027,7 +7073,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7027
7073
|
<span class="cron-job-detail-label">${p("cron.jobDetail.delivery")}</span>
|
|
7028
7074
|
<span class="muted cron-job-detail-value">${t.mode}${n}</span>
|
|
7029
7075
|
</div>`:h}
|
|
7030
|
-
`}function
|
|
7076
|
+
`}function Ml(e){return typeof e!="number"||!Number.isFinite(e)?p("common.na"):ne(e)}function Gx(e,t=Date.now()){const n=ne(e);return e>t?p("cron.runEntry.next",{rel:n}):p("cron.runEntry.due",{rel:n})}function Vx(e){const t=e.state?.lastStatus,n=t==="ok"?"cron-job-status-ok":t==="error"?"cron-job-status-error":t==="skipped"?"cron-job-status-skipped":"cron-job-status-na",s=p(t==="ok"?"cron.runs.runStatusOk":t==="error"?"cron.runs.runStatusError":t==="skipped"?"cron.runs.runStatusSkipped":"common.na"),i=e.state?.nextRunAtMs,o=e.state?.lastRunAtMs;return c`
|
|
7031
7077
|
<div class="cron-job-state">
|
|
7032
7078
|
<div class="cron-job-state-row">
|
|
7033
7079
|
<span class="cron-job-state-key">${p("cron.jobState.status")}</span>
|
|
@@ -7036,17 +7082,17 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7036
7082
|
<div class="cron-job-state-row">
|
|
7037
7083
|
<span class="cron-job-state-key">${p("cron.jobState.next")}</span>
|
|
7038
7084
|
<span class="cron-job-state-value" title=${kt(i)}>
|
|
7039
|
-
${
|
|
7085
|
+
${Ml(i)}
|
|
7040
7086
|
</span>
|
|
7041
7087
|
</div>
|
|
7042
7088
|
<div class="cron-job-state-row">
|
|
7043
7089
|
<span class="cron-job-state-key">${p("cron.jobState.last")}</span>
|
|
7044
7090
|
<span class="cron-job-state-value" title=${kt(o)}>
|
|
7045
|
-
${
|
|
7091
|
+
${Ml(o)}
|
|
7046
7092
|
</span>
|
|
7047
7093
|
</div>
|
|
7048
7094
|
</div>
|
|
7049
|
-
`}function
|
|
7095
|
+
`}function Jx(e){switch(e){case"ok":return p("cron.runs.runStatusOk");case"error":return p("cron.runs.runStatusError");case"skipped":return p("cron.runs.runStatusSkipped");default:return p("cron.runs.runStatusUnknown")}}function Qx(e){switch(e){case"delivered":return p("cron.runs.deliveryDelivered");case"not-delivered":return p("cron.runs.deliveryNotDelivered");case"not-requested":return p("cron.runs.deliveryNotRequested");case"unknown":return p("cron.runs.deliveryUnknown");default:return p("cron.runs.deliveryUnknown")}}function Yx(e,t){const n=typeof e.sessionKey=="string"&&e.sessionKey.trim().length>0?`${li("chat",t)}?session=${encodeURIComponent(e.sessionKey)}`:null,s=Jx(e.status??"unknown"),i=Qx(e.deliveryStatus??"not-requested"),o=e.usage,r=o&&typeof o.total_tokens=="number"?`${o.total_tokens} tokens`:o&&typeof o.input_tokens=="number"&&typeof o.output_tokens=="number"?`${o.input_tokens} in / ${o.output_tokens} out`:null;return c`
|
|
7050
7096
|
<div class="list-item cron-run-entry">
|
|
7051
7097
|
<div class="list-main cron-run-entry__main">
|
|
7052
7098
|
<div class="list-title cron-run-entry__title">
|
|
@@ -7065,13 +7111,13 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7065
7111
|
<div>${kt(e.ts)}</div>
|
|
7066
7112
|
${typeof e.runAtMs=="number"?c`<div class="muted">${p("cron.runEntry.runAt")} ${kt(e.runAtMs)}</div>`:h}
|
|
7067
7113
|
<div class="muted">${e.durationMs??0}ms</div>
|
|
7068
|
-
${typeof e.nextRunAtMs=="number"?c`<div class="muted">${
|
|
7114
|
+
${typeof e.nextRunAtMs=="number"?c`<div class="muted">${Gx(e.nextRunAtMs)}</div>`:h}
|
|
7069
7115
|
${n?c`<div><a class="session-link" href=${n}>${p("cron.runEntry.openRunChat")}</a></div>`:h}
|
|
7070
7116
|
${e.error?c`<div class="muted">${e.error}</div>`:h}
|
|
7071
7117
|
${e.deliveryError?c`<div class="muted">${e.deliveryError}</div>`:h}
|
|
7072
7118
|
</div>
|
|
7073
7119
|
</div>
|
|
7074
|
-
`}function
|
|
7120
|
+
`}function Xx(e){const n=(e.status&&typeof e.status=="object"?e.status.securityAudit:null)?.summary??null,s=n?.critical??0,i=n?.warn??0,o=n?.info??0,r=s>0?"danger":i>0?"warn":"success",l=s>0?`${s} critical`:i>0?`${i} warnings`:"No critical issues";return c`
|
|
7075
7121
|
<section class="grid grid-cols-2">
|
|
7076
7122
|
<div class="card">
|
|
7077
7123
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -7154,14 +7200,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7154
7200
|
<div class="list-sub">${new Date(a.ts).toLocaleTimeString()}</div>
|
|
7155
7201
|
</div>
|
|
7156
7202
|
<div class="list-meta debug-event-log__meta">
|
|
7157
|
-
<pre class="code-block debug-event-log__payload">${
|
|
7203
|
+
<pre class="code-block debug-event-log__payload">${Mb(a.payload)}</pre>
|
|
7158
7204
|
</div>
|
|
7159
7205
|
</div>
|
|
7160
7206
|
`)}
|
|
7161
7207
|
</div>
|
|
7162
7208
|
`}
|
|
7163
7209
|
</section>
|
|
7164
|
-
`}function
|
|
7210
|
+
`}function Zx(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 Ft(e,t){return t?c`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:h}function ew(e){const t=e.execApprovalQueue[0];if(!t)return h;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${Zx(s)}`:"expired",o=e.execApprovalQueue.length;return c`
|
|
7165
7211
|
<div class="exec-approval-overlay" role="dialog" aria-live="polite">
|
|
7166
7212
|
<div class="exec-approval-card">
|
|
7167
7213
|
<div class="exec-approval-header">
|
|
@@ -7207,7 +7253,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7207
7253
|
</div>
|
|
7208
7254
|
</div>
|
|
7209
7255
|
</div>
|
|
7210
|
-
`}function
|
|
7256
|
+
`}function tw(e){const{pendingGatewayUrl:t}=e;return t?c`
|
|
7211
7257
|
<div class="exec-approval-overlay" role="dialog" aria-modal="true" aria-live="polite">
|
|
7212
7258
|
<div class="exec-approval-card">
|
|
7213
7259
|
<div class="exec-approval-header">
|
|
@@ -7236,7 +7282,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7236
7282
|
</div>
|
|
7237
7283
|
</div>
|
|
7238
7284
|
</div>
|
|
7239
|
-
`:h}function
|
|
7285
|
+
`:h}function nw(e){return c`
|
|
7240
7286
|
<section class="card">
|
|
7241
7287
|
<div class="row" style="justify-content: space-between;">
|
|
7242
7288
|
<div>
|
|
@@ -7256,14 +7302,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7256
7302
|
<div class="list" style="margin-top: 16px;">
|
|
7257
7303
|
${e.entries.length===0?c`
|
|
7258
7304
|
<div class="muted">No instances reported yet.</div>
|
|
7259
|
-
`:e.entries.map(t=>
|
|
7305
|
+
`:e.entries.map(t=>sw(t))}
|
|
7260
7306
|
</div>
|
|
7261
7307
|
</section>
|
|
7262
|
-
`}function
|
|
7308
|
+
`}function sw(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):[],o=i.length>0?i.length>3?`${i.length} scopes`:`scopes: ${i.join(", ")}`:null;return c`
|
|
7263
7309
|
<div class="list-item">
|
|
7264
7310
|
<div class="list-main">
|
|
7265
7311
|
<div class="list-title">${e.host??"unknown host"}</div>
|
|
7266
|
-
<div class="list-sub">${
|
|
7312
|
+
<div class="list-sub">${_b(e)}</div>
|
|
7267
7313
|
<div class="chip-row">
|
|
7268
7314
|
<span class="chip">${n}</span>
|
|
7269
7315
|
${s.map(r=>c`<span class="chip">${r}</span>`)}
|
|
@@ -7275,12 +7321,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7275
7321
|
</div>
|
|
7276
7322
|
</div>
|
|
7277
7323
|
<div class="list-meta">
|
|
7278
|
-
<div>${
|
|
7324
|
+
<div>${Ib(e)}</div>
|
|
7279
7325
|
<div class="muted">Last input ${t}</div>
|
|
7280
7326
|
<div class="muted">Reason ${e.reason??""}</div>
|
|
7281
7327
|
</div>
|
|
7282
7328
|
</div>
|
|
7283
|
-
`}const
|
|
7329
|
+
`}const Ll=["trace","debug","info","warn","error","fatal"];function iw(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function ow(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function rw(e){const t=e.filterText.trim().toLowerCase(),n=Ll.some(o=>!e.levelFilters[o]),s=e.entries.filter(o=>o.level&&!e.levelFilters[o.level]?!1:ow(o,t)),i=t||n?"filtered":"visible";return c`
|
|
7284
7330
|
<section class="card">
|
|
7285
7331
|
<div class="row" style="justify-content: space-between;">
|
|
7286
7332
|
<div>
|
|
@@ -7321,7 +7367,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7321
7367
|
</div>
|
|
7322
7368
|
|
|
7323
7369
|
<div class="chip-row" style="margin-top: 12px;">
|
|
7324
|
-
${
|
|
7370
|
+
${Ll.map(o=>c`
|
|
7325
7371
|
<label class="chip log-chip ${o}">
|
|
7326
7372
|
<input
|
|
7327
7373
|
type="checkbox"
|
|
@@ -7344,7 +7390,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7344
7390
|
<div class="muted" style="padding: 12px">No log entries.</div>
|
|
7345
7391
|
`:s.map(o=>c`
|
|
7346
7392
|
<div class="log-row">
|
|
7347
|
-
<div class="log-time mono">${
|
|
7393
|
+
<div class="log-time mono">${iw(o.time)}</div>
|
|
7348
7394
|
<div class="log-level ${o.level??""}">${o.level??""}</div>
|
|
7349
7395
|
<div class="log-subsystem mono">${o.subsystem??""}</div>
|
|
7350
7396
|
<div class="log-message mono">${o.message??o.raw}</div>
|
|
@@ -7352,7 +7398,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7352
7398
|
`)}
|
|
7353
7399
|
</div>
|
|
7354
7400
|
</section>
|
|
7355
|
-
`}const
|
|
7401
|
+
`}const Dl=["automation","developer-tools","search-research","audio-media","meta-security"];function aw(e){return e==="automation"?"Automation":e==="developer-tools"?"Developer Tools":e==="search-research"?"Search & Research":e==="audio-media"?"Audio & Media":e==="meta-security"?"Skill Building & Security":e}function lw(e){return xn(e).kind==="install"?"Install":xn(e).kind==="enable"?"Enable":"Disable"}function cw(e){return xn(e).kind==="install"?"Installing...":xn(e).kind==="enable"?"Enabling...":"Disabling..."}function dw(e){return xn(e).kind==="disable"?"btn btn--sm market-action-btn":"btn primary btn--sm market-action-btn"}function uw(e){return e.state.installed?e.state.enabled?"Enabled":"Disabled":null}function gw(e){return e.state.installed?e.state.enabled?"pill market-state-badge market-state-badge--enabled":"pill market-state-badge market-state-badge--disabled":"pill market-state-badge"}function fw(e){return e.state.installed?e.state.missingDeps?"Installed, but setup is incomplete.":e.state.enabled?"Installed locally and active.":"Installed locally, currently disabled.":"Available in Bitseek Skill Hub."}function pw(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"provider"}function Pl(e){if(typeof e!="number"||!Number.isFinite(e)||e<0)return"--";if(e>=1e6){const t=e/1e6;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}m`}if(e>=1e3){const t=e/1e3;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}k`}return String(Math.round(e))}function hw(e){const t=new Map;for(const o of e){const r=t.get(o.category)??[];r.push(o),t.set(o.category,r)}const n=[...t.keys()].filter(o=>!Dl.includes(o)),s=[...Dl,...n.toSorted()],i=[];for(const o of s){const r=t.get(o);!r||r.length===0||i.push({id:o,label:aw(o),entries:r})}return i}function mw(e){const t=e.filter.trim().toLowerCase(),n=t?e.catalog.filter(i=>[i.name,i.summary,i.provider,i.category,i.tags.join(" ")].join(" ").toLowerCase().includes(t)):e.catalog,s=hw(n);return c`
|
|
7356
7402
|
<section class="card market-shell">
|
|
7357
7403
|
<div class="filters market-filters">
|
|
7358
7404
|
<label class="field" style="flex: 1;">
|
|
@@ -7381,16 +7427,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7381
7427
|
<div class="market-group-title">${i.label}</div>
|
|
7382
7428
|
</div>
|
|
7383
7429
|
<div class="market-grid">
|
|
7384
|
-
${i.entries.map(o=>{const r=e.busyKey===o.skillKey,l=e.messages[o.skillKey],a=
|
|
7430
|
+
${i.entries.map(o=>{const r=e.busyKey===o.skillKey,l=e.messages[o.skillKey],a=lw(o),d=cw(o),g=uw(o);return c`
|
|
7385
7431
|
<article class="market-card">
|
|
7386
7432
|
<div class="market-card-top">
|
|
7387
7433
|
<div class="list-title market-title">${o.name}</div>
|
|
7388
|
-
${g?c`<span class=${
|
|
7434
|
+
${g?c`<span class=${gw(o)}>
|
|
7389
7435
|
${g}
|
|
7390
7436
|
</span>`:h}
|
|
7391
7437
|
</div>
|
|
7392
7438
|
<div class="list-sub market-summary">${o.summary}</div>
|
|
7393
|
-
<div class="muted market-status">${
|
|
7439
|
+
<div class="muted market-status">${fw(o)}</div>
|
|
7394
7440
|
${l?c`<div
|
|
7395
7441
|
class="muted market-card-message ${l.kind==="error"?"danger":"success"}"
|
|
7396
7442
|
>
|
|
@@ -7400,23 +7446,23 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7400
7446
|
<div class="market-provider">
|
|
7401
7447
|
<span class="market-provider-prefix">by</span>
|
|
7402
7448
|
<span class="market-provider-name">
|
|
7403
|
-
@${
|
|
7449
|
+
@${pw(o.provider)}
|
|
7404
7450
|
</span>
|
|
7405
7451
|
</div>
|
|
7406
7452
|
<div class="market-metrics" aria-label="Skill popularity metrics">
|
|
7407
7453
|
<span class="market-metric">
|
|
7408
7454
|
<span class="market-metric-icon" aria-hidden="true">★</span>
|
|
7409
|
-
${
|
|
7455
|
+
${Pl(o.stars)}
|
|
7410
7456
|
</span>
|
|
7411
7457
|
<span class="market-metric">
|
|
7412
7458
|
<span class="market-metric-icon" aria-hidden="true">↓</span>
|
|
7413
|
-
${
|
|
7459
|
+
${Pl(o.downloads)}
|
|
7414
7460
|
</span>
|
|
7415
7461
|
</div>
|
|
7416
7462
|
</div>
|
|
7417
7463
|
<div class="market-actions">
|
|
7418
7464
|
<button
|
|
7419
|
-
class=${
|
|
7465
|
+
class=${dw(o)}
|
|
7420
7466
|
?disabled=${r}
|
|
7421
7467
|
@click=${()=>e.onAction(o.skillKey)}
|
|
7422
7468
|
>
|
|
@@ -7431,7 +7477,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7431
7477
|
</div>
|
|
7432
7478
|
`}
|
|
7433
7479
|
</section>
|
|
7434
|
-
`}function
|
|
7480
|
+
`}function Fl(e){return e?e.tone==="success"?"success":e.tone==="danger"?"danger":"info":""}function vw(e){const t=e.modelOptions.map(i=>({value:i.modelRef,label:i.label})),n=t.some(i=>i.value===e.selectedDefault)?e.selectedDefault:t[0]?.value??"",s=e.modelOptions.find(i=>i.modelRef===n)?.label??n;return c`
|
|
7435
7481
|
<section class="grid grid-cols-2">
|
|
7436
7482
|
<div class="card">
|
|
7437
7483
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -7475,7 +7521,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7475
7521
|
${e.defaultSaving?"Saving…":"Save Default"}
|
|
7476
7522
|
</button>
|
|
7477
7523
|
</div>
|
|
7478
|
-
${e.defaultState?c`<div class="callout ${
|
|
7524
|
+
${e.defaultState?c`<div class="callout ${Fl(e.defaultState)}" style="margin-top: 12px;">
|
|
7479
7525
|
${e.defaultState.message}
|
|
7480
7526
|
</div>`:h}
|
|
7481
7527
|
</div>
|
|
@@ -7585,7 +7631,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7585
7631
|
/>
|
|
7586
7632
|
</label>
|
|
7587
7633
|
</div>
|
|
7588
|
-
${e.verifyState?c`<div class="callout ${
|
|
7634
|
+
${e.verifyState?c`<div class="callout ${Fl(e.verifyState)}" style="margin-top: 12px;">
|
|
7589
7635
|
${e.verifyState.message}
|
|
7590
7636
|
</div>`:h}
|
|
7591
7637
|
<div class="row" style="margin-top: 16px; gap: 10px;">
|
|
@@ -7603,7 +7649,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7603
7649
|
<div class="callout info" style="margin-top: 12px">Select a provider to edit.</div>
|
|
7604
7650
|
`}
|
|
7605
7651
|
</section>
|
|
7606
|
-
`}function
|
|
7652
|
+
`}function xu(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach((i,o)=>{if(!i||typeof i!="object")return;const r=i,l=typeof r.id=="string"?r.id.trim():"";if(!l)return;const a=typeof r.name=="string"?r.name.trim():void 0,d=r.default===!0;s.push({id:l,name:a||void 0,isDefault:d,index:o,record:r})}),s}function wu(e,t){const n=new Set(t),s=[];for(const i of e){if(!(Array.isArray(i.commands)?i.commands:[]).some(d=>n.has(String(d))))continue;const l=typeof i.nodeId=="string"?i.nodeId.trim():"";if(!l)continue;const a=typeof i.displayName=="string"&&i.displayName.trim()?i.displayName.trim():l;s.push({id:l,label:a===l?l:`${a} · ${l}`})}return s.sort((i,o)=>i.label.localeCompare(o.label)),s}const xt="__defaults__",Nl=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],bw=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Ol(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function yw(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function $w(e){const t=e?.defaults??{};return{security:Ol(t.security),ask:yw(t.ask),askFallback:Ol(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function xw(e){return xu(e).map(t=>({id:t.id,name:t.name,isDefault:t.isDefault}))}function ww(e,t){const n=xw(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(r=>i.set(r.id,r)),s.forEach(r=>{i.has(r)||i.set(r,{id:r})});const o=Array.from(i.values());return o.length===0&&o.push({id:"main",isDefault:!0}),o.sort((r,l)=>{if(r.isDefault&&!l.isDefault)return-1;if(!r.isDefault&&l.isDefault)return 1;const a=r.name?.trim()?r.name:r.id,d=l.name?.trim()?l.name:l.id;return a.localeCompare(d)}),o}function Sw(e,t){return e===xt?xt:e&&t.some(n=>n.id===e)?e:xt}function kw(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=$w(t),i=ww(e.configForm,t),o=Rw(e.nodes),r=e.execApprovalsTarget;let l=r==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;r==="node"&&l&&!o.some(u=>u.id===l)&&(l=null);const a=Sw(e.execApprovalsSelectedAgent,i),d=a!==xt?(t?.agents??{})[a]??null:null,g=Array.isArray(d?.allowlist)?d.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:a,selectedAgent:d,agents:i,allowlist:g,target:r,targetNodeId:l,targetNodes:o,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function Aw(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return c`
|
|
7607
7653
|
<section class="card">
|
|
7608
7654
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
7609
7655
|
<div>
|
|
@@ -7621,12 +7667,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7621
7667
|
</button>
|
|
7622
7668
|
</div>
|
|
7623
7669
|
|
|
7624
|
-
${
|
|
7670
|
+
${Cw(e)}
|
|
7625
7671
|
|
|
7626
7672
|
${t?c`
|
|
7627
|
-
${
|
|
7628
|
-
${
|
|
7629
|
-
${e.selectedScope===xt?h:
|
|
7673
|
+
${Tw(e)}
|
|
7674
|
+
${Ew(e)}
|
|
7675
|
+
${e.selectedScope===xt?h:_w(e)}
|
|
7630
7676
|
`:c`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
7631
7677
|
<div class="muted">Load exec approvals to edit allowlists.</div>
|
|
7632
7678
|
<button class="btn" ?disabled=${e.loading||!n} @click=${e.onLoad}>
|
|
@@ -7634,7 +7680,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7634
7680
|
</button>
|
|
7635
7681
|
</div>`}
|
|
7636
7682
|
</section>
|
|
7637
|
-
`}function
|
|
7683
|
+
`}function Cw(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return c`
|
|
7638
7684
|
<div class="list" style="margin-top: 12px;">
|
|
7639
7685
|
<div class="list-item">
|
|
7640
7686
|
<div class="list-main">
|
|
@@ -7677,7 +7723,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7677
7723
|
<div class="muted">No nodes advertise exec approvals yet.</div>
|
|
7678
7724
|
`:h}
|
|
7679
7725
|
</div>
|
|
7680
|
-
`}function
|
|
7726
|
+
`}function Tw(e){return c`
|
|
7681
7727
|
<div class="row" style="margin-top: 12px; gap: 8px; flex-wrap: wrap;">
|
|
7682
7728
|
<span class="label">Scope</span>
|
|
7683
7729
|
<div class="row" style="gap: 8px; flex-wrap: wrap;">
|
|
@@ -7697,7 +7743,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7697
7743
|
`})}
|
|
7698
7744
|
</div>
|
|
7699
7745
|
</div>
|
|
7700
|
-
`}function
|
|
7746
|
+
`}function Ew(e){const t=e.selectedScope===xt,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],o=typeof s.security=="string"?s.security:void 0,r=typeof s.ask=="string"?s.ask:void 0,l=typeof s.askFallback=="string"?s.askFallback:void 0,a=t?n.security:o??"__default__",d=t?n.ask:r??"__default__",g=t?n.askFallback:l??"__default__",u=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,f=u??n.autoAllowSkills,v=u==null;return c`
|
|
7701
7747
|
<div class="list" style="margin-top: 16px;">
|
|
7702
7748
|
<div class="list-item">
|
|
7703
7749
|
<div class="list-main">
|
|
@@ -7716,7 +7762,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7716
7762
|
${t?h:c`<option value="__default__" ?selected=${a==="__default__"}>
|
|
7717
7763
|
Use default (${n.security})
|
|
7718
7764
|
</option>`}
|
|
7719
|
-
${
|
|
7765
|
+
${Nl.map(m=>c`<option
|
|
7720
7766
|
value=${m.value}
|
|
7721
7767
|
?selected=${a===m.value}
|
|
7722
7768
|
>
|
|
@@ -7744,7 +7790,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7744
7790
|
${t?h:c`<option value="__default__" ?selected=${d==="__default__"}>
|
|
7745
7791
|
Use default (${n.ask})
|
|
7746
7792
|
</option>`}
|
|
7747
|
-
${
|
|
7793
|
+
${bw.map(m=>c`<option
|
|
7748
7794
|
value=${m.value}
|
|
7749
7795
|
?selected=${d===m.value}
|
|
7750
7796
|
>
|
|
@@ -7772,7 +7818,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7772
7818
|
${t?h:c`<option value="__default__" ?selected=${g==="__default__"}>
|
|
7773
7819
|
Use default (${n.askFallback})
|
|
7774
7820
|
</option>`}
|
|
7775
|
-
${
|
|
7821
|
+
${Nl.map(m=>c`<option
|
|
7776
7822
|
value=${m.value}
|
|
7777
7823
|
?selected=${g===m.value}
|
|
7778
7824
|
>
|
|
@@ -7810,7 +7856,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7810
7856
|
</div>
|
|
7811
7857
|
</div>
|
|
7812
7858
|
</div>
|
|
7813
|
-
`}function
|
|
7859
|
+
`}function _w(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return c`
|
|
7814
7860
|
<div class="row" style="margin-top: 18px; justify-content: space-between;">
|
|
7815
7861
|
<div>
|
|
7816
7862
|
<div class="card-title">Allowlist</div>
|
|
@@ -7827,9 +7873,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7827
7873
|
<div class="list" style="margin-top: 12px;">
|
|
7828
7874
|
${n.length===0?c`
|
|
7829
7875
|
<div class="muted">No allowlist entries yet.</div>
|
|
7830
|
-
`:n.map((s,i)
|
|
7876
|
+
`:n.map((s,i)=>Iw(e,s,i))}
|
|
7831
7877
|
</div>
|
|
7832
|
-
`}function
|
|
7878
|
+
`}function Iw(e,t,n){const s=t.lastUsedAt?ne(t.lastUsedAt):"never",i=t.lastUsedCommand?so(t.lastUsedCommand,120):null,o=t.lastResolvedPath?so(t.lastResolvedPath,120):null;return c`
|
|
7833
7879
|
<div class="list-item">
|
|
7834
7880
|
<div class="list-main">
|
|
7835
7881
|
<div class="list-title">${t.pattern?.trim()?t.pattern:"New pattern"}</div>
|
|
@@ -7856,10 +7902,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7856
7902
|
</button>
|
|
7857
7903
|
</div>
|
|
7858
7904
|
</div>
|
|
7859
|
-
`}function
|
|
7860
|
-
${
|
|
7861
|
-
${
|
|
7862
|
-
${
|
|
7905
|
+
`}function Rw(e){return wu(e,["system.execApprovals.get","system.execApprovals.set"])}function Mw(e){const t=Nw(e),n=kw(e);return c`
|
|
7906
|
+
${Aw(n)}
|
|
7907
|
+
${Ow(t)}
|
|
7908
|
+
${Lw(e)}
|
|
7863
7909
|
<section class="card">
|
|
7864
7910
|
<div class="row" style="justify-content: space-between;">
|
|
7865
7911
|
<div>
|
|
@@ -7873,10 +7919,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7873
7919
|
<div class="list" style="margin-top: 16px;">
|
|
7874
7920
|
${e.nodes.length===0?c`
|
|
7875
7921
|
<div class="muted">No nodes found.</div>
|
|
7876
|
-
`:e.nodes.map(s=>
|
|
7922
|
+
`:e.nodes.map(s=>zw(s))}
|
|
7877
7923
|
</div>
|
|
7878
7924
|
</section>
|
|
7879
|
-
`}function
|
|
7925
|
+
`}function Lw(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],s=Array.isArray(t.paired)?t.paired:[];return c`
|
|
7880
7926
|
<section class="card">
|
|
7881
7927
|
<div class="row" style="justify-content: space-between;">
|
|
7882
7928
|
<div>
|
|
@@ -7891,18 +7937,18 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7891
7937
|
<div class="list" style="margin-top: 16px;">
|
|
7892
7938
|
${n.length>0?c`
|
|
7893
7939
|
<div class="muted" style="margin-bottom: 8px;">Pending</div>
|
|
7894
|
-
${n.map(i=>
|
|
7940
|
+
${n.map(i=>Dw(i,e))}
|
|
7895
7941
|
`:h}
|
|
7896
7942
|
${s.length>0?c`
|
|
7897
7943
|
<div class="muted" style="margin-top: 12px; margin-bottom: 8px;">Paired</div>
|
|
7898
|
-
${s.map(i=>
|
|
7944
|
+
${s.map(i=>Pw(i,e))}
|
|
7899
7945
|
`:h}
|
|
7900
7946
|
${n.length===0&&s.length===0?c`
|
|
7901
7947
|
<div class="muted">No paired devices.</div>
|
|
7902
7948
|
`:h}
|
|
7903
7949
|
</div>
|
|
7904
7950
|
</section>
|
|
7905
|
-
`}function
|
|
7951
|
+
`}function Dw(e,t){const n=e.displayName?.trim()||e.deviceId,s=typeof e.ts=="number"?ne(e.ts):"n/a",i=e.role?.trim()?`role: ${e.role}`:"role: -",o=e.isRepair?" · repair":"",r=e.remoteIp?` · ${e.remoteIp}`:"";return c`
|
|
7906
7952
|
<div class="list-item">
|
|
7907
7953
|
<div class="list-main">
|
|
7908
7954
|
<div class="list-title">${n}</div>
|
|
@@ -7922,7 +7968,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7922
7968
|
</div>
|
|
7923
7969
|
</div>
|
|
7924
7970
|
</div>
|
|
7925
|
-
`}function
|
|
7971
|
+
`}function Pw(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${no(e.roles)}`,o=`scopes: ${no(e.scopes)}`,r=Array.isArray(e.tokens)?e.tokens:[];return c`
|
|
7926
7972
|
<div class="list-item">
|
|
7927
7973
|
<div class="list-main">
|
|
7928
7974
|
<div class="list-title">${n}</div>
|
|
@@ -7933,12 +7979,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7933
7979
|
`:c`
|
|
7934
7980
|
<div class="muted" style="margin-top: 10px;">Tokens</div>
|
|
7935
7981
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 6px;">
|
|
7936
|
-
${r.map(l=>
|
|
7982
|
+
${r.map(l=>Fw(e.deviceId,l,t))}
|
|
7937
7983
|
</div>
|
|
7938
7984
|
`}
|
|
7939
7985
|
</div>
|
|
7940
7986
|
</div>
|
|
7941
|
-
`}function
|
|
7987
|
+
`}function Fw(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${no(t.scopes)}`,o=ne(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return c`
|
|
7942
7988
|
<div class="row" style="justify-content: space-between; gap: 8px;">
|
|
7943
7989
|
<div class="list-sub">${t.role} · ${s} · ${i} · ${o}</div>
|
|
7944
7990
|
<div class="row" style="justify-content: flex-end; gap: 6px; flex-wrap: wrap;">
|
|
@@ -7958,7 +8004,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7958
8004
|
`}
|
|
7959
8005
|
</div>
|
|
7960
8006
|
</div>
|
|
7961
|
-
`}function
|
|
8007
|
+
`}function Nw(e){const t=e.configForm,n=Bw(e.nodes),{defaultBinding:s,agents:i}=Hw(t),o=!!t,r=e.configSaving||e.configFormMode==="raw";return{ready:o,disabled:r,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 Ow(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return c`
|
|
7962
8008
|
<section class="card">
|
|
7963
8009
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
7964
8010
|
<div>
|
|
@@ -8013,7 +8059,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8013
8059
|
|
|
8014
8060
|
${e.agents.length===0?c`
|
|
8015
8061
|
<div class="muted">No agents found.</div>
|
|
8016
|
-
`:e.agents.map(s=>
|
|
8062
|
+
`:e.agents.map(s=>Uw(s,e))}
|
|
8017
8063
|
</div>
|
|
8018
8064
|
`:c`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
8019
8065
|
<div class="muted">Load config to edit bindings.</div>
|
|
@@ -8022,7 +8068,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8022
8068
|
</button>
|
|
8023
8069
|
</div>`}
|
|
8024
8070
|
</section>
|
|
8025
|
-
`}function
|
|
8071
|
+
`}function Uw(e,t){const n=e.binding??"__default__",s=e.name?.trim()?`${e.name} (${e.id})`:e.id,i=t.nodes.length>0;return c`
|
|
8026
8072
|
<div class="list-item">
|
|
8027
8073
|
<div class="list-main">
|
|
8028
8074
|
<div class="list-title">${s}</div>
|
|
@@ -8051,7 +8097,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8051
8097
|
</label>
|
|
8052
8098
|
</div>
|
|
8053
8099
|
</div>
|
|
8054
|
-
`}function
|
|
8100
|
+
`}function Bw(e){return wu(e,["system.run"])}function Hw(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,o=e.agents??{};if(!Array.isArray(o.list)||o.list.length===0)return{defaultBinding:i,agents:[t]};const r=xu(e).map(l=>{const d=(l.record.tools??{}).exec??{},g=typeof d.node=="string"&&d.node.trim()?d.node.trim():null;return{id:l.id,name:l.name,index:l.index,isDefault:l.isDefault,binding:g}});return r.length===0&&r.push(t),{defaultBinding:i,agents:r}}function zw(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:[],o=Array.isArray(e.commands)?e.commands:[];return c`
|
|
8055
8101
|
<div class="list-item">
|
|
8056
8102
|
<div class="list-main">
|
|
8057
8103
|
<div class="list-title">${s}</div>
|
|
@@ -8070,7 +8116,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8070
8116
|
</div>
|
|
8071
8117
|
</div>
|
|
8072
8118
|
</div>
|
|
8073
|
-
`}function
|
|
8119
|
+
`}function jw(e,t,n){return e||!t?!1:n===xe.PAIRING_REQUIRED?!0:t.toLowerCase().includes("pairing required")}function Kw(e){const t=e.hello?.snapshot,n=t?.uptimeMs?Ho(t.uptimeMs):p("common.na"),s=t?.policy?.tickIntervalMs?`${t.policy.tickIntervalMs}ms`:p("common.na"),o=t?.authMode==="trusted-proxy",r=jw(e.connected,e.lastError,e.lastErrorCode)?c`
|
|
8074
8120
|
<div class="muted" style="margin-top: 8px">
|
|
8075
8121
|
${p("overview.pairing.hint")}
|
|
8076
8122
|
<div style="margin-top: 6px">
|
|
@@ -8195,7 +8241,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8195
8241
|
.value=${d}
|
|
8196
8242
|
@change=${g=>{const u=g.target.value;Jn.setLocale(u),e.onSettingsChange({...e.settings,locale:u})}}
|
|
8197
8243
|
>
|
|
8198
|
-
${
|
|
8244
|
+
${Ql.map(g=>{const u=g.replace(/-([a-zA-Z])/g,(f,v)=>v.toUpperCase());return c`<option value=${g}>${p(`languages.${u}`)}</option>`})}
|
|
8199
8245
|
</select>
|
|
8200
8246
|
</label>
|
|
8201
8247
|
</div>
|
|
@@ -8260,7 +8306,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8260
8306
|
<div class="stat-value">
|
|
8261
8307
|
${e.cronEnabled==null?p("common.na"):e.cronEnabled?p("common.enabled"):p("common.disabled")}
|
|
8262
8308
|
</div>
|
|
8263
|
-
<div class="muted">${p("overview.stats.cronNext",{time:
|
|
8309
|
+
<div class="muted">${p("overview.stats.cronNext",{time:ur(e.cronNext)})}</div>
|
|
8264
8310
|
</div>
|
|
8265
8311
|
</section>
|
|
8266
8312
|
|
|
@@ -8284,7 +8330,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8284
8330
|
</div>
|
|
8285
8331
|
</div>
|
|
8286
8332
|
</section>
|
|
8287
|
-
`}const
|
|
8333
|
+
`}const Ww=["","off","minimal","low","medium","high","xhigh"],qw=["","off","on"],Gw=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"},{value:"full",label:"full"}],Vw=["","off","on","stream"];function Jw(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function Su(e){return Jw(e)==="zai"}function Qw(e){return Su(e)?qw:Ww}function Ul(e,t){return t?e.includes(t)?[...e]:[...e,t]:[...e]}function Yw(e,t){return t?e.some(n=>n.value===t)?[...e]:[...e,{value:t,label:`${t} (custom)`}]:[...e]}function Xw(e,t){return!t||!e||e==="off"?e:"on"}function Zw(e,t){return e?t&&e==="on"?"low":e:null}function e1(e){const t=e.result?.sessions??[];return c`
|
|
8288
8334
|
<section class="card">
|
|
8289
8335
|
<div class="row" style="justify-content: space-between;">
|
|
8290
8336
|
<div>
|
|
@@ -8349,10 +8395,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8349
8395
|
</div>
|
|
8350
8396
|
${t.length===0?c`
|
|
8351
8397
|
<div class="muted">No sessions found.</div>
|
|
8352
|
-
`:t.map(n=>
|
|
8398
|
+
`:t.map(n=>t1(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
|
|
8353
8399
|
</div>
|
|
8354
8400
|
</section>
|
|
8355
|
-
`}function
|
|
8401
|
+
`}function t1(e,t,n,s,i){const o=e.updatedAt?ne(e.updatedAt):"n/a",r=e.thinkingLevel??"",l=Su(e.modelProvider),a=Xw(r,l),d=Ul(Qw(e.modelProvider),a),g=e.verboseLevel??"",u=Yw(Gw,g),f=e.reasoningLevel??"",v=Ul(Vw,f),m=typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName.trim():null,S=typeof e.label=="string"?e.label.trim():"",T=!!(m&&m!==e.key&&m!==S),M=e.kind!=="global",I=M?`${li("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return c`
|
|
8356
8402
|
<div class="table-row">
|
|
8357
8403
|
<div class="mono session-key-cell">
|
|
8358
8404
|
${M?c`<a href=${I} class="session-link">${e.key}</a>`:e.key}
|
|
@@ -8368,11 +8414,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8368
8414
|
</div>
|
|
8369
8415
|
<div>${e.kind}</div>
|
|
8370
8416
|
<div>${o}</div>
|
|
8371
|
-
<div>${
|
|
8417
|
+
<div>${Rb(e)}</div>
|
|
8372
8418
|
<div>
|
|
8373
8419
|
<select
|
|
8374
8420
|
?disabled=${i}
|
|
8375
|
-
@change=${A=>{const w=A.target.value;n(e.key,{thinkingLevel:
|
|
8421
|
+
@change=${A=>{const w=A.target.value;n(e.key,{thinkingLevel:Zw(w,l)})}}
|
|
8376
8422
|
>
|
|
8377
8423
|
${d.map(A=>c`<option value=${A} ?selected=${a===A}>
|
|
8378
8424
|
${A||"inherit"}
|
|
@@ -8405,7 +8451,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8405
8451
|
</button>
|
|
8406
8452
|
</div>
|
|
8407
8453
|
</div>
|
|
8408
|
-
`}function
|
|
8454
|
+
`}function n1(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(o=>[o.name,o.description,o.source].join(" ").toLowerCase().includes(n)):t,i=Pd(s);return c`
|
|
8409
8455
|
<section class="card">
|
|
8410
8456
|
<div class="row" style="justify-content: space-between;">
|
|
8411
8457
|
<div>
|
|
@@ -8442,14 +8488,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8442
8488
|
<span class="muted">${o.skills.length}</span>
|
|
8443
8489
|
</summary>
|
|
8444
8490
|
<div class="list skills-grid">
|
|
8445
|
-
${o.skills.map(l=>
|
|
8491
|
+
${o.skills.map(l=>s1(l,e))}
|
|
8446
8492
|
</div>
|
|
8447
8493
|
</details>
|
|
8448
8494
|
`})}
|
|
8449
8495
|
</div>
|
|
8450
8496
|
`}
|
|
8451
8497
|
</section>
|
|
8452
|
-
`}function
|
|
8498
|
+
`}function s1(e,t){const n=t.busyKey===e.skillKey,s=t.edits[e.skillKey]??"",i=t.messages[e.skillKey]??null,o=e.install.length>0&&e.missing.bins.length>0,r=!!(e.bundled&&e.source!=="openclaw-bundled"),l=Fd(e),a=Nd(e);return c`
|
|
8453
8499
|
<div class="list-item">
|
|
8454
8500
|
<div class="list-main">
|
|
8455
8501
|
<div class="list-title">
|
|
@@ -8511,7 +8557,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8511
8557
|
`:h}
|
|
8512
8558
|
</div>
|
|
8513
8559
|
</div>
|
|
8514
|
-
`}const
|
|
8560
|
+
`}const i1=["off","minimal","low","medium","high"],o1=["UTC","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","Europe/London","Europe/Berlin","Asia/Tokyo"],r1=new Set(["chat","overview","market","models"]);function a1(e){return/^https?:\/\//i.test(e.trim())}function Yi(e){return typeof e=="string"?e.trim():""}function Bl(e){const t=new Set,n=[];for(const s of e){const i=s.trim();if(!i)continue;const o=i.toLowerCase();t.has(o)||(t.add(o),n.push(i))}return n}function l1(e){const t=typeof e.hello?.server?.version=="string"&&e.hello.server.version.trim()||e.updateAvailable?.currentVersion||p("common.na"),n=e.updateAvailable&&e.updateAvailable.latestVersion!==e.updateAvailable.currentVersion?e.updateAvailable:null,s=n?"warn":"ok",i=e.presenceEntries.length,o=e.sessionsResult?.count??null,r=e.cronStatus?.nextWakeAtMs??null,l=e.connected?null:p("chat.disconnected"),a=e.tab==="chat",d=a&&(e.settings.chatFocusMode||e.onboarding),g=e.onboarding?!1:e.settings.chatShowThinking,u=e.configForm??e.configSnapshot?.config,f=u?.bitseek?.advancedMode===!0,v=async()=>{if(!e.client||!e.connected||e.configSaving||!e.configSnapshot?.hash&&(await Ae(e),!e.configSnapshot?.hash))return;!f?Re(e,["bitseek","advancedMode"],!0):qe(e,["bitseek","advancedMode"]),await On(e)},m=Xt(e.basePath??""),S=m?`${m}/brand.png`:"/brand.png",T=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null,M=bo(new Set([...e.agentsList?.agents?.map(b=>b.id.trim())??[],...e.cronJobs.map(b=>typeof b.agentId=="string"?b.agentId.trim():"").filter(Boolean)].filter(Boolean))),I=bo(new Set([...e.cronModelSuggestions,...wb(u),...e.cronJobs.map(b=>b.payload.kind!=="agentTurn"||typeof b.payload.model!="string"?"":b.payload.model.trim()).filter(Boolean)].filter(Boolean))),A=sf(e),w=e.cronForm.deliveryChannel&&e.cronForm.deliveryChannel.trim()?e.cronForm.deliveryChannel.trim():"last",L=e.cronJobs.map(b=>Yi(b.delivery?.to)).filter(Boolean),E=(w==="last"?Object.values(e.channelsSnapshot?.channelAccounts??{}).flat():e.channelsSnapshot?.channelAccounts?.[w]??[]).flatMap(b=>[Yi(b.accountId),Yi(b.name)]).filter(Boolean),R=Bl([...L,...E]),K=Bl(E),G=e.cronForm.deliveryMode==="webhook"?R.filter(b=>a1(b)):R;return c`
|
|
8515
8561
|
<div class="shell ${a?"shell--chat":""} ${d?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
|
|
8516
8562
|
<header class="topbar">
|
|
8517
8563
|
<div class="topbar-left">
|
|
@@ -8521,7 +8567,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8521
8567
|
title="${e.settings.navCollapsed?p("nav.expand"):p("nav.collapse")}"
|
|
8522
8568
|
aria-label="${e.settings.navCollapsed?p("nav.expand"):p("nav.collapse")}"
|
|
8523
8569
|
>
|
|
8524
|
-
<span class="nav-collapse-toggle__icon">${
|
|
8570
|
+
<span class="nav-collapse-toggle__icon">${pe.menu}</span>
|
|
8525
8571
|
</button>
|
|
8526
8572
|
<div class="brand">
|
|
8527
8573
|
<div class="brand-logo">
|
|
@@ -8557,11 +8603,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8557
8603
|
<span>Advanced</span>
|
|
8558
8604
|
<span class="mono">${f?"ON":"OFF"}</span>
|
|
8559
8605
|
</button>
|
|
8560
|
-
${
|
|
8606
|
+
${eb(e)}
|
|
8561
8607
|
</div>
|
|
8562
8608
|
</header>
|
|
8563
8609
|
<aside class="nav ${e.settings.navCollapsed?"nav--collapsed":""}">
|
|
8564
|
-
${
|
|
8610
|
+
${Gp.map(b=>{const C=f?b.tabs:b.tabs.filter(V=>r1.has(V));if(C.length===0)return h;const N=e.settings.navGroupsCollapsed[b.label]??!1,W=C.some(V=>V===e.tab);return c`
|
|
8565
8611
|
<div class="nav-group ${N&&!W?"nav-group--collapsed":""}">
|
|
8566
8612
|
<button
|
|
8567
8613
|
class="nav-label"
|
|
@@ -8572,7 +8618,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8572
8618
|
<span class="nav-label__chevron">${N?"+":"−"}</span>
|
|
8573
8619
|
</button>
|
|
8574
8620
|
<div class="nav-group__items">
|
|
8575
|
-
${C.map(V=>
|
|
8621
|
+
${C.map(V=>Wv(e,V))}
|
|
8576
8622
|
</div>
|
|
8577
8623
|
</div>
|
|
8578
8624
|
`})}
|
|
@@ -8588,7 +8634,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8588
8634
|
rel=${un()}
|
|
8589
8635
|
title="${p("common.docs")} (opens in new tab)"
|
|
8590
8636
|
>
|
|
8591
|
-
<span class="nav-item__icon" aria-hidden="true">${
|
|
8637
|
+
<span class="nav-item__icon" aria-hidden="true">${pe.book}</span>
|
|
8592
8638
|
<span class="nav-item__text">${p("common.docs")}</span>
|
|
8593
8639
|
</a>
|
|
8594
8640
|
</div>
|
|
@@ -8601,54 +8647,54 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8601
8647
|
<button
|
|
8602
8648
|
class="btn btn--sm update-banner__btn"
|
|
8603
8649
|
?disabled=${e.updateRunning||!e.connected}
|
|
8604
|
-
@click=${()=>
|
|
8650
|
+
@click=${()=>ea(e)}
|
|
8605
8651
|
>${e.updateRunning?"Updating…":"Update now"}</button>
|
|
8606
8652
|
</div>`:h}
|
|
8607
8653
|
<section class="content-header">
|
|
8608
8654
|
<div>
|
|
8609
8655
|
${e.tab==="usage"?h:c`<div class="page-title">${go(e.tab)}</div>`}
|
|
8610
|
-
${e.tab==="usage"?h:c`<div class="page-sub">${
|
|
8656
|
+
${e.tab==="usage"?h:c`<div class="page-sub">${Jp(e.tab)}</div>`}
|
|
8611
8657
|
</div>
|
|
8612
8658
|
<div class="page-meta">
|
|
8613
8659
|
${e.lastError?c`<div class="pill danger">${e.lastError}</div>`:h}
|
|
8614
|
-
${a?
|
|
8660
|
+
${a?Gv(e):h}
|
|
8615
8661
|
</div>
|
|
8616
8662
|
</section>
|
|
8617
8663
|
|
|
8618
|
-
${e.tab==="overview"?
|
|
8664
|
+
${e.tab==="overview"?Kw({connected:e.connected,hello:e.hello,settings:e.settings,password:e.password,lastError:e.lastError,lastErrorCode:e.lastErrorCode,presenceCount:i,sessionsCount:o,cronEnabled:e.cronStatus?.enabled??null,cronNext:r,lastChannelsRefresh:e.channelsLastSuccess,onSettingsChange:b=>e.applySettings(b),onPasswordChange:b=>e.password=b,onSessionKeyChange:b=>{e.sessionKey=b,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:b,lastActiveSessionKey:b}),e.loadAssistantIdentity()},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):h}
|
|
8619
8665
|
|
|
8620
|
-
${e.tab==="channels"?
|
|
8666
|
+
${e.tab==="channels"?Ry({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:b=>Me(e,b),onWhatsAppStart:b=>e.handleWhatsAppStart(b),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(b,C)=>Re(e,b,C),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(b,C)=>e.handleNostrProfileEdit(b,C),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(b,C)=>e.handleNostrProfileFieldChange(b,C),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):h}
|
|
8621
8667
|
|
|
8622
|
-
${e.tab==="instances"?
|
|
8668
|
+
${e.tab==="instances"?nw({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>nr(e)}):h}
|
|
8623
8669
|
|
|
8624
|
-
${e.tab==="sessions"?
|
|
8670
|
+
${e.tab==="sessions"?e1({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:b=>{e.sessionsFilterActive=b.activeMinutes,e.sessionsFilterLimit=b.limit,e.sessionsIncludeGlobal=b.includeGlobal,e.sessionsIncludeUnknown=b.includeUnknown},onRefresh:()=>Yt(e),onPatch:(b,C)=>Bp(e,b,C),onDelete:b=>zp(e,b)}):h}
|
|
8625
8671
|
|
|
8626
|
-
${
|
|
8672
|
+
${Nv(e)}
|
|
8627
8673
|
|
|
8628
|
-
${e.tab==="cron"?
|
|
8674
|
+
${e.tab==="cron"?jx({basePath:e.basePath,loading:e.cronLoading,jobsLoadingMore:e.cronJobsLoadingMore,status:e.cronStatus,jobs:A,jobsTotal:e.cronJobsTotal,jobsHasMore:e.cronJobsHasMore,jobsQuery:e.cronJobsQuery,jobsEnabledFilter:e.cronJobsEnabledFilter,jobsScheduleKindFilter:e.cronJobsScheduleKindFilter,jobsLastStatusFilter:e.cronJobsLastStatusFilter,jobsSortBy:e.cronJobsSortBy,jobsSortDir:e.cronJobsSortDir,error:e.cronError,busy:e.cronBusy,form:e.cronForm,fieldErrors:e.cronFieldErrors,canSubmit:!pc(e.cronFieldErrors),editingJobId:e.cronEditingJobId,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(b=>b.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,runsTotal:e.cronRunsTotal,runsHasMore:e.cronRunsHasMore,runsLoadingMore:e.cronRunsLoadingMore,runsScope:e.cronRunsScope,runsStatuses:e.cronRunsStatuses,runsDeliveryStatuses:e.cronRunsDeliveryStatuses,runsStatusFilter:e.cronRunsStatusFilter,runsQuery:e.cronRunsQuery,runsSortDir:e.cronRunsSortDir,agentSuggestions:M,modelSuggestions:I,thinkingSuggestions:i1,timezoneSuggestions:o1,deliveryToSuggestions:G,accountSuggestions:K,onFormChange:b=>{e.cronForm=zo({...e.cronForm,...b}),e.cronFieldErrors=ns(e.cronForm)},onRefresh:()=>e.loadCron(),onAdd:()=>uf(e),onEdit:b=>mf(e,b),onClone:b=>bf(e,b),onCancelEdit:()=>yf(e),onToggle:(b,C)=>gf(e,b,C),onRun:(b,C)=>ff(e,b,C??"force"),onRemove:b=>pf(e,b),onLoadRuns:async b=>{ra(e,{cronRunsScope:"job"}),await yt(e,b)},onLoadMoreJobs:()=>nf(e),onJobsFiltersChange:async b=>{oa(e,b),(typeof b.cronJobsQuery=="string"||b.cronJobsEnabledFilter||b.cronJobsSortBy||b.cronJobsSortDir)&&await ia(e)},onJobsFiltersReset:async()=>{oa(e,{cronJobsQuery:"",cronJobsEnabledFilter:"all",cronJobsScheduleKindFilter:"all",cronJobsLastStatusFilter:"all",cronJobsSortBy:"nextRunAtMs",cronJobsSortDir:"asc"}),await ia(e)},onLoadMoreRuns:()=>hf(e),onRunsFiltersChange:async b=>{if(ra(e,b),e.cronRunsScope==="all"){await yt(e,null);return}await yt(e,e.cronRunsJobId)}}):h}
|
|
8629
8675
|
|
|
8630
|
-
${e.tab==="agents"?
|
|
8676
|
+
${e.tab==="agents"?Vb({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:T,activePanel:e.agentsPanel,configForm:u,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,toolsCatalogLoading:e.toolsCatalogLoading,toolsCatalogError:e.toolsCatalogError,toolsCatalogResult:e.toolsCatalogResult,skillsFilter:e.skillsFilter,onRefresh:async()=>{await Uo(e);const b=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null;await Hn(e,b);const C=e.agentsList?.agents?.map(N=>N.id)??[];C.length>0&&gc(e,C)},onSelectAgent:b=>{e.agentsSelectedId!==b&&(e.agentsSelectedId=b,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,uc(e,b),e.agentsPanel==="tools"&&Hn(e,b),e.agentsPanel==="files"&&Ui(e,b),e.agentsPanel==="skills"&&Cs(e,b))},onSelectPanel:b=>{e.agentsPanel=b,b==="files"&&T&&e.agentFilesList?.agentId!==T&&(e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},Ui(e,T)),b==="tools"&&Hn(e,T),b==="skills"&&T&&Cs(e,T),b==="channels"&&Me(e,!1),b==="cron"&&e.loadCron()},onLoadFiles:b=>Ui(e,b),onSelectFile:b=>{e.agentFileActive=b,T&&ib(e,T,b)},onFileDraftChange:(b,C)=>{e.agentFileDrafts={...e.agentFileDrafts,[b]:C}},onFileReset:b=>{const C=e.agentFileContents[b]??"";e.agentFileDrafts={...e.agentFileDrafts,[b]:C}},onFileSave:b=>{if(!T)return;const C=e.agentFileDrafts[b]??e.agentFileContents[b]??"";ob(e,T,b,C)},onToolsProfileChange:(b,C,N)=>{if(!u)return;const W=u.agents?.list;if(!Array.isArray(W))return;const V=W.findIndex(O=>O&&typeof O=="object"&&"id"in O&&O.id===b);if(V<0)return;const _=["agents","list",V,"tools"];C?Re(e,[..._,"profile"],C):qe(e,[..._,"profile"]),N&&qe(e,[..._,"allow"])},onToolsOverridesChange:(b,C,N)=>{if(!u)return;const W=u.agents?.list;if(!Array.isArray(W))return;const V=W.findIndex(O=>O&&typeof O=="object"&&"id"in O&&O.id===b);if(V<0)return;const _=["agents","list",V,"tools"];C.length>0?Re(e,[..._,"alsoAllow"],C):qe(e,[..._,"alsoAllow"]),N.length>0?Re(e,[..._,"deny"],N):qe(e,[..._,"deny"])},onConfigReload:()=>Ae(e),onConfigSave:()=>On(e),onChannelsRefresh:()=>Me(e,!1),onCronRefresh:()=>e.loadCron(),onSkillsFilterChange:b=>e.skillsFilter=b,onSkillsRefresh:()=>{T&&Cs(e,T)},onAgentSkillToggle:(b,C,N)=>{if(!u)return;const W=u.agents?.list;if(!Array.isArray(W))return;const V=W.findIndex(F=>F&&typeof F=="object"&&"id"in F&&F.id===b);if(V<0)return;const _=W[V],O=C.trim();if(!O)return;const q=e.agentSkillsReport?.skills?.map(F=>F.name).filter(Boolean)??[],re=(Array.isArray(_.skills)?_.skills.map(F=>String(F).trim()).filter(Boolean):void 0)??q,D=new Set(re);N?D.add(O):D.delete(O),Re(e,["agents","list",V,"skills"],[...D])},onAgentSkillsClear:b=>{if(!u)return;const C=u.agents?.list;if(!Array.isArray(C))return;const N=C.findIndex(W=>W&&typeof W=="object"&&"id"in W&&W.id===b);N<0||qe(e,["agents","list",N,"skills"])},onAgentSkillsDisableAll:b=>{if(!u)return;const C=u.agents?.list;if(!Array.isArray(C))return;const N=C.findIndex(W=>W&&typeof W=="object"&&"id"in W&&W.id===b);N<0||Re(e,["agents","list",N,"skills"],[])},onModelChange:(b,C)=>{if(!u)return;const N=u.agents?.list;if(!Array.isArray(N))return;const W=N.findIndex(q=>q&&typeof q=="object"&&"id"in q&&q.id===b);if(W<0)return;const V=["agents","list",W,"model"];if(!C){qe(e,V);return}const O=N[W]?.model;if(O&&typeof O=="object"&&!Array.isArray(O)){const q=O.fallbacks,oe={primary:C,...Array.isArray(q)?{fallbacks:q}:{}};Re(e,V,oe)}else Re(e,V,C)},onModelFallbacksChange:(b,C)=>{if(!u)return;const N=u.agents?.list;if(!Array.isArray(N))return;const W=N.findIndex(F=>F&&typeof F=="object"&&"id"in F&&F.id===b);if(W<0)return;const V=["agents","list",W,"model"],_=N[W],O=C.map(F=>F.trim()).filter(Boolean),q=_.model,re=(()=>{if(typeof q=="string")return q.trim()||null;if(q&&typeof q=="object"&&!Array.isArray(q)){const F=q.primary;if(typeof F=="string")return F.trim()||null}return null})();if(O.length===0){re?Re(e,V,re):qe(e,V);return}Re(e,V,re?{primary:re,fallbacks:O}:{fallbacks:O})}}):h}
|
|
8631
8677
|
|
|
8632
|
-
${e.tab==="skills"?
|
|
8678
|
+
${e.tab==="skills"?n1({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:b=>e.skillsFilter=b,onRefresh:()=>rs(e,{clearMessages:!0}),onToggle:(b,C)=>Kp(e,b,C),onEdit:(b,C)=>jp(e,b,C),onSaveKey:b=>Wp(e,b),onInstall:(b,C,N)=>qp(e,b,C,N)}):h}
|
|
8633
8679
|
|
|
8634
|
-
${e.tab==="market"?
|
|
8680
|
+
${e.tab==="market"?mw({loading:e.marketLoading,catalog:e.marketCatalog,error:e.marketError,filter:e.marketFilter,busyKey:e.marketBusyKey,messages:e.marketMessages,onFilterChange:b=>e.marketFilter=b,onRefresh:()=>Xo(e),onAction:b=>rp(e,b)}):h}
|
|
8635
8681
|
|
|
8636
|
-
${e.tab==="nodes"?
|
|
8682
|
+
${e.tab==="nodes"?Mw({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:()=>ni(e),onDevicesRefresh:()=>Et(e),onDeviceApprove:b=>Qf(e,b),onDeviceReject:b=>Yf(e,b),onDeviceRotate:(b,C,N)=>Xf(e,{deviceId:b,role:C,scopes:N}),onDeviceRevoke:(b,C)=>Zf(e,{deviceId:b,role:C}),onLoadConfig:()=>Ae(e),onLoadExecApprovals:()=>{const b=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Yo(e,b)},onBindDefault:b=>{b?Re(e,["tools","exec","node"],b):qe(e,["tools","exec","node"])},onBindAgent:(b,C)=>{const N=["agents","list",b,"tools","exec","node"];C?Re(e,N,C):qe(e,N)},onSaveBindings:()=>On(e),onExecApprovalsTargetChange:(b,C)=>{e.execApprovalsTarget=b,e.execApprovalsTargetNodeId=C,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:b=>{e.execApprovalsSelectedAgent=b},onExecApprovalsPatch:(b,C)=>ip(e,b,C),onExecApprovalsRemove:b=>op(e,b),onSaveExecApprovals:()=>{const b=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return sp(e,b)}}):h}
|
|
8637
8683
|
|
|
8638
|
-
${e.tab==="chat"?
|
|
8684
|
+
${e.tab==="chat"?Cx({sessionKey:e.sessionKey,onSessionKeyChange:b=>{e.sessionKey=b,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatBitSeekTopUpPrompt=null,e.chatBitSeekTopUpLastRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:b,lastActiveSessionKey:b}),e.loadAssistantIdentity(),gi(e),fd(e)},thinkingLevel:e.chatThinkingLevel,showThinking:g,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,fallbackStatus:e.fallbackStatus,brandAvatarUrl:S,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,bitSeekTopUpPrompt:e.chatBitSeekTopUpPrompt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:d,onDismissBitSeekTopUpPrompt:()=>qh(e),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:b=>e.handleChatScroll(b),onDraftChange:b=>e.chatMessage=b,attachments:e.chatAttachments,onAttachmentsChange:b=>e.chatAttachments=b,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:b=>e.removeQueuedMessage(b),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:b=>e.handleOpenSidebar(b),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:b=>e.handleSplitRatioChange(b),assistantName:e.assistantName}):h}
|
|
8639
8685
|
|
|
8640
|
-
${e.tab==="models"?
|
|
8686
|
+
${e.tab==="models"?vw({loading:e.modelsLoading,saving:e.modelsSaving,defaultSaving:e.modelsDefaultSaving,verifyBusy:e.modelsVerifyBusy,error:e.modelsError,providers:e.modelsProviders,modelOptions:e.modelsSwitchableModels,selectedProviderId:e.modelsSelectedProviderId,selectedDefault:e.modelsSelectedDefault,draft:e.modelsDraft,defaultState:e.modelsDefaultState,verifyState:e.modelsVerifyState,onReload:()=>zc(e),onSelectProvider:b=>ha(e,b),onAddProvider:()=>ha(e,Up()),onDraftChange:(b,C)=>Lp(e,b,C),onDefaultChange:b=>Op(e,b),onSaveDefault:()=>Pp(e),onVerify:()=>Np(e),onSave:()=>Dp(e),onDelete:()=>Fp(e)}):h}
|
|
8641
8687
|
|
|
8642
|
-
${e.tab==="config"?
|
|
8688
|
+
${e.tab==="config"?Px({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:b=>{e.configRaw=b},onFormModeChange:b=>e.configFormMode=b,onFormPatch:(b,C)=>Re(e,b,C),onSearchChange:b=>e.configSearchQuery=b,onSectionChange:b=>{e.configActiveSection=b,e.configActiveSubsection=null},onSubsectionChange:b=>e.configActiveSubsection=b,onReload:()=>Ae(e),onSave:()=>On(e),onApply:()=>mg(e),onUpdate:()=>ea(e)}):h}
|
|
8643
8689
|
|
|
8644
|
-
${e.tab==="debug"?
|
|
8690
|
+
${e.tab==="debug"?Xx({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:b=>e.debugCallMethod=b,onCallParamsChange:b=>e.debugCallParams=b,onRefresh:()=>ti(e),onCall:()=>Og(e)}):h}
|
|
8645
8691
|
|
|
8646
|
-
${e.tab==="logs"?
|
|
8692
|
+
${e.tab==="logs"?rw({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:b=>e.logsFilterText=b,onLevelToggle:(b,C)=>{e.logsLevelFilters={...e.logsLevelFilters,[b]:C}},onToggleAutoFollow:b=>e.logsAutoFollow=b,onRefresh:()=>Oo(e,{reset:!0}),onExport:(b,C)=>e.exportLogs(b,C),onScroll:b=>e.handleLogsScroll(b)}):h}
|
|
8647
8693
|
</main>
|
|
8648
|
-
${
|
|
8649
|
-
${
|
|
8694
|
+
${ew(e)}
|
|
8695
|
+
${tw(e)}
|
|
8650
8696
|
</div>
|
|
8651
|
-
`}var
|
|
8697
|
+
`}var c1=Object.defineProperty,d1=Object.getOwnPropertyDescriptor,$=(e,t,n,s)=>{for(var i=s>1?void 0:s?d1(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(i=(s?r(t,n,i):r(i))||i);return s&&i&&c1(t,n,i),i};const Xi=ir({});function u1(){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 mn{constructor(){super(),this.i18nController=new cg(this),this.clientInstanceId=ui(),this.settings=Qp(),this.password="",this.tab="chat",this.onboarding=u1(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="light",this.hello=null,this.lastError=null,this.lastErrorCode=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=Xi.name,this.assistantAvatar=Xi.avatar,this.assistantAgentId=Xi.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.chatBitSeekTopUpPrompt=null,this.compactionStatus=null,this.fallbackStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.chatManualRefreshInFlight=!1,this.chatBitSeekTopUpLastRunId=null,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=`{
|
|
8652
8698
|
}
|
|
8653
|
-
`,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.modelsLoading=!1,this.modelsSaving=!1,this.modelsDefaultSaving=!1,this.modelsVerifyBusy=!1,this.modelsError=null,this.modelsProviders=[],this.modelsSwitchableModels=[],this.modelsSelectedProviderId=null,this.modelsSelectedDefault="",this.modelsDraft=null,this.modelsDefaultState=null,this.modelsVerifyState=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.toolsCatalogLoading=!1,this.toolsCatalogError=null,this.toolsCatalogResult=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.sessionsHideCron=!0,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.usageTimeSeriesCursorStart=null,this.usageTimeSeriesCursorEnd=null,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.cronJobsLoadingMore=!1,this.cronJobs=[],this.cronJobsTotal=0,this.cronJobsHasMore=!1,this.cronJobsNextOffset=null,this.cronJobsLimit=50,this.cronJobsQuery="",this.cronJobsEnabledFilter="all",this.cronJobsScheduleKindFilter="all",this.cronJobsLastStatusFilter="all",this.cronJobsSortBy="nextRunAtMs",this.cronJobsSortDir="asc",this.cronStatus=null,this.cronError=null,this.cronForm={...Ns},this.cronFieldErrors={},this.cronEditingJobId=null,this.cronRunsJobId=null,this.cronRunsLoadingMore=!1,this.cronRuns=[],this.cronRunsTotal=0,this.cronRunsHasMore=!1,this.cronRunsNextOffset=null,this.cronRunsLimit=50,this.cronRunsScope="all",this.cronRunsStatuses=[],this.cronRunsDeliveryStatuses=[],this.cronRunsStatusFilter="all",this.cronRunsQuery="",this.cronRunsSortDir="desc",this.cronModelSuggestions=[],this.cronBusy=!1,this.updateAvailable=null,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.marketLoading=!1,this.marketCatalog=[],this.marketError=null,this.marketFilter="",this.marketBusyKey=null,this.marketMessages={},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={...Wg},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=()=>lh(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,Xl(this.settings.locale)&&Jn.setLocale(this.settings.locale)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),mm(this)}firstUpdated(){vm(this)}disconnectedCallback(){bm(this),super.disconnectedCallback()}updated(e){ym(this,e)}connect(){vd(this)}handleChatScroll(e){Lg(this,e)}handleLogsScroll(e){Dg(this,e)}exportLogs(e,t){Pg(e,t)}resetToolStream(){ui(this)}resetChatScroll(){na(this)}scrollToBottom(e){na(this),ns(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await pd(this)}applySettings(e){At(this,e)}setTab(e){th(this,e)}setTheme(e,t){nh(this,e,t)}async loadOverview(){await ed(this)}async loadCron(){await js(this)}async handleAbortChat(){await dd(this)}removeQueuedMessage(e){Wh(this,e)}async handleSendChat(e,t){await qh(this,e,t)}async handleWhatsAppStart(e){await yg(this,e)}async handleWhatsAppWait(){await $g(this)}async handleWhatsAppLogout(){await xg(this)}async handleChannelConfigSave(){await wg(this)}async handleChannelConfigReload(){await Sg(this)}handleNostrProfileEdit(e,t){Cg(this,e,t)}handleNostrProfileCancel(){Tg(this)}handleNostrProfileFieldChange(e,t){Eg(this,e,t)}async handleNostrProfileSave(){await Ig(this)}async handleNostrProfileImport(){await Rg(this)}handleNostrProfileToggleAdvanced(){_g(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,At(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 Xw(this)}};$([x()],y.prototype,"settings",2);$([x()],y.prototype,"password",2);$([x()],y.prototype,"tab",2);$([x()],y.prototype,"onboarding",2);$([x()],y.prototype,"connected",2);$([x()],y.prototype,"theme",2);$([x()],y.prototype,"themeResolved",2);$([x()],y.prototype,"hello",2);$([x()],y.prototype,"lastError",2);$([x()],y.prototype,"lastErrorCode",2);$([x()],y.prototype,"eventLog",2);$([x()],y.prototype,"assistantName",2);$([x()],y.prototype,"assistantAvatar",2);$([x()],y.prototype,"assistantAgentId",2);$([x()],y.prototype,"sessionKey",2);$([x()],y.prototype,"chatLoading",2);$([x()],y.prototype,"chatSending",2);$([x()],y.prototype,"chatMessage",2);$([x()],y.prototype,"chatMessages",2);$([x()],y.prototype,"chatToolMessages",2);$([x()],y.prototype,"chatStream",2);$([x()],y.prototype,"chatStreamStartedAt",2);$([x()],y.prototype,"chatRunId",2);$([x()],y.prototype,"compactionStatus",2);$([x()],y.prototype,"fallbackStatus",2);$([x()],y.prototype,"chatAvatarUrl",2);$([x()],y.prototype,"chatThinkingLevel",2);$([x()],y.prototype,"chatQueue",2);$([x()],y.prototype,"chatAttachments",2);$([x()],y.prototype,"chatManualRefreshInFlight",2);$([x()],y.prototype,"sidebarOpen",2);$([x()],y.prototype,"sidebarContent",2);$([x()],y.prototype,"sidebarError",2);$([x()],y.prototype,"splitRatio",2);$([x()],y.prototype,"nodesLoading",2);$([x()],y.prototype,"nodes",2);$([x()],y.prototype,"devicesLoading",2);$([x()],y.prototype,"devicesError",2);$([x()],y.prototype,"devicesList",2);$([x()],y.prototype,"execApprovalsLoading",2);$([x()],y.prototype,"execApprovalsSaving",2);$([x()],y.prototype,"execApprovalsDirty",2);$([x()],y.prototype,"execApprovalsSnapshot",2);$([x()],y.prototype,"execApprovalsForm",2);$([x()],y.prototype,"execApprovalsSelectedAgent",2);$([x()],y.prototype,"execApprovalsTarget",2);$([x()],y.prototype,"execApprovalsTargetNodeId",2);$([x()],y.prototype,"execApprovalQueue",2);$([x()],y.prototype,"execApprovalBusy",2);$([x()],y.prototype,"execApprovalError",2);$([x()],y.prototype,"pendingGatewayUrl",2);$([x()],y.prototype,"configLoading",2);$([x()],y.prototype,"configRaw",2);$([x()],y.prototype,"configRawOriginal",2);$([x()],y.prototype,"configValid",2);$([x()],y.prototype,"configIssues",2);$([x()],y.prototype,"configSaving",2);$([x()],y.prototype,"configApplying",2);$([x()],y.prototype,"updateRunning",2);$([x()],y.prototype,"applySessionKey",2);$([x()],y.prototype,"configSnapshot",2);$([x()],y.prototype,"configSchema",2);$([x()],y.prototype,"configSchemaVersion",2);$([x()],y.prototype,"configSchemaLoading",2);$([x()],y.prototype,"configUiHints",2);$([x()],y.prototype,"configForm",2);$([x()],y.prototype,"configFormOriginal",2);$([x()],y.prototype,"configFormDirty",2);$([x()],y.prototype,"configFormMode",2);$([x()],y.prototype,"configSearchQuery",2);$([x()],y.prototype,"configActiveSection",2);$([x()],y.prototype,"configActiveSubsection",2);$([x()],y.prototype,"modelsLoading",2);$([x()],y.prototype,"modelsSaving",2);$([x()],y.prototype,"modelsDefaultSaving",2);$([x()],y.prototype,"modelsVerifyBusy",2);$([x()],y.prototype,"modelsError",2);$([x()],y.prototype,"modelsProviders",2);$([x()],y.prototype,"modelsSwitchableModels",2);$([x()],y.prototype,"modelsSelectedProviderId",2);$([x()],y.prototype,"modelsSelectedDefault",2);$([x()],y.prototype,"modelsDraft",2);$([x()],y.prototype,"modelsDefaultState",2);$([x()],y.prototype,"modelsVerifyState",2);$([x()],y.prototype,"channelsLoading",2);$([x()],y.prototype,"channelsSnapshot",2);$([x()],y.prototype,"channelsError",2);$([x()],y.prototype,"channelsLastSuccess",2);$([x()],y.prototype,"whatsappLoginMessage",2);$([x()],y.prototype,"whatsappLoginQrDataUrl",2);$([x()],y.prototype,"whatsappLoginConnected",2);$([x()],y.prototype,"whatsappBusy",2);$([x()],y.prototype,"nostrProfileFormState",2);$([x()],y.prototype,"nostrProfileAccountId",2);$([x()],y.prototype,"presenceLoading",2);$([x()],y.prototype,"presenceEntries",2);$([x()],y.prototype,"presenceError",2);$([x()],y.prototype,"presenceStatus",2);$([x()],y.prototype,"agentsLoading",2);$([x()],y.prototype,"agentsList",2);$([x()],y.prototype,"agentsError",2);$([x()],y.prototype,"agentsSelectedId",2);$([x()],y.prototype,"toolsCatalogLoading",2);$([x()],y.prototype,"toolsCatalogError",2);$([x()],y.prototype,"toolsCatalogResult",2);$([x()],y.prototype,"agentsPanel",2);$([x()],y.prototype,"agentFilesLoading",2);$([x()],y.prototype,"agentFilesError",2);$([x()],y.prototype,"agentFilesList",2);$([x()],y.prototype,"agentFileContents",2);$([x()],y.prototype,"agentFileDrafts",2);$([x()],y.prototype,"agentFileActive",2);$([x()],y.prototype,"agentFileSaving",2);$([x()],y.prototype,"agentIdentityLoading",2);$([x()],y.prototype,"agentIdentityError",2);$([x()],y.prototype,"agentIdentityById",2);$([x()],y.prototype,"agentSkillsLoading",2);$([x()],y.prototype,"agentSkillsError",2);$([x()],y.prototype,"agentSkillsReport",2);$([x()],y.prototype,"agentSkillsAgentId",2);$([x()],y.prototype,"sessionsLoading",2);$([x()],y.prototype,"sessionsResult",2);$([x()],y.prototype,"sessionsError",2);$([x()],y.prototype,"sessionsFilterActive",2);$([x()],y.prototype,"sessionsFilterLimit",2);$([x()],y.prototype,"sessionsIncludeGlobal",2);$([x()],y.prototype,"sessionsIncludeUnknown",2);$([x()],y.prototype,"sessionsHideCron",2);$([x()],y.prototype,"usageLoading",2);$([x()],y.prototype,"usageResult",2);$([x()],y.prototype,"usageCostSummary",2);$([x()],y.prototype,"usageError",2);$([x()],y.prototype,"usageStartDate",2);$([x()],y.prototype,"usageEndDate",2);$([x()],y.prototype,"usageSelectedSessions",2);$([x()],y.prototype,"usageSelectedDays",2);$([x()],y.prototype,"usageSelectedHours",2);$([x()],y.prototype,"usageChartMode",2);$([x()],y.prototype,"usageDailyChartMode",2);$([x()],y.prototype,"usageTimeSeriesMode",2);$([x()],y.prototype,"usageTimeSeriesBreakdownMode",2);$([x()],y.prototype,"usageTimeSeries",2);$([x()],y.prototype,"usageTimeSeriesLoading",2);$([x()],y.prototype,"usageTimeSeriesCursorStart",2);$([x()],y.prototype,"usageTimeSeriesCursorEnd",2);$([x()],y.prototype,"usageSessionLogs",2);$([x()],y.prototype,"usageSessionLogsLoading",2);$([x()],y.prototype,"usageSessionLogsExpanded",2);$([x()],y.prototype,"usageQuery",2);$([x()],y.prototype,"usageQueryDraft",2);$([x()],y.prototype,"usageSessionSort",2);$([x()],y.prototype,"usageSessionSortDir",2);$([x()],y.prototype,"usageRecentSessions",2);$([x()],y.prototype,"usageTimeZone",2);$([x()],y.prototype,"usageContextExpanded",2);$([x()],y.prototype,"usageHeaderPinned",2);$([x()],y.prototype,"usageSessionsTab",2);$([x()],y.prototype,"usageVisibleColumns",2);$([x()],y.prototype,"usageLogFilterRoles",2);$([x()],y.prototype,"usageLogFilterTools",2);$([x()],y.prototype,"usageLogFilterHasTools",2);$([x()],y.prototype,"usageLogFilterQuery",2);$([x()],y.prototype,"cronLoading",2);$([x()],y.prototype,"cronJobsLoadingMore",2);$([x()],y.prototype,"cronJobs",2);$([x()],y.prototype,"cronJobsTotal",2);$([x()],y.prototype,"cronJobsHasMore",2);$([x()],y.prototype,"cronJobsNextOffset",2);$([x()],y.prototype,"cronJobsLimit",2);$([x()],y.prototype,"cronJobsQuery",2);$([x()],y.prototype,"cronJobsEnabledFilter",2);$([x()],y.prototype,"cronJobsScheduleKindFilter",2);$([x()],y.prototype,"cronJobsLastStatusFilter",2);$([x()],y.prototype,"cronJobsSortBy",2);$([x()],y.prototype,"cronJobsSortDir",2);$([x()],y.prototype,"cronStatus",2);$([x()],y.prototype,"cronError",2);$([x()],y.prototype,"cronForm",2);$([x()],y.prototype,"cronFieldErrors",2);$([x()],y.prototype,"cronEditingJobId",2);$([x()],y.prototype,"cronRunsJobId",2);$([x()],y.prototype,"cronRunsLoadingMore",2);$([x()],y.prototype,"cronRuns",2);$([x()],y.prototype,"cronRunsTotal",2);$([x()],y.prototype,"cronRunsHasMore",2);$([x()],y.prototype,"cronRunsNextOffset",2);$([x()],y.prototype,"cronRunsLimit",2);$([x()],y.prototype,"cronRunsScope",2);$([x()],y.prototype,"cronRunsStatuses",2);$([x()],y.prototype,"cronRunsDeliveryStatuses",2);$([x()],y.prototype,"cronRunsStatusFilter",2);$([x()],y.prototype,"cronRunsQuery",2);$([x()],y.prototype,"cronRunsSortDir",2);$([x()],y.prototype,"cronModelSuggestions",2);$([x()],y.prototype,"cronBusy",2);$([x()],y.prototype,"updateAvailable",2);$([x()],y.prototype,"skillsLoading",2);$([x()],y.prototype,"skillsReport",2);$([x()],y.prototype,"skillsError",2);$([x()],y.prototype,"skillsFilter",2);$([x()],y.prototype,"skillEdits",2);$([x()],y.prototype,"skillsBusyKey",2);$([x()],y.prototype,"skillMessages",2);$([x()],y.prototype,"marketLoading",2);$([x()],y.prototype,"marketCatalog",2);$([x()],y.prototype,"marketError",2);$([x()],y.prototype,"marketFilter",2);$([x()],y.prototype,"marketBusyKey",2);$([x()],y.prototype,"marketMessages",2);$([x()],y.prototype,"debugLoading",2);$([x()],y.prototype,"debugStatus",2);$([x()],y.prototype,"debugHealth",2);$([x()],y.prototype,"debugModels",2);$([x()],y.prototype,"debugHeartbeat",2);$([x()],y.prototype,"debugCallMethod",2);$([x()],y.prototype,"debugCallParams",2);$([x()],y.prototype,"debugCallResult",2);$([x()],y.prototype,"debugCallError",2);$([x()],y.prototype,"logsLoading",2);$([x()],y.prototype,"logsError",2);$([x()],y.prototype,"logsFile",2);$([x()],y.prototype,"logsEntries",2);$([x()],y.prototype,"logsFilterText",2);$([x()],y.prototype,"logsLevelFilters",2);$([x()],y.prototype,"logsAutoFollow",2);$([x()],y.prototype,"logsTruncated",2);$([x()],y.prototype,"logsCursor",2);$([x()],y.prototype,"logsLastFetchAt",2);$([x()],y.prototype,"logsLimit",2);$([x()],y.prototype,"logsMaxBytes",2);$([x()],y.prototype,"logsAtBottom",2);$([x()],y.prototype,"chatNewMessagesBelow",2);y=$([Jl("openclaw-app")],y);
|
|
8654
|
-
//# sourceMappingURL=index-
|
|
8699
|
+
`,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.modelsLoading=!1,this.modelsSaving=!1,this.modelsDefaultSaving=!1,this.modelsVerifyBusy=!1,this.modelsError=null,this.modelsProviders=[],this.modelsSwitchableModels=[],this.modelsSelectedProviderId=null,this.modelsSelectedDefault="",this.modelsDraft=null,this.modelsDefaultState=null,this.modelsVerifyState=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.toolsCatalogLoading=!1,this.toolsCatalogError=null,this.toolsCatalogResult=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.sessionsHideCron=!0,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.usageTimeSeriesCursorStart=null,this.usageTimeSeriesCursorEnd=null,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.cronJobsLoadingMore=!1,this.cronJobs=[],this.cronJobsTotal=0,this.cronJobsHasMore=!1,this.cronJobsNextOffset=null,this.cronJobsLimit=50,this.cronJobsQuery="",this.cronJobsEnabledFilter="all",this.cronJobsScheduleKindFilter="all",this.cronJobsLastStatusFilter="all",this.cronJobsSortBy="nextRunAtMs",this.cronJobsSortDir="asc",this.cronStatus=null,this.cronError=null,this.cronForm={...Fs},this.cronFieldErrors={},this.cronEditingJobId=null,this.cronRunsJobId=null,this.cronRunsLoadingMore=!1,this.cronRuns=[],this.cronRunsTotal=0,this.cronRunsHasMore=!1,this.cronRunsNextOffset=null,this.cronRunsLimit=50,this.cronRunsScope="all",this.cronRunsStatuses=[],this.cronRunsDeliveryStatuses=[],this.cronRunsStatusFilter="all",this.cronRunsQuery="",this.cronRunsSortDir="desc",this.cronModelSuggestions=[],this.cronBusy=!1,this.updateAvailable=null,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.marketLoading=!1,this.marketCatalog=[],this.marketError=null,this.marketFilter="",this.marketBusyKey=null,this.marketMessages={},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={...qg},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=()=>ch(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,Yl(this.settings.locale)&&Jn.setLocale(this.settings.locale)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Cm(this)}firstUpdated(){Tm(this)}disconnectedCallback(){Em(this),super.disconnectedCallback()}updated(e){_m(this,e)}connect(){vd(this)}handleChatScroll(e){Dg(this,e)}handleLogsScroll(e){Pg(this,e)}exportLogs(e,t){Fg(e,t)}resetToolStream(){di(this)}resetChatScroll(){ta(this)}scrollToBottom(e){ta(this),ts(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await pd(this)}applySettings(e){At(this,e)}setTab(e){nh(this,e)}setTheme(e,t){sh(this,e,t)}async loadOverview(){await Zc(this)}async loadCron(){await zs(this)}async handleAbortChat(){await cd(this)}removeQueuedMessage(e){tm(this,e)}async handleSendChat(e,t){await nm(this,e,t)}async handleWhatsAppStart(e){await $g(this,e)}async handleWhatsAppWait(){await xg(this)}async handleWhatsAppLogout(){await wg(this)}async handleChannelConfigSave(){await Sg(this)}async handleChannelConfigReload(){await kg(this)}handleNostrProfileEdit(e,t){Tg(this,e,t)}handleNostrProfileCancel(){Eg(this)}handleNostrProfileFieldChange(e,t){_g(this,e,t)}async handleNostrProfileSave(){await Rg(this)}async handleNostrProfileImport(){await Mg(this)}handleNostrProfileToggleAdvanced(){Ig(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,At(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 l1(this)}};$([x()],y.prototype,"settings",2);$([x()],y.prototype,"password",2);$([x()],y.prototype,"tab",2);$([x()],y.prototype,"onboarding",2);$([x()],y.prototype,"connected",2);$([x()],y.prototype,"theme",2);$([x()],y.prototype,"themeResolved",2);$([x()],y.prototype,"hello",2);$([x()],y.prototype,"lastError",2);$([x()],y.prototype,"lastErrorCode",2);$([x()],y.prototype,"eventLog",2);$([x()],y.prototype,"assistantName",2);$([x()],y.prototype,"assistantAvatar",2);$([x()],y.prototype,"assistantAgentId",2);$([x()],y.prototype,"sessionKey",2);$([x()],y.prototype,"chatLoading",2);$([x()],y.prototype,"chatSending",2);$([x()],y.prototype,"chatMessage",2);$([x()],y.prototype,"chatMessages",2);$([x()],y.prototype,"chatToolMessages",2);$([x()],y.prototype,"chatStream",2);$([x()],y.prototype,"chatStreamStartedAt",2);$([x()],y.prototype,"chatRunId",2);$([x()],y.prototype,"chatBitSeekTopUpPrompt",2);$([x()],y.prototype,"compactionStatus",2);$([x()],y.prototype,"fallbackStatus",2);$([x()],y.prototype,"chatAvatarUrl",2);$([x()],y.prototype,"chatThinkingLevel",2);$([x()],y.prototype,"chatQueue",2);$([x()],y.prototype,"chatAttachments",2);$([x()],y.prototype,"chatManualRefreshInFlight",2);$([x()],y.prototype,"sidebarOpen",2);$([x()],y.prototype,"sidebarContent",2);$([x()],y.prototype,"sidebarError",2);$([x()],y.prototype,"splitRatio",2);$([x()],y.prototype,"nodesLoading",2);$([x()],y.prototype,"nodes",2);$([x()],y.prototype,"devicesLoading",2);$([x()],y.prototype,"devicesError",2);$([x()],y.prototype,"devicesList",2);$([x()],y.prototype,"execApprovalsLoading",2);$([x()],y.prototype,"execApprovalsSaving",2);$([x()],y.prototype,"execApprovalsDirty",2);$([x()],y.prototype,"execApprovalsSnapshot",2);$([x()],y.prototype,"execApprovalsForm",2);$([x()],y.prototype,"execApprovalsSelectedAgent",2);$([x()],y.prototype,"execApprovalsTarget",2);$([x()],y.prototype,"execApprovalsTargetNodeId",2);$([x()],y.prototype,"execApprovalQueue",2);$([x()],y.prototype,"execApprovalBusy",2);$([x()],y.prototype,"execApprovalError",2);$([x()],y.prototype,"pendingGatewayUrl",2);$([x()],y.prototype,"configLoading",2);$([x()],y.prototype,"configRaw",2);$([x()],y.prototype,"configRawOriginal",2);$([x()],y.prototype,"configValid",2);$([x()],y.prototype,"configIssues",2);$([x()],y.prototype,"configSaving",2);$([x()],y.prototype,"configApplying",2);$([x()],y.prototype,"updateRunning",2);$([x()],y.prototype,"applySessionKey",2);$([x()],y.prototype,"configSnapshot",2);$([x()],y.prototype,"configSchema",2);$([x()],y.prototype,"configSchemaVersion",2);$([x()],y.prototype,"configSchemaLoading",2);$([x()],y.prototype,"configUiHints",2);$([x()],y.prototype,"configForm",2);$([x()],y.prototype,"configFormOriginal",2);$([x()],y.prototype,"configFormDirty",2);$([x()],y.prototype,"configFormMode",2);$([x()],y.prototype,"configSearchQuery",2);$([x()],y.prototype,"configActiveSection",2);$([x()],y.prototype,"configActiveSubsection",2);$([x()],y.prototype,"modelsLoading",2);$([x()],y.prototype,"modelsSaving",2);$([x()],y.prototype,"modelsDefaultSaving",2);$([x()],y.prototype,"modelsVerifyBusy",2);$([x()],y.prototype,"modelsError",2);$([x()],y.prototype,"modelsProviders",2);$([x()],y.prototype,"modelsSwitchableModels",2);$([x()],y.prototype,"modelsSelectedProviderId",2);$([x()],y.prototype,"modelsSelectedDefault",2);$([x()],y.prototype,"modelsDraft",2);$([x()],y.prototype,"modelsDefaultState",2);$([x()],y.prototype,"modelsVerifyState",2);$([x()],y.prototype,"channelsLoading",2);$([x()],y.prototype,"channelsSnapshot",2);$([x()],y.prototype,"channelsError",2);$([x()],y.prototype,"channelsLastSuccess",2);$([x()],y.prototype,"whatsappLoginMessage",2);$([x()],y.prototype,"whatsappLoginQrDataUrl",2);$([x()],y.prototype,"whatsappLoginConnected",2);$([x()],y.prototype,"whatsappBusy",2);$([x()],y.prototype,"nostrProfileFormState",2);$([x()],y.prototype,"nostrProfileAccountId",2);$([x()],y.prototype,"presenceLoading",2);$([x()],y.prototype,"presenceEntries",2);$([x()],y.prototype,"presenceError",2);$([x()],y.prototype,"presenceStatus",2);$([x()],y.prototype,"agentsLoading",2);$([x()],y.prototype,"agentsList",2);$([x()],y.prototype,"agentsError",2);$([x()],y.prototype,"agentsSelectedId",2);$([x()],y.prototype,"toolsCatalogLoading",2);$([x()],y.prototype,"toolsCatalogError",2);$([x()],y.prototype,"toolsCatalogResult",2);$([x()],y.prototype,"agentsPanel",2);$([x()],y.prototype,"agentFilesLoading",2);$([x()],y.prototype,"agentFilesError",2);$([x()],y.prototype,"agentFilesList",2);$([x()],y.prototype,"agentFileContents",2);$([x()],y.prototype,"agentFileDrafts",2);$([x()],y.prototype,"agentFileActive",2);$([x()],y.prototype,"agentFileSaving",2);$([x()],y.prototype,"agentIdentityLoading",2);$([x()],y.prototype,"agentIdentityError",2);$([x()],y.prototype,"agentIdentityById",2);$([x()],y.prototype,"agentSkillsLoading",2);$([x()],y.prototype,"agentSkillsError",2);$([x()],y.prototype,"agentSkillsReport",2);$([x()],y.prototype,"agentSkillsAgentId",2);$([x()],y.prototype,"sessionsLoading",2);$([x()],y.prototype,"sessionsResult",2);$([x()],y.prototype,"sessionsError",2);$([x()],y.prototype,"sessionsFilterActive",2);$([x()],y.prototype,"sessionsFilterLimit",2);$([x()],y.prototype,"sessionsIncludeGlobal",2);$([x()],y.prototype,"sessionsIncludeUnknown",2);$([x()],y.prototype,"sessionsHideCron",2);$([x()],y.prototype,"usageLoading",2);$([x()],y.prototype,"usageResult",2);$([x()],y.prototype,"usageCostSummary",2);$([x()],y.prototype,"usageError",2);$([x()],y.prototype,"usageStartDate",2);$([x()],y.prototype,"usageEndDate",2);$([x()],y.prototype,"usageSelectedSessions",2);$([x()],y.prototype,"usageSelectedDays",2);$([x()],y.prototype,"usageSelectedHours",2);$([x()],y.prototype,"usageChartMode",2);$([x()],y.prototype,"usageDailyChartMode",2);$([x()],y.prototype,"usageTimeSeriesMode",2);$([x()],y.prototype,"usageTimeSeriesBreakdownMode",2);$([x()],y.prototype,"usageTimeSeries",2);$([x()],y.prototype,"usageTimeSeriesLoading",2);$([x()],y.prototype,"usageTimeSeriesCursorStart",2);$([x()],y.prototype,"usageTimeSeriesCursorEnd",2);$([x()],y.prototype,"usageSessionLogs",2);$([x()],y.prototype,"usageSessionLogsLoading",2);$([x()],y.prototype,"usageSessionLogsExpanded",2);$([x()],y.prototype,"usageQuery",2);$([x()],y.prototype,"usageQueryDraft",2);$([x()],y.prototype,"usageSessionSort",2);$([x()],y.prototype,"usageSessionSortDir",2);$([x()],y.prototype,"usageRecentSessions",2);$([x()],y.prototype,"usageTimeZone",2);$([x()],y.prototype,"usageContextExpanded",2);$([x()],y.prototype,"usageHeaderPinned",2);$([x()],y.prototype,"usageSessionsTab",2);$([x()],y.prototype,"usageVisibleColumns",2);$([x()],y.prototype,"usageLogFilterRoles",2);$([x()],y.prototype,"usageLogFilterTools",2);$([x()],y.prototype,"usageLogFilterHasTools",2);$([x()],y.prototype,"usageLogFilterQuery",2);$([x()],y.prototype,"cronLoading",2);$([x()],y.prototype,"cronJobsLoadingMore",2);$([x()],y.prototype,"cronJobs",2);$([x()],y.prototype,"cronJobsTotal",2);$([x()],y.prototype,"cronJobsHasMore",2);$([x()],y.prototype,"cronJobsNextOffset",2);$([x()],y.prototype,"cronJobsLimit",2);$([x()],y.prototype,"cronJobsQuery",2);$([x()],y.prototype,"cronJobsEnabledFilter",2);$([x()],y.prototype,"cronJobsScheduleKindFilter",2);$([x()],y.prototype,"cronJobsLastStatusFilter",2);$([x()],y.prototype,"cronJobsSortBy",2);$([x()],y.prototype,"cronJobsSortDir",2);$([x()],y.prototype,"cronStatus",2);$([x()],y.prototype,"cronError",2);$([x()],y.prototype,"cronForm",2);$([x()],y.prototype,"cronFieldErrors",2);$([x()],y.prototype,"cronEditingJobId",2);$([x()],y.prototype,"cronRunsJobId",2);$([x()],y.prototype,"cronRunsLoadingMore",2);$([x()],y.prototype,"cronRuns",2);$([x()],y.prototype,"cronRunsTotal",2);$([x()],y.prototype,"cronRunsHasMore",2);$([x()],y.prototype,"cronRunsNextOffset",2);$([x()],y.prototype,"cronRunsLimit",2);$([x()],y.prototype,"cronRunsScope",2);$([x()],y.prototype,"cronRunsStatuses",2);$([x()],y.prototype,"cronRunsDeliveryStatuses",2);$([x()],y.prototype,"cronRunsStatusFilter",2);$([x()],y.prototype,"cronRunsQuery",2);$([x()],y.prototype,"cronRunsSortDir",2);$([x()],y.prototype,"cronModelSuggestions",2);$([x()],y.prototype,"cronBusy",2);$([x()],y.prototype,"updateAvailable",2);$([x()],y.prototype,"skillsLoading",2);$([x()],y.prototype,"skillsReport",2);$([x()],y.prototype,"skillsError",2);$([x()],y.prototype,"skillsFilter",2);$([x()],y.prototype,"skillEdits",2);$([x()],y.prototype,"skillsBusyKey",2);$([x()],y.prototype,"skillMessages",2);$([x()],y.prototype,"marketLoading",2);$([x()],y.prototype,"marketCatalog",2);$([x()],y.prototype,"marketError",2);$([x()],y.prototype,"marketFilter",2);$([x()],y.prototype,"marketBusyKey",2);$([x()],y.prototype,"marketMessages",2);$([x()],y.prototype,"debugLoading",2);$([x()],y.prototype,"debugStatus",2);$([x()],y.prototype,"debugHealth",2);$([x()],y.prototype,"debugModels",2);$([x()],y.prototype,"debugHeartbeat",2);$([x()],y.prototype,"debugCallMethod",2);$([x()],y.prototype,"debugCallParams",2);$([x()],y.prototype,"debugCallResult",2);$([x()],y.prototype,"debugCallError",2);$([x()],y.prototype,"logsLoading",2);$([x()],y.prototype,"logsError",2);$([x()],y.prototype,"logsFile",2);$([x()],y.prototype,"logsEntries",2);$([x()],y.prototype,"logsFilterText",2);$([x()],y.prototype,"logsLevelFilters",2);$([x()],y.prototype,"logsAutoFollow",2);$([x()],y.prototype,"logsTruncated",2);$([x()],y.prototype,"logsCursor",2);$([x()],y.prototype,"logsLastFetchAt",2);$([x()],y.prototype,"logsLimit",2);$([x()],y.prototype,"logsMaxBytes",2);$([x()],y.prototype,"logsAtBottom",2);$([x()],y.prototype,"chatNewMessagesBelow",2);y=$([Vl("openclaw-app")],y);
|
|
8700
|
+
//# sourceMappingURL=index-BX-BH831.js.map
|