@poolzin/pool-bot 2026.3.25 → 2026.3.27
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/model-fallback.js +5 -4
- package/dist/agents/tools/common.js +16 -201
- package/dist/auto-reply/auto-reply/reply/agent-runner-execution.js +502 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-helpers.js +65 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-memory.js +160 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-payloads.js +85 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-utils.js +101 -0
- package/dist/auto-reply/auto-reply/reply/bash-command.js +338 -0
- package/dist/auto-reply/auto-reply/reply/block-streaming.js +91 -0
- package/dist/auto-reply/auto-reply/reply/commands-approve.js +88 -0
- package/dist/auto-reply/auto-reply/reply/commands-bash.js +26 -0
- package/dist/auto-reply/auto-reply/reply/commands-compact.js +107 -0
- package/dist/auto-reply/auto-reply/reply/commands-config.js +241 -0
- package/dist/auto-reply/auto-reply/reply/commands-context-report.js +295 -0
- package/dist/auto-reply/auto-reply/reply/commands-context.js +30 -0
- package/dist/auto-reply/auto-reply/reply/commands-core.js +151 -0
- package/dist/auto-reply/auto-reply/reply/commands-export-session.js +163 -0
- package/dist/auto-reply/auto-reply/reply/commands-info.js +184 -0
- package/dist/auto-reply/auto-reply/reply/commands-models.js +299 -0
- package/dist/auto-reply/auto-reply/reply/commands-plugin.js +35 -0
- package/dist/auto-reply/auto-reply/reply/commands-ptt.js +171 -0
- package/dist/auto-reply/auto-reply/reply/commands-setunset-standard.js +13 -0
- package/dist/auto-reply/auto-reply/reply/commands-setunset.js +73 -0
- package/dist/auto-reply/auto-reply/reply/commands-slash-parse.js +31 -0
- package/dist/auto-reply/auto-reply/reply/commands-status.js +178 -0
- package/dist/auto-reply/auto-reply/reply/commands-subagents.js +73 -0
- package/dist/auto-reply/auto-reply/reply/commands-system-prompt.js +117 -0
- package/dist/auto-reply/auto-reply/reply/commands-tts.js +231 -0
- package/dist/auto-reply/auto-reply/reply/directive-handling.impl.js +380 -0
- package/dist/auto-reply/auto-reply/reply/followup-runner.js +227 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-apply.js +201 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-utils.js +54 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives.js +332 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-inline-actions.js +258 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-run.js +297 -0
- package/dist/auto-reply/auto-reply/reply/groups.js +102 -0
- package/dist/auto-reply/auto-reply/reply/mentions.js +129 -0
- package/dist/auto-reply/auto-reply/reply/reply-delivery.js +92 -0
- package/dist/auto-reply/auto-reply/reply/reply-directives.js +30 -0
- package/dist/auto-reply/auto-reply/reply/reply-dispatcher.js +152 -0
- package/dist/auto-reply/auto-reply/reply/reply-elevated.js +166 -0
- package/dist/auto-reply/auto-reply/reply/reply-inline.js +28 -0
- package/dist/auto-reply/auto-reply/reply/reply-payloads.js +114 -0
- package/dist/auto-reply/auto-reply/reply/reply-reference.js +36 -0
- package/dist/auto-reply/auto-reply/reply/reply-tags.js +13 -0
- package/dist/auto-reply/auto-reply/reply/reply-threading.js +41 -0
- package/dist/auto-reply/auto-reply/reply/session-updates.js +233 -0
- package/dist/auto-reply/auto-reply/reply/stage-sandbox-media.js +146 -0
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +2 -17772
- package/dist/canvas-host/a2ui/index.html +1 -307
- package/dist/channels/channels/directory-config.js +185 -0
- package/dist/channels/channels/discord/handle-action.guild-admin.js +332 -0
- package/dist/channels/channels/discord/handle-action.js +165 -0
- package/dist/channels/channels/discord.js +413 -0
- package/dist/channels/channels/dock.js +436 -0
- package/dist/channels/channels/index.js +51 -0
- package/dist/channels/channels/plugins/outbound/discord.js +101 -0
- package/dist/channels/channels/whatsapp.js +17 -0
- package/dist/channels/plugins/types.js +1 -1
- package/dist/channels/run-state-machine.js +7 -0
- package/dist/commands/models/auth.js +47 -1
- package/dist/commands-subagents/action-agents.js +44 -0
- package/dist/commands-subagents/action-focus.js +64 -0
- package/dist/commands-subagents/action-help.js +4 -0
- package/dist/commands-subagents/action-info.js +45 -0
- package/dist/commands-subagents/action-kill.js +60 -0
- package/dist/commands-subagents/action-list.js +44 -0
- package/dist/commands-subagents/action-log.js +29 -0
- package/dist/commands-subagents/action-send.js +119 -0
- package/dist/commands-subagents/action-spawn.js +52 -0
- package/dist/commands-subagents/action-unfocus.js +30 -0
- package/dist/commands-subagents/shared.js +303 -0
- package/dist/config/config.js +1 -8
- package/dist/config/types.secrets.js +61 -0
- package/dist/control-ui/assets/{index-D7shnQwQ.js → index-umCsvrWy.js} +884 -741
- package/dist/control-ui/assets/index-umCsvrWy.js.map +1 -0
- package/dist/control-ui/assets/pt-BR-DedEVAvY.js +2 -0
- package/dist/control-ui/assets/pt-BR-DedEVAvY.js.map +1 -0
- package/dist/control-ui/assets/zh-CN-CDzeklK-.js +2 -0
- package/dist/control-ui/assets/zh-CN-CDzeklK-.js.map +1 -0
- package/dist/control-ui/assets/zh-TW-BJCRYNWH.js +2 -0
- package/dist/control-ui/assets/zh-TW-BJCRYNWH.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/gateway/method-scopes.js +9 -1
- package/dist/gateway/node-pending-work.js +142 -0
- package/dist/gateway/protocol/index.js +5 -1
- package/dist/gateway/protocol/schema/nodes.js +18 -0
- package/dist/gateway/server-methods/nodes-pending.js +96 -0
- package/dist/gateway/server-methods-list.js +4 -0
- package/dist/gateway/server-methods.js +2 -0
- package/dist/imessage/channel.js +253 -0
- package/dist/imessage/monitor/echo-cache.js +70 -0
- package/dist/imessage/monitor/loop-rate-limiter.js +51 -0
- package/dist/imessage/monitor/reflection-guard.js +50 -0
- package/dist/imessage/monitor/sanitize-outbound.js +25 -0
- package/dist/imessage/monitor/self-chat-cache.js +75 -0
- package/dist/imessage/runtime.js +3 -0
- package/dist/infra/exec-approval-reply.js +7 -0
- package/dist/infra/tmp-openclaw-dir.js +84 -0
- package/dist/pairing/pairing-challenge.js +15 -0
- package/dist/plugin-sdk/account-id.d.ts +1 -0
- package/dist/plugin-sdk/agent-media-payload.d.ts +12 -0
- package/dist/plugin-sdk/allow-from.d.ts +27 -0
- package/dist/plugin-sdk/command-auth.d.ts +25 -0
- package/dist/plugin-sdk/command-auth.js +3 -1
- package/dist/plugin-sdk/config-paths.d.ts +6 -0
- package/dist/plugin-sdk/file-lock.d.ts +16 -0
- package/dist/plugin-sdk/index.d.ts +428 -0
- package/dist/plugin-sdk/index.js +237 -103
- package/dist/plugin-sdk/json-store.d.ts +5 -0
- package/dist/plugin-sdk/keyed-async-queue.d.ts +12 -0
- package/dist/plugin-sdk/onboarding.d.ts +11 -0
- package/dist/plugin-sdk/provider-auth-result.d.ts +14 -0
- package/dist/plugin-sdk/slack-message-actions.d.ts +11 -0
- package/dist/plugin-sdk/status-helpers.d.ts +25 -0
- package/dist/plugin-sdk/temp-path.d.ts +12 -0
- package/dist/plugin-sdk/text-chunking.d.ts +1 -0
- package/dist/plugin-sdk/tool-send.d.ts +4 -0
- package/dist/plugin-sdk/webhook-path.d.ts +6 -0
- package/dist/plugin-sdk/webhook-targets.d.ts +23 -0
- package/dist/plugin-sdk/windows-spawn.d.ts +39 -0
- package/dist/plugin-sdk-internal/accounts.js +6 -0
- package/dist/plugin-sdk-internal/discord.js +23 -0
- package/dist/plugin-sdk-internal/imessage.js +13 -0
- package/dist/plugin-sdk-internal/setup.js +9 -0
- package/dist/plugin-sdk-internal/signal.js +13 -0
- package/dist/plugin-sdk-internal/slack.js +22 -0
- package/dist/plugin-sdk-internal/telegram.js +32 -0
- package/dist/plugin-sdk-internal/whatsapp.js +29 -0
- package/dist/routing/session-key.js +4 -185
- package/dist/shared/pid-alive.js +2 -61
- package/dist/shared/process-scoped-map.js +5 -7
- package/dist/signal/channel.js +264 -0
- package/dist/signal/monitor/access-policy.js +60 -0
- package/dist/signal/runtime.js +3 -0
- package/dist/slack/account-inspect.js +135 -0
- package/dist/slack/blocks-input.js +7 -38
- package/dist/slack/channel.js +394 -0
- package/dist/slack/interactive-replies.js +28 -0
- package/dist/slack/monitor/channel-type.js +31 -0
- package/dist/slack/monitor/dm-auth.js +49 -0
- package/dist/slack/monitor/events/interactions.modal.js +137 -0
- package/dist/slack/monitor/events/message-subtype-handlers.js +68 -0
- package/dist/slack/monitor/events/system-event-context.js +29 -0
- package/dist/slack/monitor/events/system-event-test-harness.js +41 -0
- package/dist/slack/monitor/external-arg-menu-store.js +46 -0
- package/dist/slack/monitor/message-handler/prepare-content.js +69 -0
- package/dist/slack/monitor/message-handler/prepare-thread-context.js +91 -0
- package/dist/slack/monitor/message-handler/prepare.test-helpers.js +55 -0
- package/dist/slack/monitor/reconnect-policy.js +78 -0
- package/dist/slack/monitor/slash-commands.runtime.js +1 -0
- package/dist/slack/monitor/slash-dispatch.runtime.js +9 -0
- package/dist/slack/monitor/slash-skill-commands.runtime.js +1 -0
- package/dist/slack/resolve-allowlist-common.js +36 -0
- package/dist/slack/runtime.js +3 -0
- package/dist/slack/sent-thread-cache.js +61 -0
- package/dist/slack/truncate.js +10 -0
- package/dist/telegram/account-inspect.js +175 -0
- package/dist/telegram/allow-from.js +10 -0
- package/dist/telegram/api-fetch.js +18 -0
- package/dist/telegram/approval-buttons.js +30 -0
- package/dist/telegram/audit-membership-runtime.js +61 -0
- package/dist/telegram/bot/delivery.replies.js +508 -0
- package/dist/telegram/bot/delivery.resolve-media.js +227 -0
- package/dist/telegram/bot/delivery.send.js +132 -0
- package/dist/telegram/bot/reply-threading.js +46 -0
- package/dist/telegram/bot-message-context.body.js +186 -0
- package/dist/telegram/bot-message-context.session.js +207 -0
- package/dist/telegram/bot-message-context.types.js +1 -0
- package/dist/telegram/bot-native-commands.test-helpers.js +117 -0
- package/dist/telegram/bot.media.e2e-harness.js +81 -0
- package/dist/telegram/bot.media.test-utils.js +81 -0
- package/dist/telegram/channel-actions.js +225 -0
- package/dist/telegram/channel.js +515 -0
- package/dist/telegram/conversation-route.js +107 -0
- package/dist/telegram/delivery.js +2 -0
- package/dist/telegram/delivery.replies.js +508 -0
- package/dist/telegram/dm-access.js +86 -0
- package/dist/telegram/draft-stream.test-helpers.js +62 -0
- package/dist/telegram/exec-approvals-handler.js +281 -0
- package/dist/telegram/exec-approvals.js +62 -0
- package/dist/telegram/forum-service-message.js +22 -0
- package/dist/telegram/group-config-helpers.js +10 -0
- package/dist/telegram/lane-delivery-state.js +19 -0
- package/dist/telegram/lane-delivery-text-deliverer.js +357 -0
- package/dist/telegram/lane-delivery.js +2 -0
- package/dist/telegram/normalize.js +37 -0
- package/dist/telegram/onboarding.js +192 -0
- package/dist/telegram/outbound-adapter.js +100 -0
- package/dist/telegram/polling-session.js +275 -0
- package/dist/telegram/runtime.js +3 -0
- package/dist/telegram/sendchataction-401-backoff.js +71 -0
- package/dist/telegram/sequential-key.js +46 -0
- package/dist/telegram/status-issues.js +105 -0
- package/dist/telegram/target-writeback.js +165 -0
- package/dist/telegram/thread-bindings.js +560 -0
- package/dist/utils.js +32 -257
- package/dist/wizard/prompts.js +5 -5
- package/extensions/feishu/src/policy.ts +1 -1
- package/extensions/firecrawl/index.test.ts +82 -0
- package/extensions/firecrawl/index.ts +20 -0
- package/extensions/firecrawl/openclaw.plugin.json +8 -0
- package/extensions/firecrawl/package.json +12 -0
- package/extensions/firecrawl/src/config.ts +159 -0
- package/extensions/firecrawl/src/firecrawl-client.ts +446 -0
- package/extensions/firecrawl/src/firecrawl-scrape-tool.ts +89 -0
- package/extensions/firecrawl/src/firecrawl-search-provider.ts +63 -0
- package/extensions/firecrawl/src/firecrawl-search-tool.ts +76 -0
- package/package.json +1 -1
- package/dist/.buildstamp +0 -1
- package/dist/acp/bindings-store.js +0 -209
- package/dist/acp/control-plane/runtime-cache.js +0 -54
- package/dist/acp/control-plane/runtime-options.js +0 -215
- package/dist/acp/control-plane/session-actor-queue.js +0 -36
- package/dist/acp/index.js +0 -2
- package/dist/acp/runtime/errors.js +0 -47
- package/dist/acp/runtime/registry.js +0 -86
- package/dist/acp/secret-file.js +0 -22
- package/dist/agents/auth-profiles.resolve-auth-profile-order.fixtures.js +0 -23
- package/dist/agents/bash-process-registry.test-helpers.js +0 -29
- package/dist/agents/bash-tools.exec-approval-request.js +0 -20
- package/dist/agents/bash-tools.exec-host-gateway.js +0 -240
- package/dist/agents/bash-tools.exec-host-node.js +0 -235
- package/dist/agents/checkpoint-manager.js +0 -290
- package/dist/agents/claude-cli-runner.js +0 -3
- package/dist/agents/error-classifier.js +0 -251
- package/dist/agents/live-model-filter.js +0 -84
- package/dist/agents/nvidia-models.js +0 -228
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.fixture.js +0 -34
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.mocks.shared.js +0 -156
- package/dist/agents/pi-embedded-subscribe.handlers.tools.media.test-helpers.js +0 -30
- package/dist/agents/provider/config-loader.js +0 -76
- package/dist/agents/provider/index.js +0 -15
- package/dist/agents/provider/models-dev.js +0 -129
- package/dist/agents/provider/session-binding.js +0 -376
- package/dist/agents/queued-file-writer.js +0 -22
- package/dist/agents/skills/bundled-context.js +0 -23
- package/dist/agents/skills/security.js +0 -211
- package/dist/agents/skills/tools-dir.js +0 -9
- package/dist/agents/skills-install-download.js +0 -290
- package/dist/agents/skills-install-output.js +0 -30
- package/dist/agents/skills-install.download-test-utils.js +0 -36
- package/dist/agents/skills.test-helpers.js +0 -13
- package/dist/agents/subagent-announce-reliability.js +0 -160
- package/dist/agents/subagent-registry.mocks.shared.js +0 -12
- package/dist/agents/test-helpers/assistant-message-fixtures.js +0 -29
- package/dist/agents/test-helpers/fast-coding-tools.js +0 -1
- package/dist/agents/test-helpers/fast-core-tools.js +0 -8
- package/dist/agents/test-helpers/fast-tool-stubs.js +0 -18
- package/dist/agents/test-helpers/host-sandbox-fs-bridge.js +0 -74
- package/dist/agents/test-helpers/pi-tools-sandbox-context.js +0 -27
- package/dist/agents/tool-display-common.js +0 -915
- package/dist/agents/tool-policy-shared.js +0 -108
- package/dist/agents/tool-policy.conformance.js +0 -14
- package/dist/agents/tool-result-truncation.js +0 -299
- package/dist/agents/tools/cron-tool.test-helpers.js +0 -12
- package/dist/agents/tools/discord-actions-moderation-shared.js +0 -27
- package/dist/agents/tools/discord-actions-presence.js +0 -78
- package/dist/control-ui/assets/index-D7shnQwQ.js.map +0 -1
- package/dist/discord/discord-improvements.js +0 -167
- package/dist/discord/index.js +0 -2
- package/dist/hooks/bundled/boot-md/HOOK.md +0 -19
- package/dist/hooks/bundled/command-logger/HOOK.md +0 -122
- package/dist/hooks/bundled/session-memory/HOOK.md +0 -86
- package/dist/hooks/bundled/soul-evil/HOOK.md +0 -71
- package/dist/whatsapp/normalize.js +0 -66
- package/dist/whatsapp/resolve-outbound-target.js +0 -42
- /package/dist/{acp/runtime/types.js → auto-reply/auto-reply/reply/commands-types.js} +0 -0
- /package/dist/{agents/pi-embedded-payloads.js → slack/account-surface-fields.js} +0 -0
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),zi=/'/g,ji=/"/g,Xa=/^(?:script|style|textarea|title)$/i,nl=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),c=nl(1),Se=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),qi=new WeakMap,Pe=Oe.createTreeWalker(Oe,129);function eo(e,t){if(!Ps(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ui!==void 0?Ui.createHTML(t):t}const sl=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=rt;for(let l=0;l<n;l++){const r=e[l];let p,d,u=-1,g=0;for(;g<r.length&&(o.lastIndex=g,d=o.exec(r),d!==null);)g=o.lastIndex,o===rt?d[1]==="!--"?o=Ki:d[1]!==void 0?o=Hi:d[2]!==void 0?(Xa.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=Me):d[3]!==void 0&&(o=Me):o===Me?d[0]===">"?(o=i??rt,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,p=d[1],o=d[3]===void 0?Me:d[3]==='"'?ji:zi):o===ji||o===zi?o=Me:o===Ki||o===Hi?o=rt:(o=Me,i=void 0);const v=o===Me&&e[l+1].startsWith("/>")?" ":"";a+=o===rt?r+el:u>=0?(s.push(p),r.slice(0,u)+Za+r.slice(u)+xe+v):r+xe+(u===-2?l:v)}return[eo(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let is=class to{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,r=this.parts,[p,d]=sl(t,n);if(this.el=to.createElement(p,s),Pe.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Pe.nextNode())!==null&&r.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(Za)){const g=d[o++],v=i.getAttribute(u).split(xe),w=/([.?@])?(.*)/.exec(g);r.push({type:1,index:a,name:w[2],strings:v,ctor:w[1]==="."?al:w[1]==="?"?ol:w[1]==="@"?rl:an}),i.removeAttribute(u)}else u.startsWith(xe)&&(r.push({type:6,index:a}),i.removeAttribute(u));if(Xa.test(i.tagName)){const u=i.textContent.split(xe),g=u.length-1;if(g>0){i.textContent=Yt?Yt.emptyScript:"";for(let v=0;v<g;v++)i.append(u[v],$t()),Pe.nextNode(),r.push({type:2,index:++a});i.append(u[g],$t())}}}else if(i.nodeType===8)if(i.data===Ja)r.push({type:2,index:a});else{let u=-1;for(;(u=i.data.indexOf(xe,u+1))!==-1;)r.push({type:7,index:a}),u+=xe.length-1}a++}}static createElement(t,n){const s=Oe.createElement("template");return s.innerHTML=t,s}};function Je(e,t,n=e,s){if(t===Se)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=xt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=Je(e,i._$AS(e,t.values),i,s)),t}class il{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??Oe).importNode(n,!0);Pe.currentNode=i;let a=Pe.nextNode(),o=0,l=0,r=s[0];for(;r!==void 0;){if(o===r.index){let p;r.type===2?p=new sn(a,a.nextSibling,this,t):r.type===1?p=new r.ctor(a,r.name,r.strings,this,t):r.type===6&&(p=new ll(a,this,t)),this._$AV.push(p),r=s[++l]}o!==r?.index&&(a=Pe.nextNode(),o++)}return Pe.currentNode=Oe,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 sn=class no{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=f,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=Je(this,t,n),xt(t)?t===f||t==null||t===""?(this._$AH!==f&&this._$AR(),this._$AH=f):t!==this._$AH&&t!==Se&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):tl(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!==f&&xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Oe.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=is.createElement(eo(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new il(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=qi.get(t.strings);return n===void 0&&qi.set(t.strings,n=new is(t)),n}k(t){Ps(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new no(this.O($t()),this.O($t()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=Fi(t).nextSibling;Fi(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class an{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=f,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=f}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=Je(this,t,n,0),o=!xt(t)||t!==this._$AH&&t!==Se,o&&(this._$AH=t);else{const l=t;let r,p;for(t=a[0],r=0;r<a.length-1;r++)p=Je(this,l[s+r],n,r),p===Se&&(p=this._$AH[r]),o||=!xt(p)||p!==this._$AH[r],p===f?t=f:t!==f&&(t+=(p??"")+a[r+1]),this._$AH[r]=p}o&&!i&&this.j(t)}j(t){t===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let al=class extends an{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===f?void 0:t}},ol=class extends an{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==f)}},rl=class extends an{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=Je(this,t,n,0)??f)===Se)return;const s=this._$AH,i=t===f&&s!==f||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==f&&(s===f||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ll=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){Je(this,t)}};const cl={I:sn},dl=Rs.litHtmlPolyfillSupport;dl?.(is,sn),(Rs.litHtmlVersions??=[]).push("3.3.2");const ul=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new sn(t.insertBefore($t(),a),a,void 0,n??{})}return i._$AI(e),i};const Ns=globalThis;let Ze=class extends Ye{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=ul(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Se}};Ze._$litElement$=!0,Ze.finalized=!0,Ns.litElementHydrateSupport?.({LitElement:Ze});const pl=Ns.litElementPolyfillSupport;pl?.({LitElement:Ze});(Ns.litElementVersions??=[]).push("4.2.2");const so=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const hl={attribute:!0,type:String,converter:Gt,reflect:!1,hasChanged:Is},fl=(e=hl,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(l){const r=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,r,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const r=this[o];t.call(this,l),this.requestUpdate(o,r,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function on(e){return(t,n)=>typeof n=="object"?fl(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function y(e){return on({...e,state:!0,attribute:!1})}const gl=50,vl=200,ml="Assistant";function Wi(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function as(e){const t=Wi(e?.name,gl)??ml,n=Wi(e?.avatar??void 0,vl)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function bl(){return as(typeof window>"u"?{}:{name:window.__CLAWDBOT_ASSISTANT_NAME__,avatar:window.__CLAWDBOT_ASSISTANT_AVATAR__})}const io="poolbot.control.settings.v1";function yl(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(io);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function wl(e){localStorage.setItem(io,JSON.stringify(e))}function ao(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const $l=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","cron"]},{label:"Agent",tabs:["skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],oo={overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},ro=new Map(Object.entries(oo).map(([e,t])=>[t,e]));function rn(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function kt(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 ln(e,t=""){const n=rn(t),s=oo[e];return n?`${n}${s}`:s}function lo(e,t=""){const n=rn(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=kt(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":ro.get(i)??null}function xl(e){let t=kt(e);if(t.endsWith("/index.html")&&(t=kt(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(ro.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function kl(e){switch(e){case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function os(e){switch(e){case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function Al(e){switch(e){case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.poolbot/poolbot.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const V={messageSquare:c`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:c`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:c`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:c`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:c`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:c`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:c`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:c`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:c`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:c`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,menu:c`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:c`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:c`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:c`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:c`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:c`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:c`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:c`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,wrench:c`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:c`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:c`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:c`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:c`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,eye:c`<svg viewBox="0 0 24 24"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`,eyeOff:c`<svg viewBox="0 0 24 24"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:c`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:c`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,shield:c`<svg viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="m9 12 2 2 4-4"/></svg>`,plug:c`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:c`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`},Sl=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Dt=/<\s*\/?\s*final\b[^<>]*>/gi,Vi=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Gi(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(r=>a>=r.start&&o<=r.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Yi(e,t){return t.some(n=>e>=n.start&&e<n.end)}function _l(e,t){return e.trimStart()}function Tl(e,t){if(!e||!Sl.test(e))return e;let n=e;if(Dt.test(n)){Dt.lastIndex=0;const l=[],r=Gi(n);for(const p of n.matchAll(Dt)){const d=p.index??0;l.push({start:d,length:p[0].length,inCode:Yi(d,r)})}for(let p=l.length-1;p>=0;p--){const d=l[p];d.inCode||(n=n.slice(0,d.start)+n.slice(d.start+d.length))}}else Dt.lastIndex=0;const s=Gi(n);Vi.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(Vi)){const r=l.index??0,p=l[1]==="/";Yi(r,s)||(o?p&&(o=!1):(i+=n.slice(a,r),p||(o=!0)),a=r+l[0].length)}return i+=n.slice(a),_l(i)}function At(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function D(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0)return"just now";const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const s=Math.round(n/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);return i<48?`${i}h ago`:`${Math.round(i/24)}d ago`}const cn=D;function co(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const s=Math.round(n/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function rs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function ls(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function uo(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 Qt(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Un(e){return Tl(e)}const Cl=/^\[([^\]]+)\]\s*/,El=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Kn=new WeakMap,Hn=new WeakMap;function Ml(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:El.some(t=>e.startsWith(`${t} `))}function zn(e){const t=e.match(Cl);if(!t)return e;const n=t[1]??"";return Ml(n)?e.slice(t[0].length):e}function cs(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?Un(s):zn(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
|
|
4
|
-
`);return n==="assistant"?
|
|
5
|
-
`);const i=
|
|
6
|
-
`):null}function
|
|
7
|
-
`)}return typeof t.text=="string"?t.text:null}function
|
|
8
|
-
`):""}let
|
|
9
|
-
|
|
10
|
-
Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await
|
|
11
|
-
`)}function
|
|
12
|
-
|
|
13
|
-
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const Qt=globalThis,Os=Qt.ShadowRoot&&(Qt.ShadyCSS===void 0||Qt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ds=Symbol(),Hi=new WeakMap;let so=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==Ds)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(Os&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Hi.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Hi.set(n,t))}return t}toString(){return this.cssText}};const Zr=e=>new so(typeof e=="string"?e:e+"",void 0,Ds),Xr=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,a)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[a+1],e[0]);return new so(n,e,Ds)},el=(e,t)=>{if(Os)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Qt.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},Ki=Os?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Zr(n)})(e):e;const{is:tl,defineProperty:nl,getOwnPropertyDescriptor:sl,getOwnPropertyNames:il,getOwnPropertySymbols:al,getPrototypeOf:ol}=Object,cn=globalThis,zi=cn.trustedTypes,rl=zi?zi.emptyScript:"",ll=cn.reactiveElementPolyfillSupport,kt=(e,t)=>e,Xt={toAttribute(e,t){switch(t){case Boolean:e=e?rl: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}},Us=(e,t)=>!tl(e,t),ji={attribute:!0,type:String,converter:Xt,reflect:!1,useDefault:!1,hasChanged:Us};Symbol.metadata??=Symbol("metadata"),cn.litPropertyMetadata??=new WeakMap;let Je=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=ji){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&&nl(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=sl(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const c=i?.call(this);a?.call(this,o),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ji}static _$Ei(){if(this.hasOwnProperty(kt("elementProperties")))return;const t=ol(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(kt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(kt("properties"))){const n=this.properties,s=[...il(n),...al(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(Ki(i))}else t!==void 0&&n.push(Ki(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 el(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,s){this._$AK(t,s)}_$ET(t,n){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const a=(s.converter?.toAttribute!==void 0?s.converter:Xt).toAttribute(n,s.type);this._$Em=t,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(t,n){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const a=s.getPropertyOptions(i),o=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Xt;this._$Em=i;const c=o.fromAttribute(n,a.type);this[i]=c??this._$Ej?.get(i)??c,this._$Em=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??Us)(a,n)||s.useDefault&&s.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,c=this[i];o!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,a,c)}}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){}};Je.elementStyles=[],Je.shadowRootOptions={mode:"open"},Je[kt("elementProperties")]=new Map,Je[kt("finalized")]=new Map,ll?.({ReactiveElement:Je}),(cn.reactiveElementVersions??=[]).push("2.1.2");const Bs=globalThis,qi=e=>e,en=Bs.trustedTypes,Wi=en?en.createPolicy("lit-html",{createHTML:e=>e}):void 0,io="$lit$",xe=`lit$${Math.random().toFixed(9).slice(2)}$`,ao="?"+xe,cl=`<${ao}>`,Ue=document,_t=()=>Ue.createComment(""),Tt=e=>e===null||typeof e!="object"&&typeof e!="function",Fs=Array.isArray,dl=e=>Fs(e)||typeof e?.[Symbol.iterator]=="function",jn=`[
|
|
2
|
+
\f\r]`,pt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gi=/-->/g,Vi=/>/g,Le=RegExp(`>|${jn}(?:([^\\s"'>=/]+)(${jn}*=${jn}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Yi=/'/g,Qi=/"/g,oo=/^(?:script|style|textarea|title)$/i,ul=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=ul(1),Te=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Ji=new WeakMap,Oe=Ue.createTreeWalker(Ue,129);function ro(e,t){if(!Fs(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wi!==void 0?Wi.createHTML(t):t}const pl=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=pt;for(let c=0;c<n;c++){const l=e[c];let p,d,u=-1,f=0;for(;f<l.length&&(o.lastIndex=f,d=o.exec(l),d!==null);)f=o.lastIndex,o===pt?d[1]==="!--"?o=Gi:d[1]!==void 0?o=Vi:d[2]!==void 0?(oo.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=Le):d[3]!==void 0&&(o=Le):o===Le?d[0]===">"?(o=i??pt,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,p=d[1],o=d[3]===void 0?Le:d[3]==='"'?Qi:Yi):o===Qi||o===Yi?o=Le:o===Gi||o===Vi?o=pt:(o=Le,i=void 0);const v=o===Le&&e[c+1].startsWith("/>")?" ":"";a+=o===pt?l+cl:u>=0?(s.push(p),l.slice(0,u)+io+l.slice(u)+xe+v):l+xe+(u===-2?c:v)}return[ro(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let ds=class lo{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const c=t.length-1,l=this.parts,[p,d]=pl(t,n);if(this.el=lo.createElement(p,s),Oe.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Oe.nextNode())!==null&&l.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(io)){const f=d[o++],v=i.getAttribute(u).split(xe),m=/([.?@])?(.*)/.exec(f);l.push({type:1,index:a,name:m[2],strings:v,ctor:m[1]==="."?fl:m[1]==="?"?gl:m[1]==="@"?vl:un}),i.removeAttribute(u)}else u.startsWith(xe)&&(l.push({type:6,index:a}),i.removeAttribute(u));if(oo.test(i.tagName)){const u=i.textContent.split(xe),f=u.length-1;if(f>0){i.textContent=en?en.emptyScript:"";for(let v=0;v<f;v++)i.append(u[v],_t()),Oe.nextNode(),l.push({type:2,index:++a});i.append(u[f],_t())}}}else if(i.nodeType===8)if(i.data===ao)l.push({type:2,index:a});else{let u=-1;for(;(u=i.data.indexOf(xe,u+1))!==-1;)l.push({type:7,index:a}),u+=xe.length-1}a++}}static createElement(t,n){const s=Ue.createElement("template");return s.innerHTML=t,s}};function nt(e,t,n=e,s){if(t===Te)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Tt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=nt(e,i._$AS(e,t.values),i,s)),t}class hl{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??Ue).importNode(n,!0);Oe.currentNode=i;let a=Oe.nextNode(),o=0,c=0,l=s[0];for(;l!==void 0;){if(o===l.index){let p;l.type===2?p=new dn(a,a.nextSibling,this,t):l.type===1?p=new l.ctor(a,l.name,l.strings,this,t):l.type===6&&(p=new ml(a,this,t)),this._$AV.push(p),l=s[++c]}o!==l?.index&&(a=Oe.nextNode(),o++)}return Oe.currentNode=Ue,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 dn=class co{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=g,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=nt(this,t,n),Tt(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==Te&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):dl(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!==g&&Tt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ue.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=ds.createElement(ro(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new hl(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Ji.get(t.strings);return n===void 0&&Ji.set(t.strings,n=new ds(t)),n}k(t){Fs(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new co(this.O(_t()),this.O(_t()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=qi(t).nextSibling;qi(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class un{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=g}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=nt(this,t,n,0),o=!Tt(t)||t!==this._$AH&&t!==Te,o&&(this._$AH=t);else{const c=t;let l,p;for(t=a[0],l=0;l<a.length-1;l++)p=nt(this,c[s+l],n,l),p===Te&&(p=this._$AH[l]),o||=!Tt(p)||p!==this._$AH[l],p===g?t=g:t!==g&&(t+=(p??"")+a[l+1]),this._$AH[l]=p}o&&!i&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let fl=class extends un{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},gl=class extends un{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},vl=class extends un{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=nt(this,t,n,0)??g)===Te)return;const s=this._$AH,i=t===g&&s!==g||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==g&&(s===g||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ml=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){nt(this,t)}};const bl={I:dn},yl=Bs.litHtmlPolyfillSupport;yl?.(ds,dn),(Bs.litHtmlVersions??=[]).push("3.3.2");const wl=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new dn(t.insertBefore(_t(),a),a,void 0,n??{})}return i._$AI(e),i};const Hs=globalThis;let tt=class extends Je{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=wl(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Te}};tt._$litElement$=!0,tt.finalized=!0,Hs.litElementHydrateSupport?.({LitElement:tt});const $l=Hs.litElementPolyfillSupport;$l?.({LitElement:tt});(Hs.litElementVersions??=[]).push("4.2.2");const uo=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const Al={attribute:!0,type:String,converter:Xt,reflect:!1,hasChanged:Us},kl=(e=Al,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(c){const l=t.get.call(this);t.set.call(this,c),this.requestUpdate(o,l,e,!0,c)},init(c){return c!==void 0&&this.C(o,void 0,e,c),c}}}if(s==="setter"){const{name:o}=n;return function(c){const l=this[o];t.call(this,c),this.requestUpdate(o,l,e,!0,c)}}throw Error("Unsupported decorator location: "+s)};function pn(e){return(t,n)=>typeof n=="object"?kl(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function w(e){return pn({...e,state:!0,attribute:!1})}const xl=50,Sl=200,_l="Assistant";function Zi(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function us(e){const t=Zi(e?.name,xl)??_l,n=Zi(e?.avatar??void 0,Sl)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function Tl(){return us(typeof window>"u"?{}:{name:window.__CLAWDBOT_ASSISTANT_NAME__,avatar:window.__CLAWDBOT_ASSISTANT_AVATAR__})}const po="poolbot.control.settings.v1";function El(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(po);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function Cl(e){localStorage.setItem(po,JSON.stringify(e))}function ho(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const Il=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","cron"]},{label:"Agent",tabs:["skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],fo={overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},go=new Map(Object.entries(fo).map(([e,t])=>[t,e]));function hn(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Et(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 fn(e,t=""){const n=hn(t),s=fo[e];return n?`${n}${s}`:s}function vo(e,t=""){const n=hn(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=Et(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":go.get(i)??null}function Rl(e){let t=Et(e);if(t.endsWith("/index.html")&&(t=Et(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(go.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function Ll(e){switch(e){case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function ps(e){switch(e){case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function Ml(e){switch(e){case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.poolbot/poolbot.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const D={messageSquare:r`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:r`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:r`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:r`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:r`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:r`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:r`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:r`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:r`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:r`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,menu:r`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:r`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:r`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:r`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:r`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:r`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:r`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:r`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,wrench:r`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:r`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:r`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:r`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:r`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,eye:r`<svg viewBox="0 0 24 24"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`,eyeOff:r`<svg viewBox="0 0 24 24"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:r`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:r`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,shield:r`<svg viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="m9 12 2 2 4-4"/></svg>`,plug:r`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:r`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`},Pl=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Kt=/<\s*\/?\s*final\b[^<>]*>/gi,Xi=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function ea(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(l=>a>=l.start&&o<=l.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function ta(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Nl(e,t){return e.trimStart()}function Ol(e,t){if(!e||!Pl.test(e))return e;let n=e;if(Kt.test(n)){Kt.lastIndex=0;const c=[],l=ea(n);for(const p of n.matchAll(Kt)){const d=p.index??0;c.push({start:d,length:p[0].length,inCode:ta(d,l)})}for(let p=c.length-1;p>=0;p--){const d=c[p];d.inCode||(n=n.slice(0,d.start)+n.slice(d.start+d.length))}}else Kt.lastIndex=0;const s=ea(n);Xi.lastIndex=0;let i="",a=0,o=!1;for(const c of n.matchAll(Xi)){const l=c.index??0,p=c[1]==="/";ta(l,s)||(o?p&&(o=!1):(i+=n.slice(a,l),p||(o=!0)),a=l+c[0].length)}return i+=n.slice(a),Nl(i)}function Ct(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function B(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0)return"just now";const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const s=Math.round(n/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);return i<48?`${i}h ago`:`${Math.round(i/24)}d ago`}const rt=B;function Dl(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const s=Math.round(n/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function Ul(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60),i=Math.floor(s/24),a=[];return i>0&&a.push(`${i}d`),s%24>0&&a.push(`${s%24}h`),n%60>0&&a.push(`${n%60}m`),t%60>0&&a.length===0&&a.push(`${t%60}s`),a.join(" ")||"0s"}function hs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function fs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function mo(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 tn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function qn(e){return Ol(e)}function Bl(e,t=2){return Number.isFinite(e)?`$${e.toFixed(t)}`:"$0.00"}function Fl(e){return Number.isFinite(e)?e.toLocaleString():"0"}const Hl=/^\[([^\]]+)\]\s*/,Kl=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Wn=new WeakMap,Gn=new WeakMap;function zl(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:Kl.some(t=>e.startsWith(`${t} `))}function Vn(e){const t=e.match(Hl);if(!t)return e;const n=t[1]??"";return zl(n)?e.slice(t[0].length):e}function gs(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?qn(s):Vn(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
|
|
4
|
+
`);return n==="assistant"?qn(a):Vn(a)}}return typeof t.text=="string"?n==="assistant"?qn(t.text):Vn(t.text):null}function bo(e){if(!e||typeof e!="object")return gs(e);const t=e;if(Wn.has(t))return Wn.get(t)??null;const n=gs(e);return Wn.set(t,n),n}function na(e){const n=e.content,s=[];if(Array.isArray(n))for(const c of n){const l=c;if(l.type==="thinking"&&typeof l.thinking=="string"){const p=l.thinking.trim();p&&s.push(p)}}if(s.length>0)return s.join(`
|
|
5
|
+
`);const i=ql(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(c=>(c[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
|
|
6
|
+
`):null}function jl(e){if(!e||typeof e!="object")return na(e);const t=e;if(Gn.has(t))return Gn.get(t)??null;const n=na(e);return Gn.set(t,n),n}function ql(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
|
|
7
|
+
`)}return typeof t.text=="string"?t.text:null}function Wl(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(`
|
|
8
|
+
`):""}let sa=!1;function ia(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 Gl(){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 Vl(){sa||(sa=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Ks(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),ia(t)}return Vl(),ia(Gl())}async function st(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Yl(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Ql(e,t,n){if(!e.client||!e.connected)return!1;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return!1;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const p of n)o.push({type:"image",source:{type:"base64",media_type:p.mimeType,data:p.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const c=Ks();e.chatRunId=c,e.chatStream="",e.chatStreamStartedAt=a;const l=i?n.map(p=>{const d=Yl(p.dataUrl);return d?{type:"image",mimeType:d.mimeType,content:d.content}:null}).filter(p=>p!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:c,attachments:l}),!0}catch(p){const d=String(p);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=d,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+d}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function Jl(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 Zl(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=gs(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}async function lt(e){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const t={includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown},n=tn(e.sessionsFilterActive,0),s=tn(e.sessionsFilterLimit,0);n>0&&(t.activeMinutes=n),s>0&&(t.limit=s);const i=await e.client.request("sessions.list",t);i&&(e.sessionsResult=i)}catch(t){e.sessionsError=String(t)}finally{e.sessionsLoading=!1}}}async function Xl(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 lt(e)}catch(i){e.sessionsError=String(i)}}async function ec(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
9
|
+
|
|
10
|
+
Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await lt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}const aa=50,tc=80,nc=12e4;function sc(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
11
|
+
`)}function oa(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=sc(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=mo(n,nc);return s.truncated?`${s.text}
|
|
12
|
+
|
|
13
|
+
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function ic(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 ac(e){if(e.toolStreamOrder.length<=aa)return;const t=e.toolStreamOrder.length-aa,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function oc(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function vs(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),oc(e)}function rc(e,t=!1){if(t){vs(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>vs(e),tc))}function gn(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],vs(e)}const lc=5e3;function cc(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},lc))}function dc(e,t){if(!t)return;if(t.stream==="compaction"){cc(e,t);return}if(t.stream!=="tool")return;const n=typeof t.sessionKey=="string"?t.sessionKey:void 0;if(n&&n!==e.sessionKey||!n&&e.chatRunId&&t.runId!==e.chatRunId||e.chatRunId&&t.runId!==e.chatRunId||!e.chatRunId)return;const s=t.data??{},i=typeof s.toolCallId=="string"?s.toolCallId:"";if(!i)return;const a=typeof s.name=="string"?s.name:"tool",o=typeof s.phase=="string"?s.phase:"",c=o==="start"?s.args:void 0,l=o==="update"?oa(s.partialResult):o==="result"?oa(s.result):void 0,p=Date.now();let d=e.toolStreamById.get(i);d?(d.name=a,c!==void 0&&(d.args=c),l!==void 0&&(d.output=l),d.updatedAt=p):(d={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:c,output:l,startedAt:typeof t.ts=="number"?t.ts:p,updatedAt:p,message:{}},e.toolStreamById.set(i,d),e.toolStreamOrder.push(i)),d.message=ic(d),ac(e),rc(e,o==="result")}function vn(e,t=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const n=()=>{const s=e.querySelector(".chat-thread");if(s){const i=getComputedStyle(s).overflowY;if(i==="auto"||i==="scroll"||s.scrollHeight-s.clientHeight>1)return s}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const s=n();if(!s)return;const i=s.scrollHeight-s.scrollTop-s.clientHeight;if(!(t||e.chatUserNearBottom||i<200))return;t&&(e.chatHasAutoScrolled=!0),s.scrollTop=s.scrollHeight,e.chatUserNearBottom=!0;const o=t?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const c=n();if(!c)return;const l=c.scrollHeight-c.scrollTop-c.clientHeight;(t||e.chatUserNearBottom||l<200)&&(c.scrollTop=c.scrollHeight,e.chatUserNearBottom=!0)},o)})})}function yo(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 uc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<200}function pc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function hc(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0}function fc(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
14
14
|
`)}
|
|
15
|
-
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`poolbot-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function
|
|
16
|
-
`}function fo(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],l=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof l=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const r=s;r[o]==null&&(r[o]=typeof l=="number"?[]:{}),s=r[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function go(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function be(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});ic(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function vo(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});sc(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function sc(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function ic(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?et(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=et(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=De(t.config??{}),e.configFormOriginal=De(t.config??{}),e.configRawOriginal=n)}async function us(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?et(e.configForm):e.configRaw,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 be(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function ac(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?et(e.configForm):e.configRaw,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 be(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function oc(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 Bt(e,t,n){const s=De(e.configForm??e.configSnapshot?.config??{});fo(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=et(s))}function ta(e,t){const n=De(e.configForm??e.configSnapshot?.config??{});go(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=et(n))}async function Tt(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 pn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function rc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=Qt(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function lc(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=Qt(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function cc(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=rc(e.cronForm),n=lc(e.cronForm),s=e.cronForm.agentId.trim(),i={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!i.name)throw new Error("Name required.");await e.client.request("cron.add",i),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await pn(e),await Tt(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function dc(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 pn(e),await Tt(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function uc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await mo(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function pc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await pn(e),await Tt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function mo(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function oe(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 hc(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 fc(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 gc(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}}}async function hn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function vc(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 mc=2e3,bc=new Set(["trace","debug","info","warn","error","fatal"]);function yc(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function wc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return bc.has(t)?t:null}function $c(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=wc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=yc(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let r=null;return typeof t[1]=="string"?r=t[1]:!o&&typeof t[0]=="string"?r=t[0]:typeof t.message=="string"&&(r=t.message),{raw:e,time:s,level:i,subsystem:l,message:r??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ds(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map($c),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-mc),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)}}}const bo={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:W,n:Wt,Gx:na,Gy:sa,a:jn,d:qn,h:xc}=bo,Be=32,Bs=64,kc=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},H=(e="")=>{const t=new Error(e);throw kc(t,H),t},Ac=e=>typeof e=="bigint",Sc=e=>typeof e=="string",_c=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",_e=(e,t,n="")=>{const s=_c(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",r=s?`length=${i}`:`type=${typeof e}`;H(o+"expected Uint8Array"+l+", got "+r)}return e},fn=e=>new Uint8Array(e),yo=e=>Uint8Array.from(e),wo=(e,t)=>e.toString(16).padStart(t,"0"),$o=e=>Array.from(_e(e)).map(t=>wo(t,2)).join(""),ve={_0:48,_9:57,A:65,F:70,a:97,f:102},ia=e=>{if(e>=ve._0&&e<=ve._9)return e-ve._0;if(e>=ve.A&&e<=ve.F)return e-(ve.A-10);if(e>=ve.a&&e<=ve.f)return e-(ve.a-10)},xo=e=>{const t="hex invalid";if(!Sc(e))return H(t);const n=e.length,s=n/2;if(n%2)return H(t);const i=fn(s);for(let a=0,o=0;a<s;a++,o+=2){const l=ia(e.charCodeAt(o)),r=ia(e.charCodeAt(o+1));if(l===void 0||r===void 0)return H(t);i[a]=l*16+r}return i},ko=()=>globalThis?.crypto,Tc=()=>ko()?.subtle??H("crypto.subtle must be defined, consider polyfill"),St=(...e)=>{const t=fn(e.reduce((s,i)=>s+_e(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},Cc=(e=Be)=>ko().getRandomValues(fn(e)),Zt=BigInt,Re=(e,t,n,s="bad number: out of range")=>Ac(e)&&t<=e&&e<n?e:H(s),A=(e,t=W)=>{const n=e%t;return n>=0n?n:t+n},Ao=e=>A(e,Wt),Ec=(e,t)=>{(e===0n||t<=0n)&&H("no inverse n="+e+" mod="+t);let n=A(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,r=i-a*o;s=n,n=l,i=a,a=r}return s===1n?A(i,t):H("no inverse")},Mc=e=>{const t=Co[e];return typeof t!="function"&&H("hashes."+e+" not set"),t},Wn=e=>e instanceof ee?e:H("Point expected"),ps=2n**256n;class ee{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=ps;this.X=Re(t,0n,a),this.Y=Re(n,0n,a),this.Z=Re(s,1n,a),this.T=Re(i,0n,a),Object.freeze(this)}static CURVE(){return bo}static fromAffine(t){return new ee(t.x,t.y,1n,A(t.x*t.y))}static fromBytes(t,n=!1){const s=qn,i=yo(_e(t,Be)),a=t[31];i[31]=a&-129;const o=_o(i);Re(o,0n,n?ps:W);const r=A(o*o),p=A(r-1n),d=A(s*r+1n);let{isValid:u,value:g}=Ic(p,d);u||H("bad point: y not sqrt");const v=(g&1n)===1n,w=(a&128)!==0;return!n&&g===0n&&w&&H("bad point: x==0, isLastByteOdd"),w!==v&&(g=A(-g)),new ee(g,o,1n,A(g*o))}static fromHex(t,n){return ee.fromBytes(xo(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=jn,n=qn,s=this;if(s.is0())return H("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,r=A(i*i),p=A(a*a),d=A(o*o),u=A(d*d),g=A(r*t),v=A(d*A(g+p)),w=A(u+A(n*A(r*p)));if(v!==w)return H("bad point: equation left != right (1)");const $=A(i*a),k=A(o*l);return $!==k?H("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=Wn(t),r=A(n*l),p=A(a*i),d=A(s*l),u=A(o*i);return r===p&&d===u}is0(){return this.equals(Qe)}negate(){return new ee(A(-this.X),this.Y,this.Z,A(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=jn,a=A(t*t),o=A(n*n),l=A(2n*A(s*s)),r=A(i*a),p=t+n,d=A(A(p*p)-a-o),u=r+o,g=u-l,v=r-o,w=A(d*g),$=A(u*v),k=A(d*v),_=A(g*u);return new ee(w,$,_,k)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:r,T:p}=Wn(t),d=jn,u=qn,g=A(n*o),v=A(s*l),w=A(a*u*p),$=A(i*r),k=A((n+s)*(o+l)-g-v),_=A($-w),L=A($+w),P=A(v-d*g),M=A(k*_),C=A(L*P),E=A(k*P),pe=A(_*L);return new ee(M,C,pe,E)}subtract(t){return this.add(Wn(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Qe;if(Re(t,1n,Wt),t===1n)return this;if(this.equals(Fe))return zc(t).p;let s=Qe,i=Fe;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(Qe))return{x:0n,y:1n};const i=Ec(s,W);A(s*i)!==1n&&H("invalid inverse");const a=A(t*i),o=A(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=So(n);return s[31]|=t&1n?128:0,s}toHex(){return $o(this.toBytes())}clearCofactor(){return this.multiply(Zt(xc),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Wt/2n,!1).double();return Wt%2n&&(t=t.add(this)),t.is0()}}const Fe=new ee(na,sa,1n,A(na*sa)),Qe=new ee(0n,1n,1n,0n);ee.BASE=Fe;ee.ZERO=Qe;const So=e=>xo(wo(Re(e,0n,ps),Bs)).reverse(),_o=e=>Zt("0x"+$o(yo(_e(e)).reverse())),ce=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=W;return n},Lc=e=>{const n=e*e%W*e%W,s=ce(n,2n)*n%W,i=ce(s,1n)*e%W,a=ce(i,5n)*i%W,o=ce(a,10n)*a%W,l=ce(o,20n)*o%W,r=ce(l,40n)*l%W,p=ce(r,80n)*r%W,d=ce(p,80n)*r%W,u=ce(d,10n)*a%W;return{pow_p_5_8:ce(u,2n)*e%W,b2:n}},aa=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Ic=(e,t)=>{const n=A(t*t*t),s=A(n*n*t),i=Lc(e*s).pow_p_5_8;let a=A(e*n*i);const o=A(t*a*a),l=a,r=A(a*aa),p=o===e,d=o===A(-e),u=o===A(-e*aa);return p&&(a=l),(d||u)&&(a=r),(A(a)&1n)===1n&&(a=A(-a)),{isValid:p||d,value:a}},hs=e=>Ao(_o(e)),Fs=(...e)=>Co.sha512Async(St(...e)),Rc=(...e)=>Mc("sha512")(St(...e)),To=e=>{const t=e.slice(0,Be);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Be,Bs),s=hs(t),i=Fe.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Us=e=>Fs(_e(e,Be)).then(To),Pc=e=>To(Rc(_e(e,Be))),Nc=e=>Us(e).then(t=>t.pointBytes),Oc=e=>Fs(e.hashable).then(e.finish),Dc=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=hs(t),o=Fe.multiply(a).toBytes();return{hashable:St(o,s,n),finish:p=>{const d=Ao(a+hs(p)*i);return _e(St(o,So(d)),Bs)}}},Bc=async(e,t)=>{const n=_e(e),s=await Us(t),i=await Fs(s.prefix,n);return Oc(Dc(s,i,n))},Co={sha512Async:async e=>{const t=Tc(),n=St(e);return fn(await t.digest("SHA-512",n.buffer))},sha512:void 0},Fc=(e=Cc(Be))=>e,Uc={getExtendedPublicKeyAsync:Us,getExtendedPublicKey:Pc,randomSecretKey:Fc},Jt=8,Kc=256,Eo=Math.ceil(Kc/Jt)+1,fs=2**(Jt-1),Hc=()=>{const e=[];let t=Fe,n=t;for(let s=0;s<Eo;s++){n=t,e.push(n);for(let i=1;i<fs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let oa;const ra=(e,t)=>{const n=t.negate();return e?n:t},zc=e=>{const t=oa||(oa=Hc());let n=Qe,s=Fe;const i=2**Jt,a=i,o=Zt(i-1),l=Zt(Jt);for(let r=0;r<Eo;r++){let p=Number(e&o);e>>=l,p>fs&&(p-=a,e+=1n);const d=r*fs,u=d,g=d+Math.abs(p)-1,v=r%2!==0,w=p<0;p===0?s=s.add(ra(v,t[u])):n=n.add(ra(w,t[g]))}return e!==0n&&H("invalid wnaf"),{p:n,f:s}},Vn="poolbot-device-identity-v1";function gs(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Mo(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function jc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Lo(e){const t=await crypto.subtle.digest("SHA-256",e);return jc(new Uint8Array(t))}async function qc(){const e=Uc.randomSecretKey(),t=await Nc(e);return{deviceId:await Lo(t),publicKey:gs(t),privateKey:gs(e)}}async function Ks(){try{const n=localStorage.getItem(Vn);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 Lo(Mo(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Vn,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await qc(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Vn,JSON.stringify(t)),e}async function Wc(e,t){const n=Mo(e),s=new TextEncoder().encode(t),i=await Bc(s,n);return gs(i)}const Io="poolbot.device.auth.v1";function Hs(e){return e.trim()}function Vc(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].sort()}function zs(){try{const e=window.localStorage.getItem(Io);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 Ro(e){try{window.localStorage.setItem(Io,JSON.stringify(e))}catch{}}function Gc(e){const t=zs();if(!t||t.deviceId!==e.deviceId)return null;const n=Hs(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Po(e){const t=Hs(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=zs();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:Vc(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,Ro(n),i}function No(e){const t=zs();if(!t||t.deviceId!==e.deviceId)return;const n=Hs(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],Ro(s)}async function Te(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 Yc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Te(e)}catch(n){e.devicesError=String(n)}}async function Qc(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 Te(e)}catch(s){e.devicesError=String(s)}}async function Zc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Ks(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Po({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 Te(e)}catch(n){e.devicesError=String(n)}}async function Jc(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 Ks();t.deviceId===s.deviceId&&No({deviceId:s.deviceId,role:t.role}),await Te(e)}catch(s){e.devicesError=String(s)}}async function gn(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function Xc(e){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 ed(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 js(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Xc(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);td(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function td(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=De(t.file??{}))}async function nd(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=ed(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 js(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function sd(e,t,n){const s=De(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});fo(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function id(e,t){const n=De(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});go(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function qs(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}}}function tt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function vn(e){return e instanceof Error?e.message:String(e)}async function Ct(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=vn(n)}finally{e.skillsLoading=!1}}}function ad(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function od(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 Ct(e),tt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=vn(s);e.skillsError=i,tt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function rd(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 Ct(e),tt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=vn(n);e.skillsError=s,tt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function ld(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 Ct(e),tt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=vn(i);e.skillsError=a,tt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}function cd(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ws(e){return e==="system"?cd():e}const Ft=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,dd=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Ut=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ud=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,l=dd();if(!!o.startViewTransition&&!l){let p=.5,d=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")p=Ft(n.pointerClientX/window.innerWidth),d=Ft(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(p=Ft((u.left+u.width/2)/window.innerWidth),d=Ft((u.top+u.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${p*100}%`),a.style.setProperty("--theme-switch-y",`${d*100}%`),a.classList.add("theme-transition");try{const u=o.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>Ut(a)):Ut(a)}catch{Ut(a),t()}return}t(),Ut(a)};function pd(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{gn(e,{quiet:!0})},5e3))}function hd(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Vs(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ds(e,{quiet:!0})},2e3))}function Gs(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Ys(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&hn(e)},3e3))}function Qs(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function ke(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,wl(n),t.theme!==e.theme&&(e.theme=t.theme,mn(e,Ws(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Oo(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&ke(e,{...e.settings,lastActiveSessionKey:n})}function fd(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),a=t.get("gatewayUrl");let o=!1;if(n!=null){const r=n.trim();r&&r!==e.settings.token&&ke(e,{...e.settings,token:r}),t.delete("token"),o=!0}if(s!=null){const r=s.trim();r&&(e.password=r),t.delete("password"),o=!0}if(i!=null){const r=i.trim();r&&(e.sessionKey=r,ke(e,{...e.settings,sessionKey:r,lastActiveSessionKey:r}))}if(a!=null){const r=a.trim();r&&r!==e.settings.gatewayUrl&&ke(e,{...e.settings,gatewayUrl:r}),t.delete("gatewayUrl"),o=!0}if(!o)return;const l=new URL(window.location.href);l.search=t.toString(),window.history.replaceState({},"",l.toString())}function gd(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Vs(e):Gs(e),t==="debug"?Ys(e):Qs(e),Zs(e),Bo(e,t,!1)}function vd(e,t,n){ud({nextTheme:t,applyTheme:()=>{e.theme=t,ke(e,{...e.settings,theme:t}),mn(e,Ws(t))},context:n,currentTheme:e.theme})}async function Zs(e){e.tab==="overview"&&await Fo(e),e.tab==="channels"&&await Ad(e),e.tab==="instances"&&await qs(e),e.tab==="sessions"&&await st(e),e.tab==="cron"&&await Js(e),e.tab==="skills"&&await Ct(e),e.tab==="nodes"&&(await gn(e),await Te(e),await be(e),await js(e)),e.tab==="chat"&&(await Ed(e),un(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await vo(e),await be(e)),e.tab==="debug"&&(await hn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Ds(e,{reset:!0}),ho(e,!0))}function md(){if(typeof window>"u")return"";const e=window.__CLAWDBOT_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?rn(e):xl(window.location.pathname)}function bd(e){e.theme=e.settings.theme??"system",mn(e,Ws(e.theme))}function mn(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function yd(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"&&mn(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function wd(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 $d(e,t){if(typeof window>"u")return;const n=lo(window.location.pathname,e.basePath)??"chat";Do(e,n),Bo(e,n,t)}function xd(e){if(typeof window>"u")return;const t=lo(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,ke(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Do(e,t)}function Do(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Vs(e):Gs(e),t==="debug"?Ys(e):Qs(e),e.connected&&Zs(e)}function Bo(e,t,n){if(typeof window>"u")return;const s=kt(ln(t,e.basePath)),i=kt(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function kd(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 Fo(e){await Promise.all([oe(e,!1),qs(e),st(e),Tt(e),hn(e)])}async function Ad(e){await Promise.all([oe(e,!0),vo(e),be(e)])}async function Js(e){await Promise.all([oe(e,!1),Tt(e),pn(e)])}function Uo(e){return e.chatSending||!!e.chatRunId}function Sd(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"}async function Ko(e){e.connected&&(e.chatMessage="",await Bl(e))}function _d(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Os(),text:s,createdAt:Date.now(),attachments:i?n?.map(a=>({...a})):void 0}])}async function Ho(e,t,n){dn(e);const s=await Dl(e,t,n?.attachments);return!s&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!s&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),s&&Oo(e,e.sessionKey),s&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),s&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),un(e),s&&!e.chatRunId&&zo(e),s}async function zo(e){if(!e.connected||Uo(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Ho(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Td(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Cd(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!(!i&&!l)){if(Sd(i)){await Ko(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Uo(e)){_d(e,i,o);return}await Ho(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft)})}}async function Ed(e){await Promise.all([Xe(e),st(e),vs(e)]),un(e,!0)}const Md=zo;function Ld(e){const t=ao(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Id(e,t){const n=rn(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function vs(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Ld(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Id(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const jo={CHILD:2},qo=e=>(...t)=>({_$litDirective$:e,values:t});let Wo=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:Rd}=cl,la=e=>e,ca=()=>document.createComment(""),lt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(ca(),i),o=s.insertBefore(ca(),i);n=new Rd(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let r;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(r=e._$AU)!==o._$AU&&n._$AP(r)}if(a!==i||l){let r=n._$AA;for(;r!==a;){const p=la(r).nextSibling;la(s).insertBefore(r,i),r=p}}}return n},Le=(e,t,n=e)=>(e._$AI(t,n),e),Pd={},Nd=(e,t=Pd)=>e._$AH=t,Od=e=>e._$AH,Gn=e=>{e._$AR(),e._$AA.remove()};const da=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Vo=qo(class extends Wo{constructor(e){if(super(e),e.type!==jo.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const l of e)i[o]=s?s(l,o):o,a[o]=n(l,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Od(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],r=[];let p,d,u=0,g=i.length-1,v=0,w=a.length-1;for(;u<=g&&v<=w;)if(i[u]===null)u++;else if(i[g]===null)g--;else if(l[u]===o[v])r[v]=Le(i[u],a[v]),u++,v++;else if(l[g]===o[w])r[w]=Le(i[g],a[w]),g--,w--;else if(l[u]===o[w])r[w]=Le(i[u],a[w]),lt(e,r[w+1],i[u]),u++,w--;else if(l[g]===o[v])r[v]=Le(i[g],a[v]),lt(e,i[u],i[g]),g--,v++;else if(p===void 0&&(p=da(o,v,w),d=da(l,u,g)),p.has(l[u]))if(p.has(l[g])){const $=d.get(o[v]),k=$!==void 0?i[$]:null;if(k===null){const _=lt(e,i[u]);Le(_,a[v]),r[v]=_}else r[v]=Le(k,a[v]),lt(e,i[u],k),i[$]=null;v++}else Gn(i[g]),g--;else Gn(i[u]),u++;for(;v<=w;){const $=lt(e,r[w+1]);Le($,a[v]),r[v++]=$}for(;u<=g;){const $=i[u++];$!==null&&Gn($)}return this.ut=o,Nd(e,r),Se}});function Go(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(u=>{const v=String(u.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||l)&&(n="toolResult");let r=[];typeof t.content=="string"?r=[{type:"text",text:t.content}]:Array.isArray(t.content)?r=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(r=[{type:"text",text:t.text}]);const p=typeof t.timestamp=="number"?t.timestamp:Date.now(),d=typeof t.id=="string"?t.id:void 0;return{role:n,content:r,timestamp:p,id:d}}function Xs(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 Yo(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}class ms extends Wo{constructor(t){if(super(t),this.it=f,t.type!==jo.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===f||t==null)return this._t=void 0,this.it=t;if(t===Se)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:[]}}}ms.directiveName="unsafeHTML",ms.resultType=1;const bs=qo(ms);const{entries:Qo,setPrototypeOf:ua,isFrozen:Dd,getPrototypeOf:Bd,getOwnPropertyDescriptor:Fd}=Object;let{freeze:Z,seal:ne,create:ys}=Object,{apply:ws,construct:$s}=typeof Reflect<"u"&&Reflect;Z||(Z=function(t){return t});ne||(ne=function(t){return t});ws||(ws=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});$s||($s=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 Kt=J(Array.prototype.forEach),Ud=J(Array.prototype.lastIndexOf),pa=J(Array.prototype.pop),ct=J(Array.prototype.push),Kd=J(Array.prototype.splice),Vt=J(String.prototype.toLowerCase),Yn=J(String.prototype.toString),Qn=J(String.prototype.match),dt=J(String.prototype.replace),Hd=J(String.prototype.indexOf),zd=J(String.prototype.trim),se=J(Object.prototype.hasOwnProperty),Y=J(RegExp.prototype.test),ut=jd(TypeError);function J(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 ws(e,t,s)}}function jd(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return $s(e,n)}}function I(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Vt;ua&&ua(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(Dd(t)||(t[s]=a),i=a)}e[i]=!0}return e}function qd(e){for(let t=0;t<e.length;t++)se(e,t)||(e[t]=null);return e}function de(e){const t=ys(null);for(const[n,s]of Qo(e))se(e,n)&&(Array.isArray(s)?t[n]=qd(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=de(s):t[n]=s);return t}function pt(e,t){for(;e!==null;){const s=Fd(e,t);if(s){if(s.get)return J(s.get);if(typeof s.value=="function")return J(s.value)}e=Bd(e)}function n(){return null}return n}const ha=Z(["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"]),Zn=Z(["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"]),Jn=Z(["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"]),Wd=Z(["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"]),Xn=Z(["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"]),Vd=Z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fa=Z(["#text"]),ga=Z(["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"]),es=Z(["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"]),va=Z(["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"]),Ht=Z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gd=ne(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Yd=ne(/<%[\w\W]*|[\w\W]*%>/gm),Qd=ne(/\$\{[\w\W]*/gm),Zd=ne(/^data-[\-\w.\u00B7-\uFFFF]+$/),Jd=ne(/^aria-[\-\w]+$/),Zo=ne(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Xd=ne(/^(?:\w+script|data):/i),eu=ne(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jo=ne(/^html$/i),tu=ne(/^[a-z][.\w]*(-[.\w]+)+$/i);var ma=Object.freeze({__proto__:null,ARIA_ATTR:Jd,ATTR_WHITESPACE:eu,CUSTOM_ELEMENT:tu,DATA_ATTR:Zd,DOCTYPE_NAME:Jo,ERB_EXPR:Yd,IS_ALLOWED_URI:Zo,IS_SCRIPT_OR_DATA:Xd,MUSTACHE_EXPR:Gd,TMPLIT_EXPR:Qd});const ht={element:1,text:3,progressingInstruction:7,comment:8,document:9},nu=function(){return typeof window>"u"?null:window},su=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},ba=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Xo(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nu();const t=T=>Xo(T);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==ht.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:r,NodeFilter:p,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:v}=e,w=r.prototype,$=pt(w,"cloneNode"),k=pt(w,"remove"),_=pt(w,"nextSibling"),L=pt(w,"childNodes"),P=pt(w,"parentNode");if(typeof o=="function"){const T=n.createElement("template");T.content&&T.content.ownerDocument&&(n=T.content.ownerDocument)}let M,C="";const{implementation:E,createNodeIterator:pe,createDocumentFragment:xn,getElementsByTagName:kn}=n,{importNode:Mr}=s;let G=ba();t.isSupported=typeof Qo=="function"&&typeof P=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:An,ERB_EXPR:Sn,TMPLIT_EXPR:_n,DATA_ATTR:Lr,ARIA_ATTR:Ir,IS_SCRIPT_OR_DATA:Rr,ATTR_WHITESPACE:ui,CUSTOM_ELEMENT:Pr}=ma;let{IS_ALLOWED_URI:pi}=ma,K=null;const hi=I({},[...ha,...Zn,...Jn,...Xn,...fa]);let z=null;const fi=I({},[...ga,...es,...va,...Ht]);let B=Object.seal(ys(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}})),it=null,Tn=null;const He=Object.seal(ys(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let gi=!0,Cn=!0,vi=!1,mi=!0,ze=!1,Mt=!0,Ce=!1,En=!1,Mn=!1,je=!1,Lt=!1,It=!1,bi=!0,yi=!1;const Nr="user-content-";let Ln=!0,at=!1,qe={},re=null;const In=I({},["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 wi=null;const $i=I({},["audio","video","img","source","image","track"]);let Rn=null;const xi=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",Pt="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml";let We=he,Pn=!1,Nn=null;const Or=I({},[Rt,Pt,he],Yn);let Nt=I({},["mi","mo","mn","ms","mtext"]),Ot=I({},["annotation-xml"]);const Dr=I({},["title","style","font","a","script"]);let ot=null;const Br=["application/xhtml+xml","text/html"],Fr="text/html";let U=null,Ve=null;const Ur=n.createElement("form"),ki=function(h){return h instanceof RegExp||h instanceof Function},On=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ve&&Ve===h)){if((!h||typeof h!="object")&&(h={}),h=de(h),ot=Br.indexOf(h.PARSER_MEDIA_TYPE)===-1?Fr:h.PARSER_MEDIA_TYPE,U=ot==="application/xhtml+xml"?Yn:Vt,K=se(h,"ALLOWED_TAGS")?I({},h.ALLOWED_TAGS,U):hi,z=se(h,"ALLOWED_ATTR")?I({},h.ALLOWED_ATTR,U):fi,Nn=se(h,"ALLOWED_NAMESPACES")?I({},h.ALLOWED_NAMESPACES,Yn):Or,Rn=se(h,"ADD_URI_SAFE_ATTR")?I(de(xi),h.ADD_URI_SAFE_ATTR,U):xi,wi=se(h,"ADD_DATA_URI_TAGS")?I(de($i),h.ADD_DATA_URI_TAGS,U):$i,re=se(h,"FORBID_CONTENTS")?I({},h.FORBID_CONTENTS,U):In,it=se(h,"FORBID_TAGS")?I({},h.FORBID_TAGS,U):de({}),Tn=se(h,"FORBID_ATTR")?I({},h.FORBID_ATTR,U):de({}),qe=se(h,"USE_PROFILES")?h.USE_PROFILES:!1,gi=h.ALLOW_ARIA_ATTR!==!1,Cn=h.ALLOW_DATA_ATTR!==!1,vi=h.ALLOW_UNKNOWN_PROTOCOLS||!1,mi=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=h.SAFE_FOR_TEMPLATES||!1,Mt=h.SAFE_FOR_XML!==!1,Ce=h.WHOLE_DOCUMENT||!1,je=h.RETURN_DOM||!1,Lt=h.RETURN_DOM_FRAGMENT||!1,It=h.RETURN_TRUSTED_TYPE||!1,Mn=h.FORCE_BODY||!1,bi=h.SANITIZE_DOM!==!1,yi=h.SANITIZE_NAMED_PROPS||!1,Ln=h.KEEP_CONTENT!==!1,at=h.IN_PLACE||!1,pi=h.ALLOWED_URI_REGEXP||Zo,We=h.NAMESPACE||he,Nt=h.MATHML_TEXT_INTEGRATION_POINTS||Nt,Ot=h.HTML_INTEGRATION_POINTS||Ot,B=h.CUSTOM_ELEMENT_HANDLING||{},h.CUSTOM_ELEMENT_HANDLING&&ki(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&ki(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(B.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ze&&(Cn=!1),Lt&&(je=!0),qe&&(K=I({},fa),z=[],qe.html===!0&&(I(K,ha),I(z,ga)),qe.svg===!0&&(I(K,Zn),I(z,es),I(z,Ht)),qe.svgFilters===!0&&(I(K,Jn),I(z,es),I(z,Ht)),qe.mathMl===!0&&(I(K,Xn),I(z,va),I(z,Ht))),h.ADD_TAGS&&(typeof h.ADD_TAGS=="function"?He.tagCheck=h.ADD_TAGS:(K===hi&&(K=de(K)),I(K,h.ADD_TAGS,U))),h.ADD_ATTR&&(typeof h.ADD_ATTR=="function"?He.attributeCheck=h.ADD_ATTR:(z===fi&&(z=de(z)),I(z,h.ADD_ATTR,U))),h.ADD_URI_SAFE_ATTR&&I(Rn,h.ADD_URI_SAFE_ATTR,U),h.FORBID_CONTENTS&&(re===In&&(re=de(re)),I(re,h.FORBID_CONTENTS,U)),h.ADD_FORBID_CONTENTS&&(re===In&&(re=de(re)),I(re,h.ADD_FORBID_CONTENTS,U)),Ln&&(K["#text"]=!0),Ce&&I(K,["html","head","body"]),K.table&&(I(K,["tbody"]),delete it.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=h.TRUSTED_TYPES_POLICY,C=M.createHTML("")}else M===void 0&&(M=su(v,i)),M!==null&&typeof C=="string"&&(C=M.createHTML(""));Z&&Z(h),Ve=h}},Ai=I({},[...Zn,...Jn,...Wd]),Si=I({},[...Xn,...Vd]),Kr=function(h){let x=P(h);(!x||!x.tagName)&&(x={namespaceURI:We,tagName:"template"});const S=Vt(h.tagName),O=Vt(x.tagName);return Nn[h.namespaceURI]?h.namespaceURI===Pt?x.namespaceURI===he?S==="svg":x.namespaceURI===Rt?S==="svg"&&(O==="annotation-xml"||Nt[O]):!!Ai[S]:h.namespaceURI===Rt?x.namespaceURI===he?S==="math":x.namespaceURI===Pt?S==="math"&&Ot[O]:!!Si[S]:h.namespaceURI===he?x.namespaceURI===Pt&&!Ot[O]||x.namespaceURI===Rt&&!Nt[O]?!1:!Si[S]&&(Dr[S]||!Ai[S]):!!(ot==="application/xhtml+xml"&&Nn[h.namespaceURI]):!1},le=function(h){ct(t.removed,{element:h});try{P(h).removeChild(h)}catch{k(h)}},Ee=function(h,x){try{ct(t.removed,{attribute:x.getAttributeNode(h),from:x})}catch{ct(t.removed,{attribute:null,from:x})}if(x.removeAttribute(h),h==="is")if(je||Lt)try{le(x)}catch{}else try{x.setAttribute(h,"")}catch{}},_i=function(h){let x=null,S=null;if(Mn)h="<remove></remove>"+h;else{const F=Qn(h,/^[\r\n\t ]+/);S=F&&F[0]}ot==="application/xhtml+xml"&&We===he&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const O=M?M.createHTML(h):h;if(We===he)try{x=new g().parseFromString(O,ot)}catch{}if(!x||!x.documentElement){x=E.createDocument(We,"template",null);try{x.documentElement.innerHTML=Pn?C:O}catch{}}const q=x.body||x.documentElement;return h&&S&&q.insertBefore(n.createTextNode(S),q.childNodes[0]||null),We===he?kn.call(x,Ce?"html":"body")[0]:Ce?x.documentElement:q},Ti=function(h){return pe.call(h.ownerDocument||h,h,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Dn=function(h){return h instanceof u&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof d)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},Ci=function(h){return typeof l=="function"&&h instanceof l};function fe(T,h,x){Kt(T,S=>{S.call(t,h,x,Ve)})}const Ei=function(h){let x=null;if(fe(G.beforeSanitizeElements,h,null),Dn(h))return le(h),!0;const S=U(h.nodeName);if(fe(G.uponSanitizeElement,h,{tagName:S,allowedTags:K}),Mt&&h.hasChildNodes()&&!Ci(h.firstElementChild)&&Y(/<[/\w!]/g,h.innerHTML)&&Y(/<[/\w!]/g,h.textContent)||h.nodeType===ht.progressingInstruction||Mt&&h.nodeType===ht.comment&&Y(/<[/\w]/g,h.data))return le(h),!0;if(!(He.tagCheck instanceof Function&&He.tagCheck(S))&&(!K[S]||it[S])){if(!it[S]&&Li(S)&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,S)||B.tagNameCheck instanceof Function&&B.tagNameCheck(S)))return!1;if(Ln&&!re[S]){const O=P(h)||h.parentNode,q=L(h)||h.childNodes;if(q&&O){const F=q.length;for(let X=F-1;X>=0;--X){const ge=$(q[X],!0);ge.__removalCount=(h.__removalCount||0)+1,O.insertBefore(ge,_(h))}}}return le(h),!0}return h instanceof r&&!Kr(h)||(S==="noscript"||S==="noembed"||S==="noframes")&&Y(/<\/no(script|embed|frames)/i,h.innerHTML)?(le(h),!0):(ze&&h.nodeType===ht.text&&(x=h.textContent,Kt([An,Sn,_n],O=>{x=dt(x,O," ")}),h.textContent!==x&&(ct(t.removed,{element:h.cloneNode()}),h.textContent=x)),fe(G.afterSanitizeElements,h,null),!1)},Mi=function(h,x,S){if(bi&&(x==="id"||x==="name")&&(S in n||S in Ur))return!1;if(!(Cn&&!Tn[x]&&Y(Lr,x))){if(!(gi&&Y(Ir,x))){if(!(He.attributeCheck instanceof Function&&He.attributeCheck(x,h))){if(!z[x]||Tn[x]){if(!(Li(h)&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,h)||B.tagNameCheck instanceof Function&&B.tagNameCheck(h))&&(B.attributeNameCheck instanceof RegExp&&Y(B.attributeNameCheck,x)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(x,h))||x==="is"&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,S)||B.tagNameCheck instanceof Function&&B.tagNameCheck(S))))return!1}else if(!Rn[x]){if(!Y(pi,dt(S,ui,""))){if(!((x==="src"||x==="xlink:href"||x==="href")&&h!=="script"&&Hd(S,"data:")===0&&wi[h])){if(!(vi&&!Y(Rr,dt(S,ui,"")))){if(S)return!1}}}}}}}return!0},Li=function(h){return h!=="annotation-xml"&&Qn(h,Pr)},Ii=function(h){fe(G.beforeSanitizeAttributes,h,null);const{attributes:x}=h;if(!x||Dn(h))return;const S={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let O=x.length;for(;O--;){const q=x[O],{name:F,namespaceURI:X,value:ge}=q,Ge=U(F),Bn=ge;let j=F==="value"?Bn:zd(Bn);if(S.attrName=Ge,S.attrValue=j,S.keepAttr=!0,S.forceKeepAttr=void 0,fe(G.uponSanitizeAttribute,h,S),j=S.attrValue,yi&&(Ge==="id"||Ge==="name")&&(Ee(F,h),j=Nr+j),Mt&&Y(/((--!?|])>)|<\/(style|title|textarea)/i,j)){Ee(F,h);continue}if(Ge==="attributename"&&Qn(j,"href")){Ee(F,h);continue}if(S.forceKeepAttr)continue;if(!S.keepAttr){Ee(F,h);continue}if(!mi&&Y(/\/>/i,j)){Ee(F,h);continue}ze&&Kt([An,Sn,_n],Pi=>{j=dt(j,Pi," ")});const Ri=U(h.nodeName);if(!Mi(Ri,Ge,j)){Ee(F,h);continue}if(M&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!X)switch(v.getAttributeType(Ri,Ge)){case"TrustedHTML":{j=M.createHTML(j);break}case"TrustedScriptURL":{j=M.createScriptURL(j);break}}if(j!==Bn)try{X?h.setAttributeNS(X,F,j):h.setAttribute(F,j),Dn(h)?le(h):pa(t.removed)}catch{Ee(F,h)}}fe(G.afterSanitizeAttributes,h,null)},Hr=function T(h){let x=null;const S=Ti(h);for(fe(G.beforeSanitizeShadowDOM,h,null);x=S.nextNode();)fe(G.uponSanitizeShadowNode,x,null),Ei(x),Ii(x),x.content instanceof a&&T(x.content);fe(G.afterSanitizeShadowDOM,h,null)};return t.sanitize=function(T){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,S=null,O=null,q=null;if(Pn=!T,Pn&&(T="<!-->"),typeof T!="string"&&!Ci(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw ut("dirty is not a string, aborting")}else throw ut("toString is not a function");if(!t.isSupported)return T;if(En||On(h),t.removed=[],typeof T=="string"&&(at=!1),at){if(T.nodeName){const ge=U(T.nodeName);if(!K[ge]||it[ge])throw ut("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof l)x=_i("<!---->"),S=x.ownerDocument.importNode(T,!0),S.nodeType===ht.element&&S.nodeName==="BODY"||S.nodeName==="HTML"?x=S:x.appendChild(S);else{if(!je&&!ze&&!Ce&&T.indexOf("<")===-1)return M&&It?M.createHTML(T):T;if(x=_i(T),!x)return je?null:It?C:""}x&&Mn&&le(x.firstChild);const F=Ti(at?T:x);for(;O=F.nextNode();)Ei(O),Ii(O),O.content instanceof a&&Hr(O.content);if(at)return T;if(je){if(Lt)for(q=xn.call(x.ownerDocument);x.firstChild;)q.appendChild(x.firstChild);else q=x;return(z.shadowroot||z.shadowrootmode)&&(q=Mr.call(s,q,!0)),q}let X=Ce?x.outerHTML:x.innerHTML;return Ce&&K["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&Y(Jo,x.ownerDocument.doctype.name)&&(X="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
17
|
-
`+
|
|
18
|
-
]`).replace("lheading",
|
|
19
|
-
`).map(a=>{let o=a.match(n.other.beginningSpace);if(o===null)return a;let[
|
|
20
|
-
`)}var
|
|
21
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=
|
|
22
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=
|
|
15
|
+
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`poolbot-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function gc(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)}function Be(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function it(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
16
|
+
`}function wo(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],c=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof c=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const l=s;l[o]==null&&(l[o]=typeof c=="number"?[]:{}),s=l[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function $o(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function we(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});mc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function Ao(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});vc(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function vc(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function mc(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?it(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=it(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=Be(t.config??{}),e.configFormOriginal=Be(t.config??{}),e.configRawOriginal=n)}async function ms(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?it(e.configForm):e.configRaw,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 we(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function bc(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?it(e.configForm):e.configRaw,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 we(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function yc(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 zt(e,t,n){const s=Be(e.configForm??e.configSnapshot?.config??{});wo(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=it(s))}function ra(e,t){const n=Be(e.configForm??e.configSnapshot?.config??{});$o(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=it(n))}async function Lt(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 mn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function wc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=tn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function $c(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=tn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function Ac(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=wc(e.cronForm),n=$c(e.cronForm),s=e.cronForm.agentId.trim(),i={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!i.name)throw new Error("Name required.");await e.client.request("cron.add",i),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await mn(e),await Lt(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function kc(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 mn(e),await Lt(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function xc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await ko(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Sc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await mn(e),await Lt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ko(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function le(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function _c(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Tc(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 Ec(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}}}async function bn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Cc(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 Ic=2e3,Rc=new Set(["trace","debug","info","warn","error","fatal"]);function Lc(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 Mc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Rc.has(t)?t:null}function Pc(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=Mc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=Lc(a);let c=null;o&&(typeof o.subsystem=="string"?c=o.subsystem:typeof o.module=="string"&&(c=o.module)),!c&&a&&a.length<120&&(c=a);let l=null;return typeof t[1]=="string"?l=t[1]:!o&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:s,level:i,subsystem:c,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function zs(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(c=>typeof c=="string"):[]).map(Pc),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-Ic),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)}}}const xo={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:Y,n:Jt,Gx:la,Gy:ca,a:Yn,d:Qn,h:Nc}=xo,Fe=32,js=64,Oc=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},j=(e="")=>{const t=new Error(e);throw Oc(t,j),t},Dc=e=>typeof e=="bigint",Uc=e=>typeof e=="string",Bc=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ee=(e,t,n="")=>{const s=Bc(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,c=a?` of length ${t}`:"",l=s?`length=${i}`:`type=${typeof e}`;j(o+"expected Uint8Array"+c+", got "+l)}return e},yn=e=>new Uint8Array(e),So=e=>Uint8Array.from(e),_o=(e,t)=>e.toString(16).padStart(t,"0"),To=e=>Array.from(Ee(e)).map(t=>_o(t,2)).join(""),be={_0:48,_9:57,A:65,F:70,a:97,f:102},da=e=>{if(e>=be._0&&e<=be._9)return e-be._0;if(e>=be.A&&e<=be.F)return e-(be.A-10);if(e>=be.a&&e<=be.f)return e-(be.a-10)},Eo=e=>{const t="hex invalid";if(!Uc(e))return j(t);const n=e.length,s=n/2;if(n%2)return j(t);const i=yn(s);for(let a=0,o=0;a<s;a++,o+=2){const c=da(e.charCodeAt(o)),l=da(e.charCodeAt(o+1));if(c===void 0||l===void 0)return j(t);i[a]=c*16+l}return i},Co=()=>globalThis?.crypto,Fc=()=>Co()?.subtle??j("crypto.subtle must be defined, consider polyfill"),It=(...e)=>{const t=yn(e.reduce((s,i)=>s+Ee(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},Hc=(e=Fe)=>Co().getRandomValues(yn(e)),nn=BigInt,Ne=(e,t,n,s="bad number: out of range")=>Dc(e)&&t<=e&&e<n?e:j(s),x=(e,t=Y)=>{const n=e%t;return n>=0n?n:t+n},Io=e=>x(e,Jt),Kc=(e,t)=>{(e===0n||t<=0n)&&j("no inverse n="+e+" mod="+t);let n=x(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,c=s%n,l=i-a*o;s=n,n=c,i=a,a=l}return s===1n?x(i,t):j("no inverse")},zc=e=>{const t=Po[e];return typeof t!="function"&&j("hashes."+e+" not set"),t},Jn=e=>e instanceof ne?e:j("Point expected"),bs=2n**256n;class ne{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=bs;this.X=Ne(t,0n,a),this.Y=Ne(n,0n,a),this.Z=Ne(s,1n,a),this.T=Ne(i,0n,a),Object.freeze(this)}static CURVE(){return xo}static fromAffine(t){return new ne(t.x,t.y,1n,x(t.x*t.y))}static fromBytes(t,n=!1){const s=Qn,i=So(Ee(t,Fe)),a=t[31];i[31]=a&-129;const o=Lo(i);Ne(o,0n,n?bs:Y);const l=x(o*o),p=x(l-1n),d=x(s*l+1n);let{isValid:u,value:f}=qc(p,d);u||j("bad point: y not sqrt");const v=(f&1n)===1n,m=(a&128)!==0;return!n&&f===0n&&m&&j("bad point: x==0, isLastByteOdd"),m!==v&&(f=x(-f)),new ne(f,o,1n,x(f*o))}static fromHex(t,n){return ne.fromBytes(Eo(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Yn,n=Qn,s=this;if(s.is0())return j("bad point: ZERO");const{X:i,Y:a,Z:o,T:c}=s,l=x(i*i),p=x(a*a),d=x(o*o),u=x(d*d),f=x(l*t),v=x(d*x(f+p)),m=x(u+x(n*x(l*p)));if(v!==m)return j("bad point: equation left != right (1)");const $=x(i*a),k=x(o*c);return $!==k?j("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:c}=Jn(t),l=x(n*c),p=x(a*i),d=x(s*c),u=x(o*i);return l===p&&d===u}is0(){return this.equals(et)}negate(){return new ne(x(-this.X),this.Y,this.Z,x(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Yn,a=x(t*t),o=x(n*n),c=x(2n*x(s*s)),l=x(i*a),p=t+n,d=x(x(p*p)-a-o),u=l+o,f=u-c,v=l-o,m=x(d*f),$=x(u*v),k=x(d*v),_=x(f*u);return new ne(m,$,_,k)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:c,Z:l,T:p}=Jn(t),d=Yn,u=Qn,f=x(n*o),v=x(s*c),m=x(a*u*p),$=x(i*l),k=x((n+s)*(o+c)-f-v),_=x($-m),M=x($+m),R=x(v-d*f),L=x(k*_),C=x(M*R),I=x(k*R),fe=x(_*M);return new ne(L,C,fe,I)}subtract(t){return this.add(Jn(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return et;if(Ne(t,1n,Jt),t===1n)return this;if(this.equals(He))return nd(t).p;let s=et,i=He;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(et))return{x:0n,y:1n};const i=Kc(s,Y);x(s*i)!==1n&&j("invalid inverse");const a=x(t*i),o=x(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Ro(n);return s[31]|=t&1n?128:0,s}toHex(){return To(this.toBytes())}clearCofactor(){return this.multiply(nn(Nc),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Jt/2n,!1).double();return Jt%2n&&(t=t.add(this)),t.is0()}}const He=new ne(la,ca,1n,x(la*ca)),et=new ne(0n,1n,1n,0n);ne.BASE=He;ne.ZERO=et;const Ro=e=>Eo(_o(Ne(e,0n,bs),js)).reverse(),Lo=e=>nn("0x"+To(So(Ee(e)).reverse())),ue=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=Y;return n},jc=e=>{const n=e*e%Y*e%Y,s=ue(n,2n)*n%Y,i=ue(s,1n)*e%Y,a=ue(i,5n)*i%Y,o=ue(a,10n)*a%Y,c=ue(o,20n)*o%Y,l=ue(c,40n)*c%Y,p=ue(l,80n)*l%Y,d=ue(p,80n)*l%Y,u=ue(d,10n)*a%Y;return{pow_p_5_8:ue(u,2n)*e%Y,b2:n}},ua=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,qc=(e,t)=>{const n=x(t*t*t),s=x(n*n*t),i=jc(e*s).pow_p_5_8;let a=x(e*n*i);const o=x(t*a*a),c=a,l=x(a*ua),p=o===e,d=o===x(-e),u=o===x(-e*ua);return p&&(a=c),(d||u)&&(a=l),(x(a)&1n)===1n&&(a=x(-a)),{isValid:p||d,value:a}},ys=e=>Io(Lo(e)),qs=(...e)=>Po.sha512Async(It(...e)),Wc=(...e)=>zc("sha512")(It(...e)),Mo=e=>{const t=e.slice(0,Fe);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Fe,js),s=ys(t),i=He.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Ws=e=>qs(Ee(e,Fe)).then(Mo),Gc=e=>Mo(Wc(Ee(e,Fe))),Vc=e=>Ws(e).then(t=>t.pointBytes),Yc=e=>qs(e.hashable).then(e.finish),Qc=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=ys(t),o=He.multiply(a).toBytes();return{hashable:It(o,s,n),finish:p=>{const d=Io(a+ys(p)*i);return Ee(It(o,Ro(d)),js)}}},Jc=async(e,t)=>{const n=Ee(e),s=await Ws(t),i=await qs(s.prefix,n);return Yc(Qc(s,i,n))},Po={sha512Async:async e=>{const t=Fc(),n=It(e);return yn(await t.digest("SHA-512",n.buffer))},sha512:void 0},Zc=(e=Hc(Fe))=>e,Xc={getExtendedPublicKeyAsync:Ws,getExtendedPublicKey:Gc,randomSecretKey:Zc},sn=8,ed=256,No=Math.ceil(ed/sn)+1,ws=2**(sn-1),td=()=>{const e=[];let t=He,n=t;for(let s=0;s<No;s++){n=t,e.push(n);for(let i=1;i<ws;i++)n=n.add(t),e.push(n);t=n.double()}return e};let pa;const ha=(e,t)=>{const n=t.negate();return e?n:t},nd=e=>{const t=pa||(pa=td());let n=et,s=He;const i=2**sn,a=i,o=nn(i-1),c=nn(sn);for(let l=0;l<No;l++){let p=Number(e&o);e>>=c,p>ws&&(p-=a,e+=1n);const d=l*ws,u=d,f=d+Math.abs(p)-1,v=l%2!==0,m=p<0;p===0?s=s.add(ha(v,t[u])):n=n.add(ha(m,t[f]))}return e!==0n&&j("invalid wnaf"),{p:n,f:s}},Zn="poolbot-device-identity-v1";function $s(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Oo(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function sd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Do(e){const t=await crypto.subtle.digest("SHA-256",e);return sd(new Uint8Array(t))}async function id(){const e=Xc.randomSecretKey(),t=await Vc(e);return{deviceId:await Do(t),publicKey:$s(t),privateKey:$s(e)}}async function Gs(){try{const n=localStorage.getItem(Zn);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 Do(Oo(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Zn,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await id(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Zn,JSON.stringify(t)),e}async function ad(e,t){const n=Oo(e),s=new TextEncoder().encode(t),i=await Jc(s,n);return $s(i)}const Uo="poolbot.device.auth.v1";function Vs(e){return e.trim()}function od(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].sort()}function Ys(){try{const e=window.localStorage.getItem(Uo);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 Bo(e){try{window.localStorage.setItem(Uo,JSON.stringify(e))}catch{}}function rd(e){const t=Ys();if(!t||t.deviceId!==e.deviceId)return null;const n=Vs(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Fo(e){const t=Vs(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Ys();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:od(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,Bo(n),i}function Ho(e){const t=Ys();if(!t||t.deviceId!==e.deviceId)return;const n=Vs(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],Bo(s)}async function Ce(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 ld(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Ce(e)}catch(n){e.devicesError=String(n)}}async function cd(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 Ce(e)}catch(s){e.devicesError=String(s)}}async function dd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Gs(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Fo({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 Ce(e)}catch(n){e.devicesError=String(n)}}async function ud(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await Gs();t.deviceId===s.deviceId&&Ho({deviceId:s.deviceId,role:t.role}),await Ce(e)}catch(s){e.devicesError=String(s)}}async function wn(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 pd(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function hd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Qs(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=pd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);fd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function fd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=Be(t.file??{}))}async function gd(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=hd(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await Qs(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function vd(e,t,n){const s=Be(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});wo(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function md(e,t){const n=Be(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});$o(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Js(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}}}function at(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function $n(e){return e instanceof Error?e.message:String(e)}async function Mt(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=$n(n)}finally{e.skillsLoading=!1}}}function bd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function yd(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await Mt(e),at(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=$n(s);e.skillsError=i,at(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function wd(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 Mt(e),at(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=$n(n);e.skillsError=s,at(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function $d(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 Mt(e),at(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=$n(i);e.skillsError=a,at(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}function Ad(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Zs(e){return e==="system"?Ad():e}const jt=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,kd=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,qt=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},xd=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,c=kd();if(!!o.startViewTransition&&!c){let p=.5,d=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")p=jt(n.pointerClientX/window.innerWidth),d=jt(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(p=jt((u.left+u.width/2)/window.innerWidth),d=jt((u.top+u.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${p*100}%`),a.style.setProperty("--theme-switch-y",`${d*100}%`),a.classList.add("theme-transition");try{const u=o.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>qt(a)):qt(a)}catch{qt(a),t()}return}t(),qt(a)};function Sd(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{wn(e,{quiet:!0})},5e3))}function _d(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Xs(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&zs(e,{quiet:!0})},2e3))}function ei(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function ti(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&bn(e)},3e3))}function ni(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Se(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,Cl(n),t.theme!==e.theme&&(e.theme=t.theme,An(e,Zs(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Ko(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Se(e,{...e.settings,lastActiveSessionKey:n})}function Td(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),a=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&Se(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(s!=null){const l=s.trim();l&&(e.password=l),t.delete("password"),o=!0}if(i!=null){const l=i.trim();l&&(e.sessionKey=l,Se(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(a!=null){const l=a.trim();l&&l!==e.settings.gatewayUrl&&Se(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),o=!0}if(!o)return;const c=new URL(window.location.href);c.search=t.toString(),window.history.replaceState({},"",c.toString())}function Ed(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Xs(e):ei(e),t==="debug"?ti(e):ni(e),si(e),jo(e,t,!1)}function Cd(e,t,n){xd({nextTheme:t,applyTheme:()=>{e.theme=t,Se(e,{...e.settings,theme:t}),An(e,Zs(t))},context:n,currentTheme:e.theme})}async function si(e){e.tab==="overview"&&await qo(e),e.tab==="channels"&&await Dd(e),e.tab==="instances"&&await Js(e),e.tab==="sessions"&&await lt(e),e.tab==="cron"&&await ii(e),e.tab==="skills"&&await Mt(e),e.tab==="nodes"&&(await wn(e),await Ce(e),await we(e),await Qs(e)),e.tab==="chat"&&(await Kd(e),vn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await Ao(e),await we(e)),e.tab==="debug"&&(await bn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await zs(e,{reset:!0}),yo(e,!0))}function Id(){if(typeof window>"u")return"";const e=window.__CLAWDBOT_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?hn(e):Rl(window.location.pathname)}function Rd(e){e.theme=e.settings.theme??"system",An(e,Zs(e.theme))}function An(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Ld(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"&&An(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Md(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 Pd(e,t){if(typeof window>"u")return;const n=vo(window.location.pathname,e.basePath)??"chat";zo(e,n),jo(e,n,t)}function Nd(e){if(typeof window>"u")return;const t=vo(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Se(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),zo(e,t)}function zo(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Xs(e):ei(e),t==="debug"?ti(e):ni(e),e.connected&&si(e)}function jo(e,t,n){if(typeof window>"u")return;const s=Et(fn(t,e.basePath)),i=Et(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function Od(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 qo(e){await Promise.all([le(e,!1),Js(e),lt(e),Lt(e),bn(e)])}async function Dd(e){await Promise.all([le(e,!0),Ao(e),we(e)])}async function ii(e){await Promise.all([le(e,!1),Lt(e),mn(e)])}function Wo(e){return e.chatSending||!!e.chatRunId}function Ud(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"}async function Go(e){e.connected&&(e.chatMessage="",await Jl(e))}function Bd(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Ks(),text:s,createdAt:Date.now(),attachments:i?n?.map(a=>({...a})):void 0}])}async function Vo(e,t,n){gn(e);const s=await Ql(e,t,n?.attachments);return!s&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!s&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),s&&Ko(e,e.sessionKey),s&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),s&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),vn(e),s&&!e.chatRunId&&Yo(e),s}async function Yo(e){if(!e.connected||Wo(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Vo(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Fd(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Hd(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],c=o.length>0;if(!(!i&&!c)){if(Ud(i)){await Go(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Wo(e)){Bd(e,i,o);return}await Vo(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:c?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft)})}}async function Kd(e){await Promise.all([st(e),lt(e),As(e)]),vn(e,!0)}const zd=Yo;function jd(e){const t=ho(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function qd(e,t){const n=hn(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function As(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=jd(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=qd(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const Qo={CHILD:2},Jo=e=>(...t)=>({_$litDirective$:e,values:t});let Zo=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:Wd}=bl,fa=e=>e,ga=()=>document.createComment(""),ht=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(ga(),i),o=s.insertBefore(ga(),i);n=new Wd(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,c=o!==e;if(c){let l;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(l=e._$AU)!==o._$AU&&n._$AP(l)}if(a!==i||c){let l=n._$AA;for(;l!==a;){const p=fa(l).nextSibling;fa(s).insertBefore(l,i),l=p}}}return n},Me=(e,t,n=e)=>(e._$AI(t,n),e),Gd={},Vd=(e,t=Gd)=>e._$AH=t,Yd=e=>e._$AH,Xn=e=>{e._$AR(),e._$AA.remove()};const va=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Xo=Jo(class extends Zo{constructor(e){if(super(e),e.type!==Qo.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const c of e)i[o]=s?s(c,o):o,a[o]=n(c,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Yd(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const c=this.ut??=[],l=[];let p,d,u=0,f=i.length-1,v=0,m=a.length-1;for(;u<=f&&v<=m;)if(i[u]===null)u++;else if(i[f]===null)f--;else if(c[u]===o[v])l[v]=Me(i[u],a[v]),u++,v++;else if(c[f]===o[m])l[m]=Me(i[f],a[m]),f--,m--;else if(c[u]===o[m])l[m]=Me(i[u],a[m]),ht(e,l[m+1],i[u]),u++,m--;else if(c[f]===o[v])l[v]=Me(i[f],a[v]),ht(e,i[u],i[f]),f--,v++;else if(p===void 0&&(p=va(o,v,m),d=va(c,u,f)),p.has(c[u]))if(p.has(c[f])){const $=d.get(o[v]),k=$!==void 0?i[$]:null;if(k===null){const _=ht(e,i[u]);Me(_,a[v]),l[v]=_}else l[v]=Me(k,a[v]),ht(e,i[u],k),i[$]=null;v++}else Xn(i[f]),f--;else Xn(i[u]),u++;for(;v<=m;){const $=ht(e,l[m+1]);Me($,a[v]),l[v++]=$}for(;u<=f;){const $=i[u++];$!==null&&Xn($)}return this.ut=o,Vd(e,l),Te}});function er(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(u=>{const v=String(u.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),c=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||c)&&(n="toolResult");let l=[];typeof t.content=="string"?l=[{type:"text",text:t.content}]:Array.isArray(t.content)?l=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(l=[{type:"text",text:t.text}]);const p=typeof t.timestamp=="number"?t.timestamp:Date.now(),d=typeof t.id=="string"?t.id:void 0;return{role:n,content:l,timestamp:p,id:d}}function ai(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 tr(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}class ks extends Zo{constructor(t){if(super(t),this.it=g,t.type!==Qo.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===g||t==null)return this._t=void 0,this.it=t;if(t===Te)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:[]}}}ks.directiveName="unsafeHTML",ks.resultType=1;const an=Jo(ks);const{entries:nr,setPrototypeOf:ma,isFrozen:Qd,getPrototypeOf:Jd,getOwnPropertyDescriptor:Zd}=Object;let{freeze:X,seal:ie,create:xs}=Object,{apply:Ss,construct:_s}=typeof Reflect<"u"&&Reflect;X||(X=function(t){return t});ie||(ie=function(t){return t});Ss||(Ss=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});_s||(_s=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 Wt=ee(Array.prototype.forEach),Xd=ee(Array.prototype.lastIndexOf),ba=ee(Array.prototype.pop),ft=ee(Array.prototype.push),eu=ee(Array.prototype.splice),Zt=ee(String.prototype.toLowerCase),es=ee(String.prototype.toString),ts=ee(String.prototype.match),gt=ee(String.prototype.replace),tu=ee(String.prototype.indexOf),nu=ee(String.prototype.trim),ae=ee(Object.prototype.hasOwnProperty),J=ee(RegExp.prototype.test),vt=su(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 Ss(e,t,s)}}function su(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return _s(e,n)}}function P(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Zt;ma&&ma(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(Qd(t)||(t[s]=a),i=a)}e[i]=!0}return e}function iu(e){for(let t=0;t<e.length;t++)ae(e,t)||(e[t]=null);return e}function pe(e){const t=xs(null);for(const[n,s]of nr(e))ae(e,n)&&(Array.isArray(s)?t[n]=iu(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=pe(s):t[n]=s);return t}function mt(e,t){for(;e!==null;){const s=Zd(e,t);if(s){if(s.get)return ee(s.get);if(typeof s.value=="function")return ee(s.value)}e=Jd(e)}function n(){return null}return n}const ya=X(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ns=X(["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"]),ss=X(["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"]),au=X(["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"]),is=X(["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"]),ou=X(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wa=X(["#text"]),$a=X(["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"]),as=X(["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"]),Aa=X(["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"]),Gt=X(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ru=ie(/\{\{[\w\W]*|[\w\W]*\}\}/gm),lu=ie(/<%[\w\W]*|[\w\W]*%>/gm),cu=ie(/\$\{[\w\W]*/gm),du=ie(/^data-[\-\w.\u00B7-\uFFFF]+$/),uu=ie(/^aria-[\-\w]+$/),sr=ie(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pu=ie(/^(?:\w+script|data):/i),hu=ie(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ir=ie(/^html$/i),fu=ie(/^[a-z][.\w]*(-[.\w]+)+$/i);var ka=Object.freeze({__proto__:null,ARIA_ATTR:uu,ATTR_WHITESPACE:hu,CUSTOM_ELEMENT:fu,DATA_ATTR:du,DOCTYPE_NAME:ir,ERB_EXPR:lu,IS_ALLOWED_URI:sr,IS_SCRIPT_OR_DATA:pu,MUSTACHE_EXPR:ru,TMPLIT_EXPR:cu});const bt={element:1,text:3,progressingInstruction:7,comment:8,document:9},gu=function(){return typeof window>"u"?null:window},vu=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},xa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ar(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gu();const t=T=>ar(T);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==bt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:c,Element:l,NodeFilter:p,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:v}=e,m=l.prototype,$=mt(m,"cloneNode"),k=mt(m,"remove"),_=mt(m,"nextSibling"),M=mt(m,"childNodes"),R=mt(m,"parentNode");if(typeof o=="function"){const T=n.createElement("template");T.content&&T.content.ownerDocument&&(n=T.content.ownerDocument)}let L,C="";const{implementation:I,createNodeIterator:fe,createDocumentFragment:Tn,getElementsByTagName:En}=n,{importNode:Br}=s;let Q=xa();t.isSupported=typeof nr=="function"&&typeof R=="function"&&I&&I.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Cn,ERB_EXPR:In,TMPLIT_EXPR:Rn,DATA_ATTR:Fr,ARIA_ATTR:Hr,IS_SCRIPT_OR_DATA:Kr,ATTR_WHITESPACE:mi,CUSTOM_ELEMENT:zr}=ka;let{IS_ALLOWED_URI:bi}=ka,z=null;const yi=P({},[...ya,...ns,...ss,...is,...wa]);let q=null;const wi=P({},[...$a,...as,...Aa,...Gt]);let F=Object.seal(xs(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}})),ct=null,Ln=null;const je=Object.seal(xs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $i=!0,Mn=!0,Ai=!1,ki=!0,qe=!1,Nt=!0,Ie=!1,Pn=!1,Nn=!1,We=!1,Ot=!1,Dt=!1,xi=!0,Si=!1;const jr="user-content-";let On=!0,dt=!1,Ge={},ce=null;const Dn=P({},["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 _i=null;const Ti=P({},["audio","video","img","source","image","track"]);let Un=null;const Ei=P({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ut="http://www.w3.org/1998/Math/MathML",Bt="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let Ve=ge,Bn=!1,Fn=null;const qr=P({},[Ut,Bt,ge],es);let Ft=P({},["mi","mo","mn","ms","mtext"]),Ht=P({},["annotation-xml"]);const Wr=P({},["title","style","font","a","script"]);let ut=null;const Gr=["application/xhtml+xml","text/html"],Vr="text/html";let K=null,Ye=null;const Yr=n.createElement("form"),Ci=function(h){return h instanceof RegExp||h instanceof Function},Hn=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ye&&Ye===h)){if((!h||typeof h!="object")&&(h={}),h=pe(h),ut=Gr.indexOf(h.PARSER_MEDIA_TYPE)===-1?Vr:h.PARSER_MEDIA_TYPE,K=ut==="application/xhtml+xml"?es:Zt,z=ae(h,"ALLOWED_TAGS")?P({},h.ALLOWED_TAGS,K):yi,q=ae(h,"ALLOWED_ATTR")?P({},h.ALLOWED_ATTR,K):wi,Fn=ae(h,"ALLOWED_NAMESPACES")?P({},h.ALLOWED_NAMESPACES,es):qr,Un=ae(h,"ADD_URI_SAFE_ATTR")?P(pe(Ei),h.ADD_URI_SAFE_ATTR,K):Ei,_i=ae(h,"ADD_DATA_URI_TAGS")?P(pe(Ti),h.ADD_DATA_URI_TAGS,K):Ti,ce=ae(h,"FORBID_CONTENTS")?P({},h.FORBID_CONTENTS,K):Dn,ct=ae(h,"FORBID_TAGS")?P({},h.FORBID_TAGS,K):pe({}),Ln=ae(h,"FORBID_ATTR")?P({},h.FORBID_ATTR,K):pe({}),Ge=ae(h,"USE_PROFILES")?h.USE_PROFILES:!1,$i=h.ALLOW_ARIA_ATTR!==!1,Mn=h.ALLOW_DATA_ATTR!==!1,Ai=h.ALLOW_UNKNOWN_PROTOCOLS||!1,ki=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,qe=h.SAFE_FOR_TEMPLATES||!1,Nt=h.SAFE_FOR_XML!==!1,Ie=h.WHOLE_DOCUMENT||!1,We=h.RETURN_DOM||!1,Ot=h.RETURN_DOM_FRAGMENT||!1,Dt=h.RETURN_TRUSTED_TYPE||!1,Nn=h.FORCE_BODY||!1,xi=h.SANITIZE_DOM!==!1,Si=h.SANITIZE_NAMED_PROPS||!1,On=h.KEEP_CONTENT!==!1,dt=h.IN_PLACE||!1,bi=h.ALLOWED_URI_REGEXP||sr,Ve=h.NAMESPACE||ge,Ft=h.MATHML_TEXT_INTEGRATION_POINTS||Ft,Ht=h.HTML_INTEGRATION_POINTS||Ht,F=h.CUSTOM_ELEMENT_HANDLING||{},h.CUSTOM_ELEMENT_HANDLING&&Ci(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(F.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&Ci(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(F.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(F.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),qe&&(Mn=!1),Ot&&(We=!0),Ge&&(z=P({},wa),q=[],Ge.html===!0&&(P(z,ya),P(q,$a)),Ge.svg===!0&&(P(z,ns),P(q,as),P(q,Gt)),Ge.svgFilters===!0&&(P(z,ss),P(q,as),P(q,Gt)),Ge.mathMl===!0&&(P(z,is),P(q,Aa),P(q,Gt))),h.ADD_TAGS&&(typeof h.ADD_TAGS=="function"?je.tagCheck=h.ADD_TAGS:(z===yi&&(z=pe(z)),P(z,h.ADD_TAGS,K))),h.ADD_ATTR&&(typeof h.ADD_ATTR=="function"?je.attributeCheck=h.ADD_ATTR:(q===wi&&(q=pe(q)),P(q,h.ADD_ATTR,K))),h.ADD_URI_SAFE_ATTR&&P(Un,h.ADD_URI_SAFE_ATTR,K),h.FORBID_CONTENTS&&(ce===Dn&&(ce=pe(ce)),P(ce,h.FORBID_CONTENTS,K)),h.ADD_FORBID_CONTENTS&&(ce===Dn&&(ce=pe(ce)),P(ce,h.ADD_FORBID_CONTENTS,K)),On&&(z["#text"]=!0),Ie&&P(z,["html","head","body"]),z.table&&(P(z,["tbody"]),delete ct.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw vt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=h.TRUSTED_TYPES_POLICY,C=L.createHTML("")}else L===void 0&&(L=vu(v,i)),L!==null&&typeof C=="string"&&(C=L.createHTML(""));X&&X(h),Ye=h}},Ii=P({},[...ns,...ss,...au]),Ri=P({},[...is,...ou]),Qr=function(h){let A=R(h);(!A||!A.tagName)&&(A={namespaceURI:Ve,tagName:"template"});const S=Zt(h.tagName),U=Zt(A.tagName);return Fn[h.namespaceURI]?h.namespaceURI===Bt?A.namespaceURI===ge?S==="svg":A.namespaceURI===Ut?S==="svg"&&(U==="annotation-xml"||Ft[U]):!!Ii[S]:h.namespaceURI===Ut?A.namespaceURI===ge?S==="math":A.namespaceURI===Bt?S==="math"&&Ht[U]:!!Ri[S]:h.namespaceURI===ge?A.namespaceURI===Bt&&!Ht[U]||A.namespaceURI===Ut&&!Ft[U]?!1:!Ri[S]&&(Wr[S]||!Ii[S]):!!(ut==="application/xhtml+xml"&&Fn[h.namespaceURI]):!1},de=function(h){ft(t.removed,{element:h});try{R(h).removeChild(h)}catch{k(h)}},Re=function(h,A){try{ft(t.removed,{attribute:A.getAttributeNode(h),from:A})}catch{ft(t.removed,{attribute:null,from:A})}if(A.removeAttribute(h),h==="is")if(We||Ot)try{de(A)}catch{}else try{A.setAttribute(h,"")}catch{}},Li=function(h){let A=null,S=null;if(Nn)h="<remove></remove>"+h;else{const H=ts(h,/^[\r\n\t ]+/);S=H&&H[0]}ut==="application/xhtml+xml"&&Ve===ge&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const U=L?L.createHTML(h):h;if(Ve===ge)try{A=new f().parseFromString(U,ut)}catch{}if(!A||!A.documentElement){A=I.createDocument(Ve,"template",null);try{A.documentElement.innerHTML=Bn?C:U}catch{}}const V=A.body||A.documentElement;return h&&S&&V.insertBefore(n.createTextNode(S),V.childNodes[0]||null),Ve===ge?En.call(A,Ie?"html":"body")[0]:Ie?A.documentElement:V},Mi=function(h){return fe.call(h.ownerDocument||h,h,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Kn=function(h){return h instanceof u&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof d)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},Pi=function(h){return typeof c=="function"&&h instanceof c};function ve(T,h,A){Wt(T,S=>{S.call(t,h,A,Ye)})}const Ni=function(h){let A=null;if(ve(Q.beforeSanitizeElements,h,null),Kn(h))return de(h),!0;const S=K(h.nodeName);if(ve(Q.uponSanitizeElement,h,{tagName:S,allowedTags:z}),Nt&&h.hasChildNodes()&&!Pi(h.firstElementChild)&&J(/<[/\w!]/g,h.innerHTML)&&J(/<[/\w!]/g,h.textContent)||h.nodeType===bt.progressingInstruction||Nt&&h.nodeType===bt.comment&&J(/<[/\w]/g,h.data))return de(h),!0;if(!(je.tagCheck instanceof Function&&je.tagCheck(S))&&(!z[S]||ct[S])){if(!ct[S]&&Di(S)&&(F.tagNameCheck instanceof RegExp&&J(F.tagNameCheck,S)||F.tagNameCheck instanceof Function&&F.tagNameCheck(S)))return!1;if(On&&!ce[S]){const U=R(h)||h.parentNode,V=M(h)||h.childNodes;if(V&&U){const H=V.length;for(let te=H-1;te>=0;--te){const me=$(V[te],!0);me.__removalCount=(h.__removalCount||0)+1,U.insertBefore(me,_(h))}}}return de(h),!0}return h instanceof l&&!Qr(h)||(S==="noscript"||S==="noembed"||S==="noframes")&&J(/<\/no(script|embed|frames)/i,h.innerHTML)?(de(h),!0):(qe&&h.nodeType===bt.text&&(A=h.textContent,Wt([Cn,In,Rn],U=>{A=gt(A,U," ")}),h.textContent!==A&&(ft(t.removed,{element:h.cloneNode()}),h.textContent=A)),ve(Q.afterSanitizeElements,h,null),!1)},Oi=function(h,A,S){if(xi&&(A==="id"||A==="name")&&(S in n||S in Yr))return!1;if(!(Mn&&!Ln[A]&&J(Fr,A))){if(!($i&&J(Hr,A))){if(!(je.attributeCheck instanceof Function&&je.attributeCheck(A,h))){if(!q[A]||Ln[A]){if(!(Di(h)&&(F.tagNameCheck instanceof RegExp&&J(F.tagNameCheck,h)||F.tagNameCheck instanceof Function&&F.tagNameCheck(h))&&(F.attributeNameCheck instanceof RegExp&&J(F.attributeNameCheck,A)||F.attributeNameCheck instanceof Function&&F.attributeNameCheck(A,h))||A==="is"&&F.allowCustomizedBuiltInElements&&(F.tagNameCheck instanceof RegExp&&J(F.tagNameCheck,S)||F.tagNameCheck instanceof Function&&F.tagNameCheck(S))))return!1}else if(!Un[A]){if(!J(bi,gt(S,mi,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&h!=="script"&&tu(S,"data:")===0&&_i[h])){if(!(Ai&&!J(Kr,gt(S,mi,"")))){if(S)return!1}}}}}}}return!0},Di=function(h){return h!=="annotation-xml"&&ts(h,zr)},Ui=function(h){ve(Q.beforeSanitizeAttributes,h,null);const{attributes:A}=h;if(!A||Kn(h))return;const S={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let U=A.length;for(;U--;){const V=A[U],{name:H,namespaceURI:te,value:me}=V,Qe=K(H),zn=me;let W=H==="value"?zn:nu(zn);if(S.attrName=Qe,S.attrValue=W,S.keepAttr=!0,S.forceKeepAttr=void 0,ve(Q.uponSanitizeAttribute,h,S),W=S.attrValue,Si&&(Qe==="id"||Qe==="name")&&(Re(H,h),W=jr+W),Nt&&J(/((--!?|])>)|<\/(style|title|textarea)/i,W)){Re(H,h);continue}if(Qe==="attributename"&&ts(W,"href")){Re(H,h);continue}if(S.forceKeepAttr)continue;if(!S.keepAttr){Re(H,h);continue}if(!ki&&J(/\/>/i,W)){Re(H,h);continue}qe&&Wt([Cn,In,Rn],Fi=>{W=gt(W,Fi," ")});const Bi=K(h.nodeName);if(!Oi(Bi,Qe,W)){Re(H,h);continue}if(L&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!te)switch(v.getAttributeType(Bi,Qe)){case"TrustedHTML":{W=L.createHTML(W);break}case"TrustedScriptURL":{W=L.createScriptURL(W);break}}if(W!==zn)try{te?h.setAttributeNS(te,H,W):h.setAttribute(H,W),Kn(h)?de(h):ba(t.removed)}catch{Re(H,h)}}ve(Q.afterSanitizeAttributes,h,null)},Jr=function T(h){let A=null;const S=Mi(h);for(ve(Q.beforeSanitizeShadowDOM,h,null);A=S.nextNode();)ve(Q.uponSanitizeShadowNode,A,null),Ni(A),Ui(A),A.content instanceof a&&T(A.content);ve(Q.afterSanitizeShadowDOM,h,null)};return t.sanitize=function(T){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,S=null,U=null,V=null;if(Bn=!T,Bn&&(T="<!-->"),typeof T!="string"&&!Pi(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw vt("dirty is not a string, aborting")}else throw vt("toString is not a function");if(!t.isSupported)return T;if(Pn||Hn(h),t.removed=[],typeof T=="string"&&(dt=!1),dt){if(T.nodeName){const me=K(T.nodeName);if(!z[me]||ct[me])throw vt("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof c)A=Li("<!---->"),S=A.ownerDocument.importNode(T,!0),S.nodeType===bt.element&&S.nodeName==="BODY"||S.nodeName==="HTML"?A=S:A.appendChild(S);else{if(!We&&!qe&&!Ie&&T.indexOf("<")===-1)return L&&Dt?L.createHTML(T):T;if(A=Li(T),!A)return We?null:Dt?C:""}A&&Nn&&de(A.firstChild);const H=Mi(dt?T:A);for(;U=H.nextNode();)Ni(U),Ui(U),U.content instanceof a&&Jr(U.content);if(dt)return T;if(We){if(Ot)for(V=Tn.call(A.ownerDocument);A.firstChild;)V.appendChild(A.firstChild);else V=A;return(q.shadowroot||q.shadowrootmode)&&(V=Br.call(s,V,!0)),V}let te=Ie?A.outerHTML:A.innerHTML;return Ie&&z["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&J(ir,A.ownerDocument.doctype.name)&&(te="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
|
17
|
+
`+te),qe&&Wt([Cn,In,Rn],me=>{te=gt(te,me," ")}),L&&Dt?L.createHTML(te):te},t.setConfig=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hn(T),Pn=!0},t.clearConfig=function(){Ye=null,Pn=!1},t.isValidAttribute=function(T,h,A){Ye||Hn({});const S=K(T),U=K(h);return Oi(S,U,A)},t.addHook=function(T,h){typeof h=="function"&&ft(Q[T],h)},t.removeHook=function(T,h){if(h!==void 0){const A=Xd(Q[T],h);return A===-1?void 0:eu(Q[T],A,1)[0]}return ba(Q[T])},t.removeHooks=function(T){Q[T]=[]},t.removeAllHooks=function(){Q=xa()},t}var Ts=ar();function oi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ze=oi();function or(e){ze=e}var xt={exec:()=>null};function N(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(Z.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var mu=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Z={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},bu=/^(?:[ \t]*(?:\n|$))+/,yu=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,wu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Pt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$u=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ri=/(?:[*+-]|\d{1,9}[.)])/,rr=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lr=N(rr).replace(/bull/g,ri).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(),Au=N(rr).replace(/bull/g,ri).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(),li=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ku=/^[^\n]+/,ci=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,xu=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ci).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Su=N(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ri).getRegex(),kn="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",di=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_u=N("^ {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",di).replace("tag",kn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cr=N(li).replace("hr",Pt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",kn).getRegex(),Tu=N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",cr).getRegex(),ui={blockquote:Tu,code:yu,def:xu,fences:wu,heading:$u,hr:Pt,html:_u,lheading:lr,list:Su,newline:bu,paragraph:cr,table:xt,text:ku},Sa=N("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Pt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",kn).getRegex(),Eu={...ui,lheading:Au,table:Sa,paragraph:N(li).replace("hr",Pt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Sa).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",kn).getRegex()},Cu={...ui,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",di).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:xt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(li).replace("hr",Pt).replace("heading",` *#{1,6} *[^
|
|
18
|
+
]`).replace("lheading",lr).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Iu=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ru=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,dr=/^( {2,}|\\)\n(?!\s*$)/,Lu=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xn=/[\p{P}\p{S}]/u,pi=/[\s\p{P}\p{S}]/u,ur=/[^\s\p{P}\p{S}]/u,Mu=N(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,pi).getRegex(),pr=/(?!~)[\p{P}\p{S}]/u,Pu=/(?!~)[\s\p{P}\p{S}]/u,Nu=/(?:[^\s\p{P}\p{S}]|~)/u,Ou=N(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",mu?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),hr=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Du=N(hr,"u").replace(/punct/g,xn).getRegex(),Uu=N(hr,"u").replace(/punct/g,pr).getRegex(),fr="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Bu=N(fr,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,pi).replace(/punct/g,xn).getRegex(),Fu=N(fr,"gu").replace(/notPunctSpace/g,Nu).replace(/punctSpace/g,Pu).replace(/punct/g,pr).getRegex(),Hu=N("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,pi).replace(/punct/g,xn).getRegex(),Ku=N(/\\(punct)/,"gu").replace(/punct/g,xn).getRegex(),zu=N(/^<(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(),ju=N(di).replace("(?:-->|$)","-->").getRegex(),qu=N("^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",ju).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),on=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Wu=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",on).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gr=N(/^!?\[(label)\]\[(ref)\]/).replace("label",on).replace("ref",ci).getRegex(),vr=N(/^!?\[(ref)\](?:\[\])?/).replace("ref",ci).getRegex(),Gu=N("reflink|nolink(?!\\()","g").replace("reflink",gr).replace("nolink",vr).getRegex(),_a=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,hi={_backpedal:xt,anyPunctuation:Ku,autolink:zu,blockSkip:Ou,br:dr,code:Ru,del:xt,emStrongLDelim:Du,emStrongRDelimAst:Bu,emStrongRDelimUnd:Hu,escape:Iu,link:Wu,nolink:vr,punctuation:Mu,reflink:gr,reflinkSearch:Gu,tag:qu,text:Lu,url:xt},Vu={...hi,link:N(/^!?\[(label)\]\((.*?)\)/).replace("label",on).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",on).getRegex()},Es={...hi,emStrongRDelimAst:Fu,emStrongLDelim:Uu,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_a).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:N(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_a).getRegex()},Yu={...Es,br:N(dr).replace("{2,}","*").getRegex(),text:N(Es.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Vt={normal:ui,gfm:Eu,pedantic:Cu},yt={normal:hi,gfm:Es,breaks:Yu,pedantic:Vu},Qu={"&":"&","<":"<",">":">",'"':""","'":"'"},Ta=e=>Qu[e];function ye(e,t){if(t){if(Z.escapeTest.test(e))return e.replace(Z.escapeReplace,Ta)}else if(Z.escapeTestNoEncode.test(e))return e.replace(Z.escapeReplaceNoEncode,Ta);return e}function Ea(e){try{e=encodeURI(e).replace(Z.percentDecode,"%")}catch{return null}return e}function Ca(e,t){let n=e.replace(Z.findPipe,(a,o,c)=>{let l=!1,p=o;for(;--p>=0&&c[p]==="\\";)l=!l;return l?"|":" |"}),s=n.split(Z.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(Z.slashPipe,"|");return s}function wt(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 Ju(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 Ia(e,t,n,s,i){let a=t.href,o=t.title||null,c=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:c,tokens:s.inlineTokens(c)};return s.state.inLink=!1,l}function Zu(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
|
|
19
|
+
`).map(a=>{let o=a.match(n.other.beginningSpace);if(o===null)return a;let[c]=o;return c.length>=i.length?a.slice(i.length):a}).join(`
|
|
20
|
+
`)}var rn=class{options;rules;lexer;constructor(e){this.options=e||ze}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:wt(n,`
|
|
21
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=Zu(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=wt(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:wt(t[0],`
|
|
22
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=wt(t[0],`
|
|
23
23
|
`).split(`
|
|
24
|
-
`),s="",i="",a=[];for(;n.length>0;){let o=!1,
|
|
24
|
+
`),s="",i="",a=[];for(;n.length>0;){let o=!1,c=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))c.push(n[l]),o=!0;else if(!o)c.push(n[l]);else break;n=n.slice(l);let p=c.join(`
|
|
25
25
|
`),d=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
26
26
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
27
27
|
${p}`:p,i=i?`${i}
|
|
28
|
-
${d}`:d;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,a,!0),this.lexer.state.top=u,n.length===0)break;let
|
|
28
|
+
${d}`:d;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,a,!0),this.lexer.state.top=u,n.length===0)break;let f=a.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let v=f,m=v.raw+`
|
|
29
29
|
`+n.join(`
|
|
30
|
-
`),$=this.blockquote(
|
|
30
|
+
`),$=this.blockquote(m);a[a.length-1]=$,s=s.substring(0,s.length-v.raw.length)+$.raw,i=i.substring(0,i.length-v.text.length)+$.text;break}else if(f?.type==="list"){let v=f,m=v.raw+`
|
|
31
31
|
`+n.join(`
|
|
32
|
-
`),$=this.list(
|
|
33
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let
|
|
34
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,$=>" ".repeat(3*$.length)),
|
|
35
|
-
`,1)[0],v=!u.trim(),
|
|
36
|
-
`,e=e.substring(
|
|
37
|
-
`,1)[0],C;if(
|
|
38
|
-
`+C.slice(
|
|
39
|
-
`+
|
|
40
|
-
`,e=e.substring(
|
|
41
|
-
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(
|
|
42
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=
|
|
43
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(
|
|
32
|
+
`),$=this.list(m);a[a.length-1]=$,s=s.substring(0,s.length-f.raw.length)+$.raw,i=i.substring(0,i.length-v.raw.length)+$.raw,n=m.substring(a.at(-1).raw.length).split(`
|
|
33
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let l=!1,p="",d="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let u=t[2].split(`
|
|
34
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,$=>" ".repeat(3*$.length)),f=e.split(`
|
|
35
|
+
`,1)[0],v=!u.trim(),m=0;if(this.options.pedantic?(m=2,d=u.trimStart()):v?m=t[1].length+1:(m=t[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,d=u.slice(m),m+=t[1].length),v&&this.rules.other.blankLine.test(f)&&(p+=f+`
|
|
36
|
+
`,e=e.substring(f.length+1),l=!0),!l){let $=this.rules.other.nextBulletRegex(m),k=this.rules.other.hrRegex(m),_=this.rules.other.fencesBeginRegex(m),M=this.rules.other.headingBeginRegex(m),R=this.rules.other.htmlBeginRegex(m);for(;e;){let L=e.split(`
|
|
37
|
+
`,1)[0],C;if(f=L,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),C=f):C=f.replace(this.rules.other.tabCharGlobal," "),_.test(f)||M.test(f)||R.test(f)||$.test(f)||k.test(f))break;if(C.search(this.rules.other.nonSpaceChar)>=m||!f.trim())d+=`
|
|
38
|
+
`+C.slice(m);else{if(v||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(u)||M.test(u)||k.test(u))break;d+=`
|
|
39
|
+
`+f}!v&&!f.trim()&&(v=!0),p+=L+`
|
|
40
|
+
`,e=e.substring(L.length+1),u=C.slice(m)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(o=!0)),i.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),i.raw+=p}let c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=d.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=d.raw+l.tokens[0].raw,l.tokens[0].text=d.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(d)):l.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):l.tokens.unshift(d)}}if(!i.loose){let p=l.tokens.filter(u=>u.type==="space"),d=p.length>0&&p.some(u=>this.rules.other.anyLine.test(u.raw));i.loose=d}}if(i.loose)for(let l of i.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ca(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
41
|
+
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(Ca(o,a.header.length).map((c,l)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:a.align[l]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
42
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=wt(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=Ju(t[2],"()");if(a===-2)return;if(a>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Ia(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Ia(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,c=i,l=0,p=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+i);(s=p.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){c+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+l);let d=[...s[0]][0].length,u=e.slice(0,i+s.index+d+o);if(Math.min(i,o)%2){let v=u.slice(1,-1);return{type:"em",raw:u,text:v,tokens:this.lexer.inlineTokens(v)}}let f=u.slice(2,-2);return{type:"strong",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},oe=class Cs{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ze,this.options.tokenizer=this.options.tokenizer||new rn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Z,block:Vt.normal,inline:yt.normal};this.options.pedantic?(n.block=Vt.pedantic,n.inline=yt.pedantic):this.options.gfm&&(n.block=Vt.gfm,this.options.breaks?n.inline=yt.breaks:n.inline=yt.gfm),this.tokenizer.rules=n}static get rules(){return{block:Vt,inline:yt}}static lex(t,n){return new Cs(n).lex(t)}static lexInline(t,n){return new Cs(n).inlineTokens(t)}lex(t){t=t.replace(Z.carriageReturn,`
|
|
43
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(Z.tabCharGlobal," ").replace(Z.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
44
44
|
`:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
45
45
|
`)?"":`
|
|
46
46
|
`)+i.raw,o.text+=`
|
|
47
47
|
`+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
48
48
|
`)?"":`
|
|
49
49
|
`)+i.raw,o.text+=`
|
|
50
|
-
`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),n.push(i);continue}let a=t;if(this.options.extensions?.startBlock){let o=1/0,
|
|
50
|
+
`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),n.push(i);continue}let a=t;if(this.options.extensions?.startBlock){let o=1/0,c=t.slice(1),l;this.options.extensions.startBlock.forEach(p=>{l=p.call({lexer:this},c),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(a=t.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let o=n.at(-1);s&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
51
51
|
`)?"":`
|
|
52
52
|
`)+i.raw,o.text+=`
|
|
53
53
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),s=a.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
54
54
|
`)?"":`
|
|
55
55
|
`)+i.raw,o.text+=`
|
|
56
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let
|
|
57
|
-
`;return s?'<pre><code class="language-'+
|
|
58
|
-
`:"<pre><code>"+(n?i:
|
|
56
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)a=i[2]?i[2].length:0,s=s.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,c="";for(;t;){o||(c=""),o=!1;let l;if(this.options.extensions?.inline?.some(d=>(l=d.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let d=n.at(-1);l.type==="text"&&d?.type==="text"?(d.raw+=l.raw,d.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(t,s,c)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),n.push(l);continue}let p=t;if(this.options.extensions?.startInline){let d=1/0,u=t.slice(1),f;this.options.extensions.startInline.forEach(v=>{f=v.call({lexer:this},u),typeof f=="number"&&f>=0&&(d=Math.min(d,f))}),d<1/0&&d>=0&&(p=t.substring(0,d+1))}if(l=this.tokenizer.inlineText(p)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(c=l.raw.slice(-1)),o=!0;let d=n.at(-1);d?.type==="text"?(d.raw+=l.raw,d.text+=l.text):n.push(l);continue}if(t){let d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}},ln=class{options;parser;constructor(e){this.options=e||ze}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(Z.notSpaceStart)?.[0],i=e.replace(Z.endingNewline,"")+`
|
|
57
|
+
`;return s?'<pre><code class="language-'+ye(s)+'">'+(n?i:ye(i,!0))+`</code></pre>
|
|
58
|
+
`:"<pre><code>"+(n?i:ye(i,!0))+`</code></pre>
|
|
59
59
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
60
60
|
${this.parser.parse(e)}</blockquote>
|
|
61
61
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
62
62
|
`}hr(e){return`<hr>
|
|
63
|
-
`}list(e){let t=e.ordered,n=e.start,s="";for(let o=0;o<e.items.length;o++){let
|
|
63
|
+
`}list(e){let t=e.ordered,n=e.start,s="";for(let o=0;o<e.items.length;o++){let c=e.items[o];s+=this.listitem(c)}let i=t?"ol":"ul",a=t&&n!==1?' start="'+n+'"':"";return"<"+i+a+`>
|
|
64
64
|
`+s+"</"+i+`>
|
|
65
65
|
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
66
66
|
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
@@ -71,52 +71,52 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
71
71
|
`}tablerow({text:e}){return`<tr>
|
|
72
72
|
${e}</tr>
|
|
73
73
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
74
|
-
`}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>${
|
|
75
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+
|
|
74
|
+
`}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>${ye(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=Ea(e);if(i===null)return s;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+ye(t)+'"'),a+=">"+s+"</a>",a}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Ea(e);if(i===null)return ye(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${ye(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ye(e.text)}},fi=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}},re=class Is{options;renderer;textRenderer;constructor(t){this.options=t||ze,this.options.renderer=this.options.renderer||new ln,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new fi}static parse(t,n){return new Is(n).parse(t)}static parseInline(t,n){return new Is(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=c||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=c||"";continue}}let o=a;switch(o.type){case"escape":{s+=n.text(o);break}case"html":{s+=n.html(o);break}case"link":{s+=n.link(o);break}case"image":{s+=n.image(o);break}case"checkbox":{s+=n.checkbox(o);break}case"strong":{s+=n.strong(o);break}case"em":{s+=n.em(o);break}case"codespan":{s+=n.codespan(o);break}case"br":{s+=n.br(o);break}case"del":{s+=n.del(o);break}case"text":{s+=n.text(o);break}default:{let c='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}},$t=class{options;block;constructor(e){this.options=e||ze}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?oe.lex:oe.lexInline}provideParser(){return this.block?re.parse:re.parseInline}},Xu=class{defaults=oi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=re;Renderer=ln;TextRenderer=fi;Lexer=oe;Tokenizer=rn;Hooks=$t;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...o){let c=i.renderer.apply(this,o);return c===!1&&(c=a.apply(this,o)),c}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new ln(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,c=n.renderer[o],l=i[o];i[o]=(...p)=>{let d=c.apply(i,p);return d===!1&&(d=l.apply(i,p)),d||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new rn(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,c=n.tokenizer[o],l=i[o];i[o]=(...p)=>{let d=c.apply(i,p);return d===!1&&(d=l.apply(i,p)),d}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new $t;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,c=n.hooks[o],l=i[o];$t.passThroughHooks.has(a)?i[o]=p=>{if(this.defaults.async&&$t.passThroughHooksRespectAsync.has(a))return(async()=>{let u=await c.call(i,p);return l.call(i,u)})();let d=c.call(i,p);return l.call(i,d)}:i[o]=(...p)=>{if(this.defaults.async)return(async()=>{let u=await c.apply(i,p);return u===!1&&(u=await l.apply(i,p)),u})();let d=c.apply(i,p);return d===!1&&(d=l.apply(i,p)),d}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let c=[];return c.push(a.call(this,o)),i&&(c=c.concat(i.call(this,o))),c}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return oe.lex(e,t??this.defaults)}parser(e,t){return re.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(t):t,c=await(i.hooks?await i.hooks.provideLexer():e?oe.lex:oe.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(c):c;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let p=await(i.hooks?await i.hooks.provideParser():e?re.parse:re.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(p):p})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?oe.lex:oe.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let c=(i.hooks?i.hooks.provideParser():e?re.parse:re.parseInline)(o,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
75
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+ye(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},Ke=new Xu;function O(e,t){return Ke.parse(e,t)}O.options=O.setOptions=function(e){return Ke.setOptions(e),O.defaults=Ke.defaults,or(O.defaults),O};O.getDefaults=oi;O.defaults=ze;O.use=function(...e){return Ke.use(...e),O.defaults=Ke.defaults,or(O.defaults),O};O.walkTokens=function(e,t){return Ke.walkTokens(e,t)};O.parseInline=Ke.parseInline;O.Parser=re;O.parser=re.parse;O.Renderer=ln;O.TextRenderer=fi;O.Lexer=oe;O.lexer=oe.lex;O.Tokenizer=rn;O.Hooks=$t;O.parse=O;O.options;O.setOptions;O.use;O.walkTokens;O.parseInline;re.parse;oe.lex;O.setOptions({gfm:!0,breaks:!0,mangle:!1});const Ra=["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"],La=["class","href","rel","target","title","start"];let Ma=!1;const ep=14e4,tp=4e4,np=200,os=5e4,De=new Map;function sp(e){const t=De.get(e);return t===void 0?null:(De.delete(e),De.set(e,t),t)}function Pa(e,t){if(De.set(e,t),De.size<=np)return;const n=De.keys().next().value;n&&De.delete(n)}function ip(){Ma||(Ma=!0,Ts.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function Rs(e){const t=e.trim();if(!t)return"";if(ip(),t.length<=os){const o=sp(t);if(o!==null)return o}const n=mo(t,ep),s=n.truncated?`
|
|
76
76
|
|
|
77
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>
|
|
77
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>tp){const c=`<pre class="code-block">${ap(`${n.text}${s}`)}</pre>`,l=Ts.sanitize(c,{ALLOWED_TAGS:Ra,ALLOWED_ATTR:La});return t.length<=os&&Pa(t,l),l}const i=O.parse(`${n.text}${s}`),a=Ts.sanitize(i,{ALLOWED_TAGS:Ra,ALLOWED_ATTR:La});return t.length<=os&&Pa(t,a),a}function ap(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const op=1500,rp=2e3,mr="Copy as markdown",lp="Copied",cp="Copy failed";async function dp(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Yt(e,t){e.title=t,e.setAttribute("aria-label",t)}function up(e){const t=e.label??mr;return r`
|
|
78
78
|
<button
|
|
79
79
|
class="chat-copy-btn"
|
|
80
80
|
type="button"
|
|
81
81
|
title=${t}
|
|
82
82
|
aria-label=${t}
|
|
83
|
-
@click=${async n=>{const s=n.currentTarget;if(s?.querySelector(".chat-copy-btn__icon"),!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await
|
|
83
|
+
@click=${async n=>{const s=n.currentTarget;if(s?.querySelector(".chat-copy-btn__icon"),!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await dp(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",Yt(s,cp),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,Yt(s,t))},rp);return}s.dataset.copied="1",Yt(s,lp),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,Yt(s,t))},op)}}}
|
|
84
84
|
>
|
|
85
85
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
86
|
-
<span class="chat-copy-btn__icon-copy">${
|
|
87
|
-
<span class="chat-copy-btn__icon-check">${
|
|
86
|
+
<span class="chat-copy-btn__icon-copy">${D.copy}</span>
|
|
87
|
+
<span class="chat-copy-btn__icon-check">${D.check}</span>
|
|
88
88
|
</span>
|
|
89
89
|
</button>
|
|
90
|
-
`}function
|
|
91
|
-
`),n=t.slice(0,
|
|
92
|
-
`);return s.length>
|
|
90
|
+
`}function pp(e){return up({text:()=>e,label:mr})}const hp={icon:"puzzle",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},fp={bash:{icon:"wrench",title:"Bash",detailKeys:["command"]},process:{icon:"wrench",title:"Process",detailKeys:["sessionId"]},read:{icon:"fileText",title:"Read",detailKeys:["path"]},write:{icon:"edit",title:"Write",detailKeys:["path"]},edit:{icon:"penLine",title:"Edit",detailKeys:["path"]},attach:{icon:"paperclip",title:"Attach",detailKeys:["path","url","fileName"]},browser:{icon:"globe",title:"Browser",actions:{status:{label:"status"},start:{label:"start"},stop:{label:"stop"},tabs:{label:"tabs"},open:{label:"open",detailKeys:["targetUrl"]},focus:{label:"focus",detailKeys:["targetId"]},close:{label:"close",detailKeys:["targetId"]},snapshot:{label:"snapshot",detailKeys:["targetUrl","targetId","ref","element","format"]},screenshot:{label:"screenshot",detailKeys:["targetUrl","targetId","ref","element"]},navigate:{label:"navigate",detailKeys:["targetUrl","targetId"]},console:{label:"console",detailKeys:["level","targetId"]},pdf:{label:"pdf",detailKeys:["targetId"]},upload:{label:"upload",detailKeys:["paths","ref","inputRef","element","targetId"]},dialog:{label:"dialog",detailKeys:["accept","promptText","targetId"]},act:{label:"act",detailKeys:["request.kind","request.ref","request.selector","request.text","request.value"]}}},canvas:{icon:"image",title:"Canvas",actions:{present:{label:"present",detailKeys:["target","node","nodeId"]},hide:{label:"hide",detailKeys:["node","nodeId"]},navigate:{label:"navigate",detailKeys:["url","node","nodeId"]},eval:{label:"eval",detailKeys:["javaScript","node","nodeId"]},snapshot:{label:"snapshot",detailKeys:["format","node","nodeId"]},a2ui_push:{label:"A2UI push",detailKeys:["jsonlPath","node","nodeId"]},a2ui_reset:{label:"A2UI reset",detailKeys:["node","nodeId"]}}},nodes:{icon:"smartphone",title:"Nodes",actions:{status:{label:"status"},describe:{label:"describe",detailKeys:["node","nodeId"]},pending:{label:"pending"},approve:{label:"approve",detailKeys:["requestId"]},reject:{label:"reject",detailKeys:["requestId"]},notify:{label:"notify",detailKeys:["node","nodeId","title","body"]},camera_snap:{label:"camera snap",detailKeys:["node","nodeId","facing","deviceId"]},camera_list:{label:"camera list",detailKeys:["node","nodeId"]},camera_clip:{label:"camera clip",detailKeys:["node","nodeId","facing","duration","durationMs"]},screen_record:{label:"screen record",detailKeys:["node","nodeId","duration","durationMs","fps","screenIndex"]}}},cron:{icon:"loader",title:"Cron",actions:{status:{label:"status"},list:{label:"list"},add:{label:"add",detailKeys:["job.name","job.id","job.schedule","job.cron"]},update:{label:"update",detailKeys:["id"]},remove:{label:"remove",detailKeys:["id"]},run:{label:"run",detailKeys:["id"]},runs:{label:"runs",detailKeys:["id"]},wake:{label:"wake",detailKeys:["text","mode"]}}},gateway:{icon:"plug",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]},"config.get":{label:"config get"},"config.schema":{label:"config schema"},"config.apply":{label:"config apply",detailKeys:["restartDelayMs"]},"update.run":{label:"update run",detailKeys:["restartDelayMs"]}}},whatsapp_login:{icon:"circle",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{icon:"messageSquare",title:"Discord",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sticker:{label:"sticker",detailKeys:["to","stickerIds"]},poll:{label:"poll",detailKeys:["question","to"]},permissions:{label:"permissions",detailKeys:["channelId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},threadCreate:{label:"thread create",detailKeys:["channelId","name"]},threadList:{label:"thread list",detailKeys:["guildId","channelId"]},threadReply:{label:"thread reply",detailKeys:["channelId","content"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},searchMessages:{label:"search",detailKeys:["guildId","content"]},memberInfo:{label:"member",detailKeys:["guildId","userId"]},roleInfo:{label:"roles",detailKeys:["guildId"]},emojiList:{label:"emoji list",detailKeys:["guildId"]},roleAdd:{label:"role add",detailKeys:["guildId","userId","roleId"]},roleRemove:{label:"role remove",detailKeys:["guildId","userId","roleId"]},channelInfo:{label:"channel",detailKeys:["channelId"]},channelList:{label:"channels",detailKeys:["guildId"]},voiceStatus:{label:"voice",detailKeys:["guildId","userId"]},eventList:{label:"events",detailKeys:["guildId"]},eventCreate:{label:"event create",detailKeys:["guildId","name"]},timeout:{label:"timeout",detailKeys:["guildId","userId"]},kick:{label:"kick",detailKeys:["guildId","userId"]},ban:{label:"ban",detailKeys:["guildId","userId"]}}},slack:{icon:"messageSquare",title:"Slack",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},memberInfo:{label:"member",detailKeys:["userId"]},emojiList:{label:"emoji list"}}}},gp={fallback:hp,tools:fp},br=gp,Na=br.fallback??{icon:"puzzle"},vp=br.tools??{};function mp(e){return(e??"tool").trim()}function bp(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 yp(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function yr(e){if(e!=null){if(typeof e=="string"){const t=e.trim();if(!t)return;const n=t.split(/\r?\n/)[0]?.trim()??"";return n?n.length>160?`${n.slice(0,157)}…`:n:void 0}if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const t=e.map(s=>yr(s)).filter(s=>!!s);if(t.length===0)return;const n=t.slice(0,3).join(", ");return t.length>3?`${n}…`:n}}}function wp(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 $p(e,t){for(const n of t){const s=wp(e,n),i=yr(s);if(i)return i}}function Ap(e){if(!e||typeof e!="object")return;const t=e,n=typeof t.path=="string"?t.path:void 0;if(!n)return;const s=typeof t.offset=="number"?t.offset:void 0,i=typeof t.limit=="number"?t.limit:void 0;return s!==void 0&&i!==void 0?`${n}:${s}-${s+i}`:n}function kp(e){if(!e||typeof e!="object")return;const t=e;return typeof t.path=="string"?t.path:void 0}function xp(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function Sp(e){const t=mp(e.name),n=t.toLowerCase(),s=vp[n],i=s?.icon??Na.icon??"puzzle",a=s?.title??bp(t),o=s?.label??t,c=e.args&&typeof e.args=="object"?e.args.action:void 0,l=typeof c=="string"?c.trim():void 0,p=xp(s,l),d=yp(p?.label??l);let u;n==="read"&&(u=Ap(e.args)),!u&&(n==="write"||n==="edit"||n==="attach")&&(u=kp(e.args));const f=p?.detailKeys??s?.detailKeys??Na.detailKeys??[];return!u&&f.length>0&&(u=$p(e.args,f)),!u&&e.meta&&(u=e.meta),u&&(u=Tp(u)),{name:t,icon:i,title:a,label:o,verb:d,detail:u}}function _p(e){const t=[];if(e.verb&&t.push(e.verb),e.detail&&t.push(e.detail),t.length!==0)return t.join(" · ")}function Tp(e){return e&&e.replace(/\/Users\/[^/]+/g,"~").replace(/\/home\/[^/]+/g,"~")}const Ep=80,Cp=2,Oa=100;function Ip(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 Rp(e){const t=e.split(`
|
|
91
|
+
`),n=t.slice(0,Cp),s=n.join(`
|
|
92
|
+
`);return s.length>Oa?s.slice(0,Oa)+"…":n.length<t.length?s+"…":s}function Lp(e){const t=e,n=Mp(t.content),s=[];for(const i of n){const a=String(i.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(a)||typeof i.name=="string"&&i.arguments!=null)&&s.push({kind:"call",name:i.name??"tool",args:Pp(i.arguments??i.args)})}for(const i of n){const a=String(i.type??"").toLowerCase();if(a!=="toolresult"&&a!=="tool_result")continue;const o=Np(i),c=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:c,text:o})}if(tr(e)&&!s.some(i=>i.kind==="result")){const i=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",a=bo(e)??void 0;s.push({kind:"result",name:i,text:a})}return s}function Da(e,t){const n=Sp({name:e.name,args:e.args}),s=_p(n),i=!!e.text?.trim(),a=!!t,o=a?()=>{if(i){t(Ip(e.text));return}const u=`## ${n.label}
|
|
93
93
|
|
|
94
94
|
${s?`**Command:** \`${s}\`
|
|
95
95
|
|
|
96
|
-
`:""}*No output — tool completed successfully.*`;t(u)}:void 0,
|
|
96
|
+
`:""}*No output — tool completed successfully.*`;t(u)}:void 0,c=i&&(e.text?.length??0)<=Ep,l=i&&!c,p=i&&c,d=!i;return r`
|
|
97
97
|
<div
|
|
98
98
|
class="chat-tool-card ${a?"chat-tool-card--clickable":""}"
|
|
99
99
|
@click=${o}
|
|
100
|
-
role=${a?"button":
|
|
101
|
-
tabindex=${a?"0":
|
|
102
|
-
@keydown=${a?u=>{u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),o?.())}:
|
|
100
|
+
role=${a?"button":g}
|
|
101
|
+
tabindex=${a?"0":g}
|
|
102
|
+
@keydown=${a?u=>{u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),o?.())}:g}
|
|
103
103
|
>
|
|
104
104
|
<div class="chat-tool-card__header">
|
|
105
105
|
<div class="chat-tool-card__title">
|
|
106
|
-
<span class="chat-tool-card__icon">${
|
|
106
|
+
<span class="chat-tool-card__icon">${D[n.icon]}</span>
|
|
107
107
|
<span>${n.label}</span>
|
|
108
108
|
</div>
|
|
109
|
-
${a?
|
|
110
|
-
${d&&!a?
|
|
109
|
+
${a?r`<span class="chat-tool-card__action">${i?"View":""} ${D.check}</span>`:g}
|
|
110
|
+
${d&&!a?r`<span class="chat-tool-card__status">${D.check}</span>`:g}
|
|
111
111
|
</div>
|
|
112
|
-
${s?
|
|
113
|
-
${d?
|
|
114
|
-
${r
|
|
115
|
-
${p?
|
|
112
|
+
${s?r`<div class="chat-tool-card__detail">${s}</div>`:g}
|
|
113
|
+
${d?r`<div class="chat-tool-card__status-text muted">Completed</div>`:g}
|
|
114
|
+
${l?r`<div class="chat-tool-card__preview mono">${Rp(e.text)}</div>`:g}
|
|
115
|
+
${p?r`<div class="chat-tool-card__inline mono">${e.text}</div>`:g}
|
|
116
116
|
</div>
|
|
117
|
-
`}function
|
|
117
|
+
`}function Mp(e){return Array.isArray(e)?e.filter(Boolean):[]}function Pp(e){if(typeof e!="string")return e;const t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(t)}catch{return e}}function Np(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function Op(e){const n=e.content,s=[];if(Array.isArray(n))for(const i of n){if(typeof i!="object"||i===null)continue;const a=i;if(a.type==="image"){const o=a.source;if(o?.type==="base64"&&typeof o.data=="string"){const c=o.data,l=o.media_type||"image/png",p=c.startsWith("data:")?c:`data:${l};base64,${c}`;s.push({url:p})}else typeof a.url=="string"&&s.push({url:a.url})}else if(a.type==="image_url"){const o=a.image_url;typeof o?.url=="string"&&s.push({url:o.url})}}return s}function Dp(e){return r`
|
|
118
118
|
<div class="chat-group assistant">
|
|
119
|
-
${
|
|
119
|
+
${gi("assistant",e)}
|
|
120
120
|
<div class="chat-group-messages">
|
|
121
121
|
<div class="chat-bubble chat-reading-indicator" aria-hidden="true">
|
|
122
122
|
<span class="chat-reading-indicator__dots">
|
|
@@ -125,35 +125,35 @@ ${s?`**Command:** \`${s}\`
|
|
|
125
125
|
</div>
|
|
126
126
|
</div>
|
|
127
127
|
</div>
|
|
128
|
-
`}function
|
|
128
|
+
`}function Up(e,t,n,s){const i=new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),a=s?.name??"Assistant";return r`
|
|
129
129
|
<div class="chat-group assistant">
|
|
130
|
-
${
|
|
130
|
+
${gi("assistant",s)}
|
|
131
131
|
<div class="chat-group-messages">
|
|
132
|
-
${
|
|
132
|
+
${wr({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!0,showReasoning:!1},n)}
|
|
133
133
|
<div class="chat-group-footer">
|
|
134
134
|
<span class="chat-sender-name">${a}</span>
|
|
135
135
|
<span class="chat-group-timestamp">${i}</span>
|
|
136
136
|
</div>
|
|
137
137
|
</div>
|
|
138
138
|
</div>
|
|
139
|
-
`}function
|
|
139
|
+
`}function Bp(e,t){const n=ai(e.role),s=t.assistantName??"Assistant",i=n==="user"?"You":n==="assistant"?s:n,a=n==="user"?"user":n==="assistant"?"assistant":"other",o=new Date(e.timestamp).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return r`
|
|
140
140
|
<div class="chat-group ${a}">
|
|
141
|
-
${
|
|
141
|
+
${gi(e.role,{name:s,avatar:t.assistantAvatar??null})}
|
|
142
142
|
<div class="chat-group-messages">
|
|
143
|
-
${e.messages.map((l
|
|
143
|
+
${e.messages.map((c,l)=>wr(c.message,{isStreaming:e.isStreaming&&l===e.messages.length-1,showReasoning:t.showReasoning},t.onOpenSidebar))}
|
|
144
144
|
<div class="chat-group-footer">
|
|
145
145
|
<span class="chat-sender-name">${i}</span>
|
|
146
146
|
<span class="chat-group-timestamp">${o}</span>
|
|
147
147
|
</div>
|
|
148
148
|
</div>
|
|
149
149
|
</div>
|
|
150
|
-
`}function
|
|
150
|
+
`}function gi(e,t){const n=ai(e),s=t?.name?.trim()||"Assistant",i=t?.avatar?.trim()||"",a=n==="user"?"U":n==="assistant"?s.charAt(0).toUpperCase()||"A":n==="tool"?"⚙":"?",o=n==="user"?"user":n==="assistant"?"assistant":n==="tool"?"tool":"other";return i&&n==="assistant"?Fp(i)?r`<img
|
|
151
151
|
class="chat-avatar ${o}"
|
|
152
152
|
src="${i}"
|
|
153
153
|
alt="${s}"
|
|
154
|
-
/>`:
|
|
154
|
+
/>`:r`<div class="chat-avatar ${o}">${i}</div>`:r`<div class="chat-avatar ${o}">${a}</div>`}function Fp(e){return/^https?:\/\//i.test(e)||/^data:image\//i.test(e)||/^\//.test(e)}function Hp(e){return e.length===0?g:r`
|
|
155
155
|
<div class="chat-message-images">
|
|
156
|
-
${e.map(t=>
|
|
156
|
+
${e.map(t=>r`
|
|
157
157
|
<img
|
|
158
158
|
src=${t.url}
|
|
159
159
|
alt=${t.alt??"Attached image"}
|
|
@@ -162,32 +162,32 @@ ${s?`**Command:** \`${s}\`
|
|
|
162
162
|
/>
|
|
163
163
|
`)}
|
|
164
164
|
</div>
|
|
165
|
-
`}function
|
|
165
|
+
`}function wr(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",a=tr(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",o=Lp(e),c=o.length>0,l=Op(e),p=l.length>0,d=bo(e),u=t.showReasoning&&i==="assistant"?jl(e):null,f=d?.trim()?d:null,v=u?Wl(u):null,m=f,$=i==="assistant"&&!!m?.trim(),k=["chat-bubble",$?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!m&&c&&a?r`${o.map(_=>Da(_,n))}`:!m&&!c&&!p?g:r`
|
|
166
166
|
<div class="${k}">
|
|
167
|
-
${$?
|
|
168
|
-
${
|
|
169
|
-
${v?
|
|
170
|
-
${
|
|
171
|
-
${o.map(_=>
|
|
167
|
+
${$?pp(m):g}
|
|
168
|
+
${Hp(l)}
|
|
169
|
+
${v?r`<div class="chat-thinking">${an(Rs(v))}</div>`:g}
|
|
170
|
+
${m?r`<div class="chat-text">${an(Rs(m))}</div>`:g}
|
|
171
|
+
${o.map(_=>Da(_,n))}
|
|
172
172
|
</div>
|
|
173
|
-
`}function
|
|
173
|
+
`}function Kp(e){return r`
|
|
174
174
|
<div class="sidebar-panel">
|
|
175
175
|
<div class="sidebar-header">
|
|
176
176
|
<div class="sidebar-title">Tool Output</div>
|
|
177
177
|
<button @click=${e.onClose} class="btn" title="Close sidebar">
|
|
178
|
-
${
|
|
178
|
+
${D.x}
|
|
179
179
|
</button>
|
|
180
180
|
</div>
|
|
181
181
|
<div class="sidebar-content">
|
|
182
|
-
${e.error?
|
|
182
|
+
${e.error?r`
|
|
183
183
|
<div class="callout danger">${e.error}</div>
|
|
184
184
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
185
185
|
View Raw Text
|
|
186
186
|
</button>
|
|
187
|
-
`:e.content?
|
|
187
|
+
`:e.content?r`<div class="sidebar-markdown">${an(Rs(e.content))}</div>`:r`<div class="muted">No content available</div>`}
|
|
188
188
|
</div>
|
|
189
189
|
</div>
|
|
190
|
-
`}var
|
|
190
|
+
`}var zp=Object.defineProperty,jp=Object.getOwnPropertyDescriptor,Sn=(e,t,n,s)=>{for(var i=s>1?void 0:s?jp(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&zp(t,n,i),i};let ot=class extends tt{constructor(){super(...arguments),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.isDragging=!1,this.startX=0,this.startRatio=0,this.handleMouseDown=e=>{this.isDragging=!0,this.startX=e.clientX,this.startRatio=this.splitRatio,this.classList.add("dragging"),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),e.preventDefault()},this.handleMouseMove=e=>{if(!this.isDragging)return;const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect().width,i=(e.clientX-this.startX)/n;let a=this.startRatio+i;a=Math.max(this.minRatio,Math.min(this.maxRatio,a)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:a},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return r``}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)}};ot.styles=Xr`
|
|
191
191
|
:host {
|
|
192
192
|
width: 4px;
|
|
193
193
|
cursor: col-resize;
|
|
@@ -213,17 +213,17 @@ ${s?`**Command:** \`${s}\`
|
|
|
213
213
|
:host(.dragging) {
|
|
214
214
|
background: var(--accent, #007bff);
|
|
215
215
|
}
|
|
216
|
-
`;
|
|
216
|
+
`;Sn([pn({type:Number})],ot.prototype,"splitRatio",2);Sn([pn({type:Number})],ot.prototype,"minRatio",2);Sn([pn({type:Number})],ot.prototype,"maxRatio",2);ot=Sn([uo("resizable-divider")],ot);const qp=5e3;function Wp(e){return e?e.active?r`
|
|
217
217
|
<div class="callout info compaction-indicator compaction-indicator--active">
|
|
218
|
-
${
|
|
218
|
+
${D.loader} Compacting context...
|
|
219
219
|
</div>
|
|
220
|
-
`:e.completedAt&&Date.now()-e.completedAt<
|
|
220
|
+
`:e.completedAt&&Date.now()-e.completedAt<qp?r`
|
|
221
221
|
<div class="callout success compaction-indicator compaction-indicator--complete">
|
|
222
|
-
${
|
|
222
|
+
${D.check} Context compacted
|
|
223
223
|
</div>
|
|
224
|
-
`:
|
|
224
|
+
`:g:g}function Gp(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Vp(e,t){const n=e.clipboardData?.items;if(!n||!t.onAttachmentsChange)return;const s=[];for(let i=0;i<n.length;i++){const a=n[i];a.type.startsWith("image/")&&s.push(a)}if(s.length!==0){e.preventDefault();for(const i of s){const a=i.getAsFile();if(!a)continue;const o=new FileReader;o.onload=()=>{const c=o.result,l={id:Gp(),dataUrl:c,mimeType:a.type},p=t.attachments??[];t.onAttachmentsChange?.([...p,l])},o.readAsDataURL(a)}}}function Yp(e){const t=e.attachments??[];return t.length===0?g:r`
|
|
225
225
|
<div class="chat-attachments">
|
|
226
|
-
${t.map(n=>
|
|
226
|
+
${t.map(n=>r`
|
|
227
227
|
<div class="chat-attachment">
|
|
228
228
|
<img
|
|
229
229
|
src=${n.dataUrl}
|
|
@@ -236,30 +236,30 @@ ${s?`**Command:** \`${s}\`
|
|
|
236
236
|
aria-label="Remove attachment"
|
|
237
237
|
@click=${()=>{const s=(e.attachments??[]).filter(i=>i.id!==n.id);e.onAttachmentsChange?.(s)}}
|
|
238
238
|
>
|
|
239
|
-
${
|
|
239
|
+
${D.x}
|
|
240
240
|
</button>
|
|
241
241
|
</div>
|
|
242
242
|
`)}
|
|
243
243
|
</div>
|
|
244
|
-
`}function
|
|
244
|
+
`}function Qp(e){const t=e.connected,n=e.sending||e.stream!==null,s=!!(e.canAbort&&e.onAbort),a=e.sessions?.sessions?.find(v=>v.key===e.sessionKey)?.reasoningLevel??"off",o=e.showThinking&&a!=="off",c={name:e.assistantName,avatar:e.assistantAvatar??e.assistantAvatarUrl??null},l=(e.attachments?.length??0)>0,p=e.connected?l?"Add a message or paste more images...":"Message (↩ to send, Shift+↩ for line breaks, paste images)":"Connect to the gateway to start chatting…",d=e.splitRatio??.6,u=!!(e.sidebarOpen&&e.onCloseSidebar),f=r`
|
|
245
245
|
<div
|
|
246
246
|
class="chat-thread"
|
|
247
247
|
role="log"
|
|
248
248
|
aria-live="polite"
|
|
249
249
|
@scroll=${e.onChatScroll}
|
|
250
250
|
>
|
|
251
|
-
${e.loading?
|
|
252
|
-
${
|
|
251
|
+
${e.loading?r`<div class="muted">Loading chat…</div>`:g}
|
|
252
|
+
${Xo(Zp(e),v=>v.key,v=>v.kind==="reading-indicator"?Dp(c):v.kind==="stream"?Up(v.text,v.startedAt,e.onOpenSidebar,c):v.kind==="group"?Bp(v,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName,assistantAvatar:c.avatar}):g)}
|
|
253
253
|
</div>
|
|
254
|
-
`;return
|
|
254
|
+
`;return r`
|
|
255
255
|
<section class="card chat">
|
|
256
|
-
${e.disabledReason?
|
|
256
|
+
${e.disabledReason?r`<div class="callout">${e.disabledReason}</div>`:g}
|
|
257
257
|
|
|
258
|
-
${e.error?
|
|
258
|
+
${e.error?r`<div class="callout danger">${e.error}</div>`:g}
|
|
259
259
|
|
|
260
|
-
${
|
|
260
|
+
${Wp(e.compactionStatus)}
|
|
261
261
|
|
|
262
|
-
${e.focusMode?
|
|
262
|
+
${e.focusMode?r`
|
|
263
263
|
<button
|
|
264
264
|
class="chat-focus-exit"
|
|
265
265
|
type="button"
|
|
@@ -267,9 +267,9 @@ ${s?`**Command:** \`${s}\`
|
|
|
267
267
|
aria-label="Exit focus mode"
|
|
268
268
|
title="Exit focus mode"
|
|
269
269
|
>
|
|
270
|
-
${
|
|
270
|
+
${D.x}
|
|
271
271
|
</button>
|
|
272
|
-
`:
|
|
272
|
+
`:g}
|
|
273
273
|
|
|
274
274
|
<div
|
|
275
275
|
class="chat-split-container ${u?"chat-split-container--open":""}"
|
|
@@ -278,27 +278,27 @@ ${s?`**Command:** \`${s}\`
|
|
|
278
278
|
class="chat-main"
|
|
279
279
|
style="flex: ${u?`0 0 ${d*100}%`:"1 1 100%"}"
|
|
280
280
|
>
|
|
281
|
-
${
|
|
281
|
+
${f}
|
|
282
282
|
</div>
|
|
283
283
|
|
|
284
|
-
${u?
|
|
284
|
+
${u?r`
|
|
285
285
|
<resizable-divider
|
|
286
286
|
.splitRatio=${d}
|
|
287
287
|
@resize=${v=>e.onSplitRatioChange?.(v.detail.splitRatio)}
|
|
288
288
|
></resizable-divider>
|
|
289
289
|
<div class="chat-sidebar">
|
|
290
|
-
${
|
|
290
|
+
${Kp({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
|
|
291
291
|
${e.sidebarContent}
|
|
292
292
|
\`\`\``)}})}
|
|
293
293
|
</div>
|
|
294
|
-
`:
|
|
294
|
+
`:g}
|
|
295
295
|
</div>
|
|
296
296
|
|
|
297
|
-
${e.queue.length?
|
|
297
|
+
${e.queue.length?r`
|
|
298
298
|
<div class="chat-queue" role="status" aria-live="polite">
|
|
299
299
|
<div class="chat-queue__title">Queued (${e.queue.length})</div>
|
|
300
300
|
<div class="chat-queue__list">
|
|
301
|
-
${e.queue.map(v=>
|
|
301
|
+
${e.queue.map(v=>r`
|
|
302
302
|
<div class="chat-queue__item">
|
|
303
303
|
<div class="chat-queue__text">
|
|
304
304
|
${v.text||(v.attachments?.length?`Image (${v.attachments.length})`:"")}
|
|
@@ -309,16 +309,16 @@ ${e.sidebarContent}
|
|
|
309
309
|
aria-label="Remove queued message"
|
|
310
310
|
@click=${()=>e.onQueueRemove(v.id)}
|
|
311
311
|
>
|
|
312
|
-
${
|
|
312
|
+
${D.x}
|
|
313
313
|
</button>
|
|
314
314
|
</div>
|
|
315
315
|
`)}
|
|
316
316
|
</div>
|
|
317
317
|
</div>
|
|
318
|
-
`:
|
|
318
|
+
`:g}
|
|
319
319
|
|
|
320
320
|
<div class="chat-compose">
|
|
321
|
-
${
|
|
321
|
+
${Yp(e)}
|
|
322
322
|
<div class="chat-compose__row">
|
|
323
323
|
<label class="field chat-compose__field">
|
|
324
324
|
<span>Message</span>
|
|
@@ -327,7 +327,7 @@ ${e.sidebarContent}
|
|
|
327
327
|
?disabled=${!e.connected}
|
|
328
328
|
@keydown=${v=>{v.key==="Enter"&&(v.isComposing||v.keyCode===229||v.shiftKey||e.connected&&(v.preventDefault(),t&&e.onSend()))}}
|
|
329
329
|
@input=${v=>e.onDraftChange(v.target.value)}
|
|
330
|
-
@paste=${v=>
|
|
330
|
+
@paste=${v=>Vp(v,e)}
|
|
331
331
|
placeholder=${p}
|
|
332
332
|
></textarea>
|
|
333
333
|
</label>
|
|
@@ -350,78 +350,78 @@ ${e.sidebarContent}
|
|
|
350
350
|
</div>
|
|
351
351
|
</div>
|
|
352
352
|
</section>
|
|
353
|
-
`}const
|
|
353
|
+
`}const Ua=200;function Jp(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=er(s.message),a=ai(i.role),o=i.timestamp||Date.now();!n||n.role!==a?(n&&t.push(n),n={kind:"group",key:`group:${a}:${s.key}`,role:a,messages:[{message:s.message,key:s.key}],timestamp:o,isStreaming:!1}):n.messages.push({message:s.message,key:s.key})}return n&&t.push(n),t}function Zp(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Ua);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Ua} messages (${i} hidden).`,timestamp:Date.now()}});for(let a=i;a<n.length;a++){const o=n[a],c=er(o);!e.showThinking&&c.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:Ba(o,a),message:o})}if(e.showThinking)for(let a=0;a<s.length;a++)t.push({kind:"message",key:Ba(s[a],a+n.length),message:s[a]});if(e.stream!==null){const a=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:a,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:a})}return Jp(t)}function Ba(e,t){const n=e,s=typeof n.toolCallId=="string"?n.toolCallId:"";if(s)return`tool:${s}`;const i=typeof n.id=="string"?n.id:"";if(i)return`msg:${i}`;const a=typeof n.messageId=="string"?n.messageId:"";if(a)return`msg:${a}`;const o=typeof n.timestamp=="number"?n.timestamp:null,c=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${c}:${o}:${t}`:`msg:${c}:${t}`}function he(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function $r(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(he(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function _n(e){return e.filter(t=>typeof t=="string").join(".")}function se(e,t){const n=_n(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const c=a.split(".");if(c.length!==i.length)continue;let l=!0;for(let p=0;p<i.length;p+=1)if(c[p]!=="*"&&c[p]!==i[p]){l=!1;break}if(l)return o}}function Ae(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Xp(e){const t=_n(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}const eh=new Set(["title","description","default","nullable"]);function th(e){return Object.keys(e??{}).filter(n=>!eh.has(n)).length===0}function nh(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const Rt={chevronDown:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>`,plus:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>`,minus:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>`,trash:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>`,edit:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>`};function $e(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:c}=e,l=e.showLabel??!0,p=he(t),d=se(s,i),u=d?.label??t.title??Ae(String(s.at(-1))),f=d?.help??t.description,v=_n(s);if(a.has(v))return r`<div class="cfg-field cfg-field--error">
|
|
354
354
|
<div class="cfg-field__label">${u}</div>
|
|
355
355
|
<div class="cfg-field__error">Unsupported schema node. Use Raw mode.</div>
|
|
356
|
-
</div>`;if(t.anyOf||t.oneOf){const $=(t.anyOf??t.oneOf??[]).filter(C=>!(C.type==="null"||Array.isArray(C.type)&&C.type.includes("null")));if($.length===1)return
|
|
356
|
+
</div>`;if(t.anyOf||t.oneOf){const $=(t.anyOf??t.oneOf??[]).filter(C=>!(C.type==="null"||Array.isArray(C.type)&&C.type.includes("null")));if($.length===1)return $e({...e,schema:$[0]});const k=C=>{if(C.const!==void 0)return C.const;if(C.enum&&C.enum.length===1)return C.enum[0]},_=$.map(k),M=_.every(C=>C!==void 0);if(M&&_.length>0&&_.length<=5){const C=n??t.default;return r`
|
|
357
357
|
<div class="cfg-field">
|
|
358
|
-
${r
|
|
359
|
-
${
|
|
358
|
+
${l?r`<label class="cfg-field__label">${u}</label>`:g}
|
|
359
|
+
${f?r`<div class="cfg-field__help">${f}</div>`:g}
|
|
360
360
|
<div class="cfg-segmented">
|
|
361
|
-
${_.map((
|
|
361
|
+
${_.map((I,fe)=>r`
|
|
362
362
|
<button
|
|
363
363
|
type="button"
|
|
364
|
-
class="cfg-segmented__btn ${
|
|
364
|
+
class="cfg-segmented__btn ${I===C||String(I)===String(C)?"active":""}"
|
|
365
365
|
?disabled=${o}
|
|
366
|
-
@click=${()=>
|
|
366
|
+
@click=${()=>c(s,I)}
|
|
367
367
|
>
|
|
368
|
-
${String(
|
|
368
|
+
${String(I)}
|
|
369
369
|
</button>
|
|
370
370
|
`)}
|
|
371
371
|
</div>
|
|
372
372
|
</div>
|
|
373
|
-
`}if(
|
|
373
|
+
`}if(M&&_.length>5)return Ha({...e,options:_,value:n??t.default});const R=new Set($.map(C=>he(C)).filter(Boolean)),L=new Set([...R].map(C=>C==="integer"?"number":C));if([...L].every(C=>["string","number","boolean"].includes(C))){const C=L.has("string"),I=L.has("number");if(L.has("boolean")&&L.size===1)return $e({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(C||I)return Fa({...e,inputType:I&&!C?"number":"text"})}}if(t.enum){const m=t.enum;if(m.length<=5){const $=n??t.default;return r`
|
|
374
374
|
<div class="cfg-field">
|
|
375
|
-
${r
|
|
376
|
-
${
|
|
375
|
+
${l?r`<label class="cfg-field__label">${u}</label>`:g}
|
|
376
|
+
${f?r`<div class="cfg-field__help">${f}</div>`:g}
|
|
377
377
|
<div class="cfg-segmented">
|
|
378
|
-
${
|
|
378
|
+
${m.map(k=>r`
|
|
379
379
|
<button
|
|
380
380
|
type="button"
|
|
381
381
|
class="cfg-segmented__btn ${k===$||String(k)===String($)?"active":""}"
|
|
382
382
|
?disabled=${o}
|
|
383
|
-
@click=${()=>
|
|
383
|
+
@click=${()=>c(s,k)}
|
|
384
384
|
>
|
|
385
385
|
${String(k)}
|
|
386
386
|
</button>
|
|
387
387
|
`)}
|
|
388
388
|
</div>
|
|
389
389
|
</div>
|
|
390
|
-
`}return
|
|
390
|
+
`}return Ha({...e,options:m,value:n??t.default})}if(p==="object")return ih(e);if(p==="array")return ah(e);if(p==="boolean"){const m=typeof n=="boolean"?n:typeof t.default=="boolean"?t.default:!1;return r`
|
|
391
391
|
<label class="cfg-toggle-row ${o?"disabled":""}">
|
|
392
392
|
<div class="cfg-toggle-row__content">
|
|
393
393
|
<span class="cfg-toggle-row__label">${u}</span>
|
|
394
|
-
${
|
|
394
|
+
${f?r`<span class="cfg-toggle-row__help">${f}</span>`:g}
|
|
395
395
|
</div>
|
|
396
396
|
<div class="cfg-toggle">
|
|
397
397
|
<input
|
|
398
398
|
type="checkbox"
|
|
399
|
-
.checked=${
|
|
399
|
+
.checked=${m}
|
|
400
400
|
?disabled=${o}
|
|
401
|
-
@change=${$=>
|
|
401
|
+
@change=${$=>c(s,$.target.checked)}
|
|
402
402
|
/>
|
|
403
403
|
<span class="cfg-toggle__track"></span>
|
|
404
404
|
</div>
|
|
405
405
|
</label>
|
|
406
|
-
`}return p==="number"||p==="integer"?
|
|
406
|
+
`}return p==="number"||p==="integer"?sh(e):p==="string"?Fa({...e,inputType:"text"}):r`
|
|
407
407
|
<div class="cfg-field cfg-field--error">
|
|
408
408
|
<div class="cfg-field__label">${u}</div>
|
|
409
409
|
<div class="cfg-field__error">Unsupported type: ${p}. Use Raw mode.</div>
|
|
410
410
|
</div>
|
|
411
|
-
`}function
|
|
411
|
+
`}function Fa(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:c}=e,l=e.showLabel??!0,p=se(s,i),d=p?.label??t.title??Ae(String(s.at(-1))),u=p?.help??t.description,f=p?.sensitive??Xp(s),v=p?.placeholder??(f?"••••":t.default!==void 0?`Default: ${t.default}`:""),m=n??"";return r`
|
|
412
412
|
<div class="cfg-field">
|
|
413
|
-
${r
|
|
414
|
-
${u?
|
|
413
|
+
${l?r`<label class="cfg-field__label">${d}</label>`:g}
|
|
414
|
+
${u?r`<div class="cfg-field__help">${u}</div>`:g}
|
|
415
415
|
<div class="cfg-input-wrap">
|
|
416
416
|
<input
|
|
417
|
-
type=${
|
|
417
|
+
type=${f?"password":c}
|
|
418
418
|
class="cfg-input"
|
|
419
419
|
placeholder=${v}
|
|
420
|
-
.value=${
|
|
420
|
+
.value=${m==null?"":String(m)}
|
|
421
421
|
?disabled=${a}
|
|
422
|
-
@input=${$=>{const k=$.target.value;if(
|
|
422
|
+
@input=${$=>{const k=$.target.value;if(c==="number"){if(k.trim()===""){o(s,void 0);return}const _=Number(k);o(s,Number.isNaN(_)?k:_);return}o(s,k)}}
|
|
423
423
|
/>
|
|
424
|
-
${t.default!==void 0?
|
|
424
|
+
${t.default!==void 0?r`
|
|
425
425
|
<button
|
|
426
426
|
type="button"
|
|
427
427
|
class="cfg-input__reset"
|
|
@@ -429,97 +429,97 @@ ${e.sidebarContent}
|
|
|
429
429
|
?disabled=${a}
|
|
430
430
|
@click=${()=>o(s,t.default)}
|
|
431
431
|
>↺</button>
|
|
432
|
-
`:
|
|
432
|
+
`:g}
|
|
433
433
|
</div>
|
|
434
434
|
</div>
|
|
435
|
-
`}function
|
|
435
|
+
`}function sh(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,c=e.showLabel??!0,l=se(s,i),p=l?.label??t.title??Ae(String(s.at(-1))),d=l?.help??t.description,u=n??t.default??"",f=typeof u=="number"?u:0;return r`
|
|
436
436
|
<div class="cfg-field">
|
|
437
|
-
${
|
|
438
|
-
${d?
|
|
437
|
+
${c?r`<label class="cfg-field__label">${p}</label>`:g}
|
|
438
|
+
${d?r`<div class="cfg-field__help">${d}</div>`:g}
|
|
439
439
|
<div class="cfg-number">
|
|
440
440
|
<button
|
|
441
441
|
type="button"
|
|
442
442
|
class="cfg-number__btn"
|
|
443
443
|
?disabled=${a}
|
|
444
|
-
@click=${()=>o(s,
|
|
444
|
+
@click=${()=>o(s,f-1)}
|
|
445
445
|
>−</button>
|
|
446
446
|
<input
|
|
447
447
|
type="number"
|
|
448
448
|
class="cfg-number__input"
|
|
449
449
|
.value=${u==null?"":String(u)}
|
|
450
450
|
?disabled=${a}
|
|
451
|
-
@input=${v=>{const
|
|
451
|
+
@input=${v=>{const m=v.target.value,$=m===""?void 0:Number(m);o(s,$)}}
|
|
452
452
|
/>
|
|
453
453
|
<button
|
|
454
454
|
type="button"
|
|
455
455
|
class="cfg-number__btn"
|
|
456
456
|
?disabled=${a}
|
|
457
|
-
@click=${()=>o(s,
|
|
457
|
+
@click=${()=>o(s,f+1)}
|
|
458
458
|
>+</button>
|
|
459
459
|
</div>
|
|
460
460
|
</div>
|
|
461
|
-
`}function
|
|
461
|
+
`}function Ha(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:c}=e,l=e.showLabel??!0,p=se(s,i),d=p?.label??t.title??Ae(String(s.at(-1))),u=p?.help??t.description,f=n??t.default,v=o.findIndex($=>$===f||String($)===String(f)),m="__unset__";return r`
|
|
462
462
|
<div class="cfg-field">
|
|
463
|
-
${r
|
|
464
|
-
${u?
|
|
463
|
+
${l?r`<label class="cfg-field__label">${d}</label>`:g}
|
|
464
|
+
${u?r`<div class="cfg-field__help">${u}</div>`:g}
|
|
465
465
|
<select
|
|
466
466
|
class="cfg-select"
|
|
467
467
|
?disabled=${a}
|
|
468
|
-
.value=${v>=0?String(v):
|
|
469
|
-
@change=${$=>{const k=$.target.value;
|
|
468
|
+
.value=${v>=0?String(v):m}
|
|
469
|
+
@change=${$=>{const k=$.target.value;c(s,k===m?void 0:o[Number(k)])}}
|
|
470
470
|
>
|
|
471
|
-
<option value=${
|
|
472
|
-
${o.map(($,k)=>
|
|
471
|
+
<option value=${m}>Select...</option>
|
|
472
|
+
${o.map(($,k)=>r`
|
|
473
473
|
<option value=${String(k)}>${String($)}</option>
|
|
474
474
|
`)}
|
|
475
475
|
</select>
|
|
476
476
|
</div>
|
|
477
|
-
`}function
|
|
477
|
+
`}function ih(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:c}=e;e.showLabel;const l=se(s,i),p=l?.label??t.title??Ae(String(s.at(-1))),d=l?.help??t.description,u=n??t.default,f=u&&typeof u=="object"&&!Array.isArray(u)?u:{},v=t.properties??{},$=Object.entries(v).sort((R,L)=>{const C=se([...s,R[0]],i)?.order??0,I=se([...s,L[0]],i)?.order??0;return C!==I?C-I:R[0].localeCompare(L[0])}),k=new Set(Object.keys(v)),_=t.additionalProperties,M=!!_&&typeof _=="object";return s.length===1?r`
|
|
478
478
|
<div class="cfg-fields">
|
|
479
|
-
${$.map(([
|
|
480
|
-
${
|
|
479
|
+
${$.map(([R,L])=>$e({schema:L,value:f[R],path:[...s,R],hints:i,unsupported:a,disabled:o,onPatch:c}))}
|
|
480
|
+
${M?Ka({schema:_,value:f,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:k,onPatch:c}):g}
|
|
481
481
|
</div>
|
|
482
|
-
`:
|
|
482
|
+
`:r`
|
|
483
483
|
<details class="cfg-object" open>
|
|
484
484
|
<summary class="cfg-object__header">
|
|
485
485
|
<span class="cfg-object__title">${p}</span>
|
|
486
|
-
<span class="cfg-object__chevron">${
|
|
486
|
+
<span class="cfg-object__chevron">${Rt.chevronDown}</span>
|
|
487
487
|
</summary>
|
|
488
|
-
${d?
|
|
488
|
+
${d?r`<div class="cfg-object__help">${d}</div>`:g}
|
|
489
489
|
<div class="cfg-object__content">
|
|
490
|
-
${$.map(([
|
|
491
|
-
${
|
|
490
|
+
${$.map(([R,L])=>$e({schema:L,value:f[R],path:[...s,R],hints:i,unsupported:a,disabled:o,onPatch:c}))}
|
|
491
|
+
${M?Ka({schema:_,value:f,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:k,onPatch:c}):g}
|
|
492
492
|
</div>
|
|
493
493
|
</details>
|
|
494
|
-
`}function
|
|
494
|
+
`}function ah(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:c}=e,l=e.showLabel??!0,p=se(s,i),d=p?.label??t.title??Ae(String(s.at(-1))),u=p?.help??t.description,f=Array.isArray(t.items)?t.items[0]:t.items;if(!f)return r`
|
|
495
495
|
<div class="cfg-field cfg-field--error">
|
|
496
496
|
<div class="cfg-field__label">${d}</div>
|
|
497
497
|
<div class="cfg-field__error">Unsupported array schema. Use Raw mode.</div>
|
|
498
498
|
</div>
|
|
499
|
-
`;const v=Array.isArray(n)?n:Array.isArray(t.default)?t.default:[];return
|
|
499
|
+
`;const v=Array.isArray(n)?n:Array.isArray(t.default)?t.default:[];return r`
|
|
500
500
|
<div class="cfg-array">
|
|
501
501
|
<div class="cfg-array__header">
|
|
502
|
-
${r
|
|
502
|
+
${l?r`<span class="cfg-array__label">${d}</span>`:g}
|
|
503
503
|
<span class="cfg-array__count">${v.length} item${v.length!==1?"s":""}</span>
|
|
504
504
|
<button
|
|
505
505
|
type="button"
|
|
506
506
|
class="cfg-array__add"
|
|
507
507
|
?disabled=${o}
|
|
508
|
-
@click=${()=>{const
|
|
508
|
+
@click=${()=>{const m=[...v,$r(f)];c(s,m)}}
|
|
509
509
|
>
|
|
510
|
-
<span class="cfg-array__add-icon">${
|
|
510
|
+
<span class="cfg-array__add-icon">${Rt.plus}</span>
|
|
511
511
|
Add
|
|
512
512
|
</button>
|
|
513
513
|
</div>
|
|
514
|
-
${u?
|
|
514
|
+
${u?r`<div class="cfg-array__help">${u}</div>`:g}
|
|
515
515
|
|
|
516
|
-
${v.length===0?
|
|
516
|
+
${v.length===0?r`
|
|
517
517
|
<div class="cfg-array__empty">
|
|
518
518
|
No items yet. Click "Add" to create one.
|
|
519
519
|
</div>
|
|
520
|
-
`:
|
|
520
|
+
`:r`
|
|
521
521
|
<div class="cfg-array__items">
|
|
522
|
-
${v.map((
|
|
522
|
+
${v.map((m,$)=>r`
|
|
523
523
|
<div class="cfg-array__item">
|
|
524
524
|
<div class="cfg-array__item-header">
|
|
525
525
|
<span class="cfg-array__item-index">#${$+1}</span>
|
|
@@ -528,20 +528,20 @@ ${e.sidebarContent}
|
|
|
528
528
|
class="cfg-array__item-remove"
|
|
529
529
|
title="Remove item"
|
|
530
530
|
?disabled=${o}
|
|
531
|
-
@click=${()=>{const k=[...v];k.splice($,1),
|
|
531
|
+
@click=${()=>{const k=[...v];k.splice($,1),c(s,k)}}
|
|
532
532
|
>
|
|
533
|
-
${
|
|
533
|
+
${Rt.trash}
|
|
534
534
|
</button>
|
|
535
535
|
</div>
|
|
536
536
|
<div class="cfg-array__item-content">
|
|
537
|
-
${
|
|
537
|
+
${$e({schema:f,value:m,path:[...s,$],hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:c})}
|
|
538
538
|
</div>
|
|
539
539
|
</div>
|
|
540
540
|
`)}
|
|
541
541
|
</div>
|
|
542
542
|
`}
|
|
543
543
|
</div>
|
|
544
|
-
`}function
|
|
544
|
+
`}function Ka(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:c,onPatch:l}=e,p=th(t),d=Object.entries(n??{}).filter(([u])=>!c.has(u));return r`
|
|
545
545
|
<div class="cfg-map">
|
|
546
546
|
<div class="cfg-map__header">
|
|
547
547
|
<span class="cfg-map__label">Custom entries</span>
|
|
@@ -549,18 +549,18 @@ ${e.sidebarContent}
|
|
|
549
549
|
type="button"
|
|
550
550
|
class="cfg-map__add"
|
|
551
551
|
?disabled=${o}
|
|
552
|
-
@click=${()=>{const u={...n??{}};let
|
|
552
|
+
@click=${()=>{const u={...n??{}};let f=1,v=`custom-${f}`;for(;v in u;)f+=1,v=`custom-${f}`;u[v]=p?{}:$r(t),l(s,u)}}
|
|
553
553
|
>
|
|
554
|
-
<span class="cfg-map__add-icon">${
|
|
554
|
+
<span class="cfg-map__add-icon">${Rt.plus}</span>
|
|
555
555
|
Add Entry
|
|
556
556
|
</button>
|
|
557
557
|
</div>
|
|
558
558
|
|
|
559
|
-
${d.length===0?
|
|
559
|
+
${d.length===0?r`
|
|
560
560
|
<div class="cfg-map__empty">No custom entries.</div>
|
|
561
|
-
`:
|
|
561
|
+
`:r`
|
|
562
562
|
<div class="cfg-map__items">
|
|
563
|
-
${d.map(([u,
|
|
563
|
+
${d.map(([u,f])=>{const v=[...s,u],m=nh(f);return r`
|
|
564
564
|
<div class="cfg-map__item">
|
|
565
565
|
<div class="cfg-map__item-key">
|
|
566
566
|
<input
|
|
@@ -569,73 +569,73 @@ ${e.sidebarContent}
|
|
|
569
569
|
placeholder="Key"
|
|
570
570
|
.value=${u}
|
|
571
571
|
?disabled=${o}
|
|
572
|
-
@change=${$=>{const k=$.target.value.trim();if(!k||k===u)return;const _={...n??{}};k in _||(_[k]=_[u],delete _[u],
|
|
572
|
+
@change=${$=>{const k=$.target.value.trim();if(!k||k===u)return;const _={...n??{}};k in _||(_[k]=_[u],delete _[u],l(s,_))}}
|
|
573
573
|
/>
|
|
574
574
|
</div>
|
|
575
575
|
<div class="cfg-map__item-value">
|
|
576
|
-
${p?
|
|
576
|
+
${p?r`
|
|
577
577
|
<textarea
|
|
578
578
|
class="cfg-textarea cfg-textarea--sm"
|
|
579
579
|
placeholder="JSON value"
|
|
580
580
|
rows="2"
|
|
581
|
-
.value=${
|
|
581
|
+
.value=${m}
|
|
582
582
|
?disabled=${o}
|
|
583
|
-
@change=${$=>{const k=$.target,_=k.value.trim();if(!_){
|
|
583
|
+
@change=${$=>{const k=$.target,_=k.value.trim();if(!_){l(v,void 0);return}try{l(v,JSON.parse(_))}catch{k.value=m}}}
|
|
584
584
|
></textarea>
|
|
585
|
-
|
|
585
|
+
`:$e({schema:t,value:f,path:v,hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:l})}
|
|
586
586
|
</div>
|
|
587
587
|
<button
|
|
588
588
|
type="button"
|
|
589
589
|
class="cfg-map__item-remove"
|
|
590
590
|
title="Remove entry"
|
|
591
591
|
?disabled=${o}
|
|
592
|
-
@click=${()=>{const $={...n??{}};delete $[u],
|
|
592
|
+
@click=${()=>{const $={...n??{}};delete $[u],l(s,$)}}
|
|
593
593
|
>
|
|
594
|
-
${
|
|
594
|
+
${Rt.trash}
|
|
595
595
|
</button>
|
|
596
596
|
</div>
|
|
597
597
|
`})}
|
|
598
598
|
</div>
|
|
599
599
|
`}
|
|
600
600
|
</div>
|
|
601
|
-
`}const Da={env:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},di={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 Ba(e){return Da[e]??Da.default}function Vp(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=di[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:mt(t,s)}function mt(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||mt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&mt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&mt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&mt(s,t))return!0}return!1}function Gp(e){if(!e.schema)return c`<div class="muted">Schema unavailable.</div>`;const t=e.schema,n=e.value??{};if(ue(t)!=="object"||!t.properties)return c`<div class="callout danger">Unsupported schema. Use Raw.</div>`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,l=e.activeSubsection??null,p=Object.entries(i).sort((u,g)=>{const v=te([u[0]],e.uiHints)?.order??50,w=te([g[0]],e.uiHints)?.order??50;return v!==w?v-w:u[0].localeCompare(g[0])}).filter(([u,g])=>!(o&&u!==o||a&&!Vp(u,g,a)));let d=null;if(o&&l&&p.length===1){const u=p[0]?.[1];u&&ue(u)==="object"&&u.properties&&u.properties[l]&&(d={sectionKey:o,subsectionKey:l,schema:u.properties[l]})}return p.length===0?c`
|
|
601
|
+
`}const za={env:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},vi={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 ja(e){return za[e]??za.default}function oh(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=vi[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:At(t,s)}function At(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||At(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&At(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&At(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&At(s,t))return!0}return!1}function rh(e){if(!e.schema)return r`<div class="muted">Schema unavailable.</div>`;const t=e.schema,n=e.value??{};if(he(t)!=="object"||!t.properties)return r`<div class="callout danger">Unsupported schema. Use Raw.</div>`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,c=e.activeSubsection??null,p=Object.entries(i).sort((u,f)=>{const v=se([u[0]],e.uiHints)?.order??50,m=se([f[0]],e.uiHints)?.order??50;return v!==m?v-m:u[0].localeCompare(f[0])}).filter(([u,f])=>!(o&&u!==o||a&&!oh(u,f,a)));let d=null;if(o&&c&&p.length===1){const u=p[0]?.[1];u&&he(u)==="object"&&u.properties&&u.properties[c]&&(d={sectionKey:o,subsectionKey:c,schema:u.properties[c]})}return p.length===0?r`
|
|
602
602
|
<div class="config-empty">
|
|
603
|
-
<div class="config-empty__icon">${
|
|
603
|
+
<div class="config-empty__icon">${D.search}</div>
|
|
604
604
|
<div class="config-empty__text">
|
|
605
605
|
${a?`No settings match "${a}"`:"No settings in this section"}
|
|
606
606
|
</div>
|
|
607
607
|
</div>
|
|
608
|
-
`:
|
|
608
|
+
`:r`
|
|
609
609
|
<div class="config-form config-form--modern">
|
|
610
|
-
${d?(()=>{const{sectionKey:u,subsectionKey:
|
|
611
|
-
<section class="config-section-card" id=${
|
|
610
|
+
${d?(()=>{const{sectionKey:u,subsectionKey:f,schema:v}=d,m=se([u,f],e.uiHints),$=m?.label??v.title??Ae(f),k=m?.help??v.description??"",_=n[u],M=_&&typeof _=="object"?_[f]:void 0,R=`config-section-${u}-${f}`;return r`
|
|
611
|
+
<section class="config-section-card" id=${R}>
|
|
612
612
|
<div class="config-section-card__header">
|
|
613
|
-
<span class="config-section-card__icon">${
|
|
613
|
+
<span class="config-section-card__icon">${ja(u)}</span>
|
|
614
614
|
<div class="config-section-card__titles">
|
|
615
615
|
<h3 class="config-section-card__title">${$}</h3>
|
|
616
|
-
${k?
|
|
616
|
+
${k?r`<p class="config-section-card__desc">${k}</p>`:g}
|
|
617
617
|
</div>
|
|
618
618
|
</div>
|
|
619
619
|
<div class="config-section-card__content">
|
|
620
|
-
${
|
|
620
|
+
${$e({schema:v,value:M,path:[u,f],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
|
|
621
621
|
</div>
|
|
622
622
|
</section>
|
|
623
|
-
`})():p.map(([u,
|
|
623
|
+
`})():p.map(([u,f])=>{const v=vi[u]??{label:u.charAt(0).toUpperCase()+u.slice(1),description:f.description??""};return r`
|
|
624
624
|
<section class="config-section-card" id="config-section-${u}">
|
|
625
625
|
<div class="config-section-card__header">
|
|
626
|
-
<span class="config-section-card__icon">${
|
|
626
|
+
<span class="config-section-card__icon">${ja(u)}</span>
|
|
627
627
|
<div class="config-section-card__titles">
|
|
628
628
|
<h3 class="config-section-card__title">${v.label}</h3>
|
|
629
|
-
${v.description?
|
|
629
|
+
${v.description?r`<p class="config-section-card__desc">${v.description}</p>`:g}
|
|
630
630
|
</div>
|
|
631
631
|
</div>
|
|
632
632
|
<div class="config-section-card__content">
|
|
633
|
-
${
|
|
633
|
+
${$e({schema:f,value:n[u],path:[u],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
|
|
634
634
|
</div>
|
|
635
635
|
</section>
|
|
636
636
|
`})}
|
|
637
637
|
</div>
|
|
638
|
-
`}const Yp=new Set(["title","description","default","nullable"]);function Qp(e){return Object.keys(e??{}).filter(n=>!Yp.has(n)).length===0}function vr(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function mr(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:wt(e,[])}function wt(e,t){const n=new Set,s={...e},i=$n(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const l=Zp(e,t);return l||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=ue(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:l,nullable:r}=vr(s.enum);s.enum=l,r&&(s.nullable=!0),l.length===0&&n.add(i)}if(o==="object"){const l=e.properties??{},r={};for(const[p,d]of Object.entries(l)){const u=wt(d,[...t,p]);u.schema&&(r[p]=u.schema);for(const g of u.unsupportedPaths)n.add(g)}if(s.properties=r,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!Qp(e.additionalProperties)){const p=wt(e.additionalProperties,[...t,"*"]);s.additionalProperties=p.schema??e.additionalProperties,p.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const l=Array.isArray(e.items)?e.items[0]:e.items;if(!l)n.add(i);else{const r=wt(l,[...t,"*"]);s.items=r.schema??l,r.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function Zp(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const l of n){if(!l||typeof l!="object")return null;if(Array.isArray(l.enum)){const{enumValues:r,nullable:p}=vr(l.enum);s.push(...r),p&&(a=!0);continue}if("const"in l){if(l.const==null){a=!0;continue}s.push(l.const);continue}if(ue(l)==="null"){a=!0;continue}i.push(l)}if(s.length>0&&i.length===0){const l=[];for(const r of s)l.some(p=>Object.is(p,r))||l.push(r);return{schema:{...e,enum:l,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const l=wt(i[0],t);return l.schema&&(l.schema.nullable=a||l.schema.nullable),l}const o=["string","number","integer","boolean"];return i.length>0&&s.length===0&&i.every(l=>l.type&&o.includes(String(l.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}const Ts={all:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>`,env:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},Fa=[{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"}],Ua="__all__";function Ka(e){return Ts[e]??Ts.default}function Jp(e,t){const n=di[e];return n||{label:t?.title??we(e),description:t?.description??""}}function Xp(e){const{key:t,schema:n,uiHints:s}=e;if(!n||ue(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const l=te([t,a],s),r=l?.label??o.title??we(a),p=l?.help??o.description??"",d=l?.order??50;return{key:a,label:r,description:p,order:d}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function eh(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const l=i,r=a,p=new Set([...Object.keys(l),...Object.keys(r)]);for(const d of p)s(l[d],r[d],o?`${o}.${d}`:d)}return s(e,t,""),n}function Ha(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 th(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=mr(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=Fa.filter(E=>E.key in i),o=new Set(Fa.map(E=>E.key)),l=Object.keys(i).filter(E=>!o.has(E)).map(E=>({key:E,label:E.charAt(0).toUpperCase()+E.slice(1)})),r=[...a,...l],p=e.activeSection&&n.schema&&ue(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,d=e.activeSection?Jp(e.activeSection,p):null,u=e.activeSection?Xp({key:e.activeSection,schema:p,uiHints:e.uiHints}):[],g=e.formMode==="form"&&!!e.activeSection&&u.length>0,v=e.activeSubsection===Ua,w=e.searchQuery||v?null:e.activeSubsection??u[0]?.key??null,$=e.formMode==="form"?eh(e.originalValue,e.formValue):[],k=e.formMode==="raw"&&e.raw!==e.originalRaw,_=e.formMode==="form"?$.length>0:k,L=!!e.formValue&&!e.loading&&!!n.schema,P=e.connected&&!e.saving&&_&&(e.formMode==="raw"?!0:L),M=e.connected&&!e.applying&&!e.updating&&_&&(e.formMode==="raw"?!0:L),C=e.connected&&!e.applying&&!e.updating;return c`
|
|
638
|
+
`}const lh=new Set(["title","description","default","nullable"]);function ch(e){return Object.keys(e??{}).filter(n=>!lh.has(n)).length===0}function Ar(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function kr(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:St(e,[])}function St(e,t){const n=new Set,s={...e},i=_n(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const c=dh(e,t);return c||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=he(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:c,nullable:l}=Ar(s.enum);s.enum=c,l&&(s.nullable=!0),c.length===0&&n.add(i)}if(o==="object"){const c=e.properties??{},l={};for(const[p,d]of Object.entries(c)){const u=St(d,[...t,p]);u.schema&&(l[p]=u.schema);for(const f of u.unsupportedPaths)n.add(f)}if(s.properties=l,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!ch(e.additionalProperties)){const p=St(e.additionalProperties,[...t,"*"]);s.additionalProperties=p.schema??e.additionalProperties,p.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const c=Array.isArray(e.items)?e.items[0]:e.items;if(!c)n.add(i);else{const l=St(c,[...t,"*"]);s.items=l.schema??c,l.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function dh(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const c of n){if(!c||typeof c!="object")return null;if(Array.isArray(c.enum)){const{enumValues:l,nullable:p}=Ar(c.enum);s.push(...l),p&&(a=!0);continue}if("const"in c){if(c.const==null){a=!0;continue}s.push(c.const);continue}if(he(c)==="null"){a=!0;continue}i.push(c)}if(s.length>0&&i.length===0){const c=[];for(const l of s)c.some(p=>Object.is(p,l))||c.push(l);return{schema:{...e,enum:c,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const c=St(i[0],t);return c.schema&&(c.schema.nullable=a||c.schema.nullable),c}const o=["string","number","integer","boolean"];return i.length>0&&s.length===0&&i.every(c=>c.type&&o.includes(String(c.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}const Ls={all:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>`,env:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},qa=[{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"}],Wa="__all__";function Ga(e){return Ls[e]??Ls.default}function uh(e,t){const n=vi[e];return n||{label:t?.title??Ae(e),description:t?.description??""}}function ph(e){const{key:t,schema:n,uiHints:s}=e;if(!n||he(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const c=se([t,a],s),l=c?.label??o.title??Ae(a),p=c?.help??o.description??"",d=c?.order??50;return{key:a,label:l,description:p,order:d}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function hh(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const c=i,l=a,p=new Set([...Object.keys(c),...Object.keys(l)]);for(const d of p)s(c[d],l[d],o?`${o}.${d}`:d)}return s(e,t,""),n}function Va(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 fh(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=kr(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=qa.filter(I=>I.key in i),o=new Set(qa.map(I=>I.key)),c=Object.keys(i).filter(I=>!o.has(I)).map(I=>({key:I,label:I.charAt(0).toUpperCase()+I.slice(1)})),l=[...a,...c],p=e.activeSection&&n.schema&&he(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,d=e.activeSection?uh(e.activeSection,p):null,u=e.activeSection?ph({key:e.activeSection,schema:p,uiHints:e.uiHints}):[],f=e.formMode==="form"&&!!e.activeSection&&u.length>0,v=e.activeSubsection===Wa,m=e.searchQuery||v?null:e.activeSubsection??u[0]?.key??null,$=e.formMode==="form"?hh(e.originalValue,e.formValue):[],k=e.formMode==="raw"&&e.raw!==e.originalRaw,_=e.formMode==="form"?$.length>0:k,M=!!e.formValue&&!e.loading&&!!n.schema,R=e.connected&&!e.saving&&_&&(e.formMode==="raw"?!0:M),L=e.connected&&!e.applying&&!e.updating&&_&&(e.formMode==="raw"?!0:M),C=e.connected&&!e.applying&&!e.updating;return r`
|
|
639
639
|
<div class="config-layout">
|
|
640
640
|
<!-- Sidebar -->
|
|
641
641
|
<aside class="config-sidebar">
|
|
@@ -655,14 +655,14 @@ ${e.sidebarContent}
|
|
|
655
655
|
class="config-search__input"
|
|
656
656
|
placeholder="Search settings..."
|
|
657
657
|
.value=${e.searchQuery}
|
|
658
|
-
@input=${
|
|
658
|
+
@input=${I=>e.onSearchChange(I.target.value)}
|
|
659
659
|
/>
|
|
660
|
-
${e.searchQuery?
|
|
660
|
+
${e.searchQuery?r`
|
|
661
661
|
<button
|
|
662
662
|
class="config-search__clear"
|
|
663
663
|
@click=${()=>e.onSearchChange("")}
|
|
664
664
|
>×</button>
|
|
665
|
-
`:
|
|
665
|
+
`:g}
|
|
666
666
|
</div>
|
|
667
667
|
|
|
668
668
|
<!-- Section nav -->
|
|
@@ -671,16 +671,16 @@ ${e.sidebarContent}
|
|
|
671
671
|
class="config-nav__item ${e.activeSection===null?"active":""}"
|
|
672
672
|
@click=${()=>e.onSectionChange(null)}
|
|
673
673
|
>
|
|
674
|
-
<span class="config-nav__icon">${
|
|
674
|
+
<span class="config-nav__icon">${Ls.all}</span>
|
|
675
675
|
<span class="config-nav__label">All Settings</span>
|
|
676
676
|
</button>
|
|
677
|
-
${
|
|
677
|
+
${l.map(I=>r`
|
|
678
678
|
<button
|
|
679
|
-
class="config-nav__item ${e.activeSection===
|
|
680
|
-
@click=${()=>e.onSectionChange(
|
|
679
|
+
class="config-nav__item ${e.activeSection===I.key?"active":""}"
|
|
680
|
+
@click=${()=>e.onSectionChange(I.key)}
|
|
681
681
|
>
|
|
682
|
-
<span class="config-nav__icon">${
|
|
683
|
-
<span class="config-nav__label">${
|
|
682
|
+
<span class="config-nav__icon">${Ga(I.key)}</span>
|
|
683
|
+
<span class="config-nav__label">${I.label}</span>
|
|
684
684
|
</button>
|
|
685
685
|
`)}
|
|
686
686
|
</nav>
|
|
@@ -710,9 +710,9 @@ ${e.sidebarContent}
|
|
|
710
710
|
<!-- Action bar -->
|
|
711
711
|
<div class="config-actions">
|
|
712
712
|
<div class="config-actions__left">
|
|
713
|
-
${_?
|
|
713
|
+
${_?r`
|
|
714
714
|
<span class="config-changes-badge">${e.formMode==="raw"?"Unsaved changes":`${$.length} unsaved change${$.length!==1?"s":""}`}</span>
|
|
715
|
-
`:
|
|
715
|
+
`:r`
|
|
716
716
|
<span class="config-status muted">No changes</span>
|
|
717
717
|
`}
|
|
718
718
|
</div>
|
|
@@ -722,14 +722,14 @@ ${e.sidebarContent}
|
|
|
722
722
|
</button>
|
|
723
723
|
<button
|
|
724
724
|
class="btn btn--sm primary"
|
|
725
|
-
?disabled=${!
|
|
725
|
+
?disabled=${!R}
|
|
726
726
|
@click=${e.onSave}
|
|
727
727
|
>
|
|
728
728
|
${e.saving?"Saving…":"Save"}
|
|
729
729
|
</button>
|
|
730
730
|
<button
|
|
731
731
|
class="btn btn--sm"
|
|
732
|
-
?disabled=${!
|
|
732
|
+
?disabled=${!L}
|
|
733
733
|
@click=${e.onApply}
|
|
734
734
|
>
|
|
735
735
|
${e.applying?"Applying…":"Apply"}
|
|
@@ -745,7 +745,7 @@ ${e.sidebarContent}
|
|
|
745
745
|
</div>
|
|
746
746
|
|
|
747
747
|
<!-- Diff panel (form mode only - raw mode doesn't have granular diff) -->
|
|
748
|
-
${_&&e.formMode==="form"?
|
|
748
|
+
${_&&e.formMode==="form"?r`
|
|
749
749
|
<details class="config-diff">
|
|
750
750
|
<summary class="config-diff__summary">
|
|
751
751
|
<span>View ${$.length} pending change${$.length!==1?"s":""}</span>
|
|
@@ -754,84 +754,84 @@ ${e.sidebarContent}
|
|
|
754
754
|
</svg>
|
|
755
755
|
</summary>
|
|
756
756
|
<div class="config-diff__content">
|
|
757
|
-
${$.map(
|
|
757
|
+
${$.map(I=>r`
|
|
758
758
|
<div class="config-diff__item">
|
|
759
|
-
<div class="config-diff__path">${
|
|
759
|
+
<div class="config-diff__path">${I.path}</div>
|
|
760
760
|
<div class="config-diff__values">
|
|
761
|
-
<span class="config-diff__from">${
|
|
761
|
+
<span class="config-diff__from">${Va(I.from)}</span>
|
|
762
762
|
<span class="config-diff__arrow">→</span>
|
|
763
|
-
<span class="config-diff__to">${
|
|
763
|
+
<span class="config-diff__to">${Va(I.to)}</span>
|
|
764
764
|
</div>
|
|
765
765
|
</div>
|
|
766
766
|
`)}
|
|
767
767
|
</div>
|
|
768
768
|
</details>
|
|
769
|
-
`:
|
|
769
|
+
`:g}
|
|
770
770
|
|
|
771
|
-
${d&&e.formMode==="form"?
|
|
771
|
+
${d&&e.formMode==="form"?r`
|
|
772
772
|
<div class="config-section-hero">
|
|
773
|
-
<div class="config-section-hero__icon">${
|
|
773
|
+
<div class="config-section-hero__icon">${Ga(e.activeSection??"")}</div>
|
|
774
774
|
<div class="config-section-hero__text">
|
|
775
775
|
<div class="config-section-hero__title">${d.label}</div>
|
|
776
|
-
${d.description?
|
|
776
|
+
${d.description?r`<div class="config-section-hero__desc">${d.description}</div>`:g}
|
|
777
777
|
</div>
|
|
778
778
|
</div>
|
|
779
|
-
`:
|
|
779
|
+
`:g}
|
|
780
780
|
|
|
781
|
-
${
|
|
781
|
+
${f?r`
|
|
782
782
|
<div class="config-subnav">
|
|
783
783
|
<button
|
|
784
|
-
class="config-subnav__item ${
|
|
785
|
-
@click=${()=>e.onSubsectionChange(
|
|
784
|
+
class="config-subnav__item ${m===null?"active":""}"
|
|
785
|
+
@click=${()=>e.onSubsectionChange(Wa)}
|
|
786
786
|
>
|
|
787
787
|
All
|
|
788
788
|
</button>
|
|
789
|
-
${u.map(
|
|
789
|
+
${u.map(I=>r`
|
|
790
790
|
<button
|
|
791
|
-
class="config-subnav__item ${
|
|
792
|
-
title=${
|
|
793
|
-
@click=${()=>e.onSubsectionChange(
|
|
791
|
+
class="config-subnav__item ${m===I.key?"active":""}"
|
|
792
|
+
title=${I.description||I.label}
|
|
793
|
+
@click=${()=>e.onSubsectionChange(I.key)}
|
|
794
794
|
>
|
|
795
|
-
${
|
|
795
|
+
${I.label}
|
|
796
796
|
</button>
|
|
797
797
|
`)}
|
|
798
798
|
</div>
|
|
799
|
-
`:
|
|
799
|
+
`:g}
|
|
800
800
|
|
|
801
801
|
<!-- Form content -->
|
|
802
802
|
<div class="config-content">
|
|
803
|
-
${e.formMode==="form"?
|
|
804
|
-
${e.schemaLoading?
|
|
803
|
+
${e.formMode==="form"?r`
|
|
804
|
+
${e.schemaLoading?r`<div class="config-loading">
|
|
805
805
|
<div class="config-loading__spinner"></div>
|
|
806
806
|
<span>Loading schema…</span>
|
|
807
|
-
</div>`:
|
|
808
|
-
${s?
|
|
807
|
+
</div>`:rh({schema:n.schema,uiHints:e.uiHints,value:e.formValue,disabled:e.loading||!e.formValue,unsupportedPaths:n.unsupportedPaths,onPatch:e.onFormPatch,searchQuery:e.searchQuery,activeSection:e.activeSection,activeSubsection:m})}
|
|
808
|
+
${s?r`<div class="callout danger" style="margin-top: 12px;">
|
|
809
809
|
Form view can't safely edit some fields.
|
|
810
810
|
Use Raw to avoid losing config entries.
|
|
811
|
-
</div>`:
|
|
812
|
-
`:
|
|
811
|
+
</div>`:g}
|
|
812
|
+
`:r`
|
|
813
813
|
<label class="field config-raw-field">
|
|
814
814
|
<span>Raw JSON5</span>
|
|
815
815
|
<textarea
|
|
816
816
|
.value=${e.raw}
|
|
817
|
-
@input=${
|
|
817
|
+
@input=${I=>e.onRawChange(I.target.value)}
|
|
818
818
|
></textarea>
|
|
819
819
|
</label>
|
|
820
820
|
`}
|
|
821
821
|
</div>
|
|
822
822
|
|
|
823
|
-
${e.issues.length>0?
|
|
823
|
+
${e.issues.length>0?r`<div class="callout danger" style="margin-top: 12px;">
|
|
824
824
|
<pre class="code-block">${JSON.stringify(e.issues,null,2)}</pre>
|
|
825
|
-
</div>`:
|
|
825
|
+
</div>`:g}
|
|
826
826
|
</main>
|
|
827
827
|
</div>
|
|
828
|
-
`}function
|
|
828
|
+
`}function gh(e){if(!e&&e!==0)return"n/a";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function vh(e,t){const n=t.snapshot,s=n?.channels;if(!n||!s)return!1;const i=s[e],a=typeof i?.configured=="boolean"&&i.configured,o=typeof i?.running=="boolean"&&i.running,c=typeof i?.connected=="boolean"&&i.connected,p=(n.channelAccounts?.[e]??[]).some(d=>d.configured||d.running||d.connected);return a||o||c||p}function mh(e,t){return t?.[e]?.length??0}function xr(e,t){const n=mh(e,t);return n<2?g:r`<div class="account-count">Accounts (${n})</div>`}function bh(e,t){let n=e;for(const s of t){if(!n)return null;const i=he(n);if(i==="object"){const a=n.properties??{};if(typeof s=="string"&&a[s]){n=a[s];continue}const o=n.additionalProperties;if(typeof s=="string"&&o&&typeof o=="object"){n=o;continue}return null}if(i==="array"){if(typeof s!="number")return null;n=(Array.isArray(n.items)?n.items[0]:n.items)??null;continue}return null}return n}function yh(e,t){const s=(e.channels??{})[t],i=e[t];return(s&&typeof s=="object"?s:null)??(i&&typeof i=="object"?i:null)??{}}function wh(e){const t=kr(e.schema),n=t.schema;if(!n)return r`<div class="callout danger">Schema unavailable. Use Raw.</div>`;const s=bh(n,["channels",e.channelId]);if(!s)return r`<div class="callout danger">Channel config schema unavailable.</div>`;const i=e.configValue??{},a=yh(i,e.channelId);return r`
|
|
829
829
|
<div class="config-form">
|
|
830
|
-
${
|
|
830
|
+
${$e({schema:s,value:a,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
|
|
831
831
|
</div>
|
|
832
|
-
`}function
|
|
832
|
+
`}function ke(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return r`
|
|
833
833
|
<div style="margin-top: 16px;">
|
|
834
|
-
${n.configSchemaLoading?
|
|
834
|
+
${n.configSchemaLoading?r`<div class="muted">Loading config schema…</div>`:wh({channelId:t,configValue:n.configForm,schema:n.configSchema,uiHints:n.configUiHints,disabled:s,onPatch:n.onConfigPatch})}
|
|
835
835
|
<div class="row" style="margin-top: 12px;">
|
|
836
836
|
<button
|
|
837
837
|
class="btn primary"
|
|
@@ -849,7 +849,7 @@ ${e.sidebarContent}
|
|
|
849
849
|
</button>
|
|
850
850
|
</div>
|
|
851
851
|
</div>
|
|
852
|
-
`}function
|
|
852
|
+
`}function $h(e){const{props:t,discord:n,accountCountLabel:s}=e;return r`
|
|
853
853
|
<div class="card">
|
|
854
854
|
<div class="card-title">Discord</div>
|
|
855
855
|
<div class="card-sub">Bot status and channel configuration.</div>
|
|
@@ -866,24 +866,24 @@ ${e.sidebarContent}
|
|
|
866
866
|
</div>
|
|
867
867
|
<div>
|
|
868
868
|
<span class="label">Last start</span>
|
|
869
|
-
<span>${n?.lastStartAt?
|
|
869
|
+
<span>${n?.lastStartAt?B(n.lastStartAt):"n/a"}</span>
|
|
870
870
|
</div>
|
|
871
871
|
<div>
|
|
872
872
|
<span class="label">Last probe</span>
|
|
873
|
-
<span>${n?.lastProbeAt?
|
|
873
|
+
<span>${n?.lastProbeAt?B(n.lastProbeAt):"n/a"}</span>
|
|
874
874
|
</div>
|
|
875
875
|
</div>
|
|
876
876
|
|
|
877
|
-
${n?.lastError?
|
|
877
|
+
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
878
878
|
${n.lastError}
|
|
879
|
-
</div>`:
|
|
879
|
+
</div>`:g}
|
|
880
880
|
|
|
881
|
-
${n?.probe?
|
|
881
|
+
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
882
882
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
883
883
|
${n.probe.status??""} ${n.probe.error??""}
|
|
884
|
-
</div>`:
|
|
884
|
+
</div>`:g}
|
|
885
885
|
|
|
886
|
-
${
|
|
886
|
+
${ke({channelId:"discord",props:t})}
|
|
887
887
|
|
|
888
888
|
<div class="row" style="margin-top: 12px;">
|
|
889
889
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -891,7 +891,7 @@ ${e.sidebarContent}
|
|
|
891
891
|
</button>
|
|
892
892
|
</div>
|
|
893
893
|
</div>
|
|
894
|
-
`}function
|
|
894
|
+
`}function Ah(e){const{props:t,googleChat:n,accountCountLabel:s}=e;return r`
|
|
895
895
|
<div class="card">
|
|
896
896
|
<div class="card-title">Google Chat</div>
|
|
897
897
|
<div class="card-sub">Chat API webhook status and channel configuration.</div>
|
|
@@ -918,24 +918,24 @@ ${e.sidebarContent}
|
|
|
918
918
|
</div>
|
|
919
919
|
<div>
|
|
920
920
|
<span class="label">Last start</span>
|
|
921
|
-
<span>${n?.lastStartAt?
|
|
921
|
+
<span>${n?.lastStartAt?B(n.lastStartAt):"n/a"}</span>
|
|
922
922
|
</div>
|
|
923
923
|
<div>
|
|
924
924
|
<span class="label">Last probe</span>
|
|
925
|
-
<span>${n?.lastProbeAt?
|
|
925
|
+
<span>${n?.lastProbeAt?B(n.lastProbeAt):"n/a"}</span>
|
|
926
926
|
</div>
|
|
927
927
|
</div>
|
|
928
928
|
|
|
929
|
-
${n?.lastError?
|
|
929
|
+
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
930
930
|
${n.lastError}
|
|
931
|
-
</div>`:
|
|
931
|
+
</div>`:g}
|
|
932
932
|
|
|
933
|
-
${n?.probe?
|
|
933
|
+
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
934
934
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
935
935
|
${n.probe.status??""} ${n.probe.error??""}
|
|
936
|
-
</div>`:
|
|
936
|
+
</div>`:g}
|
|
937
937
|
|
|
938
|
-
${
|
|
938
|
+
${ke({channelId:"googlechat",props:t})}
|
|
939
939
|
|
|
940
940
|
<div class="row" style="margin-top: 12px;">
|
|
941
941
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -943,7 +943,7 @@ ${e.sidebarContent}
|
|
|
943
943
|
</button>
|
|
944
944
|
</div>
|
|
945
945
|
</div>
|
|
946
|
-
`}function
|
|
946
|
+
`}function kh(e){const{props:t,imessage:n,accountCountLabel:s}=e;return r`
|
|
947
947
|
<div class="card">
|
|
948
948
|
<div class="card-title">iMessage</div>
|
|
949
949
|
<div class="card-sub">macOS bridge status and channel configuration.</div>
|
|
@@ -960,24 +960,24 @@ ${e.sidebarContent}
|
|
|
960
960
|
</div>
|
|
961
961
|
<div>
|
|
962
962
|
<span class="label">Last start</span>
|
|
963
|
-
<span>${n?.lastStartAt?
|
|
963
|
+
<span>${n?.lastStartAt?B(n.lastStartAt):"n/a"}</span>
|
|
964
964
|
</div>
|
|
965
965
|
<div>
|
|
966
966
|
<span class="label">Last probe</span>
|
|
967
|
-
<span>${n?.lastProbeAt?
|
|
967
|
+
<span>${n?.lastProbeAt?B(n.lastProbeAt):"n/a"}</span>
|
|
968
968
|
</div>
|
|
969
969
|
</div>
|
|
970
970
|
|
|
971
|
-
${n?.lastError?
|
|
971
|
+
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
972
972
|
${n.lastError}
|
|
973
|
-
</div>`:
|
|
973
|
+
</div>`:g}
|
|
974
974
|
|
|
975
|
-
${n?.probe?
|
|
975
|
+
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
976
976
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
977
977
|
${n.probe.error??""}
|
|
978
|
-
</div>`:
|
|
978
|
+
</div>`:g}
|
|
979
979
|
|
|
980
|
-
${
|
|
980
|
+
${ke({channelId:"imessage",props:t})}
|
|
981
981
|
|
|
982
982
|
<div class="row" style="margin-top: 12px;">
|
|
983
983
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -985,62 +985,62 @@ ${e.sidebarContent}
|
|
|
985
985
|
</button>
|
|
986
986
|
</div>
|
|
987
987
|
</div>
|
|
988
|
-
`}function
|
|
988
|
+
`}function xh(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 Sh(e){const{state:t,callbacks:n,accountId:s}=e,i=xh(t),a=(c,l,p={})=>{const{type:d="text",placeholder:u,maxLength:f,help:v}=p,m=t.values[c]??"",$=t.fieldErrors[c],k=`nostr-profile-${c}`;return d==="textarea"?r`
|
|
989
989
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
990
990
|
<label for="${k}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
991
|
-
${
|
|
991
|
+
${l}
|
|
992
992
|
</label>
|
|
993
993
|
<textarea
|
|
994
994
|
id="${k}"
|
|
995
|
-
.value=${
|
|
995
|
+
.value=${m}
|
|
996
996
|
placeholder=${u??""}
|
|
997
|
-
maxlength=${
|
|
997
|
+
maxlength=${f??2e3}
|
|
998
998
|
rows="3"
|
|
999
999
|
style="width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 4px; resize: vertical; font-family: inherit;"
|
|
1000
|
-
@input=${_=>{const
|
|
1000
|
+
@input=${_=>{const M=_.target;n.onFieldChange(c,M.value)}}
|
|
1001
1001
|
?disabled=${t.saving}
|
|
1002
1002
|
></textarea>
|
|
1003
|
-
${v?
|
|
1004
|
-
${$?
|
|
1003
|
+
${v?r`<div style="font-size: 12px; color: var(--text-muted); margin-top: 2px;">${v}</div>`:g}
|
|
1004
|
+
${$?r`<div style="font-size: 12px; color: var(--danger-color); margin-top: 2px;">${$}</div>`:g}
|
|
1005
1005
|
</div>
|
|
1006
|
-
`:
|
|
1006
|
+
`:r`
|
|
1007
1007
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
1008
1008
|
<label for="${k}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
1009
|
-
${
|
|
1009
|
+
${l}
|
|
1010
1010
|
</label>
|
|
1011
1011
|
<input
|
|
1012
1012
|
id="${k}"
|
|
1013
1013
|
type=${d}
|
|
1014
|
-
.value=${
|
|
1014
|
+
.value=${m}
|
|
1015
1015
|
placeholder=${u??""}
|
|
1016
|
-
maxlength=${
|
|
1016
|
+
maxlength=${f??256}
|
|
1017
1017
|
style="width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 4px;"
|
|
1018
|
-
@input=${_=>{const
|
|
1018
|
+
@input=${_=>{const M=_.target;n.onFieldChange(c,M.value)}}
|
|
1019
1019
|
?disabled=${t.saving}
|
|
1020
1020
|
/>
|
|
1021
|
-
${v?
|
|
1022
|
-
${$?
|
|
1021
|
+
${v?r`<div style="font-size: 12px; color: var(--text-muted); margin-top: 2px;">${v}</div>`:g}
|
|
1022
|
+
${$?r`<div style="font-size: 12px; color: var(--danger-color); margin-top: 2px;">${$}</div>`:g}
|
|
1023
1023
|
</div>
|
|
1024
|
-
`},o=()=>{const
|
|
1024
|
+
`},o=()=>{const c=t.values.picture;return c?r`
|
|
1025
1025
|
<div style="margin-bottom: 12px;">
|
|
1026
1026
|
<img
|
|
1027
|
-
src=${
|
|
1027
|
+
src=${c}
|
|
1028
1028
|
alt="Profile picture preview"
|
|
1029
1029
|
style="max-width: 80px; max-height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color);"
|
|
1030
|
-
@error=${
|
|
1031
|
-
@load=${
|
|
1030
|
+
@error=${l=>{const p=l.target;p.style.display="none"}}
|
|
1031
|
+
@load=${l=>{const p=l.target;p.style.display="block"}}
|
|
1032
1032
|
/>
|
|
1033
1033
|
</div>
|
|
1034
|
-
`:
|
|
1034
|
+
`:g};return r`
|
|
1035
1035
|
<div class="nostr-profile-form" style="padding: 16px; background: var(--bg-secondary); border-radius: 8px; margin-top: 12px;">
|
|
1036
1036
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;">
|
|
1037
1037
|
<div style="font-weight: 600; font-size: 16px;">Edit Profile</div>
|
|
1038
1038
|
<div style="font-size: 12px; color: var(--text-muted);">Account: ${s}</div>
|
|
1039
1039
|
</div>
|
|
1040
1040
|
|
|
1041
|
-
${t.error?
|
|
1041
|
+
${t.error?r`<div class="callout danger" style="margin-bottom: 12px;">${t.error}</div>`:g}
|
|
1042
1042
|
|
|
1043
|
-
${t.success?
|
|
1043
|
+
${t.success?r`<div class="callout success" style="margin-bottom: 12px;">${t.success}</div>`:g}
|
|
1044
1044
|
|
|
1045
1045
|
${o()}
|
|
1046
1046
|
|
|
@@ -1052,7 +1052,7 @@ ${e.sidebarContent}
|
|
|
1052
1052
|
|
|
1053
1053
|
${a("picture","Avatar URL",{type:"url",placeholder:"https://example.com/avatar.jpg",help:"HTTPS URL to your profile picture"})}
|
|
1054
1054
|
|
|
1055
|
-
${t.showAdvanced?
|
|
1055
|
+
${t.showAdvanced?r`
|
|
1056
1056
|
<div style="border-top: 1px solid var(--border-color); padding-top: 12px; margin-top: 12px;">
|
|
1057
1057
|
<div style="font-weight: 500; margin-bottom: 12px; color: var(--text-muted);">Advanced</div>
|
|
1058
1058
|
|
|
@@ -1064,7 +1064,7 @@ ${e.sidebarContent}
|
|
|
1064
1064
|
|
|
1065
1065
|
${a("lud16","Lightning Address",{placeholder:"you@getalby.com",help:"Lightning address for tips (LUD-16)"})}
|
|
1066
1066
|
</div>
|
|
1067
|
-
`:
|
|
1067
|
+
`:g}
|
|
1068
1068
|
|
|
1069
1069
|
<div style="display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;">
|
|
1070
1070
|
<button
|
|
@@ -1099,86 +1099,86 @@ ${e.sidebarContent}
|
|
|
1099
1099
|
</button>
|
|
1100
1100
|
</div>
|
|
1101
1101
|
|
|
1102
|
-
${i?
|
|
1102
|
+
${i?r`<div style="font-size: 12px; color: var(--warning-color); margin-top: 8px;">
|
|
1103
1103
|
You have unsaved changes
|
|
1104
|
-
</div>`:
|
|
1104
|
+
</div>`:g}
|
|
1105
1105
|
</div>
|
|
1106
|
-
`}function
|
|
1106
|
+
`}function _h(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)}}function Ya(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:"n/a"}function Th(e){const{props:t,nostr:n,nostrAccounts:s,accountCountLabel:i,profileFormState:a,profileFormCallbacks:o,onEditProfile:c}=e,l=s[0],p=n?.configured??l?.configured??!1,d=n?.running??l?.running??!1,u=n?.publicKey??l?.publicKey,f=n?.lastStartAt??l?.lastStartAt??null,v=n?.lastError??l?.lastError??null,m=s.length>1,$=a!=null,k=M=>{const R=M.publicKey,L=M.profile,C=L?.displayName??L?.name??M.name??M.accountId;return r`
|
|
1107
1107
|
<div class="account-card">
|
|
1108
1108
|
<div class="account-card-header">
|
|
1109
1109
|
<div class="account-card-title">${C}</div>
|
|
1110
|
-
<div class="account-card-id">${
|
|
1110
|
+
<div class="account-card-id">${M.accountId}</div>
|
|
1111
1111
|
</div>
|
|
1112
1112
|
<div class="status-list account-card-status">
|
|
1113
1113
|
<div>
|
|
1114
1114
|
<span class="label">Running</span>
|
|
1115
|
-
<span>${
|
|
1115
|
+
<span>${M.running?"Yes":"No"}</span>
|
|
1116
1116
|
</div>
|
|
1117
1117
|
<div>
|
|
1118
1118
|
<span class="label">Configured</span>
|
|
1119
|
-
<span>${
|
|
1119
|
+
<span>${M.configured?"Yes":"No"}</span>
|
|
1120
1120
|
</div>
|
|
1121
1121
|
<div>
|
|
1122
1122
|
<span class="label">Public Key</span>
|
|
1123
|
-
<span class="monospace" title="${
|
|
1123
|
+
<span class="monospace" title="${R??""}">${Ya(R)}</span>
|
|
1124
1124
|
</div>
|
|
1125
1125
|
<div>
|
|
1126
1126
|
<span class="label">Last inbound</span>
|
|
1127
|
-
<span>${
|
|
1127
|
+
<span>${M.lastInboundAt?B(M.lastInboundAt):"n/a"}</span>
|
|
1128
1128
|
</div>
|
|
1129
|
-
${
|
|
1130
|
-
<div class="account-card-error">${
|
|
1131
|
-
`:
|
|
1129
|
+
${M.lastError?r`
|
|
1130
|
+
<div class="account-card-error">${M.lastError}</div>
|
|
1131
|
+
`:g}
|
|
1132
1132
|
</div>
|
|
1133
1133
|
</div>
|
|
1134
|
-
`},_=()=>{if($&&o)return
|
|
1134
|
+
`},_=()=>{if($&&o)return Sh({state:a,callbacks:o,accountId:s[0]?.accountId??"default"});const M=l?.profile??n?.profile,{name:R,displayName:L,about:C,picture:I,nip05:fe}=M??{},Tn=R||L||C||I||fe;return r`
|
|
1135
1135
|
<div style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
|
|
1136
1136
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
|
1137
1137
|
<div style="font-weight: 500;">Profile</div>
|
|
1138
|
-
${p?
|
|
1138
|
+
${p?r`
|
|
1139
1139
|
<button
|
|
1140
1140
|
class="btn btn-sm"
|
|
1141
|
-
@click=${
|
|
1141
|
+
@click=${c}
|
|
1142
1142
|
style="font-size: 12px; padding: 4px 8px;"
|
|
1143
1143
|
>
|
|
1144
1144
|
Edit Profile
|
|
1145
1145
|
</button>
|
|
1146
|
-
`:
|
|
1146
|
+
`:g}
|
|
1147
1147
|
</div>
|
|
1148
|
-
${
|
|
1148
|
+
${Tn?r`
|
|
1149
1149
|
<div class="status-list">
|
|
1150
|
-
${
|
|
1150
|
+
${I?r`
|
|
1151
1151
|
<div style="margin-bottom: 8px;">
|
|
1152
1152
|
<img
|
|
1153
|
-
src=${
|
|
1153
|
+
src=${I}
|
|
1154
1154
|
alt="Profile picture"
|
|
1155
1155
|
style="width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color);"
|
|
1156
|
-
@error=${
|
|
1156
|
+
@error=${En=>{En.target.style.display="none"}}
|
|
1157
1157
|
/>
|
|
1158
1158
|
</div>
|
|
1159
|
-
`:
|
|
1160
|
-
${
|
|
1161
|
-
${
|
|
1162
|
-
${C?
|
|
1163
|
-
${
|
|
1159
|
+
`:g}
|
|
1160
|
+
${R?r`<div><span class="label">Name</span><span>${R}</span></div>`:g}
|
|
1161
|
+
${L?r`<div><span class="label">Display Name</span><span>${L}</span></div>`:g}
|
|
1162
|
+
${C?r`<div><span class="label">About</span><span style="max-width: 300px; overflow: hidden; text-overflow: ellipsis;">${C}</span></div>`:g}
|
|
1163
|
+
${fe?r`<div><span class="label">NIP-05</span><span>${fe}</span></div>`:g}
|
|
1164
1164
|
</div>
|
|
1165
|
-
`:
|
|
1165
|
+
`:r`
|
|
1166
1166
|
<div style="color: var(--text-muted); font-size: 13px;">
|
|
1167
1167
|
No profile set. Click "Edit Profile" to add your name, bio, and avatar.
|
|
1168
1168
|
</div>
|
|
1169
1169
|
`}
|
|
1170
1170
|
</div>
|
|
1171
|
-
`};return
|
|
1171
|
+
`};return r`
|
|
1172
1172
|
<div class="card">
|
|
1173
1173
|
<div class="card-title">Nostr</div>
|
|
1174
1174
|
<div class="card-sub">Decentralized DMs via Nostr relays (NIP-04).</div>
|
|
1175
1175
|
${i}
|
|
1176
1176
|
|
|
1177
|
-
${
|
|
1177
|
+
${m?r`
|
|
1178
1178
|
<div class="account-card-list">
|
|
1179
|
-
${s.map(
|
|
1179
|
+
${s.map(M=>k(M))}
|
|
1180
1180
|
</div>
|
|
1181
|
-
`:
|
|
1181
|
+
`:r`
|
|
1182
1182
|
<div class="status-list" style="margin-top: 16px;">
|
|
1183
1183
|
<div>
|
|
1184
1184
|
<span class="label">Configured</span>
|
|
@@ -1191,27 +1191,27 @@ ${e.sidebarContent}
|
|
|
1191
1191
|
<div>
|
|
1192
1192
|
<span class="label">Public Key</span>
|
|
1193
1193
|
<span class="monospace" title="${u??""}"
|
|
1194
|
-
>${
|
|
1194
|
+
>${Ya(u)}</span
|
|
1195
1195
|
>
|
|
1196
1196
|
</div>
|
|
1197
1197
|
<div>
|
|
1198
1198
|
<span class="label">Last start</span>
|
|
1199
|
-
<span>${
|
|
1199
|
+
<span>${f?B(f):"n/a"}</span>
|
|
1200
1200
|
</div>
|
|
1201
1201
|
</div>
|
|
1202
1202
|
`}
|
|
1203
1203
|
|
|
1204
|
-
${v?
|
|
1204
|
+
${v?r`<div class="callout danger" style="margin-top: 12px;">${v}</div>`:g}
|
|
1205
1205
|
|
|
1206
1206
|
${_()}
|
|
1207
1207
|
|
|
1208
|
-
${
|
|
1208
|
+
${ke({channelId:"nostr",props:t})}
|
|
1209
1209
|
|
|
1210
1210
|
<div class="row" style="margin-top: 12px;">
|
|
1211
1211
|
<button class="btn" @click=${()=>t.onRefresh(!1)}>Refresh</button>
|
|
1212
1212
|
</div>
|
|
1213
1213
|
</div>
|
|
1214
|
-
`}function
|
|
1214
|
+
`}function Eh(e){const{props:t,signal:n,accountCountLabel:s}=e;return r`
|
|
1215
1215
|
<div class="card">
|
|
1216
1216
|
<div class="card-title">Signal</div>
|
|
1217
1217
|
<div class="card-sub">signal-cli status and channel configuration.</div>
|
|
@@ -1232,24 +1232,24 @@ ${e.sidebarContent}
|
|
|
1232
1232
|
</div>
|
|
1233
1233
|
<div>
|
|
1234
1234
|
<span class="label">Last start</span>
|
|
1235
|
-
<span>${n?.lastStartAt?
|
|
1235
|
+
<span>${n?.lastStartAt?B(n.lastStartAt):"n/a"}</span>
|
|
1236
1236
|
</div>
|
|
1237
1237
|
<div>
|
|
1238
1238
|
<span class="label">Last probe</span>
|
|
1239
|
-
<span>${n?.lastProbeAt?
|
|
1239
|
+
<span>${n?.lastProbeAt?B(n.lastProbeAt):"n/a"}</span>
|
|
1240
1240
|
</div>
|
|
1241
1241
|
</div>
|
|
1242
1242
|
|
|
1243
|
-
${n?.lastError?
|
|
1243
|
+
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1244
1244
|
${n.lastError}
|
|
1245
|
-
</div>`:
|
|
1245
|
+
</div>`:g}
|
|
1246
1246
|
|
|
1247
|
-
${n?.probe?
|
|
1247
|
+
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
1248
1248
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
1249
1249
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1250
|
-
</div>`:
|
|
1250
|
+
</div>`:g}
|
|
1251
1251
|
|
|
1252
|
-
${
|
|
1252
|
+
${ke({channelId:"signal",props:t})}
|
|
1253
1253
|
|
|
1254
1254
|
<div class="row" style="margin-top: 12px;">
|
|
1255
1255
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -1257,7 +1257,7 @@ ${e.sidebarContent}
|
|
|
1257
1257
|
</button>
|
|
1258
1258
|
</div>
|
|
1259
1259
|
</div>
|
|
1260
|
-
`}function
|
|
1260
|
+
`}function Ch(e){const{props:t,slack:n,accountCountLabel:s}=e;return r`
|
|
1261
1261
|
<div class="card">
|
|
1262
1262
|
<div class="card-title">Slack</div>
|
|
1263
1263
|
<div class="card-sub">Socket mode status and channel configuration.</div>
|
|
@@ -1274,24 +1274,24 @@ ${e.sidebarContent}
|
|
|
1274
1274
|
</div>
|
|
1275
1275
|
<div>
|
|
1276
1276
|
<span class="label">Last start</span>
|
|
1277
|
-
<span>${n?.lastStartAt?
|
|
1277
|
+
<span>${n?.lastStartAt?B(n.lastStartAt):"n/a"}</span>
|
|
1278
1278
|
</div>
|
|
1279
1279
|
<div>
|
|
1280
1280
|
<span class="label">Last probe</span>
|
|
1281
|
-
<span>${n?.lastProbeAt?
|
|
1281
|
+
<span>${n?.lastProbeAt?B(n.lastProbeAt):"n/a"}</span>
|
|
1282
1282
|
</div>
|
|
1283
1283
|
</div>
|
|
1284
1284
|
|
|
1285
|
-
${n?.lastError?
|
|
1285
|
+
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1286
1286
|
${n.lastError}
|
|
1287
|
-
</div>`:
|
|
1287
|
+
</div>`:g}
|
|
1288
1288
|
|
|
1289
|
-
${n?.probe?
|
|
1289
|
+
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
1290
1290
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
1291
1291
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1292
|
-
</div>`:
|
|
1292
|
+
</div>`:g}
|
|
1293
1293
|
|
|
1294
|
-
${
|
|
1294
|
+
${ke({channelId:"slack",props:t})}
|
|
1295
1295
|
|
|
1296
1296
|
<div class="row" style="margin-top: 12px;">
|
|
1297
1297
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -1299,45 +1299,45 @@ ${e.sidebarContent}
|
|
|
1299
1299
|
</button>
|
|
1300
1300
|
</div>
|
|
1301
1301
|
</div>
|
|
1302
|
-
`}function
|
|
1302
|
+
`}function Ih(e){const{props:t,telegram:n,telegramAccounts:s,accountCountLabel:i}=e,a=s.length>1,o=c=>{const p=c.probe?.bot?.username,d=c.name||c.accountId;return r`
|
|
1303
1303
|
<div class="account-card">
|
|
1304
1304
|
<div class="account-card-header">
|
|
1305
1305
|
<div class="account-card-title">
|
|
1306
1306
|
${p?`@${p}`:d}
|
|
1307
1307
|
</div>
|
|
1308
|
-
<div class="account-card-id">${
|
|
1308
|
+
<div class="account-card-id">${c.accountId}</div>
|
|
1309
1309
|
</div>
|
|
1310
1310
|
<div class="status-list account-card-status">
|
|
1311
1311
|
<div>
|
|
1312
1312
|
<span class="label">Running</span>
|
|
1313
|
-
<span>${
|
|
1313
|
+
<span>${c.running?"Yes":"No"}</span>
|
|
1314
1314
|
</div>
|
|
1315
1315
|
<div>
|
|
1316
1316
|
<span class="label">Configured</span>
|
|
1317
|
-
<span>${
|
|
1317
|
+
<span>${c.configured?"Yes":"No"}</span>
|
|
1318
1318
|
</div>
|
|
1319
1319
|
<div>
|
|
1320
1320
|
<span class="label">Last inbound</span>
|
|
1321
|
-
<span>${
|
|
1321
|
+
<span>${c.lastInboundAt?B(c.lastInboundAt):"n/a"}</span>
|
|
1322
1322
|
</div>
|
|
1323
|
-
${
|
|
1323
|
+
${c.lastError?r`
|
|
1324
1324
|
<div class="account-card-error">
|
|
1325
|
-
${
|
|
1325
|
+
${c.lastError}
|
|
1326
1326
|
</div>
|
|
1327
|
-
`:
|
|
1327
|
+
`:g}
|
|
1328
1328
|
</div>
|
|
1329
1329
|
</div>
|
|
1330
|
-
`};return
|
|
1330
|
+
`};return r`
|
|
1331
1331
|
<div class="card">
|
|
1332
1332
|
<div class="card-title">Telegram</div>
|
|
1333
1333
|
<div class="card-sub">Bot status and channel configuration.</div>
|
|
1334
1334
|
${i}
|
|
1335
1335
|
|
|
1336
|
-
${a?
|
|
1336
|
+
${a?r`
|
|
1337
1337
|
<div class="account-card-list">
|
|
1338
|
-
${s.map(
|
|
1338
|
+
${s.map(c=>o(c))}
|
|
1339
1339
|
</div>
|
|
1340
|
-
`:
|
|
1340
|
+
`:r`
|
|
1341
1341
|
<div class="status-list" style="margin-top: 16px;">
|
|
1342
1342
|
<div>
|
|
1343
1343
|
<span class="label">Configured</span>
|
|
@@ -1353,25 +1353,25 @@ ${e.sidebarContent}
|
|
|
1353
1353
|
</div>
|
|
1354
1354
|
<div>
|
|
1355
1355
|
<span class="label">Last start</span>
|
|
1356
|
-
<span>${n?.lastStartAt?
|
|
1356
|
+
<span>${n?.lastStartAt?B(n.lastStartAt):"n/a"}</span>
|
|
1357
1357
|
</div>
|
|
1358
1358
|
<div>
|
|
1359
1359
|
<span class="label">Last probe</span>
|
|
1360
|
-
<span>${n?.lastProbeAt?
|
|
1360
|
+
<span>${n?.lastProbeAt?B(n.lastProbeAt):"n/a"}</span>
|
|
1361
1361
|
</div>
|
|
1362
1362
|
</div>
|
|
1363
1363
|
`}
|
|
1364
1364
|
|
|
1365
|
-
${n?.lastError?
|
|
1365
|
+
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1366
1366
|
${n.lastError}
|
|
1367
|
-
</div>`:
|
|
1367
|
+
</div>`:g}
|
|
1368
1368
|
|
|
1369
|
-
${n?.probe?
|
|
1369
|
+
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
1370
1370
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
1371
1371
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1372
|
-
</div>`:
|
|
1372
|
+
</div>`:g}
|
|
1373
1373
|
|
|
1374
|
-
${
|
|
1374
|
+
${ke({channelId:"telegram",props:t})}
|
|
1375
1375
|
|
|
1376
1376
|
<div class="row" style="margin-top: 12px;">
|
|
1377
1377
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -1379,7 +1379,7 @@ ${e.sidebarContent}
|
|
|
1379
1379
|
</button>
|
|
1380
1380
|
</div>
|
|
1381
1381
|
</div>
|
|
1382
|
-
`}function
|
|
1382
|
+
`}function Rh(e){const{props:t,whatsapp:n,accountCountLabel:s}=e;return r`
|
|
1383
1383
|
<div class="card">
|
|
1384
1384
|
<div class="card-title">WhatsApp</div>
|
|
1385
1385
|
<div class="card-sub">Link WhatsApp Web and monitor connection health.</div>
|
|
@@ -1405,34 +1405,34 @@ ${e.sidebarContent}
|
|
|
1405
1405
|
<div>
|
|
1406
1406
|
<span class="label">Last connect</span>
|
|
1407
1407
|
<span>
|
|
1408
|
-
${n?.lastConnectedAt?
|
|
1408
|
+
${n?.lastConnectedAt?B(n.lastConnectedAt):"n/a"}
|
|
1409
1409
|
</span>
|
|
1410
1410
|
</div>
|
|
1411
1411
|
<div>
|
|
1412
1412
|
<span class="label">Last message</span>
|
|
1413
1413
|
<span>
|
|
1414
|
-
${n?.lastMessageAt?
|
|
1414
|
+
${n?.lastMessageAt?B(n.lastMessageAt):"n/a"}
|
|
1415
1415
|
</span>
|
|
1416
1416
|
</div>
|
|
1417
1417
|
<div>
|
|
1418
1418
|
<span class="label">Auth age</span>
|
|
1419
1419
|
<span>
|
|
1420
|
-
${n?.authAgeMs!=null?
|
|
1420
|
+
${n?.authAgeMs!=null?gh(n.authAgeMs):"n/a"}
|
|
1421
1421
|
</span>
|
|
1422
1422
|
</div>
|
|
1423
1423
|
</div>
|
|
1424
1424
|
|
|
1425
|
-
${n?.lastError?
|
|
1425
|
+
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1426
1426
|
${n.lastError}
|
|
1427
|
-
</div>`:
|
|
1427
|
+
</div>`:g}
|
|
1428
1428
|
|
|
1429
|
-
${t.whatsappMessage?
|
|
1429
|
+
${t.whatsappMessage?r`<div class="callout" style="margin-top: 12px;">
|
|
1430
1430
|
${t.whatsappMessage}
|
|
1431
|
-
</div>`:
|
|
1431
|
+
</div>`:g}
|
|
1432
1432
|
|
|
1433
|
-
${t.whatsappQrDataUrl?
|
|
1433
|
+
${t.whatsappQrDataUrl?r`<div class="qr-wrap">
|
|
1434
1434
|
<img src=${t.whatsappQrDataUrl} alt="WhatsApp QR" />
|
|
1435
|
-
</div>`:
|
|
1435
|
+
</div>`:g}
|
|
1436
1436
|
|
|
1437
1437
|
<div class="row" style="margin-top: 14px; flex-wrap: wrap;">
|
|
1438
1438
|
<button
|
|
@@ -1468,11 +1468,11 @@ ${e.sidebarContent}
|
|
|
1468
1468
|
</button>
|
|
1469
1469
|
</div>
|
|
1470
1470
|
|
|
1471
|
-
${
|
|
1471
|
+
${ke({channelId:"whatsapp",props:t})}
|
|
1472
1472
|
</div>
|
|
1473
|
-
`}function
|
|
1473
|
+
`}function Lh(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null;t?.googlechat;const a=t?.slack??null,o=t?.signal??null,c=t?.imessage??null,l=t?.nostr??null,d=Mh(e.snapshot).map((u,f)=>({key:u,enabled:vh(u,e),order:f})).sort((u,f)=>u.enabled!==f.enabled?u.enabled?-1:1:u.order-f.order);return r`
|
|
1474
1474
|
<section class="grid grid-cols-2">
|
|
1475
|
-
${d.map(u
|
|
1475
|
+
${d.map(u=>Ph(u.key,e,{whatsapp:n,telegram:s,discord:i,slack:a,signal:o,imessage:c,nostr:l,channelAccounts:e.snapshot?.channelAccounts??null}))}
|
|
1476
1476
|
</section>
|
|
1477
1477
|
|
|
1478
1478
|
<section class="card" style="margin-top: 18px;">
|
|
@@ -1481,26 +1481,26 @@ ${e.sidebarContent}
|
|
|
1481
1481
|
<div class="card-title">Channel health</div>
|
|
1482
1482
|
<div class="card-sub">Channel status snapshots from the gateway.</div>
|
|
1483
1483
|
</div>
|
|
1484
|
-
<div class="muted">${e.lastSuccessAt?
|
|
1484
|
+
<div class="muted">${e.lastSuccessAt?B(e.lastSuccessAt):"n/a"}</div>
|
|
1485
1485
|
</div>
|
|
1486
|
-
${e.lastError?
|
|
1486
|
+
${e.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1487
1487
|
${e.lastError}
|
|
1488
|
-
</div>`:
|
|
1488
|
+
</div>`:g}
|
|
1489
1489
|
<pre class="code-block" style="margin-top: 12px;">
|
|
1490
1490
|
${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
1491
1491
|
</pre>
|
|
1492
1492
|
</section>
|
|
1493
|
-
`}function
|
|
1493
|
+
`}function Mh(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 Ph(e,t,n){const s=xr(e,n.channelAccounts);switch(e){case"whatsapp":return Rh({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return Ih({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return $h({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return Ah({props:t,accountCountLabel:s});case"slack":return Ch({props:t,slack:n.slack,accountCountLabel:s});case"signal":return Eh({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return kh({props:t,imessage:n.imessage,accountCountLabel:s});case"nostr":{const i=n.channelAccounts?.nostr??[],a=i[0],o=a?.accountId??"default",c=a?.profile??null,l=t.nostrProfileAccountId===o?t.nostrProfileFormState:null,p=l?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return Th({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:l,profileFormCallbacks:p,onEditProfile:()=>t.onNostrProfileEdit(o,c)})}default:return Nh(e,t,n.channelAccounts??{})}}function Nh(e,t,n){const s=Dh(t.snapshot,e),i=t.snapshot?.channels?.[e],a=typeof i?.configured=="boolean"?i.configured:void 0,o=typeof i?.running=="boolean"?i.running:void 0,c=typeof i?.connected=="boolean"?i.connected:void 0,l=typeof i?.lastError=="string"?i.lastError:void 0,p=n[e]??[],d=xr(e,n);return r`
|
|
1494
1494
|
<div class="card">
|
|
1495
1495
|
<div class="card-title">${s}</div>
|
|
1496
1496
|
<div class="card-sub">Channel status and configuration.</div>
|
|
1497
1497
|
${d}
|
|
1498
1498
|
|
|
1499
|
-
${p.length>0?
|
|
1499
|
+
${p.length>0?r`
|
|
1500
1500
|
<div class="account-card-list">
|
|
1501
|
-
${p.map(u=>
|
|
1501
|
+
${p.map(u=>Hh(u))}
|
|
1502
1502
|
</div>
|
|
1503
|
-
`:
|
|
1503
|
+
`:r`
|
|
1504
1504
|
<div class="status-list" style="margin-top: 16px;">
|
|
1505
1505
|
<div>
|
|
1506
1506
|
<span class="label">Configured</span>
|
|
@@ -1512,18 +1512,18 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1512
1512
|
</div>
|
|
1513
1513
|
<div>
|
|
1514
1514
|
<span class="label">Connected</span>
|
|
1515
|
-
<span>${
|
|
1515
|
+
<span>${c==null?"n/a":c?"Yes":"No"}</span>
|
|
1516
1516
|
</div>
|
|
1517
1517
|
</div>
|
|
1518
1518
|
`}
|
|
1519
1519
|
|
|
1520
|
-
${r
|
|
1521
|
-
${
|
|
1522
|
-
</div>`:
|
|
1520
|
+
${l?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1521
|
+
${l}
|
|
1522
|
+
</div>`:g}
|
|
1523
1523
|
|
|
1524
|
-
${
|
|
1524
|
+
${ke({channelId:e,props:t})}
|
|
1525
1525
|
</div>
|
|
1526
|
-
`}function
|
|
1526
|
+
`}function Oh(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Dh(e,t){return Oh(e)[t]?.label??e?.channelLabels?.[t]??t}const Uh=600*1e3;function Sr(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<Uh:!1}function Bh(e){return e.running?"Yes":Sr(e)?"Active":"No"}function Fh(e){return e.connected===!0?"Yes":e.connected===!1?"No":Sr(e)?"Active":"n/a"}function Hh(e){const t=Bh(e),n=Fh(e);return r`
|
|
1527
1527
|
<div class="account-card">
|
|
1528
1528
|
<div class="account-card-header">
|
|
1529
1529
|
<div class="account-card-title">${e.name||e.accountId}</div>
|
|
@@ -1544,16 +1544,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1544
1544
|
</div>
|
|
1545
1545
|
<div>
|
|
1546
1546
|
<span class="label">Last inbound</span>
|
|
1547
|
-
<span>${e.lastInboundAt?
|
|
1547
|
+
<span>${e.lastInboundAt?B(e.lastInboundAt):"n/a"}</span>
|
|
1548
1548
|
</div>
|
|
1549
|
-
${e.lastError?
|
|
1549
|
+
${e.lastError?r`
|
|
1550
1550
|
<div class="account-card-error">
|
|
1551
1551
|
${e.lastError}
|
|
1552
1552
|
</div>
|
|
1553
|
-
`:
|
|
1553
|
+
`:g}
|
|
1554
1554
|
</div>
|
|
1555
1555
|
</div>
|
|
1556
|
-
`}function
|
|
1556
|
+
`}function Kh(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function zh(e){const t=e.ts??null;return t?B(t):"n/a"}function _r(e){return e?`${Ct(e)} (${B(e)})`:"n/a"}function jh(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function Tr(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function qh(e){const t=e.schedule;return t.kind==="at"?`At ${Ct(t.atMs)}`:t.kind==="every"?`Every ${Dl(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function Wh(e){const t=["last",...e.channels.filter(Boolean)],n=e.form.deliveryChannel?.trim();n&&!t.includes(n)&&t.push(n);const s=new Set;return t.filter(i=>s.has(i)?!1:(s.add(i),!0))}function Gh(e,t){if(t==="last")return"last";const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function Vh(e){const t=Wh(e),s=(e.runsJobId==null?void 0:e.jobs.find(a=>a.id===e.runsJobId))?.name??e.runsJobId??"(select a job)",i=e.runs.toSorted((a,o)=>o.ts-a.ts);return r`
|
|
1557
1557
|
<section class="grid grid-cols-2">
|
|
1558
1558
|
<div class="card">
|
|
1559
1559
|
<div class="card-title">Scheduler</div>
|
|
@@ -1571,14 +1571,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1571
1571
|
</div>
|
|
1572
1572
|
<div class="stat">
|
|
1573
1573
|
<div class="stat-label">Next wake</div>
|
|
1574
|
-
<div class="stat-value">${
|
|
1574
|
+
<div class="stat-value">${_r(e.status?.nextWakeAtMs??null)}</div>
|
|
1575
1575
|
</div>
|
|
1576
1576
|
</div>
|
|
1577
1577
|
<div class="row" style="margin-top: 12px;">
|
|
1578
1578
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
1579
1579
|
${e.loading?"Refreshing…":"Refresh"}
|
|
1580
1580
|
</button>
|
|
1581
|
-
${e.error?
|
|
1581
|
+
${e.error?r`<span class="muted">${e.error}</span>`:g}
|
|
1582
1582
|
</div>
|
|
1583
1583
|
</div>
|
|
1584
1584
|
|
|
@@ -1628,7 +1628,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1628
1628
|
</select>
|
|
1629
1629
|
</label>
|
|
1630
1630
|
</div>
|
|
1631
|
-
${
|
|
1631
|
+
${Yh(e)}
|
|
1632
1632
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1633
1633
|
<label class="field">
|
|
1634
1634
|
<span>Session</span>
|
|
@@ -1669,7 +1669,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1669
1669
|
rows="4"
|
|
1670
1670
|
></textarea>
|
|
1671
1671
|
</label>
|
|
1672
|
-
${e.form.payloadKind==="agentTurn"?
|
|
1672
|
+
${e.form.payloadKind==="agentTurn"?r`
|
|
1673
1673
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1674
1674
|
<label class="field">
|
|
1675
1675
|
<span>Delivery</span>
|
|
@@ -1689,15 +1689,15 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1689
1689
|
@input=${a=>e.onFormChange({timeoutSeconds:a.target.value})}
|
|
1690
1690
|
/>
|
|
1691
1691
|
</label>
|
|
1692
|
-
${e.form.deliveryMode==="announce"?
|
|
1692
|
+
${e.form.deliveryMode==="announce"?r`
|
|
1693
1693
|
<label class="field">
|
|
1694
1694
|
<span>Channel</span>
|
|
1695
1695
|
<select
|
|
1696
1696
|
.value=${e.form.deliveryChannel||"last"}
|
|
1697
1697
|
@change=${a=>e.onFormChange({deliveryChannel:a.target.value})}
|
|
1698
1698
|
>
|
|
1699
|
-
${t.map(a=>
|
|
1700
|
-
${
|
|
1699
|
+
${t.map(a=>r`<option value=${a}>
|
|
1700
|
+
${Gh(e,a)}
|
|
1701
1701
|
</option>`)}
|
|
1702
1702
|
</select>
|
|
1703
1703
|
</label>
|
|
@@ -1709,9 +1709,9 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1709
1709
|
placeholder="+1555… or chat id"
|
|
1710
1710
|
/>
|
|
1711
1711
|
</label>
|
|
1712
|
-
`:
|
|
1712
|
+
`:g}
|
|
1713
1713
|
</div>
|
|
1714
|
-
`:
|
|
1714
|
+
`:g}
|
|
1715
1715
|
<div class="row" style="margin-top: 14px;">
|
|
1716
1716
|
<button class="btn primary" ?disabled=${e.busy} @click=${e.onAdd}>
|
|
1717
1717
|
${e.busy?"Saving…":"Add job"}
|
|
@@ -1723,11 +1723,11 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1723
1723
|
<section class="card" style="margin-top: 18px;">
|
|
1724
1724
|
<div class="card-title">Jobs</div>
|
|
1725
1725
|
<div class="card-sub">All scheduled jobs stored in the gateway.</div>
|
|
1726
|
-
${e.jobs.length===0?
|
|
1726
|
+
${e.jobs.length===0?r`
|
|
1727
1727
|
<div class="muted" style="margin-top: 12px">No jobs yet.</div>
|
|
1728
|
-
`:
|
|
1728
|
+
`:r`
|
|
1729
1729
|
<div class="list" style="margin-top: 12px;">
|
|
1730
|
-
${e.jobs.map(a=>
|
|
1730
|
+
${e.jobs.map(a=>Qh(a,e))}
|
|
1731
1731
|
</div>
|
|
1732
1732
|
`}
|
|
1733
1733
|
</section>
|
|
@@ -1735,17 +1735,17 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1735
1735
|
<section class="card" style="margin-top: 18px;">
|
|
1736
1736
|
<div class="card-title">Run history</div>
|
|
1737
1737
|
<div class="card-sub">Latest runs for ${s}.</div>
|
|
1738
|
-
${e.runsJobId==null?
|
|
1738
|
+
${e.runsJobId==null?r`
|
|
1739
1739
|
<div class="muted" style="margin-top: 12px">Select a job to inspect run history.</div>
|
|
1740
|
-
`:i.length===0?
|
|
1740
|
+
`:i.length===0?r`
|
|
1741
1741
|
<div class="muted" style="margin-top: 12px">No runs yet.</div>
|
|
1742
|
-
`:
|
|
1742
|
+
`:r`
|
|
1743
1743
|
<div class="list" style="margin-top: 12px;">
|
|
1744
|
-
${i.map(a=>
|
|
1744
|
+
${i.map(a=>Xh(a,e.basePath))}
|
|
1745
1745
|
</div>
|
|
1746
1746
|
`}
|
|
1747
1747
|
</section>
|
|
1748
|
-
`}function
|
|
1748
|
+
`}function Yh(e){const t=e.form;return t.scheduleKind==="at"?r`
|
|
1749
1749
|
<label class="field" style="margin-top: 12px;">
|
|
1750
1750
|
<span>Run at</span>
|
|
1751
1751
|
<input
|
|
@@ -1754,7 +1754,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1754
1754
|
@input=${n=>e.onFormChange({scheduleAt:n.target.value})}
|
|
1755
1755
|
/>
|
|
1756
1756
|
</label>
|
|
1757
|
-
`:t.scheduleKind==="every"?
|
|
1757
|
+
`:t.scheduleKind==="every"?r`
|
|
1758
1758
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1759
1759
|
<label class="field">
|
|
1760
1760
|
<span>Every</span>
|
|
@@ -1775,7 +1775,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1775
1775
|
</select>
|
|
1776
1776
|
</label>
|
|
1777
1777
|
</div>
|
|
1778
|
-
`:
|
|
1778
|
+
`:r`
|
|
1779
1779
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1780
1780
|
<label class="field">
|
|
1781
1781
|
<span>Expression</span>
|
|
@@ -1792,16 +1792,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1792
1792
|
/>
|
|
1793
1793
|
</label>
|
|
1794
1794
|
</div>
|
|
1795
|
-
`}function
|
|
1795
|
+
`}function Qh(e,t){const s=`list-item list-item-clickable cron-job${t.runsJobId===e.id?" list-item-selected":""}`;return r`
|
|
1796
1796
|
<div class=${s} @click=${()=>t.onLoadRuns(e.id)}>
|
|
1797
1797
|
<div class="list-main">
|
|
1798
1798
|
<div class="list-title">${e.name}</div>
|
|
1799
|
-
<div class="list-sub">${
|
|
1800
|
-
${
|
|
1801
|
-
${e.agentId?
|
|
1799
|
+
<div class="list-sub">${qh(e)}</div>
|
|
1800
|
+
${Jh(e)}
|
|
1801
|
+
${e.agentId?r`<div class="muted cron-job-agent">Agent: ${e.agentId}</div>`:g}
|
|
1802
1802
|
</div>
|
|
1803
1803
|
<div class="list-meta">
|
|
1804
|
-
${
|
|
1804
|
+
${Zh(e)}
|
|
1805
1805
|
</div>
|
|
1806
1806
|
<div class="cron-job-footer">
|
|
1807
1807
|
<div class="chip-row cron-job-chips">
|
|
@@ -1843,19 +1843,19 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1843
1843
|
</div>
|
|
1844
1844
|
</div>
|
|
1845
1845
|
</div>
|
|
1846
|
-
`}function
|
|
1846
|
+
`}function Jh(e){if(e.payload.kind==="systemEvent")return r`<div class="cron-job-detail">
|
|
1847
1847
|
<span class="cron-job-detail-label">System</span>
|
|
1848
1848
|
<span class="muted cron-job-detail-value">${e.payload.text}</span>
|
|
1849
|
-
</div>`;const t=e.delivery,n=t?.channel||t?.to?` (${t.channel??"last"}${t.to?` -> ${t.to}`:""})`:"";return
|
|
1849
|
+
</div>`;const t=e.delivery,n=t?.channel||t?.to?` (${t.channel??"last"}${t.to?` -> ${t.to}`:""})`:"";return r`
|
|
1850
1850
|
<div class="cron-job-detail">
|
|
1851
1851
|
<span class="cron-job-detail-label">Prompt</span>
|
|
1852
1852
|
<span class="muted cron-job-detail-value">${e.payload.message}</span>
|
|
1853
1853
|
</div>
|
|
1854
|
-
${t?
|
|
1854
|
+
${t?r`<div class="cron-job-detail">
|
|
1855
1855
|
<span class="cron-job-detail-label">Delivery</span>
|
|
1856
1856
|
<span class="muted cron-job-detail-value">${t.mode}${n}</span>
|
|
1857
|
-
</div>`:
|
|
1858
|
-
`}function
|
|
1857
|
+
</div>`:g}
|
|
1858
|
+
`}function Qa(e){return typeof e!="number"||!Number.isFinite(e)?"n/a":rt(e)}function Zh(e){const t=e.state?.lastStatus??"n/a",n=t==="ok"?"cron-job-status-ok":t==="error"?"cron-job-status-error":t==="skipped"?"cron-job-status-skipped":"cron-job-status-na",s=e.state?.nextRunAtMs,i=e.state?.lastRunAtMs;return r`
|
|
1859
1859
|
<div class="cron-job-state">
|
|
1860
1860
|
<div class="cron-job-state-row">
|
|
1861
1861
|
<span class="cron-job-state-key">Status</span>
|
|
@@ -1863,31 +1863,31 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1863
1863
|
</div>
|
|
1864
1864
|
<div class="cron-job-state-row">
|
|
1865
1865
|
<span class="cron-job-state-key">Next</span>
|
|
1866
|
-
<span class="cron-job-state-value" title=${
|
|
1867
|
-
${
|
|
1866
|
+
<span class="cron-job-state-value" title=${Ct(s)}>
|
|
1867
|
+
${Qa(s)}
|
|
1868
1868
|
</span>
|
|
1869
1869
|
</div>
|
|
1870
1870
|
<div class="cron-job-state-row">
|
|
1871
1871
|
<span class="cron-job-state-key">Last</span>
|
|
1872
|
-
<span class="cron-job-state-value" title=${
|
|
1873
|
-
${
|
|
1872
|
+
<span class="cron-job-state-value" title=${Ct(i)}>
|
|
1873
|
+
${Qa(i)}
|
|
1874
1874
|
</span>
|
|
1875
1875
|
</div>
|
|
1876
1876
|
</div>
|
|
1877
|
-
`}function
|
|
1877
|
+
`}function Xh(e,t){const n=typeof e.sessionKey=="string"&&e.sessionKey.trim().length>0?`${fn("chat",t)}?session=${encodeURIComponent(e.sessionKey)}`:null;return r`
|
|
1878
1878
|
<div class="list-item">
|
|
1879
1879
|
<div class="list-main">
|
|
1880
1880
|
<div class="list-title">${e.status}</div>
|
|
1881
1881
|
<div class="list-sub">${e.summary??""}</div>
|
|
1882
1882
|
</div>
|
|
1883
1883
|
<div class="list-meta">
|
|
1884
|
-
<div>${
|
|
1884
|
+
<div>${Ct(e.ts)}</div>
|
|
1885
1885
|
<div class="muted">${e.durationMs??0}ms</div>
|
|
1886
|
-
${n?
|
|
1887
|
-
${e.error?
|
|
1886
|
+
${n?r`<div><a class="session-link" href=${n}>Open run chat</a></div>`:g}
|
|
1887
|
+
${e.error?r`<div class="muted">${e.error}</div>`:g}
|
|
1888
1888
|
</div>
|
|
1889
1889
|
</div>
|
|
1890
|
-
`}function
|
|
1890
|
+
`}function ef(e){const n=(e.status&&typeof e.status=="object"?e.status.securityAudit:null)?.summary??null,s=n?.critical??0,i=n?.warn??0,a=n?.info??0,o=s>0?"danger":i>0?"warn":"success",c=s>0?`${s} critical`:i>0?`${i} warnings`:"No critical issues";return r`
|
|
1891
1891
|
<section class="grid grid-cols-2">
|
|
1892
1892
|
<div class="card">
|
|
1893
1893
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -1902,10 +1902,10 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1902
1902
|
<div class="stack" style="margin-top: 12px;">
|
|
1903
1903
|
<div>
|
|
1904
1904
|
<div class="muted">Status</div>
|
|
1905
|
-
${n?
|
|
1906
|
-
Security audit: ${
|
|
1905
|
+
${n?r`<div class="callout ${o}" style="margin-top: 8px;">
|
|
1906
|
+
Security audit: ${c}${a>0?` · ${a} info`:""}. Run
|
|
1907
1907
|
<span class="mono">poolbot security audit --deep</span> for details.
|
|
1908
|
-
</div>`:
|
|
1908
|
+
</div>`:g}
|
|
1909
1909
|
<pre class="code-block">${JSON.stringify(e.status??{},null,2)}</pre>
|
|
1910
1910
|
</div>
|
|
1911
1911
|
<div>
|
|
@@ -1927,7 +1927,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1927
1927
|
<span>Method</span>
|
|
1928
1928
|
<input
|
|
1929
1929
|
.value=${e.callMethod}
|
|
1930
|
-
@input=${
|
|
1930
|
+
@input=${l=>e.onCallMethodChange(l.target.value)}
|
|
1931
1931
|
placeholder="system-presence"
|
|
1932
1932
|
/>
|
|
1933
1933
|
</label>
|
|
@@ -1935,7 +1935,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1935
1935
|
<span>Params (JSON)</span>
|
|
1936
1936
|
<textarea
|
|
1937
1937
|
.value=${e.callParams}
|
|
1938
|
-
@input=${
|
|
1938
|
+
@input=${l=>e.onCallParamsChange(l.target.value)}
|
|
1939
1939
|
rows="6"
|
|
1940
1940
|
></textarea>
|
|
1941
1941
|
</label>
|
|
@@ -1943,10 +1943,10 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1943
1943
|
<div class="row" style="margin-top: 12px;">
|
|
1944
1944
|
<button class="btn primary" @click=${e.onCall}>Call</button>
|
|
1945
1945
|
</div>
|
|
1946
|
-
${e.callError?
|
|
1946
|
+
${e.callError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1947
1947
|
${e.callError}
|
|
1948
|
-
</div>`:
|
|
1949
|
-
${e.callResult?
|
|
1948
|
+
</div>`:g}
|
|
1949
|
+
${e.callResult?r`<pre class="code-block" style="margin-top: 12px;">${e.callResult}</pre>`:g}
|
|
1950
1950
|
</div>
|
|
1951
1951
|
</section>
|
|
1952
1952
|
|
|
@@ -1959,23 +1959,23 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1959
1959
|
<section class="card" style="margin-top: 18px;">
|
|
1960
1960
|
<div class="card-title">Event Log</div>
|
|
1961
1961
|
<div class="card-sub">Latest gateway events.</div>
|
|
1962
|
-
${e.eventLog.length===0?
|
|
1962
|
+
${e.eventLog.length===0?r`<div class="muted" style="margin-top: 12px;">No events yet.</div>`:r`
|
|
1963
1963
|
<div class="list" style="margin-top: 12px;">
|
|
1964
|
-
${e.eventLog.map(r
|
|
1964
|
+
${e.eventLog.map(l=>r`
|
|
1965
1965
|
<div class="list-item">
|
|
1966
1966
|
<div class="list-main">
|
|
1967
|
-
<div class="list-title">${
|
|
1968
|
-
<div class="list-sub">${new Date(
|
|
1967
|
+
<div class="list-title">${l.event}</div>
|
|
1968
|
+
<div class="list-sub">${new Date(l.ts).toLocaleTimeString()}</div>
|
|
1969
1969
|
</div>
|
|
1970
1970
|
<div class="list-meta">
|
|
1971
|
-
<pre class="code-block">${
|
|
1971
|
+
<pre class="code-block">${Tr(l.payload)}</pre>
|
|
1972
1972
|
</div>
|
|
1973
1973
|
</div>
|
|
1974
1974
|
`)}
|
|
1975
1975
|
</div>
|
|
1976
1976
|
`}
|
|
1977
1977
|
</section>
|
|
1978
|
-
`}function
|
|
1978
|
+
`}function tf(e){return r`
|
|
1979
1979
|
<section class="card">
|
|
1980
1980
|
<div class="row" style="justify-content: space-between;">
|
|
1981
1981
|
<div>
|
|
@@ -1986,38 +1986,38 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1986
1986
|
${e.loading?"Loading…":"Refresh"}
|
|
1987
1987
|
</button>
|
|
1988
1988
|
</div>
|
|
1989
|
-
${e.lastError?
|
|
1989
|
+
${e.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1990
1990
|
${e.lastError}
|
|
1991
|
-
</div>`:
|
|
1992
|
-
${e.statusMessage?
|
|
1991
|
+
</div>`:g}
|
|
1992
|
+
${e.statusMessage?r`<div class="callout" style="margin-top: 12px;">
|
|
1993
1993
|
${e.statusMessage}
|
|
1994
|
-
</div>`:
|
|
1994
|
+
</div>`:g}
|
|
1995
1995
|
<div class="list" style="margin-top: 16px;">
|
|
1996
|
-
${e.entries.length===0?
|
|
1996
|
+
${e.entries.length===0?r`<div class="muted">No instances reported yet.</div>`:e.entries.map(t=>nf(t))}
|
|
1997
1997
|
</div>
|
|
1998
1998
|
</section>
|
|
1999
|
-
`}function
|
|
1999
|
+
`}function nf(e){const t=e.lastInputSeconds!=null?`${e.lastInputSeconds}s ago`:"n/a",n=e.mode??"unknown",s=Array.isArray(e.roles)?e.roles.filter(Boolean):[],i=Array.isArray(e.scopes)?e.scopes.filter(Boolean):[],a=i.length>0?i.length>3?`${i.length} scopes`:`scopes: ${i.join(", ")}`:null;return r`
|
|
2000
2000
|
<div class="list-item">
|
|
2001
2001
|
<div class="list-main">
|
|
2002
2002
|
<div class="list-title">${e.host??"unknown host"}</div>
|
|
2003
|
-
<div class="list-sub">${
|
|
2003
|
+
<div class="list-sub">${Kh(e)}</div>
|
|
2004
2004
|
<div class="chip-row">
|
|
2005
2005
|
<span class="chip">${n}</span>
|
|
2006
|
-
${s.map(o=>
|
|
2007
|
-
${a?
|
|
2008
|
-
${e.platform?
|
|
2009
|
-
${e.deviceFamily?
|
|
2010
|
-
${e.modelIdentifier?
|
|
2011
|
-
${e.version?
|
|
2006
|
+
${s.map(o=>r`<span class="chip">${o}</span>`)}
|
|
2007
|
+
${a?r`<span class="chip">${a}</span>`:g}
|
|
2008
|
+
${e.platform?r`<span class="chip">${e.platform}</span>`:g}
|
|
2009
|
+
${e.deviceFamily?r`<span class="chip">${e.deviceFamily}</span>`:g}
|
|
2010
|
+
${e.modelIdentifier?r`<span class="chip">${e.modelIdentifier}</span>`:g}
|
|
2011
|
+
${e.version?r`<span class="chip">${e.version}</span>`:g}
|
|
2012
2012
|
</div>
|
|
2013
2013
|
</div>
|
|
2014
2014
|
<div class="list-meta">
|
|
2015
|
-
<div>${
|
|
2015
|
+
<div>${zh(e)}</div>
|
|
2016
2016
|
<div class="muted">Last input ${t}</div>
|
|
2017
2017
|
<div class="muted">Reason ${e.reason??""}</div>
|
|
2018
2018
|
</div>
|
|
2019
2019
|
</div>
|
|
2020
|
-
`}const
|
|
2020
|
+
`}const Ja=["trace","debug","info","warn","error","fatal"];function sf(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function af(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function of(e){const t=e.filterText.trim().toLowerCase(),n=Ja.some(a=>!e.levelFilters[a]),s=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:af(a,t)),i=t||n?"filtered":"visible";return r`
|
|
2021
2021
|
<section class="card">
|
|
2022
2022
|
<div class="row" style="justify-content: space-between;">
|
|
2023
2023
|
<div>
|
|
@@ -2058,7 +2058,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2058
2058
|
</div>
|
|
2059
2059
|
|
|
2060
2060
|
<div class="chip-row" style="margin-top: 12px;">
|
|
2061
|
-
${
|
|
2061
|
+
${Ja.map(a=>r`
|
|
2062
2062
|
<label class="chip log-chip ${a}">
|
|
2063
2063
|
<input
|
|
2064
2064
|
type="checkbox"
|
|
@@ -2070,16 +2070,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2070
2070
|
`)}
|
|
2071
2071
|
</div>
|
|
2072
2072
|
|
|
2073
|
-
${e.file?
|
|
2074
|
-
${e.truncated?
|
|
2073
|
+
${e.file?r`<div class="muted" style="margin-top: 10px;">File: ${e.file}</div>`:g}
|
|
2074
|
+
${e.truncated?r`<div class="callout" style="margin-top: 10px;">
|
|
2075
2075
|
Log output truncated; showing latest chunk.
|
|
2076
|
-
</div>`:
|
|
2077
|
-
${e.error?
|
|
2076
|
+
</div>`:g}
|
|
2077
|
+
${e.error?r`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:g}
|
|
2078
2078
|
|
|
2079
2079
|
<div class="log-stream" style="margin-top: 12px;" @scroll=${e.onScroll}>
|
|
2080
|
-
${s.length===0?
|
|
2080
|
+
${s.length===0?r`<div class="muted" style="padding: 12px;">No log entries.</div>`:s.map(a=>r`
|
|
2081
2081
|
<div class="log-row">
|
|
2082
|
-
<div class="log-time mono">${
|
|
2082
|
+
<div class="log-time mono">${sf(a.time)}</div>
|
|
2083
2083
|
<div class="log-level ${a.level??""}">${a.level??""}</div>
|
|
2084
2084
|
<div class="log-subsystem mono">${a.subsystem??""}</div>
|
|
2085
2085
|
<div class="log-message mono">${a.message??a.raw}</div>
|
|
@@ -2087,7 +2087,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2087
2087
|
`)}
|
|
2088
2088
|
</div>
|
|
2089
2089
|
</section>
|
|
2090
|
-
`}function
|
|
2090
|
+
`}function Er(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach((i,a)=>{if(!i||typeof i!="object")return;const o=i,c=typeof o.id=="string"?o.id.trim():"";if(!c)return;const l=typeof o.name=="string"?o.name.trim():void 0,p=o.default===!0;s.push({id:c,name:l||void 0,isDefault:p,index:a,record:o})}),s}function Cr(e,t){const n=new Set(t),s=[];for(const i of e){if(!(Array.isArray(i.commands)?i.commands:[]).some(p=>n.has(String(p))))continue;const c=typeof i.nodeId=="string"?i.nodeId.trim():"";if(!c)continue;const l=typeof i.displayName=="string"&&i.displayName.trim()?i.displayName.trim():c;s.push({id:c,label:l===c?c:`${l} · ${c}`})}return s.sort((i,a)=>i.label.localeCompare(a.label)),s}const _e="__defaults__",Za=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],rf=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Xa(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function lf(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function cf(e){const t=e?.defaults??{};return{security:Xa(t.security),ask:lf(t.ask),askFallback:Xa(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function df(e){return Er(e).map(t=>({id:t.id,name:t.name,isDefault:t.isDefault}))}function uf(e,t){const n=df(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(o=>i.set(o.id,o)),s.forEach(o=>{i.has(o)||i.set(o,{id:o})});const a=Array.from(i.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,c)=>{if(o.isDefault&&!c.isDefault)return-1;if(!o.isDefault&&c.isDefault)return 1;const l=o.name?.trim()?o.name:o.id,p=c.name?.trim()?c.name:c.id;return l.localeCompare(p)}),a}function pf(e,t){return e===_e?_e:e&&t.some(n=>n.id===e)?e:_e}function hf(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=cf(t),i=uf(e.configForm,t),a=wf(e.nodes),o=e.execApprovalsTarget;let c=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&c&&!a.some(u=>u.id===c)&&(c=null);const l=pf(e.execApprovalsSelectedAgent,i),p=l!==_e?(t?.agents??{})[l]??null:null,d=Array.isArray(p?.allowlist)?p.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:l,selectedAgent:p,agents:i,allowlist:d,target:o,targetNodeId:c,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function ff(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return r`
|
|
2091
2091
|
<section class="card">
|
|
2092
2092
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
2093
2093
|
<div>
|
|
@@ -2105,20 +2105,20 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2105
2105
|
</button>
|
|
2106
2106
|
</div>
|
|
2107
2107
|
|
|
2108
|
-
${
|
|
2108
|
+
${gf(e)}
|
|
2109
2109
|
|
|
2110
|
-
${t?
|
|
2111
|
-
${
|
|
2112
|
-
${
|
|
2113
|
-
${e.selectedScope===
|
|
2114
|
-
`:
|
|
2110
|
+
${t?r`
|
|
2111
|
+
${vf(e)}
|
|
2112
|
+
${mf(e)}
|
|
2113
|
+
${e.selectedScope===_e?g:bf(e)}
|
|
2114
|
+
`:r`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
2115
2115
|
<div class="muted">Load exec approvals to edit allowlists.</div>
|
|
2116
2116
|
<button class="btn" ?disabled=${e.loading||!n} @click=${e.onLoad}>
|
|
2117
2117
|
${e.loading?"Loading…":"Load approvals"}
|
|
2118
2118
|
</button>
|
|
2119
2119
|
</div>`}
|
|
2120
2120
|
</section>
|
|
2121
|
-
`}function
|
|
2121
|
+
`}function gf(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return r`
|
|
2122
2122
|
<div class="list" style="margin-top: 12px;">
|
|
2123
2123
|
<div class="list-item">
|
|
2124
2124
|
<div class="list-main">
|
|
@@ -2138,7 +2138,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2138
2138
|
<option value="node" ?selected=${e.target==="node"}>Node</option>
|
|
2139
2139
|
</select>
|
|
2140
2140
|
</label>
|
|
2141
|
-
${e.target==="node"?
|
|
2141
|
+
${e.target==="node"?r`
|
|
2142
2142
|
<label class="field">
|
|
2143
2143
|
<span>Node</span>
|
|
2144
2144
|
<select
|
|
@@ -2146,7 +2146,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2146
2146
|
@change=${s=>{const a=s.target.value.trim();e.onSelectTarget("node",a||null)}}
|
|
2147
2147
|
>
|
|
2148
2148
|
<option value="" ?selected=${n===""}>Select node</option>
|
|
2149
|
-
${e.targetNodes.map(s=>
|
|
2149
|
+
${e.targetNodes.map(s=>r`<option
|
|
2150
2150
|
value=${s.id}
|
|
2151
2151
|
?selected=${n===s.id}
|
|
2152
2152
|
>
|
|
@@ -2154,24 +2154,24 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2154
2154
|
</option>`)}
|
|
2155
2155
|
</select>
|
|
2156
2156
|
</label>
|
|
2157
|
-
`:
|
|
2157
|
+
`:g}
|
|
2158
2158
|
</div>
|
|
2159
2159
|
</div>
|
|
2160
|
-
${e.target==="node"&&!t?
|
|
2160
|
+
${e.target==="node"&&!t?r`
|
|
2161
2161
|
<div class="muted">No nodes advertise exec approvals yet.</div>
|
|
2162
|
-
`:
|
|
2162
|
+
`:g}
|
|
2163
2163
|
</div>
|
|
2164
|
-
`}function
|
|
2164
|
+
`}function vf(e){return r`
|
|
2165
2165
|
<div class="row" style="margin-top: 12px; gap: 8px; flex-wrap: wrap;">
|
|
2166
2166
|
<span class="label">Scope</span>
|
|
2167
2167
|
<div class="row" style="gap: 8px; flex-wrap: wrap;">
|
|
2168
2168
|
<button
|
|
2169
|
-
class="btn btn--sm ${e.selectedScope===
|
|
2170
|
-
@click=${()=>e.onSelectScope(
|
|
2169
|
+
class="btn btn--sm ${e.selectedScope===_e?"active":""}"
|
|
2170
|
+
@click=${()=>e.onSelectScope(_e)}
|
|
2171
2171
|
>
|
|
2172
2172
|
Defaults
|
|
2173
2173
|
</button>
|
|
2174
|
-
${e.agents.map(t=>{const n=t.name?.trim()?`${t.name} (${t.id})`:t.id;return
|
|
2174
|
+
${e.agents.map(t=>{const n=t.name?.trim()?`${t.name} (${t.id})`:t.id;return r`
|
|
2175
2175
|
<button
|
|
2176
2176
|
class="btn btn--sm ${e.selectedScope===t.id?"active":""}"
|
|
2177
2177
|
@click=${()=>e.onSelectScope(t.id)}
|
|
@@ -2181,7 +2181,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2181
2181
|
`})}
|
|
2182
2182
|
</div>
|
|
2183
2183
|
</div>
|
|
2184
|
-
`}function
|
|
2184
|
+
`}function mf(e){const t=e.selectedScope===_e,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],a=typeof s.security=="string"?s.security:void 0,o=typeof s.ask=="string"?s.ask:void 0,c=typeof s.askFallback=="string"?s.askFallback:void 0,l=t?n.security:a??"__default__",p=t?n.ask:o??"__default__",d=t?n.askFallback:c??"__default__",u=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,f=u??n.autoAllowSkills,v=u==null;return r`
|
|
2185
2185
|
<div class="list" style="margin-top: 16px;">
|
|
2186
2186
|
<div class="list-item">
|
|
2187
2187
|
<div class="list-main">
|
|
@@ -2195,16 +2195,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2195
2195
|
<span>Mode</span>
|
|
2196
2196
|
<select
|
|
2197
2197
|
?disabled=${e.disabled}
|
|
2198
|
-
@change=${
|
|
2198
|
+
@change=${m=>{const k=m.target.value;!t&&k==="__default__"?e.onRemove([...i,"security"]):e.onPatch([...i,"security"],k)}}
|
|
2199
2199
|
>
|
|
2200
|
-
${t?
|
|
2200
|
+
${t?g:r`<option value="__default__" ?selected=${l==="__default__"}>
|
|
2201
2201
|
Use default (${n.security})
|
|
2202
2202
|
</option>`}
|
|
2203
|
-
${
|
|
2204
|
-
value=${
|
|
2205
|
-
?selected=${
|
|
2203
|
+
${Za.map(m=>r`<option
|
|
2204
|
+
value=${m.value}
|
|
2205
|
+
?selected=${l===m.value}
|
|
2206
2206
|
>
|
|
2207
|
-
${
|
|
2207
|
+
${m.label}
|
|
2208
2208
|
</option>`)}
|
|
2209
2209
|
</select>
|
|
2210
2210
|
</label>
|
|
@@ -2223,16 +2223,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2223
2223
|
<span>Mode</span>
|
|
2224
2224
|
<select
|
|
2225
2225
|
?disabled=${e.disabled}
|
|
2226
|
-
@change=${
|
|
2226
|
+
@change=${m=>{const k=m.target.value;!t&&k==="__default__"?e.onRemove([...i,"ask"]):e.onPatch([...i,"ask"],k)}}
|
|
2227
2227
|
>
|
|
2228
|
-
${t?
|
|
2228
|
+
${t?g:r`<option value="__default__" ?selected=${p==="__default__"}>
|
|
2229
2229
|
Use default (${n.ask})
|
|
2230
2230
|
</option>`}
|
|
2231
|
-
${
|
|
2232
|
-
value=${
|
|
2233
|
-
?selected=${p===
|
|
2231
|
+
${rf.map(m=>r`<option
|
|
2232
|
+
value=${m.value}
|
|
2233
|
+
?selected=${p===m.value}
|
|
2234
2234
|
>
|
|
2235
|
-
${
|
|
2235
|
+
${m.label}
|
|
2236
2236
|
</option>`)}
|
|
2237
2237
|
</select>
|
|
2238
2238
|
</label>
|
|
@@ -2251,16 +2251,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2251
2251
|
<span>Fallback</span>
|
|
2252
2252
|
<select
|
|
2253
2253
|
?disabled=${e.disabled}
|
|
2254
|
-
@change=${
|
|
2254
|
+
@change=${m=>{const k=m.target.value;!t&&k==="__default__"?e.onRemove([...i,"askFallback"]):e.onPatch([...i,"askFallback"],k)}}
|
|
2255
2255
|
>
|
|
2256
|
-
${t?
|
|
2256
|
+
${t?g:r`<option value="__default__" ?selected=${d==="__default__"}>
|
|
2257
2257
|
Use default (${n.askFallback})
|
|
2258
2258
|
</option>`}
|
|
2259
|
-
${
|
|
2260
|
-
value=${
|
|
2261
|
-
?selected=${d===
|
|
2259
|
+
${Za.map(m=>r`<option
|
|
2260
|
+
value=${m.value}
|
|
2261
|
+
?selected=${d===m.value}
|
|
2262
2262
|
>
|
|
2263
|
-
${
|
|
2263
|
+
${m.label}
|
|
2264
2264
|
</option>`)}
|
|
2265
2265
|
</select>
|
|
2266
2266
|
</label>
|
|
@@ -2271,7 +2271,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2271
2271
|
<div class="list-main">
|
|
2272
2272
|
<div class="list-title">Auto-allow skill CLIs</div>
|
|
2273
2273
|
<div class="list-sub">
|
|
2274
|
-
${t?"Allow skill executables listed by the Gateway.":v?`Using default (${n.autoAllowSkills?"on":"off"}).`:`Override (${
|
|
2274
|
+
${t?"Allow skill executables listed by the Gateway.":v?`Using default (${n.autoAllowSkills?"on":"off"}).`:`Override (${f?"on":"off"}).`}
|
|
2275
2275
|
</div>
|
|
2276
2276
|
</div>
|
|
2277
2277
|
<div class="list-meta">
|
|
@@ -2280,21 +2280,21 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2280
2280
|
<input
|
|
2281
2281
|
type="checkbox"
|
|
2282
2282
|
?disabled=${e.disabled}
|
|
2283
|
-
.checked=${
|
|
2284
|
-
@change=${
|
|
2283
|
+
.checked=${f}
|
|
2284
|
+
@change=${m=>{const $=m.target;e.onPatch([...i,"autoAllowSkills"],$.checked)}}
|
|
2285
2285
|
/>
|
|
2286
2286
|
</label>
|
|
2287
|
-
${!t&&!v?
|
|
2287
|
+
${!t&&!v?r`<button
|
|
2288
2288
|
class="btn btn--sm"
|
|
2289
2289
|
?disabled=${e.disabled}
|
|
2290
2290
|
@click=${()=>e.onRemove([...i,"autoAllowSkills"])}
|
|
2291
2291
|
>
|
|
2292
2292
|
Use default
|
|
2293
|
-
</button>`:
|
|
2293
|
+
</button>`:g}
|
|
2294
2294
|
</div>
|
|
2295
2295
|
</div>
|
|
2296
2296
|
</div>
|
|
2297
|
-
`}function
|
|
2297
|
+
`}function bf(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return r`
|
|
2298
2298
|
<div class="row" style="margin-top: 18px; justify-content: space-between;">
|
|
2299
2299
|
<div>
|
|
2300
2300
|
<div class="card-title">Allowlist</div>
|
|
@@ -2309,17 +2309,17 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2309
2309
|
</button>
|
|
2310
2310
|
</div>
|
|
2311
2311
|
<div class="list" style="margin-top: 12px;">
|
|
2312
|
-
${n.length===0?
|
|
2312
|
+
${n.length===0?r`
|
|
2313
2313
|
<div class="muted">No allowlist entries yet.</div>
|
|
2314
|
-
`:n.map((s,i)=>
|
|
2314
|
+
`:n.map((s,i)=>yf(e,s,i))}
|
|
2315
2315
|
</div>
|
|
2316
|
-
`}function
|
|
2316
|
+
`}function yf(e,t,n){const s=t.lastUsedAt?rt(t.lastUsedAt):"never",i=t.lastUsedCommand?fs(t.lastUsedCommand,120):null,a=t.lastResolvedPath?fs(t.lastResolvedPath,120):null;return r`
|
|
2317
2317
|
<div class="list-item">
|
|
2318
2318
|
<div class="list-main">
|
|
2319
2319
|
<div class="list-title">${t.pattern?.trim()?t.pattern:"New pattern"}</div>
|
|
2320
2320
|
<div class="list-sub">Last used: ${s}</div>
|
|
2321
|
-
${i?
|
|
2322
|
-
${a?
|
|
2321
|
+
${i?r`<div class="list-sub mono">${i}</div>`:g}
|
|
2322
|
+
${a?r`<div class="list-sub mono">${a}</div>`:g}
|
|
2323
2323
|
</div>
|
|
2324
2324
|
<div class="list-meta">
|
|
2325
2325
|
<label class="field">
|
|
@@ -2328,7 +2328,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2328
2328
|
type="text"
|
|
2329
2329
|
.value=${t.pattern??""}
|
|
2330
2330
|
?disabled=${e.disabled}
|
|
2331
|
-
@input=${o=>{const
|
|
2331
|
+
@input=${o=>{const c=o.target;e.onPatch(["agents",e.selectedScope,"allowlist",n,"pattern"],c.value)}}
|
|
2332
2332
|
/>
|
|
2333
2333
|
</label>
|
|
2334
2334
|
<button
|
|
@@ -2340,10 +2340,10 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2340
2340
|
</button>
|
|
2341
2341
|
</div>
|
|
2342
2342
|
</div>
|
|
2343
|
-
`}function
|
|
2344
|
-
${
|
|
2345
|
-
${
|
|
2346
|
-
${
|
|
2343
|
+
`}function wf(e){return Cr(e,["system.execApprovals.get","system.execApprovals.set"])}function $f(e){const t=_f(e),n=hf(e);return r`
|
|
2344
|
+
${ff(n)}
|
|
2345
|
+
${Tf(t)}
|
|
2346
|
+
${Af(e)}
|
|
2347
2347
|
<section class="card">
|
|
2348
2348
|
<div class="row" style="justify-content: space-between;">
|
|
2349
2349
|
<div>
|
|
@@ -2355,12 +2355,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2355
2355
|
</button>
|
|
2356
2356
|
</div>
|
|
2357
2357
|
<div class="list" style="margin-top: 16px;">
|
|
2358
|
-
${e.nodes.length===0?
|
|
2358
|
+
${e.nodes.length===0?r`
|
|
2359
2359
|
<div class="muted">No nodes found.</div>
|
|
2360
|
-
`:e.nodes.map(s=>
|
|
2360
|
+
`:e.nodes.map(s=>Rf(s))}
|
|
2361
2361
|
</div>
|
|
2362
2362
|
</section>
|
|
2363
|
-
`}function
|
|
2363
|
+
`}function Af(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],s=Array.isArray(t.paired)?t.paired:[];return r`
|
|
2364
2364
|
<section class="card">
|
|
2365
2365
|
<div class="row" style="justify-content: space-between;">
|
|
2366
2366
|
<div>
|
|
@@ -2371,22 +2371,22 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2371
2371
|
${e.devicesLoading?"Loading…":"Refresh"}
|
|
2372
2372
|
</button>
|
|
2373
2373
|
</div>
|
|
2374
|
-
${e.devicesError?
|
|
2374
|
+
${e.devicesError?r`<div class="callout danger" style="margin-top: 12px;">${e.devicesError}</div>`:g}
|
|
2375
2375
|
<div class="list" style="margin-top: 16px;">
|
|
2376
|
-
${n.length>0?
|
|
2376
|
+
${n.length>0?r`
|
|
2377
2377
|
<div class="muted" style="margin-bottom: 8px;">Pending</div>
|
|
2378
|
-
${n.map(i=>
|
|
2379
|
-
`:
|
|
2380
|
-
${s.length>0?
|
|
2378
|
+
${n.map(i=>kf(i,e))}
|
|
2379
|
+
`:g}
|
|
2380
|
+
${s.length>0?r`
|
|
2381
2381
|
<div class="muted" style="margin-top: 12px; margin-bottom: 8px;">Paired</div>
|
|
2382
|
-
${s.map(i=>
|
|
2383
|
-
`:
|
|
2384
|
-
${n.length===0&&s.length===0?
|
|
2382
|
+
${s.map(i=>xf(i,e))}
|
|
2383
|
+
`:g}
|
|
2384
|
+
${n.length===0&&s.length===0?r`
|
|
2385
2385
|
<div class="muted">No paired devices.</div>
|
|
2386
|
-
`:
|
|
2386
|
+
`:g}
|
|
2387
2387
|
</div>
|
|
2388
2388
|
</section>
|
|
2389
|
-
`}function
|
|
2389
|
+
`}function kf(e,t){const n=e.displayName?.trim()||e.deviceId,s=typeof e.ts=="number"?rt(e.ts):"n/a",i=e.role?.trim()?`role: ${e.role}`:"role: -",a=e.isRepair?" · repair":"",o=e.remoteIp?` · ${e.remoteIp}`:"";return r`
|
|
2390
2390
|
<div class="list-item">
|
|
2391
2391
|
<div class="list-main">
|
|
2392
2392
|
<div class="list-title">${n}</div>
|
|
@@ -2406,23 +2406,23 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2406
2406
|
</div>
|
|
2407
2407
|
</div>
|
|
2408
2408
|
</div>
|
|
2409
|
-
`}function
|
|
2409
|
+
`}function xf(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${hs(e.roles)}`,a=`scopes: ${hs(e.scopes)}`,o=Array.isArray(e.tokens)?e.tokens:[];return r`
|
|
2410
2410
|
<div class="list-item">
|
|
2411
2411
|
<div class="list-main">
|
|
2412
2412
|
<div class="list-title">${n}</div>
|
|
2413
2413
|
<div class="list-sub">${e.deviceId}${s}</div>
|
|
2414
2414
|
<div class="muted" style="margin-top: 6px;">${i} · ${a}</div>
|
|
2415
|
-
${o.length===0?
|
|
2415
|
+
${o.length===0?r`
|
|
2416
2416
|
<div class="muted" style="margin-top: 6px">Tokens: none</div>
|
|
2417
|
-
`:
|
|
2417
|
+
`:r`
|
|
2418
2418
|
<div class="muted" style="margin-top: 10px;">Tokens</div>
|
|
2419
2419
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 6px;">
|
|
2420
|
-
${o.map(
|
|
2420
|
+
${o.map(c=>Sf(e.deviceId,c,t))}
|
|
2421
2421
|
</div>
|
|
2422
2422
|
`}
|
|
2423
2423
|
</div>
|
|
2424
2424
|
</div>
|
|
2425
|
-
`}function
|
|
2425
|
+
`}function Sf(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${hs(t.scopes)}`,a=rt(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return r`
|
|
2426
2426
|
<div class="row" style="justify-content: space-between; gap: 8px;">
|
|
2427
2427
|
<div class="list-sub">${t.role} · ${s} · ${i} · ${a}</div>
|
|
2428
2428
|
<div class="row" style="justify-content: flex-end; gap: 6px; flex-wrap: wrap;">
|
|
@@ -2432,7 +2432,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2432
2432
|
>
|
|
2433
2433
|
Rotate
|
|
2434
2434
|
</button>
|
|
2435
|
-
${t.revokedAtMs?
|
|
2435
|
+
${t.revokedAtMs?g:r`
|
|
2436
2436
|
<button
|
|
2437
2437
|
class="btn btn--sm danger"
|
|
2438
2438
|
@click=${()=>n.onDeviceRevoke(e,t.role)}
|
|
@@ -2442,7 +2442,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2442
2442
|
`}
|
|
2443
2443
|
</div>
|
|
2444
2444
|
</div>
|
|
2445
|
-
`}function
|
|
2445
|
+
`}function _f(e){const t=e.configForm,n=Cf(e.nodes),{defaultBinding:s,agents:i}=If(t),a=!!t,o=e.configSaving||e.configFormMode==="raw";return{ready:a,disabled:o,configDirty:e.configDirty,configLoading:e.configLoading,configSaving:e.configSaving,defaultBinding:s,agents:i,nodes:n,onBindDefault:e.onBindDefault,onBindAgent:e.onBindAgent,onSave:e.onSaveBindings,onLoadConfig:e.onLoadConfig,formMode:e.configFormMode}}function Tf(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return r`
|
|
2446
2446
|
<section class="card">
|
|
2447
2447
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
2448
2448
|
<div>
|
|
@@ -2460,13 +2460,13 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2460
2460
|
</button>
|
|
2461
2461
|
</div>
|
|
2462
2462
|
|
|
2463
|
-
${e.formMode==="raw"?
|
|
2463
|
+
${e.formMode==="raw"?r`
|
|
2464
2464
|
<div class="callout warn" style="margin-top: 12px">
|
|
2465
2465
|
Switch the Config tab to <strong>Form</strong> mode to edit bindings here.
|
|
2466
2466
|
</div>
|
|
2467
|
-
`:
|
|
2467
|
+
`:g}
|
|
2468
2468
|
|
|
2469
|
-
${e.ready?
|
|
2469
|
+
${e.ready?r`
|
|
2470
2470
|
<div class="list" style="margin-top: 16px;">
|
|
2471
2471
|
<div class="list-item">
|
|
2472
2472
|
<div class="list-main">
|
|
@@ -2481,7 +2481,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2481
2481
|
@change=${s=>{const a=s.target.value.trim();e.onBindDefault(a||null)}}
|
|
2482
2482
|
>
|
|
2483
2483
|
<option value="" ?selected=${n===""}>Any node</option>
|
|
2484
|
-
${e.nodes.map(s=>
|
|
2484
|
+
${e.nodes.map(s=>r`<option
|
|
2485
2485
|
value=${s.id}
|
|
2486
2486
|
?selected=${n===s.id}
|
|
2487
2487
|
>
|
|
@@ -2489,24 +2489,24 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2489
2489
|
</option>`)}
|
|
2490
2490
|
</select>
|
|
2491
2491
|
</label>
|
|
2492
|
-
${t?
|
|
2492
|
+
${t?g:r`
|
|
2493
2493
|
<div class="muted">No nodes with system.run available.</div>
|
|
2494
2494
|
`}
|
|
2495
2495
|
</div>
|
|
2496
2496
|
</div>
|
|
2497
2497
|
|
|
2498
|
-
${e.agents.length===0?
|
|
2498
|
+
${e.agents.length===0?r`
|
|
2499
2499
|
<div class="muted">No agents found.</div>
|
|
2500
|
-
`:e.agents.map(s=>
|
|
2500
|
+
`:e.agents.map(s=>Ef(s,e))}
|
|
2501
2501
|
</div>
|
|
2502
|
-
`:
|
|
2502
|
+
`:r`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
2503
2503
|
<div class="muted">Load config to edit bindings.</div>
|
|
2504
2504
|
<button class="btn" ?disabled=${e.configLoading} @click=${e.onLoadConfig}>
|
|
2505
2505
|
${e.configLoading?"Loading…":"Load config"}
|
|
2506
2506
|
</button>
|
|
2507
2507
|
</div>`}
|
|
2508
2508
|
</section>
|
|
2509
|
-
`}function
|
|
2509
|
+
`}function Ef(e,t){const n=e.binding??"__default__",s=e.name?.trim()?`${e.name} (${e.id})`:e.id,i=t.nodes.length>0;return r`
|
|
2510
2510
|
<div class="list-item">
|
|
2511
2511
|
<div class="list-main">
|
|
2512
2512
|
<div class="list-title">${s}</div>
|
|
@@ -2520,12 +2520,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2520
2520
|
<span>Binding</span>
|
|
2521
2521
|
<select
|
|
2522
2522
|
?disabled=${t.disabled||!i}
|
|
2523
|
-
@change=${a=>{const
|
|
2523
|
+
@change=${a=>{const c=a.target.value.trim();t.onBindAgent(e.index,c==="__default__"?null:c)}}
|
|
2524
2524
|
>
|
|
2525
2525
|
<option value="__default__" ?selected=${n==="__default__"}>
|
|
2526
2526
|
Use default
|
|
2527
2527
|
</option>
|
|
2528
|
-
${t.nodes.map(a=>
|
|
2528
|
+
${t.nodes.map(a=>r`<option
|
|
2529
2529
|
value=${a.id}
|
|
2530
2530
|
?selected=${n===a.id}
|
|
2531
2531
|
>
|
|
@@ -2535,7 +2535,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2535
2535
|
</label>
|
|
2536
2536
|
</div>
|
|
2537
2537
|
</div>
|
|
2538
|
-
`}function
|
|
2538
|
+
`}function Cf(e){return Cr(e,["system.run"])}function If(e){const t={id:"main",name:void 0,index:0,isDefault:!0,binding:null};if(!e||typeof e!="object")return{defaultBinding:null,agents:[t]};const s=(e.tools??{}).exec??{},i=typeof s.node=="string"&&s.node.trim()?s.node.trim():null,a=e.agents??{};if(!Array.isArray(a.list)||a.list.length===0)return{defaultBinding:i,agents:[t]};const o=Er(e).map(c=>{const p=(c.record.tools??{}).exec??{},d=typeof p.node=="string"&&p.node.trim()?p.node.trim():null;return{id:c.id,name:c.name,index:c.index,isDefault:c.isDefault,binding:d}});return o.length===0&&o.push(t),{defaultBinding:i,agents:o}}function Rf(e){const t=!!e.connected,n=!!e.paired,s=typeof e.displayName=="string"&&e.displayName.trim()||(typeof e.nodeId=="string"?e.nodeId:"unknown"),i=Array.isArray(e.caps)?e.caps:[],a=Array.isArray(e.commands)?e.commands:[];return r`
|
|
2539
2539
|
<div class="list-item">
|
|
2540
2540
|
<div class="list-main">
|
|
2541
2541
|
<div class="list-title">${s}</div>
|
|
@@ -2549,59 +2549,163 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2549
2549
|
<span class="chip ${t?"chip-ok":"chip-warn"}">
|
|
2550
2550
|
${t?"connected":"offline"}
|
|
2551
2551
|
</span>
|
|
2552
|
-
${i.slice(0,12).map(o=>
|
|
2553
|
-
${a.slice(0,8).map(o=>
|
|
2552
|
+
${i.slice(0,12).map(o=>r`<span class="chip">${String(o)}</span>`)}
|
|
2553
|
+
${a.slice(0,8).map(o=>r`<span class="chip">${String(o)}</span>`)}
|
|
2554
2554
|
</div>
|
|
2555
2555
|
</div>
|
|
2556
2556
|
</div>
|
|
2557
|
-
`}function
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2557
|
+
`}const Lf="modulepreload",Mf=function(e,t){return new URL(e,t).href},eo={},rs=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let p=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const o=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),l=c?.nonce||c?.getAttribute("nonce");i=p(n.map(d=>{if(d=Mf(d,s),d in eo)return;eo[d]=!0;const u=d.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(s)for(let m=o.length-1;m>=0;m--){const $=o[m];if($.href===d&&(!u||$.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${f}`))return;const v=document.createElement("link");if(v.rel=u?"stylesheet":Lf,u||(v.as="script"),v.crossOrigin="",v.href=d,l&&v.setAttribute("nonce",l),document.head.appendChild(v),u)return new Promise((m,$)=>{v.addEventListener("load",m),v.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return i.then(o=>{for(const c of o||[])c.status==="rejected"&&a(c.reason);return t().catch(a)})},Pf={common:{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",nodes:"Nodes",chat:"Chat",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.",nodes:"Paired devices, capabilities, and command exposure.",chat:"Direct gateway chat session for quick interventions.",config:"Edit ~/.poolbot/poolbot.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."},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)",onboardingDisabled:"Disabled during onboarding"},languages:{en:"English",zhCN:"简体中文 (Simplified Chinese)",zhTW:"繁體中文 (Traditional Chinese)",ptBR:"Português (Brazilian Portuguese)"}},Ir=["en","zh-CN","zh-TW","pt-BR"];function Nf(e){return e!=null&&Ir.includes(e)}class Of{constructor(){this.locale="en",this.translations={en:Pf},this.subscribers=new Set,this.loadLocale()}loadLocale(){const t=localStorage.getItem("poolbot.i18n.locale");if(Nf(t))this.locale=t;else{const n=navigator.language;n.startsWith("zh")?this.locale=n==="zh-TW"||n==="zh-HK"?"zh-TW":"zh-CN":n.startsWith("pt")?this.locale="pt-BR":this.locale="en"}}getLocale(){return this.locale}async setLocale(t){if(this.locale!==t){if(!this.translations[t])try{let n;if(t==="zh-CN")n=await rs(()=>import("./zh-CN-CDzeklK-.js"),[],import.meta.url);else if(t==="zh-TW")n=await rs(()=>import("./zh-TW-BJCRYNWH.js"),[],import.meta.url);else if(t==="pt-BR")n=await rs(()=>import("./pt-BR-DedEVAvY.js"),[],import.meta.url);else return;this.translations[t]=n[t.replace("-","_")]}catch(n){console.error(`Failed to load locale: ${t}`,n);return}this.locale=t,localStorage.setItem("poolbot.i18n.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.en;for(const a of s)if(i&&typeof i=="object")i=i[a];else{i=void 0;break}if(i===void 0&&this.locale!=="en"){i=this.translations.en;for(const a of s)if(i&&typeof i=="object")i=i[a];else{i=void 0;break}}return typeof i!="string"?t:n?i.replace(/\{(\w+)\}/g,(a,o)=>n[o]||`{${o}}`):i}}const Ms=new Of,E=(e,t)=>Ms.t(e,t),Ze="_blank";function Xe(){return"noopener noreferrer"}function Df(e){return e==="error"?"danger":e==="warning"?"warn":""}function Uf(e){return e in D?D[e]:D.radio}function Bf(e){return e.items.length===0?g:r`
|
|
2558
|
+
<section class="card ov-attention">
|
|
2559
|
+
<div class="card-title">${E("overview.attention.title")}</div>
|
|
2560
|
+
<div class="ov-attention-list">
|
|
2561
|
+
${e.items.map(t=>r`
|
|
2562
|
+
<div class="ov-attention-item ${Df(t.severity)}">
|
|
2563
|
+
<span class="ov-attention-icon">${Uf(t.icon)}</span>
|
|
2564
|
+
<div class="ov-attention-body">
|
|
2565
|
+
<div class="ov-attention-title">${t.title}</div>
|
|
2566
|
+
<div class="muted">${t.description}</div>
|
|
2567
|
+
</div>
|
|
2568
|
+
${t.href?r`<a
|
|
2569
|
+
class="ov-attention-link"
|
|
2570
|
+
href=${t.href}
|
|
2571
|
+
target=${t.external?Ze:g}
|
|
2572
|
+
rel=${t.external?Xe():g}
|
|
2573
|
+
>${E("common.docs")}</a>`:g}
|
|
2574
|
+
</div>
|
|
2575
|
+
`)}
|
|
2576
|
+
</div>
|
|
2577
|
+
</section>
|
|
2578
|
+
`}const Ff=/\d{3,}/g;function Hf(e){const n=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(Ff,s=>`<span class="blur-digits">${s}</span>`);return r`${an(n)}`}function Kf(e,t){return r`
|
|
2579
|
+
<button class="ov-card" data-kind=${e.kind} @click=${()=>t(e.tab)}>
|
|
2580
|
+
<span class="ov-card__label">${e.label}</span>
|
|
2581
|
+
<span class="ov-card__value">${e.value}</span>
|
|
2582
|
+
<span class="ov-card__hint">${e.hint}</span>
|
|
2583
|
+
</button>
|
|
2584
|
+
`}function zf(){return r`
|
|
2585
|
+
<section class="ov-cards">
|
|
2586
|
+
${[0,1,2,3].map(e=>r`
|
|
2587
|
+
<div class="ov-card" style="cursor:default;animation-delay:${e*50}ms">
|
|
2588
|
+
<span class="skeleton skeleton-line" style="width:60px;height:10px"></span>
|
|
2589
|
+
<span class="skeleton skeleton-stat"></span>
|
|
2590
|
+
<span class="skeleton skeleton-line skeleton-line--medium" style="height:12px"></span>
|
|
2591
|
+
</div>
|
|
2592
|
+
`)}
|
|
2593
|
+
</section>
|
|
2594
|
+
`}function jf(e){if(!(e.usageResult!=null||e.sessionsResult!=null||e.skillsReport!=null))return zf();const n=e.usageResult?.totals,s=Bl(n?.totalCost),i=Fl(n?.totalTokens),a=n?String(e.usageResult?.aggregates?.messages?.total??0):"0",o=e.sessionsResult?.count??null,c=e.skillsReport?.skills??[],l=c.filter(R=>!R.disabled).length,p=c.filter(R=>R.blockedByAllowlist).length,d=c.length,u=e.cronStatus?.enabled??null,f=e.cronStatus?.nextWakeAtMs??null,v=e.cronJobs.length,m=e.cronJobs.filter(R=>R.state?.lastStatus==="error").length,$=u==null?E("common.na"):u?`${v} jobs`:E("common.disabled"),k=m>0?r`<span class="danger">${m} failed</span>`:f?E("overview.stats.cronNext",{time:_r(f)}):"",_=[{kind:"cost",tab:"usage",label:E("overview.cards.cost"),value:s,hint:`${i} tokens · ${a} msgs`},{kind:"sessions",tab:"sessions",label:E("overview.stats.sessions"),value:String(o??E("common.na")),hint:E("overview.stats.sessionsHint")},{kind:"skills",tab:"skills",label:E("overview.cards.skills"),value:`${l}/${d}`,hint:p>0?`${p} blocked`:`${l} active`},{kind:"cron",tab:"cron",label:E("overview.stats.cron"),value:$,hint:k}],M=e.sessionsResult?.sessions.slice(0,5)??[];return r`
|
|
2595
|
+
<section class="ov-cards">
|
|
2596
|
+
${_.map(R=>Kf(R,e.onNavigate))}
|
|
2597
|
+
</section>
|
|
2598
|
+
|
|
2599
|
+
${M.length>0?r`
|
|
2600
|
+
<section class="ov-recent">
|
|
2601
|
+
<h3 class="ov-recent__title">${E("overview.cards.recentSessions")}</h3>
|
|
2602
|
+
<ul class="ov-recent__list">
|
|
2603
|
+
${M.map(R=>r`
|
|
2604
|
+
<li class="ov-recent__row">
|
|
2605
|
+
<span class="ov-recent__key">${Hf(R.displayName||R.label||R.key)}</span>
|
|
2606
|
+
<span class="ov-recent__model">${R.model??""}</span>
|
|
2607
|
+
<span class="ov-recent__time">${R.updatedAt?rt(R.updatedAt):""}</span>
|
|
2608
|
+
</li>
|
|
2609
|
+
`)}
|
|
2610
|
+
</ul>
|
|
2611
|
+
</section>
|
|
2612
|
+
`:g}
|
|
2613
|
+
`}function qf(e){if(e.events.length===0)return g;const t=e.events.slice(0,20);return r`
|
|
2614
|
+
<details class="card ov-event-log">
|
|
2615
|
+
<summary class="ov-expandable-toggle">
|
|
2616
|
+
<span class="nav-item__icon">${D.radio}</span>
|
|
2617
|
+
${E("overview.eventLog.title")}
|
|
2618
|
+
<span class="ov-count-badge">${e.events.length}</span>
|
|
2619
|
+
</summary>
|
|
2620
|
+
<div class="ov-event-log-list">
|
|
2621
|
+
${t.map(n=>r`
|
|
2622
|
+
<div class="ov-event-log-entry">
|
|
2623
|
+
<span class="ov-event-log-ts">${new Date(n.ts).toLocaleTimeString()}</span>
|
|
2624
|
+
<span class="ov-event-log-name">${n.event}</span>
|
|
2625
|
+
${n.payload?r`<span class="ov-event-log-payload muted">${Tr(n.payload).slice(0,120)}</span>`:g}
|
|
2626
|
+
</div>
|
|
2627
|
+
`)}
|
|
2628
|
+
</div>
|
|
2629
|
+
</details>
|
|
2630
|
+
`}const G={AUTH_REQUIRED:"AUTH_REQUIRED",AUTH_TOKEN_MISSING:"AUTH_TOKEN_MISSING",AUTH_PASSWORD_MISSING:"AUTH_PASSWORD_MISSING",AUTH_TOKEN_NOT_CONFIGURED:"AUTH_TOKEN_NOT_CONFIGURED",AUTH_PASSWORD_NOT_CONFIGURED:"AUTH_PASSWORD_NOT_CONFIGURED",AUTH_UNAUTHORIZED:"AUTH_UNAUTHORIZED",AUTH_TOKEN_MISMATCH:"AUTH_TOKEN_MISMATCH",AUTH_PASSWORD_MISMATCH:"AUTH_PASSWORD_MISMATCH",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"},Rr=new Set([G.AUTH_REQUIRED,G.AUTH_TOKEN_MISSING,G.AUTH_PASSWORD_MISSING,G.AUTH_TOKEN_NOT_CONFIGURED,G.AUTH_PASSWORD_NOT_CONFIGURED]),Wf=new Set([...Rr,G.AUTH_UNAUTHORIZED,G.AUTH_TOKEN_MISMATCH,G.AUTH_PASSWORD_MISMATCH,G.AUTH_DEVICE_TOKEN_MISMATCH,G.AUTH_RATE_LIMITED,G.AUTH_TAILSCALE_IDENTITY_MISSING,G.AUTH_TAILSCALE_PROXY_MISSING,G.AUTH_TAILSCALE_WHOIS_FAILED,G.AUTH_TAILSCALE_IDENTITY_MISMATCH]),Gf=new Set([G.CONTROL_UI_DEVICE_IDENTITY_REQUIRED,G.DEVICE_IDENTITY_REQUIRED]);function Vf(e,t,n){return e||!t?!1:n===G.PAIRING_REQUIRED?!0:t.toLowerCase().includes("pairing required")}function Yf(e){return e.connected||!e.lastError?null:e.lastErrorCode?Wf.has(e.lastErrorCode)?Rr.has(e.lastErrorCode)?"required":"failed":null:e.lastError.toLowerCase().includes("unauthorized")?!e.hasToken&&!e.hasPassword?"required":"failed":null}function Qf(e,t,n){if(e||!t)return!1;if(n)return Gf.has(n);const s=t.toLowerCase();return s.includes("secure context")||s.includes("device identity required")}function Jf(e){return e.replace(/\x1b\]8;;.*?\x1b\\|\x1b\]8;;\x1b\\/g,"").replace(/\x1b\[[0-9;]*m/g,"")}function Zf(e){if(e.lines.length===0)return g;const t=e.lines.slice(-50).map(n=>Jf(n)).join(`
|
|
2631
|
+
`);return r`
|
|
2632
|
+
<details class="card ov-log-tail">
|
|
2633
|
+
<summary class="ov-expandable-toggle">
|
|
2634
|
+
<span class="nav-item__icon">${D.scrollText}</span>
|
|
2635
|
+
${E("overview.logTail.title")}
|
|
2636
|
+
<span class="ov-count-badge">${e.lines.length}</span>
|
|
2637
|
+
<span
|
|
2638
|
+
class="ov-log-refresh"
|
|
2639
|
+
@click=${n=>{n.preventDefault(),n.stopPropagation(),e.onRefreshLogs()}}
|
|
2640
|
+
>${D.loader}</span>
|
|
2641
|
+
</summary>
|
|
2642
|
+
<pre class="ov-log-tail-content">${t}</pre>
|
|
2643
|
+
</details>
|
|
2644
|
+
`}function Xf(e){const t=e.hello?.snapshot,n=t?.uptimeMs?Ul(t.uptimeMs):E("common.na"),s=e.hello?.policy?.tickIntervalMs,i=s?`${(s/1e3).toFixed(s%1e3===0?0:1)}s`:E("common.na"),o=t?.authMode==="trusted-proxy",c=Vf(e.connected,e.lastError,e.lastErrorCode)?r`
|
|
2645
|
+
<div class="muted" style="margin-top: 8px">
|
|
2646
|
+
${E("overview.pairing.hint")}
|
|
2647
|
+
<div style="margin-top: 6px">
|
|
2648
|
+
<span class="mono">poolbot devices list</span><br />
|
|
2649
|
+
<span class="mono">poolbot devices approve <requestId></span>
|
|
2650
|
+
</div>
|
|
2651
|
+
<div style="margin-top: 6px; font-size: 12px;">
|
|
2652
|
+
${E("overview.pairing.mobileHint")}
|
|
2653
|
+
</div>
|
|
2654
|
+
<div style="margin-top: 6px">
|
|
2655
|
+
<a
|
|
2656
|
+
class="session-link"
|
|
2657
|
+
href="https://docs.molt.bot/web/control-ui#device-pairing-first-connection"
|
|
2658
|
+
target=${Ze}
|
|
2659
|
+
rel=${Xe()}
|
|
2660
|
+
title="Device pairing docs (opens in new tab)"
|
|
2661
|
+
>Docs: Device pairing</a
|
|
2662
|
+
>
|
|
2663
|
+
</div>
|
|
2664
|
+
</div>
|
|
2665
|
+
`:null,l=(()=>{const u=Yf({connected:e.connected,lastError:e.lastError,lastErrorCode:e.lastErrorCode,hasToken:!!e.settings.token.trim(),hasPassword:!!e.password.trim()});return u==null?null:u==="required"?r`
|
|
2666
|
+
<div class="muted" style="margin-top: 8px">
|
|
2667
|
+
${E("overview.auth.required")}
|
|
2668
|
+
<div style="margin-top: 6px">
|
|
2561
2669
|
<span class="mono">poolbot dashboard --no-open</span> → tokenized URL<br />
|
|
2562
2670
|
<span class="mono">poolbot doctor --generate-gateway-token</span> → set token
|
|
2563
2671
|
</div>
|
|
2564
|
-
<div style="margin-top: 6px
|
|
2672
|
+
<div style="margin-top: 6px">
|
|
2565
2673
|
<a
|
|
2566
2674
|
class="session-link"
|
|
2567
2675
|
href="https://docs.molt.bot/web/dashboard"
|
|
2568
|
-
target
|
|
2569
|
-
rel
|
|
2676
|
+
target=${Ze}
|
|
2677
|
+
rel=${Xe()}
|
|
2570
2678
|
title="Control UI auth docs (opens in new tab)"
|
|
2571
2679
|
>Docs: Control UI auth</a
|
|
2572
2680
|
>
|
|
2573
2681
|
</div>
|
|
2574
2682
|
</div>
|
|
2575
|
-
`:
|
|
2576
|
-
<div class="muted" style="margin-top: 8px
|
|
2577
|
-
|
|
2578
|
-
<
|
|
2579
|
-
then click Connect.
|
|
2580
|
-
<div style="margin-top: 6px;">
|
|
2683
|
+
`:r`
|
|
2684
|
+
<div class="muted" style="margin-top: 8px">
|
|
2685
|
+
${E("overview.auth.failed",{command:"poolbot dashboard --no-open"})}
|
|
2686
|
+
<div style="margin-top: 6px">
|
|
2581
2687
|
<a
|
|
2582
2688
|
class="session-link"
|
|
2583
2689
|
href="https://docs.molt.bot/web/dashboard"
|
|
2584
|
-
target
|
|
2585
|
-
rel
|
|
2690
|
+
target=${Ze}
|
|
2691
|
+
rel=${Xe()}
|
|
2586
2692
|
title="Control UI auth docs (opens in new tab)"
|
|
2587
2693
|
>Docs: Control UI auth</a
|
|
2588
2694
|
>
|
|
2589
2695
|
</div>
|
|
2590
2696
|
</div>
|
|
2591
|
-
`})(),
|
|
2592
|
-
<div class="muted" style="margin-top: 8px
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
If you must stay on HTTP, set
|
|
2597
|
-
<span class="mono">gateway.controlUi.allowInsecureAuth: true</span> (token-only).
|
|
2697
|
+
`})(),p=e.connected||!e.lastError||(typeof window<"u"?window.isSecureContext:!0)||!Qf(e.connected,e.lastError,e.lastErrorCode)?null:r`
|
|
2698
|
+
<div class="muted" style="margin-top: 8px">
|
|
2699
|
+
${E("overview.insecure.hint",{url:"http://127.0.0.1:18789"})}
|
|
2700
|
+
<div style="margin-top: 6px">
|
|
2701
|
+
${E("overview.insecure.stayHttp",{config:"gateway.controlUi.allowInsecureAuth: true"})}
|
|
2598
2702
|
</div>
|
|
2599
|
-
<div style="margin-top: 6px
|
|
2703
|
+
<div style="margin-top: 6px">
|
|
2600
2704
|
<a
|
|
2601
2705
|
class="session-link"
|
|
2602
2706
|
href="https://docs.molt.bot/gateway/tailscale"
|
|
2603
|
-
target
|
|
2604
|
-
rel
|
|
2707
|
+
target=${Ze}
|
|
2708
|
+
rel=${Xe()}
|
|
2605
2709
|
title="Tailscale Serve docs (opens in new tab)"
|
|
2606
2710
|
>Docs: Tailscale Serve</a
|
|
2607
2711
|
>
|
|
@@ -2609,135 +2713,174 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2609
2713
|
<a
|
|
2610
2714
|
class="session-link"
|
|
2611
2715
|
href="https://docs.molt.bot/web/control-ui#insecure-http"
|
|
2612
|
-
target
|
|
2613
|
-
rel
|
|
2716
|
+
target=${Ze}
|
|
2717
|
+
rel=${Xe()}
|
|
2614
2718
|
title="Insecure HTTP docs (opens in new tab)"
|
|
2615
2719
|
>Docs: Insecure HTTP</a
|
|
2616
2720
|
>
|
|
2617
2721
|
</div>
|
|
2618
2722
|
</div>
|
|
2619
|
-
|
|
2620
|
-
<section class="grid
|
|
2723
|
+
`,d=Ms.getLocale();return r`
|
|
2724
|
+
<section class="grid">
|
|
2621
2725
|
<div class="card">
|
|
2622
|
-
<div class="card-title"
|
|
2623
|
-
<div class="card-sub"
|
|
2624
|
-
<div class="
|
|
2625
|
-
<label class="field">
|
|
2626
|
-
<span
|
|
2726
|
+
<div class="card-title">${E("overview.access.title")}</div>
|
|
2727
|
+
<div class="card-sub">${E("overview.access.subtitle")}</div>
|
|
2728
|
+
<div class="ov-access-grid" style="margin-top: 16px;">
|
|
2729
|
+
<label class="field ov-access-grid__full">
|
|
2730
|
+
<span>${E("overview.access.wsUrl")}</span>
|
|
2627
2731
|
<input
|
|
2628
2732
|
.value=${e.settings.gatewayUrl}
|
|
2629
|
-
@input=${
|
|
2733
|
+
@input=${u=>{const f=u.target.value;e.onSettingsChange({...e.settings,gatewayUrl:f,token:f.trim()===e.settings.gatewayUrl.trim()?e.settings.token:""})}}
|
|
2630
2734
|
placeholder="ws://100.x.y.z:18789"
|
|
2631
2735
|
/>
|
|
2632
2736
|
</label>
|
|
2737
|
+
${o?"":r`
|
|
2738
|
+
<label class="field">
|
|
2739
|
+
<span>${E("overview.access.token")}</span>
|
|
2740
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
2741
|
+
<input
|
|
2742
|
+
type=${e.showGatewayToken?"text":"password"}
|
|
2743
|
+
autocomplete="off"
|
|
2744
|
+
style="flex: 1;"
|
|
2745
|
+
.value=${e.settings.token}
|
|
2746
|
+
@input=${u=>{const f=u.target.value;e.onSettingsChange({...e.settings,token:f})}}
|
|
2747
|
+
placeholder="OPENCLAW_GATEWAY_TOKEN"
|
|
2748
|
+
/>
|
|
2749
|
+
<button
|
|
2750
|
+
type="button"
|
|
2751
|
+
class="btn btn--icon ${e.showGatewayToken?"active":""}"
|
|
2752
|
+
style="width: 36px; height: 36px;"
|
|
2753
|
+
title=${e.showGatewayToken?"Hide token":"Show token"}
|
|
2754
|
+
aria-label="Toggle token visibility"
|
|
2755
|
+
aria-pressed=${e.showGatewayToken}
|
|
2756
|
+
@click=${e.onToggleGatewayTokenVisibility}
|
|
2757
|
+
>
|
|
2758
|
+
${e.showGatewayToken?D.eye:D.eyeOff}
|
|
2759
|
+
</button>
|
|
2760
|
+
</div>
|
|
2761
|
+
</label>
|
|
2762
|
+
<label class="field">
|
|
2763
|
+
<span>${E("overview.access.password")}</span>
|
|
2764
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
2765
|
+
<input
|
|
2766
|
+
type=${e.showGatewayPassword?"text":"password"}
|
|
2767
|
+
autocomplete="off"
|
|
2768
|
+
style="flex: 1;"
|
|
2769
|
+
.value=${e.password}
|
|
2770
|
+
@input=${u=>{const f=u.target.value;e.onPasswordChange(f)}}
|
|
2771
|
+
placeholder="system or shared password"
|
|
2772
|
+
/>
|
|
2773
|
+
<button
|
|
2774
|
+
type="button"
|
|
2775
|
+
class="btn btn--icon ${e.showGatewayPassword?"active":""}"
|
|
2776
|
+
style="width: 36px; height: 36px;"
|
|
2777
|
+
title=${e.showGatewayPassword?"Hide password":"Show password"}
|
|
2778
|
+
aria-label="Toggle password visibility"
|
|
2779
|
+
aria-pressed=${e.showGatewayPassword}
|
|
2780
|
+
@click=${e.onToggleGatewayPasswordVisibility}
|
|
2781
|
+
>
|
|
2782
|
+
${e.showGatewayPassword?D.eye:D.eyeOff}
|
|
2783
|
+
</button>
|
|
2784
|
+
</div>
|
|
2785
|
+
</label>
|
|
2786
|
+
`}
|
|
2633
2787
|
<label class="field">
|
|
2634
|
-
<span
|
|
2635
|
-
<input
|
|
2636
|
-
.value=${e.settings.token}
|
|
2637
|
-
@input=${o=>{const l=o.target.value;e.onSettingsChange({...e.settings,token:l})}}
|
|
2638
|
-
placeholder="CLAWDBOT_GATEWAY_TOKEN"
|
|
2639
|
-
/>
|
|
2640
|
-
</label>
|
|
2641
|
-
<label class="field">
|
|
2642
|
-
<span>Password (not stored)</span>
|
|
2788
|
+
<span>${E("overview.access.sessionKey")}</span>
|
|
2643
2789
|
<input
|
|
2644
|
-
|
|
2645
|
-
.value
|
|
2646
|
-
@input=${o=>{const l=o.target.value;e.onPasswordChange(l)}}
|
|
2647
|
-
placeholder="system or shared password"
|
|
2790
|
+
.value=${e.settings.sessionKey}
|
|
2791
|
+
@input=${u=>{const f=u.target.value;e.onSessionKeyChange(f)}}
|
|
2648
2792
|
/>
|
|
2649
2793
|
</label>
|
|
2650
2794
|
<label class="field">
|
|
2651
|
-
<span
|
|
2652
|
-
<
|
|
2653
|
-
.value=${
|
|
2654
|
-
@
|
|
2655
|
-
|
|
2795
|
+
<span>${E("overview.access.language")}</span>
|
|
2796
|
+
<select
|
|
2797
|
+
.value=${d}
|
|
2798
|
+
@change=${u=>{const f=u.target.value;Ms.setLocale(f),e.onSettingsChange({...e.settings,locale:f})}}
|
|
2799
|
+
>
|
|
2800
|
+
${Ir.map(u=>{const f=u.replace(/-([a-zA-Z])/g,(v,m)=>m.toUpperCase());return r`<option value=${u}>${E(`languages.${f}`)}</option>`})}
|
|
2801
|
+
</select>
|
|
2656
2802
|
</label>
|
|
2657
2803
|
</div>
|
|
2658
2804
|
<div class="row" style="margin-top: 14px;">
|
|
2659
|
-
<button class="btn" @click=${()=>e.onConnect()}
|
|
2660
|
-
<button class="btn" @click=${()=>e.onRefresh()}
|
|
2661
|
-
<span class="muted"
|
|
2662
|
-
</div>
|
|
2805
|
+
<button class="btn" @click=${()=>e.onConnect()}>${E("common.connect")}</button>
|
|
2806
|
+
<button class="btn" @click=${()=>e.onRefresh()}>${E("common.refresh")}</button>
|
|
2807
|
+
<span class="muted">${E(o?"overview.access.trustedProxy":"overview.access.connectHint")}</span>
|
|
2808
|
+
</div>
|
|
2809
|
+
${e.connected?g:r`
|
|
2810
|
+
<div class="login-gate__help" style="margin-top: 16px;">
|
|
2811
|
+
<div class="login-gate__help-title">${E("overview.connection.title")}</div>
|
|
2812
|
+
<ol class="login-gate__steps">
|
|
2813
|
+
<li>${E("overview.connection.step1")}<code>poolbot gateway run</code></li>
|
|
2814
|
+
<li>${E("overview.connection.step2")}<code>poolbot dashboard --no-open</code></li>
|
|
2815
|
+
<li>${E("overview.connection.step3")}</li>
|
|
2816
|
+
<li>${E("overview.connection.step4")}<code>poolbot doctor --generate-gateway-token</code></li>
|
|
2817
|
+
</ol>
|
|
2818
|
+
<div class="login-gate__docs">
|
|
2819
|
+
${E("overview.connection.docsHint")}
|
|
2820
|
+
<a
|
|
2821
|
+
class="session-link"
|
|
2822
|
+
href="https://docs.molt.bot/web/dashboard"
|
|
2823
|
+
target="_blank"
|
|
2824
|
+
rel="noreferrer"
|
|
2825
|
+
>${E("overview.connection.docsLink")}</a>
|
|
2826
|
+
</div>
|
|
2827
|
+
</div>
|
|
2828
|
+
`}
|
|
2663
2829
|
</div>
|
|
2664
2830
|
|
|
2665
2831
|
<div class="card">
|
|
2666
|
-
<div class="card-title"
|
|
2667
|
-
<div class="card-sub"
|
|
2832
|
+
<div class="card-title">${E("overview.snapshot.title")}</div>
|
|
2833
|
+
<div class="card-sub">${E("overview.snapshot.subtitle")}</div>
|
|
2668
2834
|
<div class="stat-grid" style="margin-top: 16px;">
|
|
2669
2835
|
<div class="stat">
|
|
2670
|
-
<div class="stat-label"
|
|
2836
|
+
<div class="stat-label">${E("overview.snapshot.status")}</div>
|
|
2671
2837
|
<div class="stat-value ${e.connected?"ok":"warn"}">
|
|
2672
|
-
${e.connected?"
|
|
2838
|
+
${e.connected?E("common.ok"):E("common.offline")}
|
|
2673
2839
|
</div>
|
|
2674
2840
|
</div>
|
|
2675
2841
|
<div class="stat">
|
|
2676
|
-
<div class="stat-label"
|
|
2842
|
+
<div class="stat-label">${E("overview.snapshot.uptime")}</div>
|
|
2677
2843
|
<div class="stat-value">${n}</div>
|
|
2678
2844
|
</div>
|
|
2679
2845
|
<div class="stat">
|
|
2680
|
-
<div class="stat-label"
|
|
2681
|
-
<div class="stat-value">${
|
|
2846
|
+
<div class="stat-label">${E("overview.snapshot.tickInterval")}</div>
|
|
2847
|
+
<div class="stat-value">${i}</div>
|
|
2682
2848
|
</div>
|
|
2683
2849
|
<div class="stat">
|
|
2684
|
-
<div class="stat-label"
|
|
2850
|
+
<div class="stat-label">${E("overview.snapshot.lastChannelsRefresh")}</div>
|
|
2685
2851
|
<div class="stat-value">
|
|
2686
|
-
${e.lastChannelsRefresh?
|
|
2852
|
+
${e.lastChannelsRefresh?rt(e.lastChannelsRefresh):E("common.na")}
|
|
2687
2853
|
</div>
|
|
2688
2854
|
</div>
|
|
2689
2855
|
</div>
|
|
2690
|
-
${e.lastError?
|
|
2856
|
+
${e.lastError?r`<div class="callout danger" style="margin-top: 14px;">
|
|
2691
2857
|
<div>${e.lastError}</div>
|
|
2692
|
-
${
|
|
2693
|
-
${
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2858
|
+
${c??""}
|
|
2859
|
+
${l??""}
|
|
2860
|
+
${p??""}
|
|
2861
|
+
</div>`:r`
|
|
2862
|
+
<div class="callout" style="margin-top: 14px">
|
|
2863
|
+
${E("overview.snapshot.channelsHint")}
|
|
2864
|
+
</div>
|
|
2865
|
+
`}
|
|
2697
2866
|
</div>
|
|
2698
2867
|
</section>
|
|
2699
2868
|
|
|
2700
|
-
<
|
|
2701
|
-
<div class="card stat-card">
|
|
2702
|
-
<div class="stat-label">Instances</div>
|
|
2703
|
-
<div class="stat-value">${e.presenceCount}</div>
|
|
2704
|
-
<div class="muted">Presence beacons in the last 5 minutes.</div>
|
|
2705
|
-
</div>
|
|
2706
|
-
<div class="card stat-card">
|
|
2707
|
-
<div class="stat-label">Sessions</div>
|
|
2708
|
-
<div class="stat-value">${e.sessionsCount??"n/a"}</div>
|
|
2709
|
-
<div class="muted">Recent session keys tracked by the gateway.</div>
|
|
2710
|
-
</div>
|
|
2711
|
-
<div class="card stat-card">
|
|
2712
|
-
<div class="stat-label">Cron</div>
|
|
2713
|
-
<div class="stat-value">
|
|
2714
|
-
${e.cronEnabled==null?"n/a":e.cronEnabled?"Enabled":"Disabled"}
|
|
2715
|
-
</div>
|
|
2716
|
-
<div class="muted">Next wake ${wr(e.cronNext)}</div>
|
|
2717
|
-
</div>
|
|
2718
|
-
</section>
|
|
2869
|
+
<div class="ov-section-divider"></div>
|
|
2719
2870
|
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
</div>
|
|
2734
|
-
<div>
|
|
2735
|
-
<div class="note-title">Cron reminders</div>
|
|
2736
|
-
<div class="muted">Use isolated sessions for recurring runs.</div>
|
|
2737
|
-
</div>
|
|
2738
|
-
</div>
|
|
2739
|
-
</section>
|
|
2740
|
-
`}const $f=["","off","minimal","low","medium","high"],xf=["","off","on"],kf=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"}],Af=["","off","on","stream"];function Sf(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function kr(e){return Sf(e)==="zai"}function _f(e){return kr(e)?xf:$f}function Tf(e,t){return!t||!e||e==="off"?e:"on"}function Cf(e,t){return e?t&&e==="on"?"low":e:null}function Ef(e){const t=e.result?.sessions??[];return c`
|
|
2871
|
+
${jf({usageResult:e.usageResult,sessionsResult:e.sessionsResult,skillsReport:e.skillsReport,cronJobs:e.cronJobs,cronStatus:e.cronStatus,presenceCount:e.presenceCount,onNavigate:e.onNavigate})}
|
|
2872
|
+
|
|
2873
|
+
${Bf({items:e.attentionItems})}
|
|
2874
|
+
|
|
2875
|
+
<div class="ov-section-divider"></div>
|
|
2876
|
+
|
|
2877
|
+
<div class="ov-bottom-grid" style="margin-top: 18px;">
|
|
2878
|
+
${qf({events:e.eventLog})}
|
|
2879
|
+
|
|
2880
|
+
${Zf({lines:e.overviewLogLines,onRefreshLogs:e.onRefreshLogs})}
|
|
2881
|
+
</div>
|
|
2882
|
+
|
|
2883
|
+
`}const eg=["","off","minimal","low","medium","high"],tg=["","off","on"],ng=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"}],sg=["","off","on","stream"];function ig(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function Lr(e){return ig(e)==="zai"}function ag(e){return Lr(e)?tg:eg}function og(e,t){return!t||!e||e==="off"?e:"on"}function rg(e,t){return e?t&&e==="on"?"low":e:null}function lg(e){const t=e.result?.sessions??[];return r`
|
|
2741
2884
|
<section class="card">
|
|
2742
2885
|
<div class="row" style="justify-content: space-between;">
|
|
2743
2886
|
<div>
|
|
@@ -2782,7 +2925,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2782
2925
|
</label>
|
|
2783
2926
|
</div>
|
|
2784
2927
|
|
|
2785
|
-
${e.error?
|
|
2928
|
+
${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:g}
|
|
2786
2929
|
|
|
2787
2930
|
<div class="muted" style="margin-top: 12px;">
|
|
2788
2931
|
${e.result?`Store: ${e.result.path}`:""}
|
|
@@ -2800,12 +2943,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2800
2943
|
<div>Reasoning</div>
|
|
2801
2944
|
<div>Actions</div>
|
|
2802
2945
|
</div>
|
|
2803
|
-
${t.length===0?
|
|
2946
|
+
${t.length===0?r`<div class="muted">No sessions found.</div>`:t.map(n=>cg(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
|
|
2804
2947
|
</div>
|
|
2805
2948
|
</section>
|
|
2806
|
-
`}function
|
|
2949
|
+
`}function cg(e,t,n,s,i){const a=e.updatedAt?B(e.updatedAt):"n/a",o=e.thinkingLevel??"",c=Lr(e.modelProvider),l=og(o,c),p=ag(e.modelProvider),d=e.verboseLevel??"",u=e.reasoningLevel??"",f=e.displayName??e.key,v=e.kind!=="global",m=v?`${fn("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return r`
|
|
2807
2950
|
<div class="table-row">
|
|
2808
|
-
<div class="mono">${v?
|
|
2951
|
+
<div class="mono">${v?r`<a href=${m} class="session-link">${f}</a>`:f}</div>
|
|
2809
2952
|
<div>
|
|
2810
2953
|
<input
|
|
2811
2954
|
.value=${e.label??""}
|
|
@@ -2816,14 +2959,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2816
2959
|
</div>
|
|
2817
2960
|
<div>${e.kind}</div>
|
|
2818
2961
|
<div>${a}</div>
|
|
2819
|
-
<div>${
|
|
2962
|
+
<div>${jh(e)}</div>
|
|
2820
2963
|
<div>
|
|
2821
2964
|
<select
|
|
2822
|
-
.value=${
|
|
2965
|
+
.value=${l}
|
|
2823
2966
|
?disabled=${i}
|
|
2824
|
-
@change=${$=>{const k=$.target.value;n(e.key,{thinkingLevel:
|
|
2967
|
+
@change=${$=>{const k=$.target.value;n(e.key,{thinkingLevel:rg(k,c)})}}
|
|
2825
2968
|
>
|
|
2826
|
-
${p.map($=>
|
|
2969
|
+
${p.map($=>r`<option value=${$}>${$||"inherit"}</option>`)}
|
|
2827
2970
|
</select>
|
|
2828
2971
|
</div>
|
|
2829
2972
|
<div>
|
|
@@ -2832,7 +2975,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2832
2975
|
?disabled=${i}
|
|
2833
2976
|
@change=${$=>{const k=$.target.value;n(e.key,{verboseLevel:k||null})}}
|
|
2834
2977
|
>
|
|
2835
|
-
${
|
|
2978
|
+
${ng.map($=>r`<option value=${$.value}>${$.label}</option>`)}
|
|
2836
2979
|
</select>
|
|
2837
2980
|
</div>
|
|
2838
2981
|
<div>
|
|
@@ -2841,7 +2984,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2841
2984
|
?disabled=${i}
|
|
2842
2985
|
@change=${$=>{const k=$.target.value;n(e.key,{reasoningLevel:k||null})}}
|
|
2843
2986
|
>
|
|
2844
|
-
${
|
|
2987
|
+
${sg.map($=>r`<option value=${$}>${$||"inherit"}</option>`)}
|
|
2845
2988
|
</select>
|
|
2846
2989
|
</div>
|
|
2847
2990
|
<div>
|
|
@@ -2850,7 +2993,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2850
2993
|
</button>
|
|
2851
2994
|
</div>
|
|
2852
2995
|
</div>
|
|
2853
|
-
`}function
|
|
2996
|
+
`}function dg(e){const t=Math.max(0,e),n=Math.floor(t/1e3);if(n<60)return`${n}s`;const s=Math.floor(n/60);return s<60?`${s}m`:`${Math.floor(s/60)}h`}function Pe(e,t){return t?r`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:g}function ug(e){const t=e.execApprovalQueue[0];if(!t)return g;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${dg(s)}`:"expired",a=e.execApprovalQueue.length;return r`
|
|
2854
2997
|
<div class="exec-approval-overlay" role="dialog" aria-live="polite">
|
|
2855
2998
|
<div class="exec-approval-card">
|
|
2856
2999
|
<div class="exec-approval-header">
|
|
@@ -2858,19 +3001,19 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2858
3001
|
<div class="exec-approval-title">Exec approval needed</div>
|
|
2859
3002
|
<div class="exec-approval-sub">${i}</div>
|
|
2860
3003
|
</div>
|
|
2861
|
-
${a>1?
|
|
3004
|
+
${a>1?r`<div class="exec-approval-queue">${a} pending</div>`:g}
|
|
2862
3005
|
</div>
|
|
2863
3006
|
<div class="exec-approval-command mono">${n.command}</div>
|
|
2864
3007
|
<div class="exec-approval-meta">
|
|
2865
|
-
${
|
|
2866
|
-
${
|
|
2867
|
-
${
|
|
2868
|
-
${
|
|
2869
|
-
${
|
|
2870
|
-
${
|
|
2871
|
-
${
|
|
2872
|
-
</div>
|
|
2873
|
-
${e.execApprovalError?
|
|
3008
|
+
${Pe("Host",n.host)}
|
|
3009
|
+
${Pe("Agent",n.agentId)}
|
|
3010
|
+
${Pe("Session",n.sessionKey)}
|
|
3011
|
+
${Pe("CWD",n.cwd)}
|
|
3012
|
+
${Pe("Resolved",n.resolvedPath)}
|
|
3013
|
+
${Pe("Security",n.security)}
|
|
3014
|
+
${Pe("Ask",n.ask)}
|
|
3015
|
+
</div>
|
|
3016
|
+
${e.execApprovalError?r`<div class="exec-approval-error">${e.execApprovalError}</div>`:g}
|
|
2874
3017
|
<div class="exec-approval-actions">
|
|
2875
3018
|
<button
|
|
2876
3019
|
class="btn primary"
|
|
@@ -2896,7 +3039,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2896
3039
|
</div>
|
|
2897
3040
|
</div>
|
|
2898
3041
|
</div>
|
|
2899
|
-
`}function
|
|
3042
|
+
`}function pg(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(i=>[i.name,i.description,i.source].join(" ").toLowerCase().includes(n)):t;return r`
|
|
2900
3043
|
<section class="card">
|
|
2901
3044
|
<div class="row" style="justify-content: space-between;">
|
|
2902
3045
|
<div>
|
|
@@ -2920,38 +3063,38 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2920
3063
|
<div class="muted">${s.length} shown</div>
|
|
2921
3064
|
</div>
|
|
2922
3065
|
|
|
2923
|
-
${e.error?
|
|
3066
|
+
${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:g}
|
|
2924
3067
|
|
|
2925
|
-
${s.length===0?
|
|
3068
|
+
${s.length===0?r`<div class="muted" style="margin-top: 16px;">No skills found.</div>`:r`
|
|
2926
3069
|
<div class="list" style="margin-top: 16px;">
|
|
2927
|
-
${s.map(i=>
|
|
3070
|
+
${s.map(i=>hg(i,e))}
|
|
2928
3071
|
</div>
|
|
2929
3072
|
`}
|
|
2930
3073
|
</section>
|
|
2931
|
-
`}function
|
|
3074
|
+
`}function hg(e,t){const n=t.busyKey===e.skillKey,s=t.edits[e.skillKey]??"",i=t.messages[e.skillKey]??null,a=e.install.length>0&&e.missing.bins.length>0,o=[...e.missing.bins.map(l=>`bin:${l}`),...e.missing.env.map(l=>`env:${l}`),...e.missing.config.map(l=>`config:${l}`),...e.missing.os.map(l=>`os:${l}`)],c=[];return e.disabled&&c.push("disabled"),e.blockedByAllowlist&&c.push("blocked by allowlist"),r`
|
|
2932
3075
|
<div class="list-item">
|
|
2933
3076
|
<div class="list-main">
|
|
2934
3077
|
<div class="list-title">
|
|
2935
3078
|
${e.emoji?`${e.emoji} `:""}${e.name}
|
|
2936
3079
|
</div>
|
|
2937
|
-
<div class="list-sub">${
|
|
3080
|
+
<div class="list-sub">${fs(e.description,140)}</div>
|
|
2938
3081
|
<div class="chip-row" style="margin-top: 6px;">
|
|
2939
3082
|
<span class="chip">${e.source}</span>
|
|
2940
3083
|
<span class="chip ${e.eligible?"chip-ok":"chip-warn"}">
|
|
2941
3084
|
${e.eligible?"eligible":"blocked"}
|
|
2942
3085
|
</span>
|
|
2943
|
-
${e.disabled?
|
|
3086
|
+
${e.disabled?r`<span class="chip chip-warn">disabled</span>`:g}
|
|
2944
3087
|
</div>
|
|
2945
|
-
${o.length>0?
|
|
3088
|
+
${o.length>0?r`
|
|
2946
3089
|
<div class="muted" style="margin-top: 6px;">
|
|
2947
3090
|
Missing: ${o.join(", ")}
|
|
2948
3091
|
</div>
|
|
2949
|
-
`:
|
|
2950
|
-
${
|
|
3092
|
+
`:g}
|
|
3093
|
+
${c.length>0?r`
|
|
2951
3094
|
<div class="muted" style="margin-top: 6px;">
|
|
2952
|
-
Reason: ${
|
|
3095
|
+
Reason: ${c.join(", ")}
|
|
2953
3096
|
</div>
|
|
2954
|
-
`:
|
|
3097
|
+
`:g}
|
|
2955
3098
|
</div>
|
|
2956
3099
|
<div class="list-meta">
|
|
2957
3100
|
<div class="row" style="justify-content: flex-end; flex-wrap: wrap;">
|
|
@@ -2962,27 +3105,27 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2962
3105
|
>
|
|
2963
3106
|
${e.disabled?"Enable":"Disable"}
|
|
2964
3107
|
</button>
|
|
2965
|
-
${a?
|
|
3108
|
+
${a?r`<button
|
|
2966
3109
|
class="btn"
|
|
2967
3110
|
?disabled=${n}
|
|
2968
3111
|
@click=${()=>t.onInstall(e.skillKey,e.name,e.install[0].id)}
|
|
2969
3112
|
>
|
|
2970
3113
|
${n?"Installing…":e.install[0].label}
|
|
2971
|
-
</button>`:
|
|
3114
|
+
</button>`:g}
|
|
2972
3115
|
</div>
|
|
2973
|
-
${i?
|
|
3116
|
+
${i?r`<div
|
|
2974
3117
|
class="muted"
|
|
2975
3118
|
style="margin-top: 8px; color: ${i.kind==="error"?"var(--danger-color, #d14343)":"var(--success-color, #0a7f5a)"};"
|
|
2976
3119
|
>
|
|
2977
3120
|
${i.message}
|
|
2978
|
-
</div>`:
|
|
2979
|
-
${e.primaryEnv?
|
|
3121
|
+
</div>`:g}
|
|
3122
|
+
${e.primaryEnv?r`
|
|
2980
3123
|
<div class="field" style="margin-top: 10px;">
|
|
2981
3124
|
<span>API key</span>
|
|
2982
3125
|
<input
|
|
2983
3126
|
type="password"
|
|
2984
3127
|
.value=${s}
|
|
2985
|
-
@input=${
|
|
3128
|
+
@input=${l=>t.onEdit(e.skillKey,l.target.value)}
|
|
2986
3129
|
/>
|
|
2987
3130
|
</div>
|
|
2988
3131
|
<button
|
|
@@ -2993,36 +3136,36 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2993
3136
|
>
|
|
2994
3137
|
Save key
|
|
2995
3138
|
</button>
|
|
2996
|
-
`:
|
|
3139
|
+
`:g}
|
|
2997
3140
|
</div>
|
|
2998
3141
|
</div>
|
|
2999
|
-
`}function
|
|
3142
|
+
`}function fg(e,t){const n=fn(t,e.basePath);return r`
|
|
3000
3143
|
<a
|
|
3001
3144
|
href=${n}
|
|
3002
3145
|
class="nav-item ${e.tab===t?"active":""}"
|
|
3003
3146
|
@click=${s=>{s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||(s.preventDefault(),e.setTab(t))}}
|
|
3004
|
-
title=${
|
|
3147
|
+
title=${ps(t)}
|
|
3005
3148
|
>
|
|
3006
|
-
<span class="nav-item__icon" aria-hidden="true">${
|
|
3007
|
-
<span class="nav-item__text">${
|
|
3149
|
+
<span class="nav-item__icon" aria-hidden="true">${D[Ll(t)]}</span>
|
|
3150
|
+
<span class="nav-item__text">${ps(t)}</span>
|
|
3008
3151
|
</a>
|
|
3009
|
-
`}function
|
|
3152
|
+
`}function gg(e){const t=vg(e.sessionKey,e.sessionsResult),n=e.onboarding,s=e.onboarding,i=e.onboarding?!1:e.settings.chatShowThinking,a=e.onboarding?!0:e.settings.chatFocusMode,o=r`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg>`,c=r`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7V4h3"></path><path d="M20 7V4h-3"></path><path d="M4 17v3h3"></path><path d="M20 17v3h-3"></path><circle cx="12" cy="12" r="3"></circle></svg>`;return r`
|
|
3010
3153
|
<div class="chat-controls">
|
|
3011
3154
|
<label class="field chat-controls__session">
|
|
3012
3155
|
<select
|
|
3013
3156
|
.value=${e.sessionKey}
|
|
3014
3157
|
?disabled=${!e.connected}
|
|
3015
|
-
@change=${
|
|
3158
|
+
@change=${l=>{const p=l.target.value;e.sessionKey=p,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:p,lastActiveSessionKey:p}),e.loadAssistantIdentity(),Od(e,p),st(e)}}
|
|
3016
3159
|
>
|
|
3017
|
-
${
|
|
3018
|
-
${
|
|
3160
|
+
${Xo(t,l=>l.key,l=>r`<option value=${l.key}>
|
|
3161
|
+
${l.displayName??l.key}
|
|
3019
3162
|
</option>`)}
|
|
3020
3163
|
</select>
|
|
3021
3164
|
</label>
|
|
3022
3165
|
<button
|
|
3023
3166
|
class="btn btn--sm btn--icon"
|
|
3024
3167
|
?disabled=${e.chatLoading||!e.connected}
|
|
3025
|
-
@click=${()=>{e.resetToolStream(),
|
|
3168
|
+
@click=${()=>{e.resetToolStream(),st(e)}}
|
|
3026
3169
|
title="Refresh chat history"
|
|
3027
3170
|
>
|
|
3028
3171
|
${o}
|
|
@@ -3035,7 +3178,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3035
3178
|
aria-pressed=${i}
|
|
3036
3179
|
title=${n?"Disabled during onboarding":"Toggle assistant thinking/working output"}
|
|
3037
3180
|
>
|
|
3038
|
-
${
|
|
3181
|
+
${D.brain}
|
|
3039
3182
|
</button>
|
|
3040
3183
|
<button
|
|
3041
3184
|
class="btn btn--sm btn--icon ${a?"active":""}"
|
|
@@ -3044,10 +3187,10 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3044
3187
|
aria-pressed=${a}
|
|
3045
3188
|
title=${s?"Disabled during onboarding":"Toggle focus mode (hide sidebar + page header)"}
|
|
3046
3189
|
>
|
|
3047
|
-
${
|
|
3190
|
+
${c}
|
|
3048
3191
|
</button>
|
|
3049
3192
|
</div>
|
|
3050
|
-
`}function
|
|
3193
|
+
`}function vg(e,t){const n=new Set,s=[],i=t?.sessions?.find(a=>a.key===e);if(n.add(e),s.push({key:e,displayName:i?.displayName}),t?.sessions)for(const a of t.sessions)n.has(a.key)||(n.add(a.key),s.push({key:a.key,displayName:a.displayName}));return s}const mg=["system","light","dark"];function bg(e){const t=Math.max(0,mg.indexOf(e.theme)),n=s=>i=>{const o={element:i.currentTarget};(i.clientX||i.clientY)&&(o.pointerClientX=i.clientX,o.pointerClientY=i.clientY),e.setTheme(s,o)};return r`
|
|
3051
3194
|
<div class="theme-toggle" style="--theme-index: ${t};">
|
|
3052
3195
|
<div class="theme-toggle__track" role="group" aria-label="Theme">
|
|
3053
3196
|
<span class="theme-toggle__indicator"></span>
|
|
@@ -3058,7 +3201,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3058
3201
|
aria-label="System theme"
|
|
3059
3202
|
title="System"
|
|
3060
3203
|
>
|
|
3061
|
-
${
|
|
3204
|
+
${$g()}
|
|
3062
3205
|
</button>
|
|
3063
3206
|
<button
|
|
3064
3207
|
class="theme-toggle__button ${e.theme==="light"?"active":""}"
|
|
@@ -3067,7 +3210,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3067
3210
|
aria-label="Light theme"
|
|
3068
3211
|
title="Light"
|
|
3069
3212
|
>
|
|
3070
|
-
${
|
|
3213
|
+
${yg()}
|
|
3071
3214
|
</button>
|
|
3072
3215
|
<button
|
|
3073
3216
|
class="theme-toggle__button ${e.theme==="dark"?"active":""}"
|
|
@@ -3076,11 +3219,11 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3076
3219
|
aria-label="Dark theme"
|
|
3077
3220
|
title="Dark"
|
|
3078
3221
|
>
|
|
3079
|
-
${
|
|
3222
|
+
${wg()}
|
|
3080
3223
|
</button>
|
|
3081
3224
|
</div>
|
|
3082
3225
|
</div>
|
|
3083
|
-
`}function
|
|
3226
|
+
`}function yg(){return r`
|
|
3084
3227
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3085
3228
|
<circle cx="12" cy="12" r="4"></circle>
|
|
3086
3229
|
<path d="M12 2v2"></path>
|
|
@@ -3092,19 +3235,19 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3092
3235
|
<path d="m6.34 17.66-1.41 1.41"></path>
|
|
3093
3236
|
<path d="m19.07 4.93-1.41 1.41"></path>
|
|
3094
3237
|
</svg>
|
|
3095
|
-
`}function
|
|
3238
|
+
`}function wg(){return r`
|
|
3096
3239
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3097
3240
|
<path
|
|
3098
3241
|
d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"
|
|
3099
3242
|
></path>
|
|
3100
3243
|
</svg>
|
|
3101
|
-
`}function
|
|
3244
|
+
`}function $g(){return r`
|
|
3102
3245
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3103
3246
|
<rect width="20" height="14" x="2" y="3" rx="2"></rect>
|
|
3104
3247
|
<line x1="8" x2="16" y1="21" y2="21"></line>
|
|
3105
3248
|
<line x1="12" x2="12" y1="17" y2="21"></line>
|
|
3106
3249
|
</svg>
|
|
3107
|
-
`}const
|
|
3250
|
+
`}const Ag=/^data:/i,kg=/^https?:\/\//i;function xg(e){const t=e.agentsList?.agents??[],s=ho(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",a=t.find(c=>c.id===s)?.identity,o=a?.avatarUrl??a?.avatar;if(o)return Ag.test(o)||kg.test(o)?o:a?.avatarUrl}function Sg(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,s=e.cronStatus?.nextWakeAtMs??null,i=e.connected?null:"Disconnected from gateway.",a=e.tab==="chat",o=a&&(e.settings.chatFocusMode||e.onboarding),c=e.onboarding?!1:e.settings.chatShowThinking,l=xg(e),p=e.chatAvatarUrl??l??null;return r`
|
|
3108
3251
|
<div class="shell ${a?"shell--chat":""} ${o?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
|
|
3109
3252
|
<header class="topbar">
|
|
3110
3253
|
<div class="topbar-left">
|
|
@@ -3114,7 +3257,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3114
3257
|
title="${e.settings.navCollapsed?"Expand sidebar":"Collapse sidebar"}"
|
|
3115
3258
|
aria-label="${e.settings.navCollapsed?"Expand sidebar":"Collapse sidebar"}"
|
|
3116
3259
|
>
|
|
3117
|
-
<span class="nav-collapse-toggle__icon">${
|
|
3260
|
+
<span class="nav-collapse-toggle__icon">${D.menu}</span>
|
|
3118
3261
|
</button>
|
|
3119
3262
|
<div class="brand">
|
|
3120
3263
|
<div class="brand-logo">
|
|
@@ -3132,12 +3275,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3132
3275
|
<span>Health</span>
|
|
3133
3276
|
<span class="mono">${e.connected?"OK":"Offline"}</span>
|
|
3134
3277
|
</div>
|
|
3135
|
-
${
|
|
3278
|
+
${bg(e)}
|
|
3136
3279
|
</div>
|
|
3137
3280
|
</header>
|
|
3138
3281
|
<aside class="nav ${e.settings.navCollapsed?"nav--collapsed":""}">
|
|
3139
|
-
${
|
|
3140
|
-
<div class="nav-group ${u&&!
|
|
3282
|
+
${Il.map(d=>{const u=e.settings.navGroupsCollapsed[d.label]??!1,f=d.tabs.some(v=>v===e.tab);return r`
|
|
3283
|
+
<div class="nav-group ${u&&!f?"nav-group--collapsed":""}">
|
|
3141
3284
|
<button
|
|
3142
3285
|
class="nav-label"
|
|
3143
3286
|
@click=${()=>{const v={...e.settings.navGroupsCollapsed};v[d.label]=!u,e.applySettings({...e.settings,navGroupsCollapsed:v})}}
|
|
@@ -3147,7 +3290,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3147
3290
|
<span class="nav-label__chevron">${u?"+":"−"}</span>
|
|
3148
3291
|
</button>
|
|
3149
3292
|
<div class="nav-group__items">
|
|
3150
|
-
${d.tabs.map(v=>
|
|
3293
|
+
${d.tabs.map(v=>fg(e,v))}
|
|
3151
3294
|
</div>
|
|
3152
3295
|
</div>
|
|
3153
3296
|
`})}
|
|
@@ -3163,7 +3306,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3163
3306
|
rel="noreferrer"
|
|
3164
3307
|
title="Docs (opens in new tab)"
|
|
3165
3308
|
>
|
|
3166
|
-
<span class="nav-item__icon" aria-hidden="true">${
|
|
3309
|
+
<span class="nav-item__icon" aria-hidden="true">${D.book}</span>
|
|
3167
3310
|
<span class="nav-item__text">Docs</span>
|
|
3168
3311
|
</a>
|
|
3169
3312
|
</div>
|
|
@@ -3172,40 +3315,40 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3172
3315
|
<main class="content ${a?"content--chat":""}">
|
|
3173
3316
|
<section class="content-header">
|
|
3174
3317
|
<div>
|
|
3175
|
-
<div class="page-title">${
|
|
3176
|
-
<div class="page-sub">${
|
|
3318
|
+
<div class="page-title">${ps(e.tab)}</div>
|
|
3319
|
+
<div class="page-sub">${Ml(e.tab)}</div>
|
|
3177
3320
|
</div>
|
|
3178
3321
|
<div class="page-meta">
|
|
3179
|
-
${e.lastError?
|
|
3180
|
-
${a?
|
|
3322
|
+
${e.lastError?r`<div class="pill danger">${e.lastError}</div>`:g}
|
|
3323
|
+
${a?gg(e):g}
|
|
3181
3324
|
</div>
|
|
3182
3325
|
</section>
|
|
3183
3326
|
|
|
3184
|
-
${e.tab==="overview"?
|
|
3327
|
+
${e.tab==="overview"?Xf({connected:e.connected,hello:e.hello,settings:e.settings,password:e.password,lastError:e.lastError,presenceCount:t,sessionsCount:n,cronEnabled:e.cronStatus?.enabled??null,cronNext:s,lastChannelsRefresh:e.channelsLastSuccess,onSettingsChange:d=>e.applySettings(d),onPasswordChange:d=>e.password=d,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity()},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):g}
|
|
3185
3328
|
|
|
3186
|
-
${e.tab==="channels"?
|
|
3329
|
+
${e.tab==="channels"?Lh({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,whatsappMessage:e.whatsappLoginMessage,whatsappQrDataUrl:e.whatsappLoginQrDataUrl,whatsappConnected:e.whatsappLoginConnected,whatsappBusy:e.whatsappBusy,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,nostrProfileFormState:e.nostrProfileFormState,nostrProfileAccountId:e.nostrProfileAccountId,onRefresh:d=>le(e,d),onWhatsAppStart:d=>e.handleWhatsAppStart(d),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(d,u)=>zt(e,d,u),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(d,u)=>e.handleNostrProfileEdit(d,u),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(d,u)=>e.handleNostrProfileFieldChange(d,u),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):g}
|
|
3187
3330
|
|
|
3188
|
-
${e.tab==="instances"?
|
|
3331
|
+
${e.tab==="instances"?tf({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>Js(e)}):g}
|
|
3189
3332
|
|
|
3190
|
-
${e.tab==="sessions"?
|
|
3333
|
+
${e.tab==="sessions"?lg({loading:e.sessionsLoading,result:e.sessionsResult,error:e.sessionsError,activeMinutes:e.sessionsFilterActive,limit:e.sessionsFilterLimit,includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown,basePath:e.basePath,onFiltersChange:d=>{e.sessionsFilterActive=d.activeMinutes,e.sessionsFilterLimit=d.limit,e.sessionsIncludeGlobal=d.includeGlobal,e.sessionsIncludeUnknown=d.includeUnknown},onRefresh:()=>lt(e),onPatch:(d,u)=>Xl(e,d,u),onDelete:d=>ec(e,d)}):g}
|
|
3191
3334
|
|
|
3192
|
-
${e.tab==="cron"?
|
|
3335
|
+
${e.tab==="cron"?Vh({loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(d=>d.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,onFormChange:d=>e.cronForm={...e.cronForm,...d},onRefresh:()=>e.loadCron(),onAdd:()=>Ac(e),onToggle:(d,u)=>kc(e,d,u),onRun:d=>xc(e,d),onRemove:d=>Sc(e,d),onLoadRuns:d=>ko(e,d)}):g}
|
|
3193
3336
|
|
|
3194
|
-
${e.tab==="skills"?
|
|
3337
|
+
${e.tab==="skills"?pg({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:d=>e.skillsFilter=d,onRefresh:()=>Mt(e,{clearMessages:!0}),onToggle:(d,u)=>yd(e,d,u),onEdit:(d,u)=>bd(e,d,u),onSaveKey:d=>wd(e,d),onInstall:(d,u,f)=>$d(e,d,u,f)}):g}
|
|
3195
3338
|
|
|
3196
|
-
${e.tab==="nodes"
|
|
3339
|
+
${e.tab==="nodes"?$f({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:()=>wn(e),onDevicesRefresh:()=>Ce(e),onDeviceApprove:d=>ld(e,d),onDeviceReject:d=>cd(e,d),onDeviceRotate:(d,u,f)=>dd(e,{deviceId:d,role:u,scopes:f}),onDeviceRevoke:(d,u)=>ud(e,{deviceId:d,role:u}),onLoadConfig:()=>we(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Qs(e,d)},onBindDefault:d=>{d?zt(e,["tools","exec","node"],d):ra(e,["tools","exec","node"])},onBindAgent:(d,u)=>{const f=["agents","list",d,"tools","exec","node"];u?zt(e,f,u):ra(e,f)},onSaveBindings:()=>ms(e),onExecApprovalsTargetChange:(d,u)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=u,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,u)=>vd(e,d,u),onExecApprovalsRemove:d=>md(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return gd(e,d)}}):g}
|
|
3197
3340
|
|
|
3198
|
-
${e.tab==="chat"?
|
|
3341
|
+
${e.tab==="chat"?Qp({sessionKey:e.sessionKey,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity(),st(e),As(e)},thinkingLevel:e.chatThinkingLevel,showThinking:c,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:p,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:i,error:e.lastError,sessions:e.sessionsResult,focusMode:o,onRefresh:()=>(e.resetToolStream(),Promise.all([st(e),As(e)])),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:d=>e.handleChatScroll(d),onDraftChange:d=>e.chatMessage=d,attachments:e.chatAttachments,onAttachmentsChange:d=>e.chatAttachments=d,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:d=>e.removeQueuedMessage(d),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:d=>e.handleOpenSidebar(d),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:d=>e.handleSplitRatioChange(d),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar}):g}
|
|
3199
3342
|
|
|
3200
|
-
${e.tab==="config"?
|
|
3343
|
+
${e.tab==="config"?fh({raw:e.configRaw,originalRaw:e.configRawOriginal,valid:e.configValid,issues:e.configIssues,loading:e.configLoading,saving:e.configSaving,applying:e.configApplying,updating:e.updateRunning,connected:e.connected,schema:e.configSchema,schemaLoading:e.configSchemaLoading,uiHints:e.configUiHints,formMode:e.configFormMode,formValue:e.configForm,originalValue:e.configFormOriginal,searchQuery:e.configSearchQuery,activeSection:e.configActiveSection,activeSubsection:e.configActiveSubsection,onRawChange:d=>{e.configRaw=d},onFormModeChange:d=>e.configFormMode=d,onFormPatch:(d,u)=>zt(e,d,u),onSearchChange:d=>e.configSearchQuery=d,onSectionChange:d=>{e.configActiveSection=d,e.configActiveSubsection=null},onSubsectionChange:d=>e.configActiveSubsection=d,onReload:()=>we(e),onSave:()=>ms(e),onApply:()=>bc(e),onUpdate:()=>yc(e)}):g}
|
|
3201
3344
|
|
|
3202
|
-
${e.tab==="debug"?
|
|
3345
|
+
${e.tab==="debug"?ef({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:d=>e.debugCallMethod=d,onCallParamsChange:d=>e.debugCallParams=d,onRefresh:()=>bn(e),onCall:()=>Cc(e)}):g}
|
|
3203
3346
|
|
|
3204
|
-
${e.tab==="logs"?
|
|
3347
|
+
${e.tab==="logs"?of({loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:d=>e.logsFilterText=d,onLevelToggle:(d,u)=>{e.logsLevelFilters={...e.logsLevelFilters,[d]:u}},onToggleAutoFollow:d=>e.logsAutoFollow=d,onRefresh:()=>zs(e,{reset:!0}),onExport:(d,u)=>e.exportLogs(d,u),onScroll:d=>e.handleLogsScroll(d)}):g}
|
|
3205
3348
|
</main>
|
|
3206
|
-
${
|
|
3349
|
+
${ug(e)}
|
|
3207
3350
|
</div>
|
|
3208
|
-
`}const Vf={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Gf={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};async function Yf(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const Ar={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"poolbot-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"poolbot-macos",IOS_APP:"poolbot-ios",ANDROID_APP:"poolbot-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"poolbot-probe"},Ga=Ar,Cs={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(Ar));new Set(Object.values(Cs));function Qf(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const Zf=4008;class Jf{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await Ks();const d=Gc({deviceId:i.deviceId,role:s})?.token;o=d??this.opts.token,a=!!(d&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let r;if(t&&i){const d=Date.now(),u=this.connectNonce??void 0,g=Qf({deviceId:i.deviceId,clientId:this.opts.clientName??Ga.CONTROL_UI,clientMode:this.opts.mode??Cs.WEBCHAT,role:s,scopes:n,signedAtMs:d,token:o??null,nonce:u}),v=await Wc(i.privateKey,g);r={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:d,nonce:u}}const p={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ga.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Cs.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:r,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",p).then(d=>{d?.auth?.deviceToken&&i&&Po({deviceId:i.deviceId,role:d.auth.role??s,token:d.auth.deviceToken,scopes:d.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(d)}).catch(()=>{a&&i&&No({deviceId:i.deviceId,role:s}),this.ws?.close(Zf,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Os(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:r=>o(r),reject:l})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Es(e){return typeof e=="object"&&e!==null}function Xf(e){if(!Es(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Es(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function eg(e){if(!Es(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 Sr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function tg(e,t){const n=Sr(e).filter(s=>s.id!==t.id);return n.push(t),n}function Ya(e,t){return Sr(e).filter(n=>n.id!==t)}async function _r(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=as(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ns(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function ng(e,t){if(!t?.mainSessionKey)return;const n=ns(e.sessionKey,t),s=ns(e.settings.sessionKey,t),i=ns(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},l=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),l&&ke(e,o)}function Tr(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new Jf({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"poolbot-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,ag(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,dn(e),_r(e),Yf(e),gn(e,{quiet:!0}),Te(e,{quiet:!0}),Zs(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>sg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function sg(e,t){try{ig(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function ig(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;Zl(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Oo(e,n.sessionKey);const s=Fl(e,n);(s==="final"||s==="error"||s==="aborted")&&(dn(e),Md(e)),s==="final"&&Xe(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&Js(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Te(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=Xf(t.payload);if(n){e.execApprovalQueue=tg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Ya(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=eg(t.payload);n&&(e.execApprovalQueue=Ya(e.execApprovalQueue,n.id))}}function ag(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&ng(e,n.sessionDefaults)}function og(e){e.basePath=md(),$d(e,!0),bd(e),yd(e),window.addEventListener("popstate",e.popStateHandler),fd(e),Tr(e),pd(e),e.tab==="logs"&&Vs(e),e.tab==="debug"&&Ys(e)}function rg(e){nc(e)}function lg(e){window.removeEventListener("popstate",e.popStateHandler),hd(e),Gs(e),Qs(e),wd(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function cg(e,t){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===!1;un(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&ho(e,t.has("tab")||t.has("logsAutoFollow"))}async function dg(e,t){await hc(e,t),await oe(e,!0)}async function ug(e){await fc(e),await oe(e,!0)}async function pg(e){await gc(e),await oe(e,!0)}async function hg(e){await us(e),await be(e),await oe(e,!0)}async function fg(e){await be(e),await oe(e,!0)}function gg(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function Cr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function Er(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function vg(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=hh(n??void 0)}function mg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function bg(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function yg(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function wg(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Cr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(Er(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:gg(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 oe(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function $g(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Cr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(Er(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const r=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:r,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,l=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await oe(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}var xg=Object.defineProperty,kg=Object.getOwnPropertyDescriptor,b=(e,t,n,s)=>{for(var i=s>1?void 0:s?kg(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&xg(t,n,i),i};const ss=bl();function Ag(){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 m=class extends Ze{constructor(){super(...arguments),this.settings=yl(),this.password="",this.tab="chat",this.onboarding=Ag(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=ss.name,this.assistantAvatar=ss.avatar,this.assistantAgentId=ss.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.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.configLoading=!1,this.configRaw=`{
|
|
3351
|
+
`}const _g={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Tg={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};async function Eg(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const Mr={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"poolbot-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"poolbot-macos",IOS_APP:"poolbot-ios",ANDROID_APP:"poolbot-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"poolbot-probe"},to=Mr,Ps={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(Mr));new Set(Object.values(Ps));function Cg(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const Ig=4008;class Rg{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await Gs();const d=rd({deviceId:i.deviceId,role:s})?.token;o=d??this.opts.token,a=!!(d&&this.opts.token)}const c=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let l;if(t&&i){const d=Date.now(),u=this.connectNonce??void 0,f=Cg({deviceId:i.deviceId,clientId:this.opts.clientName??to.CONTROL_UI,clientMode:this.opts.mode??Ps.WEBCHAT,role:s,scopes:n,signedAtMs:d,token:o??null,nonce:u}),v=await ad(i.privateKey,f);l={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:d,nonce:u}}const p={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??to.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Ps.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:l,caps:[],auth:c,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",p).then(d=>{d?.auth?.deviceToken&&i&&Fo({deviceId:i.deviceId,role:d.auth.role??s,token:d.auth.deviceToken,scopes:d.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(d)}).catch(()=>{a&&i&&Ho({deviceId:i.deviceId,role:s}),this.ws?.close(Ig,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,c=o&&typeof o.nonce=="string"?o.nonce:null;c&&(this.connectNonce=c,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Ks(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,c)=>{this.pending.set(s,{resolve:l=>o(l),reject:c})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ns(e){return typeof e=="object"&&e!==null}function Lg(e){if(!Ns(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Ns(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function Mg(e){if(!Ns(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 Pr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Pg(e,t){const n=Pr(e).filter(s=>s.id!==t.id);return n.push(t),n}function no(e,t){return Pr(e).filter(n=>n.id!==t)}async function Nr(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=us(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ls(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function Ng(e,t){if(!t?.mainSessionKey)return;const n=ls(e.sessionKey,t),s=ls(e.settings.sessionKey,t),i=ls(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},c=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),c&&Se(e,o)}function Or(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new Rg({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"poolbot-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,Ug(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,gn(e),Nr(e),Eg(e),wn(e,{quiet:!0}),Ce(e,{quiet:!0}),si(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>Og(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function Og(e,t){try{Dg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Dg(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;dc(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Ko(e,n.sessionKey);const s=Zl(e,n);(s==="final"||s==="error"||s==="aborted")&&(gn(e),zd(e)),s==="final"&&st(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&ii(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Ce(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=Lg(t.payload);if(n){e.execApprovalQueue=Pg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=no(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=Mg(t.payload);n&&(e.execApprovalQueue=no(e.execApprovalQueue,n.id))}}function Ug(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&Ng(e,n.sessionDefaults)}function Bg(e){e.basePath=Id(),Pd(e,!0),Rd(e),Ld(e),window.addEventListener("popstate",e.popStateHandler),Td(e),Or(e),Sd(e),e.tab==="logs"&&Xs(e),e.tab==="debug"&&ti(e)}function Fg(e){gc(e)}function Hg(e){window.removeEventListener("popstate",e.popStateHandler),_d(e),ei(e),ni(e),Md(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function Kg(e,t){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===!1;vn(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&yo(e,t.has("tab")||t.has("logsAutoFollow"))}async function zg(e,t){await _c(e,t),await le(e,!0)}async function jg(e){await Tc(e),await le(e,!0)}async function qg(e){await Ec(e),await le(e,!0)}async function Wg(e){await ms(e),await we(e),await le(e,!0)}async function Gg(e){await we(e),await le(e,!0)}function Vg(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function Dr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function Ur(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Yg(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=_h(n??void 0)}function Qg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Jg(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Zg(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Xg(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Dr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(Ur(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:Vg(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 le(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function ev(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Dr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(Ur(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const l=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,c=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:c},i.saved&&await le(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}var tv=Object.defineProperty,nv=Object.getOwnPropertyDescriptor,y=(e,t,n,s)=>{for(var i=s>1?void 0:s?nv(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&tv(t,n,i),i};const cs=Tl();function sv(){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 b=class extends tt{constructor(){super(...arguments),this.settings=El(),this.password="",this.tab="chat",this.onboarding=sv(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=cs.name,this.assistantAvatar=cs.avatar,this.assistantAgentId=cs.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.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.configLoading=!1,this.configRaw=`{
|
|
3209
3352
|
}
|
|
3210
|
-
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...
|
|
3211
|
-
//# sourceMappingURL=index-
|
|
3353
|
+
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Tg},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={..._g},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.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>Nd(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Bg(this)}firstUpdated(){Fg(this)}disconnectedCallback(){Hg(this),super.disconnectedCallback()}updated(e){Kg(this,e)}connect(){Or(this)}handleChatScroll(e){uc(this,e)}handleLogsScroll(e){pc(this,e)}exportLogs(e,t){fc(e,t)}resetToolStream(){gn(this)}resetChatScroll(){hc(this)}async loadAssistantIdentity(){await Nr(this)}applySettings(e){Se(this,e)}setTab(e){Ed(this,e)}setTheme(e,t){Cd(this,e,t)}async loadOverview(){await qo(this)}async loadCron(){await ii(this)}async handleAbortChat(){await Go(this)}removeQueuedMessage(e){Fd(this,e)}async handleSendChat(e,t){await Hd(this,e,t)}async handleWhatsAppStart(e){await zg(this,e)}async handleWhatsAppWait(){await jg(this)}async handleWhatsAppLogout(){await qg(this)}async handleChannelConfigSave(){await Wg(this)}async handleChannelConfigReload(){await Gg(this)}handleNostrProfileEdit(e,t){Yg(this,e,t)}handleNostrProfileCancel(){Qg(this)}handleNostrProfileFieldChange(e,t){Jg(this,e,t)}async handleNostrProfileSave(){await Xg(this)}async handleNostrProfileImport(){await ev(this)}handleNostrProfileToggleAdvanced(){Zg(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}}}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 Sg(this)}};y([w()],b.prototype,"settings",2);y([w()],b.prototype,"password",2);y([w()],b.prototype,"tab",2);y([w()],b.prototype,"onboarding",2);y([w()],b.prototype,"connected",2);y([w()],b.prototype,"theme",2);y([w()],b.prototype,"themeResolved",2);y([w()],b.prototype,"hello",2);y([w()],b.prototype,"lastError",2);y([w()],b.prototype,"eventLog",2);y([w()],b.prototype,"assistantName",2);y([w()],b.prototype,"assistantAvatar",2);y([w()],b.prototype,"assistantAgentId",2);y([w()],b.prototype,"sessionKey",2);y([w()],b.prototype,"chatLoading",2);y([w()],b.prototype,"chatSending",2);y([w()],b.prototype,"chatMessage",2);y([w()],b.prototype,"chatMessages",2);y([w()],b.prototype,"chatToolMessages",2);y([w()],b.prototype,"chatStream",2);y([w()],b.prototype,"chatStreamStartedAt",2);y([w()],b.prototype,"chatRunId",2);y([w()],b.prototype,"compactionStatus",2);y([w()],b.prototype,"chatAvatarUrl",2);y([w()],b.prototype,"chatThinkingLevel",2);y([w()],b.prototype,"chatQueue",2);y([w()],b.prototype,"chatAttachments",2);y([w()],b.prototype,"sidebarOpen",2);y([w()],b.prototype,"sidebarContent",2);y([w()],b.prototype,"sidebarError",2);y([w()],b.prototype,"splitRatio",2);y([w()],b.prototype,"nodesLoading",2);y([w()],b.prototype,"nodes",2);y([w()],b.prototype,"devicesLoading",2);y([w()],b.prototype,"devicesError",2);y([w()],b.prototype,"devicesList",2);y([w()],b.prototype,"execApprovalsLoading",2);y([w()],b.prototype,"execApprovalsSaving",2);y([w()],b.prototype,"execApprovalsDirty",2);y([w()],b.prototype,"execApprovalsSnapshot",2);y([w()],b.prototype,"execApprovalsForm",2);y([w()],b.prototype,"execApprovalsSelectedAgent",2);y([w()],b.prototype,"execApprovalsTarget",2);y([w()],b.prototype,"execApprovalsTargetNodeId",2);y([w()],b.prototype,"execApprovalQueue",2);y([w()],b.prototype,"execApprovalBusy",2);y([w()],b.prototype,"execApprovalError",2);y([w()],b.prototype,"configLoading",2);y([w()],b.prototype,"configRaw",2);y([w()],b.prototype,"configRawOriginal",2);y([w()],b.prototype,"configValid",2);y([w()],b.prototype,"configIssues",2);y([w()],b.prototype,"configSaving",2);y([w()],b.prototype,"configApplying",2);y([w()],b.prototype,"updateRunning",2);y([w()],b.prototype,"applySessionKey",2);y([w()],b.prototype,"configSnapshot",2);y([w()],b.prototype,"configSchema",2);y([w()],b.prototype,"configSchemaVersion",2);y([w()],b.prototype,"configSchemaLoading",2);y([w()],b.prototype,"configUiHints",2);y([w()],b.prototype,"configForm",2);y([w()],b.prototype,"configFormOriginal",2);y([w()],b.prototype,"configFormDirty",2);y([w()],b.prototype,"configFormMode",2);y([w()],b.prototype,"configSearchQuery",2);y([w()],b.prototype,"configActiveSection",2);y([w()],b.prototype,"configActiveSubsection",2);y([w()],b.prototype,"channelsLoading",2);y([w()],b.prototype,"channelsSnapshot",2);y([w()],b.prototype,"channelsError",2);y([w()],b.prototype,"channelsLastSuccess",2);y([w()],b.prototype,"whatsappLoginMessage",2);y([w()],b.prototype,"whatsappLoginQrDataUrl",2);y([w()],b.prototype,"whatsappLoginConnected",2);y([w()],b.prototype,"whatsappBusy",2);y([w()],b.prototype,"nostrProfileFormState",2);y([w()],b.prototype,"nostrProfileAccountId",2);y([w()],b.prototype,"presenceLoading",2);y([w()],b.prototype,"presenceEntries",2);y([w()],b.prototype,"presenceError",2);y([w()],b.prototype,"presenceStatus",2);y([w()],b.prototype,"agentsLoading",2);y([w()],b.prototype,"agentsList",2);y([w()],b.prototype,"agentsError",2);y([w()],b.prototype,"sessionsLoading",2);y([w()],b.prototype,"sessionsResult",2);y([w()],b.prototype,"sessionsError",2);y([w()],b.prototype,"sessionsFilterActive",2);y([w()],b.prototype,"sessionsFilterLimit",2);y([w()],b.prototype,"sessionsIncludeGlobal",2);y([w()],b.prototype,"sessionsIncludeUnknown",2);y([w()],b.prototype,"cronLoading",2);y([w()],b.prototype,"cronJobs",2);y([w()],b.prototype,"cronStatus",2);y([w()],b.prototype,"cronError",2);y([w()],b.prototype,"cronForm",2);y([w()],b.prototype,"cronRunsJobId",2);y([w()],b.prototype,"cronRuns",2);y([w()],b.prototype,"cronBusy",2);y([w()],b.prototype,"skillsLoading",2);y([w()],b.prototype,"skillsReport",2);y([w()],b.prototype,"skillsError",2);y([w()],b.prototype,"skillsFilter",2);y([w()],b.prototype,"skillEdits",2);y([w()],b.prototype,"skillsBusyKey",2);y([w()],b.prototype,"skillMessages",2);y([w()],b.prototype,"debugLoading",2);y([w()],b.prototype,"debugStatus",2);y([w()],b.prototype,"debugHealth",2);y([w()],b.prototype,"debugModels",2);y([w()],b.prototype,"debugHeartbeat",2);y([w()],b.prototype,"debugCallMethod",2);y([w()],b.prototype,"debugCallParams",2);y([w()],b.prototype,"debugCallResult",2);y([w()],b.prototype,"debugCallError",2);y([w()],b.prototype,"logsLoading",2);y([w()],b.prototype,"logsError",2);y([w()],b.prototype,"logsFile",2);y([w()],b.prototype,"logsEntries",2);y([w()],b.prototype,"logsFilterText",2);y([w()],b.prototype,"logsLevelFilters",2);y([w()],b.prototype,"logsAutoFollow",2);y([w()],b.prototype,"logsTruncated",2);y([w()],b.prototype,"logsCursor",2);y([w()],b.prototype,"logsLastFetchAt",2);y([w()],b.prototype,"logsLimit",2);y([w()],b.prototype,"logsMaxBytes",2);y([w()],b.prototype,"logsAtBottom",2);b=y([uo("poolbot-app")],b);
|
|
3354
|
+
//# sourceMappingURL=index-umCsvrWy.js.map
|