clawbrah 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +8 -0
  2. package/dist/{acp-cli-BnKXNti3.js → acp-cli-CcucTH3-.js} +2 -2
  3. package/dist/{agent-BIxLfYkv.js → agent-Dtt33y4K.js} +5 -5
  4. package/dist/{audit-DK1NXsUR.js → audit-XCSjij3p.js} +5 -5
  5. package/dist/build-info.json +2 -2
  6. package/dist/{call-B0EB11Hz.js → call-BCKAcENU.js} +1 -1
  7. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  8. package/dist/{channel-options-DLVRytYw.js → channel-options-CtT-DYGS.js} +1 -1
  9. package/dist/{channel-summary-ECvQTB5n.js → channel-summary-DdBFUMut.js} +2 -2
  10. package/dist/{channels-cli-NW8TfhTG.js → channels-cli-BpWN37TL.js} +16 -16
  11. package/dist/{chrome-4hKxr5KT.js → chrome-YyXlpRHF.js} +7 -7
  12. package/dist/cli/daemon-cli.js +1 -1
  13. package/dist/{cli-CBWZx_9K.js → cli-CBRgCv0e.js} +14 -14
  14. package/dist/{client-to8eMV2s.js → client-B0XbrmGE.js} +3 -3
  15. package/dist/{completion-cli-BO3ziRR1.js → completion-cli-AvBp6AtM.js} +20 -20
  16. package/dist/{completion-cli-xQqLK_Ni.js → completion-cli-BJDSqY7E.js} +1 -1
  17. package/dist/{config-guard-CKr985of.js → config-guard-CZUUTZtP.js} +3 -3
  18. package/dist/{configure-tZw988ro.js → configure-D4Ol2sJ7.js} +4 -4
  19. package/dist/{control-service-Dssk9Kaa.js → control-service-CcBK8tVJ.js} +3 -3
  20. package/dist/control-ui/assets/{index-Dm6g1E26.js → index-D0ToVTL2.js} +73 -73
  21. package/dist/control-ui/assets/index-D0ToVTL2.js.map +1 -0
  22. package/dist/control-ui/index.html +2 -2
  23. package/dist/{cron-cli-B-LWRLK-.js → cron-cli-oVmbA9m3.js} +3 -3
  24. package/dist/{daemon-cli-CatDQvXp.js → daemon-cli-BTUVzdFV.js} +5 -5
  25. package/dist/{deliver-BBwjenkx.js → deliver-BL3iTzV7.js} +3 -3
  26. package/dist/{deps-NlR-vxlh.js → deps-DwFGYEfo.js} +2 -2
  27. package/dist/{devices-cli-_rugjRme.js → devices-cli-Dh1zQEai.js} +2 -2
  28. package/dist/{dispatcher-DOZGzrqb.js → dispatcher-BxDtNwSF.js} +1 -1
  29. package/dist/{doctor-CdqmZxrK.js → doctor-Cd7vdP5c.js} +1 -1
  30. package/dist/{doctor-DdHvLQSW.js → doctor-CxJU9o8E.js} +7 -7
  31. package/dist/entry.js +1 -1
  32. package/dist/{exec-approvals-cli-BGB1TyrS.js → exec-approvals-cli-cNZ2kj5G.js} +4 -4
  33. package/dist/{gateway-cli-Dm6fyKOW.js → gateway-cli-BNemVjwo.js} +19 -12
  34. package/dist/{gateway-cli-Ctozr1Nr.js → gateway-cli-BqqJby05.js} +43 -36
  35. package/dist/{gateway-rpc-DIBI9dZU.js → gateway-rpc-Cr07mZlu.js} +1 -1
  36. package/dist/{github-copilot-auth-CWMgcPFb.js → github-copilot-auth-CrVdsllh.js} +2 -2
  37. package/dist/{health-format-rvKQDZAe.js → health-format-DnQrmi90.js} +5 -5
  38. package/dist/{hooks-cli-Dk70ZlpQ.js → hooks-cli-DWEqzkp9.js} +15 -15
  39. package/dist/{image-fscCHaO2.js → image-D_5DXfCx.js} +1 -1
  40. package/dist/index.js +30 -30
  41. package/dist/{logs-cli-GIy-ReUJ.js → logs-cli-y18fKF21.js} +3 -3
  42. package/dist/{models-cli-BD-etPw9.js → models-cli-DanWmMCK.js} +15 -15
  43. package/dist/{node-cli-nnREUTNh.js → node-cli-DFGB6c29.js} +6 -6
  44. package/dist/{nodes-cli-C1KLCUgY.js → nodes-cli-B-CYGxk4.js} +3 -3
  45. package/dist/{onboard-channels--6mZlRdm.js → onboard-channels-BXvAgRr8.js} +1 -1
  46. package/dist/{onboard-skills-CKh0otKb.js → onboard-skills-Bi8vfuv9.js} +4 -4
  47. package/dist/{onboarding-C9T4fYdo.js → onboarding-gM1r4cd0.js} +12 -12
  48. package/dist/{pi-embedded-helpers-R5an9K5m.js → pi-embedded-helpers-C3JoQd_r.js} +2 -2
  49. package/dist/{pi-tools.policy-6uFIt3Ju.js → pi-tools.policy-UzfyMWa2.js} +1 -1
  50. package/dist/{plugins-cli-FsBHhKXs.js → plugins-cli-BEi-kDPv.js} +15 -15
  51. package/dist/{program-Tlz-_XHE.js → program-yY-4nnFP.js} +6 -6
  52. package/dist/{pw-ai-DRdnHJHd.js → pw-ai-C2z1o0vq.js} +1 -1
  53. package/dist/{register.subclis-Buhb02qd.js → register.subclis-CrzjDv0H.js} +3 -3
  54. package/dist/{reply-E1ga4GXi.js → reply-CuxaWVob.js} +15 -15
  55. package/dist/{routes-f7Edit7G.js → routes-D9Iafxku.js} +2 -2
  56. package/dist/{rpc-CGmdslK7.js → rpc-CCNQAZlJ.js} +1 -1
  57. package/dist/{run-main-7eydAwGv.js → run-main-CAI5BiMw.js} +8 -8
  58. package/dist/{sandbox-B4M0ryQ9.js → sandbox-AKDe5dkQ.js} +3 -3
  59. package/dist/{sandbox-cli-CoTcXRmo.js → sandbox-cli-DCLF09ZP.js} +4 -4
  60. package/dist/{security-cli-B_s4Rfs1.js → security-cli-CwgI6uQv.js} +8 -8
  61. package/dist/{server-context-BqWI0WDa.js → server-context-Cnep00Hq.js} +4 -4
  62. package/dist/{server-node-events-DXWeo9KB.js → server-node-events-Cb8AP2Lo.js} +16 -16
  63. package/dist/{status-BH22yQwC.js → status-PDg9fMff.js} +1 -1
  64. package/dist/{status-C09l2YXY.js → status-pc_aNqHa.js} +2 -2
  65. package/dist/{system-cli-DEm78jPM.js → system-cli-CHu5cmH5.js} +3 -3
  66. package/dist/{tui-M4SDqVBr.js → tui-B2ZEdepW.js} +4 -4
  67. package/dist/{tui-cli-DM2GolnA.js → tui-cli-DuluR3sM.js} +9 -9
  68. package/dist/{update-cli-Bfsx9UKw.js → update-cli-CRhNpoV5.js} +4 -4
  69. package/dist/{update-cli-DoiUKlNw.js → update-cli-DuendAEY.js} +20 -20
  70. package/dist/{update-runner-LPAHTmXu.js → update-runner-CXRmW-Uy.js} +1 -1
  71. package/dist/{update-runner-_TG-7dl6.js → update-runner-sVyFnQ5i.js} +3 -3
  72. package/extensions/brah-sync/index.ts +5 -4
  73. package/package.json +2 -2
  74. package/dist/control-ui/assets/index-Dm6g1E26.js.map +0 -1
