@bitseek/claw 1.2.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agents-BCJbDk2P.js → agents-Sp-v-_mR.js} +4 -4
- package/dist/{agents.config-DoxV5m9v.js → agents.config-C6zkqXkX.js} +1 -1
- package/dist/{agents.config-DQBEXhzA.js → agents.config-rRQ8xZUr.js} +1 -1
- package/dist/{auth-choice-CdsMUqKA.js → auth-choice-eimtfK0N.js} +1 -1
- package/dist/{auth-choice-CP6K5htW.js → auth-choice-lzACBXDv.js} +1 -1
- package/dist/{banner-V_1v329B.js → banner-CYVM4p3E.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-options-Dsjb-V1F.js → channel-options-Cn6pNgzb.js} +1 -1
- package/dist/{channel-options-Bnnem_wD.js → channel-options-uEYF4WRA.js} +1 -1
- package/dist/{channel-web-KY6EP9HT.js → channel-web-BJJUEEKO.js} +1 -1
- package/dist/{channel-web-wuxrfEJh.js → channel-web-TsD9bdWt.js} +1 -1
- package/dist/{channels-cli-OZeQkPMG.js → channels-cli-DA8sLqQk.js} +7 -7
- package/dist/{channels-cli-tJkvzsqO.js → channels-cli-GwM8DZvP.js} +6 -6
- package/dist/{cli-DOS1lPNs.js → cli-BLZW83kS.js} +1 -1
- package/dist/{cli-YeYpjq2c.js → cli-DIs0fL3W.js} +2 -2
- package/dist/{command-registry-Keal8P25.js → command-registry-By6zKf98.js} +9 -9
- package/dist/{completion-cli-B_pSnPVY.js → completion-cli-BuLkcc9o.js} +1 -1
- package/dist/{completion-cli-BWcHEWr6.js → completion-cli-CV7dNv8l.js} +2 -2
- package/dist/{config-cli-DZpbwWvz.js → config-cli-D4EnfBqh.js} +1 -1
- package/dist/{config-cli-hwawfBlS.js → config-cli-Dh9rvUxe.js} +1 -1
- package/dist/{configure-l-lM74c1.js → configure-BYFIF9Sz.js} +3 -3
- package/dist/{configure-CLMtWGiL.js → configure-CBB1YbMN.js} +3 -3
- package/dist/control-ui/assets/{index-puDi2eTY.js → index-CBxamjSz.js} +80 -80
- package/dist/control-ui/assets/index-CBxamjSz.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/{doctor-completion-sKCaOE5l.js → doctor-completion-BIt5xBwC.js} +1 -1
- package/dist/{doctor-completion-leOuoRMt.js → doctor-completion-T9CxDBUR.js} +1 -1
- package/dist/entry.js +2 -2
- package/dist/extensionAPI.js +1 -1
- package/dist/{gateway-cli-jL3MSRHB.js → gateway-cli-CanylfLh.js} +8 -8
- package/dist/{gateway-cli-BlVNebTw.js → gateway-cli-gzemofET.js} +9 -9
- package/dist/{health-Du8dO3vn.js → health-BX20asqJ.js} +1 -1
- package/dist/{health-CDEXWvnu.js → health-CWmeMvVp.js} +1 -1
- package/dist/{hooks-cli-DUIQuGjr.js → hooks-cli-Cs2Ovk-O.js} +2 -2
- package/dist/{hooks-cli-Deo01lF6.js → hooks-cli-DzvdmY1Z.js} +3 -3
- package/dist/index.js +6 -6
- package/dist/llm-slug-generator.js +1 -1
- package/dist/{models-CgguB_MH.js → models-C21qhHIB.js} +2 -2
- package/dist/{models-cli-CHUbcM_y.js → models-cli-C-FMLbe_.js} +2 -2
- package/dist/{models-cli-BEb0DHSP.js → models-cli-CMETQ9Wy.js} +4 -4
- package/dist/{npm-resolution-T8SphiP5.js → npm-resolution-BAwDXgj5.js} +1 -1
- package/dist/{npm-resolution-Dv7nYiaP.js → npm-resolution-oBSNTx2S.js} +1 -1
- package/dist/{onboard-KHObANUh.js → onboard-B-f5pmgG.js} +2 -2
- package/dist/{onboard-BCcjGKBR.js → onboard-CLUldVpr.js} +2 -2
- package/dist/{onboard-channels-BLZ8FdVP.js → onboard-channels-B59K9VZH.js} +1 -1
- package/dist/{onboard-channels-CRpmgX82.js → onboard-channels-Bbzz_NPd.js} +1 -1
- package/dist/{onboarding-BTXvw1Ro.js → onboarding-DHqNGWCb.js} +3 -3
- package/dist/{onboarding-DQNTd5J7.js → onboarding-Kp0zZunD.js} +3 -3
- package/dist/{onboarding.finalize-CHYENeNO.js → onboarding.finalize-CJ23anMx.js} +5 -5
- package/dist/{onboarding.finalize-D0qfP3rB.js → onboarding.finalize-D_n9fly-.js} +7 -7
- package/dist/{pi-embedded-Bacc2S0h.js → pi-embedded-BgVoy_Nm.js} +42 -6
- package/dist/{pi-embedded-Claxav22.js → pi-embedded-DdMbqfLM.js} +42 -6
- package/dist/{plugin-registry-CxFikiLF.js → plugin-registry-CA1t0UeN.js} +1 -1
- package/dist/{plugin-registry-TOEmbMc4.js → plugin-registry-pa6LjTdT.js} +1 -1
- package/dist/plugin-sdk/{accounts-AbI8uETR.js → accounts-BZrkOo6-.js} +1 -1
- package/dist/plugin-sdk/{accounts-4WE2wtsW.js → accounts-COLYAAOx.js} +1 -1
- package/dist/plugin-sdk/{accounts-BYcizTXn.js → accounts-D_pT5EjF.js} +3 -3
- package/dist/plugin-sdk/{active-listener-pnqLAUOh.js → active-listener-DxBXcWm_.js} +1 -1
- package/dist/plugin-sdk/{agent-scope-_j3fIYCK.js → agent-scope-DT5pxpJB.js} +3 -3
- package/dist/plugin-sdk/agents/context.d.ts +2 -0
- package/dist/plugin-sdk/{api-key-rotation-CYI51U_M.js → api-key-rotation-Dl6Ad7Nj.js} +2 -2
- package/dist/plugin-sdk/{audio-preflight-BTRRjPew.js → audio-preflight-CkPj4OVY.js} +33 -33
- package/dist/plugin-sdk/{audio-transcription-runner-DFZS7uCO.js → audio-transcription-runner-BBn9jEMg.js} +10 -10
- package/dist/plugin-sdk/{bindings-CxxzC7gn.js → bindings-BSfhEjKN.js} +2 -2
- package/dist/plugin-sdk/{channel-activity-B3yZ-f-m.js → channel-activity-DAEbma-o.js} +3 -3
- package/dist/plugin-sdk/{channel-web-D2q54sK-.js → channel-web-BaFUnG0F.js} +23 -23
- package/dist/plugin-sdk/{chrome-oPevdeh5.js → chrome-Dn0G4NoF.js} +7 -7
- package/dist/plugin-sdk/{chunk-BPyPeheZ.js → chunk-cvtXztAT.js} +1 -1
- package/dist/plugin-sdk/{command-format-DvyMEXQo.js → command-format-BOJz3y1v.js} +1 -1
- package/dist/plugin-sdk/{commands-registry-Dk8re8Lz.js → commands-registry-CZWv_JwZ.js} +5 -5
- package/dist/plugin-sdk/{config-D7I2_X4P.js → config-DAwOhnVF.js} +10 -10
- package/dist/plugin-sdk/{deliver-NrIHn0__.js → deliver-PdH-MCq8.js} +11 -11
- package/dist/plugin-sdk/{diagnostic-DL3k_wRi.js → diagnostic-BZvj-qNu.js} +2 -2
- package/dist/plugin-sdk/{dock-CjdkiLH7.js → dock-BdR3OYZn.js} +6 -6
- package/dist/plugin-sdk/{errors-DFTN4h2I.js → errors-jusxdu7M.js} +1 -1
- package/dist/plugin-sdk/{fetch-guard-BivEyA4v.js → fetch-guard-Dary6WwJ.js} +2 -2
- package/dist/plugin-sdk/{fs-safe-B256n7Ff.js → fs-safe-DMCE0ej9.js} +3 -3
- package/dist/plugin-sdk/{image-CkPzr3XN.js → image-B3A2l2ep.js} +6 -6
- package/dist/plugin-sdk/{image-ops-C9GXWF3o.js → image-ops-DulHE5Qc.js} +1 -1
- package/dist/plugin-sdk/index.js +64 -64
- package/dist/plugin-sdk/{ir-BIm-jvIK.js → ir-BFXiJrsN.js} +6 -6
- package/dist/plugin-sdk/{local-roots-2AOXGUXW.js → local-roots-DssN60r6.js} +4 -4
- package/dist/plugin-sdk/{logger-CNhs9eKJ.js → logger-Cr-x0vMf.js} +1 -1
- package/dist/plugin-sdk/{login-BcLiF9tC.js → login-D0ul3-6C.js} +6 -6
- package/dist/plugin-sdk/{login-qr-GyPUodKJ.js → login-qr-XWKTFBuI.js} +9 -9
- package/dist/plugin-sdk/{manager-DYLqNUb4.js → manager-DGx_cF54.js} +10 -10
- package/dist/plugin-sdk/{markdown-tables-D9mmqMKi.js → markdown-tables-CsQpDNU5.js} +1 -1
- package/dist/plugin-sdk/{message-channel-_CEZcqxE.js → message-channel-CvNq-esz.js} +1 -1
- package/dist/plugin-sdk/{outbound-DdTsUaXa.js → outbound-D29FHlQl.js} +7 -7
- package/dist/plugin-sdk/{outbound-attachment--hkuIDR1.js → outbound-attachment-DRHrZUOx.js} +2 -2
- package/dist/plugin-sdk/{path-alias-guards-BqUCBfUg.js → path-alias-guards-DpKV1B5p.js} +1 -1
- package/dist/plugin-sdk/{pi-embedded-helpers-CTfvZz83.js → pi-embedded-helpers-CKEUWckk.js} +17 -17
- package/dist/plugin-sdk/{pi-model-discovery-CK3Ih_kq.js → pi-model-discovery-BPeQq9XM.js} +1 -1
- package/dist/plugin-sdk/{plugins-BpHAMNJ1.js → plugins-DF_dKXTR.js} +6 -6
- package/dist/plugin-sdk/{proxy-BJdRZOnJ.js → proxy-BfmEDoun.js} +1 -1
- package/dist/plugin-sdk/{proxy-fetch-jmbopGcm.js → proxy-fetch-BpHIgvBk.js} +1 -1
- package/dist/plugin-sdk/{pw-ai-D0Kx7w1D.js → pw-ai-BmmXDjtm.js} +13 -13
- package/dist/plugin-sdk/{qmd-manager-BDcutPp9.js → qmd-manager-3hQbqkm5.js} +8 -8
- package/dist/plugin-sdk/{query-expansion-C_X8SyEA.js → query-expansion-BOGLUWB7.js} +2 -2
- package/dist/plugin-sdk/{redact-DH8u23pF.js → redact-BOuKZWXa.js} +1 -1
- package/dist/plugin-sdk/{registry-HF8_S7QO.js → registry-Cv-oHUj1.js} +2 -2
- package/dist/plugin-sdk/{replies-DbjvV4gf.js → replies-CddwWBTJ.js} +3 -3
- package/dist/plugin-sdk/{reply-Cs_Ks2Mr.js → reply-BCRC0yeW.js} +133 -97
- package/dist/plugin-sdk/{reply-prefix-KODsMNJ-.js → reply-prefix-DXthVxCx.js} +1 -1
- package/dist/plugin-sdk/{resolve-outbound-target-BPT4aNiD.js → resolve-outbound-target-D3Y4F2Le.js} +2 -2
- package/dist/plugin-sdk/{resolve-route-De2B5QY_.js → resolve-route-DuwYYn4a.js} +4 -4
- package/dist/plugin-sdk/{retry-pZ8iKytf.js → retry-BMcrIz7L.js} +1 -1
- package/dist/plugin-sdk/{send-C-Rd2stz.js → send-B0ztz6QC.js} +6 -6
- package/dist/plugin-sdk/{send-BoNw1Bki.js → send-C5USYGq7.js} +8 -8
- package/dist/plugin-sdk/{send-1uW-uqPf.js → send-D0AaWnIj.js} +7 -7
- package/dist/plugin-sdk/{send-wCqsQs_s.js → send-DEyQJTzd.js} +10 -10
- package/dist/plugin-sdk/{send-CZIN8SDx.js → send-DJzwu8kk.js} +15 -15
- package/dist/plugin-sdk/{session-ooYcB82T.js → session-BA7tVDpV.js} +5 -5
- package/dist/plugin-sdk/{session-meta-7J-uHiM_.js → session-meta-ChWvKVWj.js} +1 -1
- package/dist/plugin-sdk/{sessions-lAIo5l8W.js → sessions-BXps6YzJ.js} +6 -6
- package/dist/plugin-sdk/{skill-commands-D1Q6hGS4.js → skill-commands-B20uUsji.js} +5 -5
- package/dist/plugin-sdk/{skills-BWSDv2F_.js → skills-DXOTei42.js} +8 -8
- package/dist/plugin-sdk/{ssrf-JKDwTi8i.js → ssrf-Doxv9M7Q.js} +1 -1
- package/dist/plugin-sdk/{store-BMeqzQAf.js → store-BZbE1V-C.js} +2 -2
- package/dist/plugin-sdk/{subsystem-B0V8LFBA.js → subsystem-CM1s2lDT.js} +2 -2
- package/dist/plugin-sdk/{tables-DCSeBGBz.js → tables-BhH8EIqU.js} +1 -1
- package/dist/plugin-sdk/{target-errors-0u6pegQv.js → target-errors-QZay02Cv.js} +2 -2
- package/dist/plugin-sdk/{tokens-DF2_VTJy.js → tokens-DIE-Bf72.js} +1 -1
- package/dist/plugin-sdk/{tool-images-BbsgbHMZ.js → tool-images-heXfaJdb.js} +2 -2
- package/dist/plugin-sdk/{tool-loop-detection-JkCpGrfk.js → tool-loop-detection-CygMSQUK.js} +2 -2
- package/dist/plugin-sdk/{utils-BfVxx6bk.js → utils-BcL6KGZf.js} +1 -1
- package/dist/plugin-sdk/web-BDHHRoXS.js +72 -0
- package/dist/plugin-sdk/{whatsapp-actions-tVcrGNQc.js → whatsapp-actions-CRean1yN.js} +25 -25
- package/dist/{plugins-cli-bHHZzKd-.js → plugins-cli-Cidq7nJb.js} +3 -3
- package/dist/{plugins-cli-Clo_uyvq.js → plugins-cli-CqDquUh9.js} +2 -2
- package/dist/{program-BI6W1Gll.js → program-C0yxnClq.js} +8 -8
- package/dist/{program-context-D2D7wH7Q.js → program-context-D2U9PEv9.js} +17 -17
- package/dist/{prompt-select-styled-CdBJ0FWT.js → prompt-select-styled-Bir77erd.js} +4 -4
- package/dist/{prompt-select-styled-FGF3Su20.js → prompt-select-styled-Da_XCcz7.js} +4 -4
- package/dist/{provider-auth-helpers-BFsLtU8g.js → provider-auth-helpers-B4nCFlNS.js} +1 -1
- package/dist/{provider-auth-helpers-D_akOb8A.js → provider-auth-helpers-fK9RpOiF.js} +1 -1
- package/dist/{push-apns-BSlKJa83.js → push-apns-BSwx-wiI.js} +1 -1
- package/dist/{push-apns-DvNRo3EQ.js → push-apns-C7oC1J4F.js} +1 -1
- package/dist/{register.agent-DowGjvNc.js → register.agent-DVy4TdwU.js} +6 -6
- package/dist/{register.agent-C-OmdJMe.js → register.agent-kmdjftAP.js} +8 -8
- package/dist/{register.configure-BZLa_c3k.js → register.configure-BzG1EPPb.js} +7 -7
- package/dist/{register.configure-CaSRlI6h.js → register.configure-CZqcKxCG.js} +8 -8
- package/dist/{register.maintenance-f8NCHf6u.js → register.maintenance-CaDyvPmk.js} +9 -9
- package/dist/{register.maintenance-DTx6vUDv.js → register.maintenance-ClYMbiJl.js} +7 -7
- package/dist/{register.message-DE-eKss6.js → register.message-BkAe3KaX.js} +2 -2
- package/dist/{register.message-5hKmcWaB.js → register.message-DJc4mrgz.js} +3 -3
- package/dist/{register.onboard-DmymXZNT.js → register.onboard-BUBCEjZ_.js} +2 -2
- package/dist/{register.onboard-tT7keiju.js → register.onboard-a-TEy7gB.js} +2 -2
- package/dist/{register.setup-DjHaiqnA.js → register.setup-9Je9b17j.js} +2 -2
- package/dist/{register.setup-D9AvFexw.js → register.setup-Dlmt8cdD.js} +2 -2
- package/dist/{register.status-health-sessions-Cbva8fTK.js → register.status-health-sessions-BfIwzFQw.js} +3 -3
- package/dist/{register.status-health-sessions-lOM_lb6H.js → register.status-health-sessions-CxepWnj5.js} +5 -5
- package/dist/{register.subclis-pmPhNoRB.js → register.subclis-D2hfRpSx.js} +9 -9
- package/dist/{reply-D8Yu6-Ie.js → reply-BOAv4F33.js} +42 -6
- package/dist/{run-main-D5C2p24j.js → run-main-D9foK80m.js} +16 -16
- package/dist/{server-node-events-yFZiE04b.js → server-node-events-B3SyIWEd.js} +3 -3
- package/dist/{server-node-events-nakjzVDn.js → server-node-events-DAuQ0Pk2.js} +2 -2
- package/dist/{session-utils-BncMg1bn.js → session-utils-BUkGcYpv.js} +40 -4
- package/dist/{sessions-C2Xfck_9.js → sessions-DVvNhGXX.js} +1 -1
- package/dist/{status-mS4bWnIW.js → status-Bor8v_Ab.js} +3 -3
- package/dist/{status-CQYA6EJN.js → status-C6WYtjMU.js} +2 -2
- package/dist/{subagent-registry-CXBreqUP.js → subagent-registry-CukgiXMW.js} +3 -3
- package/dist/{update-cli-C2EagLTi.js → update-cli-BDRni489.js} +9 -9
- package/dist/{update-cli-DiT2fFEK.js → update-cli-CWNpH8nb.js} +7 -7
- package/dist/{update-runner-C9noXbfV.js → update-runner-BAPahND7.js} +1 -1
- package/dist/{update-runner-DO6RodZW.js → update-runner-CE9BNhOu.js} +1 -1
- package/dist/{web-CDHXvGxm.js → web-C1PpWeXj.js} +1 -1
- package/dist/{web-DbdjX4Hg.js → web-C_RqjNux.js} +2 -2
- package/dist/{web-DJKitOpu.js → web-DBuATjw6.js} +1 -1
- package/dist/{web-BKrNiKsU.js → web-D_nYCn4Q.js} +3 -3
- package/package.json +1 -1
- package/dist/control-ui/assets/index-puDi2eTY.js.map +0 -1
- package/dist/plugin-sdk/web-B35hdNQ-.js +0 -72
|
@@ -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 Ts=globalThis,Mo=Ts.ShadowRoot&&(Ts.ShadyCSS===void 0||Ts.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),Hr=new WeakMap;let zl=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==Ro)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(Mo&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Hr.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Hr.set(n,t))}return t}toString(){return this.cssText}};const
|
|
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 Ts=globalThis,Mo=Ts.ShadowRoot&&(Ts.ShadyCSS===void 0||Ts.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),Hr=new WeakMap;let zl=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==Ro)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(Mo&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Hr.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Hr.set(n,t))}return t}toString(){return this.cssText}};const Iu=e=>new zl(typeof e=="string"?e:e+"",void 0,Ro),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 zl(n,e,Ro)},Ru=(e,t)=>{if(Mo)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Ts.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},zr=Mo?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Iu(n)})(e):e;const{is:Lu,defineProperty:Du,getOwnPropertyDescriptor:Pu,getOwnPropertyNames:Fu,getOwnPropertySymbols:Nu,getPrototypeOf:Ou}=Object,Xs=globalThis,jr=Xs.trustedTypes,Uu=jr?jr.emptyScript:"",Bu=Xs.reactiveElementPolyfillSupport,Bn=(e,t)=>e,Fs={toAttribute(e,t){switch(t){case Boolean:e=e?Uu: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)=>!Lu(e,t),Kr={attribute:!0,type:String,converter:Fs,reflect:!1,useDefault:!1,hasChanged:Lo};Symbol.metadata??=Symbol("metadata"),Xs.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=Kr){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&&Du(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:o}=Pu(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)??Kr}static _$Ei(){if(this.hasOwnProperty(Bn("elementProperties")))return;const t=Ou(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=[...Fu(n),...Nu(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(zr(i))}else t!==void 0&&n.push(zr(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 Ru(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:Fs).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:Fs;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,Bu?.({ReactiveElement:cn}),(Xs.reactiveElementVersions??=[]).push("2.1.2");const Do=globalThis,Wr=e=>e,Ns=Do.trustedTypes,qr=Ns?Ns.createPolicy("lit-html",{createHTML:e=>e}):void 0,jl="$lit$",ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Kl="?"+ht,Hu=`<${Kl}>`,Gt=document,qn=()=>Gt.createComment(""),Gn=e=>e===null||typeof e!="object"&&typeof e!="function",Po=Array.isArray,zu=e=>Po(e)||typeof e?.[Symbol.iterator]=="function",Ai=`[
|
|
2
2
|
\f\r]`,_n=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gr=/-->/g,Vr=/>/g,Mt=RegExp(`>|${Ai}(?:([^\\s"'>=/]+)(${Ai}*=${Ai}*(?:[^
|
|
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),Rt=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(!Po(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return qr!==void 0?qr.createHTML(t):t}const zu=(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=Mt):g[3]!==void 0&&(r=Mt):r===Mt?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?Mt:g[3]==='"'?Qr:Jr):r===Qr||r===Jr?r=Mt:r===Gr||r===Vr?r=_n:(r=Mt,i=void 0);const v=r===Mt&&e[l+1].startsWith("/>")?" ":"";o+=r===_n?a+Bu: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]=zu(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]==="."?Ku:m[1]==="?"?Wu:m[1]==="@"?qu:ei}),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=Ns?Ns.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 ju{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 Zs(o,o.nextSibling,this,t):a.type===1?d=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(d=new Gu(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 Zs=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):Hu(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 ju(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){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 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))}},ei=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??"")}},Ku=class extends ei{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===h?void 0:t}},Wu=class extends ei{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==h)}},qu=class extends ei{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)}},Gu=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 Vu={I:Zs},Ju=Do.litHtmlPolyfillSupport;Ju?.(Vn,Zs),(Do.litHtmlVersions??=[]).push("3.3.2");const Qu=(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 Zs(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=Qu(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 Yu=Fo.litElementPolyfillSupport;Yu?.({LitElement:mn});(Fo.litElementVersions??=[]).push("4.2.2");const Jl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const Xu={attribute:!0,type:String,converter:Fs,reflect:!1,hasChanged:Lo},Zu=(e=Xu,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 ti(e){return(t,n)=>typeof n=="object"?Zu(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 ti({...e,state:!0,attribute:!1})}const eg={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:"Skill 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."}}},tg="modulepreload",ng=function(e,t){return new URL(e,t).href},Xr={},ps=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=ng(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":tg,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"],sg={"zh-CN":{exportName:"zh_CN",loader:()=>ps(()=>import("./zh-CN-DpcDfKwj.js"),[],import.meta.url)},"zh-TW":{exportName:"zh_TW",loader:()=>ps(()=>import("./zh-TW-CrXJRxS8.js"),[],import.meta.url)},"pt-BR":{exportName:"pt_BR",loader:()=>ps(()=>import("./pt-BR-DtCy1Iqj.js"),[],import.meta.url)},de:{exportName:"de",loader:()=>ps(()=>import("./de-DCndbITT.js"),[],import.meta.url)}},Yl=[Nt,...Ql];function Xl(e){return e!=null&&Yl.includes(e)}function ig(e){return Ql.includes(e)}async function og(e){if(!ig(e))return null;const t=sg[e];return(await t.loader())[t.exportName]??null}class rg{constructor(){this.locale=Nt,this.translations={[Nt]:eg},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 og(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 rg,p=(e,t)=>Jn.t(e,t);class ag{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){this.unsubscribe=Jn.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){this.unsubscribe?.()}}async function Re(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 lg(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 cg(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 dg(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 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 ni(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 ec(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 tc(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",{});
|
|
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),Rt=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(!Po(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=Mt):g[3]!==void 0&&(r=Mt):r===Mt?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?Mt:g[3]==='"'?Qr:Jr):r===Qr||r===Jr?r=Mt:r===Gr||r===Vr?r=_n:(r=Mt,i=void 0);const v=r===Mt&&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:ei}),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=Ns?Ns.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 Zs(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 Zs=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){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 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))}},ei=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 ei{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===h?void 0:t}},qu=class extends ei{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==h)}},Gu=class extends ei{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:Zs},Qu=Do.litHtmlPolyfillSupport;Qu?.(Vn,Zs),(Do.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 Zs(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=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,Fo.litElementHydrateSupport?.({LitElement:mn});const Xu=Fo.litElementPolyfillSupport;Xu?.({LitElement:mn});(Fo.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:Fs,reflect:!1,hasChanged:Lo},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 ti(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 ti({...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:"Skill 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={},ps=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:()=>ps(()=>import("./zh-CN-DpcDfKwj.js"),[],import.meta.url)},"zh-TW":{exportName:"zh_TW",loader:()=>ps(()=>import("./zh-TW-CrXJRxS8.js"),[],import.meta.url)},"pt-BR":{exportName:"pt_BR",loader:()=>ps(()=>import("./pt-BR-DtCy1Iqj.js"),[],import.meta.url)},de:{exportName:"de",loader:()=>ps(()=>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 Re(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 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 ni(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 ec(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 tc(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",{});fg(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function nc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});gg(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function gg(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function fg(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 pg(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function sc(e){if(e.configFormMode!=="form"||!e.configForm)return e.configRaw;const t=pg(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=sc(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 hg(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=sc(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 ta(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 Me(e,t,n){const s=St(e.configForm??e.configSnapshot?.config??{});ec(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??{});tc(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=$n(n))}function mg(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 vg(e){const{state:t,callbacks:n,accountId:s}=e,i=mg(t),o=(l,a,d={})=>{const{type:g="text",placeholder:u,maxLength:f,help:v}=d,m=t.values[l]??"",S=t.fieldErrors[l],C=`nostr-profile-${l}`;return g==="textarea"?c`
|
|
5
5
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
6
6
|
<label for="${C}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
7
7
|
${a}
|
|
@@ -121,21 +121,21 @@
|
|
|
121
121
|
</div>
|
|
122
122
|
`:h}
|
|
123
123
|
</div>
|
|
124
|
-
`}function
|
|
124
|
+
`}function bg(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 yg(e,t){await cg(e,t),await Re(e,!0)}async function $g(e){await dg(e),await Re(e,!0)}async function xg(e){await ug(e),await Re(e,!0)}async function wg(e){await On(e),await Ae(e),await Re(e,!0)}async function Sg(e){await Ae(e),await Re(e,!0)}function kg(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 ic(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function oc(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Ag(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 rc(e){const t=Ag(e);return t?{Authorization:t}:{}}function Cg(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=bg(n??void 0)}function Tg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Eg(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function _g(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Ig(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=ic(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(oc(n),{method:"PUT",headers:{"Content-Type":"application/json",...rc(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:kg(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 Re(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=ic(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(oc(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json",...rc(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 Re(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function Rg(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 ss(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 ac(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 Lg(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 Dg(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function na(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1}function Pg(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 Pg(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 si(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 Fg(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 Ng=2e3,Og=new Set(["trace","debug","info","warn","error","fatal"]);function Ug(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 Bg(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Og.has(t)?t:null}function Hg(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=Bg(n?.logLevelName??n?.level),o=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,r=Ug(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(Hg),r=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-Ng),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 ii(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 zg(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{ii(e,{quiet:!0})},5e3))}function jg(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function lc(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Oo(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"&&si(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 Es(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 Kg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Os={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 Wg=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,hs=/<\s*\/?\s*final\b[^<>]*>/gi,sa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function qg(e,t){return e.trimStart()}function Gg(e,t){if(!e||!Wg.test(e))return e;let n=e;if(hs.test(n)){hs.lastIndex=0;const l=[],a=eo(n);for(const d of n.matchAll(hs)){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 hs.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),qg(i)}const ia=/<\s*(\/?)\s*relevant[-_]memories\b[^<>]*>/gi,Vg=/<\s*\/?\s*relevant[-_]memories\b/i;function Jg(e){if(!e||!Vg.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 Qg(e){const t=Gg(e);return Jg(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 Yg(e){return Qg(e)}const _s="last";function Xg(e){return e.sessionTarget==="isolated"&&e.payloadKind==="agentTurn"}function zo(e){return e.deliveryMode!=="announce"||Xg(e)?e:{...e,deliveryMode:"none"}}function is(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 os(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 Zg(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 oi(e){return await jo(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 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=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)&&rs(e)}catch(s){e.cronError=String(s)}finally{n?e.cronJobsLoadingMore=!1:e.cronLoading=!1}}async function ef(e){await jo(e,{append:!0})}async function oa(e){await jo(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 tf(e){return e.cronJobs.filter(t=>!(e.cronJobsScheduleKindFilter!=="all"&&t.schedule.kind!==e.cronJobsScheduleKindFilter||e.cronJobsLastStatusFilter!=="all"&&t.state?.lastStatus!==e.cronJobsLastStatusFilter))}function rs(e){e.cronEditingJobId=null}function vc(e){e.cronForm={...Os},e.cronFieldErrors=is(e.cronForm)}function nf(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 sf(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 of(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??_s,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):Os.failureAlertAfter,failureAlertCooldownSeconds:n&&typeof n=="object"&&typeof n.cooldownMs=="number"?String(Math.floor(n.cooldownMs/1e3)):Os.failureAlertCooldownSeconds,failureAlertChannel:n&&typeof n=="object"?n.channel??_s:_s,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=nf(e.schedule.at);else if(e.schedule.kind==="every"){const i=sf(e.schedule.everyMs);s.everyAmount=i.everyAmount,s.everyUnit=i.everyUnit}else{s.cronExpr=e.schedule.expr,s.cronTz=e.schedule.tz??"";const i=of(e.schedule.staggerMs);s.scheduleExact=i.scheduleExact,s.staggerAmount=i.staggerAmount,s.staggerUnit=i.staggerUnit}return zo(s)}function rf(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 af(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 lf(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()||_s,to:e.failureAlertTo.trim()||void 0,...i!==void 0?{cooldownMs:i}:{}};return o&&(l.mode=o),l.accountId=r||void 0,l}async function cf(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=is(t);if(e.cronFieldErrors=n,hc(n))return;const s=rf(t),i=af(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=lf(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}),rs(e)):(await e.client.request("cron.add",f),vc(e)),await oi(e),await os(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function df(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 oi(e),await os(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function uf(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 gf(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&&rs(e),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null),await oi(e),await os(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 ff(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 pf(e,t){e.cronEditingJobId=t.id,e.cronRunsJobId=t.id,e.cronForm=bc(t,e.cronForm),e.cronFieldErrors=is(e.cronForm)}function hf(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 mf(e,t){rs(e),e.cronRunsJobId=t.id;const n=new Set(e.cronJobs.map(i=>i.name.trim().toLowerCase())),s=bc(t,e.cronForm);s.name=hf(t.name,n),e.cronForm=s,e.cronFieldErrors=is(e.cronForm)}function vf(e){rs(e),vc(e)}function Ko(e){return e.trim()}function bf(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 yf(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 $f(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:bf(e.scopes),updatedAtMs:Date.now()};return s.tokens[t]=i,e.adapter.writeStore(s),i}function xf(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 yc="openclaw.device.auth.v1";function Wo(){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 qo(e){try{window.localStorage.setItem(yc,JSON.stringify(e))}catch{}}function wf(e){return yf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role})}function $c(e){return $f({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role,token:e.token,scopes:e.scopes})}function xc(e){xf({adapter:{readStore:Wo,writeStore:qo},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:Is,Gx:la,Gy:ca,a:Ci,d:Ti,h:Sf}=wc,Vt=32,Go=64,kf=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},me=(e="")=>{const t=new Error(e);throw kf(t,me),t},Af=e=>typeof e=="bigint",Cf=e=>typeof e=="string",Tf=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Tt=(e,t,n="")=>{const s=Tf(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},ri=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(!Cf(e))return me(t);const n=e.length,s=n/2;if(n%2)return me(t);const i=ri(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,Ef=()=>Tc()?.subtle??me("crypto.subtle must be defined, consider polyfill"),Qn=(...e)=>{const t=ri(e.reduce((s,i)=>s+Tt(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},_f=(e=Vt)=>Tc().getRandomValues(ri(e)),Us=BigInt,Ot=(e,t,n,s="bad number: out of range")=>Af(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,Is),If=(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=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 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}=Lf(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),C=U(r*l);return S!==C?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),C=U(g*v),R=U(f*u);return new Fe(m,S,R,C)}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),C=U((n+s)*(r+l)-f-v),R=U(S-m),I=U(S+m),A=U(v-g*f),w=U(C*R),L=U(I*A),_=U(C*A),M=U(R*I);return new Fe(w,L,M,_)}subtract(t){return this.add(Ei(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return fn;if(Ot(t,1n,Is),t===1n)return this;if(this.equals(Jt))return Kf(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=If(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(Us(Sf),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Is/2n,!1).double();return Is%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),Go)).reverse(),Ic=e=>Us("0x"+Ac(Sc(Tt(e)).reverse())),Ge=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=Se;return n},Rf=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,Lf=(e,t)=>{const n=U(t*t*t),s=U(n*n*t),i=Rf(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)),Vo=(...e)=>Rc.sha512Async(Qn(...e)),Df=(...e)=>Mf("sha512")(Qn(...e)),Mc=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(Mc),Pf=e=>Mc(Df(Tt(e,Vt))),Ff=e=>Jo(e).then(t=>t.pointBytes),Nf=e=>Vo(e.hashable).then(e.finish),Of=(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)),Go)}}},Uf=async(e,t)=>{const n=Tt(e),s=await Jo(t),i=await Vo(s.prefix,n);return Nf(Of(s,i,n))},Rc={sha512Async:async e=>{const t=Ef(),n=Qn(e);return ri(await t.digest("SHA-512",n.buffer))},sha512:void 0},Bf=(e=_f(Vt))=>e,Hf={getExtendedPublicKeyAsync:Jo,getExtendedPublicKey:Pf,randomSecretKey:Bf},Bs=8,zf=256,Lc=Math.ceil(zf/Bs)+1,ro=2**(Bs-1),jf=()=>{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},Kf=e=>{const t=ga||(ga=jf());let n=fn,s=Jt;const i=2**Bs,o=i,r=Us(i-1),l=Us(Bs);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 Wf(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 Wf(new Uint8Array(t))}async function qf(){const e=Hf.randomSecretKey(),t=await Ff(e);return{deviceId:await Pc(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 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 qf(),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 Gf(e,t){const n=Dc(e),s=new TextEncoder().encode(t),i=await Uf(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 Vf(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 Jf(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 Qf(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)&&$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 Yf(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&&xc({deviceId:s.deviceId,role:t.role}),await Et(e)}catch(s){e.devicesError=String(s)}}function Xf(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 Zf(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=Xf(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);ep(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function ep(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=St(t.file??{}))}async function tp(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=Zf(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 np(e,t,n){const s=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});ec(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function sp(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 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=Fc(t)}finally{e.marketLoading=!1}}}async function ip(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),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 Nc(e){return typeof e=="string"?e.trim()||void 0:!e||typeof e!="object"?void 0:e.primary?.trim()||void 0}const op=8192,Hs="bitseek",rp="bitseek/AUTO",Yn=16e3,ap=4096,lp={"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};function lo(e,t){return`${e}/${t}`}function cp(e){const t=typeof e=="number"&&Number.isFinite(e)?Math.floor(e):0;return t>=Yn?t:Yn}function dp(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 up(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 gp(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 er(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t>0?t:null}function fp(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=er(o.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function pp(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=er(s?.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function hp(e){const t=e.trim().toLowerCase();return t?lp[t]??null:null}function mp(e){const t=gp(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=er(r.contextWindow);let a;if(t.providerId===Hs)a=op;else{const d=fp({config:e.config,selectedProviderId:t.providerId,modelId:t.modelId}),g=pp({selectedProviderId:t.providerId,modelId:t.modelId,catalogModels:e.catalogModels}),u=hp(t.modelId),f=d??g??u;a=f!=null?Math.max(f,Yn):Math.max(l??0,Yn)}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 co(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 co(i)||"custom"}catch{return"custom"}}function vp(e){const t=e.config.models?.providers??{},n=co(e.requestedProviderId?.trim()||"");if(n)return n;const s=Oc(e.baseUrl),i=co(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 bp(e){try{new URL(e)}catch{throw new Error("Custom provider base URL must be a valid URL.")}}function yp(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 $p(e){const t=e.baseUrl.trim();bp(t);const n=e.modelId.trim();if(!n)throw new Error("Custom provider model ID is required.");const s=vp({config:e.config,baseUrl:t,requestedProviderId:e.providerId}),i=e.config.models?.providers??{},o=i[s],r=Array.isArray(o?.models)?o.models:[],l=e.previousModelId?.trim(),a=l?r.filter(L=>L.id!==l):r,d=a.some(L=>L.id===n),g={id:n,name:`${n} (Custom Provider)`,contextWindow:Yn,maxTokens:ap,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!1},u=d?a.map(L=>L.id===n?{...L,contextWindow:cp(L.contextWindow)}:L):[...a,g],f=e.replaceApiKey===!0?e.apiKey?.trim():void 0,v={...o??{baseUrl:t,models:[],api:"openai-completions"},baseUrl:t,api:"openai-completions",models:u.length>0?u:[g]};e.replaceApiKey===!0&&(f?v.apiKey=f:delete v.apiKey);const m=lo(s,n),S=e.providerId?.trim()||s,C=l?lo(S,l):void 0,R=e.alias?.trim()??"";yp({cfg:e.config,alias:R,modelRef:m,ignoreModelRefs:C?[C]:[]});const I={...e.config.agents?.defaults?.models};C&&C!==m&&delete I[C];const A={...I[m]};return R?A.alias=R:delete A.alias,I[m]=A,{config:{...e.config,models:{...e.config.models,mode:e.config.models?.mode??"merge",providers:{...i,[s]:v}},agents:{...e.config.agents,defaults:{...e.config.agents?.defaults,models:I}}},providerId:s,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(lo(i,l))}return s}function xp(e){const t=ha(e,Hs);return t.length>0?t[0]:e[Hs]?rp:ha(e)[0]}function wp(e){const t=e.providerId.trim();if(!t||t===Hs)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=dp(o?.model),d=up(o?.model).filter(m=>!m.startsWith(i)),u=(a&&!a.startsWith(i)?a:void 0)??xp(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__",Xn="bitseek",Sp=4e3,zs=new WeakMap;function kp(e){const t=zs.get(e);t&&(clearTimeout(t),zs.delete(e))}function hn(e,t){if(e.modelsVerifyState=t,kp(e),t?.tone!=="success")return;const n=t,s=setTimeout(()=>{e.modelsVerifyState===n&&(e.modelsVerifyState=null),zs.delete(e)},Sp);zs.set(e,s)}function Ap(e){const t=e instanceof Error?e.message:String(e);return/invalid models\.verify params/i.test(t)&&/providerId/i.test(t)}function as(e){return St(e?.config??{})}function Cp(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 Tp(e,t,n){const s=n.startsWith(`${e}/`)?n.slice(e.length+1):"";return t.models.find(o=>o.id===s)?.id??t.models[0]?.id??""}function tr(e,t,n){return e.agents?.defaults?.models?.[`${t}/${n}`]?.alias?.trim()??""}function Ep(e){return e===Xn?"BitSeek":e}function Uc(e){const t=e.models?.providers??{};return Object.entries(t).filter(([,n])=>Cp(n)).map(([n,s])=>[n,s]).toSorted(([n],[s])=>n===Xn?-1:s===Xn?1:n.localeCompare(s))}function _p(e,t,n,s){const i=Tp(t,n,s),o=tr(e,t,i),r=t===Xn?"bitseek":"custom";return{providerId:t,kind:r,title:r==="bitseek"?"BitSeek":o||t,subtitle:r==="bitseek"?"Built-in provider":t,modelId:i,modelRef:`${t}/${i}`,baseUrl:n.baseUrl,apiKeyConfigured:n.apiKey!==void 0}}function Bc(e){const t=Nc(e.agents?.defaults?.model)??"";return Uc(e).map(([n,s])=>_p(e,n,s,t))}function Ip(e){const t=[];for(const[n,s]of Uc(e)){const i=Ep(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 Hc(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,saved:!0,canDelete:t.kind==="custom",readonlyModelIdentity:n}}function js(){return{kind:"custom",originalProviderId:null,originalModelId:null,providerIdHint:"custom",displayName:"",baseUrl:"",apiKey:"",apiKeyConfigured:!1,apiKeyChanged:!1,modelId:"",saved:!1,canDelete:!1,readonlyModelIdentity:!1}}function ai(e){const t=as(e.configSnapshot),n=Bc(t),s=Ip(t),i=Nc(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.providerId===e.modelsSelectedProviderId)?e.modelsSelectedProviderId:n[0]?.providerId??pn;if(e.modelsProviders=n,e.modelsSwitchableModels=s,e.modelsSelectedDefault=r,e.modelsSelectedProviderId=l,l===pn){e.modelsDraft=js();return}const a=n.find(d=>d.providerId===l);e.modelsDraft=a?Hc(t,a):js()}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 zc(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=as(e.configSnapshot);if(t===pn){e.modelsDraft=js();return}const s=Bc(n).find(i=>i.providerId===t);e.modelsDraft=s?Hc(n,s):js()}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),e.modelsDraft=s,hn(e,null)}async function Rp(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 d=t.apiKey.trim();if(!d)throw new Error("BitSeek API key cannot be empty.");await e.client.request("models.auth.set",{providerId:Xn,apiKey:d}),e.modelsDraft={...t,apiKey:"",apiKeyChanged:!1,apiKeyConfigured:!0},e.modelsVerifyState={tone:"success",message:"BitSeek API key saved."};return}const n=as(e.configSnapshot),s=t.originalProviderId&&t.originalModelId?`${t.originalProviderId}/${t.originalModelId}`:"",i=$p({config:n,baseUrl:t.baseUrl,modelId:t.modelId,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}`,r=e.modelsSelectedDefault===s?o:e.modelsSelectedDefault,l=Zo(i.config,r||o);if(!await nr(e,l))return;e.modelsSelectedProviderId=i.providerId??null,ai(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Lp(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=mp({config:as(e.configSnapshot),modelRef:t,catalogModels:n}),i=Zo(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 Dp(e){if(!(!e.client||!e.connected||!e.modelsDraft?.originalProviderId)&&e.modelsDraft.kind==="custom"){e.modelsSaving=!0,e.modelsError=null;try{const t=wp({config:as(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 Pp(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||!Ap(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 Fp(e,t){e.modelsSelectedDefault=t,e.modelsDefaultState=null}function Np(){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 Op(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 Up(e,t){if(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
126
|
+
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),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 si(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 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(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 ii(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(()=>{ii(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"&&Oo(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"&&si(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 Es(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 Wg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Os={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 qg=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,hs=/<\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(hs.test(n)){hs.lastIndex=0;const l=[],a=eo(n);for(const d of n.matchAll(hs)){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 hs.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 _s="last";function Zg(e){return e.sessionTarget==="isolated"&&e.payloadKind==="agentTurn"}function zo(e){return e.deliveryMode!=="announce"||Zg(e)?e:{...e,deliveryMode:"none"}}function is(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 os(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 oi(e){return await jo(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 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=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)&&rs(e)}catch(s){e.cronError=String(s)}finally{n?e.cronJobsLoadingMore=!1:e.cronLoading=!1}}async function tf(e){await jo(e,{append:!0})}async function oa(e){await jo(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 rs(e){e.cronEditingJobId=null}function vc(e){e.cronForm={...Os},e.cronFieldErrors=is(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??_s,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):Os.failureAlertAfter,failureAlertCooldownSeconds:n&&typeof n=="object"&&typeof n.cooldownMs=="number"?String(Math.floor(n.cooldownMs/1e3)):Os.failureAlertCooldownSeconds,failureAlertChannel:n&&typeof n=="object"?n.channel??_s:_s,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 zo(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()||_s,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=zo(e.cronForm);t!==e.cronForm&&(e.cronForm=t);const n=is(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}),rs(e)):(await e.client.request("cron.add",f),vc(e)),await oi(e),await os(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 oi(e),await os(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&&rs(e),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null),await oi(e),await os(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=is(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){rs(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=is(e.cronForm)}function bf(e){rs(e),vc(e)}function Ko(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=Ko(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function xf(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: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=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 yc="openclaw.device.auth.v1";function Wo(){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 qo(e){try{window.localStorage.setItem(yc,JSON.stringify(e))}catch{}}function Sf(e){return $f({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role})}function $c(e){return xf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role,token:e.token,scopes:e.scopes})}function xc(e){wf({adapter:{readStore:Wo,writeStore:qo},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:Is,Gx:la,Gy:ca,a:Ci,d:Ti,h:kf}=wc,Vt=32,Go=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},ri=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=ri(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=ri(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(ri(e)),Us=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,Is),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")},Rf=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 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),C=U(r*l);return S!==C?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),C=U(g*v),R=U(f*u);return new Fe(m,S,R,C)}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),C=U((n+s)*(r+l)-f-v),R=U(S-m),I=U(S+m),A=U(v-g*f),w=U(C*R),L=U(I*A),_=U(C*A),M=U(R*I);return new Fe(w,L,M,_)}subtract(t){return this.add(Ei(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return fn;if(Ot(t,1n,Is),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=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=_c(n);return s[31]|=t&1n?128:0,s}toHex(){return Ac(this.toBytes())}clearCofactor(){return this.multiply(Us(kf),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Is/2n,!1).double();return Is%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),Go)).reverse(),Ic=e=>Us("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)),Vo=(...e)=>Rc.sha512Async(Qn(...e)),Pf=(...e)=>Rf("sha512")(Qn(...e)),Mc=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(Mc),Ff=e=>Mc(Pf(Tt(e,Vt))),Nf=e=>Jo(e).then(t=>t.pointBytes),Of=e=>Vo(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)),Go)}}},Bf=async(e,t)=>{const n=Tt(e),s=await Jo(t),i=await Vo(s.prefix,n);return Of(Uf(s,i,n))},Rc={sha512Async:async e=>{const t=_f(),n=Qn(e);return ri(await t.digest("SHA-512",n.buffer))},sha512:void 0},Hf=(e=If(Vt))=>e,zf={getExtendedPublicKeyAsync:Jo,getExtendedPublicKey:Ff,randomSecretKey:Hf},Bs=8,jf=256,Lc=Math.ceil(jf/Bs)+1,ro=2**(Bs-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**Bs,o=i,r=Us(i-1),l=Us(Bs);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 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 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 Qo(),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 Qo();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 Yo(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 Yo(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 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=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 Xo(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 Nc(e){return typeof e=="string"?e.trim()||void 0:!e||typeof e!="object"?void 0:e.primary?.trim()||void 0}const rp=8192,Hs="bitseek",ap="bitseek/AUTO",Yn=32e3,lp=4096,cp={"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 lo(e,t){return`${e}/${t}`}function dp(e){const t=typeof e=="number"&&Number.isFinite(e)?Math.floor(e):0;return t>=Yn?t:Yn}function up(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 gp(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 fp(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 er(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t>0?t:null}function pp(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=er(o.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function hp(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=er(s?.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function mp(e){const t=e.trim().toLowerCase();return t?cp[t]??null:null}function Oc(e){const t=fp(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=er(r.contextWindow);let a;if(t.providerId===Hs)a=rp;else{const d=pp({config:e.config,selectedProviderId:t.providerId,modelId:t.modelId}),g=hp({selectedProviderId:t.providerId,modelId:t.modelId,catalogModels:e.catalogModels}),u=mp(t.modelId),f=d??g??u;a=f!=null?Math.max(f,Yn):Math.max(l??0,Yn)}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 co(e){const t=e.trim().toLowerCase();return t?t.replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,""):""}function Uc(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 co(i)||"custom"}catch{return"custom"}}function vp(e){const t=e.config.models?.providers??{},n=co(e.requestedProviderId?.trim()||"");if(n)return n;const s=Uc(e.baseUrl),i=co(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 bp(e){try{new URL(e)}catch{throw new Error("Custom provider base URL must be a valid URL.")}}function yp(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 $p(e){const t=e.baseUrl.trim();bp(t);const n=e.modelId.trim();if(!n)throw new Error("Custom provider model ID is required.");const s=vp({config:e.config,baseUrl:t,requestedProviderId:e.providerId}),i=e.config.models?.providers??{},o=i[s],r=Array.isArray(o?.models)?o.models:[],l=e.previousModelId?.trim(),a=l?r.filter(L=>L.id!==l):r,d=a.some(L=>L.id===n),g={id:n,name:`${n} (Custom Provider)`,contextWindow:Yn,maxTokens:lp,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!1},u=d?a.map(L=>L.id===n?{...L,contextWindow:dp(L.contextWindow)}:L):[...a,g],f=e.replaceApiKey===!0?e.apiKey?.trim():void 0,v={...o??{baseUrl:t,models:[],api:"openai-completions"},baseUrl:t,api:"openai-completions",models:u.length>0?u:[g]};e.replaceApiKey===!0&&(f?v.apiKey=f:delete v.apiKey);const m=lo(s,n),S=e.providerId?.trim()||s,C=l?lo(S,l):void 0,R=e.alias?.trim()??"";yp({cfg:e.config,alias:R,modelRef:m,ignoreModelRefs:C?[C]:[]});const I={...e.config.agents?.defaults?.models};C&&C!==m&&delete I[C];const A={...I[m]};return R?A.alias=R:delete A.alias,I[m]=A,{config:{...e.config,models:{...e.config.models,mode:e.config.models?.mode??"merge",providers:{...i,[s]:v}},agents:{...e.config.agents,defaults:{...e.config.agents?.defaults,models:I}}},providerId:s,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(lo(i,l))}return s}function xp(e){const t=ha(e,Hs);return t.length>0?t[0]:e[Hs]?ap:ha(e)[0]}function wp(e){const t=e.providerId.trim();if(!t||t===Hs)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=up(o?.model),d=gp(o?.model).filter(m=>!m.startsWith(i)),u=(a&&!a.startsWith(i)?a:void 0)??xp(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__",Xn="bitseek",Sp=4e3,zs=new WeakMap;function kp(e){const t=zs.get(e);t&&(clearTimeout(t),zs.delete(e))}function hn(e,t){if(e.modelsVerifyState=t,kp(e),t?.tone!=="success")return;const n=t,s=setTimeout(()=>{e.modelsVerifyState===n&&(e.modelsVerifyState=null),zs.delete(e)},Sp);zs.set(e,s)}function Ap(e){const t=e instanceof Error?e.message:String(e);return/invalid models\.verify params/i.test(t)&&/providerId/i.test(t)}function as(e){return St(e?.config??{})}function Cp(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 Tp(e,t,n){const s=n.startsWith(`${e}/`)?n.slice(e.length+1):"";return t.models.find(o=>o.id===s)?.id??t.models[0]?.id??""}function tr(e,t,n){return e.agents?.defaults?.models?.[`${t}/${n}`]?.alias?.trim()??""}function Ep(e){return e===Xn?"BitSeek":e}function Bc(e){const t=e.models?.providers??{};return Object.entries(t).filter(([,n])=>Cp(n)).map(([n,s])=>[n,s]).toSorted(([n],[s])=>n===Xn?-1:s===Xn?1:n.localeCompare(s))}function _p(e,t,n,s){const i=Tp(t,n,s),o=tr(e,t,i),r=t===Xn?"bitseek":"custom";return{providerId:t,kind:r,title:r==="bitseek"?"BitSeek":o||t,subtitle:r==="bitseek"?"Built-in provider":t,modelId:i,modelRef:`${t}/${i}`,baseUrl:n.baseUrl,apiKeyConfigured:n.apiKey!==void 0}}function Hc(e){const t=Nc(e.agents?.defaults?.model)??"";return Bc(e).map(([n,s])=>_p(e,n,s,t))}function Ip(e){const t=[];for(const[n,s]of Bc(e)){const i=Ep(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,saved:!0,canDelete:t.kind==="custom",readonlyModelIdentity:n}}function js(){return{kind:"custom",originalProviderId:null,originalModelId:null,providerIdHint:"custom",displayName:"",baseUrl:"",apiKey:"",apiKeyConfigured:!1,apiKeyChanged:!1,modelId:"",saved:!1,canDelete:!1,readonlyModelIdentity:!1}}function ai(e){const t=as(e.configSnapshot),n=Hc(t),s=Ip(t),i=Nc(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.providerId===e.modelsSelectedProviderId)?e.modelsSelectedProviderId:n[0]?.providerId??pn;if(e.modelsProviders=n,e.modelsSwitchableModels=s,e.modelsSelectedDefault=r,e.modelsSelectedProviderId=l,l===pn){e.modelsDraft=js();return}const a=n.find(d=>d.providerId===l);e.modelsDraft=a?zc(t,a):js()}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=as(e.configSnapshot);if(t===pn){e.modelsDraft=js();return}const s=Hc(n).find(i=>i.providerId===t);e.modelsDraft=s?zc(n,s):js()}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=Uc(n.trim())||"custom"),t==="apiKey"&&(s.apiKeyChanged=!0),e.modelsDraft=s,hn(e,null)}async function Rp(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 u=t.apiKey.trim();if(!u)throw new Error("BitSeek API key cannot be empty.");await e.client.request("models.auth.set",{providerId:Xn,apiKey:u}),e.modelsDraft={...t,apiKey:"",apiKeyChanged:!1,apiKeyConfigured:!0},e.modelsVerifyState={tone:"success",message:"BitSeek API key saved."};return}const n=as(e.configSnapshot),s=t.originalProviderId&&t.originalModelId?`${t.originalProviderId}/${t.originalModelId}`:"",i=$p({config:n,baseUrl:t.baseUrl,modelId:t.modelId,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 u=await e.client.request("models.list",{});r=Array.isArray(u?.models)?u.models:[]}catch{r=[]}const l=Oc({config:i.config,modelRef:o,catalogModels:r}),a=e.modelsSelectedDefault===s?o:e.modelsSelectedDefault,d=Zo(l,a||o);if(!await nr(e,d))return;e.modelsSelectedProviderId=i.providerId??null,ai(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Lp(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=Oc({config:as(e.configSnapshot),modelRef:t,catalogModels:n}),i=Zo(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 Dp(e){if(!(!e.client||!e.connected||!e.modelsDraft?.originalProviderId)&&e.modelsDraft.kind==="custom"){e.modelsSaving=!0,e.modelsError=null;try{const t=wp({config:as(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 Pp(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||!Ap(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 Fp(e,t){e.modelsSelectedDefault=t,e.modelsDefaultState=null}function Np(){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 Op(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 Up(e,t){if(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
127
127
|
|
|
128
|
-
Deletes the session entry and archives its transcript.`))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 Bp(e,t){return await Up(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 ls(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 Hp(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function zp(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 ls(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 jp(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 ls(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 Kp(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 ls(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 Wp=[{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 Zn(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=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=Zn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Kc.get(i)??null}function qc(e){let t=Zn(e);if(t.endsWith("/index.html")&&(t=Zn(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 qp(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 uo(e){return p(`tabs.${e}`)}function Gp(e){return p(`subtitles.${e}`)}const Gc="openclaw.control.settings.v1";function Vp(){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:Xl(s.locale)?s.locale:void 0}}catch{return t}}function Jp(e){localStorage.setItem(Gc,JSON.stringify(e))}const ms=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Qp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,vs=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Yp=({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=Qp();if(!!r.startViewTransition&&!l){let d=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")d=ms(n.pointerClientX/window.innerWidth),g=ms(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(d=ms((u.left+u.width/2)/window.innerWidth),g=ms((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(()=>vs(o)):vs(o)}catch{vs(o),t()}return}t(),vs(o)};function Xp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ir(e){return e==="system"?Xp():e}function At(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,Jp(n),t.theme!==e.theme&&(e.theme=t.theme,di(e,ir(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 Zp(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 eh(e,t){Yc(e,t,{refreshPolicy:"always",syncUrl:!0})}function th(e,t,n){Yp({nextTheme:t,applyTheme:()=>{e.theme=t,At(e,{...e.settings,theme:t}),di(e,ir(t))},context:n,currentTheme:e.theme})}async function Jc(e){if(e.tab==="overview"&&await Zc(e),e.tab==="channels"&&await ch(e),e.tab==="instances"&&await sr(e),e.tab==="sessions"&&await Yt(e),e.tab==="cron"&&await Ks(e),e.tab==="skills"&&await ls(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&&fc(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(gc(e,n),e.agentsPanel==="skills"&&Es(e,n),e.agentsPanel==="channels"&&Re(e,!1),e.agentsPanel==="cron"&&Ks(e))}e.tab==="models"&&await zc(e),e.tab==="nodes"&&(await ii(e),await Et(e),await Ae(e),await Yo(e)),e.tab==="chat"&&(await gd(e),ss(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await nc(e),await Ae(e)),e.tab==="debug"&&(await si(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Oo(e,{reset:!0}),ac(e,!0))}function nh(){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 sh(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 ih(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 oh(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 rh(e,t){if(typeof window>"u")return;const n=Wc(window.location.pathname,e.basePath)??"chat";Qc(e,n),Xc(e,n,t)}function ah(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"?lc(e):cc(e),t==="debug"?dc(e):uc(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=Zn(ci(t,e.basePath)),i=Zn(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 lh(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([Re(e,!1),sr(e),Yt(e),os(e),si(e)])}async function ch(e){await Promise.all([Re(e,!0),nc(e),Ae(e)])}async function Ks(e){const t=e;if(await Promise.all([Re(e,!1),os(t),oi(t),Zg(t)]),t.cronRunsScope==="all"){await yt(t,null);return}t.cronRunsJobId&&await yt(t,t.cronRunsJobId)}const va=50,dh=80,uh=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 gh(e){return Array.isArray(e)?e.map(t=>Oe(t)).filter(t=>!!t):[]}function fh(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 ph(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(`
|
|
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 Bp(e,t){return await Up(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 ls(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 Hp(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function zp(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 ls(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 jp(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 ls(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 Kp(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 ls(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 Wp=[{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 Zn(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=Zn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Wc.get(i)??null}function Gc(e){let t=Zn(e);if(t.endsWith("/index.html")&&(t=Zn(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 qp(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 uo(e){return p(`tabs.${e}`)}function Gp(e){return p(`subtitles.${e}`)}const Vc="openclaw.control.settings.v1";function Vp(){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 Jp(e){localStorage.setItem(Vc,JSON.stringify(e))}const ms=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Qp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,vs=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Yp=({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=Qp();if(!!r.startViewTransition&&!l){let d=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")d=ms(n.pointerClientX/window.innerWidth),g=ms(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(d=ms((u.left+u.width/2)/window.innerWidth),g=ms((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(()=>vs(o)):vs(o)}catch{vs(o),t()}return}t(),vs(o)};function Xp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ir(e){return e==="system"?Xp():e}function At(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,Jp(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 Zp(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 eh(e,t){Xc(e,t,{refreshPolicy:"always",syncUrl:!0})}function th(e,t,n){Yp({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 ch(e),e.tab==="instances"&&await sr(e),e.tab==="sessions"&&await Yt(e),e.tab==="cron"&&await Ks(e),e.tab==="skills"&&await ls(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&&fc(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(gc(e,n),e.agentsPanel==="skills"&&Es(e,n),e.agentsPanel==="channels"&&Re(e,!1),e.agentsPanel==="cron"&&Ks(e))}e.tab==="models"&&await jc(e),e.tab==="nodes"&&(await ii(e),await Et(e),await Ae(e),await Yo(e)),e.tab==="chat"&&(await fd(e),ss(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await nc(e),await Ae(e)),e.tab==="debug"&&(await si(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Oo(e,{reset:!0}),ac(e,!0))}function nh(){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 sh(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 ih(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 oh(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 rh(e,t){if(typeof window>"u")return;const n=qc(window.location.pathname,e.basePath)??"chat";Yc(e,n),Zc(e,n,t)}function ah(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=Zn(ci(t,e.basePath)),i=Zn(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 lh(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([Re(e,!1),sr(e),Yt(e),os(e),si(e)])}async function ch(e){await Promise.all([Re(e,!0),nc(e),Ae(e)])}async function Ks(e){const t=e;if(await Promise.all([Re(e,!1),os(t),oi(t),ef(t)]),t.cronRunsScope==="all"){await yt(t,null);return}t.cronRunsJobId&&await yt(t,t.cronRunsJobId)}const va=50,dh=80,uh=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 gh(e){return Array.isArray(e)?e.map(t=>Oe(t)).filter(t=>!!t):[]}function fh(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 ph(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
129
|
`)}function ba(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=ph(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=pc(n,uh);return s.truncated?`${s.text}
|
|
130
130
|
|
|
131
|
-
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function hh(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 mh(e){if(e.toolStreamOrder.length<=va)return;const t=e.toolStreamOrder.length-va,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function vh(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function go(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),vh(e)}function bh(e,t=!1){if(t){go(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>go(e),dh))}function ui(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],go(e)}const yh=5e3,$h=8e3;function xh(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},yh))}function
|
|
132
|
-
`);return/<<<EXTERNAL_UNTRUSTED_CONTENT|UNTRUSTED channel metadata \(|Source:\s+/.test(n)}function
|
|
131
|
+
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function hh(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 mh(e){if(e.toolStreamOrder.length<=va)return;const t=e.toolStreamOrder.length-va,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function vh(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function go(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),vh(e)}function bh(e,t=!1){if(t){go(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>go(e),dh))}function ui(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],go(e)}const yh=5e3,$h=8e3;function xh(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},yh))}function td(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 wh(e,t){const n=t.data??{},s=t.stream==="fallback"?"fallback":Oe(n.phase);if(t.stream==="lifecycle"&&s!=="fallback"&&s!=="fallback_cleared"||!td(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=gh(n.attemptSummaries);return g.length>0?g:fh(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},$h)}function Sh(e,t){if(!t)return;if(t.stream==="compaction"){xh(e,t);return}if(t.stream==="lifecycle"||t.stream==="fallback"){wh(e,t);return}if(t.stream!=="tool")return;const n=td(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"?ba(i.partialResult):l==="result"?ba(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=hh(u),mh(e),bh(e,l==="result")}const nd=["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):"],sd="Untrusted context (metadata, do not treat as instructions or commands):",kh=new RegExp([...nd,sd].map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"));function Ah(e){const t=e.trim();return nd.some(n=>n===t)}function Ch(e,t){if(e[t]?.trim()!==sd)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 id(e){if(!e||!kh.test(e))return e;const t=e.split(`
|
|
133
133
|
`),n=[];let s=!1,i=!1;for(let o=0;o<t.length;o++){const r=t[o];if(!s&&Ch(t,o))break;if(!s&&Ah(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 Th=/^\[([^\]]+)\]\s*/,Eh=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","Google Chat","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"];function _h(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:Eh.some(t=>e.startsWith(`${t} `))}function ya(e){const t=e.match(Th);if(!t)return e;const n=t[1]??"";return _h(n)?e.slice(t[0].length):e}const Ii=new WeakMap,Mi=new WeakMap;function Ih(e,t){const n=t.toLowerCase()==="user";return t==="assistant"?
|
|
135
|
-
`);const i=
|
|
136
|
-
`):null}function Mh(e){if(!e||typeof e!="object")return $a(e);const t=e;if(Mi.has(t))return Mi.get(t)??null;const n=$a(e);return Mi.set(t,n),n}function
|
|
134
|
+
`).replace(/^\n+/,"").replace(/\n+$/,"")}const Th=/^\[([^\]]+)\]\s*/,Eh=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","Google Chat","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"];function _h(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:Eh.some(t=>e.startsWith(`${t} `))}function ya(e){const t=e.match(Th);if(!t)return e;const n=t[1]??"";return _h(n)?e.slice(t[0].length):e}const Ii=new WeakMap,Mi=new WeakMap;function Ih(e,t){const n=t.toLowerCase()==="user";return t==="assistant"?Xg(e):n?id(ya(e)):ya(e)}function Ws(e){const t=e,n=typeof t.role=="string"?t.role:"",s=rd(e);return s?Ih(s,n):null}function od(e){if(!e||typeof e!="object")return Ws(e);const t=e;if(Ii.has(t))return Ii.get(t)??null;const n=Ws(e);return Ii.set(t,n),n}function $a(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=rd(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 Mh(e){if(!e||typeof e!="object")return $a(e);const t=e;if(Mi.has(t))return Mi.get(t)??null;const n=$a(e);return Mi.set(t,n),n}function rd(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
137
|
`)}return typeof t.text=="string"?t.text:null}function Rh(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 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 Lh(){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 Dh(){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 Dh(),wa(Lh())}const Ph=/^\s*NO_REPLY\s*$/;function zn(e){return Ph.test(e)}function Ms(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=Ws(e);return typeof s=="string"&&zn(s)}async function es(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=>!Ms(s)),e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Fh(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 Nh(e){return rd(e,{roleRequirement:"required",roleCaseSensitive:!0,requireContentArray:!0})}function Sa(e){return rd(e,{roleRequirement:"optional",allowTextField:!0})}async function Oh(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=Fh(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 Uh(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 Bh(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&&!Ms(n)?(e.chatMessages=[...e.chatMessages,n],null):"final"}return null}if(t.state==="delta"){const n=Ws(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&&!Ms(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=Nh(t.message);if(n&&!Ms(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 ad=120;function ld(e){return e.chatSending||!!e.chatRunId}function Hh(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 Uh(e))}function jh(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 dd(e,t,n){ui(e);const s=await Oh(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),ss(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 Kh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wh(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(Hh(i)){await cd(e);return}const a=zh(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),ld(e)){jh(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([es(e),Yt(e,{activeMinutes:ad}),fo(e)]),t?.scheduleScroll!==!1&&ss(e)}const qh=ud;function Gh(e){const t=Mg(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vh(e,t){const n=Xt(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function fo(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vh(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 Jh="update.available";function Qh(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 Yh=50,Xh=200,Zh="Assistant";function or(e){const t=ka(e?.name,Yh)??Zh,n=ka(e?.avatar??void 0,Xh)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}async function fd(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 po(e){return typeof e=="object"&&e!==null}function em(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 tm(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 pd(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function nm(e,t){const n=pd(e).filter(s=>s.id!==t.id);return n.push(t),n}function Aa(e,t){return pd(e).filter(n=>n.id!==t)}function sm(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 hd={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=hd,ho={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(hd));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 im(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 om(e){return im(e?.details)}const rm=4008;class am{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=wf({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=sm({deviceId:i.deviceId,clientId:this.opts.clientName??Ca.CONTROL_UI,clientMode:this.opts.mode??ho.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:r??null,nonce:u}),v=await Gf(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??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&&$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(rm,"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 Ri(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 lm(e,t){if(!t?.mainSessionKey)return;const n=Ri(e.sessionKey,t),s=Ri(e.settings.sessionKey,t),i=Ri(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 md(e){e.lastError=null,e.lastErrorCode=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=e.client,n=new am({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,fm(e,s),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,ui(e),fd(e),Uo(e),Hn(e),Ae(e),ii(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=om(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&&cm(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 cm(e,t){try{gm(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function dm(e,t,n){if(n!=="final"&&n!=="error"&&n!=="aborted")return;ui(e),qh(e);const s=t?.runId;!s||!e.refreshSessionsAfterChat.has(s)||(e.refreshSessionsAfterChat.delete(s),n==="final"&&Yt(e,{activeMinutes:ad}))}function um(e,t){t?.sessionKey&&Vc(e,t.sessionKey);const n=Bh(e,t);dm(e,t,n),n==="final"&&Qh(t)&&es(e)}function gm(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;Sh(e,t.payload);return}if(t.event==="chat"){um(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"&&Ks(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Et(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=em(t.payload);if(n){e.execApprovalQueue=nm(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=tm(t.payload);n&&(e.execApprovalQueue=Aa(e.execApprovalQueue,n.id));return}if(t.event===Jh){const n=t.payload;e.updateAvailable=n?.updateAvailable??null}}function fm(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&lm(e,n.sessionDefaults),e.updateAvailable=n?.updateAvailable??null}const Ea="/__openclaw/control-ui-config.json";async function pm(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 hm(e){e.basePath=nh(),pm(e),Zp(e),rh(e,!0),sh(e),ih(e),window.addEventListener("popstate",e.popStateHandler),md(e),zg(e),e.tab==="logs"&&lc(e),e.tab==="debug"&&dc(e)}function mm(e){Pg(e)}function vm(e){window.removeEventListener("popstate",e.popStateHandler),jg(e),cc(e),uc(e),e.client?.stop(),e.client=null,e.connected=!1,oh(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function bm(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;ss(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 vd="openclaw.control.usage.date-params.v1",ym="__default__",$m=/unexpected property ['"]mode['"]/i,xm=/unexpected property ['"]utcoffset['"]/i,wm=/invalid sessions\.usage params/i;let Li=null;function bd(){return typeof window<"u"&&window.localStorage?window.localStorage:typeof localStorage<"u"?localStorage:null}function Sm(){const e=bd();if(!e)return new Set;try{const t=e.getItem(vd);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 km(e){const t=bd();if(t)try{t.setItem(vd,JSON.stringify({unsupportedGatewayKeys:Array.from(e)}))}catch{}}function yd(){return Li||(Li=Sm()),Li}function Am(e){const t=e?.trim();if(!t)return ym;try{const n=new URL(t),s=n.pathname==="/"?"":n.pathname;return`${n.protocol}//${n.host}${s}`.toLowerCase()}catch{return t.toLowerCase()}}function $d(e){return Am(e.settings?.gatewayUrl)}function Cm(e){return!yd().has($d(e))}function Tm(e){const t=yd();t.add($d(e)),km(t)}function Em(e){const t=xd(e);return wm.test(t)&&($m.test(t)||xm.test(t))}const _m=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")}`},Im=(e,t)=>{if(t)return e==="utc"?{mode:"utc"}:{mode:"specific",utcOffset:_m(new Date().getTimezoneOffset())}};function xd(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=Im(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=Cm(e);try{const[a,d]=await o(l);r(a,d)}catch(a){if(l&&Em(a)){Tm(e);const[d,g]=await o(!1);r(d,g)}else throw a}}catch(s){e.usageError=xd(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 Rm(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 Lm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),qs=e=>e.trim().toLowerCase(),Dm=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}}),Pm=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)},Fm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),Nm=(e,t)=>{const n=qs(t.value??"");if(!n)return!0;if(!t.key)return Pm(e).some(i=>i.includes(n));switch(qs(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 Fm(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=Dm(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}},Om=(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=qs(o.key);if(!Lm.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(qs(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=>Nm(o,r))),warnings:s}};function wd(e){const t=e.split(`
|
|
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 Lh(){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 Dh(){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 Dh(),wa(Lh())}const Ph=/^\s*NO_REPLY\s*$/;function zn(e){return Ph.test(e)}function Ms(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=Ws(e);return typeof s=="string"&&zn(s)}async function es(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=>!Ms(s)),e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Fh(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 Nh(e){return ad(e,{roleRequirement:"required",roleCaseSensitive:!0,requireContentArray:!0})}function Sa(e){return ad(e,{roleRequirement:"optional",allowTextField:!0})}async function Oh(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=Fh(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 Uh(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 Bh(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&&!Ms(n)?(e.chatMessages=[...e.chatMessages,n],null):"final"}return null}if(t.state==="delta"){const n=Ws(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&&!Ms(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=Nh(t.message);if(n&&!Ms(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 Hh(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 dd(e){e.connected&&(e.chatMessage="",await Uh(e))}function jh(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 Oh(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),ss(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 Kh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wh(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(Hh(i)){await dd(e);return}const a=zh(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),cd(e)){jh(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([es(e),Yt(e,{activeMinutes:ld}),fo(e)]),t?.scheduleScroll!==!1&&ss(e)}const qh=gd;function Gh(e){const t=Rg(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vh(e,t){const n=Xt(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function fo(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vh(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 Jh="update.available";function Qh(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 Yh=50,Xh=200,Zh="Assistant";function or(e){const t=ka(e?.name,Yh)??Zh,n=ka(e?.avatar??void 0,Xh)??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 po(e){return typeof e=="object"&&e!==null}function em(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 tm(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 nm(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 sm(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,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 im(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 om(e){return im(e?.details)}const rm=4008;class am{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=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=sm({deviceId:i.deviceId,clientId:this.opts.clientName??Ca.CONTROL_UI,clientMode:this.opts.mode??ho.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??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&&$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(rm,"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 Ri(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 lm(e,t){if(!t?.mainSessionKey)return;const n=Ri(e.sessionKey,t),s=Ri(e.settings.sessionKey,t),i=Ri(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 am({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,fm(e,s),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,ui(e),pd(e),Uo(e),Hn(e),Ae(e),ii(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=om(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&&cm(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 cm(e,t){try{gm(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function dm(e,t,n){if(n!=="final"&&n!=="error"&&n!=="aborted")return;ui(e),qh(e);const s=t?.runId;!s||!e.refreshSessionsAfterChat.has(s)||(e.refreshSessionsAfterChat.delete(s),n==="final"&&Yt(e,{activeMinutes:ld}))}function um(e,t){t?.sessionKey&&Jc(e,t.sessionKey);const n=Bh(e,t);dm(e,t,n),n==="final"&&Qh(t)&&es(e)}function gm(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;Sh(e,t.payload);return}if(t.event==="chat"){um(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"&&Ks(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Et(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=em(t.payload);if(n){e.execApprovalQueue=nm(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=tm(t.payload);n&&(e.execApprovalQueue=Aa(e.execApprovalQueue,n.id));return}if(t.event===Jh){const n=t.payload;e.updateAvailable=n?.updateAvailable??null}}function fm(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&lm(e,n.sessionDefaults),e.updateAvailable=n?.updateAvailable??null}const Ea="/__openclaw/control-ui-config.json";async function pm(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 hm(e){e.basePath=nh(),pm(e),Zp(e),rh(e,!0),sh(e),ih(e),window.addEventListener("popstate",e.popStateHandler),vd(e),jg(e),e.tab==="logs"&&lc(e),e.tab==="debug"&&dc(e)}function mm(e){Fg(e)}function vm(e){window.removeEventListener("popstate",e.popStateHandler),Kg(e),cc(e),uc(e),e.client?.stop(),e.client=null,e.connected=!1,oh(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function bm(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;ss(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",ym="__default__",$m=/unexpected property ['"]mode['"]/i,xm=/unexpected property ['"]utcoffset['"]/i,wm=/invalid sessions\.usage params/i;let Li=null;function yd(){return typeof window<"u"&&window.localStorage?window.localStorage:typeof localStorage<"u"?localStorage:null}function Sm(){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 km(e){const t=yd();if(t)try{t.setItem(bd,JSON.stringify({unsupportedGatewayKeys:Array.from(e)}))}catch{}}function $d(){return Li||(Li=Sm()),Li}function Am(e){const t=e?.trim();if(!t)return ym;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 Am(e.settings?.gatewayUrl)}function Cm(e){return!$d().has(xd(e))}function Tm(e){const t=$d();t.add(xd(e)),km(t)}function Em(e){const t=wd(e);return wm.test(t)&&($m.test(t)||xm.test(t))}const _m=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")}`},Im=(e,t)=>{if(t)return e==="utc"?{mode:"utc"}:{mode:"specific",utcOffset:_m(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=Im(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=Cm(e);try{const[a,d]=await o(l);r(a,d)}catch(a){if(l&&Em(a)){Tm(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 Rm(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 Lm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),qs=e=>e.trim().toLowerCase(),Dm=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}}),Pm=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)},Fm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),Nm=(e,t)=>{const n=qs(t.value??"");if(!n)return!0;if(!t.key)return Pm(e).some(i=>i.includes(n));switch(qs(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 Fm(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=Dm(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}},Om=(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=qs(o.key);if(!Lm.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(qs(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=>Nm(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
140
|
`).trim()}}function Um(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 Bm(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 Hm(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 jm(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function Km(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=ar(v,t),S=lr(v,t),C=Math.min(S.getTime(),d),I=Math.max((C-f)/6e4,0)/u;n[m]+=o.messageCounts.errors*I,s[m]+=o.messageCounts.total*I,f=C+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:jm(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const Wm=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ar(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function qm(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function lr(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function Gm(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 C=new Date(S),R=ar(C,t),I=qm(C,t),A=lr(C,t),w=Math.min(A.getTime(),f),_=Math.max((w-S)/6e4,0)/m;n[R]+=a.totalTokens*_,s[I]+=a.totalTokens*_,S=w+1}}const r=Wm.map((l,a)=>({label:l,tokens:s[a]}));return{hasData:o,totalTokens:i,hourTotals:n,weekdayTotals:r}}function Vm(e,t,n,s){const i=Gm(e,t);if(!i.hasData)return c`
|
|
141
141
|
<div class="card usage-mosaic">
|
|
@@ -201,7 +201,7 @@ 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
|
|
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 Jm(e){const t=kd(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):e}const bs=()=>({input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),ys=(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},Qm=(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 C=`${S.provider??"unknown"}::${S.model??"unknown"}`,R=i.get(C)??{provider:S.provider,model:S.model,count:0,totals:bs()};R.count+=S.count,ys(R.totals,S.totals),i.set(C,R);const I=S.provider??"unknown",A=o.get(I)??{provider:S.provider,model:void 0,count:0,totals:bs()};A.count+=S.count,ys(A.totals,S.totals),o.set(I,A)}if(Um(u,m.latency),v.agentId){const S=r.get(v.agentId)??bs();ys(S,m),r.set(v.agentId,S)}if(v.channel){const S=l.get(v.channel)??bs();ys(S,m),l.set(v.channel,S)}for(const S of m.dailyBreakdown??[]){const C=a.get(S.date)??{date:S.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};C.tokens+=S.tokens,C.cost+=S.cost,a.set(S.date,C)}for(const S of m.dailyMessageCounts??[]){const C=a.get(S.date)??{date:S.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};C.messages+=S.total,C.toolCalls+=S.toolCalls,C.errors+=S.errors,a.set(S.date,C)}Bm(d,m.dailyLatency);for(const S of m.dailyModelUsage??[]){const C=`${S.date}::${S.provider??"unknown"}::${S.model??"unknown"}`,R=g.get(C)??{date:S.date,provider:S.provider,model:S.model,tokens:0,cost:0,count:0};R.tokens+=S.tokens,R.cost+=S.cost,R.count+=S.count,g.set(C,R)}}}const f=Hm({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}},Ym=(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 Xm(e){return/[",\n]/.test(e)?`"${e.replaceAll('"','""')}"`:e}function Gs(e){return e.map(t=>t==null?"":Xm(String(t))).join(",")}const Zm=e=>{const t=[Gs(["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(Gs([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
205
|
`)},ev=e=>{const t=[Gs(["date","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","inputCost","outputCost","cacheReadCost","cacheWriteCost","totalCost"])];for(const n of e)t.push(Gs([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
206
|
`)},tv=(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 C=[],R=(I,A)=>{for(const w of A)(!d||w.toLowerCase().includes(d))&&C.push({label:`${I}:${w}`,value:`${I}:${w}`})};switch(a){case"agent":R("agent",u);break;case"channel":R("channel",f);break;case"provider":R("provider",v);break;case"model":R("model",m);break;case"tool":R("tool",S);break;case"has":["errors","tools","context","usage","model","provider"].forEach(I=>{(!d||I.includes(d))&&C.push({label:`has:${I}`,value:`has:${I}`})});break}return C},nv=(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(),sv=(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} `},Ma=(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=[...rr(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 iv(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 ov(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">
|
|
@@ -255,7 +255,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
255
255
|
</div>
|
|
256
256
|
<div class="daily-chart">
|
|
257
257
|
<div class="daily-chart-bars" style="--bar-max-width: ${d}px">
|
|
258
|
-
${e.map((u,f)=>{const m=l[f]/a*100,S=t.includes(u.date),C=
|
|
258
|
+
${e.map((u,f)=>{const m=l[f]/a*100,S=t.includes(u.date),C=Ad(u.date),R=e.length>20?String(parseInt(u.date.slice(8),10)):C,I=e.length>20?"font-size: 8px":"",A=s==="by-type"?r?[{value:u.output,class:"output"},{value:u.input,class:"input"},{value:u.cacheWrite,class:"cache-write"},{value:u.cacheRead,class:"cache-read"}]:[{value:u.outputCost??0,class:"output"},{value:u.inputCost??0,class:"input"},{value:u.cacheWriteCost??0,class:"cache-write"},{value:u.cacheReadCost??0,class:"cache-read"}]:[],w=s==="by-type"?r?[`Output ${H(u.output)}`,`Input ${H(u.input)}`,`Cache write ${H(u.cacheWrite)}`,`Cache read ${H(u.cacheRead)}`]:[`Output ${se(u.outputCost??0)}`,`Input ${se(u.inputCost??0)}`,`Cache write ${se(u.cacheWriteCost??0)}`,`Cache read ${se(u.cacheReadCost??0)}`]:[],L=r?H(u.totalTokens):se(u.totalCost);return c`
|
|
259
259
|
<div
|
|
260
260
|
class="daily-bar-wrapper ${S?"selected":""}"
|
|
261
261
|
@click=${_=>o(u.date,_.shiftKey)}
|
|
@@ -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 lv(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})??"—":"—",C="Cache hit rate = cache read / (input + cache read). Higher is better.",R="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(T=>T.messages>0&&T.errors>0).map(T=>{const N=T.errors/T.messages;return{label:
|
|
346
|
+
`}function lv(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})??"—":"—",C="Cache hit rate = cache read / (input + cache read). Higher is better.",R="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(T=>T.messages>0&&T.errors>0).map(T=>{const N=T.errors/T.messages;return{label:Ad(T.date),value:`${(N*100).toFixed(2)}%`,sub:`${T.errors} errors · ${T.messages} msgs · ${H(T.tokens)}`,rate:N}}).toSorted((T,N)=>N.rate-T.rate).slice(0,5).map(({rate:T,...N})=>N),_=t.byModel.slice(0,5).map(T=>({label:T.model??"unknown",value:se(T.totals.totalCost),sub:`${H(T.totals.totalTokens)} · ${T.count} msgs`})),M=t.byProvider.slice(0,5).map(T=>({label:T.provider??"unknown",value:se(T.totals.totalCost),sub:`${H(T.totals.totalTokens)} · ${T.count} msgs`})),K=t.tools.tools.slice(0,6).map(T=>({label:T.name,value:`${T.count}`,sub:"calls"})),G=t.byAgent.slice(0,5).map(T=>({label:T.agentId,value:se(T.totals.totalCost),sub:H(T.totals.totalTokens)})),b=t.byChannel.slice(0,5).map(T=>({label:T.channel,value:se(T.totals.totalCost),sub:H(T.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">
|
|
@@ -533,9 +533,9 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
533
533
|
</div>
|
|
534
534
|
`:h}
|
|
535
535
|
</div>
|
|
536
|
-
`}const dv=.75,uv=8,gv=.06,$s=5,Pe=12,ft=.7;function vt(e,t){return!t||t<=0?0:e/t*100}function fv(){return h}function
|
|
536
|
+
`}const dv=.75,uv=8,gv=.06,$s=5,Pe=12,ft=.7;function vt(e,t){return!t||t<=0?0:e/t*100}function fv(){return h}function Cd(e){return e<1e12?e*1e3:e}function pv(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 hv(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
|
-
`;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}=
|
|
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}
|
|
540
540
|
<div class="session-summary-grid">
|
|
541
541
|
<div class="session-summary-card">
|
|
@@ -822,7 +822,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
822
822
|
<div class="session-logs-header">Conversation</div>
|
|
823
823
|
<div class="muted" style="padding: 20px; text-align: center">No messages</div>
|
|
824
824
|
</div>
|
|
825
|
-
`;const f=i.query.trim().toLowerCase(),v=e.map(L=>{const _=
|
|
825
|
+
`;const f=i.query.trim().toLowerCase(),v=e.map(L=>{const _=Sd(L.content),M=_.cleanContent||L.content;return{log:L,toolInfo:_,cleanContent:M}}),m=Array.from(new Set(v.flatMap(L=>L.toolInfo.tools.map(([_])=>_)))).toSorted((L,_)=>L.localeCompare(_)),S=v.filter(L=>{if(g!=null&&u!=null){const _=L.log.timestamp;if(_>0){const M=Math.min(g,u),K=Math.max(g,u),G=Cd(_);if(G<M||G>K)return!1}}return!(i.roles.length>0&&!i.roles.includes(L.log.role)||i.hasTools&&L.toolInfo.tools.length===0||i.tools.length>0&&!L.toolInfo.tools.some(([M])=>i.tools.includes(M))||f&&!L.cleanContent.toLowerCase().includes(f))}),C=i.roles.length>0||i.tools.length>0||i.hasTools||f,R=g!=null&&u!=null,I=C||R?`${S.length} of ${e.length} ${R?"(timeline filtered)":""}`:`${e.length}`,A=new Set(i.roles),w=new Set(i.tools);return c`
|
|
826
826
|
<div class="session-logs-compact">
|
|
827
827
|
<div class="session-logs-header">
|
|
828
828
|
<span>Conversation <span style="font-weight: normal; color: var(--muted);">(${I} messages)</span></span>
|
|
@@ -3156,7 +3156,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3156
3156
|
|
|
3157
3157
|
<!-- Session Detail Panel (when selected) or Empty State -->
|
|
3158
3158
|
${w?vv(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):fv()}
|
|
3159
|
-
`}let Fi=null;const Fa=e=>{Fi&&clearTimeout(Fi),Fi=window.setTimeout(()=>{mo(e)},400)};function Cv(e){return e.tab!=="usage"?h:Av({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=[],Fa(e)},onEndDateChange:t=>{e.usageEndDate=t,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],Fa(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&&(Mm(e,e.usageSelectedSessions[0]),Rm(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 cr={CHILD:2},dr=e=>(...t)=>({_$litDirective$:e,values:t});let ur=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:Tv}=
|
|
3159
|
+
`}let Fi=null;const Fa=e=>{Fi&&clearTimeout(Fi),Fi=window.setTimeout(()=>{mo(e)},400)};function Cv(e){return e.tab!=="usage"?h:Av({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=[],Fa(e)},onEndDateChange:t=>{e.usageEndDate=t,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],Fa(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&&(Mm(e,e.usageSelectedSessions[0]),Rm(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 cr={CHILD:2},dr=e=>(...t)=>({_$litDirective$:e,values:t});let ur=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:Tv}=Ju,Na=e=>e,Ev=e=>e.strings===void 0,Oa=()=>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(Oa(),i),r=s.insertBefore(Oa(),i);n=new Tv(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=Na(a).nextSibling;Na(s).insertBefore(a,i),a=d}}}return n},Dt=(e,t,n=e)=>(e._$AI(t,n),e),_v={},Iv=(e,t=_v)=>e._$AH=t,Mv=e=>e._$AH,Ni=e=>{e._$AR(),e._$AA.remove()};const Ua=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Td=dr(class extends ur{constructor(e){if(super(e),e.type!==cr.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=Mv(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=Ua(r,v,m),g=Ua(l,u,f)),d.has(l[u]))if(d.has(l[f])){const S=g.get(r[v]),C=S!==void 0?i[S]:null;if(C===null){const R=In(e,i[u]);Dt(R,o[v]),a[v]=R}else a[v]=Dt(C,o[v]),In(e,i[u],C),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,Iv(e,a),wt}}),he={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>
|
|
@@ -3425,7 +3425,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3425
3425
|
?disabled=${!e.connected}
|
|
3426
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(),lh(e,f),es(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}
|
|
3430
3430
|
</option>`)}
|
|
3431
3431
|
</select>
|
|
@@ -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 fd(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}
|
|
@@ -3466,7 +3466,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3466
3466
|
${Pv(s)}
|
|
3467
3467
|
</button>
|
|
3468
3468
|
</div>
|
|
3469
|
-
`}function Nv(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 Rs={bluebubbles:"iMessage",telegram:"Telegram",discord:"Discord",signal:"Signal",slack:"Slack",whatsapp:"WhatsApp",matrix:"Matrix",email:"Email",sms:"SMS"},Ov=Object.keys(Rs);function Ba(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Uv(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:`${Rs[i]??Ba(i)} · ${o}`}}const s=e.match(/^agent:[^:]+:([^:]+):group:(.+)$/);if(s){const i=s[1];return{prefix:"",fallbackName:`${Rs[i]??Ba(i)} Group`}}for(const i of Ov)if(e===i||e.startsWith(`${i}:`))return{prefix:"",fallbackName:`${Rs[i]} Session`};return{prefix:"",fallbackName:e}}function Oi(e,t){const n=t?.label?.trim()||"",s=t?.displayName?.trim()||"",{prefix:i,fallbackName:o}=Uv(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
|
|
3469
|
+
`}function Nv(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 Rs={bluebubbles:"iMessage",telegram:"Telegram",discord:"Discord",signal:"Signal",slack:"Slack",whatsapp:"WhatsApp",matrix:"Matrix",email:"Email",sms:"SMS"},Ov=Object.keys(Rs);function Ba(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Uv(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:`${Rs[i]??Ba(i)} · ${o}`}}const s=e.match(/^agent:[^:]+:([^:]+):group:(.+)$/);if(s){const i=s[1];return{prefix:"",fallbackName:`${Rs[i]??Ba(i)} Group`}}for(const i of Ov)if(e===i||e.startsWith(`${i}:`))return{prefix:"",fallbackName:`${Rs[i]} Session`};return{prefix:"",fallbackName:e}}function Oi(e,t){const n=t?.label?.trim()||"",s=t?.displayName?.trim()||"",{prefix:i,fallbackName:o}=Uv(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 Bv(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 Hv(e,t){return t?.sessions?t.sessions.filter(n=>Ed(n.key)&&n.key!==e).length:0}const zv=["system","light","dark"];function jv(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>
|
|
@@ -3523,9 +3523,9 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
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 Ed(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 Gv(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=Ed(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 Vv(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=Ed(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 Jv=[{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"}],ts=[{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(ts.map(e=>[e.id,e]));function Bi(e){return ts.filter(t=>t.profiles.includes(e)).map(t=>t.id)}const Qv={minimal:{allow:Bi("minimal")},coding:{allow:Bi("coding")},messaging:{allow:Bi("messaging")},full:{}};function Yv(){const e=new Map;for(const n of ts){const s=`group:${n.sectionId}`,i=e.get(s)??[];i.push(n.id),e.set(s,i)}return{"group:openclaw":ts.filter(n=>n.includeInOpenClawGroup).map(n=>n.id),...Object.fromEntries(e.entries())}}const Xv=Yv(),Zv=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function eb(e){if(!e)return;const t=Qv[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function tb(){return Jv.map(e=>({id:e.id,label:e.label,tools:ts.filter(t=>t.sectionId===e.id).map(t=>({id:t.id,label:t.label,description:t.description}))})).filter(e=>e.tools.length>0)}const nb={bash:"exec","apply-patch":"apply_patch"},sb={...Xv};function Ye(e){const t=e.trim().toLowerCase();return nb[t]??t}function ib(e){return e?e.map(Ye).filter(Boolean):[]}function ob(e){const t=ib(e),n=[];for(const s of t){const i=sb[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function rb(e){return eb(e)}const ab=tb(),lb=Zv;function vo(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function xs(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&&xs(n))return n;const s=e.identity?.emoji?.trim();if(s&&xs(s))return s;const i=t?.avatar?.trim();if(i&&xs(i))return i;const o=e.identity?.avatar?.trim();return o&&xs(o)?o:""}function _d(e,t){return t&&e===t?"default":null}function cb(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 db(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 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 ub(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 bo(n)}function gb(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function fb(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 pb(e,t){const n=fb(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 Gv(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 Vv(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 Jv=[{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"}],ts=[{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(ts.map(e=>[e.id,e]));function Bi(e){return ts.filter(t=>t.profiles.includes(e)).map(t=>t.id)}const Qv={minimal:{allow:Bi("minimal")},coding:{allow:Bi("coding")},messaging:{allow:Bi("messaging")},full:{}};function Yv(){const e=new Map;for(const n of ts){const s=`group:${n.sectionId}`,i=e.get(s)??[];i.push(n.id),e.set(s,i)}return{"group:openclaw":ts.filter(n=>n.includeInOpenClawGroup).map(n=>n.id),...Object.fromEntries(e.entries())}}const Xv=Yv(),Zv=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function eb(e){if(!e)return;const t=Qv[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function tb(){return Jv.map(e=>({id:e.id,label:e.label,tools:ts.filter(t=>t.sectionId===e.id).map(t=>({id:t.id,label:t.label,description:t.description}))})).filter(e=>e.tools.length>0)}const nb={bash:"exec","apply-patch":"apply_patch"},sb={...Xv};function Ye(e){const t=e.trim().toLowerCase();return nb[t]??t}function ib(e){return e?e.map(Ye).filter(Boolean):[]}function ob(e){const t=ib(e),n=[];for(const s of t){const i=sb[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function rb(e){return eb(e)}const ab=tb(),lb=Zv;function vo(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function xs(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&&xs(n))return n;const s=e.identity?.emoji?.trim();if(s&&xs(s))return s;const i=t?.avatar?.trim();if(i&&xs(i))return i;const o=e.identity?.avatar?.trim();return o&&xs(o)?o:""}function Id(e,t){return t&&e===t?"default":null}function cb(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 db(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 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 ub(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 bo(n)}function gb(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function fb(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 pb(e,t){const n=fb(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 hb(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)?ob(e).map(hb).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 mb(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 Ga(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 vb(e){return rb(e)??void 0}function bb(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function yb(e){const t=e.ts??null;return t?ne(t):"n/a"}function gr(e){return e?`${new Date(e).toLocaleDateString(void 0,{weekday:"short"})}, ${kt(e)} (${ne(e)})`:"n/a"}function $b(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function xb(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function wb(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
|
|
3528
|
+
`:n.map(i=>c`<option value=${i.value}>${i.label}</option>`)}function hb(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)?ob(e).map(hb).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 mb(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 Ga(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 vb(e){return rb(e)??void 0}function bb(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function yb(e){const t=e.ts??null;return t?ne(t):"n/a"}function gr(e){return e?`${new Date(e).toLocaleDateString(void 0,{weekday:"short"})}, ${kt(e)} (${ne(e)})`:"n/a"}function $b(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function xb(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function wb(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 Md(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 Sb(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 Rd(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 kb(e){const t=Rd(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>
|
|
@@ -3558,7 +3558,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3558
3558
|
</section>
|
|
3559
3559
|
`}function Ab(e,t){const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function Cb(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:Ab(e,i),accounts:e.channelAccounts?.[i]??[]}))}const Tb=["groupPolicy","streamMode","dmPolicy"];function Eb(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 _b(e){const t=Cb(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">
|
|
3563
3563
|
<div class="row" style="justify-content: space-between;">
|
|
3564
3564
|
<div>
|
|
@@ -3600,7 +3600,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3600
3600
|
</section>
|
|
3601
3601
|
`}function Ib(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">
|
|
3605
3605
|
<div class="row" style="justify-content: space-between;">
|
|
3606
3606
|
<div>
|
|
@@ -3643,7 +3643,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3643
3643
|
<div class="list-title">${n.name}</div>
|
|
3644
3644
|
${n.description?c`<div class="list-sub">${n.description}</div>`:h}
|
|
3645
3645
|
<div class="chip-row" style="margin-top: 6px;">
|
|
3646
|
-
<span class="chip">${
|
|
3646
|
+
<span class="chip">${Md(n)}</span>
|
|
3647
3647
|
<span class="chip ${n.enabled?"chip-ok":"chip-warn"}">
|
|
3648
3648
|
${n.enabled?"enabled":"disabled"}
|
|
3649
3649
|
</span>
|
|
@@ -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 ws=[{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
|
|
3747
|
+
`}const ws=[{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 ws)t.set(o.id,{id:o.id,label:o.label,skills:[]});const n=ws.find(o=>o.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const o of e){const r=o.bundled?n:ws.find(l=>l.sources.includes(o.source));r?t.get(r.id)?.skills.push(o):s.skills.push(o)}const i=ws.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`
|
|
@@ -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 Db(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=
|
|
3891
|
+
`}function Db(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>
|
|
@@ -3974,12 +3974,12 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3974
3974
|
${e.skills.map(s=>Fb(s,{agentId:t.agentId,allowSet:t.allowSet,usingAllowlist:t.usingAllowlist,editable:t.editable,onToggle:t.onToggle}))}
|
|
3975
3975
|
</div>
|
|
3976
3976
|
</details>
|
|
3977
|
-
`}function Fb(e,t){const n=t.usingAllowlist?t.allowSet.has(e.name):!0,s=
|
|
3977
|
+
`}function Fb(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>
|
|
3981
3981
|
<div class="list-sub">${e.description}</div>
|
|
3982
|
-
${
|
|
3982
|
+
${Od({skill:e})}
|
|
3983
3983
|
${s.length>0?c`<div class="muted" style="margin-top: 6px;">Missing: ${s.join(", ")}</div>`:h}
|
|
3984
3984
|
${i.length>0?c`<div class="muted" style="margin-top: 6px;">Reason: ${i.join(", ")}</div>`:h}
|
|
3985
3985
|
</div>
|
|
@@ -4011,7 +4011,7 @@ 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=
|
|
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}=Ob(a);return c`
|
|
4015
4015
|
<button
|
|
4016
4016
|
type="button"
|
|
4017
4017
|
class="agent-row ${s===o.id?"active":""}"
|
|
@@ -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 Ob(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 Ub(e,t,n){const s=
|
|
4048
|
+
`}function Ob(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 Ub(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>
|
|
@@ -4203,7 +4203,7 @@ 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
|
|
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 Va(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??ni(String(e.at(-1))),o=s?.help??t.description,r=Va(t["x-tags"]??t.tags),l=Va(s?.tags);return{label:i,help:o,tags:l.length>0?l:r}}function Wb(e,t){if(!e)return!0;for(const n of t)if(n&&n.toLowerCase().includes(e))return!0;return!1}function qb(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 fr(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(!qb(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 Wb(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)||fr({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>
|
|
@@ -4660,11 +4660,11 @@ 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
|
-
`},pr={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 Xa(e){return Ya[e]??Ya.default}function Yb(e){if(!e.query)return!0;const t=
|
|
4663
|
+
`},pr={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 Xa(e){return Ya[e]??Ya.default}function Yb(e){if(!e.query)return!0;const t=Ud(e.query),n=t.text,s=pr[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 Xb(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=
|
|
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&&!Yb({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
4669
|
<div class="config-empty__icon">${he.search}</div>
|
|
4670
4670
|
<div class="config-empty__text">
|
|
@@ -4701,16 +4701,16 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4701
4701
|
</section>
|
|
4702
4702
|
`})}
|
|
4703
4703
|
</div>
|
|
4704
|
-
`}const Zb=new Set(["title","description","default","nullable"]);function ey(e){return Object.keys(e??{}).filter(n=>!Zb.has(n)).length===0}function
|
|
4704
|
+
`}const Zb=new Set(["title","description","default","nullable"]);function ey(e){return Object.keys(e??{}).filter(n=>!Zb.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=iy(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"&&!ey(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 ty(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 ny(e){const t=e.oneOf??e.anyOf;return!t||t.length===0?!1:t.every(n=>ty(n))}function sy(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||!ny(o[0])?null:bn({...e,...n[i],nullable:s,anyOf:void 0,oneOf:void 0,allOf:void 0},t)}function iy(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=sy(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 oy(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 ry(e,t){return Rd(e,t)??{}}const ay=["groupPolicy","streamMode","dmPolicy"];function ly(e){const t=ay.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>
|
|
4708
4708
|
<span class="label">${n}</span>
|
|
4709
|
-
<span>${
|
|
4709
|
+
<span>${Ld(s)}</span>
|
|
4710
4710
|
</div>
|
|
4711
4711
|
`)}
|
|
4712
4712
|
</div>
|
|
4713
|
-
`}function cy(e){const t=
|
|
4713
|
+
`}function cy(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
4715
|
`;const s=oy(n,["channels",e.channelId]);if(!s)return c`
|
|
4716
4716
|
<div class="callout danger">Channel config schema unavailable.</div>
|
|
@@ -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
|
-
`},R=()=>{if(S&&r)return
|
|
4908
|
+
`},R=()=>{if(S&&r)return vg({state:o,callbacks:r,accountId:s[0]?.accountId??"default"});const I=a?.profile??n?.profile,{name:A,displayName:w,about:L,picture:_,nip05:M}=I??{},K=A||w||L||_||M;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>
|
|
@@ -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 py(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 hy(e,t){return t?.[e]?.length??0}function
|
|
4988
|
+
`}function py(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 hy(e,t){return t?.[e]?.length??0}function zd(e,t){const n=hy(e,t);return n<2?h:c`<div class="account-count">Accounts (${n})</div>`}function my(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>
|
|
@@ -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 xy(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 wy(e,t,n){const s=
|
|
5267
|
+
`}function xy(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 wy(e,t,n){const s=zd(e,n.channelAccounts);switch(e){case"whatsapp":return yy({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return by({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return dy({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return uy({props:t,googleChat:n.googlechat,accountCountLabel:s});case"slack":return vy({props:t,slack:n.slack,accountCountLabel:s});case"signal":return my({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return gy({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 fy({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:a,profileFormCallbacks:d,onEditProfile:()=>t.onNostrProfileEdit(r,l)})}default:return Sy(e,t,n.channelAccounts??{})}}function Sy(e,t,n){const s=Ay(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>
|
|
@@ -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 ky(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Ay(e,t){return ky(e)[t]?.label??e?.channelLabels?.[t]??t}const Cy=600*1e3;function
|
|
5300
|
+
`}function ky(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Ay(e,t){return ky(e)[t]?.label??e?.channelLabels?.[t]??t}const Cy=600*1e3;function jd(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<Cy:!1}function Ty(e){return e.running?"Yes":jd(e)?"Active":"No"}function Ey(e){return e.connected===!0?"Yes":e.connected===!1?"No":jd(e)?"Active":"n/a"}function _y(e){const t=Ty(e),n=Ey(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,9 +5327,9 @@ ${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},Vs=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},jd=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),Ry(t)}};function Iy(e){this._$AN!==void 0?(Vs(this),this._$AM=e,jd(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),Vs(s[o]);else s!=null&&(Wn(s,!1),Vs(s));else Wn(this,e)}const Ry=e=>{e.type==cr.CHILD&&(e._$AP??=My,e._$AQ??=Iy)};class Ly extends ur{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),jd(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Wn(this,t),Vs(this))}setValue(t){if(Ev(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,Dy=dr(class extends Ly{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 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:[]}}}$o.directiveName="unsafeHTML",$o.resultType=1;const xo=dr($o);const{entries:Kd,setPrototypeOf:el,isFrozen:Py,getPrototypeOf:Fy,getOwnPropertyDescriptor:Ny}=Object;let{freeze:Te,seal:Ue,create:Ls}=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 Ss=Ee(Array.prototype.forEach),Oy=Ee(Array.prototype.lastIndexOf),tl=Ee(Array.prototype.pop),Mn=Ee(Array.prototype.push),Uy=Ee(Array.prototype.splice),Ds=Ee(String.prototype.toLowerCase),zi=Ee(String.prototype.toString),ji=Ee(String.prototype.match),Rn=Ee(String.prototype.replace),By=Ee(String.prototype.indexOf),Hy=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]:Ds;el&&el(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const o=n(i);o!==i&&(Py(t)||(t[s]=o),i=o)}e[i]=!0}return e}function jy(e){for(let t=0;t<e.length;t++)De(e,t)||(e[t]=null);return e}function Ve(e){const t=Ls(null);for(const[n,s]of Kd(e))De(e,n)&&(Array.isArray(s)?t[n]=jy(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=Ny(e,t);if(s){if(s.get)return Ee(s.get);if(typeof s.value=="function")return Ee(s.value)}e=Fy(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"]),Ky=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"]),Wy=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"]),ks=Te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qy=Ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Gy=Ue(/<%[\w\W]*|[\w\W]*%>/gm),Vy=Ue(/\$\{[\w\W]*/gm),Jy=Ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qy=Ue(/^aria-[\-\w]+$/),Wd=Ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yy=Ue(/^(?:\w+script|data):/i),Xy=Ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qd=Ue(/^html$/i),Zy=Ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var rl=Object.freeze({__proto__:null,ARIA_ATTR:Qy,ATTR_WHITESPACE:Xy,CUSTOM_ELEMENT:Zy,DATA_ATTR:Jy,DOCTYPE_NAME:qd,ERB_EXPR:Gy,IS_ALLOWED_URI:Wd,IS_SCRIPT_OR_DATA:Yy,MUSTACHE_EXPR:qy,TMPLIT_EXPR:Vy});const Pn={element:1,text:3,progressingInstruction:7,comment:8,document:9},e0=function(){return typeof window>"u"?null:window},t0=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 Gd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e0();const t=j=>Gd(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"),C=Dn(m,"remove"),R=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:_,createNodeIterator:M,createDocumentFragment:K,getElementsByTagName:G}=n,{importNode:b}=s;let T=al();t.isSupported=typeof Kd=="function"&&typeof A=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:W,TMPLIT_EXPR:V,DATA_ATTR:E,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,...ks]);let ee=Object.seal(Ls(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(Ls(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"]),ds="http://www.w3.org/1998/Math/MathML",us="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let sn=nt,$i=!1,xi=null;const wu=Q({},[ds,us,nt],zi);let gs=Q({},["mi","mo","mn","ms","mtext"]),fs=Q({},["annotation-xml"]);const Su=Q({},["title","style","font","a","script"]);let En=null;const ku=["application/xhtml+xml","text/html"],Au="text/html";let pe=null,on=null;const Cu=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=ku.indexOf(k.PARSER_MEDIA_TYPE)===-1?Au:k.PARSER_MEDIA_TYPE,pe=En==="application/xhtml+xml"?zi:Ds,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):wu,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||Wd,sn=k.NAMESPACE||nt,gs=k.MATHML_TEXT_INTEGRATION_POINTS||gs,fs=k.HTML_INTEGRATION_POINTS||fs,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=Ls(null),Ke.html===!0&&(Q(F,nl),Q(Y,il)),Ke.svg===!0&&(Q(F,Ki),Q(Y,Gi),Q(Y,ks)),Ke.svgFilters===!0&&(Q(F,Wi),Q(Y,Gi),Q(Y,ks)),Ke.mathMl===!0&&(Q(F,qi),Q(Y,ol),Q(Y,ks))),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=t0(v,i)),w!==null&&typeof L=="string"&&(L=w.createHTML(""));Te&&Te(k),on=k}},Ir=Q({},[...Ki,...Wi,...Ky]),Mr=Q({},[...qi,...Wy]),Tu=function(k){let P=A(k);(!P||!P.tagName)&&(P={namespaceURI:sn,tagName:"template"});const B=Ds(k.tagName),ce=Ds(P.tagName);return xi[k.namespaceURI]?k.namespaceURI===us?P.namespaceURI===nt?B==="svg":P.namespaceURI===ds?B==="svg"&&(ce==="annotation-xml"||gs[ce]):!!Ir[B]:k.namespaceURI===ds?P.namespaceURI===nt?B==="math":P.namespaceURI===us?B==="math"&&fs[ce]:!!Mr[B]:k.namespaceURI===nt?P.namespaceURI===us&&!fs[ce]||P.namespaceURI===ds&&!gs[ce]?!1:!Mr[B]&&(Su[B]||!Ir[B]):!!(En==="application/xhtml+xml"&&xi[k.namespaceURI]):!1},We=function(k){Mn(t.removed,{element:k});try{A(k).removeChild(k)}catch{C(k)}},It=function(k,P){try{Mn(t.removed,{attribute:P.getAttributeNode(k),from:P})}catch{Mn(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=_.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 M.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){Ss(j,B=>{B.call(t,k,P,on)})}const Pr=function(k){let P=null;if(st(T.beforeSanitizeElements,k,null),Si(k))return We(k),!0;const B=pe(k.nodeName);if(st(T.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,R(k))}}}return We(k),!0}return k instanceof a&&!Tu(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,Ss([N,W,V],ce=>{P=Rn(P,ce," ")}),k.textContent!==P&&(Mn(t.removed,{element:k.cloneNode()}),k.textContent=P)),st(T.afterSanitizeElements,k,null),!1)},Fr=function(k,P,B){if(X[P]||dt&&(P==="id"||P==="name")&&(B in n||B in Cu))return!1;if(!(de&&!X[P]&&ke(E,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,Rn(B,oe,""))){if(!((P==="src"||P==="xlink:href"||P==="href")&&k!=="script"&&By(B,"data:")===0&&nn[k])){if(!(be&&!ke(q,Rn(B,oe,"")))){if(B)return!1}}}}}}}return!0},Nr=function(k){return k!=="annotation-xml"&&ji(k,re)},Or=function(k){st(T.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:Hy(ki);if(B.attrName=rn,B.attrValue=$e,B.keepAttr=!0,B.forceKeepAttr=void 0,st(T.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&&Ss([N,W,V],Br=>{$e=Rn($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(T.afterSanitizeAttributes,k,null)},Eu=function j(k){let P=null;const B=Lr(k);for(st(T.beforeSanitizeShadowDOM,k,null);P=B.nextNode();)st(T.uponSanitizeShadowNode,P,null),Pr(P),Or(P),P.content instanceof o&&j(P.content);st(T.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=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=Lr(ut?j:P);for(;ce=ge.nextNode();)Pr(ce),Or(ce),ce.content instanceof o&&Eu(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(qd,P.ownerDocument.doctype.name)&&(Ie="<!DOCTYPE "+P.ownerDocument.doctype.name+`>
|
|
5331
|
-
`+Ie),Xe&&Ss([N,W,V],it=>{Ie=Rn(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=pe(j),ce=pe(k);return Fr(B,ce,P)},t.addHook=function(j,k){typeof k=="function"&&Mn(T[j],k)},t.removeHook=function(j,k){if(k!==void 0){const P=Oy(T[j],k);return P===-1?void 0:Uy(T[j],P,1)[0]}return tl(T[j])},t.removeHooks=function(j){T[j]=[]},t.removeAllHooks=function(){T=al()},t}var ko=
|
|
5332
|
-
]`).replace("lheading",
|
|
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},Vs=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),Ry(t)}};function Iy(e){this._$AN!==void 0?(Vs(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),Vs(s[o]);else s!=null&&(Wn(s,!1),Vs(s));else Wn(this,e)}const Ry=e=>{e.type==cr.CHILD&&(e._$AP??=My,e._$AQ??=Iy)};class Ly 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),Vs(this))}setValue(t){if(Ev(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,Dy=dr(class extends Ly{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 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:[]}}}$o.directiveName="unsafeHTML",$o.resultType=1;const xo=dr($o);const{entries:Wd,setPrototypeOf:el,isFrozen:Py,getPrototypeOf:Fy,getOwnPropertyDescriptor:Ny}=Object;let{freeze:Te,seal:Ue,create:Ls}=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 Ss=Ee(Array.prototype.forEach),Oy=Ee(Array.prototype.lastIndexOf),tl=Ee(Array.prototype.pop),Mn=Ee(Array.prototype.push),Uy=Ee(Array.prototype.splice),Ds=Ee(String.prototype.toLowerCase),zi=Ee(String.prototype.toString),ji=Ee(String.prototype.match),Rn=Ee(String.prototype.replace),By=Ee(String.prototype.indexOf),Hy=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]:Ds;el&&el(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const o=n(i);o!==i&&(Py(t)||(t[s]=o),i=o)}e[i]=!0}return e}function jy(e){for(let t=0;t<e.length;t++)De(e,t)||(e[t]=null);return e}function Ve(e){const t=Ls(null);for(const[n,s]of Wd(e))De(e,n)&&(Array.isArray(s)?t[n]=jy(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=Ny(e,t);if(s){if(s.get)return Ee(s.get);if(typeof s.value=="function")return Ee(s.value)}e=Fy(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"]),Ky=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"]),Wy=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"]),ks=Te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qy=Ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Gy=Ue(/<%[\w\W]*|[\w\W]*%>/gm),Vy=Ue(/\$\{[\w\W]*/gm),Jy=Ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qy=Ue(/^aria-[\-\w]+$/),qd=Ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yy=Ue(/^(?:\w+script|data):/i),Xy=Ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Gd=Ue(/^html$/i),Zy=Ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var rl=Object.freeze({__proto__:null,ARIA_ATTR:Qy,ATTR_WHITESPACE:Xy,CUSTOM_ELEMENT:Zy,DATA_ATTR:Jy,DOCTYPE_NAME:Gd,ERB_EXPR:Gy,IS_ALLOWED_URI:qd,IS_SCRIPT_OR_DATA:Yy,MUSTACHE_EXPR:qy,TMPLIT_EXPR:Vy});const Pn={element:1,text:3,progressingInstruction:7,comment:8,document:9},e0=function(){return typeof window>"u"?null:window},t0=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]:e0();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"),C=Dn(m,"remove"),R=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:_,createNodeIterator:M,createDocumentFragment:K,getElementsByTagName:G}=n,{importNode:b}=s;let T=al();t.isSupported=typeof Wd=="function"&&typeof A=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:W,TMPLIT_EXPR:V,DATA_ATTR:E,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,...ks]);let ee=Object.seal(Ls(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(Ls(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"]),ds="http://www.w3.org/1998/Math/MathML",us="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let sn=nt,$i=!1,xi=null;const Su=Q({},[ds,us,nt],zi);let gs=Q({},["mi","mo","mn","ms","mtext"]),fs=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:Ds,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,gs=k.MATHML_TEXT_INTEGRATION_POINTS||gs,fs=k.HTML_INTEGRATION_POINTS||fs,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=Ls(null),Ke.html===!0&&(Q(F,nl),Q(Y,il)),Ke.svg===!0&&(Q(F,Ki),Q(Y,Gi),Q(Y,ks)),Ke.svgFilters===!0&&(Q(F,Wi),Q(Y,Gi),Q(Y,ks)),Ke.mathMl===!0&&(Q(F,qi),Q(Y,ol),Q(Y,ks))),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=t0(v,i)),w!==null&&typeof L=="string"&&(L=w.createHTML(""));Te&&Te(k),on=k}},Ir=Q({},[...Ki,...Wi,...Ky]),Mr=Q({},[...qi,...Wy]),Eu=function(k){let P=A(k);(!P||!P.tagName)&&(P={namespaceURI:sn,tagName:"template"});const B=Ds(k.tagName),ce=Ds(P.tagName);return xi[k.namespaceURI]?k.namespaceURI===us?P.namespaceURI===nt?B==="svg":P.namespaceURI===ds?B==="svg"&&(ce==="annotation-xml"||gs[ce]):!!Ir[B]:k.namespaceURI===ds?P.namespaceURI===nt?B==="math":P.namespaceURI===us?B==="math"&&fs[ce]:!!Mr[B]:k.namespaceURI===nt?P.namespaceURI===us&&!fs[ce]||P.namespaceURI===ds&&!gs[ce]?!1:!Mr[B]&&(ku[B]||!Ir[B]):!!(En==="application/xhtml+xml"&&xi[k.namespaceURI]):!1},We=function(k){Mn(t.removed,{element:k});try{A(k).removeChild(k)}catch{C(k)}},It=function(k,P){try{Mn(t.removed,{attribute:P.getAttributeNode(k),from:P})}catch{Mn(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=_.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 M.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){Ss(j,B=>{B.call(t,k,P,on)})}const Pr=function(k){let P=null;if(st(T.beforeSanitizeElements,k,null),Si(k))return We(k),!0;const B=pe(k.nodeName);if(st(T.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,R(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,Ss([N,W,V],ce=>{P=Rn(P,ce," ")}),k.textContent!==P&&(Mn(t.removed,{element:k.cloneNode()}),k.textContent=P)),st(T.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(E,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,Rn(B,oe,""))){if(!((P==="src"||P==="xlink:href"||P==="href")&&k!=="script"&&By(B,"data:")===0&&nn[k])){if(!(be&&!ke(q,Rn(B,oe,"")))){if(B)return!1}}}}}}}return!0},Nr=function(k){return k!=="annotation-xml"&&ji(k,re)},Or=function(k){st(T.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:Hy(ki);if(B.attrName=rn,B.attrValue=$e,B.keepAttr=!0,B.forceKeepAttr=void 0,st(T.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&&Ss([N,W,V],Br=>{$e=Rn($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(T.afterSanitizeAttributes,k,null)},_u=function j(k){let P=null;const B=Lr(k);for(st(T.beforeSanitizeShadowDOM,k,null);P=B.nextNode();)st(T.uponSanitizeShadowNode,P,null),Pr(P),Or(P),P.content instanceof o&&j(P.content);st(T.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=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=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&&Ss([N,W,V],it=>{Ie=Rn(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=pe(j),ce=pe(k);return Fr(B,ce,P)},t.addHook=function(j,k){typeof k=="function"&&Mn(T[j],k)},t.removeHook=function(j,k){if(k!==void 0){const P=Oy(T[j],k);return P===-1?void 0:Uy(T[j],P,1)[0]}return tl(T[j])},t.removeHooks=function(j){T[j]=[]},t.removeAllHooks=function(){T=al()},t}var ko=Vd();function hr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var en=hr();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 n0=(()=>{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)}}>`)},s0=/^(?:[ \t]*(?:\n|$))+/,i0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,o0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,r0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,mr=/ {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,mr).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(),a0=Z(Qd).replace(/bull/g,mr).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(),vr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,l0=/^[^\n]+/,br=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,c0=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",br).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),d0=Z(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mr).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",yr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,u0=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",yr).replace("tag",hi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xd=Z(vr).replace("hr",cs).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(),g0=Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Xd).getRegex(),$r={blockquote:g0,code:i0,def:c0,fences:o0,heading:r0,hr:cs,html:u0,lheading:Yd,list:d0,newline:s0,paragraph:Xd,table:jt,text:l0},ll=Z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cs).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(),f0={...$r,lheading:a0,table:ll,paragraph:Z(vr).replace("hr",cs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ll).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()},p0={...$r,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yr).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(vr).replace("hr",cs).replace("heading",` *#{1,6} *[^
|
|
5332
|
+
]`).replace("lheading",Yd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},h0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,m0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Zd=/^( {2,}|\\)\n(?!\s*$)/,v0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,mi=/[\p{P}\p{S}]/u,xr=/[\s\p{P}\p{S}]/u,eu=/[^\s\p{P}\p{S}]/u,b0=Z(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,xr).getRegex(),tu=/(?!~)[\p{P}\p{S}]/u,y0=/(?!~)[\s\p{P}\p{S}]/u,$0=/(?:[^\s\p{P}\p{S}]|~)/u,nu=/(?![*_])[\p{P}\p{S}]/u,x0=/(?![*_])[\s\p{P}\p{S}]/u,w0=/(?:[^\s\p{P}\p{S}]|[*_])/u,S0=Z(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",n0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),su=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,k0=Z(su,"u").replace(/punct/g,mi).getRegex(),A0=Z(su,"u").replace(/punct/g,tu).getRegex(),iu="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",C0=Z(iu,"gu").replace(/notPunctSpace/g,eu).replace(/punctSpace/g,xr).replace(/punct/g,mi).getRegex(),T0=Z(iu,"gu").replace(/notPunctSpace/g,$0).replace(/punctSpace/g,y0).replace(/punct/g,tu).getRegex(),E0=Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,eu).replace(/punctSpace/g,xr).replace(/punct/g,mi).getRegex(),_0=Z(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,nu).getRegex(),I0="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",M0=Z(I0,"gu").replace(/notPunctSpace/g,w0).replace(/punctSpace/g,x0).replace(/punct/g,nu).getRegex(),R0=Z(/\\(punct)/,"gu").replace(/punct/g,mi).getRegex(),L0=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(),D0=Z(yr).replace("(?:-->|$)","-->").getRegex(),P0=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",D0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Js=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,F0=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Js).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ou=Z(/^!?\[(label)\]\[(ref)\]/).replace("label",Js).replace("ref",br).getRegex(),ru=Z(/^!?\[(ref)\](?:\[\])?/).replace("ref",br).getRegex(),N0=Z("reflink|nolink(?!\\()","g").replace("reflink",ou).replace("nolink",ru).getRegex(),cl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,wr={_backpedal:jt,anyPunctuation:R0,autolink:L0,blockSkip:S0,br:Zd,code:m0,del:jt,delLDelim:jt,delRDelim:jt,emStrongLDelim:k0,emStrongRDelimAst:C0,emStrongRDelimUnd:E0,escape:h0,link:F0,nolink:ru,punctuation:b0,reflink:ou,reflinkSearch:N0,tag:P0,text:v0,url:jt},O0={...wr,link:Z(/^!?\[(label)\]\((.*?)\)/).replace("label",Js).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Js).getRegex()},Ao={...wr,emStrongRDelimAst:T0,emStrongLDelim:A0,delLDelim:_0,delRDelim:M0,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",cl).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",cl).getRegex()},U0={...Ao,br:Z(Zd).replace("{2,}","*").getRegex(),text:Z(Ao.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},As={normal:$r,gfm:f0,pedantic:p0},Fn={normal:wr,gfm:Ao,breaks:U0,pedantic:O0},B0={"&":"&","<":"<",">":">",'"':""","'":"'"},dl=e=>B0[e];function Je(e,t){if(t){if(Ce.escapeTest.test(e))return e.replace(Ce.escapeReplace,dl)}else if(Ce.escapeTestNoEncode.test(e))return e.replace(Ce.escapeReplaceNoEncode,dl);return e}function ul(e){try{e=encodeURI(e).replace(Ce.percentDecode,"%")}catch{return null}return e}function gl(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 H0(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 fl(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 j0(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
5334
|
`)}var Qs=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
5335
|
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=j0(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],`
|
|
@@ -5386,9 +5386,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
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
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=ul(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=ul(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)}},Sr=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 Ys,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Sr}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}},K0=class{defaults=hr();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ze;Renderer=Ys;TextRenderer=Sr;Lexer=He;Tokenizer=Qs;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 Ys(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 Qs(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 K0;function te(e,t){return Qt.parse(e,t)}te.options=te.setOptions=function(e){return Qt.setOptions(e),te.defaults=Qt.defaults,
|
|
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 K0;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=hr;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=Ys;te.TextRenderer=Sr;te.Lexer=He;te.lexer=He.lex;te.Tokenizer=Qs;te.Hooks=Un;te.parse=te;te.options;te.setOptions;te.use;te.walkTokens;te.parseInline;ze.parse;He.lex;const W0=["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"],q0=["class","href","rel","target","title","start","src","alt"],pl={ALLOWED_TAGS:W0,ALLOWED_ATTR:q0,ADD_DATA_URI_TAGS:["img"]};let hl=!1;const G0=14e4,V0=4e4,J0=200,Vi=5e4,Wt=new Map;function Q0(e){const t=Wt.get(e);return t===void 0?null:(Wt.delete(e),Wt.set(e,t),t)}function ml(e,t){if(Wt.set(e,t),Wt.size<=J0)return;const n=Wt.keys().next().value;n&&Wt.delete(n)}function Y0(){hl||(hl=!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(Y0(),t.length<=Vi){const r=Q0(t);if(r!==null)return r}const n=pc(t,G0),s=n.truncated?`
|
|
5390
5390
|
|
|
5391
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>V0){const l=`<pre class="code-block">${
|
|
5391
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>V0){const l=`<pre class="code-block">${lu(`${n.text}${s}`)}</pre>`,a=ko.sanitize(l,pl);return t.length<=Vi&&ml(t,a),a}const i=te.parse(`${n.text}${s}`,{renderer:au,gfm:!0,breaks:!0}),o=ko.sanitize(i,pl);return t.length<=Vi&&ml(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 Ps="data:",X0=new Set(["http:","https:","blob:"]),Z0=new Set(["image/svg+xml"]);function e$(e){if(!e.toLowerCase().startsWith(Ps))return!1;const t=e.indexOf(",");if(t<Ps.length)return!1;const s=e.slice(Ps.length,t).split(";")[0]?.trim().toLowerCase()??"";return s.startsWith("image/")?!Z0.has(s):!1}function t$(e,t,n={}){const s=e.trim();if(!s)return null;if(n.allowDataImage===!0&&e$(s))return s;if(s.toLowerCase().startsWith(Ps))return null;try{const i=new URL(s,t);return X0.has(i.protocol.toLowerCase())?i.toString():null}catch{return null}}function n$(e,t={}){const n=t.baseHref??window.location.href,s=t$(e,n,t);if(!s)return null;const i=window.open(s,"_blank","noopener,noreferrer");return i&&(i.opener=null),i}const s$=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 cu(e,t=/[\s\p{P}\p{S}]/u){if(!e)return"ltr";for(const n of e)if(!t.test(n))return s$.test(n)?"rtl":"ltr";return"ltr"}const i$=1500,o$=2e3,du="Copy as markdown",r$="Copied",a$="Copy failed";async function l$(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Cs(e,t){e.title=t,e.setAttribute("aria-label",t)}function c$(e){const t=e.label??du;return c`
|
|
5392
5392
|
<button
|
|
5393
5393
|
class="chat-copy-btn"
|
|
5394
5394
|
type="button"
|
|
@@ -5401,12 +5401,12 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
|
|
|
5401
5401
|
<span class="chat-copy-btn__icon-check">${he.check}</span>
|
|
5402
5402
|
</span>
|
|
5403
5403
|
</button>
|
|
5404
|
-
`}function d$(e){return c$({text:()=>e,label:cu})}function du(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 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 uu(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const u$={emoji:"🧩",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},g$={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"]}}}},f$={fallback:u$,tools:g$};function An(e){return e&&typeof e=="object"?e:void 0}function p$(e){return(e??"tool").trim()}function h$(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 m$(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function v$(e){if(!e||typeof e!="object")return;const t=e.action;return typeof t!="string"?void 0:t.trim()||void 0}function b$(e){return F$({toolKey:e.toolKey,args:e.args,meta:e.meta,action:v$(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 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 gu(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 y$(e){const t=An(e);if(!t)return;const n=gu(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 $$(e,t){const n=An(t);if(!n)return;const s=gu(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 x$(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 w$(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 S$(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 k$(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 A$(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 C$(e){const t=qt(e,3),n=Cn(t[0]);if(n==="cd"||n==="pushd")return t[1]||void 0}function T$(e){const t=Cn(qt(e,2)[0]);return t==="cd"||t==="pushd"||t==="popd"}function E$(e){return Cn(qt(e,2)[0])==="popd"}function _$(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)&&T$(o);if(!(o.startsWith("set ")||o.startsWith("export ")||o.startsWith("unset ")||r)||(r&&(E$(o)?n=void 0:n=C$(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=(Ar(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 I$(e){const t=A$(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 bl(e){const{command:t,chdirPath:n}=_$(e);if(!t)return n?{text:"",chdirPath:n}:void 0;const s=k$(t);if(s.length===0)return;const i=s.map(l=>I$(l)),o=i.length===1?i[0]:i.join(" → "),r=i.every(l=>
|
|
5404
|
+
`}function d$(e){return c$({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 u$={emoji:"🧩",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},g$={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"]}}}},f$={fallback:u$,tools:g$};function An(e){return e&&typeof e=="object"?e:void 0}function p$(e){return(e??"tool").trim()}function h$(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 m$(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function v$(e){if(!e||typeof e!="object")return;const t=e.action;return typeof t!="string"?void 0:t.trim()||void 0}function b$(e){return F$({toolKey:e.toolKey,args:e.args,meta:e.meta,action:v$(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 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 y$(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 $$(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 x$(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 w$(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 S$(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 k$(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 A$(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 C$(e){const t=qt(e,3),n=Cn(t[0]);if(n==="cd"||n==="pushd")return t[1]||void 0}function T$(e){const t=Cn(qt(e,2)[0]);return t==="cd"||t==="pushd"||t==="popd"}function E$(e){return Cn(qt(e,2)[0])==="popd"}function _$(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)&&T$(o);if(!(o.startsWith("set ")||o.startsWith("export ")||o.startsWith("unset ")||r)||(r&&(E$(o)?n=void 0:n=C$(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=(Ar(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 I$(e){const t=A$(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 bl(e){const{command:t,chdirPath:n}=_$(e);if(!t)return n?{text:"",chdirPath:n}:void 0;const s=k$(t);if(s.length===0)return;const i=s.map(l=>I$(l)),o=i.length===1?i[0]:i.join(" → "),r=i.every(l=>pu(l));return{text:o,chdirPath:n,allGeneric:r}}const M$=["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 pu(e){return e==="run command"?!0:e.startsWith("run ")?!M$.some(t=>e.startsWith(t)):!1}function R$(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 L$(e){const t=An(e);if(!t)return;const n=typeof t.command=="string"?t.command.trim():void 0;if(!n)return;const s=S$(n),i=bl(s)??bl(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=R$(s);if(i?.allGeneric!==!1&&pu(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 D$(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function P$(e,t,n){if(n.mode==="first"){for(const r of t){const l=vl(e,r),a=_o(l,n.coerce);if(a)return a}return}const s=[];for(const r of t){const l=vl(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 F$(e){const t=D$(e.spec,e.action),n=e.toolKey==="web_search"?"search":e.toolKey==="web_fetch"?"fetch":e.toolKey.replace(/_/g," ").replace(/\./g," "),s=m$(t?.label??e.action??n);let i;e.toolKey==="exec"&&(i=L$(e.args)),!i&&e.toolKey==="read"&&(i=y$(e.args)),!i&&(e.toolKey==="write"||e.toolKey==="edit"||e.toolKey==="attach")&&(i=$$(e.toolKey,e.args)),!i&&e.toolKey==="web_search"&&(i=x$(e.args)),!i&&e.toolKey==="web_fetch"&&(i=w$(e.args));const o=t?.detailKeys??e.spec?.detailKeys??e.fallbackDetailKeys??[];return!i&&o.length>0&&(i=P$(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 N$(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 O$={"🧩":"puzzle","🛠️":"wrench","🧰":"wrench","📖":"fileText","✍️":"edit","📝":"penLine","📎":"paperclip","🌐":"globe","📺":"monitor","🧾":"fileText","🔐":"settings","💻":"monitor","🔌":"plug","💬":"messageSquare"},U$={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 B$(e){return e?O$[e]??"puzzle":"puzzle"}function
|
|
5407
|
+
\`${a}\``:d}function D$(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function P$(e,t,n){if(n.mode==="first"){for(const r of t){const l=vl(e,r),a=_o(l,n.coerce);if(a)return a}return}const s=[];for(const r of t){const l=vl(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 F$(e){const t=D$(e.spec,e.action),n=e.toolKey==="web_search"?"search":e.toolKey==="web_fetch"?"fetch":e.toolKey.replace(/_/g," ").replace(/\./g," "),s=m$(t?.label??e.action??n);let i;e.toolKey==="exec"&&(i=L$(e.args)),!i&&e.toolKey==="read"&&(i=y$(e.args)),!i&&(e.toolKey==="write"||e.toolKey==="edit"||e.toolKey==="attach")&&(i=$$(e.toolKey,e.args)),!i&&e.toolKey==="web_search"&&(i=x$(e.args)),!i&&e.toolKey==="web_fetch"&&(i=w$(e.args));const o=t?.detailKeys??e.spec?.detailKeys??e.fallbackDetailKeys??[];return!i&&o.length>0&&(i=P$(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 N$(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 O$={"🧩":"puzzle","🛠️":"wrench","🧰":"wrench","📖":"fileText","✍️":"edit","📝":"penLine","📎":"paperclip","🌐":"globe","📺":"monitor","🧾":"fileText","🔐":"settings","💻":"monitor","🔌":"plug","💬":"messageSquare"},U$={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 B$(e){return e?O$[e]??"puzzle":"puzzle"}function hu(e){return{icon:B$(e?.emoji),title:e?.title,label:e?.label,detailKeys:e?.detailKeys,actions:e?.actions}}const mu=f$,yl=hu(mu.fallback??{emoji:"🧩"}),vu=Object.fromEntries(Object.entries(mu.tools??{}).map(([e,t])=>[e,hu(t)]));vu.slack=U$;function H$(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 z$(e){const t=p$(e.name),n=t.toLowerCase(),s=vu[n],i=s?.icon??yl.icon??"puzzle",o=s?.title??h$(t),r=s?.label??o;let{verb:l,detail:a}=b$({toolKey:n,args:e.args,meta:e.meta,spec:s,fallbackDetailKeys:yl.detailKeys,detailMode:"first",detailCoerce:{includeFalse:!0,includeZero:!0}});return a&&(a=H$(a)),{name:t,icon:i,title:o,label:r,verb:l,detail:a}}function j$(e){return N$(e.detail,{prefixWithWith:!0})}const K$=80,W$=2,$l=100;function q$(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 G$(e){const t=e.split(`
|
|
5408
5408
|
`),n=t.slice(0,W$),s=n.join(`
|
|
5409
|
-
`);return s.length>$l?s.slice(0,$l)+"…":n.length<t.length?s+"…":s}function V$(e){const t=e,n=J$(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:Q$(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=Y$(i),l=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:l,text:r})}if(
|
|
5409
|
+
`);return s.length>$l?s.slice(0,$l)+"…":n.length<t.length?s+"…":s}function V$(e){const t=e,n=J$(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:Q$(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=Y$(i),l=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:l,text:r})}if(gu(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=od(e)??void 0;s.push({kind:"result",name:i,text:o})}return s}function xl(e,t){const n=z$({name:e.name,args:e.args}),s=j$(n),i=!!e.text?.trim(),o=!!t,r=o?()=>{if(i){t(q$(e.text));return}const u=`## ${n.label}
|
|
5410
5410
|
|
|
5411
5411
|
${s?`**Command:** \`${s}\`
|
|
5412
5412
|
|
|
@@ -5448,7 +5448,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
5448
5448
|
<div class="chat-group assistant">
|
|
5449
5449
|
${Tr("assistant",s)}
|
|
5450
5450
|
<div class="chat-group-messages">
|
|
5451
|
-
${
|
|
5451
|
+
${bu({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>
|
|
@@ -5459,7 +5459,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
5459
5459
|
<div class="chat-group ${o}">
|
|
5460
5460
|
${Tr(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)=>bu(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>
|
|
@@ -5481,12 +5481,12 @@ ${s?`**Command:** \`${s}\`
|
|
|
5481
5481
|
/>
|
|
5482
5482
|
`)}
|
|
5483
5483
|
</div>
|
|
5484
|
-
`}function
|
|
5484
|
+
`}function bu(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",o=gu(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",r=V$(e),l=r.length>0,a=X$(e),d=a.length>0,g=od(e),u=t.showReasoning&&i==="assistant"?Mh(e):null,f=g?.trim()?g:null,v=u?Rh(u):null,m=f,S=i==="assistant"&&!!m?.trim(),C=["chat-bubble",S?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!m&&l&&o?c`${r.map(R=>xl(R,n))}`:!m&&!l&&!d?h:c`
|
|
5485
5485
|
<div class="${C}">
|
|
5486
5486
|
${S?d$(m):h}
|
|
5487
5487
|
${sx(a)}
|
|
5488
5488
|
${v?c`<div class="chat-thinking">${xo(Eo(v))}</div>`:h}
|
|
5489
|
-
${m?c`<div class="chat-text" dir="${
|
|
5489
|
+
${m?c`<div class="chat-text" dir="${cu(m)}">${xo(Eo(m))}</div>`:h}
|
|
5490
5490
|
${r.map(R=>xl(R,n))}
|
|
5491
5491
|
</div>
|
|
5492
5492
|
`}function ix(e){return c`
|
|
@@ -5508,7 +5508,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
5508
5508
|
`}
|
|
5509
5509
|
</div>
|
|
5510
5510
|
</div>
|
|
5511
|
-
`}var ox=Object.defineProperty,rx=Object.getOwnPropertyDescriptor,vi=(e,t,n,s)=>{for(var i=s>1?void 0:s?rx(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&&ox(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=
|
|
5511
|
+
`}var ox=Object.defineProperty,rx=Object.getOwnPropertyDescriptor,vi=(e,t,n,s)=>{for(var i=s>1?void 0:s?rx(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&&ox(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;
|
|
@@ -5584,7 +5584,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
5584
5584
|
${e.loading?c`
|
|
5585
5585
|
<div class="muted">Loading chat…</div>
|
|
5586
5586
|
`:l.length===0?px(e):h}
|
|
5587
|
-
${
|
|
5587
|
+
${Td(l,m=>m.key,m=>m.kind==="divider"?c`
|
|
5588
5588
|
<div class="chat-divider" role="separator" data-ts=${String(m.timestamp)}>
|
|
5589
5589
|
<span class="chat-divider__line"></span>
|
|
5590
5590
|
<span class="chat-divider__label">${m.label}</span>
|
|
@@ -5677,7 +5677,7 @@ ${e.sidebarContent}
|
|
|
5677
5677
|
<textarea
|
|
5678
5678
|
${Dy(m=>m&&wl(m))}
|
|
5679
5679
|
.value=${e.draft}
|
|
5680
|
-
dir=${
|
|
5680
|
+
dir=${cu(e.draft)}
|
|
5681
5681
|
?disabled=${!e.connected}
|
|
5682
5682
|
@keydown=${m=>{m.key==="Enter"&&(m.isComposing||m.keyCode===229||m.shiftKey||e.connected&&(m.preventDefault(),t&&e.onSend()))}}
|
|
5683
5683
|
@input=${m=>{const S=m.target;wl(S),e.onDraftChange(S.value)}}
|
|
@@ -5704,7 +5704,7 @@ ${e.sidebarContent}
|
|
|
5704
5704
|
</div>
|
|
5705
5705
|
</div>
|
|
5706
5706
|
</section>
|
|
5707
|
-
`}const Sl=200;function mx(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=
|
|
5707
|
+
`}const Sl=200;function mx(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=uu(s.message),o=kr(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 vx(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Sl);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Sl} messages (${i} hidden).`,timestamp:Date.now()}});for(let o=i;o<n.length;o++){const r=n[o],l=uu(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:kl(r,o),message:r})}if(e.showThinking)for(let o=0;o<s.length;o++)t.push({kind:"message",key:kl(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 mx(t)}function kl(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 yu(e){return e.trim().toLowerCase()}function bx(e){const t=new Set,n=[],s=/(^|\s)tag:([^\s]+)/gi,i=e.trim();let o=s.exec(i);for(;o;){const r=yu(o[2]??"");r&&!t.has(r)&&(t.add(r),n.push(r)),o=s.exec(i)}return n}function yx(e,t){const n=[],s=new Set;for(const l of t){const a=yu(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 $x=["security","auth","network","access","privacy","observability","performance","reliability","storage","models","media","automation","channels","tools","advanced"],Io={all:c`
|
|
5708
5708
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
5709
5709
|
<rect x="3" y="3" width="7" height="7"></rect>
|
|
5710
5710
|
<rect x="14" y="3" width="7" height="7"></rect>
|
|
@@ -5898,7 +5898,7 @@ ${e.sidebarContent}
|
|
|
5898
5898
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
5899
5899
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
5900
5900
|
</svg>
|
|
5901
|
-
`},Al=[{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"}],Cl="__all__";function Tl(e){return Io[e]??Io.default}function xx(e,t){const n=pr[e];return n||{label:t?.title??ni(e),description:t?.description??""}}function wx(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??ni(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 Sx(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 El(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 kx(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=
|
|
5901
|
+
`},Al=[{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"}],Cl="__all__";function Tl(e){return Io[e]??Io.default}function xx(e,t){const n=pr[e];return n||{label:t?.title??ni(e),description:t?.description??""}}function wx(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??ni(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 Sx(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 El(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 kx(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=Al.filter(M=>M.key in i),r=new Set(Al.map(M=>M.key)),l=Object.keys(i).filter(M=>!r.has(M)).map(M=>({key:M,label:M.charAt(0).toUpperCase()+M.slice(1)})),a=[...o,...l],d=e.activeSection&&n.schema&&ve(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,g=e.activeSection?xx(e.activeSection,d):null,u=e.activeSection?wx({key:e.activeSection,schema:d,uiHints:e.uiHints}):[],f=e.formMode==="form"&&!!e.activeSection&&u.length>0,v=e.activeSubsection===Cl,m=e.searchQuery||v?null:e.activeSubsection??u[0]?.key??null,S=e.formMode==="form"?Sx(e.originalValue,e.formValue):[],C=e.formMode==="raw"&&e.raw!==e.originalRaw,R=e.formMode==="form"?S.length>0:C,I=!!e.formValue&&!e.loading&&!!n.schema,A=e.connected&&!e.saving&&R&&(e.formMode==="raw"?!0:I),w=e.connected&&!e.applying&&!e.updating&&R&&(e.formMode==="raw"?!0:I),L=e.connected&&!e.applying&&!e.updating,_=new Set(bx(e.searchQuery));return c`
|
|
5902
5902
|
<div class="config-layout">
|
|
5903
5903
|
<!-- Sidebar -->
|
|
5904
5904
|
<aside class="config-sidebar">
|
|
@@ -6947,7 +6947,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6947
6947
|
<div class=${s} @click=${()=>t.onLoadRuns(e.id)}>
|
|
6948
6948
|
<div class="list-main">
|
|
6949
6949
|
<div class="list-title">${e.name}</div>
|
|
6950
|
-
<div class="list-sub">${
|
|
6950
|
+
<div class="list-sub">${Md(e)}</div>
|
|
6951
6951
|
${Px(e)}
|
|
6952
6952
|
${e.agentId?c`<div class="muted cron-job-agent">${p("cron.jobDetail.agent")}: ${e.agentId}</div>`:h}
|
|
6953
6953
|
</div>
|
|
@@ -7588,7 +7588,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7588
7588
|
<div class="callout info" style="margin-top: 12px">Select a provider to edit.</div>
|
|
7589
7589
|
`}
|
|
7590
7590
|
</section>
|
|
7591
|
-
`}function
|
|
7591
|
+
`}function $u(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 xu(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__",Ol=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],aw=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Ul(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function lw(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function cw(e){const t=e?.defaults??{};return{security:Ul(t.security),ask:lw(t.ask),askFallback:Ul(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function dw(e){return $u(e).map(t=>({id:t.id,name:t.name,isDefault:t.isDefault}))}function uw(e,t){const n=dw(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 gw(e,t){return e===xt?xt:e&&t.some(n=>n.id===e)?e:xt}function fw(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=cw(t),i=uw(e.configForm,t),o=$w(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=gw(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 pw(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return c`
|
|
7592
7592
|
<section class="card">
|
|
7593
7593
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
7594
7594
|
<div>
|
|
@@ -7841,7 +7841,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7841
7841
|
</button>
|
|
7842
7842
|
</div>
|
|
7843
7843
|
</div>
|
|
7844
|
-
`}function $w(e){return
|
|
7844
|
+
`}function $w(e){return xu(e,["system.execApprovals.get","system.execApprovals.set"])}function xw(e){const t=Cw(e),n=fw(e);return c`
|
|
7845
7845
|
${pw(n)}
|
|
7846
7846
|
${Tw(t)}
|
|
7847
7847
|
${ww(e)}
|
|
@@ -8036,7 +8036,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8036
8036
|
</label>
|
|
8037
8037
|
</div>
|
|
8038
8038
|
</div>
|
|
8039
|
-
`}function _w(e){return
|
|
8039
|
+
`}function _w(e){return xu(e,["system.run"])}function Iw(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=$u(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 Mw(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`
|
|
8040
8040
|
<div class="list-item">
|
|
8041
8041
|
<div class="list-main">
|
|
8042
8042
|
<div class="list-title">${s}</div>
|
|
@@ -8269,7 +8269,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8269
8269
|
</div>
|
|
8270
8270
|
</div>
|
|
8271
8271
|
</section>
|
|
8272
|
-
`}const Dw=["","off","minimal","low","medium","high","xhigh"],Pw=["","off","on"],Fw=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"},{value:"full",label:"full"}],Nw=["","off","on","stream"];function Ow(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function
|
|
8272
|
+
`}const Dw=["","off","minimal","low","medium","high","xhigh"],Pw=["","off","on"],Fw=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"},{value:"full",label:"full"}],Nw=["","off","on","stream"];function Ow(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function wu(e){return Ow(e)==="zai"}function Uw(e){return wu(e)?Pw:Dw}function Bl(e,t){return t?e.includes(t)?[...e]:[...e,t]:[...e]}function Bw(e,t){return t?e.some(n=>n.value===t)?[...e]:[...e,{value:t,label:`${t} (custom)`}]:[...e]}function Hw(e,t){return!t||!e||e==="off"?e:"on"}function zw(e,t){return e?t&&e==="on"?"low":e:null}function jw(e){const t=e.result?.sessions??[];return c`
|
|
8273
8273
|
<section class="card">
|
|
8274
8274
|
<div class="row" style="justify-content: space-between;">
|
|
8275
8275
|
<div>
|
|
@@ -8337,7 +8337,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8337
8337
|
`:t.map(n=>Kw(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
|
|
8338
8338
|
</div>
|
|
8339
8339
|
</section>
|
|
8340
|
-
`}function Kw(e,t,n,s,i){const o=e.updatedAt?ne(e.updatedAt):"n/a",r=e.thinkingLevel??"",l=
|
|
8340
|
+
`}function Kw(e,t,n,s,i){const o=e.updatedAt?ne(e.updatedAt):"n/a",r=e.thinkingLevel??"",l=wu(e.modelProvider),a=Hw(r,l),d=Bl(Uw(e.modelProvider),a),g=e.verboseLevel??"",u=Bw(Fw,g),f=e.reasoningLevel??"",v=Bl(Nw,f),m=typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName.trim():null,S=typeof e.label=="string"?e.label.trim():"",C=!!(m&&m!==e.key&&m!==S),R=e.kind!=="global",I=R?`${ci("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return c`
|
|
8341
8341
|
<div class="table-row">
|
|
8342
8342
|
<div class="mono session-key-cell">
|
|
8343
8343
|
${R?c`<a href=${I} class="session-link">${e.key}</a>`:e.key}
|
|
@@ -8390,7 +8390,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8390
8390
|
</button>
|
|
8391
8391
|
</div>
|
|
8392
8392
|
</div>
|
|
8393
|
-
`}function Ww(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=
|
|
8393
|
+
`}function Ww(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`
|
|
8394
8394
|
<section class="card">
|
|
8395
8395
|
<div class="row" style="justify-content: space-between;">
|
|
8396
8396
|
<div>
|
|
@@ -8434,14 +8434,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8434
8434
|
</div>
|
|
8435
8435
|
`}
|
|
8436
8436
|
</section>
|
|
8437
|
-
`}function qw(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=
|
|
8437
|
+
`}function qw(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`
|
|
8438
8438
|
<div class="list-item">
|
|
8439
8439
|
<div class="list-main">
|
|
8440
8440
|
<div class="list-title">
|
|
8441
8441
|
${e.emoji?`${e.emoji} `:""}${e.name}
|
|
8442
8442
|
</div>
|
|
8443
8443
|
<div class="list-sub">${so(e.description,140)}</div>
|
|
8444
|
-
${
|
|
8444
|
+
${Od({skill:e,showBundledBadge:r})}
|
|
8445
8445
|
${l.length>0?c`
|
|
8446
8446
|
<div class="muted" style="margin-top: 6px;">
|
|
8447
8447
|
Missing: ${l.join(", ")}
|
|
@@ -8496,7 +8496,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8496
8496
|
`:h}
|
|
8497
8497
|
</div>
|
|
8498
8498
|
</div>
|
|
8499
|
-
`}const Gw=["off","minimal","low","medium","high"],Vw=["UTC","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","Europe/London","Europe/Berlin","Asia/Tokyo"],Jw=new Set(["chat","overview","market","models"]);function Qw(e){return/^https?:\/\//i.test(e.trim())}function Yi(e){return typeof e=="string"?e.trim():""}function Hl(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 Yw(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?Me(e,["bitseek","advancedMode"],!0):qe(e,["bitseek","advancedMode"]),await On(e)},m=Xt(e.basePath??""),S=m?`${m}/brand.png`:"/brand.png",C=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null,R=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,...ub(u),...e.cronJobs.map(b=>b.payload.kind!=="agentTurn"||typeof b.payload.model!="string"?"":b.payload.model.trim()).filter(Boolean)].filter(Boolean))),A=
|
|
8499
|
+
`}const Gw=["off","minimal","low","medium","high"],Vw=["UTC","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","Europe/London","Europe/Berlin","Asia/Tokyo"],Jw=new Set(["chat","overview","market","models"]);function Qw(e){return/^https?:\/\//i.test(e.trim())}function Yi(e){return typeof e=="string"?e.trim():""}function Hl(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 Yw(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?Me(e,["bitseek","advancedMode"],!0):qe(e,["bitseek","advancedMode"]),await On(e)},m=Xt(e.basePath??""),S=m?`${m}/brand.png`:"/brand.png",C=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null,R=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,...ub(u),...e.cronJobs.map(b=>b.payload.kind!=="agentTurn"||typeof b.payload.model!="string"?"":b.payload.model.trim()).filter(Boolean)].filter(Boolean))),A=nf(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),_=(w==="last"?Object.values(e.channelsSnapshot?.channelAccounts??{}).flat():e.channelsSnapshot?.channelAccounts?.[w]??[]).flatMap(b=>[Yi(b.accountId),Yi(b.name)]).filter(Boolean),M=Hl([...L,..._]),K=Hl(_),G=e.cronForm.deliveryMode==="webhook"?M.filter(b=>Qw(b)):M;return c`
|
|
8500
8500
|
<div class="shell ${a?"shell--chat":""} ${d?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
|
|
8501
8501
|
<header class="topbar">
|
|
8502
8502
|
<div class="topbar-left">
|
|
@@ -8610,30 +8610,30 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8610
8610
|
|
|
8611
8611
|
${Cv(e)}
|
|
8612
8612
|
|
|
8613
|
-
${e.tab==="cron"?Rx({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:!hc(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:R,modelSuggestions:I,thinkingSuggestions:Gw,timezoneSuggestions:Vw,deliveryToSuggestions:G,accountSuggestions:K,onFormChange:b=>{e.cronForm=zo({...e.cronForm,...b}),e.cronFieldErrors=is(e.cronForm)},onRefresh:()=>e.loadCron(),onAdd:()=>
|
|
8613
|
+
${e.tab==="cron"?Rx({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:!hc(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:R,modelSuggestions:I,thinkingSuggestions:Gw,timezoneSuggestions:Vw,deliveryToSuggestions:G,accountSuggestions:K,onFormChange:b=>{e.cronForm=zo({...e.cronForm,...b}),e.cronFieldErrors=is(e.cronForm)},onRefresh:()=>e.loadCron(),onAdd:()=>df(e),onEdit:b=>hf(e,b),onClone:b=>vf(e,b),onCancelEdit:()=>bf(e),onToggle:(b,T)=>uf(e,b,T),onRun:(b,T)=>gf(e,b,T??"force"),onRemove:b=>ff(e,b),onLoadRuns:async b=>{aa(e,{cronRunsScope:"job"}),await yt(e,b)},onLoadMoreJobs:()=>tf(e),onJobsFiltersChange:async b=>{ra(e,b),(typeof b.cronJobsQuery=="string"||b.cronJobsEnabledFilter||b.cronJobsSortBy||b.cronJobsSortDir)&&await oa(e)},onJobsFiltersReset:async()=>{ra(e,{cronJobsQuery:"",cronJobsEnabledFilter:"all",cronJobsScheduleKindFilter:"all",cronJobsLastStatusFilter:"all",cronJobsSortBy:"nextRunAtMs",cronJobsSortDir:"asc"}),await oa(e)},onLoadMoreRuns:()=>pf(e),onRunsFiltersChange:async b=>{if(aa(e,b),e.cronRunsScope==="all"){await yt(e,null);return}await yt(e,e.cronRunsJobId)}}):h}
|
|
8614
8614
|
|
|
8615
8615
|
${e.tab==="agents"?Nb({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:C,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 T=e.agentsList?.agents?.map(N=>N.id)??[];T.length>0&&fc(e,T)},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,gc(e,b),e.agentsPanel==="tools"&&Hn(e,b),e.agentsPanel==="files"&&Ui(e,b),e.agentsPanel==="skills"&&Es(e,b))},onSelectPanel:b=>{e.agentsPanel=b,b==="files"&&C&&e.agentFilesList?.agentId!==C&&(e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},Ui(e,C)),b==="tools"&&Hn(e,C),b==="skills"&&C&&Es(e,C),b==="channels"&&Re(e,!1),b==="cron"&&e.loadCron()},onLoadFiles:b=>Ui(e,b),onSelectFile:b=>{e.agentFileActive=b,C&&Gv(e,C,b)},onFileDraftChange:(b,T)=>{e.agentFileDrafts={...e.agentFileDrafts,[b]:T}},onFileReset:b=>{const T=e.agentFileContents[b]??"";e.agentFileDrafts={...e.agentFileDrafts,[b]:T}},onFileSave:b=>{if(!C)return;const T=e.agentFileDrafts[b]??e.agentFileContents[b]??"";Vv(e,C,b,T)},onToolsProfileChange:(b,T,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 E=["agents","list",V,"tools"];T?Me(e,[...E,"profile"],T):qe(e,[...E,"profile"]),N&&qe(e,[...E,"allow"])},onToolsOverridesChange:(b,T,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 E=["agents","list",V,"tools"];T.length>0?Me(e,[...E,"alsoAllow"],T):qe(e,[...E,"alsoAllow"]),N.length>0?Me(e,[...E,"deny"],N):qe(e,[...E,"deny"])},onConfigReload:()=>Ae(e),onConfigSave:()=>On(e),onChannelsRefresh:()=>Re(e,!1),onCronRefresh:()=>e.loadCron(),onSkillsFilterChange:b=>e.skillsFilter=b,onSkillsRefresh:()=>{C&&Es(e,C)},onAgentSkillToggle:(b,T,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 E=W[V],O=T.trim();if(!O)return;const q=e.agentSkillsReport?.skills?.map(F=>F.name).filter(Boolean)??[],re=(Array.isArray(E.skills)?E.skills.map(F=>String(F).trim()).filter(Boolean):void 0)??q,D=new Set(re);N?D.add(O):D.delete(O),Me(e,["agents","list",V,"skills"],[...D])},onAgentSkillsClear:b=>{if(!u)return;const T=u.agents?.list;if(!Array.isArray(T))return;const N=T.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 T=u.agents?.list;if(!Array.isArray(T))return;const N=T.findIndex(W=>W&&typeof W=="object"&&"id"in W&&W.id===b);N<0||Me(e,["agents","list",N,"skills"],[])},onModelChange:(b,T)=>{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(!T){qe(e,V);return}const O=N[W]?.model;if(O&&typeof O=="object"&&!Array.isArray(O)){const q=O.fallbacks,oe={primary:T,...Array.isArray(q)?{fallbacks:q}:{}};Me(e,V,oe)}else Me(e,V,T)},onModelFallbacksChange:(b,T)=>{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"],E=N[W],O=T.map(F=>F.trim()).filter(Boolean),q=E.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?Me(e,V,re):qe(e,V);return}Me(e,V,re?{primary:re,fallbacks:O}:{fallbacks:O})}}):h}
|
|
8616
8616
|
|
|
8617
8617
|
${e.tab==="skills"?Ww({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:()=>ls(e,{clearMessages:!0}),onToggle:(b,T)=>zp(e,b,T),onEdit:(b,T)=>Hp(e,b,T),onSaveKey:b=>jp(e,b),onInstall:(b,T,N)=>Kp(e,b,T,N)}):h}
|
|
8618
8618
|
|
|
8619
|
-
${e.tab==="market"?ow({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=>
|
|
8619
|
+
${e.tab==="market"?ow({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=>op(e,b)}):h}
|
|
8620
8620
|
|
|
8621
|
-
${e.tab==="nodes"?xw({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:()=>ii(e),onDevicesRefresh:()=>Et(e),onDeviceApprove:b=>
|
|
8621
|
+
${e.tab==="nodes"?xw({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:()=>ii(e),onDevicesRefresh:()=>Et(e),onDeviceApprove:b=>Jf(e,b),onDeviceReject:b=>Qf(e,b),onDeviceRotate:(b,T,N)=>Yf(e,{deviceId:b,role:T,scopes:N}),onDeviceRevoke:(b,T)=>Xf(e,{deviceId:b,role:T}),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?Me(e,["tools","exec","node"],b):qe(e,["tools","exec","node"])},onBindAgent:(b,T)=>{const N=["agents","list",b,"tools","exec","node"];T?Me(e,N,T):qe(e,N)},onSaveBindings:()=>On(e),onExecApprovalsTargetChange:(b,T)=>{e.execApprovalsTarget=b,e.execApprovalsTargetNodeId=T,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:b=>{e.execApprovalsSelectedAgent=b},onExecApprovalsPatch:(b,T)=>sp(e,b,T),onExecApprovalsRemove:b=>ip(e,b),onSaveExecApprovals:()=>{const b=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return np(e,b)}}):h}
|
|
8622
8622
|
|
|
8623
8623
|
${e.tab==="chat"?hx({sessionKey:e.sessionKey,onSessionKeyChange:b=>{e.sessionKey=b,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:b,lastActiveSessionKey:b}),e.loadAssistantIdentity(),es(e),fo(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,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:d,onRefresh:()=>(e.resetToolStream(),Promise.all([es(e),fo(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}
|
|
8624
8624
|
|
|
8625
|
-
${e.tab==="models"?rw({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:()=>
|
|
8625
|
+
${e.tab==="models"?rw({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:()=>jc(e),onSelectProvider:b=>ma(e,b),onAddProvider:()=>ma(e,Np()),onDraftChange:(b,T)=>Mp(e,b,T),onDefaultChange:b=>Fp(e,b),onSaveDefault:()=>Lp(e),onVerify:()=>Pp(e),onSave:()=>Rp(e),onDelete:()=>Dp(e)}):h}
|
|
8626
8626
|
|
|
8627
|
-
${e.tab==="config"?kx({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,T)=>Me(e,b,T),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:()=>
|
|
8627
|
+
${e.tab==="config"?kx({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,T)=>Me(e,b,T),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:()=>hg(e),onUpdate:()=>ta(e)}):h}
|
|
8628
8628
|
|
|
8629
|
-
${e.tab==="debug"?Hx({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:()=>si(e),onCall:()=>
|
|
8629
|
+
${e.tab==="debug"?Hx({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:()=>si(e),onCall:()=>Ng(e)}):h}
|
|
8630
8630
|
|
|
8631
8631
|
${e.tab==="logs"?Jx({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,T)=>{e.logsLevelFilters={...e.logsLevelFilters,[b]:T}},onToggleAutoFollow:b=>e.logsAutoFollow=b,onRefresh:()=>Oo(e,{reset:!0}),onExport:(b,T)=>e.exportLogs(b,T),onScroll:b=>e.handleLogsScroll(b)}):h}
|
|
8632
8632
|
</main>
|
|
8633
8633
|
${jx(e)}
|
|
8634
8634
|
${Kx(e)}
|
|
8635
8635
|
</div>
|
|
8636
|
-
`}var Xw=Object.defineProperty,Zw=Object.getOwnPropertyDescriptor,$=(e,t,n,s)=>{for(var i=s>1?void 0:s?Zw(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&&Xw(t,n,i),i};const Xi=or({});function e1(){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
|
|
8636
|
+
`}var Xw=Object.defineProperty,Zw=Object.getOwnPropertyDescriptor,$=(e,t,n,s)=>{for(var i=s>1?void 0:s?Zw(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&&Xw(t,n,i),i};const Xi=or({});function e1(){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 lg(this),this.clientInstanceId=gi(),this.settings=Vp(),this.password="",this.tab="chat",this.onboarding=e1(),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.compactionStatus=null,this.fallbackStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.chatManualRefreshInFlight=!1,this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
|
|
8637
8637
|
}
|
|
8638
|
-
`,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={...Os},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={...Kg},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=()=>ah(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(),hm(this)}firstUpdated(){mm(this)}disconnectedCallback(){vm(this),super.disconnectedCallback()}updated(e){bm(this,e)}connect(){md(this)}handleChatScroll(e){Rg(this,e)}handleLogsScroll(e){Lg(this,e)}exportLogs(e,t){Dg(e,t)}resetToolStream(){ui(this)}resetChatScroll(){na(this)}scrollToBottom(e){na(this),ss(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await fd(this)}applySettings(e){At(this,e)}setTab(e){eh(this,e)}setTheme(e,t){th(this,e,t)}async loadOverview(){await Zc(this)}async loadCron(){await Ks(this)}async handleAbortChat(){await cd(this)}removeQueuedMessage(e){Kh(this,e)}async handleSendChat(e,t){await Wh(this,e,t)}async handleWhatsAppStart(e){await bg(this,e)}async handleWhatsAppWait(){await yg(this)}async handleWhatsAppLogout(){await $g(this)}async handleChannelConfigSave(){await xg(this)}async handleChannelConfigReload(){await wg(this)}handleNostrProfileEdit(e,t){Ag(this,e,t)}handleNostrProfileCancel(){Cg(this)}handleNostrProfileFieldChange(e,t){Tg(this,e,t)}async handleNostrProfileSave(){await _g(this)}async handleNostrProfileImport(){await Ig(this)}handleNostrProfileToggleAdvanced(){Eg(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 Yw(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);
|
|
8639
|
-
//# sourceMappingURL=index-
|
|
8638
|
+
`,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={...Os},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=()=>ah(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(),hm(this)}firstUpdated(){mm(this)}disconnectedCallback(){vm(this),super.disconnectedCallback()}updated(e){bm(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),ss(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await pd(this)}applySettings(e){At(this,e)}setTab(e){eh(this,e)}setTheme(e,t){th(this,e,t)}async loadOverview(){await ed(this)}async loadCron(){await Ks(this)}async handleAbortChat(){await dd(this)}removeQueuedMessage(e){Kh(this,e)}async handleSendChat(e,t){await Wh(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 Mg(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 Yw(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);
|
|
8639
|
+
//# sourceMappingURL=index-CBxamjSz.js.map
|