@@ -1,7 +1,7 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const Ln=globalThis,yi=Ln.ShadowRoot&&(Ln.ShadyCSS===void 0||Ln.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,xi=Symbol(),Ca=new WeakMap;let Jo=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==xi)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(yi&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Ca.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Ca.set(n,t))}return t}toString(){return this.cssText}};const Yl=e=>new Jo(typeof e=="string"?e:e+"",void 0,xi),Zl=(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 Jo(n,e,xi)},Jl=(e,t)=>{if(yi)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Ln.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},Ta=yi?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Yl(n)})(e):e;const{is:Xl,defineProperty:ec,getOwnPropertyDescriptor:tc,getOwnPropertyNames:nc,getOwnPropertySymbols:sc,getPrototypeOf:ic}=Object,Gn=globalThis,_a=Gn.trustedTypes,ac=_a?_a.emptyScript:"",oc=Gn.reactiveElementPolyfillSupport,Wt=(e,t)=>e,Dn={toAttribute(e,t){switch(t){case Boolean:e=e?ac: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}},$i=(e,t)=>!Xl(e,t),Ea={attribute:!0,type:String,converter:Dn,reflect:!1,useDefault:!1,hasChanged:$i};Symbol.metadata??=Symbol("metadata"),Gn.litPropertyMetadata??=new WeakMap;let At=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=Ea){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&&ec(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=tc(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const l=i?.call(this);a?.call(this,o),this.requestUpdate(t,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ea}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;const t=ic(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Wt("properties"))){const n=this.properties,s=[...nc(n),...sc(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(Ta(i))}else t!==void 0&&n.push(Ta(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 Jl(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:Dn).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:Dn;this._$Em=i;const l=o.fromAttribute(n,a.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??$i)(a,n)||s.useDefault&&s.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,l=this[i];o!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,a,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(t){}firstUpdated(t){}};At.elementStyles=[],At.shadowRootOptions={mode:"open"},At[Wt("elementProperties")]=new Map,At[Wt("finalized")]=new Map,oc?.({ReactiveElement:At}),(Gn.reactiveElementVersions??=[]).push("2.1.2");const wi=globalThis,La=e=>e,Fn=wi.trustedTypes,Ma=Fn?Fn.createPolicy("lit-html",{createHTML:e=>e}):void 0,Xo="$lit$",Ge=`lit$${Math.random().toFixed(9).slice(2)}$`,er="?"+Ge,rc=`<${er}>`,ut=document,Zt=()=>ut.createComment(""),Jt=e=>e===null||typeof e!="object"&&typeof e!="function",ki=Array.isArray,lc=e=>ki(e)||typeof e?.[Symbol.iterator]=="function",xs=`[
2
- \f\r]`,Pt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ia=/-->/g,Ra=/>/g,tt=RegExp(`>|${xs}(?:([^\\s"'>=/]+)(${xs}*=${xs}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Pa=/'/g,Da=/"/g,tr=/^(?:script|style|textarea|title)$/i,nr=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=nr(1),mn=nr(2),Qe=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Fa=new WeakMap,ct=ut.createTreeWalker(ut,129);function sr(e,t){if(!ki(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ma!==void 0?Ma.createHTML(t):t}const cc=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=Pt;for(let l=0;l<n;l++){const c=e[l];let u,p,g=-1,h=0;for(;h<c.length&&(o.lastIndex=h,p=o.exec(c),p!==null);)h=o.lastIndex,o===Pt?p[1]==="!--"?o=Ia:p[1]!==void 0?o=Ra:p[2]!==void 0?(tr.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=tt):p[3]!==void 0&&(o=tt):o===tt?p[0]===">"?(o=i??Pt,g=-1):p[1]===void 0?g=-2:(g=o.lastIndex-p[2].length,u=p[1],o=p[3]===void 0?tt:p[3]==='"'?Da:Pa):o===Da||o===Pa?o=tt:o===Ia||o===Ra?o=Pt:(o=tt,i=void 0);const d=o===tt&&e[l+1].startsWith("/>")?" ":"";a+=o===Pt?c+rc:g>=0?(s.push(u),c.slice(0,g)+Xo+c.slice(g)+Ge+d):c+Ge+(g===-2?l:d)}return[sr(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let Ws=class ir{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,c=this.parts,[u,p]=cc(t,n);if(this.el=ir.createElement(u,s),ct.currentNode=this.el.content,n===2||n===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=ct.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const g of i.getAttributeNames())if(g.endsWith(Xo)){const h=p[o++],d=i.getAttribute(g).split(Ge),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:a,name:f[2],strings:d,ctor:f[1]==="."?uc:f[1]==="?"?gc:f[1]==="@"?pc:Qn}),i.removeAttribute(g)}else g.startsWith(Ge)&&(c.push({type:6,index:a}),i.removeAttribute(g));if(tr.test(i.tagName)){const g=i.textContent.split(Ge),h=g.length-1;if(h>0){i.textContent=Fn?Fn.emptyScript:"";for(let d=0;d<h;d++)i.append(g[d],Zt()),ct.nextNode(),c.push({type:2,index:++a});i.append(g[h],Zt())}}}else if(i.nodeType===8)if(i.data===er)c.push({type:2,index:a});else{let g=-1;for(;(g=i.data.indexOf(Ge,g+1))!==-1;)c.push({type:7,index:a}),g+=Ge.length-1}a++}}static createElement(t,n){const s=ut.createElement("template");return s.innerHTML=t,s}};function _t(e,t,n=e,s){if(t===Qe)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Jt(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=_t(e,i._$AS(e,t.values),i,s)),t}class dc{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??ut).importNode(n,!0);ct.currentNode=i;let a=ct.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Vn(a,a.nextSibling,this,t):c.type===1?u=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(u=new fc(a,this,t)),this._$AV.push(u),c=s[++l]}o!==c?.index&&(a=ct.nextNode(),o++)}return ct.currentNode=ut,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let Vn=class ar{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=_t(this,t,n),Jt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==Qe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):lc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==v&&Jt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ut.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=Ws.createElement(sr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new dc(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Fa.get(t.strings);return n===void 0&&Fa.set(t.strings,n=new Ws(t)),n}k(t){ki(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 ar(this.O(Zt()),this.O(Zt()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=La(t).nextSibling;La(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class Qn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=v}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=_t(this,t,n,0),o=!Jt(t)||t!==this._$AH&&t!==Qe,o&&(this._$AH=t);else{const l=t;let c,u;for(t=a[0],c=0;c<a.length-1;c++)u=_t(this,l[s+c],n,c),u===Qe&&(u=this._$AH[c]),o||=!Jt(u)||u!==this._$AH[c],u===v?t=v:t!==v&&(t+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let uc=class extends Qn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},gc=class extends Qn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},pc=class extends Qn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=_t(this,t,n,0)??v)===Qe)return;const s=this._$AH,i=t===v&&s!==v||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==v&&(s===v||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},fc=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){_t(this,t)}};const hc={I:Vn},vc=wi.litHtmlPolyfillSupport;vc?.(Ws,Vn),(wi.litHtmlVersions??=[]).push("3.3.2");const mc=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new Vn(t.insertBefore(Zt(),a),a,void 0,n??{})}return i._$AI(e),i};const Si=globalThis;let Tt=class extends At{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=mc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Qe}};Tt._$litElement$=!0,Tt.finalized=!0,Si.litElementHydrateSupport?.({LitElement:Tt});const bc=Si.litElementPolyfillSupport;bc?.({LitElement:Tt});(Si.litElementVersions??=[]).push("4.2.2");const or=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const yc={attribute:!0,type:String,converter:Dn,reflect:!1,hasChanged:$i},xc=(e=yc,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(l){const c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const c=this[o];t.call(this,l),this.requestUpdate(o,c,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Yn(e){return(t,n)=>typeof n=="object"?xc(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function $(e){return Yn({...e,state:!0,attribute:!1})}async function ye(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function $c(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function wc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function kc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function gt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Et(e){return`${JSON.stringify(e,null,2).trimEnd()}
4
- `}function rr(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],l=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof l=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const c=s;c[o]==null&&(c[o]=typeof l=="number"?[]:{}),s=c[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function lr(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 Ee(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Ac(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function cr(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 Ac(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=gt(t.config??{}),e.configFormOriginal=gt(t.config??{}),e.configRawOriginal=n)}async function Mn(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 Ee(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function Cc(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 Ee(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function Tc(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function $e(e,t,n){const s=gt(e.configForm??e.configSnapshot?.config??{});rr(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=Et(s))}function ze(e,t){const n=gt(e.configForm??e.configSnapshot?.config??{});lr(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=Et(n))}function _c(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 Ec(e){const{state:t,callbacks:n,accountId:s}=e,i=_c(t),a=(l,c,u={})=>{const{type:p="text",placeholder:g,maxLength:h,help:d}=u,f=t.values[l]??"",m=t.fieldErrors[l],k=`nostr-profile-${l}`;return p==="textarea"?r`
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 Ln=globalThis,yi=Ln.ShadowRoot&&(Ln.ShadyCSS===void 0||Ln.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,xi=Symbol(),Ca=new WeakMap;let Jo=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==xi)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(yi&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Ca.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Ca.set(n,t))}return t}toString(){return this.cssText}};const Yl=e=>new Jo(typeof e=="string"?e:e+"",void 0,xi),Zl=(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 Jo(n,e,xi)},Jl=(e,t)=>{if(yi)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Ln.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},Ta=yi?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Yl(n)})(e):e;const{is:Xl,defineProperty:ec,getOwnPropertyDescriptor:tc,getOwnPropertyNames:nc,getOwnPropertySymbols:sc,getPrototypeOf:ic}=Object,Gn=globalThis,_a=Gn.trustedTypes,ac=_a?_a.emptyScript:"",oc=Gn.reactiveElementPolyfillSupport,Wt=(e,t)=>e,Dn={toAttribute(e,t){switch(t){case Boolean:e=e?ac: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}},$i=(e,t)=>!Xl(e,t),Ea={attribute:!0,type:String,converter:Dn,reflect:!1,useDefault:!1,hasChanged:$i};Symbol.metadata??=Symbol("metadata"),Gn.litPropertyMetadata??=new WeakMap;let At=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=Ea){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&&ec(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=tc(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const l=i?.call(this);a?.call(this,o),this.requestUpdate(t,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ea}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;const t=ic(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Wt("properties"))){const n=this.properties,s=[...nc(n),...sc(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(Ta(i))}else t!==void 0&&n.push(Ta(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 Jl(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:Dn).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:Dn;this._$Em=i;const l=o.fromAttribute(n,a.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??$i)(a,n)||s.useDefault&&s.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,l=this[i];o!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,a,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(t){}firstUpdated(t){}};At.elementStyles=[],At.shadowRootOptions={mode:"open"},At[Wt("elementProperties")]=new Map,At[Wt("finalized")]=new Map,oc?.({ReactiveElement:At}),(Gn.reactiveElementVersions??=[]).push("2.1.2");const wi=globalThis,La=e=>e,Fn=wi.trustedTypes,Ma=Fn?Fn.createPolicy("lit-html",{createHTML:e=>e}):void 0,Xo="$lit$",Ve=`lit$${Math.random().toFixed(9).slice(2)}$`,er="?"+Ve,rc=`<${er}>`,gt=document,Zt=()=>gt.createComment(""),Jt=e=>e===null||typeof e!="object"&&typeof e!="function",ki=Array.isArray,lc=e=>ki(e)||typeof e?.[Symbol.iterator]=="function",xs=`[
2
+ \f\r]`,Pt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ia=/-->/g,Ra=/>/g,nt=RegExp(`>|${xs}(?:([^\\s"'>=/]+)(${xs}*=${xs}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Pa=/'/g,Da=/"/g,tr=/^(?:script|style|textarea|title)$/i,nr=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=nr(1),mn=nr(2),Ye=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Fa=new WeakMap,dt=gt.createTreeWalker(gt,129);function sr(e,t){if(!ki(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ma!==void 0?Ma.createHTML(t):t}const cc=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=Pt;for(let l=0;l<n;l++){const c=e[l];let u,p,g=-1,h=0;for(;h<c.length&&(o.lastIndex=h,p=o.exec(c),p!==null);)h=o.lastIndex,o===Pt?p[1]==="!--"?o=Ia:p[1]!==void 0?o=Ra:p[2]!==void 0?(tr.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=nt):p[3]!==void 0&&(o=nt):o===nt?p[0]===">"?(o=i??Pt,g=-1):p[1]===void 0?g=-2:(g=o.lastIndex-p[2].length,u=p[1],o=p[3]===void 0?nt:p[3]==='"'?Da:Pa):o===Da||o===Pa?o=nt:o===Ia||o===Ra?o=Pt:(o=nt,i=void 0);const d=o===nt&&e[l+1].startsWith("/>")?" ":"";a+=o===Pt?c+rc:g>=0?(s.push(u),c.slice(0,g)+Xo+c.slice(g)+Ve+d):c+Ve+(g===-2?l:d)}return[sr(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let Ws=class ir{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,c=this.parts,[u,p]=cc(t,n);if(this.el=ir.createElement(u,s),dt.currentNode=this.el.content,n===2||n===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=dt.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const g of i.getAttributeNames())if(g.endsWith(Xo)){const h=p[o++],d=i.getAttribute(g).split(Ve),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:a,name:f[2],strings:d,ctor:f[1]==="."?uc:f[1]==="?"?gc:f[1]==="@"?pc:Qn}),i.removeAttribute(g)}else g.startsWith(Ve)&&(c.push({type:6,index:a}),i.removeAttribute(g));if(tr.test(i.tagName)){const g=i.textContent.split(Ve),h=g.length-1;if(h>0){i.textContent=Fn?Fn.emptyScript:"";for(let d=0;d<h;d++)i.append(g[d],Zt()),dt.nextNode(),c.push({type:2,index:++a});i.append(g[h],Zt())}}}else if(i.nodeType===8)if(i.data===er)c.push({type:2,index:a});else{let g=-1;for(;(g=i.data.indexOf(Ve,g+1))!==-1;)c.push({type:7,index:a}),g+=Ve.length-1}a++}}static createElement(t,n){const s=gt.createElement("template");return s.innerHTML=t,s}};function _t(e,t,n=e,s){if(t===Ye)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Jt(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=_t(e,i._$AS(e,t.values),i,s)),t}class dc{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??gt).importNode(n,!0);dt.currentNode=i;let a=dt.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Vn(a,a.nextSibling,this,t):c.type===1?u=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(u=new fc(a,this,t)),this._$AV.push(u),c=s[++l]}o!==c?.index&&(a=dt.nextNode(),o++)}return dt.currentNode=gt,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let Vn=class ar{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=_t(this,t,n),Jt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==Ye&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):lc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==v&&Jt(this._$AH)?this._$AA.nextSibling.data=t:this.T(gt.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Ws.createElement(sr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new dc(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Fa.get(t.strings);return n===void 0&&Fa.set(t.strings,n=new Ws(t)),n}k(t){ki(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 ar(this.O(Zt()),this.O(Zt()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=La(t).nextSibling;La(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class Qn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=v}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=_t(this,t,n,0),o=!Jt(t)||t!==this._$AH&&t!==Ye,o&&(this._$AH=t);else{const l=t;let c,u;for(t=a[0],c=0;c<a.length-1;c++)u=_t(this,l[s+c],n,c),u===Ye&&(u=this._$AH[c]),o||=!Jt(u)||u!==this._$AH[c],u===v?t=v:t!==v&&(t+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let uc=class extends Qn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},gc=class extends Qn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},pc=class extends Qn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=_t(this,t,n,0)??v)===Ye)return;const s=this._$AH,i=t===v&&s!==v||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==v&&(s===v||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},fc=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){_t(this,t)}};const hc={I:Vn},vc=wi.litHtmlPolyfillSupport;vc?.(Ws,Vn),(wi.litHtmlVersions??=[]).push("3.3.2");const mc=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new Vn(t.insertBefore(Zt(),a),a,void 0,n??{})}return i._$AI(e),i};const Si=globalThis;let Tt=class extends At{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=mc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ye}};Tt._$litElement$=!0,Tt.finalized=!0,Si.litElementHydrateSupport?.({LitElement:Tt});const bc=Si.litElementPolyfillSupport;bc?.({LitElement:Tt});(Si.litElementVersions??=[]).push("4.2.2");const or=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const yc={attribute:!0,type:String,converter:Dn,reflect:!1,hasChanged:$i},xc=(e=yc,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(l){const c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const c=this[o];t.call(this,l),this.requestUpdate(o,c,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Yn(e){return(t,n)=>typeof n=="object"?xc(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function $(e){return Yn({...e,state:!0,attribute:!1})}async function ye(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function $c(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function wc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function kc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function pt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Et(e){return`${JSON.stringify(e,null,2).trimEnd()}
4
+ `}function rr(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],l=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof l=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const c=s;c[o]==null&&(c[o]=typeof l=="number"?[]:{}),s=c[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function lr(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 Ee(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Ac(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function cr(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 Ac(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=pt(t.config??{}),e.configFormOriginal=pt(t.config??{}),e.configRawOriginal=n)}async function Mn(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 Ee(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function Cc(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 Ee(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function Tc(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function $e(e,t,n){const s=pt(e.configForm??e.configSnapshot?.config??{});rr(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=Et(s))}function ze(e,t){const n=pt(e.configForm??e.configSnapshot?.config??{});lr(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=Et(n))}function _c(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 Ec(e){const{state:t,callbacks:n,accountId:s}=e,i=_c(t),a=(l,c,u={})=>{const{type:p="text",placeholder:g,maxLength:h,help:d}=u,f=t.values[l]??"",m=t.fieldErrors[l],k=`nostr-profile-${l}`;return p==="textarea"?r`
5
5
  <div class="form-field" style="margin-bottom: 12px;">
6
6
  <label for="${k}" style="display: block; margin-bottom: 4px; font-weight: 500;">
7
7
  ${c}
@@ -123,9 +123,9 @@
123
123
  </div>
124
124
  `}function Lc(e){const t={name:e?.name??"",displayName:e?.displayName??"",about:e?.about??"",picture:e?.picture??"",banner:e?.banner??"",website:e?.website??"",nip05:e?.nip05??"",lud16:e?.lud16??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e?.banner||e?.website||e?.nip05||e?.lud16)}}async function Mc(e,t){await $c(e,t),await ye(e,!0)}async function Ic(e){await wc(e),await ye(e,!0)}async function Rc(e){await kc(e),await ye(e,!0)}async function Pc(e){await Mn(e),await Ee(e),await ye(e,!0)}async function Dc(e){await Ee(e),await ye(e,!0)}function Fc(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 Nc(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Lc(n??void 0)}function Oc(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Bc(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Uc(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function zc(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:Fc(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Hc(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 c=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:c,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,l=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function gr(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 qs=450;function an(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,a=t&&!e.chatHasAutoScrolled;if(!(a||e.chatUserNearBottom||i<qs)){e.chatNewMessagesBelow=!0;return}a&&(e.chatHasAutoScrolled=!0),s.scrollTop=s.scrollHeight,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1;const l=a?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const c=n();if(!c)return;const u=c.scrollHeight-c.scrollTop-c.clientHeight;(a||e.chatUserNearBottom||u<qs)&&(c.scrollTop=c.scrollHeight,e.chatUserNearBottom=!0)},l)})})}function pr(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 Kc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<qs,e.chatUserNearBottom&&(e.chatNewMessagesBelow=!1)}function jc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function Na(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1}function Wc(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
125
125
  `)}
126
- `],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function qc(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}async function Zn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Gc(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const Vc=2e3,Qc=new Set(["trace","debug","info","warn","error","fatal"]);function Yc(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function Zc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Qc.has(t)?t:null}function Jc(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=Zc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=Yc(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:s,level:i,subsystem:l,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ai(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(Jc),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-Vc),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}async function Jn(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function Xc(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Jn(e,{quiet:!0})},5e3))}function ed(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Ci(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ai(e,{quiet:!0})},2e3))}function Ti(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function _i(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Zn(e)},3e3))}function Ei(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function fr(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function hr(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function In(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Li(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const td=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,bn=/<\s*\/?\s*final\b[^<>]*>/gi,Oa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Ba(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(c=>a>=c.start&&o<=c.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Ua(e,t){return t.some(n=>e>=n.start&&e<n.end)}function nd(e,t){return e.trimStart()}function sd(e,t){if(!e||!td.test(e))return e;let n=e;if(bn.test(n)){bn.lastIndex=0;const l=[],c=Ba(n);for(const u of n.matchAll(bn)){const p=u.index??0;l.push({start:p,length:u[0].length,inCode:Ua(p,c)})}for(let u=l.length-1;u>=0;u--){const p=l[u];p.inCode||(n=n.slice(0,p.start)+n.slice(p.start+p.length))}}else bn.lastIndex=0;const s=Ba(n);Oa.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(Oa)){const c=l.index??0,u=l[1]==="/";Ua(c,s)||(o?u&&(o=!1):(i+=n.slice(a,c),u||(o=!0)),a=c+l[0].length)}return i+=n.slice(a),nd(i)}function Xt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function V(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e,n=Math.abs(t),s=t<0?"from now":"ago",i=Math.round(n/1e3);if(i<60)return t<0?"just now":`${i}s ago`;const a=Math.round(i/60);if(a<60)return`${a}m ${s}`;const o=Math.round(a/60);return o<48?`${o}h ${s}`:`${Math.round(o/24)}d ${s}`}function vr(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 Gs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Vs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function mr(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Nn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function $s(e){return sd(e)}async function on(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function Xn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function id(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",at:new Date(n).toISOString()}}if(e.scheduleKind==="every"){const n=Nn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function ad(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t},s=Nn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function od(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=id(e.cronForm),n=ad(e.cronForm),s=e.cronForm.sessionTarget==="isolated"&&e.cronForm.payloadKind==="agentTurn"&&e.cronForm.deliveryMode?{mode:e.cronForm.deliveryMode==="announce"?"announce":"none",channel:e.cronForm.deliveryChannel.trim()||"last",to:e.cronForm.deliveryTo.trim()||void 0}:void 0,i=e.cronForm.agentId.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,delivery:s};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Xn(e),await on(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function rd(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await Xn(e),await on(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function ld(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await br(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function cd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await Xn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function br(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}const yr="openclaw.device.auth.v1";function Mi(e){return e.trim()}function dd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].toSorted()}function Ii(){try{const e=window.localStorage.getItem(yr);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 xr(e){try{window.localStorage.setItem(yr,JSON.stringify(e))}catch{}}function ud(e){const t=Ii();if(!t||t.deviceId!==e.deviceId)return null;const n=Mi(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function $r(e){const t=Mi(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Ii();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:dd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,xr(n),i}function wr(e){const t=Ii();if(!t||t.deviceId!==e.deviceId)return;const n=Mi(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],xr(s)}const kr={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Rn,Gx:za,Gy:Ha,a:ws,d:ks,h:gd}=kr,pt=32,Ri=64,pd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},oe=(e="")=>{const t=new Error(e);throw pd(t,oe),t},fd=e=>typeof e=="bigint",hd=e=>typeof e=="string",vd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ye=(e,t,n="")=>{const s=vd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",c=s?`length=${i}`:`type=${typeof e}`;oe(o+"expected Uint8Array"+l+", got "+c)}return e},es=e=>new Uint8Array(e),Sr=e=>Uint8Array.from(e),Ar=(e,t)=>e.toString(16).padStart(t,"0"),Cr=e=>Array.from(Ye(e)).map(t=>Ar(t,2)).join(""),He={_0:48,_9:57,A:65,F:70,a:97,f:102},Ka=e=>{if(e>=He._0&&e<=He._9)return e-He._0;if(e>=He.A&&e<=He.F)return e-(He.A-10);if(e>=He.a&&e<=He.f)return e-(He.a-10)},Tr=e=>{const t="hex invalid";if(!hd(e))return oe(t);const n=e.length,s=n/2;if(n%2)return oe(t);const i=es(s);for(let a=0,o=0;a<s;a++,o+=2){const l=Ka(e.charCodeAt(o)),c=Ka(e.charCodeAt(o+1));if(l===void 0||c===void 0)return oe(t);i[a]=l*16+c}return i},_r=()=>globalThis?.crypto,md=()=>_r()?.subtle??oe("crypto.subtle must be defined, consider polyfill"),en=(...e)=>{const t=es(e.reduce((s,i)=>s+Ye(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},bd=(e=pt)=>_r().getRandomValues(es(e)),On=BigInt,at=(e,t,n,s="bad number: out of range")=>fd(e)&&t<=e&&e<n?e:oe(s),D=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Er=e=>D(e,Rn),yd=(e,t)=>{(e===0n||t<=0n)&&oe("no inverse n="+e+" mod="+t);let n=D(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,c=i-a*o;s=n,n=l,i=a,a=c}return s===1n?D(i,t):oe("no inverse")},xd=e=>{const t=Rr[e];return typeof t!="function"&&oe("hashes."+e+" not set"),t},Ss=e=>e instanceof ke?e:oe("Point expected"),Qs=2n**256n;class ke{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Qs;this.X=at(t,0n,a),this.Y=at(n,0n,a),this.Z=at(s,1n,a),this.T=at(i,0n,a),Object.freeze(this)}static CURVE(){return kr}static fromAffine(t){return new ke(t.x,t.y,1n,D(t.x*t.y))}static fromBytes(t,n=!1){const s=ks,i=Sr(Ye(t,pt)),a=t[31];i[31]=a&-129;const o=Mr(i);at(o,0n,n?Qs:ue);const c=D(o*o),u=D(c-1n),p=D(s*c+1n);let{isValid:g,value:h}=wd(u,p);g||oe("bad point: y not sqrt");const d=(h&1n)===1n,f=(a&128)!==0;return!n&&h===0n&&f&&oe("bad point: x==0, isLastByteOdd"),f!==d&&(h=D(-h)),new ke(h,o,1n,D(h*o))}static fromHex(t,n){return ke.fromBytes(Tr(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=ws,n=ks,s=this;if(s.is0())return oe("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,c=D(i*i),u=D(a*a),p=D(o*o),g=D(p*p),h=D(c*t),d=D(p*D(h+u)),f=D(g+D(n*D(c*u)));if(d!==f)return oe("bad point: equation left != right (1)");const m=D(i*a),k=D(o*l);return m!==k?oe("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=Ss(t),c=D(n*l),u=D(a*i),p=D(s*l),g=D(o*i);return c===u&&p===g}is0(){return this.equals(Ct)}negate(){return new ke(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=ws,a=D(t*t),o=D(n*n),l=D(2n*D(s*s)),c=D(i*a),u=t+n,p=D(D(u*u)-a-o),g=c+o,h=g-l,d=c-o,f=D(p*h),m=D(g*d),k=D(p*d),S=D(h*g);return new ke(f,m,S,k)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:c,T:u}=Ss(t),p=ws,g=ks,h=D(n*o),d=D(s*l),f=D(a*g*u),m=D(i*c),k=D((n+s)*(o+l)-h-d),S=D(m-f),w=D(m+f),C=D(d-p*h),A=D(k*S),_=D(w*C),T=D(k*C),I=D(S*w);return new ke(A,_,I,T)}subtract(t){return this.add(Ss(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Ct;if(at(t,1n,Rn),t===1n)return this;if(this.equals(ft))return Rd(t).p;let s=Ct,i=ft;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(Ct))return{x:0n,y:1n};const i=yd(s,ue);D(s*i)!==1n&&oe("invalid inverse");const a=D(t*i),o=D(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Lr(n);return s[31]|=t&1n?128:0,s}toHex(){return Cr(this.toBytes())}clearCofactor(){return this.multiply(On(gd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Rn/2n,!1).double();return Rn%2n&&(t=t.add(this)),t.is0()}}const ft=new ke(za,Ha,1n,D(za*Ha)),Ct=new ke(0n,1n,1n,0n);ke.BASE=ft;ke.ZERO=Ct;const Lr=e=>Tr(Ar(at(e,0n,Qs),Ri)).reverse(),Mr=e=>On("0x"+Cr(Sr(Ye(e)).reverse())),Ie=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},$d=e=>{const n=e*e%ue*e%ue,s=Ie(n,2n)*n%ue,i=Ie(s,1n)*e%ue,a=Ie(i,5n)*i%ue,o=Ie(a,10n)*a%ue,l=Ie(o,20n)*o%ue,c=Ie(l,40n)*l%ue,u=Ie(c,80n)*c%ue,p=Ie(u,80n)*c%ue,g=Ie(p,10n)*a%ue;return{pow_p_5_8:Ie(g,2n)*e%ue,b2:n}},ja=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,wd=(e,t)=>{const n=D(t*t*t),s=D(n*n*t),i=$d(e*s).pow_p_5_8;let a=D(e*n*i);const o=D(t*a*a),l=a,c=D(a*ja),u=o===e,p=o===D(-e),g=o===D(-e*ja);return u&&(a=l),(p||g)&&(a=c),(D(a)&1n)===1n&&(a=D(-a)),{isValid:u||p,value:a}},Ys=e=>Er(Mr(e)),Pi=(...e)=>Rr.sha512Async(en(...e)),kd=(...e)=>xd("sha512")(en(...e)),Ir=e=>{const t=e.slice(0,pt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(pt,Ri),s=Ys(t),i=ft.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Di=e=>Pi(Ye(e,pt)).then(Ir),Sd=e=>Ir(kd(Ye(e,pt))),Ad=e=>Di(e).then(t=>t.pointBytes),Cd=e=>Pi(e.hashable).then(e.finish),Td=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Ys(t),o=ft.multiply(a).toBytes();return{hashable:en(o,s,n),finish:u=>{const p=Er(a+Ys(u)*i);return Ye(en(o,Lr(p)),Ri)}}},_d=async(e,t)=>{const n=Ye(e),s=await Di(t),i=await Pi(s.prefix,n);return Cd(Td(s,i,n))},Rr={sha512Async:async e=>{const t=md(),n=en(e);return es(await t.digest("SHA-512",n.buffer))},sha512:void 0},Ed=(e=bd(pt))=>e,Ld={getExtendedPublicKeyAsync:Di,getExtendedPublicKey:Sd,randomSecretKey:Ed},Bn=8,Md=256,Pr=Math.ceil(Md/Bn)+1,Zs=2**(Bn-1),Id=()=>{const e=[];let t=ft,n=t;for(let s=0;s<Pr;s++){n=t,e.push(n);for(let i=1;i<Zs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Wa;const qa=(e,t)=>{const n=t.negate();return e?n:t},Rd=e=>{const t=Wa||(Wa=Id());let n=Ct,s=ft;const i=2**Bn,a=i,o=On(i-1),l=On(Bn);for(let c=0;c<Pr;c++){let u=Number(e&o);e>>=l,u>Zs&&(u-=a,e+=1n);const p=c*Zs,g=p,h=p+Math.abs(u)-1,d=c%2!==0,f=u<0;u===0?s=s.add(qa(d,t[g])):n=n.add(qa(f,t[h]))}return e!==0n&&oe("invalid wnaf"),{p:n,f:s}},As="openclaw-device-identity-v1";function Js(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Dr(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Pd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Fr(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Pd(new Uint8Array(t))}async function Dd(){const e=Ld.randomSecretKey(),t=await Ad(e);return{deviceId:await Fr(t),publicKey:Js(t),privateKey:Js(e)}}async function Fi(){try{const n=localStorage.getItem(As);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 Fr(Dr(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(As,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Dd(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(As,JSON.stringify(t)),e}async function Fd(e,t){const n=Dr(e),s=new TextEncoder().encode(t),i=await _d(s,n);return Js(i)}async function Ze(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Nd(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Ze(e)}catch(n){e.devicesError=String(n)}}async function Od(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Ze(e)}catch(s){e.devicesError=String(s)}}async function Bd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Fi(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&$r({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Ze(e)}catch(n){e.devicesError=String(n)}}async function Ud(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await Fi();t.deviceId===s.deviceId&&wr({deviceId:s.deviceId,role:t.role}),await Ze(e)}catch(s){e.devicesError=String(s)}}function zd(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function Hd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Ni(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=zd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);Kd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Kd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=gt(t.file??{}))}async function jd(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 Ni(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function Wd(e,t,n){const s=gt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});rr(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function qd(e,t){const n=gt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});lr(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Oi(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function mt(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??Nn(e.sessionsFilterActive,0),a=t?.limit??Nn(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const l=await e.client.request("sessions.list",o);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Gd(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await mt(e)}catch(i){e.sessionsError=String(i)}}async function Vd(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
126
+ `],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function qc(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}async function Zn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Gc(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const Vc=2e3,Qc=new Set(["trace","debug","info","warn","error","fatal"]);function Yc(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function Zc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Qc.has(t)?t:null}function Jc(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=Zc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=Yc(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:s,level:i,subsystem:l,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ai(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(Jc),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-Vc),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}async function Jn(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function Xc(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Jn(e,{quiet:!0})},5e3))}function ed(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Ci(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ai(e,{quiet:!0})},2e3))}function Ti(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function _i(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Zn(e)},3e3))}function Ei(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function fr(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function hr(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function In(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Li(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const td=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,bn=/<\s*\/?\s*final\b[^<>]*>/gi,Oa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Ba(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(c=>a>=c.start&&o<=c.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Ua(e,t){return t.some(n=>e>=n.start&&e<n.end)}function nd(e,t){return e.trimStart()}function sd(e,t){if(!e||!td.test(e))return e;let n=e;if(bn.test(n)){bn.lastIndex=0;const l=[],c=Ba(n);for(const u of n.matchAll(bn)){const p=u.index??0;l.push({start:p,length:u[0].length,inCode:Ua(p,c)})}for(let u=l.length-1;u>=0;u--){const p=l[u];p.inCode||(n=n.slice(0,p.start)+n.slice(p.start+p.length))}}else bn.lastIndex=0;const s=Ba(n);Oa.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(Oa)){const c=l.index??0,u=l[1]==="/";Ua(c,s)||(o?u&&(o=!1):(i+=n.slice(a,c),u||(o=!0)),a=c+l[0].length)}return i+=n.slice(a),nd(i)}function Xt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function V(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e,n=Math.abs(t),s=t<0?"from now":"ago",i=Math.round(n/1e3);if(i<60)return t<0?"just now":`${i}s ago`;const a=Math.round(i/60);if(a<60)return`${a}m ${s}`;const o=Math.round(a/60);return o<48?`${o}h ${s}`:`${Math.round(o/24)}d ${s}`}function vr(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 Gs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Vs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function mr(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Nn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function $s(e){return sd(e)}async function on(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function Xn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function id(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",at:new Date(n).toISOString()}}if(e.scheduleKind==="every"){const n=Nn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function ad(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t},s=Nn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function od(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=id(e.cronForm),n=ad(e.cronForm),s=e.cronForm.sessionTarget==="isolated"&&e.cronForm.payloadKind==="agentTurn"&&e.cronForm.deliveryMode?{mode:e.cronForm.deliveryMode==="announce"?"announce":"none",channel:e.cronForm.deliveryChannel.trim()||"last",to:e.cronForm.deliveryTo.trim()||void 0}:void 0,i=e.cronForm.agentId.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,delivery:s};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Xn(e),await on(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function rd(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await Xn(e),await on(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function ld(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await br(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function cd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await Xn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function br(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}const yr="openclaw.device.auth.v1";function Mi(e){return e.trim()}function dd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].toSorted()}function Ii(){try{const e=window.localStorage.getItem(yr);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 xr(e){try{window.localStorage.setItem(yr,JSON.stringify(e))}catch{}}function ud(e){const t=Ii();if(!t||t.deviceId!==e.deviceId)return null;const n=Mi(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function $r(e){const t=Mi(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Ii();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:dd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,xr(n),i}function wr(e){const t=Ii();if(!t||t.deviceId!==e.deviceId)return;const n=Mi(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],xr(s)}const kr={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Rn,Gx:za,Gy:Ha,a:ws,d:ks,h:gd}=kr,ft=32,Ri=64,pd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},oe=(e="")=>{const t=new Error(e);throw pd(t,oe),t},fd=e=>typeof e=="bigint",hd=e=>typeof e=="string",vd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ze=(e,t,n="")=>{const s=vd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",c=s?`length=${i}`:`type=${typeof e}`;oe(o+"expected Uint8Array"+l+", got "+c)}return e},es=e=>new Uint8Array(e),Sr=e=>Uint8Array.from(e),Ar=(e,t)=>e.toString(16).padStart(t,"0"),Cr=e=>Array.from(Ze(e)).map(t=>Ar(t,2)).join(""),He={_0:48,_9:57,A:65,F:70,a:97,f:102},Ka=e=>{if(e>=He._0&&e<=He._9)return e-He._0;if(e>=He.A&&e<=He.F)return e-(He.A-10);if(e>=He.a&&e<=He.f)return e-(He.a-10)},Tr=e=>{const t="hex invalid";if(!hd(e))return oe(t);const n=e.length,s=n/2;if(n%2)return oe(t);const i=es(s);for(let a=0,o=0;a<s;a++,o+=2){const l=Ka(e.charCodeAt(o)),c=Ka(e.charCodeAt(o+1));if(l===void 0||c===void 0)return oe(t);i[a]=l*16+c}return i},_r=()=>globalThis?.crypto,md=()=>_r()?.subtle??oe("crypto.subtle must be defined, consider polyfill"),en=(...e)=>{const t=es(e.reduce((s,i)=>s+Ze(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},bd=(e=ft)=>_r().getRandomValues(es(e)),On=BigInt,ot=(e,t,n,s="bad number: out of range")=>fd(e)&&t<=e&&e<n?e:oe(s),D=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Er=e=>D(e,Rn),yd=(e,t)=>{(e===0n||t<=0n)&&oe("no inverse n="+e+" mod="+t);let n=D(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,c=i-a*o;s=n,n=l,i=a,a=c}return s===1n?D(i,t):oe("no inverse")},xd=e=>{const t=Rr[e];return typeof t!="function"&&oe("hashes."+e+" not set"),t},Ss=e=>e instanceof ke?e:oe("Point expected"),Qs=2n**256n;class ke{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Qs;this.X=ot(t,0n,a),this.Y=ot(n,0n,a),this.Z=ot(s,1n,a),this.T=ot(i,0n,a),Object.freeze(this)}static CURVE(){return kr}static fromAffine(t){return new ke(t.x,t.y,1n,D(t.x*t.y))}static fromBytes(t,n=!1){const s=ks,i=Sr(Ze(t,ft)),a=t[31];i[31]=a&-129;const o=Mr(i);ot(o,0n,n?Qs:ue);const c=D(o*o),u=D(c-1n),p=D(s*c+1n);let{isValid:g,value:h}=wd(u,p);g||oe("bad point: y not sqrt");const d=(h&1n)===1n,f=(a&128)!==0;return!n&&h===0n&&f&&oe("bad point: x==0, isLastByteOdd"),f!==d&&(h=D(-h)),new ke(h,o,1n,D(h*o))}static fromHex(t,n){return ke.fromBytes(Tr(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=ws,n=ks,s=this;if(s.is0())return oe("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,c=D(i*i),u=D(a*a),p=D(o*o),g=D(p*p),h=D(c*t),d=D(p*D(h+u)),f=D(g+D(n*D(c*u)));if(d!==f)return oe("bad point: equation left != right (1)");const m=D(i*a),k=D(o*l);return m!==k?oe("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=Ss(t),c=D(n*l),u=D(a*i),p=D(s*l),g=D(o*i);return c===u&&p===g}is0(){return this.equals(Ct)}negate(){return new ke(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=ws,a=D(t*t),o=D(n*n),l=D(2n*D(s*s)),c=D(i*a),u=t+n,p=D(D(u*u)-a-o),g=c+o,h=g-l,d=c-o,f=D(p*h),m=D(g*d),k=D(p*d),S=D(h*g);return new ke(f,m,S,k)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:c,T:u}=Ss(t),p=ws,g=ks,h=D(n*o),d=D(s*l),f=D(a*g*u),m=D(i*c),k=D((n+s)*(o+l)-h-d),S=D(m-f),w=D(m+f),C=D(d-p*h),A=D(k*S),_=D(w*C),T=D(k*C),I=D(S*w);return new ke(A,_,I,T)}subtract(t){return this.add(Ss(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Ct;if(ot(t,1n,Rn),t===1n)return this;if(this.equals(ht))return Rd(t).p;let s=Ct,i=ht;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(Ct))return{x:0n,y:1n};const i=yd(s,ue);D(s*i)!==1n&&oe("invalid inverse");const a=D(t*i),o=D(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Lr(n);return s[31]|=t&1n?128:0,s}toHex(){return Cr(this.toBytes())}clearCofactor(){return this.multiply(On(gd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Rn/2n,!1).double();return Rn%2n&&(t=t.add(this)),t.is0()}}const ht=new ke(za,Ha,1n,D(za*Ha)),Ct=new ke(0n,1n,1n,0n);ke.BASE=ht;ke.ZERO=Ct;const Lr=e=>Tr(Ar(ot(e,0n,Qs),Ri)).reverse(),Mr=e=>On("0x"+Cr(Sr(Ze(e)).reverse())),Ie=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},$d=e=>{const n=e*e%ue*e%ue,s=Ie(n,2n)*n%ue,i=Ie(s,1n)*e%ue,a=Ie(i,5n)*i%ue,o=Ie(a,10n)*a%ue,l=Ie(o,20n)*o%ue,c=Ie(l,40n)*l%ue,u=Ie(c,80n)*c%ue,p=Ie(u,80n)*c%ue,g=Ie(p,10n)*a%ue;return{pow_p_5_8:Ie(g,2n)*e%ue,b2:n}},ja=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,wd=(e,t)=>{const n=D(t*t*t),s=D(n*n*t),i=$d(e*s).pow_p_5_8;let a=D(e*n*i);const o=D(t*a*a),l=a,c=D(a*ja),u=o===e,p=o===D(-e),g=o===D(-e*ja);return u&&(a=l),(p||g)&&(a=c),(D(a)&1n)===1n&&(a=D(-a)),{isValid:u||p,value:a}},Ys=e=>Er(Mr(e)),Pi=(...e)=>Rr.sha512Async(en(...e)),kd=(...e)=>xd("sha512")(en(...e)),Ir=e=>{const t=e.slice(0,ft);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(ft,Ri),s=Ys(t),i=ht.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Di=e=>Pi(Ze(e,ft)).then(Ir),Sd=e=>Ir(kd(Ze(e,ft))),Ad=e=>Di(e).then(t=>t.pointBytes),Cd=e=>Pi(e.hashable).then(e.finish),Td=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Ys(t),o=ht.multiply(a).toBytes();return{hashable:en(o,s,n),finish:u=>{const p=Er(a+Ys(u)*i);return Ze(en(o,Lr(p)),Ri)}}},_d=async(e,t)=>{const n=Ze(e),s=await Di(t),i=await Pi(s.prefix,n);return Cd(Td(s,i,n))},Rr={sha512Async:async e=>{const t=md(),n=en(e);return es(await t.digest("SHA-512",n.buffer))},sha512:void 0},Ed=(e=bd(ft))=>e,Ld={getExtendedPublicKeyAsync:Di,getExtendedPublicKey:Sd,randomSecretKey:Ed},Bn=8,Md=256,Pr=Math.ceil(Md/Bn)+1,Zs=2**(Bn-1),Id=()=>{const e=[];let t=ht,n=t;for(let s=0;s<Pr;s++){n=t,e.push(n);for(let i=1;i<Zs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Wa;const qa=(e,t)=>{const n=t.negate();return e?n:t},Rd=e=>{const t=Wa||(Wa=Id());let n=Ct,s=ht;const i=2**Bn,a=i,o=On(i-1),l=On(Bn);for(let c=0;c<Pr;c++){let u=Number(e&o);e>>=l,u>Zs&&(u-=a,e+=1n);const p=c*Zs,g=p,h=p+Math.abs(u)-1,d=c%2!==0,f=u<0;u===0?s=s.add(qa(d,t[g])):n=n.add(qa(f,t[h]))}return e!==0n&&oe("invalid wnaf"),{p:n,f:s}},As="openclaw-device-identity-v1";function Js(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Dr(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Pd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Fr(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Pd(new Uint8Array(t))}async function Dd(){const e=Ld.randomSecretKey(),t=await Ad(e);return{deviceId:await Fr(t),publicKey:Js(t),privateKey:Js(e)}}async function Fi(){try{const n=localStorage.getItem(As);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 Fr(Dr(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(As,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Dd(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(As,JSON.stringify(t)),e}async function Fd(e,t){const n=Dr(e),s=new TextEncoder().encode(t),i=await _d(s,n);return Js(i)}async function Je(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Nd(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Je(e)}catch(n){e.devicesError=String(n)}}async function Od(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Je(e)}catch(s){e.devicesError=String(s)}}async function Bd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Fi(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&$r({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 Je(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 Fi();t.deviceId===s.deviceId&&wr({deviceId:s.deviceId,role:t.role}),await Je(e)}catch(s){e.devicesError=String(s)}}function zd(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function Hd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Ni(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=zd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);Kd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Kd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=pt(t.file??{}))}async function jd(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 Ni(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function Wd(e,t,n){const s=pt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});rr(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function qd(e,t){const n=pt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});lr(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Oi(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function mt(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??Nn(e.sessionsFilterActive,0),a=t?.limit??Nn(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const l=await e.client.request("sessions.list",o);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Gd(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await mt(e)}catch(i){e.sessionsError=String(i)}}async function Vd(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
127
127
 
128
- Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await mt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}function Lt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ts(e){return e instanceof Error?e.message:String(e)}async function rn(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=ts(n)}finally{e.skillsLoading=!1}}}function Qd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Yd(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await rn(e),Lt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ts(s);e.skillsError=i,Lt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Zd(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await rn(e),Lt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ts(n);e.skillsError=s,Lt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Jd(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await rn(e),Lt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=ts(i);e.skillsError=a,Lt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}const Xd=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"Agent",tabs:["agents","skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],Nr={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},Or=new Map(Object.entries(Nr).map(([e,t])=>[t,e]));function ln(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function tn(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function Bi(e,t=""){const n=ln(t),s=Nr[e];return n?`${n}${s}`:s}function Br(e,t=""){const n=ln(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=tn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Or.get(i)??null}function eu(e){let t=tn(e);if(t.endsWith("/index.html")&&(t=tn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(Or.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function tu(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function Xs(e){switch(e){case"agents":return"Agents";case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"usage":return"Usage";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function nu(e){switch(e){case"agents":return"Manage agent workspaces, tools, and identities.";case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"usage":return"";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.openclaw/openclaw.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const Ur="openclaw.control.settings.v1";function su(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(Ur);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function iu(e){localStorage.setItem(Ur,JSON.stringify(e))}const yn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,au=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,xn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ou=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,l=au();if(!!o.startViewTransition&&!l){let u=.5,p=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=yn(n.pointerClientX/window.innerWidth),p=yn(n.pointerClientY/window.innerHeight);else if(n?.element){const g=n.element.getBoundingClientRect();g.width>0&&g.height>0&&typeof window<"u"&&(u=yn((g.left+g.width/2)/window.innerWidth),p=yn((g.top+g.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${p*100}%`),a.classList.add("theme-transition");try{const g=o.startViewTransition?.(()=>{t()});g?.finished?g.finished.finally(()=>xn(a)):xn(a)}catch{xn(a),t()}return}t(),xn(a)};function ru(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ui(e){return e==="system"?ru():e}function ht(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,iu(n),t.theme!==e.theme&&(e.theme=t.theme,ns(e,Ui(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function zr(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&ht(e,{...e.settings,lastActiveSessionKey:n})}function lu(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&&(t.delete("token"),o=!0),s!=null){const c=s.trim();c&&(e.password=c),t.delete("password"),o=!0}if(i!=null){const c=i.trim();c&&(e.sessionKey=c,ht(e,{...e.settings,sessionKey:c,lastActiveSessionKey:c}))}if(a!=null){const c=a.trim();c&&c!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=c),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 cu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ci(e):Ti(e),t==="debug"?_i(e):Ei(e),zi(e),Kr(e,t,!1)}function du(e,t,n){ou({nextTheme:t,applyTheme:()=>{e.theme=t,ht(e,{...e.settings,theme:t}),ns(e,Ui(t))},context:n,currentTheme:e.theme})}async function zi(e){if(e.tab==="overview"&&await jr(e),e.tab==="channels"&&await bu(e),e.tab==="instances"&&await Oi(e),e.tab==="sessions"&&await mt(e),e.tab==="cron"&&await Un(e),e.tab==="skills"&&await rn(e),e.tab==="agents"){await Li(e),await Ee(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&hr(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(fr(e,n),e.agentsPanel==="skills"&&In(e,n),e.agentsPanel==="channels"&&ye(e,!1),e.agentsPanel==="cron"&&Un(e))}e.tab==="nodes"&&(await Jn(e),await Ze(e),await Ee(e),await Ni(e)),e.tab==="chat"&&(await Zr(e),an(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await cr(e),await Ee(e)),e.tab==="debug"&&(await Zn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Ai(e,{reset:!0}),pr(e,!0))}function uu(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ln(e):eu(window.location.pathname)}function gu(e){e.theme=e.settings.theme??"system",ns(e,Ui(e.theme))}function ns(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function pu(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&ns(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function fu(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function hu(e,t){if(typeof window>"u")return;const n=Br(window.location.pathname,e.basePath)??"chat";Hr(e,n),Kr(e,n,t)}function vu(e){if(typeof window>"u")return;const t=Br(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,ht(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Hr(e,t)}function Hr(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ci(e):Ti(e),t==="debug"?_i(e):Ei(e),e.connected&&zi(e)}function Kr(e,t,n){if(typeof window>"u")return;const s=tn(Bi(t,e.basePath)),i=tn(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function mu(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function jr(e){await Promise.all([ye(e,!1),Oi(e),mt(e),on(e),Zn(e)])}async function bu(e){await Promise.all([ye(e,!0),cr(e),Ee(e)])}async function Un(e){await Promise.all([ye(e,!1),on(e),Xn(e)])}const Ga=50,yu=80,xu=12e4;function $u(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
128
+ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await mt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}function Lt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ts(e){return e instanceof Error?e.message:String(e)}async function rn(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=ts(n)}finally{e.skillsLoading=!1}}}function Qd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Yd(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await rn(e),Lt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ts(s);e.skillsError=i,Lt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Zd(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await rn(e),Lt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ts(n);e.skillsError=s,Lt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Jd(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await rn(e),Lt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=ts(i);e.skillsError=a,Lt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}const Xd=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"Agent",tabs:["agents","skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],Nr={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},Or=new Map(Object.entries(Nr).map(([e,t])=>[t,e]));function ln(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function tn(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function Bi(e,t=""){const n=ln(t),s=Nr[e];return n?`${n}${s}`:s}function Br(e,t=""){const n=ln(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=tn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Or.get(i)??null}function eu(e){let t=tn(e);if(t.endsWith("/index.html")&&(t=tn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(Or.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function tu(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function Xs(e){switch(e){case"agents":return"Agents";case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"usage":return"Usage";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function nu(e){switch(e){case"agents":return"Manage agent workspaces, tools, and identities.";case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"usage":return"";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.openclaw/openclaw.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const Ur="openclaw.control.settings.v1";function su(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(Ur);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function iu(e){localStorage.setItem(Ur,JSON.stringify(e))}const yn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,au=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,xn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ou=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,l=au();if(!!o.startViewTransition&&!l){let u=.5,p=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=yn(n.pointerClientX/window.innerWidth),p=yn(n.pointerClientY/window.innerHeight);else if(n?.element){const g=n.element.getBoundingClientRect();g.width>0&&g.height>0&&typeof window<"u"&&(u=yn((g.left+g.width/2)/window.innerWidth),p=yn((g.top+g.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${p*100}%`),a.classList.add("theme-transition");try{const g=o.startViewTransition?.(()=>{t()});g?.finished?g.finished.finally(()=>xn(a)):xn(a)}catch{xn(a),t()}return}t(),xn(a)};function ru(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ui(e){return e==="system"?ru():e}function je(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,iu(n),t.theme!==e.theme&&(e.theme=t.theme,ns(e,Ui(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function zr(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&je(e,{...e.settings,lastActiveSessionKey:n})}function lu(e){const t=window.__OPENCLAW_GATEWAY_TOKEN__;if(typeof t=="string"){const u=t.trim();u&&je(e,{...e.settings,token:u}),delete window.__OPENCLAW_GATEWAY_TOKEN__}if(!window.location.search)return;const n=new URLSearchParams(window.location.search),s=n.get("token"),i=n.get("password"),a=n.get("session"),o=n.get("gatewayUrl");let l=!1;if(s!=null){const u=s.trim();u&&je(e,{...e.settings,token:u}),n.delete("token"),l=!0}if(i!=null){const u=i.trim();u&&(e.password=u),n.delete("password"),l=!0}if(a!=null){const u=a.trim();u&&(e.sessionKey=u,je(e,{...e.settings,sessionKey:u,lastActiveSessionKey:u}))}if(o!=null){const u=o.trim();u&&u!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=u),n.delete("gatewayUrl"),l=!0}if(!l)return;const c=new URL(window.location.href);c.search=n.toString(),window.history.replaceState({},"",c.toString())}function cu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ci(e):Ti(e),t==="debug"?_i(e):Ei(e),zi(e),Kr(e,t,!1)}function du(e,t,n){ou({nextTheme:t,applyTheme:()=>{e.theme=t,je(e,{...e.settings,theme:t}),ns(e,Ui(t))},context:n,currentTheme:e.theme})}async function zi(e){if(e.tab==="overview"&&await jr(e),e.tab==="channels"&&await bu(e),e.tab==="instances"&&await Oi(e),e.tab==="sessions"&&await mt(e),e.tab==="cron"&&await Un(e),e.tab==="skills"&&await rn(e),e.tab==="agents"){await Li(e),await Ee(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&hr(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(fr(e,n),e.agentsPanel==="skills"&&In(e,n),e.agentsPanel==="channels"&&ye(e,!1),e.agentsPanel==="cron"&&Un(e))}e.tab==="nodes"&&(await Jn(e),await Je(e),await Ee(e),await Ni(e)),e.tab==="chat"&&(await Zr(e),an(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await cr(e),await Ee(e)),e.tab==="debug"&&(await Zn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Ai(e,{reset:!0}),pr(e,!0))}function uu(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ln(e):eu(window.location.pathname)}function gu(e){e.theme=e.settings.theme??"system",ns(e,Ui(e.theme))}function ns(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function pu(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&ns(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function fu(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function hu(e,t){if(typeof window>"u")return;const n=Br(window.location.pathname,e.basePath)??"chat";Hr(e,n),Kr(e,n,t)}function vu(e){if(typeof window>"u")return;const t=Br(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,je(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Hr(e,t)}function Hr(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ci(e):Ti(e),t==="debug"?_i(e):Ei(e),e.connected&&zi(e)}function Kr(e,t,n){if(typeof window>"u")return;const s=tn(Bi(t,e.basePath)),i=tn(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function mu(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function jr(e){await Promise.all([ye(e,!1),Oi(e),mt(e),on(e),Zn(e)])}async function bu(e){await Promise.all([ye(e,!0),cr(e),Ee(e)])}async function Un(e){await Promise.all([ye(e,!1),on(e),Xn(e)])}const Ga=50,yu=80,xu=12e4;function $u(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
129
129
  `)}function Va(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=$u(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=mr(n,xu);return s.truncated?`${s.text}
130
130
 
131
131
  … truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function wu(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 ku(e){if(e.toolStreamOrder.length<=Ga)return;const t=e.toolStreamOrder.length-Ga,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function Su(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function ei(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Su(e)}function Au(e,t=!1){if(t){ei(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>ei(e),yu))}function ss(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],ei(e)}const Cu=5e3;function Tu(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},Cu))}function _u(e,t){if(!t)return;if(t.stream==="compaction"){Tu(e,t);return}if(t.stream!=="tool")return;const n=typeof t.sessionKey=="string"?t.sessionKey:void 0;if(n&&n!==e.sessionKey||!n&&e.chatRunId&&t.runId!==e.chatRunId||e.chatRunId&&t.runId!==e.chatRunId||!e.chatRunId)return;const s=t.data??{},i=typeof s.toolCallId=="string"?s.toolCallId:"";if(!i)return;const a=typeof s.name=="string"?s.name:"tool",o=typeof s.phase=="string"?s.phase:"",l=o==="start"?s.args:void 0,c=o==="update"?Va(s.partialResult):o==="result"?Va(s.result):void 0,u=Date.now();let p=e.toolStreamById.get(i);p?(p.name=a,l!==void 0&&(p.args=l),c!==void 0&&(p.output=c||void 0),p.updatedAt=u):(p={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:l,output:c||void 0,startedAt:typeof t.ts=="number"?t.ts:u,updatedAt:u,message:{}},e.toolStreamById.set(i,p),e.toolStreamOrder.push(i)),p.message=wu(p),ku(e),Au(e,o==="result")}const Eu=/^\[([^\]]+)\]\s*/,Lu=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Cs=new WeakMap,Ts=new WeakMap;function Mu(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:Lu.some(t=>e.startsWith(`${t} `))}function _s(e){const t=e.match(Eu);if(!t)return e;const n=t[1]??"";return Mu(n)?e.slice(t[0].length):e}function ti(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?$s(s):_s(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(`
@@ -133,7 +133,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
133
133
  `);const i=Ru(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(l=>(l[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
134
134
  `):null}function Iu(e){if(!e||typeof e!="object")return Qa(e);const t=e;if(Ts.has(t))return Ts.get(t)??null;const n=Qa(e);return Ts.set(t,n),n}function Ru(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
135
135
  `)}return typeof t.text=="string"?t.text:null}function Pu(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean).map(s=>`_${s}_`);return n.length?["_Reasoning:_",...n].join(`
136
- `):""}let Ya=!1;function Za(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Du(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function Fu(){Ya||(Ya=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Hi(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),Za(t)}return Fu(),Za(Du())}async function nn(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Nu(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Ou(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const l=Hi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=a;const c=i?n.map(u=>{const p=Nu(u.dataUrl);return p?{type:"image",mimeType:p.mimeType,content:p.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:c}),l}catch(u){const p=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=p,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+p}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Bu(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Uu(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=ti(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const qr=120;function Gr(e){return e.chatSending||!!e.chatRunId}function zu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function Hu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function Vr(e){e.connected&&(e.chatMessage="",await Bu(e))}function Ku(e,t,n,s){const i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Hi(),text:i,createdAt:Date.now(),attachments:a?n?.map(o=>({...o})):void 0,refreshSessions:s}])}async function Qr(e,t,n){ss(e);const s=await Ou(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&zr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),an(e),i&&!e.chatRunId&&Yr(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function Yr(e){if(!e.connected||Gr(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Qr(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function ju(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wu(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!i&&!l)return;if(zu(i)){await Vr(e);return}const c=Hu(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Gr(e)){Ku(e,i,o,c);return}await Qr(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})}async function Zr(e){await Promise.all([nn(e),mt(e,{activeMinutes:qr}),ni(e)]),an(e)}const qu=Yr;function Gu(e){const t=gr(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vu(e,t){const n=ln(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function ni(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gu(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vu(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const Qu={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Yu={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"isolated",wakeMode:"next-heartbeat",payloadKind:"agentTurn",payloadText:"",deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",timeoutSeconds:""},Zu=50,Ju=200,Xu="Assistant";function Ja(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function si(e){const t=Ja(e?.name,Zu)??Xu,n=Ja(e?.avatar??void 0,Ju)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function eg(){return si(typeof window>"u"?{}:{name:window.__OPENCLAW_ASSISTANT_NAME__,avatar:window.__OPENCLAW_ASSISTANT_AVATAR__})}async function Jr(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=si(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ii(e){return typeof e=="object"&&e!==null}function tg(e){if(!ii(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!ii(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function ng(e){if(!ii(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 Xr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function sg(e,t){const n=Xr(e).filter(s=>s.id!==t.id);return n.push(t),n}function Xa(e,t){return Xr(e).filter(n=>n.id!==t)}function ig(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const el={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},eo=el,ai={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(el));new Set(Object.values(ai));const ag=4008;class og{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()}),this.ws.addEventListener("error",()=>{}))}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await Fi();const p=ud({deviceId:i.deviceId,role:s})?.token;o=p??this.opts.token,a=!!(p&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let c;if(t&&i){const p=Date.now(),g=this.connectNonce??void 0,h=ig({deviceId:i.deviceId,clientId:this.opts.clientName??eo.CONTROL_UI,clientMode:this.opts.mode??ai.WEBCHAT,role:s,scopes:n,signedAtMs:p,token:o??null,nonce:g}),d=await Fd(i.privateKey,h);c={id:i.deviceId,publicKey:i.publicKey,signature:d,signedAt:p,nonce:g}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??eo.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??ai.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(p=>{p?.auth?.deviceToken&&i&&$r({deviceId:i.deviceId,role:p.auth.role??s,token:p.auth.deviceToken,scopes:p.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(p)}).catch(()=>{a&&i&&wr({deviceId:i.deviceId,role:s}),this.ws?.close(ag,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Hi(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:c=>o(c),reject:l})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Es(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function rg(e,t){if(!t?.mainSessionKey)return;const n=Es(e.sessionKey,t),s=Es(e.settings.sessionKey,t),i=Es(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&&ht(e,o)}function tl(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new og({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,dg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,ss(e),Jr(e),Li(e),Jn(e,{quiet:!0}),Ze(e,{quiet:!0}),zi(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>lg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function lg(e,t){try{cg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function cg(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;_u(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&zr(e,n.sessionKey);const s=Uu(e,n);if(s==="final"||s==="error"||s==="aborted"){ss(e),qu(e);const i=n?.runId;i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),s==="final"&&mt(e,{activeMinutes:qr}))}s==="final"&&nn(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&Un(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Ze(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=tg(t.payload);if(n){e.execApprovalQueue=sg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Xa(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=ng(t.payload);n&&(e.execApprovalQueue=Xa(e.execApprovalQueue,n.id))}}function dg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&rg(e,n.sessionDefaults)}function ug(e){e.basePath=uu(),lu(e),hu(e,!0),gu(e),pu(e),window.addEventListener("popstate",e.popStateHandler),tl(e),Xc(e),e.tab==="logs"&&Ci(e),e.tab==="debug"&&_i(e)}function gg(e){qc(e)}function pg(e){window.removeEventListener("popstate",e.popStateHandler),ed(e),Ti(e),Ei(e),fu(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function fg(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;an(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&pr(e,t.has("tab")||t.has("logsAutoFollow"))}const Ki={CHILD:2},ji=e=>(...t)=>({_$litDirective$:e,values:t});let Wi=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:hg}=hc,to=e=>e,vg=e=>e.strings===void 0,no=()=>document.createComment(""),Dt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(no(),i),o=s.insertBefore(no(),i);n=new hg(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let c;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==o._$AU&&n._$AP(c)}if(a!==i||l){let c=n._$AA;for(;c!==a;){const u=to(c).nextSibling;to(s).insertBefore(c,i),c=u}}}return n},nt=(e,t,n=e)=>(e._$AI(t,n),e),mg={},bg=(e,t=mg)=>e._$AH=t,yg=e=>e._$AH,Ls=e=>{e._$AR(),e._$AA.remove()};const so=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},nl=ji(class extends Wi{constructor(e){if(super(e),e.type!==Ki.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const l of e)i[o]=s?s(l,o):o,a[o]=n(l,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=yg(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],c=[];let u,p,g=0,h=i.length-1,d=0,f=a.length-1;for(;g<=h&&d<=f;)if(i[g]===null)g++;else if(i[h]===null)h--;else if(l[g]===o[d])c[d]=nt(i[g],a[d]),g++,d++;else if(l[h]===o[f])c[f]=nt(i[h],a[f]),h--,f--;else if(l[g]===o[f])c[f]=nt(i[g],a[f]),Dt(e,c[f+1],i[g]),g++,f--;else if(l[h]===o[d])c[d]=nt(i[h],a[d]),Dt(e,i[g],i[h]),h--,d++;else if(u===void 0&&(u=so(o,d,f),p=so(l,g,h)),u.has(l[g]))if(u.has(l[h])){const m=p.get(o[d]),k=m!==void 0?i[m]:null;if(k===null){const S=Dt(e,i[g]);nt(S,a[d]),c[d]=S}else c[d]=nt(k,a[d]),Dt(e,i[g],k),i[m]=null;d++}else Ls(i[h]),h--;else Ls(i[g]),g++;for(;d<=f;){const m=Dt(e,c[f+1]);nt(m,a[d]),c[d++]=m}for(;g<=h;){const m=i[g++];m!==null&&Ls(m)}return this.ut=o,bg(e,c),Qe}}),le={messageSquare:r`
136
+ `):""}let Ya=!1;function Za(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Du(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function Fu(){Ya||(Ya=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Hi(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),Za(t)}return Fu(),Za(Du())}async function nn(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Nu(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Ou(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const l=Hi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=a;const c=i?n.map(u=>{const p=Nu(u.dataUrl);return p?{type:"image",mimeType:p.mimeType,content:p.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:c}),l}catch(u){const p=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=p,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+p}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Bu(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Uu(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=ti(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const qr=120;function Gr(e){return e.chatSending||!!e.chatRunId}function zu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function Hu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function Vr(e){e.connected&&(e.chatMessage="",await Bu(e))}function Ku(e,t,n,s){const i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Hi(),text:i,createdAt:Date.now(),attachments:a?n?.map(o=>({...o})):void 0,refreshSessions:s}])}async function Qr(e,t,n){ss(e);const s=await Ou(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&zr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),an(e),i&&!e.chatRunId&&Yr(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function Yr(e){if(!e.connected||Gr(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Qr(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function ju(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wu(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!i&&!l)return;if(zu(i)){await Vr(e);return}const c=Hu(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Gr(e)){Ku(e,i,o,c);return}await Qr(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})}async function Zr(e){await Promise.all([nn(e),mt(e,{activeMinutes:qr}),ni(e)]),an(e)}const qu=Yr;function Gu(e){const t=gr(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vu(e,t){const n=ln(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function ni(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gu(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vu(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const Qu={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Yu={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"isolated",wakeMode:"next-heartbeat",payloadKind:"agentTurn",payloadText:"",deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",timeoutSeconds:""},Zu=50,Ju=200,Xu="Assistant";function Ja(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function si(e){const t=Ja(e?.name,Zu)??Xu,n=Ja(e?.avatar??void 0,Ju)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function eg(){return si(typeof window>"u"?{}:{name:window.__OPENCLAW_ASSISTANT_NAME__,avatar:window.__OPENCLAW_ASSISTANT_AVATAR__})}async function Jr(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=si(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ii(e){return typeof e=="object"&&e!==null}function tg(e){if(!ii(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!ii(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function ng(e){if(!ii(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 Xr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function sg(e,t){const n=Xr(e).filter(s=>s.id!==t.id);return n.push(t),n}function Xa(e,t){return Xr(e).filter(n=>n.id!==t)}function ig(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const el={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},eo=el,ai={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(el));new Set(Object.values(ai));const ag=4008;class og{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()}),this.ws.addEventListener("error",()=>{}))}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await Fi();const p=ud({deviceId:i.deviceId,role:s})?.token;o=p??this.opts.token,a=!!(p&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let c;if(t&&i){const p=Date.now(),g=this.connectNonce??void 0,h=ig({deviceId:i.deviceId,clientId:this.opts.clientName??eo.CONTROL_UI,clientMode:this.opts.mode??ai.WEBCHAT,role:s,scopes:n,signedAtMs:p,token:o??null,nonce:g}),d=await Fd(i.privateKey,h);c={id:i.deviceId,publicKey:i.publicKey,signature:d,signedAt:p,nonce:g}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??eo.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??ai.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(p=>{p?.auth?.deviceToken&&i&&$r({deviceId:i.deviceId,role:p.auth.role??s,token:p.auth.deviceToken,scopes:p.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(p)}).catch(()=>{a&&i&&wr({deviceId:i.deviceId,role:s}),this.ws?.close(ag,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Hi(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:c=>o(c),reject:l})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Es(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function rg(e,t){if(!t?.mainSessionKey)return;const n=Es(e.sessionKey,t),s=Es(e.settings.sessionKey,t),i=Es(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},l=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),l&&je(e,o)}function tl(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new og({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,dg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,ss(e),Jr(e),Li(e),Jn(e,{quiet:!0}),Je(e,{quiet:!0}),zi(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>lg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function lg(e,t){try{cg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function cg(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;_u(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&zr(e,n.sessionKey);const s=Uu(e,n);if(s==="final"||s==="error"||s==="aborted"){ss(e),qu(e);const i=n?.runId;i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),s==="final"&&mt(e,{activeMinutes:qr}))}s==="final"&&nn(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&Un(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Je(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=tg(t.payload);if(n){e.execApprovalQueue=sg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Xa(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=ng(t.payload);n&&(e.execApprovalQueue=Xa(e.execApprovalQueue,n.id))}}function dg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&rg(e,n.sessionDefaults)}function ug(e){e.basePath=uu(),lu(e),hu(e,!0),gu(e),pu(e),window.addEventListener("popstate",e.popStateHandler),tl(e),Xc(e),e.tab==="logs"&&Ci(e),e.tab==="debug"&&_i(e)}function gg(e){qc(e)}function pg(e){window.removeEventListener("popstate",e.popStateHandler),ed(e),Ti(e),Ei(e),fu(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function fg(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;an(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&pr(e,t.has("tab")||t.has("logsAutoFollow"))}const Ki={CHILD:2},ji=e=>(...t)=>({_$litDirective$:e,values:t});let Wi=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:hg}=hc,to=e=>e,vg=e=>e.strings===void 0,no=()=>document.createComment(""),Dt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(no(),i),o=s.insertBefore(no(),i);n=new hg(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let c;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==o._$AU&&n._$AP(c)}if(a!==i||l){let c=n._$AA;for(;c!==a;){const u=to(c).nextSibling;to(s).insertBefore(c,i),c=u}}}return n},st=(e,t,n=e)=>(e._$AI(t,n),e),mg={},bg=(e,t=mg)=>e._$AH=t,yg=e=>e._$AH,Ls=e=>{e._$AR(),e._$AA.remove()};const so=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},nl=ji(class extends Wi{constructor(e){if(super(e),e.type!==Ki.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const l of e)i[o]=s?s(l,o):o,a[o]=n(l,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=yg(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],c=[];let u,p,g=0,h=i.length-1,d=0,f=a.length-1;for(;g<=h&&d<=f;)if(i[g]===null)g++;else if(i[h]===null)h--;else if(l[g]===o[d])c[d]=st(i[g],a[d]),g++,d++;else if(l[h]===o[f])c[f]=st(i[h],a[f]),h--,f--;else if(l[g]===o[f])c[f]=st(i[g],a[f]),Dt(e,c[f+1],i[g]),g++,f--;else if(l[h]===o[d])c[d]=st(i[h],a[d]),Dt(e,i[g],i[h]),h--,d++;else if(u===void 0&&(u=so(o,d,f),p=so(l,g,h)),u.has(l[g]))if(u.has(l[h])){const m=p.get(o[d]),k=m!==void 0?i[m]:null;if(k===null){const S=Dt(e,i[g]);st(S,a[d]),c[d]=S}else c[d]=st(k,a[d]),Dt(e,i[g],k),i[m]=null;d++}else Ls(i[h]),h--;else Ls(i[g]),g++;for(;d<=f;){const m=Dt(e,c[f+1]);st(m,a[d]),c[d++]=m}for(;g<=h;){const m=i[g++];m!==null&&Ls(m)}return this.ut=o,bg(e,c),Ye}}),le={messageSquare:r`
137
137
  <svg viewBox="0 0 24 24">
138
138
  <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
139
139
  </svg>
@@ -1080,7 +1080,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1080
1080
  </label>
1081
1081
  </div>
1082
1082
  </div>
1083
- `}function De(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function ul(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(De(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function os(e){return e.filter(t=>typeof t=="string").join(".")}function Se(e,t){const n=os(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const l=a.split(".");if(l.length!==i.length)continue;let c=!0;for(let u=0;u<i.length;u+=1)if(l[u]!=="*"&&l[u]!==i[u]){c=!1;break}if(c)return o}}function We(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function mp(e){const t=os(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}const bp=new Set(["title","description","default","nullable"]);function yp(e){return Object.keys(e??{}).filter(n=>!bp.has(n)).length===0}function xp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const sn={chevronDown:r`
1083
+ `}function De(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function ul(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(De(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function os(e){return e.filter(t=>typeof t=="string").join(".")}function Se(e,t){const n=os(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const l=a.split(".");if(l.length!==i.length)continue;let c=!0;for(let u=0;u<i.length;u+=1)if(l[u]!=="*"&&l[u]!==i[u]){c=!1;break}if(c)return o}}function qe(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function mp(e){const t=os(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}const bp=new Set(["title","description","default","nullable"]);function yp(e){return Object.keys(e??{}).filter(n=>!bp.has(n)).length===0}function xp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const sn={chevronDown:r`
1084
1084
  <svg
1085
1085
  viewBox="0 0 24 24"
1086
1086
  fill="none"
@@ -1138,10 +1138,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1138
1138
  <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
1139
1139
  <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
1140
1140
  </svg>
1141
- `};function je(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=De(t),p=Se(s,i),g=p?.label??t.title??We(String(s.at(-1))),h=p?.help??t.description,d=os(s);if(a.has(d))return r`<div class="cfg-field cfg-field--error">
1141
+ `};function We(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=De(t),p=Se(s,i),g=p?.label??t.title??qe(String(s.at(-1))),h=p?.help??t.description,d=os(s);if(a.has(d))return r`<div class="cfg-field cfg-field--error">
1142
1142
  <div class="cfg-field__label">${g}</div>
1143
1143
  <div class="cfg-field__error">Unsupported schema node. Use Raw mode.</div>
1144
- </div>`;if(t.anyOf||t.oneOf){const m=(t.anyOf??t.oneOf??[]).filter(_=>!(_.type==="null"||Array.isArray(_.type)&&_.type.includes("null")));if(m.length===1)return je({...e,schema:m[0]});const k=_=>{if(_.const!==void 0)return _.const;if(_.enum&&_.enum.length===1)return _.enum[0]},S=m.map(k),w=S.every(_=>_!==void 0);if(w&&S.length>0&&S.length<=5){const _=n??t.default;return r`
1144
+ </div>`;if(t.anyOf||t.oneOf){const m=(t.anyOf??t.oneOf??[]).filter(_=>!(_.type==="null"||Array.isArray(_.type)&&_.type.includes("null")));if(m.length===1)return We({...e,schema:m[0]});const k=_=>{if(_.const!==void 0)return _.const;if(_.enum&&_.enum.length===1)return _.enum[0]},S=m.map(k),w=S.every(_=>_!==void 0);if(w&&S.length>0&&S.length<=5){const _=n??t.default;return r`
1145
1145
  <div class="cfg-field">
1146
1146
  ${c?r`<label class="cfg-field__label">${g}</label>`:v}
1147
1147
  ${h?r`<div class="cfg-field__help">${h}</div>`:v}
@@ -1158,7 +1158,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1158
1158
  `)}
1159
1159
  </div>
1160
1160
  </div>
1161
- `}if(w&&S.length>5)return co({...e,options:S,value:n??t.default});const C=new Set(m.map(_=>De(_)).filter(Boolean)),A=new Set([...C].map(_=>_==="integer"?"number":_));if([...A].every(_=>["string","number","boolean"].includes(_))){const _=A.has("string"),T=A.has("number");if(A.has("boolean")&&A.size===1)return je({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(_||T)return lo({...e,inputType:T&&!_?"number":"text"})}}if(t.enum){const f=t.enum;if(f.length<=5){const m=n??t.default;return r`
1161
+ `}if(w&&S.length>5)return co({...e,options:S,value:n??t.default});const C=new Set(m.map(_=>De(_)).filter(Boolean)),A=new Set([...C].map(_=>_==="integer"?"number":_));if([...A].every(_=>["string","number","boolean"].includes(_))){const _=A.has("string"),T=A.has("number");if(A.has("boolean")&&A.size===1)return We({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(_||T)return lo({...e,inputType:T&&!_?"number":"text"})}}if(t.enum){const f=t.enum;if(f.length<=5){const m=n??t.default;return r`
1162
1162
  <div class="cfg-field">
1163
1163
  ${c?r`<label class="cfg-field__label">${g}</label>`:v}
1164
1164
  ${h?r`<div class="cfg-field__help">${h}</div>`:v}
@@ -1196,7 +1196,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1196
1196
  <div class="cfg-field__label">${g}</div>
1197
1197
  <div class="cfg-field__error">Unsupported type: ${u}. Use Raw mode.</div>
1198
1198
  </div>
1199
- `}function lo(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??We(String(s.at(-1))),g=u?.help??t.description,h=u?.sensitive??mp(s),d=u?.placeholder??(h?"••••":t.default!==void 0?`Default: ${String(t.default)}`:""),f=n??"";return r`
1199
+ `}function lo(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??qe(String(s.at(-1))),g=u?.help??t.description,h=u?.sensitive??mp(s),d=u?.placeholder??(h?"••••":t.default!==void 0?`Default: ${String(t.default)}`:""),f=n??"";return r`
1200
1200
  <div class="cfg-field">
1201
1201
  ${c?r`<label class="cfg-field__label">${p}</label>`:v}
1202
1202
  ${g?r`<div class="cfg-field__help">${g}</div>`:v}
@@ -1221,7 +1221,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1221
1221
  `:v}
1222
1222
  </div>
1223
1223
  </div>
1224
- `}function $p(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,l=e.showLabel??!0,c=Se(s,i),u=c?.label??t.title??We(String(s.at(-1))),p=c?.help??t.description,g=n??t.default??"",h=typeof g=="number"?g:0;return r`
1224
+ `}function $p(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,l=e.showLabel??!0,c=Se(s,i),u=c?.label??t.title??qe(String(s.at(-1))),p=c?.help??t.description,g=n??t.default??"",h=typeof g=="number"?g:0;return r`
1225
1225
  <div class="cfg-field">
1226
1226
  ${l?r`<label class="cfg-field__label">${u}</label>`:v}
1227
1227
  ${p?r`<div class="cfg-field__help">${p}</div>`:v}
@@ -1247,7 +1247,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1247
1247
  >+</button>
1248
1248
  </div>
1249
1249
  </div>
1250
- `}function co(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??We(String(s.at(-1))),g=u?.help??t.description,h=n??t.default,d=o.findIndex(m=>m===h||String(m)===String(h)),f="__unset__";return r`
1250
+ `}function co(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??qe(String(s.at(-1))),g=u?.help??t.description,h=n??t.default,d=o.findIndex(m=>m===h||String(m)===String(h)),f="__unset__";return r`
1251
1251
  <div class="cfg-field">
1252
1252
  ${c?r`<label class="cfg-field__label">${p}</label>`:v}
1253
1253
  ${g?r`<div class="cfg-field__help">${g}</div>`:v}
@@ -1263,9 +1263,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1263
1263
  `)}
1264
1264
  </select>
1265
1265
  </div>
1266
- `}function wp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=Se(s,i),u=c?.label??t.title??We(String(s.at(-1))),p=c?.help??t.description,g=n??t.default,h=g&&typeof g=="object"&&!Array.isArray(g)?g:{},d=t.properties??{},m=Object.entries(d).toSorted((C,A)=>{const _=Se([...s,C[0]],i)?.order??0,T=Se([...s,A[0]],i)?.order??0;return _!==T?_-T:C[0].localeCompare(A[0])}),k=new Set(Object.keys(d)),S=t.additionalProperties,w=!!S&&typeof S=="object";return s.length===1?r`
1266
+ `}function wp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=Se(s,i),u=c?.label??t.title??qe(String(s.at(-1))),p=c?.help??t.description,g=n??t.default,h=g&&typeof g=="object"&&!Array.isArray(g)?g:{},d=t.properties??{},m=Object.entries(d).toSorted((C,A)=>{const _=Se([...s,C[0]],i)?.order??0,T=Se([...s,A[0]],i)?.order??0;return _!==T?_-T:C[0].localeCompare(A[0])}),k=new Set(Object.keys(d)),S=t.additionalProperties,w=!!S&&typeof S=="object";return s.length===1?r`
1267
1267
  <div class="cfg-fields">
1268
- ${m.map(([C,A])=>je({schema:A,value:h[C],path:[...s,C],hints:i,unsupported:a,disabled:o,onPatch:l}))}
1268
+ ${m.map(([C,A])=>We({schema:A,value:h[C],path:[...s,C],hints:i,unsupported:a,disabled:o,onPatch:l}))}
1269
1269
  ${w?uo({schema:S,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:k,onPatch:l}):v}
1270
1270
  </div>
1271
1271
  `:r`
@@ -1276,11 +1276,11 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1276
1276
  </summary>
1277
1277
  ${p?r`<div class="cfg-object__help">${p}</div>`:v}
1278
1278
  <div class="cfg-object__content">
1279
- ${m.map(([C,A])=>je({schema:A,value:h[C],path:[...s,C],hints:i,unsupported:a,disabled:o,onPatch:l}))}
1279
+ ${m.map(([C,A])=>We({schema:A,value:h[C],path:[...s,C],hints:i,unsupported:a,disabled:o,onPatch:l}))}
1280
1280
  ${w?uo({schema:S,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:k,onPatch:l}):v}
1281
1281
  </div>
1282
1282
  </details>
1283
- `}function kp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??We(String(s.at(-1))),g=u?.help??t.description,h=Array.isArray(t.items)?t.items[0]:t.items;if(!h)return r`
1283
+ `}function kp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??qe(String(s.at(-1))),g=u?.help??t.description,h=Array.isArray(t.items)?t.items[0]:t.items;if(!h)return r`
1284
1284
  <div class="cfg-field cfg-field--error">
1285
1285
  <div class="cfg-field__label">${p}</div>
1286
1286
  <div class="cfg-field__error">Unsupported array schema. Use Raw mode.</div>
@@ -1321,7 +1321,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1321
1321
  </button>
1322
1322
  </div>
1323
1323
  <div class="cfg-array__item-content">
1324
- ${je({schema:h,value:f,path:[...s,m],hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:l})}
1324
+ ${We({schema:h,value:f,path:[...s,m],hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:l})}
1325
1325
  </div>
1326
1326
  </div>
1327
1327
  `)}
@@ -1369,7 +1369,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1369
1369
  ?disabled=${o}
1370
1370
  @change=${m=>{const k=m.target,S=k.value.trim();if(!S){c(d,void 0);return}try{c(d,JSON.parse(S))}catch{k.value=f}}}
1371
1371
  ></textarea>
1372
- `:je({schema:t,value:h,path:d,hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:c})}
1372
+ `:We({schema:t,value:h,path:d,hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:c})}
1373
1373
  </div>
1374
1374
  <button
1375
1375
  type="button"
@@ -1585,7 +1585,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1585
1585
  </div>
1586
1586
  `:r`
1587
1587
  <div class="config-form config-form--modern">
1588
- ${p?(()=>{const{sectionKey:g,subsectionKey:h,schema:d}=p,f=Se([g,h],e.uiHints),m=f?.label??d.title??We(h),k=f?.help??d.description??"",S=n[g],w=S&&typeof S=="object"?S[h]:void 0,C=`config-section-${g}-${h}`;return r`
1588
+ ${p?(()=>{const{sectionKey:g,subsectionKey:h,schema:d}=p,f=Se([g,h],e.uiHints),m=f?.label??d.title??qe(h),k=f?.help??d.description??"",S=n[g],w=S&&typeof S=="object"?S[h]:void 0,C=`config-section-${g}-${h}`;return r`
1589
1589
  <section class="config-section-card" id=${C}>
1590
1590
  <div class="config-section-card__header">
1591
1591
  <span class="config-section-card__icon">${po(g)}</span>
@@ -1595,7 +1595,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1595
1595
  </div>
1596
1596
  </div>
1597
1597
  <div class="config-section-card__content">
1598
- ${je({schema:d,value:w,path:[g,h],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
1598
+ ${We({schema:d,value:w,path:[g,h],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
1599
1599
  </div>
1600
1600
  </section>
1601
1601
  `})():u.map(([g,h])=>{const d=Gi[g]??{label:g.charAt(0).toUpperCase()+g.slice(1),description:h.description??""};return r`
@@ -1608,7 +1608,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1608
1608
  </div>
1609
1609
  </div>
1610
1610
  <div class="config-section-card__content">
1611
- ${je({schema:h,value:n[g],path:[g],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
1611
+ ${We({schema:h,value:n[g],path:[g],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
1612
1612
  </div>
1613
1613
  </section>
1614
1614
  `})}
@@ -1628,10 +1628,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1628
1628
  <div class="callout danger">Channel config schema unavailable.</div>
1629
1629
  `;const i=e.configValue??{},a=Lp(i,e.channelId);return r`
1630
1630
  <div class="config-form">
1631
- ${je({schema:s,value:a,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
1631
+ ${We({schema:s,value:a,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
1632
1632
  </div>
1633
1633
  ${Rp(a)}
1634
- `}function qe(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return r`
1634
+ `}function Ge(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return r`
1635
1635
  <div style="margin-top: 16px;">
1636
1636
  ${n.configSchemaLoading?r`
1637
1637
  <div class="muted">Loading config schema…</div>
@@ -1687,7 +1687,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1687
1687
  ${n.probe.status??""} ${n.probe.error??""}
1688
1688
  </div>`:v}
1689
1689
 
1690
- ${qe({channelId:"discord",props:t})}
1690
+ ${Ge({channelId:"discord",props:t})}
1691
1691
 
1692
1692
  <div class="row" style="margin-top: 12px;">
1693
1693
  <button class="btn" @click=${()=>t.onRefresh(!0)}>
@@ -1739,7 +1739,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1739
1739
  ${n.probe.status??""} ${n.probe.error??""}
1740
1740
  </div>`:v}
1741
1741
 
1742
- ${qe({channelId:"googlechat",props:t})}
1742
+ ${Ge({channelId:"googlechat",props:t})}
1743
1743
 
1744
1744
  <div class="row" style="margin-top: 12px;">
1745
1745
  <button class="btn" @click=${()=>t.onRefresh(!0)}>
@@ -1781,7 +1781,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1781
1781
  ${n.probe.error??""}
1782
1782
  </div>`:v}
1783
1783
 
1784
- ${qe({channelId:"imessage",props:t})}
1784
+ ${Ge({channelId:"imessage",props:t})}
1785
1785
 
1786
1786
  <div class="row" style="margin-top: 12px;">
1787
1787
  <button class="btn" @click=${()=>t.onRefresh(!0)}>
@@ -1891,7 +1891,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1891
1891
 
1892
1892
  ${S()}
1893
1893
 
1894
- ${qe({channelId:"nostr",props:t})}
1894
+ ${Ge({channelId:"nostr",props:t})}
1895
1895
 
1896
1896
  <div class="row" style="margin-top: 12px;">
1897
1897
  <button class="btn" @click=${()=>t.onRefresh(!1)}>Refresh</button>
@@ -1935,7 +1935,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1935
1935
  ${n.probe.status??""} ${n.probe.error??""}
1936
1936
  </div>`:v}
1937
1937
 
1938
- ${qe({channelId:"signal",props:t})}
1938
+ ${Ge({channelId:"signal",props:t})}
1939
1939
 
1940
1940
  <div class="row" style="margin-top: 12px;">
1941
1941
  <button class="btn" @click=${()=>t.onRefresh(!0)}>
@@ -1977,7 +1977,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
1977
1977
  ${n.probe.status??""} ${n.probe.error??""}
1978
1978
  </div>`:v}
1979
1979
 
1980
- ${qe({channelId:"slack",props:t})}
1980
+ ${Ge({channelId:"slack",props:t})}
1981
1981
 
1982
1982
  <div class="row" style="margin-top: 12px;">
1983
1983
  <button class="btn" @click=${()=>t.onRefresh(!0)}>
@@ -2057,7 +2057,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
2057
2057
  ${n.probe.status??""} ${n.probe.error??""}
2058
2058
  </div>`:v}
2059
2059
 
2060
- ${qe({channelId:"telegram",props:t})}
2060
+ ${Ge({channelId:"telegram",props:t})}
2061
2061
 
2062
2062
  <div class="row" style="margin-top: 12px;">
2063
2063
  <button class="btn" @click=${()=>t.onRefresh(!0)}>
@@ -2154,7 +2154,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
2154
2154
  </button>
2155
2155
  </div>
2156
2156
 
2157
- ${qe({channelId:"whatsapp",props:t})}
2157
+ ${Ge({channelId:"whatsapp",props:t})}
2158
2158
  </div>
2159
2159
  `}function qp(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null,a=t?.googlechat??null,o=t?.slack??null,l=t?.signal??null,c=t?.imessage??null,u=t?.nostr??null,g=Gp(e.snapshot).map((h,d)=>({key:h,enabled:Up(h,e),order:d})).toSorted((h,d)=>h.enabled!==d.enabled?h.enabled?-1:1:h.order-d.order);return r`
2160
2160
  <section class="grid grid-cols-2">
@@ -2207,7 +2207,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
2207
2207
  ${c}
2208
2208
  </div>`:v}
2209
2209
 
2210
- ${qe({channelId:e,props:t})}
2210
+ ${Ge({channelId:e,props:t})}
2211
2211
  </div>
2212
2212
  `}function Yp(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Zp(e,t){return Yp(e)[t]?.label??e?.channelLabels?.[t]??t}const Jp=600*1e3;function hl(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<Jp:!1}function Xp(e){return e.running?"Yes":hl(e)?"Active":"No"}function ef(e){return e.connected===!0?"Yes":e.connected===!1?"No":hl(e)?"Active":"n/a"}function tf(e){const t=Xp(e),n=ef(e);return r`
2213
2213
  <div class="account-card">
@@ -2239,7 +2239,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
2239
2239
  `:v}
2240
2240
  </div>
2241
2241
  </div>
2242
- `}const Qt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Qt(s,t);return!0},zn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},vl=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),af(t)}};function nf(e){this._$AN!==void 0?(zn(this),this._$AM=e,vl(this)):this._$AM=e}function sf(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let a=n;a<s.length;a++)Qt(s[a],!1),zn(s[a]);else s!=null&&(Qt(s,!1),zn(s));else Qt(this,e)}const af=e=>{e.type==Ki.CHILD&&(e._$AP??=sf,e._$AQ??=nf)};class of extends Wi{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),vl(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Qt(this,t),zn(this))}setValue(t){if(vg(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Rs=new WeakMap,rf=ji(class extends of{render(e){return v}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Rs.get(t);n===void 0&&(n=new WeakMap,Rs.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Rs.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class li extends Wi{constructor(t){if(super(t),this.it=v,t.type!==Ki.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this._t=void 0,this.it=t;if(t===Qe)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}li.directiveName="unsafeHTML",li.resultType=1;const ci=ji(li);const{entries:ml,setPrototypeOf:ho,isFrozen:lf,getPrototypeOf:cf,getOwnPropertyDescriptor:df}=Object;let{freeze:ve,seal:Ae,create:di}=Object,{apply:ui,construct:gi}=typeof Reflect<"u"&&Reflect;ve||(ve=function(t){return t});Ae||(Ae=function(t){return t});ui||(ui=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)});gi||(gi=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const kn=me(Array.prototype.forEach),uf=me(Array.prototype.lastIndexOf),vo=me(Array.prototype.pop),Ft=me(Array.prototype.push),gf=me(Array.prototype.splice),Pn=me(String.prototype.toLowerCase),Ps=me(String.prototype.toString),Ds=me(String.prototype.match),Nt=me(String.prototype.replace),pf=me(String.prototype.indexOf),ff=me(String.prototype.trim),Ce=me(Object.prototype.hasOwnProperty),fe=me(RegExp.prototype.test),Ot=hf(TypeError);function me(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return ui(e,t,s)}}function hf(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return gi(e,n)}}function j(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pn;ho&&ho(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(lf(t)||(t[s]=a),i=a)}e[i]=!0}return e}function vf(e){for(let t=0;t<e.length;t++)Ce(e,t)||(e[t]=null);return e}function Re(e){const t=di(null);for(const[n,s]of ml(e))Ce(e,n)&&(Array.isArray(s)?t[n]=vf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Re(s):t[n]=s);return t}function Bt(e,t){for(;e!==null;){const s=df(e,t);if(s){if(s.get)return me(s.get);if(typeof s.value=="function")return me(s.value)}e=cf(e)}function n(){return null}return n}const mo=ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Fs=ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ns=ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),mf=ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Os=ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),bf=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bo=ve(["#text"]),yo=ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Bs=ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),xo=ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sn=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yf=Ae(/\{\{[\w\W]*|[\w\W]*\}\}/gm),xf=Ae(/<%[\w\W]*|[\w\W]*%>/gm),$f=Ae(/\$\{[\w\W]*/gm),wf=Ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),kf=Ae(/^aria-[\-\w]+$/),bl=Ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sf=Ae(/^(?:\w+script|data):/i),Af=Ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yl=Ae(/^html$/i),Cf=Ae(/^[a-z][.\w]*(-[.\w]+)+$/i);var $o=Object.freeze({__proto__:null,ARIA_ATTR:kf,ATTR_WHITESPACE:Af,CUSTOM_ELEMENT:Cf,DATA_ATTR:wf,DOCTYPE_NAME:yl,ERB_EXPR:xf,IS_ALLOWED_URI:bl,IS_SCRIPT_OR_DATA:Sf,MUSTACHE_EXPR:yf,TMPLIT_EXPR:$f});const Ut={element:1,text:3,progressingInstruction:7,comment:8,document:9},Tf=function(){return typeof window>"u"?null:window},_f=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}},wo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tf();const t=U=>xl(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ut.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:h,trustedTypes:d}=e,f=c.prototype,m=Bt(f,"cloneNode"),k=Bt(f,"remove"),S=Bt(f,"nextSibling"),w=Bt(f,"childNodes"),C=Bt(f,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let A,_="";const{implementation:T,createNodeIterator:I,createDocumentFragment:z,getElementsByTagName:Y}=n,{importNode:se}=s;let F=wo();t.isSupported=typeof ml=="function"&&typeof C=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:ce,TMPLIT_EXPR:E,DATA_ATTR:B,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:J,CUSTOM_ELEMENT:te}=$o;let{IS_ALLOWED_URI:M}=$o,R=null;const P=j({},[...mo,...Fs,...Ns,...Os,...bo]);let K=null;const xe=j({},[...yo,...Bs,...xo,...Sn]);let Q=Object.seal(di(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,X=null;const pe=Object.seal(di(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ne=!0,Je=!1,la=!0,yt=!1,dn=!0,Xe=!1,ds=!1,us=!1,xt=!1,un=!1,gn=!1,ca=!0,da=!1;const Hl="user-content-";let gs=!0,It=!1,$t={},Le=null;const ps=j({},["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 ua=null;const ga=j({},["audio","video","img","source","image","track"]);let fs=null;const pa=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let wt=Oe,hs=!1,vs=null;const Kl=j({},[pn,fn,Oe],Ps);let hn=j({},["mi","mo","mn","ms","mtext"]),vn=j({},["annotation-xml"]);const jl=j({},["title","style","font","a","script"]);let Rt=null;const Wl=["application/xhtml+xml","text/html"],ql="text/html";let ne=null,kt=null;const Gl=n.createElement("form"),fa=function(b){return b instanceof RegExp||b instanceof Function},ms=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(kt&&kt===b)){if((!b||typeof b!="object")&&(b={}),b=Re(b),Rt=Wl.indexOf(b.PARSER_MEDIA_TYPE)===-1?ql:b.PARSER_MEDIA_TYPE,ne=Rt==="application/xhtml+xml"?Ps:Pn,R=Ce(b,"ALLOWED_TAGS")?j({},b.ALLOWED_TAGS,ne):P,K=Ce(b,"ALLOWED_ATTR")?j({},b.ALLOWED_ATTR,ne):xe,vs=Ce(b,"ALLOWED_NAMESPACES")?j({},b.ALLOWED_NAMESPACES,Ps):Kl,fs=Ce(b,"ADD_URI_SAFE_ATTR")?j(Re(pa),b.ADD_URI_SAFE_ATTR,ne):pa,ua=Ce(b,"ADD_DATA_URI_TAGS")?j(Re(ga),b.ADD_DATA_URI_TAGS,ne):ga,Le=Ce(b,"FORBID_CONTENTS")?j({},b.FORBID_CONTENTS,ne):ps,we=Ce(b,"FORBID_TAGS")?j({},b.FORBID_TAGS,ne):Re({}),X=Ce(b,"FORBID_ATTR")?j({},b.FORBID_ATTR,ne):Re({}),$t=Ce(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fe=b.ALLOW_ARIA_ATTR!==!1,Ne=b.ALLOW_DATA_ATTR!==!1,Je=b.ALLOW_UNKNOWN_PROTOCOLS||!1,la=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,yt=b.SAFE_FOR_TEMPLATES||!1,dn=b.SAFE_FOR_XML!==!1,Xe=b.WHOLE_DOCUMENT||!1,xt=b.RETURN_DOM||!1,un=b.RETURN_DOM_FRAGMENT||!1,gn=b.RETURN_TRUSTED_TYPE||!1,us=b.FORCE_BODY||!1,ca=b.SANITIZE_DOM!==!1,da=b.SANITIZE_NAMED_PROPS||!1,gs=b.KEEP_CONTENT!==!1,It=b.IN_PLACE||!1,M=b.ALLOWED_URI_REGEXP||bl,wt=b.NAMESPACE||Oe,hn=b.MATHML_TEXT_INTEGRATION_POINTS||hn,vn=b.HTML_INTEGRATION_POINTS||vn,Q=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&fa(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&fa(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),yt&&(Ne=!1),un&&(xt=!0),$t&&(R=j({},bo),K=[],$t.html===!0&&(j(R,mo),j(K,yo)),$t.svg===!0&&(j(R,Fs),j(K,Bs),j(K,Sn)),$t.svgFilters===!0&&(j(R,Ns),j(K,Bs),j(K,Sn)),$t.mathMl===!0&&(j(R,Os),j(K,xo),j(K,Sn))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?pe.tagCheck=b.ADD_TAGS:(R===P&&(R=Re(R)),j(R,b.ADD_TAGS,ne))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?pe.attributeCheck=b.ADD_ATTR:(K===xe&&(K=Re(K)),j(K,b.ADD_ATTR,ne))),b.ADD_URI_SAFE_ATTR&&j(fs,b.ADD_URI_SAFE_ATTR,ne),b.FORBID_CONTENTS&&(Le===ps&&(Le=Re(Le)),j(Le,b.FORBID_CONTENTS,ne)),b.ADD_FORBID_CONTENTS&&(Le===ps&&(Le=Re(Le)),j(Le,b.ADD_FORBID_CONTENTS,ne)),gs&&(R["#text"]=!0),Xe&&j(R,["html","head","body"]),R.table&&(j(R,["tbody"]),delete we.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ot('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ot('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=b.TRUSTED_TYPES_POLICY,_=A.createHTML("")}else A===void 0&&(A=_f(d,i)),A!==null&&typeof _=="string"&&(_=A.createHTML(""));ve&&ve(b),kt=b}},ha=j({},[...Fs,...Ns,...mf]),va=j({},[...Os,...bf]),Vl=function(b){let L=C(b);(!L||!L.tagName)&&(L={namespaceURI:wt,tagName:"template"});const N=Pn(b.tagName),Z=Pn(L.tagName);return vs[b.namespaceURI]?b.namespaceURI===fn?L.namespaceURI===Oe?N==="svg":L.namespaceURI===pn?N==="svg"&&(Z==="annotation-xml"||hn[Z]):!!ha[N]:b.namespaceURI===pn?L.namespaceURI===Oe?N==="math":L.namespaceURI===fn?N==="math"&&vn[Z]:!!va[N]:b.namespaceURI===Oe?L.namespaceURI===fn&&!vn[Z]||L.namespaceURI===pn&&!hn[Z]?!1:!va[N]&&(jl[N]||!ha[N]):!!(Rt==="application/xhtml+xml"&&vs[b.namespaceURI]):!1},Me=function(b){Ft(t.removed,{element:b});try{C(b).removeChild(b)}catch{k(b)}},et=function(b,L){try{Ft(t.removed,{attribute:L.getAttributeNode(b),from:L})}catch{Ft(t.removed,{attribute:null,from:L})}if(L.removeAttribute(b),b==="is")if(xt||un)try{Me(L)}catch{}else try{L.setAttribute(b,"")}catch{}},ma=function(b){let L=null,N=null;if(us)b="<remove></remove>"+b;else{const ee=Ds(b,/^[\r\n\t ]+/);N=ee&&ee[0]}Rt==="application/xhtml+xml"&&wt===Oe&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const Z=A?A.createHTML(b):b;if(wt===Oe)try{L=new h().parseFromString(Z,Rt)}catch{}if(!L||!L.documentElement){L=T.createDocument(wt,"template",null);try{L.documentElement.innerHTML=hs?_:Z}catch{}}const de=L.body||L.documentElement;return b&&N&&de.insertBefore(n.createTextNode(N),de.childNodes[0]||null),wt===Oe?Y.call(L,Xe?"html":"body")[0]:Xe?L.documentElement:de},ba=function(b){return I.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},bs=function(b){return b instanceof g&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof p)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},ya=function(b){return typeof l=="function"&&b instanceof l};function Be(U,b,L){kn(U,N=>{N.call(t,b,L,kt)})}const xa=function(b){let L=null;if(Be(F.beforeSanitizeElements,b,null),bs(b))return Me(b),!0;const N=ne(b.nodeName);if(Be(F.uponSanitizeElement,b,{tagName:N,allowedTags:R}),dn&&b.hasChildNodes()&&!ya(b.firstElementChild)&&fe(/<[/\w!]/g,b.innerHTML)&&fe(/<[/\w!]/g,b.textContent)||b.nodeType===Ut.progressingInstruction||dn&&b.nodeType===Ut.comment&&fe(/<[/\w]/g,b.data))return Me(b),!0;if(!(pe.tagCheck instanceof Function&&pe.tagCheck(N))&&(!R[N]||we[N])){if(!we[N]&&wa(N)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N)))return!1;if(gs&&!Le[N]){const Z=C(b)||b.parentNode,de=w(b)||b.childNodes;if(de&&Z){const ee=de.length;for(let be=ee-1;be>=0;--be){const Ue=m(de[be],!0);Ue.__removalCount=(b.__removalCount||0)+1,Z.insertBefore(Ue,S(b))}}}return Me(b),!0}return b instanceof c&&!Vl(b)||(N==="noscript"||N==="noembed"||N==="noframes")&&fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Me(b),!0):(yt&&b.nodeType===Ut.text&&(L=b.textContent,kn([H,ce,E],Z=>{L=Nt(L,Z," ")}),b.textContent!==L&&(Ft(t.removed,{element:b.cloneNode()}),b.textContent=L)),Be(F.afterSanitizeElements,b,null),!1)},$a=function(b,L,N){if(ca&&(L==="id"||L==="name")&&(N in n||N in Gl))return!1;if(!(Ne&&!X[L]&&fe(B,L))){if(!(Fe&&fe(ie,L))){if(!(pe.attributeCheck instanceof Function&&pe.attributeCheck(L,b))){if(!K[L]||X[L]){if(!(wa(b)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))&&(Q.attributeNameCheck instanceof RegExp&&fe(Q.attributeNameCheck,L)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(L,b))||L==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N))))return!1}else if(!fs[L]){if(!fe(M,Nt(N,J,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&b!=="script"&&pf(N,"data:")===0&&ua[b])){if(!(Je&&!fe(ae,Nt(N,J,"")))){if(N)return!1}}}}}}}return!0},wa=function(b){return b!=="annotation-xml"&&Ds(b,te)},ka=function(b){Be(F.beforeSanitizeAttributes,b,null);const{attributes:L}=b;if(!L||bs(b))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let Z=L.length;for(;Z--;){const de=L[Z],{name:ee,namespaceURI:be,value:Ue}=de,St=ne(ee),ys=Ue;let re=ee==="value"?ys:ff(ys);if(N.attrName=St,N.attrValue=re,N.keepAttr=!0,N.forceKeepAttr=void 0,Be(F.uponSanitizeAttribute,b,N),re=N.attrValue,da&&(St==="id"||St==="name")&&(et(ee,b),re=Hl+re),dn&&fe(/((--!?|])>)|<\/(style|title|textarea)/i,re)){et(ee,b);continue}if(St==="attributename"&&Ds(re,"href")){et(ee,b);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){et(ee,b);continue}if(!la&&fe(/\/>/i,re)){et(ee,b);continue}yt&&kn([H,ce,E],Aa=>{re=Nt(re,Aa," ")});const Sa=ne(b.nodeName);if(!$a(Sa,St,re)){et(ee,b);continue}if(A&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(Sa,St)){case"TrustedHTML":{re=A.createHTML(re);break}case"TrustedScriptURL":{re=A.createScriptURL(re);break}}if(re!==ys)try{be?b.setAttributeNS(be,ee,re):b.setAttribute(ee,re),bs(b)?Me(b):vo(t.removed)}catch{et(ee,b)}}Be(F.afterSanitizeAttributes,b,null)},Ql=function U(b){let L=null;const N=ba(b);for(Be(F.beforeSanitizeShadowDOM,b,null);L=N.nextNode();)Be(F.uponSanitizeShadowNode,L,null),xa(L),ka(L),L.content instanceof a&&U(L.content);Be(F.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,N=null,Z=null,de=null;if(hs=!U,hs&&(U="<!-->"),typeof U!="string"&&!ya(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Ot("dirty is not a string, aborting")}else throw Ot("toString is not a function");if(!t.isSupported)return U;if(ds||ms(b),t.removed=[],typeof U=="string"&&(It=!1),It){if(U.nodeName){const Ue=ne(U.nodeName);if(!R[Ue]||we[Ue])throw Ot("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)L=ma("<!---->"),N=L.ownerDocument.importNode(U,!0),N.nodeType===Ut.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?L=N:L.appendChild(N);else{if(!xt&&!yt&&!Xe&&U.indexOf("<")===-1)return A&&gn?A.createHTML(U):U;if(L=ma(U),!L)return xt?null:gn?_:""}L&&us&&Me(L.firstChild);const ee=ba(It?U:L);for(;Z=ee.nextNode();)xa(Z),ka(Z),Z.content instanceof a&&Ql(Z.content);if(It)return U;if(xt){if(un)for(de=z.call(L.ownerDocument);L.firstChild;)de.appendChild(L.firstChild);else de=L;return(K.shadowroot||K.shadowrootmode)&&(de=se.call(s,de,!0)),de}let be=Xe?L.outerHTML:L.innerHTML;return Xe&&R["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&fe(yl,L.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
2242
+ `}const Qt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Qt(s,t);return!0},zn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},vl=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),af(t)}};function nf(e){this._$AN!==void 0?(zn(this),this._$AM=e,vl(this)):this._$AM=e}function sf(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let a=n;a<s.length;a++)Qt(s[a],!1),zn(s[a]);else s!=null&&(Qt(s,!1),zn(s));else Qt(this,e)}const af=e=>{e.type==Ki.CHILD&&(e._$AP??=sf,e._$AQ??=nf)};class of extends Wi{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),vl(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Qt(this,t),zn(this))}setValue(t){if(vg(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Rs=new WeakMap,rf=ji(class extends of{render(e){return v}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Rs.get(t);n===void 0&&(n=new WeakMap,Rs.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Rs.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class li extends Wi{constructor(t){if(super(t),this.it=v,t.type!==Ki.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this._t=void 0,this.it=t;if(t===Ye)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}li.directiveName="unsafeHTML",li.resultType=1;const ci=ji(li);const{entries:ml,setPrototypeOf:ho,isFrozen:lf,getPrototypeOf:cf,getOwnPropertyDescriptor:df}=Object;let{freeze:ve,seal:Ae,create:di}=Object,{apply:ui,construct:gi}=typeof Reflect<"u"&&Reflect;ve||(ve=function(t){return t});Ae||(Ae=function(t){return t});ui||(ui=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)});gi||(gi=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const kn=me(Array.prototype.forEach),uf=me(Array.prototype.lastIndexOf),vo=me(Array.prototype.pop),Ft=me(Array.prototype.push),gf=me(Array.prototype.splice),Pn=me(String.prototype.toLowerCase),Ps=me(String.prototype.toString),Ds=me(String.prototype.match),Nt=me(String.prototype.replace),pf=me(String.prototype.indexOf),ff=me(String.prototype.trim),Ce=me(Object.prototype.hasOwnProperty),fe=me(RegExp.prototype.test),Ot=hf(TypeError);function me(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return ui(e,t,s)}}function hf(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return gi(e,n)}}function j(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pn;ho&&ho(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(lf(t)||(t[s]=a),i=a)}e[i]=!0}return e}function vf(e){for(let t=0;t<e.length;t++)Ce(e,t)||(e[t]=null);return e}function Re(e){const t=di(null);for(const[n,s]of ml(e))Ce(e,n)&&(Array.isArray(s)?t[n]=vf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Re(s):t[n]=s);return t}function Bt(e,t){for(;e!==null;){const s=df(e,t);if(s){if(s.get)return me(s.get);if(typeof s.value=="function")return me(s.value)}e=cf(e)}function n(){return null}return n}const mo=ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Fs=ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ns=ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),mf=ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Os=ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),bf=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bo=ve(["#text"]),yo=ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Bs=ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),xo=ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sn=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yf=Ae(/\{\{[\w\W]*|[\w\W]*\}\}/gm),xf=Ae(/<%[\w\W]*|[\w\W]*%>/gm),$f=Ae(/\$\{[\w\W]*/gm),wf=Ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),kf=Ae(/^aria-[\-\w]+$/),bl=Ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sf=Ae(/^(?:\w+script|data):/i),Af=Ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yl=Ae(/^html$/i),Cf=Ae(/^[a-z][.\w]*(-[.\w]+)+$/i);var $o=Object.freeze({__proto__:null,ARIA_ATTR:kf,ATTR_WHITESPACE:Af,CUSTOM_ELEMENT:Cf,DATA_ATTR:wf,DOCTYPE_NAME:yl,ERB_EXPR:xf,IS_ALLOWED_URI:bl,IS_SCRIPT_OR_DATA:Sf,MUSTACHE_EXPR:yf,TMPLIT_EXPR:$f});const Ut={element:1,text:3,progressingInstruction:7,comment:8,document:9},Tf=function(){return typeof window>"u"?null:window},_f=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}},wo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tf();const t=U=>xl(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ut.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:h,trustedTypes:d}=e,f=c.prototype,m=Bt(f,"cloneNode"),k=Bt(f,"remove"),S=Bt(f,"nextSibling"),w=Bt(f,"childNodes"),C=Bt(f,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let A,_="";const{implementation:T,createNodeIterator:I,createDocumentFragment:z,getElementsByTagName:Y}=n,{importNode:se}=s;let F=wo();t.isSupported=typeof ml=="function"&&typeof C=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:ce,TMPLIT_EXPR:E,DATA_ATTR:B,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:J,CUSTOM_ELEMENT:te}=$o;let{IS_ALLOWED_URI:M}=$o,R=null;const P=j({},[...mo,...Fs,...Ns,...Os,...bo]);let K=null;const xe=j({},[...yo,...Bs,...xo,...Sn]);let Q=Object.seal(di(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,X=null;const pe=Object.seal(di(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ne=!0,Xe=!1,la=!0,yt=!1,dn=!0,et=!1,ds=!1,us=!1,xt=!1,un=!1,gn=!1,ca=!0,da=!1;const Hl="user-content-";let gs=!0,It=!1,$t={},Le=null;const ps=j({},["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 ua=null;const ga=j({},["audio","video","img","source","image","track"]);let fs=null;const pa=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let wt=Oe,hs=!1,vs=null;const Kl=j({},[pn,fn,Oe],Ps);let hn=j({},["mi","mo","mn","ms","mtext"]),vn=j({},["annotation-xml"]);const jl=j({},["title","style","font","a","script"]);let Rt=null;const Wl=["application/xhtml+xml","text/html"],ql="text/html";let ne=null,kt=null;const Gl=n.createElement("form"),fa=function(b){return b instanceof RegExp||b instanceof Function},ms=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(kt&&kt===b)){if((!b||typeof b!="object")&&(b={}),b=Re(b),Rt=Wl.indexOf(b.PARSER_MEDIA_TYPE)===-1?ql:b.PARSER_MEDIA_TYPE,ne=Rt==="application/xhtml+xml"?Ps:Pn,R=Ce(b,"ALLOWED_TAGS")?j({},b.ALLOWED_TAGS,ne):P,K=Ce(b,"ALLOWED_ATTR")?j({},b.ALLOWED_ATTR,ne):xe,vs=Ce(b,"ALLOWED_NAMESPACES")?j({},b.ALLOWED_NAMESPACES,Ps):Kl,fs=Ce(b,"ADD_URI_SAFE_ATTR")?j(Re(pa),b.ADD_URI_SAFE_ATTR,ne):pa,ua=Ce(b,"ADD_DATA_URI_TAGS")?j(Re(ga),b.ADD_DATA_URI_TAGS,ne):ga,Le=Ce(b,"FORBID_CONTENTS")?j({},b.FORBID_CONTENTS,ne):ps,we=Ce(b,"FORBID_TAGS")?j({},b.FORBID_TAGS,ne):Re({}),X=Ce(b,"FORBID_ATTR")?j({},b.FORBID_ATTR,ne):Re({}),$t=Ce(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fe=b.ALLOW_ARIA_ATTR!==!1,Ne=b.ALLOW_DATA_ATTR!==!1,Xe=b.ALLOW_UNKNOWN_PROTOCOLS||!1,la=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,yt=b.SAFE_FOR_TEMPLATES||!1,dn=b.SAFE_FOR_XML!==!1,et=b.WHOLE_DOCUMENT||!1,xt=b.RETURN_DOM||!1,un=b.RETURN_DOM_FRAGMENT||!1,gn=b.RETURN_TRUSTED_TYPE||!1,us=b.FORCE_BODY||!1,ca=b.SANITIZE_DOM!==!1,da=b.SANITIZE_NAMED_PROPS||!1,gs=b.KEEP_CONTENT!==!1,It=b.IN_PLACE||!1,M=b.ALLOWED_URI_REGEXP||bl,wt=b.NAMESPACE||Oe,hn=b.MATHML_TEXT_INTEGRATION_POINTS||hn,vn=b.HTML_INTEGRATION_POINTS||vn,Q=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&fa(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&fa(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),yt&&(Ne=!1),un&&(xt=!0),$t&&(R=j({},bo),K=[],$t.html===!0&&(j(R,mo),j(K,yo)),$t.svg===!0&&(j(R,Fs),j(K,Bs),j(K,Sn)),$t.svgFilters===!0&&(j(R,Ns),j(K,Bs),j(K,Sn)),$t.mathMl===!0&&(j(R,Os),j(K,xo),j(K,Sn))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?pe.tagCheck=b.ADD_TAGS:(R===P&&(R=Re(R)),j(R,b.ADD_TAGS,ne))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?pe.attributeCheck=b.ADD_ATTR:(K===xe&&(K=Re(K)),j(K,b.ADD_ATTR,ne))),b.ADD_URI_SAFE_ATTR&&j(fs,b.ADD_URI_SAFE_ATTR,ne),b.FORBID_CONTENTS&&(Le===ps&&(Le=Re(Le)),j(Le,b.FORBID_CONTENTS,ne)),b.ADD_FORBID_CONTENTS&&(Le===ps&&(Le=Re(Le)),j(Le,b.ADD_FORBID_CONTENTS,ne)),gs&&(R["#text"]=!0),et&&j(R,["html","head","body"]),R.table&&(j(R,["tbody"]),delete we.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ot('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ot('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=b.TRUSTED_TYPES_POLICY,_=A.createHTML("")}else A===void 0&&(A=_f(d,i)),A!==null&&typeof _=="string"&&(_=A.createHTML(""));ve&&ve(b),kt=b}},ha=j({},[...Fs,...Ns,...mf]),va=j({},[...Os,...bf]),Vl=function(b){let L=C(b);(!L||!L.tagName)&&(L={namespaceURI:wt,tagName:"template"});const N=Pn(b.tagName),Z=Pn(L.tagName);return vs[b.namespaceURI]?b.namespaceURI===fn?L.namespaceURI===Oe?N==="svg":L.namespaceURI===pn?N==="svg"&&(Z==="annotation-xml"||hn[Z]):!!ha[N]:b.namespaceURI===pn?L.namespaceURI===Oe?N==="math":L.namespaceURI===fn?N==="math"&&vn[Z]:!!va[N]:b.namespaceURI===Oe?L.namespaceURI===fn&&!vn[Z]||L.namespaceURI===pn&&!hn[Z]?!1:!va[N]&&(jl[N]||!ha[N]):!!(Rt==="application/xhtml+xml"&&vs[b.namespaceURI]):!1},Me=function(b){Ft(t.removed,{element:b});try{C(b).removeChild(b)}catch{k(b)}},tt=function(b,L){try{Ft(t.removed,{attribute:L.getAttributeNode(b),from:L})}catch{Ft(t.removed,{attribute:null,from:L})}if(L.removeAttribute(b),b==="is")if(xt||un)try{Me(L)}catch{}else try{L.setAttribute(b,"")}catch{}},ma=function(b){let L=null,N=null;if(us)b="<remove></remove>"+b;else{const ee=Ds(b,/^[\r\n\t ]+/);N=ee&&ee[0]}Rt==="application/xhtml+xml"&&wt===Oe&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const Z=A?A.createHTML(b):b;if(wt===Oe)try{L=new h().parseFromString(Z,Rt)}catch{}if(!L||!L.documentElement){L=T.createDocument(wt,"template",null);try{L.documentElement.innerHTML=hs?_:Z}catch{}}const de=L.body||L.documentElement;return b&&N&&de.insertBefore(n.createTextNode(N),de.childNodes[0]||null),wt===Oe?Y.call(L,et?"html":"body")[0]:et?L.documentElement:de},ba=function(b){return I.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},bs=function(b){return b instanceof g&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof p)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},ya=function(b){return typeof l=="function"&&b instanceof l};function Be(U,b,L){kn(U,N=>{N.call(t,b,L,kt)})}const xa=function(b){let L=null;if(Be(F.beforeSanitizeElements,b,null),bs(b))return Me(b),!0;const N=ne(b.nodeName);if(Be(F.uponSanitizeElement,b,{tagName:N,allowedTags:R}),dn&&b.hasChildNodes()&&!ya(b.firstElementChild)&&fe(/<[/\w!]/g,b.innerHTML)&&fe(/<[/\w!]/g,b.textContent)||b.nodeType===Ut.progressingInstruction||dn&&b.nodeType===Ut.comment&&fe(/<[/\w]/g,b.data))return Me(b),!0;if(!(pe.tagCheck instanceof Function&&pe.tagCheck(N))&&(!R[N]||we[N])){if(!we[N]&&wa(N)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N)))return!1;if(gs&&!Le[N]){const Z=C(b)||b.parentNode,de=w(b)||b.childNodes;if(de&&Z){const ee=de.length;for(let be=ee-1;be>=0;--be){const Ue=m(de[be],!0);Ue.__removalCount=(b.__removalCount||0)+1,Z.insertBefore(Ue,S(b))}}}return Me(b),!0}return b instanceof c&&!Vl(b)||(N==="noscript"||N==="noembed"||N==="noframes")&&fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Me(b),!0):(yt&&b.nodeType===Ut.text&&(L=b.textContent,kn([H,ce,E],Z=>{L=Nt(L,Z," ")}),b.textContent!==L&&(Ft(t.removed,{element:b.cloneNode()}),b.textContent=L)),Be(F.afterSanitizeElements,b,null),!1)},$a=function(b,L,N){if(ca&&(L==="id"||L==="name")&&(N in n||N in Gl))return!1;if(!(Ne&&!X[L]&&fe(B,L))){if(!(Fe&&fe(ie,L))){if(!(pe.attributeCheck instanceof Function&&pe.attributeCheck(L,b))){if(!K[L]||X[L]){if(!(wa(b)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))&&(Q.attributeNameCheck instanceof RegExp&&fe(Q.attributeNameCheck,L)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(L,b))||L==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N))))return!1}else if(!fs[L]){if(!fe(M,Nt(N,J,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&b!=="script"&&pf(N,"data:")===0&&ua[b])){if(!(Xe&&!fe(ae,Nt(N,J,"")))){if(N)return!1}}}}}}}return!0},wa=function(b){return b!=="annotation-xml"&&Ds(b,te)},ka=function(b){Be(F.beforeSanitizeAttributes,b,null);const{attributes:L}=b;if(!L||bs(b))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let Z=L.length;for(;Z--;){const de=L[Z],{name:ee,namespaceURI:be,value:Ue}=de,St=ne(ee),ys=Ue;let re=ee==="value"?ys:ff(ys);if(N.attrName=St,N.attrValue=re,N.keepAttr=!0,N.forceKeepAttr=void 0,Be(F.uponSanitizeAttribute,b,N),re=N.attrValue,da&&(St==="id"||St==="name")&&(tt(ee,b),re=Hl+re),dn&&fe(/((--!?|])>)|<\/(style|title|textarea)/i,re)){tt(ee,b);continue}if(St==="attributename"&&Ds(re,"href")){tt(ee,b);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){tt(ee,b);continue}if(!la&&fe(/\/>/i,re)){tt(ee,b);continue}yt&&kn([H,ce,E],Aa=>{re=Nt(re,Aa," ")});const Sa=ne(b.nodeName);if(!$a(Sa,St,re)){tt(ee,b);continue}if(A&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(Sa,St)){case"TrustedHTML":{re=A.createHTML(re);break}case"TrustedScriptURL":{re=A.createScriptURL(re);break}}if(re!==ys)try{be?b.setAttributeNS(be,ee,re):b.setAttribute(ee,re),bs(b)?Me(b):vo(t.removed)}catch{tt(ee,b)}}Be(F.afterSanitizeAttributes,b,null)},Ql=function U(b){let L=null;const N=ba(b);for(Be(F.beforeSanitizeShadowDOM,b,null);L=N.nextNode();)Be(F.uponSanitizeShadowNode,L,null),xa(L),ka(L),L.content instanceof a&&U(L.content);Be(F.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,N=null,Z=null,de=null;if(hs=!U,hs&&(U="<!-->"),typeof U!="string"&&!ya(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Ot("dirty is not a string, aborting")}else throw Ot("toString is not a function");if(!t.isSupported)return U;if(ds||ms(b),t.removed=[],typeof U=="string"&&(It=!1),It){if(U.nodeName){const Ue=ne(U.nodeName);if(!R[Ue]||we[Ue])throw Ot("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)L=ma("<!---->"),N=L.ownerDocument.importNode(U,!0),N.nodeType===Ut.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?L=N:L.appendChild(N);else{if(!xt&&!yt&&!et&&U.indexOf("<")===-1)return A&&gn?A.createHTML(U):U;if(L=ma(U),!L)return xt?null:gn?_:""}L&&us&&Me(L.firstChild);const ee=ba(It?U:L);for(;Z=ee.nextNode();)xa(Z),ka(Z),Z.content instanceof a&&Ql(Z.content);if(It)return U;if(xt){if(un)for(de=z.call(L.ownerDocument);L.firstChild;)de.appendChild(L.firstChild);else de=L;return(K.shadowroot||K.shadowrootmode)&&(de=se.call(s,de,!0)),de}let be=et?L.outerHTML:L.innerHTML;return et&&R["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&fe(yl,L.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
2243
2243
  `+be),yt&&kn([H,ce,E],Ue=>{be=Nt(be,Ue," ")}),A&&gn?A.createHTML(be):be},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ms(U),ds=!0},t.clearConfig=function(){kt=null,ds=!1},t.isValidAttribute=function(U,b,L){kt||ms({});const N=ne(U),Z=ne(b);return $a(N,Z,L)},t.addHook=function(U,b){typeof b=="function"&&Ft(F[U],b)},t.removeHook=function(U,b){if(b!==void 0){const L=uf(F[U],b);return L===-1?void 0:gf(F[U],L,1)[0]}return vo(F[U])},t.removeHooks=function(U){F[U]=[]},t.removeAllHooks=function(){F=wo()},t}var pi=xl();function Vi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bt=Vi();function $l(e){bt=e}var Yt={exec:()=>null};function W(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(he.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var Ef=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),he={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Lf=/^(?:[ \t]*(?:\n|$))+/,Mf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,If=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Rf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Qi=/(?:[*+-]|\d{1,9}[.)])/,wl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,kl=W(wl).replace(/bull/g,Qi).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(),Pf=W(wl).replace(/bull/g,Qi).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(),Yi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Df=/^[^\n]+/,Zi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ff=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Zi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Nf=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Qi).getRegex(),rs="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",Ji=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Of=W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ji).replace("tag",rs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Sl=W(Yi).replace("hr",cn).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",rs).getRegex(),Bf=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Sl).getRegex(),Xi={blockquote:Bf,code:Mf,def:Ff,fences:If,heading:Rf,hr:cn,html:Of,lheading:kl,list:Nf,newline:Lf,paragraph:Sl,table:Yt,text:Df},ko=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cn).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",rs).getRegex(),Uf={...Xi,lheading:Pf,table:ko,paragraph:W(Yi).replace("hr",cn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ko).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",rs).getRegex()},zf={...Xi,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ji).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:Yt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Yi).replace("hr",cn).replace("heading",` *#{1,6} *[^
2244
2244
  ]`).replace("lheading",kl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Hf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Kf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Al=/^( {2,}|\\)\n(?!\s*$)/,jf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ls=/[\p{P}\p{S}]/u,ea=/[\s\p{P}\p{S}]/u,Cl=/[^\s\p{P}\p{S}]/u,Wf=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ea).getRegex(),Tl=/(?!~)[\p{P}\p{S}]/u,qf=/(?!~)[\s\p{P}\p{S}]/u,Gf=/(?:[^\s\p{P}\p{S}]|~)/u,Vf=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ef?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),_l=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Qf=W(_l,"u").replace(/punct/g,ls).getRegex(),Yf=W(_l,"u").replace(/punct/g,Tl).getRegex(),El="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Zf=W(El,"gu").replace(/notPunctSpace/g,Cl).replace(/punctSpace/g,ea).replace(/punct/g,ls).getRegex(),Jf=W(El,"gu").replace(/notPunctSpace/g,Gf).replace(/punctSpace/g,qf).replace(/punct/g,Tl).getRegex(),Xf=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Cl).replace(/punctSpace/g,ea).replace(/punct/g,ls).getRegex(),eh=W(/\\(punct)/,"gu").replace(/punct/g,ls).getRegex(),th=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),nh=W(Ji).replace("(?:-->|$)","-->").getRegex(),sh=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",nh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Hn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ih=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Hn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ll=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Hn).replace("ref",Zi).getRegex(),Ml=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",Zi).getRegex(),ah=W("reflink|nolink(?!\\()","g").replace("reflink",Ll).replace("nolink",Ml).getRegex(),So=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ta={_backpedal:Yt,anyPunctuation:eh,autolink:th,blockSkip:Vf,br:Al,code:Kf,del:Yt,emStrongLDelim:Qf,emStrongRDelimAst:Zf,emStrongRDelimUnd:Xf,escape:Hf,link:ih,nolink:Ml,punctuation:Wf,reflink:Ll,reflinkSearch:ah,tag:sh,text:jf,url:Yt},oh={...ta,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Hn).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Hn).getRegex()},fi={...ta,emStrongRDelimAst:Jf,emStrongLDelim:Yf,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",So).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",So).getRegex()},rh={...fi,br:W(Al).replace("{2,}","*").getRegex(),text:W(fi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},An={normal:Xi,gfm:Uf,pedantic:zf},zt={normal:ta,gfm:fi,breaks:rh,pedantic:oh},lh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ao=e=>lh[e];function Ke(e,t){if(t){if(he.escapeTest.test(e))return e.replace(he.escapeReplace,Ao)}else if(he.escapeTestNoEncode.test(e))return e.replace(he.escapeReplaceNoEncode,Ao);return e}function Co(e){try{e=encodeURI(e).replace(he.percentDecode,"%")}catch{return null}return e}function To(e,t){let n=e.replace(he.findPipe,(a,o,l)=>{let c=!1,u=o;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(he.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(he.slashPipe,"|");return s}function Ht(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 ch(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 _o(e,t,n,s,i){let a=t.href,o=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,c}function dh(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
2245
2245
  `).map(a=>{let o=a.match(n.other.beginningSpace);if(o===null)return a;let[l]=o;return l.length>=i.length?a.slice(i.length):a}).join(`
@@ -2298,7 +2298,7 @@ ${this.parser.parse(e)}</blockquote>
2298
2298
  ${e}</tr>
2299
2299
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
2300
2300
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ke(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=Co(e);if(i===null)return s;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+Ke(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=Co(e);if(i===null)return Ke(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Ke(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ke(e.text)}},na=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}},_e=class vi{options;renderer;textRenderer;constructor(t){this.options=t||bt,this.options.renderer=this.options.renderer||new jn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new na}static parse(t,n){return new vi(n).parse(t)}static parseInline(t,n){return new vi(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";continue}}let o=a;switch(o.type){case"escape":{s+=n.text(o);break}case"html":{s+=n.html(o);break}case"link":{s+=n.link(o);break}case"image":{s+=n.image(o);break}case"checkbox":{s+=n.checkbox(o);break}case"strong":{s+=n.strong(o);break}case"em":{s+=n.em(o);break}case"codespan":{s+=n.codespan(o);break}case"br":{s+=n.br(o);break}case"del":{s+=n.del(o);break}case"text":{s+=n.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},jt=class{options;block;constructor(e){this.options=e||bt}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?Te.lex:Te.lexInline}provideParser(){return this.block?_e.parse:_e.parseInline}},uh=class{defaults=Vi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_e;Renderer=jn;TextRenderer=na;Lexer=Te;Tokenizer=Kn;Hooks=jt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new jn(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,l=n.renderer[o],c=i[o];i[o]=(...u)=>{let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Kn(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,l=n.tokenizer[o],c=i[o];i[o]=(...u)=>{let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new jt;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,l=n.hooks[o],c=i[o];jt.passThroughHooks.has(a)?i[o]=u=>{if(this.defaults.async&&jt.passThroughHooksRespectAsync.has(a))return(async()=>{let g=await l.call(i,u);return c.call(i,g)})();let p=l.call(i,u);return c.call(i,p)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(i,u);return g===!1&&(g=await c.apply(i,u)),g})();let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Te.lex(e,t??this.defaults)}parser(e,t){return _e.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?Te.lex:Te.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?_e.parse:_e.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?Te.lex:Te.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?_e.parse:_e.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
2301
- Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Ke(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},vt=new uh;function G(e,t){return vt.parse(e,t)}G.options=G.setOptions=function(e){return vt.setOptions(e),G.defaults=vt.defaults,$l(G.defaults),G};G.getDefaults=Vi;G.defaults=bt;G.use=function(...e){return vt.use(...e),G.defaults=vt.defaults,$l(G.defaults),G};G.walkTokens=function(e,t){return vt.walkTokens(e,t)};G.parseInline=vt.parseInline;G.Parser=_e;G.parser=_e.parse;G.Renderer=jn;G.TextRenderer=na;G.Lexer=Te;G.lexer=Te.lex;G.Tokenizer=Kn;G.Hooks=jt;G.parse=G;G.options;G.setOptions;G.use;G.walkTokens;G.parseInline;_e.parse;Te.lex;G.setOptions({gfm:!0,breaks:!0});const Eo=["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"],Lo=["class","href","rel","target","title","start"];let Mo=!1;const gh=14e4,ph=4e4,fh=200,Us=5e4,dt=new Map;function hh(e){const t=dt.get(e);return t===void 0?null:(dt.delete(e),dt.set(e,t),t)}function Io(e,t){if(dt.set(e,t),dt.size<=fh)return;const n=dt.keys().next().value;n&&dt.delete(n)}function vh(){Mo||(Mo=!0,pi.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function mi(e){const t=e.trim();if(!t)return"";if(vh(),t.length<=Us){const o=hh(t);if(o!==null)return o}const n=mr(t,gh),s=n.truncated?`
2301
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Ke(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},vt=new uh;function G(e,t){return vt.parse(e,t)}G.options=G.setOptions=function(e){return vt.setOptions(e),G.defaults=vt.defaults,$l(G.defaults),G};G.getDefaults=Vi;G.defaults=bt;G.use=function(...e){return vt.use(...e),G.defaults=vt.defaults,$l(G.defaults),G};G.walkTokens=function(e,t){return vt.walkTokens(e,t)};G.parseInline=vt.parseInline;G.Parser=_e;G.parser=_e.parse;G.Renderer=jn;G.TextRenderer=na;G.Lexer=Te;G.lexer=Te.lex;G.Tokenizer=Kn;G.Hooks=jt;G.parse=G;G.options;G.setOptions;G.use;G.walkTokens;G.parseInline;_e.parse;Te.lex;G.setOptions({gfm:!0,breaks:!0});const Eo=["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"],Lo=["class","href","rel","target","title","start"];let Mo=!1;const gh=14e4,ph=4e4,fh=200,Us=5e4,ut=new Map;function hh(e){const t=ut.get(e);return t===void 0?null:(ut.delete(e),ut.set(e,t),t)}function Io(e,t){if(ut.set(e,t),ut.size<=fh)return;const n=ut.keys().next().value;n&&ut.delete(n)}function vh(){Mo||(Mo=!0,pi.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function mi(e){const t=e.trim();if(!t)return"";if(vh(),t.length<=Us){const o=hh(t);if(o!==null)return o}const n=mr(t,gh),s=n.truncated?`
2302
2302
 
2303
2303
  … truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>ph){const l=`<pre class="code-block">${mh(`${n.text}${s}`)}</pre>`,c=pi.sanitize(l,{ALLOWED_TAGS:Eo,ALLOWED_ATTR:Lo});return t.length<=Us&&Io(t,c),c}const i=G.parse(`${n.text}${s}`),a=pi.sanitize(i,{ALLOWED_TAGS:Eo,ALLOWED_ATTR:Lo});return t.length<=Us&&Io(t,a),a}function mh(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}const bh=1500,yh=2e3,Il="Copy as markdown",xh="Copied",$h="Copy failed";async function wh(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Cn(e,t){e.title=t,e.setAttribute("aria-label",t)}function kh(e){const t=e.label??Il;return r`
2304
2304
  <button
@@ -2784,7 +2784,7 @@ ${e.sidebarContent}
2784
2784
  <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
2785
2785
  <polyline points="14 2 14 8 20 8"></polyline>
2786
2786
  </svg>
2787
- `},Bo=[{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"}],Uo="__all__";function zo(e){return bi[e]??bi.default}function uv(e,t){const n=Gi[e];return n||{label:t?.title??We(e),description:t?.description??""}}function gv(e){const{key:t,schema:n,uiHints:s}=e;if(!n||De(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const l=Se([t,a],s),c=l?.label??o.title??We(a),u=l?.help??o.description??"",p=l?.order??50;return{key:a,label:c,description:u,order:p}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function pv(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const l=i,c=a,u=new Set([...Object.keys(l),...Object.keys(c)]);for(const p of u)s(l[p],c[p],o?`${o}.${p}`:p)}return s(e,t,""),n}function Ho(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 fv(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=pl(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=Bo.filter(T=>T.key in i),o=new Set(Bo.map(T=>T.key)),l=Object.keys(i).filter(T=>!o.has(T)).map(T=>({key:T,label:T.charAt(0).toUpperCase()+T.slice(1)})),c=[...a,...l],u=e.activeSection&&n.schema&&De(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,p=e.activeSection?uv(e.activeSection,u):null,g=e.activeSection?gv({key:e.activeSection,schema:u,uiHints:e.uiHints}):[],h=e.formMode==="form"&&!!e.activeSection&&g.length>0,d=e.activeSubsection===Uo,f=e.searchQuery||d?null:e.activeSubsection??g[0]?.key??null,m=e.formMode==="form"?pv(e.originalValue,e.formValue):[],k=e.formMode==="raw"&&e.raw!==e.originalRaw,S=e.formMode==="form"?m.length>0:k,w=!!e.formValue&&!e.loading&&!!n.schema,C=e.connected&&!e.saving&&S&&(e.formMode==="raw"?!0:w),A=e.connected&&!e.applying&&!e.updating&&S&&(e.formMode==="raw"?!0:w),_=e.connected&&!e.applying&&!e.updating;return r`
2787
+ `},Bo=[{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"}],Uo="__all__";function zo(e){return bi[e]??bi.default}function uv(e,t){const n=Gi[e];return n||{label:t?.title??qe(e),description:t?.description??""}}function gv(e){const{key:t,schema:n,uiHints:s}=e;if(!n||De(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const l=Se([t,a],s),c=l?.label??o.title??qe(a),u=l?.help??o.description??"",p=l?.order??50;return{key:a,label:c,description:u,order:p}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function pv(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const l=i,c=a,u=new Set([...Object.keys(l),...Object.keys(c)]);for(const p of u)s(l[p],c[p],o?`${o}.${p}`:p)}return s(e,t,""),n}function Ho(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 fv(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=pl(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=Bo.filter(T=>T.key in i),o=new Set(Bo.map(T=>T.key)),l=Object.keys(i).filter(T=>!o.has(T)).map(T=>({key:T,label:T.charAt(0).toUpperCase()+T.slice(1)})),c=[...a,...l],u=e.activeSection&&n.schema&&De(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,p=e.activeSection?uv(e.activeSection,u):null,g=e.activeSection?gv({key:e.activeSection,schema:u,uiHints:e.uiHints}):[],h=e.formMode==="form"&&!!e.activeSection&&g.length>0,d=e.activeSubsection===Uo,f=e.searchQuery||d?null:e.activeSubsection??g[0]?.key??null,m=e.formMode==="form"?pv(e.originalValue,e.formValue):[],k=e.formMode==="raw"&&e.raw!==e.originalRaw,S=e.formMode==="form"?m.length>0:k,w=!!e.formValue&&!e.loading&&!!n.schema,C=e.connected&&!e.saving&&S&&(e.formMode==="raw"?!0:w),A=e.connected&&!e.applying&&!e.updating&&S&&(e.formMode==="raw"?!0:w),_=e.connected&&!e.applying&&!e.updating;return r`
2788
2788
  <div class="config-layout">
2789
2789
  <!-- Sidebar -->
2790
2790
  <aside class="config-sidebar">
@@ -3402,7 +3402,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3402
3402
  </div>
3403
3403
  `}
3404
3404
  </section>
3405
- `}function wv(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 st(e,t){return t?r`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:v}function kv(e){const t=e.execApprovalQueue[0];if(!t)return v;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${wv(s)}`:"expired",a=e.execApprovalQueue.length;return r`
3405
+ `}function wv(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 it(e,t){return t?r`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:v}function kv(e){const t=e.execApprovalQueue[0];if(!t)return v;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${wv(s)}`:"expired",a=e.execApprovalQueue.length;return r`
3406
3406
  <div class="exec-approval-overlay" role="dialog" aria-live="polite">
3407
3407
  <div class="exec-approval-card">
3408
3408
  <div class="exec-approval-header">
@@ -3414,13 +3414,13 @@ ${JSON.stringify(e.issues,null,2)}</pre
3414
3414
  </div>
3415
3415
  <div class="exec-approval-command mono">${n.command}</div>
3416
3416
  <div class="exec-approval-meta">
3417
- ${st("Host",n.host)}
3418
- ${st("Agent",n.agentId)}
3419
- ${st("Session",n.sessionKey)}
3420
- ${st("CWD",n.cwd)}
3421
- ${st("Resolved",n.resolvedPath)}
3422
- ${st("Security",n.security)}
3423
- ${st("Ask",n.ask)}
3417
+ ${it("Host",n.host)}
3418
+ ${it("Agent",n.agentId)}
3419
+ ${it("Session",n.sessionKey)}
3420
+ ${it("CWD",n.cwd)}
3421
+ ${it("Resolved",n.resolvedPath)}
3422
+ ${it("Security",n.security)}
3423
+ ${it("Ask",n.ask)}
3424
3424
  </div>
3425
3425
  ${e.execApprovalError?r`<div class="exec-approval-error">${e.execApprovalError}</div>`:v}
3426
3426
  <div class="exec-approval-actions">
@@ -3695,7 +3695,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3695
3695
  `}
3696
3696
  </div>
3697
3697
  </div>
3698
- `}const Ve="__defaults__",jo=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],Dv=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Fv(e){const t=e.configForm,n=Zv(e.nodes),{defaultBinding:s,agents:i}=Xv(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 Wo(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function Nv(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function Ov(e){const t=e?.defaults??{};return{security:Wo(t.security),ask:Nv(t.ask),askFallback:Wo(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function Bv(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach(i=>{if(!i||typeof i!="object")return;const a=i,o=typeof a.id=="string"?a.id.trim():"";if(!o)return;const l=typeof a.name=="string"?a.name.trim():void 0,c=a.default===!0;s.push({id:o,name:l||void 0,isDefault:c})}),s}function Uv(e,t){const n=Bv(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(o=>i.set(o.id,o)),s.forEach(o=>{i.has(o)||i.set(o,{id:o})});const a=Array.from(i.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,l)=>{if(o.isDefault&&!l.isDefault)return-1;if(!o.isDefault&&l.isDefault)return 1;const c=o.name?.trim()?o.name:o.id,u=l.name?.trim()?l.name:l.id;return c.localeCompare(u)}),a}function zv(e,t){return e===Ve?Ve:e&&t.some(n=>n.id===e)?e:Ve}function Hv(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=Ov(t),i=Uv(e.configForm,t),a=Jv(e.nodes),o=e.execApprovalsTarget;let l=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&l&&!a.some(g=>g.id===l)&&(l=null);const c=zv(e.execApprovalsSelectedAgent,i),u=c!==Ve?(t?.agents??{})[c]??null:null,p=Array.isArray(u?.allowlist)?u.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:c,selectedAgent:u,agents:i,allowlist:p,target:o,targetNodeId:l,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function Kv(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return r`
3698
+ `}const Qe="__defaults__",jo=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],Dv=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Fv(e){const t=e.configForm,n=Zv(e.nodes),{defaultBinding:s,agents:i}=Xv(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 Wo(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function Nv(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function Ov(e){const t=e?.defaults??{};return{security:Wo(t.security),ask:Nv(t.ask),askFallback:Wo(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function Bv(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach(i=>{if(!i||typeof i!="object")return;const a=i,o=typeof a.id=="string"?a.id.trim():"";if(!o)return;const l=typeof a.name=="string"?a.name.trim():void 0,c=a.default===!0;s.push({id:o,name:l||void 0,isDefault:c})}),s}function Uv(e,t){const n=Bv(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(o=>i.set(o.id,o)),s.forEach(o=>{i.has(o)||i.set(o,{id:o})});const a=Array.from(i.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,l)=>{if(o.isDefault&&!l.isDefault)return-1;if(!o.isDefault&&l.isDefault)return 1;const c=o.name?.trim()?o.name:o.id,u=l.name?.trim()?l.name:l.id;return c.localeCompare(u)}),a}function zv(e,t){return e===Qe?Qe:e&&t.some(n=>n.id===e)?e:Qe}function Hv(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=Ov(t),i=Uv(e.configForm,t),a=Jv(e.nodes),o=e.execApprovalsTarget;let l=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&l&&!a.some(g=>g.id===l)&&(l=null);const c=zv(e.execApprovalsSelectedAgent,i),u=c!==Qe?(t?.agents??{})[c]??null:null,p=Array.isArray(u?.allowlist)?u.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:c,selectedAgent:u,agents:i,allowlist:p,target:o,targetNodeId:l,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function Kv(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return r`
3699
3699
  <section class="card">
3700
3700
  <div class="row" style="justify-content: space-between; align-items: center;">
3701
3701
  <div>
@@ -3782,7 +3782,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3782
3782
  ${t?r`
3783
3783
  ${qv(e)}
3784
3784
  ${Gv(e)}
3785
- ${e.selectedScope===Ve?v:Vv(e)}
3785
+ ${e.selectedScope===Qe?v:Vv(e)}
3786
3786
  `:r`<div class="row" style="margin-top: 12px; gap: 12px;">
3787
3787
  <div class="muted">Load exec approvals to edit allowlists.</div>
3788
3788
  <button class="btn" ?disabled=${e.loading||!n} @click=${e.onLoad}>
@@ -3838,8 +3838,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
3838
3838
  <span class="label">Scope</span>
3839
3839
  <div class="row" style="gap: 8px; flex-wrap: wrap;">
3840
3840
  <button
3841
- class="btn btn--sm ${e.selectedScope===Ve?"active":""}"
3842
- @click=${()=>e.onSelectScope(Ve)}
3841
+ class="btn btn--sm ${e.selectedScope===Qe?"active":""}"
3842
+ @click=${()=>e.onSelectScope(Qe)}
3843
3843
  >
3844
3844
  Defaults
3845
3845
  </button>
@@ -3853,7 +3853,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
3853
3853
  `})}
3854
3854
  </div>
3855
3855
  </div>
3856
- `}function Gv(e){const t=e.selectedScope===Ve,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],a=typeof s.security=="string"?s.security:void 0,o=typeof s.ask=="string"?s.ask:void 0,l=typeof s.askFallback=="string"?s.askFallback:void 0,c=t?n.security:a??"__default__",u=t?n.ask:o??"__default__",p=t?n.askFallback:l??"__default__",g=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,h=g??n.autoAllowSkills,d=g==null;return r`
3856
+ `}function Gv(e){const t=e.selectedScope===Qe,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],a=typeof s.security=="string"?s.security:void 0,o=typeof s.ask=="string"?s.ask:void 0,l=typeof s.askFallback=="string"?s.askFallback:void 0,c=t?n.security:a??"__default__",u=t?n.ask:o??"__default__",p=t?n.askFallback:l??"__default__",g=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,h=g??n.autoAllowSkills,d=g==null;return r`
3857
3857
  <div class="list" style="margin-top: 16px;">
3858
3858
  <div class="list-item">
3859
3859
  <div class="list-main">
@@ -4475,7 +4475,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
4475
4475
  `:v}
4476
4476
  </div>
4477
4477
  </div>
4478
- `}const hm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),Wn=e=>e.trim().toLowerCase(),vm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},ot=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith("$")&&(t=t.slice(1));let n=1;t.endsWith("k")?(n=1e3,t=t.slice(0,-1)):t.endsWith("m")&&(n=1e6,t=t.slice(0,-1));const s=Number(t);return Number.isFinite(s)?s*n:null},aa=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const a=s.slice(0,i),o=s.slice(i+1);return{key:a,value:o,raw:s}}return{value:s,raw:s}}),mm=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),qo=e=>{const t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(const n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},Go=e=>{const t=new Set;e.model&&t.add(e.model.toLowerCase());for(const n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},bm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),ym=(e,t)=>{const n=Wn(t.value??"");if(!n)return!0;if(!t.key)return mm(e).some(i=>i.includes(n));switch(Wn(t.key)){case"agent":return e.agentId?.toLowerCase().includes(n)??!1;case"channel":return e.channel?.toLowerCase().includes(n)??!1;case"chat":return e.chatType?.toLowerCase().includes(n)??!1;case"provider":return qo(e).some(i=>i.includes(n));case"model":return Go(e).some(i=>i.includes(n));case"tool":return bm(e).some(i=>i.includes(n));case"label":return e.label?.toLowerCase().includes(n)??!1;case"key":case"session":case"id":if(n.includes("*")||n.includes("?")){const i=vm(n);return i.test(e.key)||(e.sessionId?i.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case"has":switch(n){case"tools":return(e.usage?.toolUsage?.totalCalls??0)>0;case"errors":return(e.usage?.messageCounts?.errors??0)>0;case"context":return!!e.contextWeight;case"usage":return!!e.usage;case"model":return Go(e).length>0;case"provider":return qo(e).length>0;default:return!0}case"mintokens":{const i=ot(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=ot(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=ot(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=ot(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=ot(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=ot(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},xm=(e,t)=>{const n=aa(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const a of n){if(!a.key)continue;const o=Wn(a.key);if(!hm.has(o)){s.push(`Unknown filter: ${a.key}`);continue}if(a.value===""&&s.push(`Missing value for ${a.key}`),o==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);a.value&&!l.has(Wn(a.value))&&s.push(`Unknown has:${a.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(o)&&a.value&&ot(a.value)===null&&s.push(`Invalid number for ${a.key}`)}return{sessions:e.filter(a=>n.every(o=>ym(a,o))),warnings:s}};function $m(e){const t=e.split(`
4478
+ `}const hm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),Wn=e=>e.trim().toLowerCase(),vm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},rt=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith("$")&&(t=t.slice(1));let n=1;t.endsWith("k")?(n=1e3,t=t.slice(0,-1)):t.endsWith("m")&&(n=1e6,t=t.slice(0,-1));const s=Number(t);return Number.isFinite(s)?s*n:null},aa=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const a=s.slice(0,i),o=s.slice(i+1);return{key:a,value:o,raw:s}}return{value:s,raw:s}}),mm=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),qo=e=>{const t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(const n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},Go=e=>{const t=new Set;e.model&&t.add(e.model.toLowerCase());for(const n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},bm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),ym=(e,t)=>{const n=Wn(t.value??"");if(!n)return!0;if(!t.key)return mm(e).some(i=>i.includes(n));switch(Wn(t.key)){case"agent":return e.agentId?.toLowerCase().includes(n)??!1;case"channel":return e.channel?.toLowerCase().includes(n)??!1;case"chat":return e.chatType?.toLowerCase().includes(n)??!1;case"provider":return qo(e).some(i=>i.includes(n));case"model":return Go(e).some(i=>i.includes(n));case"tool":return bm(e).some(i=>i.includes(n));case"label":return e.label?.toLowerCase().includes(n)??!1;case"key":case"session":case"id":if(n.includes("*")||n.includes("?")){const i=vm(n);return i.test(e.key)||(e.sessionId?i.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case"has":switch(n){case"tools":return(e.usage?.toolUsage?.totalCalls??0)>0;case"errors":return(e.usage?.messageCounts?.errors??0)>0;case"context":return!!e.contextWeight;case"usage":return!!e.usage;case"model":return Go(e).length>0;case"provider":return qo(e).length>0;default:return!0}case"mintokens":{const i=rt(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=rt(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=rt(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=rt(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=rt(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=rt(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},xm=(e,t)=>{const n=aa(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const a of n){if(!a.key)continue;const o=Wn(a.key);if(!hm.has(o)){s.push(`Unknown filter: ${a.key}`);continue}if(a.value===""&&s.push(`Missing value for ${a.key}`),o==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);a.value&&!l.has(Wn(a.value))&&s.push(`Unknown has:${a.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(o)&&a.value&&rt(a.value)===null&&s.push(`Invalid number for ${a.key}`)}return{sessions:e.filter(a=>n.every(o=>ym(a,o))),warnings:s}};function $m(e){const t=e.split(`
4479
4479
  `),n=new Map,s=[];for(const l of t){const c=/^\[Tool:\s*([^\]]+)\]/.exec(l.trim());if(c){const u=c[1];n.set(u,(n.get(u)??0)+1);continue}l.trim().startsWith("[Tool Result]")||s.push(l)}const i=Array.from(n.entries()).toSorted((l,c)=>c[1]-l[1]),a=i.reduce((l,[,c])=>l+c,0),o=i.length>0?`Tools: ${i.map(([l,c])=>`${l}×${c}`).join(", ")} (${a} calls)`:"";return{tools:i,summary:o,cleanContent:s.join(`
4480
4480
  `).trim()}}const wm=`
4481
4481
  .usage-page-header {
@@ -6387,7 +6387,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6387
6387
  height: 22px;
6388
6388
  }
6389
6389
  }
6390
- `,km=4;function it(e){return Math.round(e/km)}function O(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Sm(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function Am(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:24},()=>0);for(const i of e){const a=i.usage;if(!a?.messageCounts||a.messageCounts.total===0)continue;const o=a.firstActivity??i.updatedAt,l=a.lastActivity??i.updatedAt;if(!o||!l)continue;const c=Math.min(o,l),u=Math.max(o,l),g=Math.max(u-c,1)/6e4;let h=c;for(;h<u;){const d=new Date(h),f=oa(d,t),m=ra(d,t),k=Math.min(m.getTime(),u),w=Math.max((k-h)/6e4,0)/g;n[f]+=a.messageCounts.errors*w,s[f]+=a.messageCounts.total*w,h=k+1}}return s.map((i,a)=>{const o=n[a],l=i>0?o/i:0;return{hour:a,rate:l,errors:o,msgs:i}}).filter(i=>i.msgs>0&&i.errors>0).toSorted((i,a)=>a.rate-i.rate).slice(0,5).map(i=>({label:Sm(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const Cm=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function oa(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function Tm(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function ra(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function _m(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:7},()=>0);let i=0,a=!1;for(const l of e){const c=l.usage;if(!c||!c.totalTokens||c.totalTokens<=0)continue;i+=c.totalTokens;const u=c.firstActivity??l.updatedAt,p=c.lastActivity??l.updatedAt;if(!u||!p)continue;a=!0;const g=Math.min(u,p),h=Math.max(u,p),f=Math.max(h-g,1)/6e4;let m=g;for(;m<h;){const k=new Date(m),S=oa(k,t),w=Tm(k,t),C=ra(k,t),A=Math.min(C.getTime(),h),T=Math.max((A-m)/6e4,0)/f;n[S]+=c.totalTokens*T,s[w]+=c.totalTokens*T,m=A+1}}const o=Cm.map((l,c)=>({label:l,tokens:s[c]}));return{hasData:a,totalTokens:i,hourTotals:n,weekdayTotals:o}}function Em(e,t,n,s){const i=_m(e,t);if(!i.hasData)return r`
6390
+ `,km=4;function at(e){return Math.round(e/km)}function O(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Sm(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function Am(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:24},()=>0);for(const i of e){const a=i.usage;if(!a?.messageCounts||a.messageCounts.total===0)continue;const o=a.firstActivity??i.updatedAt,l=a.lastActivity??i.updatedAt;if(!o||!l)continue;const c=Math.min(o,l),u=Math.max(o,l),g=Math.max(u-c,1)/6e4;let h=c;for(;h<u;){const d=new Date(h),f=oa(d,t),m=ra(d,t),k=Math.min(m.getTime(),u),w=Math.max((k-h)/6e4,0)/g;n[f]+=a.messageCounts.errors*w,s[f]+=a.messageCounts.total*w,h=k+1}}return s.map((i,a)=>{const o=n[a],l=i>0?o/i:0;return{hour:a,rate:l,errors:o,msgs:i}}).filter(i=>i.msgs>0&&i.errors>0).toSorted((i,a)=>a.rate-i.rate).slice(0,5).map(i=>({label:Sm(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const Cm=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function oa(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function Tm(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function ra(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function _m(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:7},()=>0);let i=0,a=!1;for(const l of e){const c=l.usage;if(!c||!c.totalTokens||c.totalTokens<=0)continue;i+=c.totalTokens;const u=c.firstActivity??l.updatedAt,p=c.lastActivity??l.updatedAt;if(!u||!p)continue;a=!0;const g=Math.min(u,p),h=Math.max(u,p),f=Math.max(h-g,1)/6e4;let m=g;for(;m<h;){const k=new Date(m),S=oa(k,t),w=Tm(k,t),C=ra(k,t),A=Math.min(C.getTime(),h),T=Math.max((A-m)/6e4,0)/f;n[S]+=c.totalTokens*T,s[w]+=c.totalTokens*T,m=A+1}}const o=Cm.map((l,c)=>({label:l,tokens:s[c]}));return{hasData:a,totalTokens:i,hourTotals:n,weekdayTotals:o}}function Em(e,t,n,s){const i=_m(e,t);if(!i.hasData)return r`
6391
6391
  <div class="card usage-mosaic">
6392
6392
  <div class="usage-mosaic-header">
6393
6393
  <div>
@@ -6454,7 +6454,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6454
6454
  `}function q(e,t=2){return`$${e.toFixed(t)}`}function zs(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Lm(e){return!e||e<=0?"0s":e>=6e4?`${Math.round(e/6e4)}m`:e>=1e3?`${Math.round(e/1e3)}s`:`${Math.round(e)}ms`}function Bl(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const[,n,s,i]=t,a=new Date(Date.UTC(Number(n),Number(s)-1,Number(i)));return Number.isNaN(a.valueOf())?null:a}function Ul(e){const t=Bl(e);return t?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e}function Mm(e){const t=Bl(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):e}function zl(e){if(!e||e<=0)return"—";const t=Math.round(e/1e3),n=t%60,s=Math.floor(t/60)%60,i=Math.floor(t/3600);return i>0?`${i}h ${s}m`:s>0?`${s}m ${n}s`:`${n}s`}function Hs(e,t,n="text/plain"){const s=new Blob([t],{type:n}),i=URL.createObjectURL(s),a=document.createElement("a");a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function Im(e){return e.includes('"')||e.includes(",")||e.includes(`
6455
6455
  `)?`"${e.replace(/"/g,'""')}"`:e}function qn(e){return e.map(t=>t==null?"":Im(String(t))).join(",")}const _n=()=>({input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),En=(e,t)=>{e.input+=t.input??0,e.output+=t.output??0,e.cacheRead+=t.cacheRead??0,e.cacheWrite+=t.cacheWrite??0,e.totalTokens+=t.totalTokens??0,e.totalCost+=t.totalCost??0,e.inputCost+=t.inputCost??0,e.outputCost+=t.outputCost??0,e.cacheReadCost+=t.cacheReadCost??0,e.cacheWriteCost+=t.cacheWriteCost??0,e.missingCostEntries+=t.missingCostEntries??0},Rm=(e,t)=>{if(e.length===0)return t??{messages:{total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},tools:{totalCalls:0,uniqueTools:0,tools:[]},byModel:[],byProvider:[],byAgent:[],byChannel:[],daily:[]};const n={total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},s=new Map,i=new Map,a=new Map,o=new Map,l=new Map,c=new Map,u=new Map,p=new Map,g={count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};for(const h of e){const d=h.usage;if(d){if(d.messageCounts&&(n.total+=d.messageCounts.total,n.user+=d.messageCounts.user,n.assistant+=d.messageCounts.assistant,n.toolCalls+=d.messageCounts.toolCalls,n.toolResults+=d.messageCounts.toolResults,n.errors+=d.messageCounts.errors),d.toolUsage)for(const f of d.toolUsage.tools)s.set(f.name,(s.get(f.name)??0)+f.count);if(d.modelUsage)for(const f of d.modelUsage){const m=`${f.provider??"unknown"}::${f.model??"unknown"}`,k=i.get(m)??{provider:f.provider,model:f.model,count:0,totals:_n()};k.count+=f.count,En(k.totals,f.totals),i.set(m,k);const S=f.provider??"unknown",w=a.get(S)??{provider:f.provider,model:void 0,count:0,totals:_n()};w.count+=f.count,En(w.totals,f.totals),a.set(S,w)}if(d.latency){const{count:f,avgMs:m,minMs:k,maxMs:S,p95Ms:w}=d.latency;f>0&&(g.count+=f,g.sum+=m*f,g.min=Math.min(g.min,k),g.max=Math.max(g.max,S),g.p95Max=Math.max(g.p95Max,w))}if(h.agentId){const f=o.get(h.agentId)??_n();En(f,d),o.set(h.agentId,f)}if(h.channel){const f=l.get(h.channel)??_n();En(f,d),l.set(h.channel,f)}for(const f of d.dailyBreakdown??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.tokens+=f.tokens,m.cost+=f.cost,c.set(f.date,m)}for(const f of d.dailyMessageCounts??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.messages+=f.total,m.toolCalls+=f.toolCalls,m.errors+=f.errors,c.set(f.date,m)}for(const f of d.dailyLatency??[]){const m=u.get(f.date)??{date:f.date,count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};m.count+=f.count,m.sum+=f.avgMs*f.count,m.min=Math.min(m.min,f.minMs),m.max=Math.max(m.max,f.maxMs),m.p95Max=Math.max(m.p95Max,f.p95Ms),u.set(f.date,m)}for(const f of d.dailyModelUsage??[]){const m=`${f.date}::${f.provider??"unknown"}::${f.model??"unknown"}`,k=p.get(m)??{date:f.date,provider:f.provider,model:f.model,tokens:0,cost:0,count:0};k.tokens+=f.tokens,k.cost+=f.cost,k.count+=f.count,p.set(m,k)}}}return{messages:n,tools:{totalCalls:Array.from(s.values()).reduce((h,d)=>h+d,0),uniqueTools:s.size,tools:Array.from(s.entries()).map(([h,d])=>({name:h,count:d})).toSorted((h,d)=>d.count-h.count)},byModel:Array.from(i.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byProvider:Array.from(a.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byAgent:Array.from(o.entries()).map(([h,d])=>({agentId:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byChannel:Array.from(l.entries()).map(([h,d])=>({channel:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),latency:g.count>0?{count:g.count,avgMs:g.sum/g.count,minMs:g.min===Number.POSITIVE_INFINITY?0:g.min,maxMs:g.max,p95Ms:g.p95Max}:void 0,dailyLatency:Array.from(u.values()).map(h=>({date:h.date,count:h.count,avgMs:h.count?h.sum/h.count:0,minMs:h.min===Number.POSITIVE_INFINITY?0:h.min,maxMs:h.max,p95Ms:h.p95Max})).toSorted((h,d)=>h.date.localeCompare(d.date)),modelDaily:Array.from(p.values()).toSorted((h,d)=>h.date.localeCompare(d.date)||d.cost-h.cost),daily:Array.from(c.values()).toSorted((h,d)=>h.date.localeCompare(d.date))}},Pm=(e,t,n)=>{let s=0,i=0;for(const p of e){const g=p.usage?.durationMs??0;g>0&&(s+=g,i+=1)}const a=i?s/i:0,o=t&&s>0?t.totalTokens/(s/6e4):void 0,l=t&&s>0?t.totalCost/(s/6e4):void 0,c=n.messages.total?n.messages.errors/n.messages.total:0,u=n.daily.filter(p=>p.messages>0&&p.errors>0).map(p=>({date:p.date,errors:p.errors,messages:p.messages,rate:p.errors/p.messages})).toSorted((p,g)=>g.rate-p.rate||g.errors-p.errors)[0];return{durationSumMs:s,durationCount:i,avgDurationMs:a,throughputTokensPerMin:o,throughputCostPerMin:l,errorRate:c,peakErrorDay:u}},Dm=e=>{const t=[qn(["key","label","agentId","channel","provider","model","updatedAt","durationMs","messages","errors","toolCalls","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","totalCost"])];for(const n of e){const s=n.usage;t.push(qn([n.key,n.label??"",n.agentId??"",n.channel??"",n.modelProvider??n.providerOverride??"",n.model??n.modelOverride??"",n.updatedAt?new Date(n.updatedAt).toISOString():"",s?.durationMs??"",s?.messageCounts?.total??"",s?.messageCounts?.errors??"",s?.messageCounts?.toolCalls??"",s?.input??"",s?.output??"",s?.cacheRead??"",s?.cacheWrite??"",s?.totalTokens??"",s?.totalCost??""]))}return t.join(`
6456
6456
  `)},Fm=e=>{const t=[qn(["date","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","inputCost","outputCost","cacheReadCost","cacheWriteCost","totalCost"])];for(const n of e)t.push(qn([n.date,n.input,n.output,n.cacheRead,n.cacheWrite,n.totalTokens,n.inputCost??"",n.outputCost??"",n.cacheReadCost??"",n.cacheWriteCost??"",n.totalCost]));return t.join(`
6457
- `)},Nm=(e,t,n)=>{const s=e.trim();if(!s)return[];const i=s.length?s.split(/\s+/):[],a=i.length?i[i.length-1]:"",[o,l]=a.includes(":")?[a.slice(0,a.indexOf(":")),a.slice(a.indexOf(":")+1)]:["",""],c=o.toLowerCase(),u=l.toLowerCase(),p=w=>{const C=new Set;for(const A of w)A&&C.add(A);return Array.from(C)},g=p(t.map(w=>w.agentId)).slice(0,6),h=p(t.map(w=>w.channel)).slice(0,6),d=p([...t.map(w=>w.modelProvider),...t.map(w=>w.providerOverride),...n?.byProvider.map(w=>w.provider)??[]]).slice(0,6),f=p([...t.map(w=>w.model),...n?.byModel.map(w=>w.model)??[]]).slice(0,6),m=p(n?.tools.tools.map(w=>w.name)??[]).slice(0,6);if(!c)return[{label:"agent:",value:"agent:"},{label:"channel:",value:"channel:"},{label:"provider:",value:"provider:"},{label:"model:",value:"model:"},{label:"tool:",value:"tool:"},{label:"has:errors",value:"has:errors"},{label:"has:tools",value:"has:tools"},{label:"minTokens:",value:"minTokens:"},{label:"maxCost:",value:"maxCost:"}];const k=[],S=(w,C)=>{for(const A of C)(!u||A.toLowerCase().includes(u))&&k.push({label:`${w}:${A}`,value:`${w}:${A}`})};switch(c){case"agent":S("agent",g);break;case"channel":S("channel",h);break;case"provider":S("provider",d);break;case"model":S("model",f);break;case"tool":S("tool",m);break;case"has":["errors","tools","context","usage","model","provider"].forEach(w=>{(!u||w.includes(u))&&k.push({label:`has:${w}`,value:`has:${w}`})});break}return k},Om=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/);return s[s.length-1]=t,`${s.join(" ")} `},rt=e=>e.trim().toLowerCase(),Bm=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/),i=s[s.length-1]??"",a=t.includes(":")?t.split(":")[0]:null,o=i.includes(":")?i.split(":")[0]:null;return i.endsWith(":")&&a&&o===a?(s[s.length-1]=t,`${s.join(" ")} `):s.includes(t)?`${s.join(" ")} `:`${s.join(" ")} ${t} `},Vo=(e,t)=>{const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>i!==t);return s.length?`${s.join(" ")} `:""},Qo=(e,t,n)=>{const s=rt(t),a=[...aa(e).filter(o=>rt(o.key??"")!==s).map(o=>o.raw),...n.map(o=>`${t}:${o}`)];return a.length?`${a.join(" ")} `:""};function ge(e,t){return t===0?0:e/t*100}function Um(e){const t=e.totalCost||0;return{input:{tokens:e.input,cost:e.inputCost||0,pct:ge(e.inputCost||0,t)},output:{tokens:e.output,cost:e.outputCost||0,pct:ge(e.outputCost||0,t)},cacheRead:{tokens:e.cacheRead,cost:e.cacheReadCost||0,pct:ge(e.cacheReadCost||0,t)},cacheWrite:{tokens:e.cacheWrite,cost:e.cacheWriteCost||0,pct:ge(e.cacheWriteCost||0,t)},totalCost:t}}function zm(e,t,n,s,i,a,o,l){if(!(e.length>0||t.length>0||n.length>0))return v;const u=n.length===1?s.find(f=>f.key===n[0]):null,p=u?(u.label||u.key).slice(0,20)+((u.label||u.key).length>20?"…":""):n.length===1?n[0].slice(0,8)+"…":`${n.length} sessions`,g=u?u.label||u.key:n.length===1?n[0]:n.join(", "),h=e.length===1?e[0]:`${e.length} days`,d=t.length===1?`${t[0]}:00`:`${t.length} hours`;return r`
6457
+ `)},Nm=(e,t,n)=>{const s=e.trim();if(!s)return[];const i=s.length?s.split(/\s+/):[],a=i.length?i[i.length-1]:"",[o,l]=a.includes(":")?[a.slice(0,a.indexOf(":")),a.slice(a.indexOf(":")+1)]:["",""],c=o.toLowerCase(),u=l.toLowerCase(),p=w=>{const C=new Set;for(const A of w)A&&C.add(A);return Array.from(C)},g=p(t.map(w=>w.agentId)).slice(0,6),h=p(t.map(w=>w.channel)).slice(0,6),d=p([...t.map(w=>w.modelProvider),...t.map(w=>w.providerOverride),...n?.byProvider.map(w=>w.provider)??[]]).slice(0,6),f=p([...t.map(w=>w.model),...n?.byModel.map(w=>w.model)??[]]).slice(0,6),m=p(n?.tools.tools.map(w=>w.name)??[]).slice(0,6);if(!c)return[{label:"agent:",value:"agent:"},{label:"channel:",value:"channel:"},{label:"provider:",value:"provider:"},{label:"model:",value:"model:"},{label:"tool:",value:"tool:"},{label:"has:errors",value:"has:errors"},{label:"has:tools",value:"has:tools"},{label:"minTokens:",value:"minTokens:"},{label:"maxCost:",value:"maxCost:"}];const k=[],S=(w,C)=>{for(const A of C)(!u||A.toLowerCase().includes(u))&&k.push({label:`${w}:${A}`,value:`${w}:${A}`})};switch(c){case"agent":S("agent",g);break;case"channel":S("channel",h);break;case"provider":S("provider",d);break;case"model":S("model",f);break;case"tool":S("tool",m);break;case"has":["errors","tools","context","usage","model","provider"].forEach(w=>{(!u||w.includes(u))&&k.push({label:`has:${w}`,value:`has:${w}`})});break}return k},Om=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/);return s[s.length-1]=t,`${s.join(" ")} `},lt=e=>e.trim().toLowerCase(),Bm=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/),i=s[s.length-1]??"",a=t.includes(":")?t.split(":")[0]:null,o=i.includes(":")?i.split(":")[0]:null;return i.endsWith(":")&&a&&o===a?(s[s.length-1]=t,`${s.join(" ")} `):s.includes(t)?`${s.join(" ")} `:`${s.join(" ")} ${t} `},Vo=(e,t)=>{const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>i!==t);return s.length?`${s.join(" ")} `:""},Qo=(e,t,n)=>{const s=lt(t),a=[...aa(e).filter(o=>lt(o.key??"")!==s).map(o=>o.raw),...n.map(o=>`${t}:${o}`)];return a.length?`${a.join(" ")} `:""};function ge(e,t){return t===0?0:e/t*100}function Um(e){const t=e.totalCost||0;return{input:{tokens:e.input,cost:e.inputCost||0,pct:ge(e.inputCost||0,t)},output:{tokens:e.output,cost:e.outputCost||0,pct:ge(e.outputCost||0,t)},cacheRead:{tokens:e.cacheRead,cost:e.cacheReadCost||0,pct:ge(e.cacheReadCost||0,t)},cacheWrite:{tokens:e.cacheWrite,cost:e.cacheWriteCost||0,pct:ge(e.cacheWriteCost||0,t)},totalCost:t}}function zm(e,t,n,s,i,a,o,l){if(!(e.length>0||t.length>0||n.length>0))return v;const u=n.length===1?s.find(f=>f.key===n[0]):null,p=u?(u.label||u.key).slice(0,20)+((u.label||u.key).length>20?"…":""):n.length===1?n[0].slice(0,8)+"…":`${n.length} sessions`,g=u?u.label||u.key:n.length===1?n[0]:n.join(", "),h=e.length===1?e[0]:`${e.length} days`,d=t.length===1?`${t[0]}:00`:`${t.length} hours`;return r`
6458
6458
  <div class="active-filters">
6459
6459
  ${e.length>0?r`
6460
6460
  <div class="filter-chip">
@@ -6562,7 +6562,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6562
6562
  Total: ${s?O(e.totalTokens):q(e.totalCost)}
6563
6563
  </div>
6564
6564
  </div>
6565
- `}function lt(e,t,n){return r`
6565
+ `}function ct(e,t,n){return r`
6566
6566
  <div class="usage-insight-card">
6567
6567
  <div class="usage-insight-title">${e}</div>
6568
6568
  ${t.length===0?r`<div class="muted">${n}</div>`:r`
@@ -6678,11 +6678,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
6678
6678
  </div>
6679
6679
  </div>
6680
6680
  <div class="usage-insights-grid">
6681
- ${lt("Top Models",T,"No model data")}
6682
- ${lt("Top Providers",I,"No provider data")}
6683
- ${lt("Top Tools",z,"No tool calls")}
6684
- ${lt("Top Agents",Y,"No agent data")}
6685
- ${lt("Top Channels",se,"No channel data")}
6681
+ ${ct("Top Models",T,"No model data")}
6682
+ ${ct("Top Providers",I,"No provider data")}
6683
+ ${ct("Top Tools",z,"No tool calls")}
6684
+ ${ct("Top Agents",Y,"No agent data")}
6685
+ ${ct("Top Channels",se,"No channel data")}
6686
6686
  ${Yo("Peak Error Days",_,"No error data")}
6687
6687
  ${Yo("Peak Error Hours",i,"No error data")}
6688
6688
  </div>
@@ -6855,8 +6855,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
6855
6855
  </div>
6856
6856
  </div>
6857
6857
  <div class="usage-insights-grid" style="margin-top: 12px;">
6858
- ${lt("Top Tools",i,"No tool calls")}
6859
- ${lt("Model Mix",a,"No model data")}
6858
+ ${ct("Top Tools",i,"No tool calls")}
6859
+ ${ct("Model Mix",a,"No model data")}
6860
6860
  </div>
6861
6861
  `}function Vm(e,t,n,s,i,a,o,l,c,u,p,g,h,d,f,m,k,S,w,C,A,_,T){const I=e.label||e.key,z=I.length>50?I.slice(0,50)+"…":I,Y=e.usage;return r`
6862
6862
  <div class="card session-detail-panel">
@@ -6982,7 +6982,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
6982
6982
  <div class="context-details-panel">
6983
6983
  <div class="muted" style="padding: 20px; text-align: center">No context data</div>
6984
6984
  </div>
6985
- `;const i=it(e.systemPrompt.chars),a=it(e.skills.promptChars),o=it(e.tools.listChars+e.tools.schemaChars),l=it(e.injectedWorkspaceFiles.reduce((C,A)=>C+A.injectedChars,0)),c=i+a+o+l;let u="";if(t&&t.totalTokens>0){const C=t.input+t.cacheRead;C>0&&(u=`~${Math.min(c/C*100,100).toFixed(0)}% of input`)}const p=e.skills.entries.toSorted((C,A)=>A.blockChars-C.blockChars),g=e.tools.entries.toSorted((C,A)=>A.summaryChars+A.schemaChars-(C.summaryChars+C.schemaChars)),h=e.injectedWorkspaceFiles.toSorted((C,A)=>A.injectedChars-C.injectedChars),d=4,f=n,m=f?p:p.slice(0,d),k=f?g:g.slice(0,d),S=f?h:h.slice(0,d),w=p.length>d||g.length>d||h.length>d;return r`
6985
+ `;const i=at(e.systemPrompt.chars),a=at(e.skills.promptChars),o=at(e.tools.listChars+e.tools.schemaChars),l=at(e.injectedWorkspaceFiles.reduce((C,A)=>C+A.injectedChars,0)),c=i+a+o+l;let u="";if(t&&t.totalTokens>0){const C=t.input+t.cacheRead;C>0&&(u=`~${Math.min(c/C*100,100).toFixed(0)}% of input`)}const p=e.skills.entries.toSorted((C,A)=>A.blockChars-C.blockChars),g=e.tools.entries.toSorted((C,A)=>A.summaryChars+A.schemaChars-(C.summaryChars+C.schemaChars)),h=e.injectedWorkspaceFiles.toSorted((C,A)=>A.injectedChars-C.injectedChars),d=4,f=n,m=f?p:p.slice(0,d),k=f?g:g.slice(0,d),S=f?h:h.slice(0,d),w=p.length>d||g.length>d||h.length>d;return r`
6986
6986
  <div class="context-details-panel">
6987
6987
  <div class="context-breakdown-header">
6988
6988
  <div class="card-title" style="font-size: 13px;">System Prompt Breakdown</div>
@@ -7012,7 +7012,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7012
7012
  ${m.map(A=>r`
7013
7013
  <div class="context-breakdown-item">
7014
7014
  <span class="mono">${A.name}</span>
7015
- <span class="muted">~${O(it(A.blockChars))}</span>
7015
+ <span class="muted">~${O(at(A.blockChars))}</span>
7016
7016
  </div>
7017
7017
  `)}
7018
7018
  </div>
@@ -7026,7 +7026,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7026
7026
  ${k.map(A=>r`
7027
7027
  <div class="context-breakdown-item">
7028
7028
  <span class="mono">${A.name}</span>
7029
- <span class="muted">~${O(it(A.summaryChars+A.schemaChars))}</span>
7029
+ <span class="muted">~${O(at(A.summaryChars+A.schemaChars))}</span>
7030
7030
  </div>
7031
7031
  `)}
7032
7032
  </div>
@@ -7040,7 +7040,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7040
7040
  ${S.map(A=>r`
7041
7041
  <div class="context-breakdown-item">
7042
7042
  <span class="mono">${A.name}</span>
7043
- <span class="muted">~${O(it(A.injectedChars))}</span>
7043
+ <span class="muted">~${O(at(A.injectedChars))}</span>
7044
7044
  </div>
7045
7045
  `)}
7046
7046
  </div>
@@ -7175,7 +7175,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7175
7175
  </div>
7176
7176
  </div>
7177
7177
  </section>
7178
- `;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((M,R)=>{const P=t?M.usage?.totalTokens??0:M.usage?.totalCost??0;return(t?R.usage?.totalTokens??0:R.usage?.totalCost??0)-P}),a=e.selectedDays.length>0?i.filter(M=>{if(M.usage?.activityDates?.length)return M.usage.activityDates.some(K=>e.selectedDays.includes(K));if(!M.updatedAt)return!1;const R=new Date(M.updatedAt),P=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(P)}):i,o=(M,R)=>{if(R.length===0)return!0;const P=M.usage,K=P?.firstActivity??M.updatedAt,xe=P?.lastActivity??M.updatedAt;if(!K||!xe)return!1;const Q=Math.min(K,xe),we=Math.max(K,xe);let X=Q;for(;X<=we;){const pe=new Date(X),Fe=oa(pe,e.timeZone);if(R.includes(Fe))return!0;const Ne=ra(pe,e.timeZone);X=Math.min(Ne.getTime(),we)+1}return!1},l=e.selectedHours.length>0?a.filter(M=>o(M,e.selectedHours)):a,c=xm(l,e.query),u=c.sessions,p=c.warnings,g=Nm(e.queryDraft,i,e.aggregates),h=aa(e.query),d=M=>{const R=rt(M);return h.filter(P=>rt(P.key??"")===R).map(P=>P.value).filter(Boolean)},f=M=>{const R=new Set;for(const P of M)P&&R.add(P);return Array.from(R)},m=f(i.map(M=>M.agentId)).slice(0,12),k=f(i.map(M=>M.channel)).slice(0,12),S=f([...i.map(M=>M.modelProvider),...i.map(M=>M.providerOverride),...e.aggregates?.byProvider.map(M=>M.provider)??[]]).slice(0,12),w=f([...i.map(M=>M.model),...e.aggregates?.byModel.map(M=>M.model)??[]]).slice(0,12),C=f(e.aggregates?.tools.tools.map(M=>M.name)??[]).slice(0,12),A=e.selectedSessions.length===1?e.sessions.find(M=>M.key===e.selectedSessions[0])??u.find(M=>M.key===e.selectedSessions[0]):null,_=M=>M.reduce((R,P)=>(P.usage&&(R.input+=P.usage.input,R.output+=P.usage.output,R.cacheRead+=P.usage.cacheRead,R.cacheWrite+=P.usage.cacheWrite,R.totalTokens+=P.usage.totalTokens,R.totalCost+=P.usage.totalCost,R.inputCost+=P.usage.inputCost??0,R.outputCost+=P.usage.outputCost??0,R.cacheReadCost+=P.usage.cacheReadCost??0,R.cacheWriteCost+=P.usage.cacheWriteCost??0,R.missingCostEntries+=P.usage.missingCostEntries??0),R),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),T=M=>e.costDaily.filter(P=>M.includes(P.date)).reduce((P,K)=>(P.input+=K.input,P.output+=K.output,P.cacheRead+=K.cacheRead,P.cacheWrite+=K.cacheWrite,P.totalTokens+=K.totalTokens,P.totalCost+=K.totalCost,P.inputCost+=K.inputCost??0,P.outputCost+=K.outputCost??0,P.cacheReadCost+=K.cacheReadCost??0,P.cacheWriteCost+=K.cacheWriteCost??0,P),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0});let I,z;const Y=i.length;if(e.selectedSessions.length>0){const M=u.filter(R=>e.selectedSessions.includes(R.key));I=_(M),z=M.length}else e.selectedDays.length>0&&e.selectedHours.length===0?(I=T(e.selectedDays),z=u.length):e.selectedHours.length>0||n?(I=_(u),z=u.length):(I=e.totals,z=Y);const se=e.selectedSessions.length>0?u.filter(M=>e.selectedSessions.includes(M.key)):n||e.selectedHours.length>0?u:e.selectedDays.length>0?a:i,F=Rm(se,e.aggregates),H=e.selectedSessions.length>0?(()=>{const M=u.filter(P=>e.selectedSessions.includes(P.key)),R=new Set;for(const P of M)for(const K of P.usage?.activityDates??[])R.add(K);return R.size>0?e.costDaily.filter(P=>R.has(P.date)):e.costDaily})():e.costDaily,ce=Pm(se,I,F),E=!e.loading&&!e.totals&&e.sessions.length===0,B=(I?.missingCostEntries??0)>0||(I?I.totalTokens>0&&I.totalCost===0&&I.input+I.output+I.cacheRead+I.cacheWrite>0:!1),ie=[{label:"Today",days:1},{label:"7d",days:7},{label:"30d",days:30}],ae=M=>{const R=new Date,P=new Date;P.setDate(P.getDate()-(M-1)),e.onStartDateChange(zs(P)),e.onEndDateChange(zs(R))},J=(M,R,P)=>{if(P.length===0)return v;const K=d(M),xe=new Set(K.map(X=>rt(X))),Q=P.length>0&&P.every(X=>xe.has(rt(X))),we=K.length;return r`
7178
+ `;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((M,R)=>{const P=t?M.usage?.totalTokens??0:M.usage?.totalCost??0;return(t?R.usage?.totalTokens??0:R.usage?.totalCost??0)-P}),a=e.selectedDays.length>0?i.filter(M=>{if(M.usage?.activityDates?.length)return M.usage.activityDates.some(K=>e.selectedDays.includes(K));if(!M.updatedAt)return!1;const R=new Date(M.updatedAt),P=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(P)}):i,o=(M,R)=>{if(R.length===0)return!0;const P=M.usage,K=P?.firstActivity??M.updatedAt,xe=P?.lastActivity??M.updatedAt;if(!K||!xe)return!1;const Q=Math.min(K,xe),we=Math.max(K,xe);let X=Q;for(;X<=we;){const pe=new Date(X),Fe=oa(pe,e.timeZone);if(R.includes(Fe))return!0;const Ne=ra(pe,e.timeZone);X=Math.min(Ne.getTime(),we)+1}return!1},l=e.selectedHours.length>0?a.filter(M=>o(M,e.selectedHours)):a,c=xm(l,e.query),u=c.sessions,p=c.warnings,g=Nm(e.queryDraft,i,e.aggregates),h=aa(e.query),d=M=>{const R=lt(M);return h.filter(P=>lt(P.key??"")===R).map(P=>P.value).filter(Boolean)},f=M=>{const R=new Set;for(const P of M)P&&R.add(P);return Array.from(R)},m=f(i.map(M=>M.agentId)).slice(0,12),k=f(i.map(M=>M.channel)).slice(0,12),S=f([...i.map(M=>M.modelProvider),...i.map(M=>M.providerOverride),...e.aggregates?.byProvider.map(M=>M.provider)??[]]).slice(0,12),w=f([...i.map(M=>M.model),...e.aggregates?.byModel.map(M=>M.model)??[]]).slice(0,12),C=f(e.aggregates?.tools.tools.map(M=>M.name)??[]).slice(0,12),A=e.selectedSessions.length===1?e.sessions.find(M=>M.key===e.selectedSessions[0])??u.find(M=>M.key===e.selectedSessions[0]):null,_=M=>M.reduce((R,P)=>(P.usage&&(R.input+=P.usage.input,R.output+=P.usage.output,R.cacheRead+=P.usage.cacheRead,R.cacheWrite+=P.usage.cacheWrite,R.totalTokens+=P.usage.totalTokens,R.totalCost+=P.usage.totalCost,R.inputCost+=P.usage.inputCost??0,R.outputCost+=P.usage.outputCost??0,R.cacheReadCost+=P.usage.cacheReadCost??0,R.cacheWriteCost+=P.usage.cacheWriteCost??0,R.missingCostEntries+=P.usage.missingCostEntries??0),R),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),T=M=>e.costDaily.filter(P=>M.includes(P.date)).reduce((P,K)=>(P.input+=K.input,P.output+=K.output,P.cacheRead+=K.cacheRead,P.cacheWrite+=K.cacheWrite,P.totalTokens+=K.totalTokens,P.totalCost+=K.totalCost,P.inputCost+=K.inputCost??0,P.outputCost+=K.outputCost??0,P.cacheReadCost+=K.cacheReadCost??0,P.cacheWriteCost+=K.cacheWriteCost??0,P),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0});let I,z;const Y=i.length;if(e.selectedSessions.length>0){const M=u.filter(R=>e.selectedSessions.includes(R.key));I=_(M),z=M.length}else e.selectedDays.length>0&&e.selectedHours.length===0?(I=T(e.selectedDays),z=u.length):e.selectedHours.length>0||n?(I=_(u),z=u.length):(I=e.totals,z=Y);const se=e.selectedSessions.length>0?u.filter(M=>e.selectedSessions.includes(M.key)):n||e.selectedHours.length>0?u:e.selectedDays.length>0?a:i,F=Rm(se,e.aggregates),H=e.selectedSessions.length>0?(()=>{const M=u.filter(P=>e.selectedSessions.includes(P.key)),R=new Set;for(const P of M)for(const K of P.usage?.activityDates??[])R.add(K);return R.size>0?e.costDaily.filter(P=>R.has(P.date)):e.costDaily})():e.costDaily,ce=Pm(se,I,F),E=!e.loading&&!e.totals&&e.sessions.length===0,B=(I?.missingCostEntries??0)>0||(I?I.totalTokens>0&&I.totalCost===0&&I.input+I.output+I.cacheRead+I.cacheWrite>0:!1),ie=[{label:"Today",days:1},{label:"7d",days:7},{label:"30d",days:30}],ae=M=>{const R=new Date,P=new Date;P.setDate(P.getDate()-(M-1)),e.onStartDateChange(zs(P)),e.onEndDateChange(zs(R))},J=(M,R,P)=>{if(P.length===0)return v;const K=d(M),xe=new Set(K.map(X=>lt(X))),Q=P.length>0&&P.every(X=>xe.has(lt(X))),we=K.length;return r`
7179
7179
  <details
7180
7180
  class="usage-filter-select"
7181
7181
  @toggle=${X=>{const pe=X.currentTarget;if(!pe.open)return;const Fe=Ne=>{Ne.composedPath().includes(pe)||(pe.open=!1,window.removeEventListener("click",Fe,!0))};window.addEventListener("click",Fe,!0)}}
@@ -7204,12 +7204,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
7204
7204
  </button>
7205
7205
  </div>
7206
7206
  <div class="usage-filter-options">
7207
- ${P.map(X=>{const pe=xe.has(rt(X));return r`
7207
+ ${P.map(X=>{const pe=xe.has(lt(X));return r`
7208
7208
  <label class="usage-filter-option">
7209
7209
  <input
7210
7210
  type="checkbox"
7211
7211
  .checked=${pe}
7212
- @change=${Fe=>{const Ne=Fe.target,Je=`${M}:${X}`;e.onQueryDraftChange(Ne.checked?Bm(e.queryDraft,Je):Vo(e.queryDraft,Je))}}
7212
+ @change=${Fe=>{const Ne=Fe.target,Xe=`${M}:${X}`;e.onQueryDraftChange(Ne.checked?Bm(e.queryDraft,Xe):Vo(e.queryDraft,Xe))}}
7213
7213
  />
7214
7214
  <span>${X}</span>
7215
7215
  </label>
@@ -7455,10 +7455,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
7455
7455
  </button>
7456
7456
  <div class="brand">
7457
7457
  <div class="brand-logo">
7458
- <img src=${g?`${g}/favicon.svg`:"/favicon.svg"} alt="OpenClaw" />
7458
+ <img src=${g?`${g}/favicon.svg`:"/favicon.svg"} alt=${"ClawBrah"} />
7459
7459
  </div>
7460
7460
  <div class="brand-text">
7461
- <div class="brand-title">OPENCLAW</div>
7461
+ <div class="brand-title">${"CLAWBRAH"}</div>
7462
7462
  <div class="brand-sub">Gateway Dashboard</div>
7463
7463
  </div>
7464
7464
  </div>
@@ -7534,7 +7534,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
7534
7534
 
7535
7535
  ${e.tab==="skills"?pm({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:()=>rn(e,{clearMessages:!0}),onToggle:(d,f)=>Yd(e,d,f),onEdit:(d,f)=>Qd(e,d,f),onSaveKey:d=>Zd(e,d),onInstall:(d,f,m)=>Jd(e,d,f,m)}):v}
7536
7536
 
7537
- ${e.tab==="nodes"?Lv({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:()=>Jn(e),onDevicesRefresh:()=>Ze(e),onDeviceApprove:d=>Nd(e,d),onDeviceReject:d=>Od(e,d),onDeviceRotate:(d,f,m)=>Bd(e,{deviceId:d,role:f,scopes:m}),onDeviceRevoke:(d,f)=>Ud(e,{deviceId:d,role:f}),onLoadConfig:()=>Ee(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Ni(e,d)},onBindDefault:d=>{d?$e(e,["tools","exec","node"],d):ze(e,["tools","exec","node"])},onBindAgent:(d,f)=>{const m=["agents","list",d,"tools","exec","node"];f?$e(e,m,f):ze(e,m)},onSaveBindings:()=>Mn(e),onExecApprovalsTargetChange:(d,f)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=f,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,f)=>Wd(e,d,f),onExecApprovalsRemove:d=>qd(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return jd(e,d)}}):v}
7537
+ ${e.tab==="nodes"?Lv({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:()=>Jn(e),onDevicesRefresh:()=>Je(e),onDeviceApprove:d=>Nd(e,d),onDeviceReject:d=>Od(e,d),onDeviceRotate:(d,f,m)=>Bd(e,{deviceId:d,role:f,scopes:m}),onDeviceRevoke:(d,f)=>Ud(e,{deviceId:d,role:f}),onLoadConfig:()=>Ee(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Ni(e,d)},onBindDefault:d=>{d?$e(e,["tools","exec","node"],d):ze(e,["tools","exec","node"])},onBindAgent:(d,f)=>{const m=["agents","list",d,"tools","exec","node"];f?$e(e,m,f):ze(e,m)},onSaveBindings:()=>Mn(e),onExecApprovalsTargetChange:(d,f)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=f,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,f)=>Wd(e,d,f),onExecApprovalsRemove:d=>qd(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return jd(e,d)}}):v}
7538
7538
 
7539
7539
  ${e.tab==="chat"?lv({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(),nn(e),ni(e)},thinkingLevel:e.chatThinkingLevel,showThinking:l,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:u,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:i,error:e.lastError,sessions:e.sessionsResult,focusMode:o,onRefresh:()=>(e.resetToolStream(),Promise.all([nn(e),ni(e)])),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:d=>e.handleChatScroll(d),onDraftChange:d=>e.chatMessage=d,attachments:e.chatAttachments,onAttachmentsChange:d=>e.chatAttachments=d,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:d=>e.removeQueuedMessage(d),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),showNewMessages:e.chatNewMessagesBelow,onScrollToBottom:()=>e.scrollToBottom(),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:d=>e.handleOpenSidebar(d),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:d=>e.handleSplitRatioChange(d),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar}):v}
7540
7540
 
@@ -7549,5 +7549,5 @@ ${JSON.stringify(e.issues,null,2)}</pre
7549
7549
  </div>
7550
7550
  `}var sb=Object.defineProperty,ib=Object.getOwnPropertyDescriptor,x=(e,t,n,s)=>{for(var i=s>1?void 0:s?ib(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&&sb(t,n,i),i};const js=eg();function ab(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let y=class extends Tt{constructor(){super(...arguments),this.settings=su(),this.password="",this.tab="chat",this.onboarding=ab(),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=js.name,this.assistantAvatar=js.avatar,this.assistantAgentId=js.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.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
7551
7551
  }
7552
- `,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Yu},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...Qu},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>vu(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ug(this)}firstUpdated(){gg(this)}disconnectedCallback(){pg(this),super.disconnectedCallback()}updated(e){fg(this,e)}connect(){tl(this)}handleChatScroll(e){Kc(this,e)}handleLogsScroll(e){jc(this,e)}exportLogs(e,t){Wc(e,t)}resetToolStream(){ss(this)}resetChatScroll(){Na(this)}scrollToBottom(){Na(this),an(this,!0)}async loadAssistantIdentity(){await Jr(this)}applySettings(e){ht(this,e)}setTab(e){cu(this,e)}setTheme(e,t){du(this,e,t)}async loadOverview(){await jr(this)}async loadCron(){await Un(this)}async handleAbortChat(){await Vr(this)}removeQueuedMessage(e){ju(this,e)}async handleSendChat(e,t){await Wu(this,e,t)}async handleWhatsAppStart(e){await Mc(this,e)}async handleWhatsAppWait(){await Ic(this)}async handleWhatsAppLogout(){await Rc(this)}async handleChannelConfigSave(){await Pc(this)}async handleChannelConfigReload(){await Dc(this)}handleNostrProfileEdit(e,t){Nc(this,e,t)}handleNostrProfileCancel(){Oc(this)}handleNostrProfileFieldChange(e,t){Bc(this,e,t)}async handleNostrProfileSave(){await zc(this)}async handleNostrProfileImport(){await Hc(this)}handleNostrProfileToggleAdvanced(){Uc(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,ht(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return nb(this)}};x([$()],y.prototype,"settings",2);x([$()],y.prototype,"password",2);x([$()],y.prototype,"tab",2);x([$()],y.prototype,"onboarding",2);x([$()],y.prototype,"connected",2);x([$()],y.prototype,"theme",2);x([$()],y.prototype,"themeResolved",2);x([$()],y.prototype,"hello",2);x([$()],y.prototype,"lastError",2);x([$()],y.prototype,"eventLog",2);x([$()],y.prototype,"assistantName",2);x([$()],y.prototype,"assistantAvatar",2);x([$()],y.prototype,"assistantAgentId",2);x([$()],y.prototype,"sessionKey",2);x([$()],y.prototype,"chatLoading",2);x([$()],y.prototype,"chatSending",2);x([$()],y.prototype,"chatMessage",2);x([$()],y.prototype,"chatMessages",2);x([$()],y.prototype,"chatToolMessages",2);x([$()],y.prototype,"chatStream",2);x([$()],y.prototype,"chatStreamStartedAt",2);x([$()],y.prototype,"chatRunId",2);x([$()],y.prototype,"compactionStatus",2);x([$()],y.prototype,"chatAvatarUrl",2);x([$()],y.prototype,"chatThinkingLevel",2);x([$()],y.prototype,"chatQueue",2);x([$()],y.prototype,"chatAttachments",2);x([$()],y.prototype,"sidebarOpen",2);x([$()],y.prototype,"sidebarContent",2);x([$()],y.prototype,"sidebarError",2);x([$()],y.prototype,"splitRatio",2);x([$()],y.prototype,"nodesLoading",2);x([$()],y.prototype,"nodes",2);x([$()],y.prototype,"devicesLoading",2);x([$()],y.prototype,"devicesError",2);x([$()],y.prototype,"devicesList",2);x([$()],y.prototype,"execApprovalsLoading",2);x([$()],y.prototype,"execApprovalsSaving",2);x([$()],y.prototype,"execApprovalsDirty",2);x([$()],y.prototype,"execApprovalsSnapshot",2);x([$()],y.prototype,"execApprovalsForm",2);x([$()],y.prototype,"execApprovalsSelectedAgent",2);x([$()],y.prototype,"execApprovalsTarget",2);x([$()],y.prototype,"execApprovalsTargetNodeId",2);x([$()],y.prototype,"execApprovalQueue",2);x([$()],y.prototype,"execApprovalBusy",2);x([$()],y.prototype,"execApprovalError",2);x([$()],y.prototype,"pendingGatewayUrl",2);x([$()],y.prototype,"configLoading",2);x([$()],y.prototype,"configRaw",2);x([$()],y.prototype,"configRawOriginal",2);x([$()],y.prototype,"configValid",2);x([$()],y.prototype,"configIssues",2);x([$()],y.prototype,"configSaving",2);x([$()],y.prototype,"configApplying",2);x([$()],y.prototype,"updateRunning",2);x([$()],y.prototype,"applySessionKey",2);x([$()],y.prototype,"configSnapshot",2);x([$()],y.prototype,"configSchema",2);x([$()],y.prototype,"configSchemaVersion",2);x([$()],y.prototype,"configSchemaLoading",2);x([$()],y.prototype,"configUiHints",2);x([$()],y.prototype,"configForm",2);x([$()],y.prototype,"configFormOriginal",2);x([$()],y.prototype,"configFormDirty",2);x([$()],y.prototype,"configFormMode",2);x([$()],y.prototype,"configSearchQuery",2);x([$()],y.prototype,"configActiveSection",2);x([$()],y.prototype,"configActiveSubsection",2);x([$()],y.prototype,"channelsLoading",2);x([$()],y.prototype,"channelsSnapshot",2);x([$()],y.prototype,"channelsError",2);x([$()],y.prototype,"channelsLastSuccess",2);x([$()],y.prototype,"whatsappLoginMessage",2);x([$()],y.prototype,"whatsappLoginQrDataUrl",2);x([$()],y.prototype,"whatsappLoginConnected",2);x([$()],y.prototype,"whatsappBusy",2);x([$()],y.prototype,"nostrProfileFormState",2);x([$()],y.prototype,"nostrProfileAccountId",2);x([$()],y.prototype,"presenceLoading",2);x([$()],y.prototype,"presenceEntries",2);x([$()],y.prototype,"presenceError",2);x([$()],y.prototype,"presenceStatus",2);x([$()],y.prototype,"agentsLoading",2);x([$()],y.prototype,"agentsList",2);x([$()],y.prototype,"agentsError",2);x([$()],y.prototype,"agentsSelectedId",2);x([$()],y.prototype,"agentsPanel",2);x([$()],y.prototype,"agentFilesLoading",2);x([$()],y.prototype,"agentFilesError",2);x([$()],y.prototype,"agentFilesList",2);x([$()],y.prototype,"agentFileContents",2);x([$()],y.prototype,"agentFileDrafts",2);x([$()],y.prototype,"agentFileActive",2);x([$()],y.prototype,"agentFileSaving",2);x([$()],y.prototype,"agentIdentityLoading",2);x([$()],y.prototype,"agentIdentityError",2);x([$()],y.prototype,"agentIdentityById",2);x([$()],y.prototype,"agentSkillsLoading",2);x([$()],y.prototype,"agentSkillsError",2);x([$()],y.prototype,"agentSkillsReport",2);x([$()],y.prototype,"agentSkillsAgentId",2);x([$()],y.prototype,"sessionsLoading",2);x([$()],y.prototype,"sessionsResult",2);x([$()],y.prototype,"sessionsError",2);x([$()],y.prototype,"sessionsFilterActive",2);x([$()],y.prototype,"sessionsFilterLimit",2);x([$()],y.prototype,"sessionsIncludeGlobal",2);x([$()],y.prototype,"sessionsIncludeUnknown",2);x([$()],y.prototype,"usageLoading",2);x([$()],y.prototype,"usageResult",2);x([$()],y.prototype,"usageCostSummary",2);x([$()],y.prototype,"usageError",2);x([$()],y.prototype,"usageStartDate",2);x([$()],y.prototype,"usageEndDate",2);x([$()],y.prototype,"usageSelectedSessions",2);x([$()],y.prototype,"usageSelectedDays",2);x([$()],y.prototype,"usageSelectedHours",2);x([$()],y.prototype,"usageChartMode",2);x([$()],y.prototype,"usageDailyChartMode",2);x([$()],y.prototype,"usageTimeSeriesMode",2);x([$()],y.prototype,"usageTimeSeriesBreakdownMode",2);x([$()],y.prototype,"usageTimeSeries",2);x([$()],y.prototype,"usageTimeSeriesLoading",2);x([$()],y.prototype,"usageSessionLogs",2);x([$()],y.prototype,"usageSessionLogsLoading",2);x([$()],y.prototype,"usageSessionLogsExpanded",2);x([$()],y.prototype,"usageQuery",2);x([$()],y.prototype,"usageQueryDraft",2);x([$()],y.prototype,"usageSessionSort",2);x([$()],y.prototype,"usageSessionSortDir",2);x([$()],y.prototype,"usageRecentSessions",2);x([$()],y.prototype,"usageTimeZone",2);x([$()],y.prototype,"usageContextExpanded",2);x([$()],y.prototype,"usageHeaderPinned",2);x([$()],y.prototype,"usageSessionsTab",2);x([$()],y.prototype,"usageVisibleColumns",2);x([$()],y.prototype,"usageLogFilterRoles",2);x([$()],y.prototype,"usageLogFilterTools",2);x([$()],y.prototype,"usageLogFilterHasTools",2);x([$()],y.prototype,"usageLogFilterQuery",2);x([$()],y.prototype,"cronLoading",2);x([$()],y.prototype,"cronJobs",2);x([$()],y.prototype,"cronStatus",2);x([$()],y.prototype,"cronError",2);x([$()],y.prototype,"cronForm",2);x([$()],y.prototype,"cronRunsJobId",2);x([$()],y.prototype,"cronRuns",2);x([$()],y.prototype,"cronBusy",2);x([$()],y.prototype,"skillsLoading",2);x([$()],y.prototype,"skillsReport",2);x([$()],y.prototype,"skillsError",2);x([$()],y.prototype,"skillsFilter",2);x([$()],y.prototype,"skillEdits",2);x([$()],y.prototype,"skillsBusyKey",2);x([$()],y.prototype,"skillMessages",2);x([$()],y.prototype,"debugLoading",2);x([$()],y.prototype,"debugStatus",2);x([$()],y.prototype,"debugHealth",2);x([$()],y.prototype,"debugModels",2);x([$()],y.prototype,"debugHeartbeat",2);x([$()],y.prototype,"debugCallMethod",2);x([$()],y.prototype,"debugCallParams",2);x([$()],y.prototype,"debugCallResult",2);x([$()],y.prototype,"debugCallError",2);x([$()],y.prototype,"logsLoading",2);x([$()],y.prototype,"logsError",2);x([$()],y.prototype,"logsFile",2);x([$()],y.prototype,"logsEntries",2);x([$()],y.prototype,"logsFilterText",2);x([$()],y.prototype,"logsLevelFilters",2);x([$()],y.prototype,"logsAutoFollow",2);x([$()],y.prototype,"logsTruncated",2);x([$()],y.prototype,"logsCursor",2);x([$()],y.prototype,"logsLastFetchAt",2);x([$()],y.prototype,"logsLimit",2);x([$()],y.prototype,"logsMaxBytes",2);x([$()],y.prototype,"logsAtBottom",2);x([$()],y.prototype,"chatNewMessagesBelow",2);y=x([or("openclaw-app")],y);
7553
- //# sourceMappingURL=index-Dm6g1E26.js.map
7552
+ `,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Yu},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...Qu},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>vu(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),document.title="ClawBrah Control",ug(this)}firstUpdated(){gg(this)}disconnectedCallback(){pg(this),super.disconnectedCallback()}updated(e){fg(this,e)}connect(){tl(this)}handleChatScroll(e){Kc(this,e)}handleLogsScroll(e){jc(this,e)}exportLogs(e,t){Wc(e,t)}resetToolStream(){ss(this)}resetChatScroll(){Na(this)}scrollToBottom(){Na(this),an(this,!0)}async loadAssistantIdentity(){await Jr(this)}applySettings(e){je(this,e)}setTab(e){cu(this,e)}setTheme(e,t){du(this,e,t)}async loadOverview(){await jr(this)}async loadCron(){await Un(this)}async handleAbortChat(){await Vr(this)}removeQueuedMessage(e){ju(this,e)}async handleSendChat(e,t){await Wu(this,e,t)}async handleWhatsAppStart(e){await Mc(this,e)}async handleWhatsAppWait(){await Ic(this)}async handleWhatsAppLogout(){await Rc(this)}async handleChannelConfigSave(){await Pc(this)}async handleChannelConfigReload(){await Dc(this)}handleNostrProfileEdit(e,t){Nc(this,e,t)}handleNostrProfileCancel(){Oc(this)}handleNostrProfileFieldChange(e,t){Bc(this,e,t)}async handleNostrProfileSave(){await zc(this)}async handleNostrProfileImport(){await Hc(this)}handleNostrProfileToggleAdvanced(){Uc(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,je(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return nb(this)}};x([$()],y.prototype,"settings",2);x([$()],y.prototype,"password",2);x([$()],y.prototype,"tab",2);x([$()],y.prototype,"onboarding",2);x([$()],y.prototype,"connected",2);x([$()],y.prototype,"theme",2);x([$()],y.prototype,"themeResolved",2);x([$()],y.prototype,"hello",2);x([$()],y.prototype,"lastError",2);x([$()],y.prototype,"eventLog",2);x([$()],y.prototype,"assistantName",2);x([$()],y.prototype,"assistantAvatar",2);x([$()],y.prototype,"assistantAgentId",2);x([$()],y.prototype,"sessionKey",2);x([$()],y.prototype,"chatLoading",2);x([$()],y.prototype,"chatSending",2);x([$()],y.prototype,"chatMessage",2);x([$()],y.prototype,"chatMessages",2);x([$()],y.prototype,"chatToolMessages",2);x([$()],y.prototype,"chatStream",2);x([$()],y.prototype,"chatStreamStartedAt",2);x([$()],y.prototype,"chatRunId",2);x([$()],y.prototype,"compactionStatus",2);x([$()],y.prototype,"chatAvatarUrl",2);x([$()],y.prototype,"chatThinkingLevel",2);x([$()],y.prototype,"chatQueue",2);x([$()],y.prototype,"chatAttachments",2);x([$()],y.prototype,"sidebarOpen",2);x([$()],y.prototype,"sidebarContent",2);x([$()],y.prototype,"sidebarError",2);x([$()],y.prototype,"splitRatio",2);x([$()],y.prototype,"nodesLoading",2);x([$()],y.prototype,"nodes",2);x([$()],y.prototype,"devicesLoading",2);x([$()],y.prototype,"devicesError",2);x([$()],y.prototype,"devicesList",2);x([$()],y.prototype,"execApprovalsLoading",2);x([$()],y.prototype,"execApprovalsSaving",2);x([$()],y.prototype,"execApprovalsDirty",2);x([$()],y.prototype,"execApprovalsSnapshot",2);x([$()],y.prototype,"execApprovalsForm",2);x([$()],y.prototype,"execApprovalsSelectedAgent",2);x([$()],y.prototype,"execApprovalsTarget",2);x([$()],y.prototype,"execApprovalsTargetNodeId",2);x([$()],y.prototype,"execApprovalQueue",2);x([$()],y.prototype,"execApprovalBusy",2);x([$()],y.prototype,"execApprovalError",2);x([$()],y.prototype,"pendingGatewayUrl",2);x([$()],y.prototype,"configLoading",2);x([$()],y.prototype,"configRaw",2);x([$()],y.prototype,"configRawOriginal",2);x([$()],y.prototype,"configValid",2);x([$()],y.prototype,"configIssues",2);x([$()],y.prototype,"configSaving",2);x([$()],y.prototype,"configApplying",2);x([$()],y.prototype,"updateRunning",2);x([$()],y.prototype,"applySessionKey",2);x([$()],y.prototype,"configSnapshot",2);x([$()],y.prototype,"configSchema",2);x([$()],y.prototype,"configSchemaVersion",2);x([$()],y.prototype,"configSchemaLoading",2);x([$()],y.prototype,"configUiHints",2);x([$()],y.prototype,"configForm",2);x([$()],y.prototype,"configFormOriginal",2);x([$()],y.prototype,"configFormDirty",2);x([$()],y.prototype,"configFormMode",2);x([$()],y.prototype,"configSearchQuery",2);x([$()],y.prototype,"configActiveSection",2);x([$()],y.prototype,"configActiveSubsection",2);x([$()],y.prototype,"channelsLoading",2);x([$()],y.prototype,"channelsSnapshot",2);x([$()],y.prototype,"channelsError",2);x([$()],y.prototype,"channelsLastSuccess",2);x([$()],y.prototype,"whatsappLoginMessage",2);x([$()],y.prototype,"whatsappLoginQrDataUrl",2);x([$()],y.prototype,"whatsappLoginConnected",2);x([$()],y.prototype,"whatsappBusy",2);x([$()],y.prototype,"nostrProfileFormState",2);x([$()],y.prototype,"nostrProfileAccountId",2);x([$()],y.prototype,"presenceLoading",2);x([$()],y.prototype,"presenceEntries",2);x([$()],y.prototype,"presenceError",2);x([$()],y.prototype,"presenceStatus",2);x([$()],y.prototype,"agentsLoading",2);x([$()],y.prototype,"agentsList",2);x([$()],y.prototype,"agentsError",2);x([$()],y.prototype,"agentsSelectedId",2);x([$()],y.prototype,"agentsPanel",2);x([$()],y.prototype,"agentFilesLoading",2);x([$()],y.prototype,"agentFilesError",2);x([$()],y.prototype,"agentFilesList",2);x([$()],y.prototype,"agentFileContents",2);x([$()],y.prototype,"agentFileDrafts",2);x([$()],y.prototype,"agentFileActive",2);x([$()],y.prototype,"agentFileSaving",2);x([$()],y.prototype,"agentIdentityLoading",2);x([$()],y.prototype,"agentIdentityError",2);x([$()],y.prototype,"agentIdentityById",2);x([$()],y.prototype,"agentSkillsLoading",2);x([$()],y.prototype,"agentSkillsError",2);x([$()],y.prototype,"agentSkillsReport",2);x([$()],y.prototype,"agentSkillsAgentId",2);x([$()],y.prototype,"sessionsLoading",2);x([$()],y.prototype,"sessionsResult",2);x([$()],y.prototype,"sessionsError",2);x([$()],y.prototype,"sessionsFilterActive",2);x([$()],y.prototype,"sessionsFilterLimit",2);x([$()],y.prototype,"sessionsIncludeGlobal",2);x([$()],y.prototype,"sessionsIncludeUnknown",2);x([$()],y.prototype,"usageLoading",2);x([$()],y.prototype,"usageResult",2);x([$()],y.prototype,"usageCostSummary",2);x([$()],y.prototype,"usageError",2);x([$()],y.prototype,"usageStartDate",2);x([$()],y.prototype,"usageEndDate",2);x([$()],y.prototype,"usageSelectedSessions",2);x([$()],y.prototype,"usageSelectedDays",2);x([$()],y.prototype,"usageSelectedHours",2);x([$()],y.prototype,"usageChartMode",2);x([$()],y.prototype,"usageDailyChartMode",2);x([$()],y.prototype,"usageTimeSeriesMode",2);x([$()],y.prototype,"usageTimeSeriesBreakdownMode",2);x([$()],y.prototype,"usageTimeSeries",2);x([$()],y.prototype,"usageTimeSeriesLoading",2);x([$()],y.prototype,"usageSessionLogs",2);x([$()],y.prototype,"usageSessionLogsLoading",2);x([$()],y.prototype,"usageSessionLogsExpanded",2);x([$()],y.prototype,"usageQuery",2);x([$()],y.prototype,"usageQueryDraft",2);x([$()],y.prototype,"usageSessionSort",2);x([$()],y.prototype,"usageSessionSortDir",2);x([$()],y.prototype,"usageRecentSessions",2);x([$()],y.prototype,"usageTimeZone",2);x([$()],y.prototype,"usageContextExpanded",2);x([$()],y.prototype,"usageHeaderPinned",2);x([$()],y.prototype,"usageSessionsTab",2);x([$()],y.prototype,"usageVisibleColumns",2);x([$()],y.prototype,"usageLogFilterRoles",2);x([$()],y.prototype,"usageLogFilterTools",2);x([$()],y.prototype,"usageLogFilterHasTools",2);x([$()],y.prototype,"usageLogFilterQuery",2);x([$()],y.prototype,"cronLoading",2);x([$()],y.prototype,"cronJobs",2);x([$()],y.prototype,"cronStatus",2);x([$()],y.prototype,"cronError",2);x([$()],y.prototype,"cronForm",2);x([$()],y.prototype,"cronRunsJobId",2);x([$()],y.prototype,"cronRuns",2);x([$()],y.prototype,"cronBusy",2);x([$()],y.prototype,"skillsLoading",2);x([$()],y.prototype,"skillsReport",2);x([$()],y.prototype,"skillsError",2);x([$()],y.prototype,"skillsFilter",2);x([$()],y.prototype,"skillEdits",2);x([$()],y.prototype,"skillsBusyKey",2);x([$()],y.prototype,"skillMessages",2);x([$()],y.prototype,"debugLoading",2);x([$()],y.prototype,"debugStatus",2);x([$()],y.prototype,"debugHealth",2);x([$()],y.prototype,"debugModels",2);x([$()],y.prototype,"debugHeartbeat",2);x([$()],y.prototype,"debugCallMethod",2);x([$()],y.prototype,"debugCallParams",2);x([$()],y.prototype,"debugCallResult",2);x([$()],y.prototype,"debugCallError",2);x([$()],y.prototype,"logsLoading",2);x([$()],y.prototype,"logsError",2);x([$()],y.prototype,"logsFile",2);x([$()],y.prototype,"logsEntries",2);x([$()],y.prototype,"logsFilterText",2);x([$()],y.prototype,"logsLevelFilters",2);x([$()],y.prototype,"logsAutoFollow",2);x([$()],y.prototype,"logsTruncated",2);x([$()],y.prototype,"logsCursor",2);x([$()],y.prototype,"logsLastFetchAt",2);x([$()],y.prototype,"logsLimit",2);x([$()],y.prototype,"logsMaxBytes",2);x([$()],y.prototype,"logsAtBottom",2);x([$()],y.prototype,"chatNewMessagesBelow",2);y=x([or("openclaw-app")],y);
7553
+ //# sourceMappingURL=index-D0ToVTL2.js.map