@bitseek/claw 1.2.2 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agents-BMaMDR6h.js → agents-BCJbDk2P.js} +4 -4
- package/dist/{agents.config-BSY7Z6IC.js → agents.config-DQBEXhzA.js} +1 -1
- package/dist/{agents.config-Bjwf3eo1.js → agents.config-DoxV5m9v.js} +1 -1
- package/dist/{auth-choice-BYuegxlw.js → auth-choice-CP6K5htW.js} +1 -1
- package/dist/{auth-choice-BpOvsd_n.js → auth-choice-CdsMUqKA.js} +1 -1
- package/dist/{banner-EymX6IpH.js → banner-V_1v329B.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +6027 -1405
- package/dist/{channel-options-bD8Nb_XT.js → channel-options-Bnnem_wD.js} +1 -1
- package/dist/{channel-options-BbugzQSv.js → channel-options-Dsjb-V1F.js} +1 -1
- package/dist/{channel-web-BzKDism5.js → channel-web-KY6EP9HT.js} +1 -1
- package/dist/{channel-web-C8R11QOm.js → channel-web-wuxrfEJh.js} +1 -1
- package/dist/{channels-cli-DLh8uOwf.js → channels-cli-OZeQkPMG.js} +6 -6
- package/dist/{channels-cli-B6ICcQiX.js → channels-cli-tJkvzsqO.js} +6 -6
- package/dist/{cli-BT1aLbEG.js → cli-DOS1lPNs.js} +1 -1
- package/dist/{cli-dy2BdjPZ.js → cli-YeYpjq2c.js} +1 -1
- package/dist/{command-registry-oV1633Vs.js → command-registry-KxdBw74g.js} +9 -9
- package/dist/{completion-cli-C9i-Dicb.js → completion-cli-Cfp2m1Sy.js} +2 -2
- package/dist/{completion-cli-5z7Fk2X-.js → completion-cli-DU3T8Tur.js} +1 -1
- package/dist/{config-cli-CENkfh8B.js → config-cli-DZpbwWvz.js} +1 -1
- package/dist/{config-cli-CpsK8BqN.js → config-cli-hwawfBlS.js} +1 -1
- package/dist/{configure-boTkhg01.js → configure-CLMtWGiL.js} +3 -3
- package/dist/{configure-DcXrqefi.js → configure-l-lM74c1.js} +3 -3
- package/dist/control-ui/assets/{index-DmJK8e2M.js → index-CKSSOzJL.js} +116 -116
- package/dist/control-ui/assets/{index-DmJK8e2M.js.map → index-CKSSOzJL.js.map} +1 -1
- package/dist/control-ui/assets/index-Ck63PFX9.css +1 -0
- package/dist/control-ui/index.html +2 -2
- package/dist/{doctor-completion-BwIgzkLP.js → doctor-completion-AraQfpv2.js} +1 -1
- package/dist/{doctor-completion-BySkhMZY.js → doctor-completion-B6_JtN22.js} +1 -1
- package/dist/entry.js +2 -2
- package/dist/extensionAPI.js +1 -1
- package/dist/{gateway-cli-BVn-fVbw.js → gateway-cli-C6G3qMkR.js} +8 -8
- package/dist/{gateway-cli-Dn-Yq6Tf.js → gateway-cli-CX2HA_sy.js} +8 -8
- package/dist/{health-Du4IbXAP.js → health-CDEXWvnu.js} +1 -1
- package/dist/{health-DmJq2Wph.js → health-Du8dO3vn.js} +1 -1
- package/dist/{hooks-cli-BhSZV-cM.js → hooks-cli-DUIQuGjr.js} +2 -2
- package/dist/{hooks-cli-BrT4aprv.js → hooks-cli-Deo01lF6.js} +2 -2
- package/dist/index.js +6 -6
- package/dist/llm-slug-generator.js +1 -1
- package/dist/{models-BEMBo-jJ.js → models-CgguB_MH.js} +2 -2
- package/dist/{models-cli-Bj5d7qpe.js → models-cli-BEb0DHSP.js} +3 -3
- package/dist/{models-cli-CJCNoVhQ.js → models-cli-CHUbcM_y.js} +2 -2
- package/dist/{npm-resolution-BHQDGwrV.js → npm-resolution-Dv7nYiaP.js} +1 -1
- package/dist/{npm-resolution-DyqMvaHn.js → npm-resolution-T8SphiP5.js} +1 -1
- package/dist/{onboard-CUFDJWvM.js → onboard-D66uwNCb.js} +2 -2
- package/dist/{onboard-DpLm6YX6.js → onboard-DcI-IxL0.js} +2 -2
- package/dist/{onboard-channels-i1FFoaW7.js → onboard-channels-BLZ8FdVP.js} +1 -1
- package/dist/{onboard-channels-CrxnmwMd.js → onboard-channels-CRpmgX82.js} +1 -1
- package/dist/{onboarding-ORzDCBo6.js → onboarding-CZCgESNI.js} +3 -3
- package/dist/{onboarding-Wve1--YA.js → onboarding-Dae6N665.js} +3 -3
- package/dist/{onboarding.finalize-BoXDIiNp.js → onboarding.finalize-ANKeWCQe.js} +5 -5
- package/dist/{onboarding.finalize-DH8INVdN.js → onboarding.finalize-B8nYvA0i.js} +6 -6
- package/dist/{pi-embedded-DDt-4VY9.js → pi-embedded-Claxav22.js} +30 -2
- package/dist/{pi-embedded-DnavjoU4.js → pi-embedded-DKX65Hec.js} +30 -2
- package/dist/{plugin-registry-eOikaO9b.js → plugin-registry-CxFikiLF.js} +1 -1
- package/dist/{plugin-registry-CFL5j9cN.js → plugin-registry-TOEmbMc4.js} +1 -1
- package/dist/plugin-sdk/{channel-web-MpDUG9SU.js → channel-web-O79O_ah6.js} +1 -1
- package/dist/plugin-sdk/index.js +2 -2
- package/dist/plugin-sdk/{reply-wHFXod4j.js → reply-YZQvouuF.js} +30 -2
- package/dist/plugin-sdk/{web-DbkpdVSZ.js → web-jmxdxo0H.js} +2 -2
- package/dist/{plugins-cli-DrlRj_8V.js → plugins-cli-Clo_uyvq.js} +2 -2
- package/dist/{plugins-cli-Bg6sFJYH.js → plugins-cli-bHHZzKd-.js} +2 -2
- package/dist/{program-BQ8WwHMi.js → program-DSOHn27G.js} +7 -7
- package/dist/{program-context-BWsBkMJn.js → program-context-DfYJPL5N.js} +17 -17
- package/dist/{prompt-select-styled-CLCyaJAG.js → prompt-select-styled-B2izefsj.js} +4 -4
- package/dist/{prompt-select-styled-DbUQHcBh.js → prompt-select-styled-DG7woZ0E.js} +4 -4
- package/dist/{provider-auth-helpers-CKpEFImN.js → provider-auth-helpers-BFsLtU8g.js} +1 -1
- package/dist/{provider-auth-helpers-CdTLpxG1.js → provider-auth-helpers-D_akOb8A.js} +1 -1
- package/dist/{push-apns-CVnc3jrx.js → push-apns-BSlKJa83.js} +1 -1
- package/dist/{push-apns-B_GGZO2Z.js → push-apns-DvNRo3EQ.js} +1 -1
- package/dist/{register.agent-BxMqGoLQ.js → register.agent-C-OmdJMe.js} +7 -7
- package/dist/{register.agent-BwCayvbD.js → register.agent-DowGjvNc.js} +6 -6
- package/dist/{register.configure-Bv4KP_MD.js → register.configure-BZLa_c3k.js} +7 -7
- package/dist/{register.configure-PCuADy_e.js → register.configure-CaSRlI6h.js} +7 -7
- package/dist/{register.maintenance-CW5_urTq.js → register.maintenance-CQivhR8Y.js} +8 -8
- package/dist/{register.maintenance-jHaU-XSR.js → register.maintenance-DyTduYA4.js} +7 -7
- package/dist/{register.message-ByUxZi3s.js → register.message-5hKmcWaB.js} +2 -2
- package/dist/{register.message-DPlqIVvv.js → register.message-DE-eKss6.js} +2 -2
- package/dist/{register.onboard-B-8WoYZr.js → register.onboard-BRBPNENF.js} +2 -2
- package/dist/{register.onboard-BC4wpDdz.js → register.onboard-CWX2zarB.js} +2 -2
- package/dist/{register.setup-BQQX0yB6.js → register.setup-DwZL0RXc.js} +2 -2
- package/dist/{register.setup-CZ9a3M_O.js → register.setup-YcxKWN94.js} +2 -2
- package/dist/{register.status-health-sessions-BRJgE7jh.js → register.status-health-sessions-Cbva8fTK.js} +3 -3
- package/dist/{register.status-health-sessions-BKLWh2aq.js → register.status-health-sessions-lOM_lb6H.js} +3 -3
- package/dist/{register.subclis-DKG1KoTd.js → register.subclis-CEq4Db2Q.js} +9 -9
- package/dist/{reply-ezOUjaUp.js → reply-D8Yu6-Ie.js} +31 -2
- package/dist/{run-main-CGAXqlRX.js → run-main-BoenTqTz.js} +14 -14
- package/dist/{server-node-events-BHkXD38g.js → server-node-events-nakjzVDn.js} +2 -2
- package/dist/{server-node-events-D_9Quh-1.js → server-node-events-yFZiE04b.js} +2 -2
- package/dist/{status-DjnNnvyr.js → status-CQYA6EJN.js} +2 -2
- package/dist/{status-CwKeOASs.js → status-mS4bWnIW.js} +2 -2
- package/dist/{subagent-registry-CfKMgII6.js → subagent-registry-CXBreqUP.js} +31 -2
- package/dist/{update-cli-BCH7o0oB.js → update-cli-CuKW0N9W.js} +11 -7
- package/dist/{update-cli-Dcvb1LZT.js → update-cli-D1B0Vytl.js} +12 -8
- package/dist/{update-runner-l9K_q6Kz.js → update-runner-C9noXbfV.js} +10 -3
- package/dist/{update-runner-rrlmopJw.js → update-runner-DO6RodZW.js} +10 -3
- package/dist/{web-CsfqGSAa.js → web-BKrNiKsU.js} +2 -2
- package/dist/{web-C9QAX9EH.js → web-DJKitOpu.js} +1 -1
- package/dist/{web-CtrUXk94.js → web-DbdjX4Hg.js} +2 -2
- package/dist/{web-BJ_nNwKp.js → web-V1uGLepo.js} +1 -1
- package/extensions/diagnostics-otel/node_modules/.bin/acorn +21 -0
- package/extensions/googlechat/node_modules/.bin/nlc +21 -0
- package/extensions/googlechat/node_modules/.bin/node-llama-cpp +21 -0
- package/extensions/googlechat/node_modules/.bin/openclaw +2 -2
- package/extensions/googlechat/node_modules/.bin/tsc +21 -0
- package/extensions/googlechat/node_modules/.bin/tsserver +21 -0
- package/extensions/memory-core/node_modules/.bin/nlc +21 -0
- package/extensions/memory-core/node_modules/.bin/node-llama-cpp +21 -0
- package/extensions/memory-core/node_modules/.bin/openclaw +2 -2
- package/extensions/memory-core/node_modules/.bin/tsc +21 -0
- package/extensions/memory-core/node_modules/.bin/tsserver +21 -0
- package/extensions/memory-lancedb/node_modules/.bin/arrow2csv +21 -0
- package/extensions/nostr/node_modules/.bin/tsc +21 -0
- package/extensions/nostr/node_modules/.bin/tsserver +21 -0
- package/package.json +2 -5
- package/dist/control-ui/assets/index-B5WC_0Be.css +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const Ts=globalThis,Mo=Ts.ShadowRoot&&(Ts.ShadyCSS===void 0||Ts.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),Hr=new WeakMap;let zl=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==Ro)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(Mo&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Hr.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Hr.set(n,t))}return t}toString(){return this.cssText}};const _u=e=>new zl(typeof e=="string"?e:e+"",void 0,Ro),Iu=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,o)=>s+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[o+1],e[0]);return new zl(n,e,Ro)},Mu=(e,t)=>{if(Mo)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Ts.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},zr=Mo?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return _u(n)})(e):e;const{is:Ru,defineProperty:Lu,getOwnPropertyDescriptor:Du,getOwnPropertyNames:Pu,getOwnPropertySymbols:Fu,getPrototypeOf:Nu}=Object,
|
|
2
|
-
\f\r]`,_n=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gr=/-->/g,Vr=/>/g,Mt=RegExp(`>|${
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Jr=/'/g,Qr=/"/g,Wl=/^(?:script|style|textarea|title)$/i,ql=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),c=ql(1),Rt=ql(2),wt=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Yr=new WeakMap,Kt=Gt.createTreeWalker(Gt,129);function Gl(e,t){if(!Po(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return qr!==void 0?qr.createHTML(t):t}const zu=(e,t)=>{const n=e.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",r=_n;for(let l=0;l<n;l++){const a=e[l];let d,g,u=-1,f=0;for(;f<a.length&&(r.lastIndex=f,g=r.exec(a),g!==null);)f=r.lastIndex,r===_n?g[1]==="!--"?r=Gr:g[1]!==void 0?r=Vr:g[2]!==void 0?(Wl.test(g[2])&&(i=RegExp("</"+g[2],"g")),r=Mt):g[3]!==void 0&&(r=Mt):r===Mt?g[0]===">"?(r=i??_n,u=-1):g[1]===void 0?u=-2:(u=r.lastIndex-g[2].length,d=g[1],r=g[3]===void 0?Mt:g[3]==='"'?Qr:Jr):r===Qr||r===Jr?r=Mt:r===Gr||r===Vr?r=_n:(r=Mt,i=void 0);const v=r===Mt&&e[l+1].startsWith("/>")?" ":"";o+=r===_n?a+Bu:u>=0?(s.push(d),a.slice(0,u)+jl+a.slice(u)+ht+v):a+ht+(u===-2?l:v)}return[Gl(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class Vn{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let o=0,r=0;const l=t.length-1,a=this.parts,[d,g]=zu(t,n);if(this.el=Vn.createElement(d,s),Kt.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Kt.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(jl)){const f=g[r++],v=i.getAttribute(u).split(ht),m=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:m[2],strings:v,ctor:m[1]==="."?Ku:m[1]==="?"?Wu:m[1]==="@"?qu:Zs}),i.removeAttribute(u)}else u.startsWith(ht)&&(a.push({type:6,index:o}),i.removeAttribute(u));if(Wl.test(i.tagName)){const u=i.textContent.split(ht),f=u.length-1;if(f>0){i.textContent=Fs?Fs.emptyScript:"";for(let v=0;v<f;v++)i.append(u[v],qn()),Kt.nextNode(),a.push({type:2,index:++o});i.append(u[f],qn())}}}else if(i.nodeType===8)if(i.data===Kl)a.push({type:2,index:o});else{let u=-1;for(;(u=i.data.indexOf(ht,u+1))!==-1;)a.push({type:7,index:o}),u+=ht.length-1}o++}}static createElement(t,n){const s=Gt.createElement("template");return s.innerHTML=t,s}}function yn(e,t,n=e,s){if(t===wt)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const o=Gn(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=yn(e,i._$AS(e,t.values),i,s)),t}class ju{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??Gt).importNode(n,!0);Kt.currentNode=i;let o=Kt.nextNode(),r=0,l=0,a=s[0];for(;a!==void 0;){if(r===a.index){let d;a.type===2?d=new Xs(o,o.nextSibling,this,t):a.type===1?d=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(d=new Gu(o,this,t)),this._$AV.push(d),a=s[++l]}r!==a?.index&&(o=Kt.nextNode(),r++)}return Kt.currentNode=Gt,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let Xs=class Vl{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=yn(this,t,n),Gn(t)?t===h||t==null||t===""?(this._$AH!==h&&this._$AR(),this._$AH=h):t!==this._$AH&&t!==wt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Hu(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==h&&Gn(this._$AH)?this._$AA.nextSibling.data=t:this.T(Gt.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Vn.createElement(Gl(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const o=new ju(i,this),r=o.u(this.options);o.p(n),this.T(r),this._$AH=o}}_$AC(t){let n=Yr.get(t.strings);return n===void 0&&Yr.set(t.strings,n=new Vn(t)),n}k(t){Po(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const o of t)i===n.length?n.push(s=new Vl(this.O(qn()),this.O(qn()),this,this.options)):s=n[i],s._$AI(o),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=Wr(t).nextSibling;Wr(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Zs=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,o){this.type=1,this._$AH=h,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=h}_$AI(t,n=this,s,i){const o=this.strings;let r=!1;if(o===void 0)t=yn(this,t,n,0),r=!Gn(t)||t!==this._$AH&&t!==wt,r&&(this._$AH=t);else{const l=t;let a,d;for(t=o[0],a=0;a<o.length-1;a++)d=yn(this,l[s+a],n,a),d===wt&&(d=this._$AH[a]),r||=!Gn(d)||d!==this._$AH[a],d===h?t=h:t!==h&&(t+=(d??"")+o[a+1]),this._$AH[a]=d}r&&!i&&this.j(t)}j(t){t===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ku=class extends Zs{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===h?void 0:t}},Wu=class extends Zs{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==h)}},qu=class extends Zs{constructor(t,n,s,i,o){super(t,n,s,i,o),this.type=5}_$AI(t,n=this){if((t=yn(this,t,n,0)??h)===wt)return;const s=this._$AH,i=t===h&&s!==h||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==h&&(s===h||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Gu=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){yn(this,t)}};const Vu={I:Xs},Ju=Do.litHtmlPolyfillSupport;Ju?.(Vn,Xs),(Do.litHtmlVersions??=[]).push("3.3.2");const Qu=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const o=n?.renderBefore??null;s._$litPart$=i=new Xs(t.insertBefore(qn(),o),o,void 0,n??{})}return i._$AI(e),i};const Fo=globalThis;let mn=class extends cn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Qu(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return wt}};mn._$litElement$=!0,mn.finalized=!0,Fo.litElementHydrateSupport?.({LitElement:mn});const Yu=Fo.litElementPolyfillSupport;Yu?.({LitElement:mn});(Fo.litElementVersions??=[]).push("4.2.2");const Jl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const Xu={attribute:!0,type:String,converter:Ps,reflect:!1,hasChanged:Lo},Zu=(e=Xu,t,n)=>{const{kind:s,metadata:i}=n;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(n.name,e),s==="accessor"){const{name:r}=n;return{set(l){const a=t.get.call(this);t.set.call(this,l),this.requestUpdate(r,a,e,!0,l)},init(l){return l!==void 0&&this.C(r,void 0,e,l),l}}}if(s==="setter"){const{name:r}=n;return function(l){const a=this[r];t.call(this,l),this.requestUpdate(r,a,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function ei(e){return(t,n)=>typeof n=="object"?Zu(e,t,n):((s,i,o)=>{const r=i.hasOwnProperty(o);return i.constructor.createProperty(o,s),r?Object.getOwnPropertyDescriptor(i,o):void 0})(e,t,n)}function x(e){return ei({...e,state:!0,attribute:!1})}const eg={common:{version:"Version",health:"Health",ok:"OK",offline:"Offline",connect:"Connect",refresh:"Refresh",enabled:"Enabled",disabled:"Disabled",na:"n/a",docs:"Docs",resources:"Resources"},nav:{chat:"Chat",control:"Control",agent:"Agent",settings:"Settings",expand:"Expand sidebar",collapse:"Collapse sidebar"},tabs:{agents:"Agents",overview:"Overview",channels:"Channels",instances:"Instances",sessions:"Sessions",usage:"Usage",cron:"Cron Jobs",skills:"Skills",market:"Skill Market",nodes:"Nodes",chat:"Chat",models:"Models",config:"Config",debug:"Debug",logs:"Logs"},subtitles:{agents:"Manage agent workspaces, tools, and identities.",overview:"Gateway status, entry points, and a fast health read.",channels:"Manage channels and settings.",instances:"Presence beacons from connected clients and nodes.",sessions:"Inspect active sessions and adjust per-session defaults.",usage:"Monitor API usage and costs.",cron:"Schedule wakeups and recurring agent runs.",skills:"Manage skill availability and API key injection.",market:"Install and enable Web3 skills from BitSeek.",nodes:"Paired devices, capabilities, and command exposure.",chat:"Direct gateway chat session for quick interventions.",models:"Manage the default model and OpenAI-compatible providers.",config:"Edit ~/.openclaw/openclaw.json safely.",debug:"Gateway snapshots, events, and manual RPC calls.",logs:"Live tail of the gateway file logs."},overview:{access:{title:"Gateway Access",subtitle:"Where the dashboard connects and how it authenticates.",wsUrl:"WebSocket URL",token:"Gateway Token",password:"Password (not stored)",sessionKey:"Default Session Key",language:"Language",connectHint:"Click Connect to apply connection changes.",trustedProxy:"Authenticated via trusted proxy."},snapshot:{title:"Snapshot",subtitle:"Latest gateway handshake information.",status:"Status",uptime:"Uptime",tickInterval:"Tick Interval",lastChannelsRefresh:"Last Channels Refresh",channelsHint:"Use Channels to link WhatsApp, Telegram, Discord, Signal, or iMessage."},stats:{instances:"Instances",instancesHint:"Presence beacons in the last 5 minutes.",sessions:"Sessions",sessionsHint:"Recent session keys tracked by the gateway.",cron:"Cron",cronNext:"Next wake {time}"},notes:{title:"Notes",subtitle:"Quick reminders for remote control setups.",tailscaleTitle:"Tailscale serve",tailscaleText:"Prefer serve mode to keep the gateway on loopback with tailnet auth.",sessionTitle:"Session hygiene",sessionText:"Use /new or sessions.patch to reset context.",cronTitle:"Cron reminders",cronText:"Use isolated sessions for recurring runs."},auth:{required:"This gateway requires auth. Add a token or password, then click Connect.",failed:"Auth failed. Re-copy a tokenized URL with {command}, or update the token, then click Connect."},pairing:{hint:"This device needs pairing approval from the gateway host.",mobileHint:"On mobile? Copy the full URL (including #token=...) from openclaw dashboard --no-open on your desktop."},insecure:{hint:"This page is HTTP, so the browser blocks device identity. Use HTTPS (Tailscale Serve) or open {url} on the gateway host.",stayHttp:"If you must stay on HTTP, set {config} (token-only)."}},chat:{disconnected:"Disconnected from gateway.",refreshTitle:"Refresh chat data",thinkingToggle:"Toggle assistant thinking/working output",focusToggle:"Toggle focus mode (hide sidebar + page header)",hideCronSessions:"Hide cron sessions",showCronSessions:"Show cron sessions",showCronSessionsHidden:"Show cron sessions ({count} hidden)",onboardingDisabled:"Disabled during onboarding"},languages:{en:"English",zhCN:"简体中文 (Simplified Chinese)",zhTW:"繁體中文 (Traditional Chinese)",ptBR:"Português (Brazilian Portuguese)",de:"Deutsch (German)"},cron:{summary:{enabled:"Enabled",yes:"Yes",no:"No",jobs:"Jobs",nextWake:"Next wake",refreshing:"Refreshing...",refresh:"Refresh"},jobs:{title:"Jobs",subtitle:"All scheduled jobs stored in the gateway.",shownOf:"{shown} shown of {total}",searchJobs:"Search jobs",searchPlaceholder:"Name, description, or agent",enabled:"Enabled",schedule:"Schedule",lastRun:"Last run",all:"All",sort:"Sort",nextRun:"Next run",recentlyUpdated:"Recently updated",name:"Name",direction:"Direction",ascending:"Ascending",descending:"Descending",reset:"Reset",noMatching:"No matching jobs.",loading:"Loading...",loadMore:"Load more jobs"},runs:{title:"Run history",subtitleAll:"Latest runs across all jobs.",subtitleJob:"Latest runs for {title}.",scope:"Scope",allJobs:"All jobs",selectedJob:"Selected job",searchRuns:"Search runs",searchPlaceholder:"Summary, error, or job",newestFirst:"Newest first",oldestFirst:"Oldest first",status:"Status",delivery:"Delivery",clear:"Clear",allStatuses:"All statuses",allDelivery:"All delivery",selectJobHint:"Select a job to inspect run history.",noMatching:"No matching runs.",loadMore:"Load more runs",runStatusOk:"OK",runStatusError:"Error",runStatusSkipped:"Skipped",runStatusUnknown:"Unknown",deliveryDelivered:"Delivered",deliveryNotDelivered:"Not delivered",deliveryUnknown:"Unknown",deliveryNotRequested:"Not requested"},form:{editJob:"Edit Job",newJob:"New Job",updateSubtitle:"Update the selected scheduled job.",createSubtitle:"Create a scheduled wakeup or agent run.",required:"Required",requiredSr:"required",basics:"Basics",basicsSub:"Name it, choose the assistant, and set enabled state.",fieldName:"Name",description:"Description",agentId:"Agent ID",namePlaceholder:"Morning brief",descriptionPlaceholder:"Optional context for this job",agentPlaceholder:"main or ops",agentHelp:"Start typing to pick a known agent, or enter a custom one.",schedule:"Schedule",scheduleSub:"Control when this job runs.",every:"Every",at:"At",cronOption:"Cron",runAt:"Run at",unit:"Unit",minutes:"Minutes",hours:"Hours",days:"Days",expression:"Expression",expressionPlaceholder:"0 7 * * *",everyAmountPlaceholder:"30",timezoneOptional:"Timezone (optional)",timezonePlaceholder:"America/Los_Angeles",timezoneHelp:"Pick a common timezone or enter any valid IANA timezone.",jitterHelp:"Need jitter? Use Advanced → Stagger window / Stagger unit.",execution:"Execution",executionSub:"Choose when to wake, and what this job should do.",session:"Session",main:"Main",isolated:"Isolated",sessionHelp:"Main posts a system event. Isolated runs a dedicated agent turn.",wakeMode:"Wake mode",now:"Now",nextHeartbeat:"Next heartbeat",wakeModeHelp:"Now triggers immediately. Next heartbeat waits for the next cycle.",payloadKind:"What should run?",systemEvent:"Post message to main timeline",agentTurn:"Run assistant task (isolated)",systemEventHelp:"Sends your text to the gateway main timeline (good for reminders/triggers).",agentTurnHelp:"Starts an assistant run in its own session using your prompt.",timeoutSeconds:"Timeout (seconds)",timeoutPlaceholder:"Optional, e.g. 90",timeoutHelp:"Optional. Leave blank to use the gateway default timeout behavior for this run.",mainTimelineMessage:"Main timeline message",assistantTaskPrompt:"Assistant task prompt",deliverySection:"Delivery",deliverySub:"Choose where run summaries are sent.",resultDelivery:"Result delivery",announceDefault:"Announce summary (default)",webhookPost:"Webhook POST",noneInternal:"None (internal)",deliveryHelp:"Announce posts a summary to chat. None keeps execution internal.",webhookUrl:"Webhook URL",channel:"Channel",webhookPlaceholder:"https://example.com/cron",channelHelp:"Choose which connected channel receives the summary.",webhookHelp:"Send run summaries to a webhook endpoint.",to:"To",toPlaceholder:"+1555... or chat id",toHelp:"Optional recipient override (chat id, phone, or user id).",advanced:"Advanced",advancedHelp:"Optional overrides for delivery guarantees, schedule jitter, and model controls.",deleteAfterRun:"Delete after run",deleteAfterRunHelp:"Best for one-shot reminders that should auto-clean up.",clearAgentOverride:"Clear agent override",clearAgentHelp:"Force this job to use the gateway default assistant.",exactTiming:"Exact timing (no stagger)",exactTimingHelp:"Run on exact cron boundaries with no spread.",staggerWindow:"Stagger window",staggerUnit:"Stagger unit",staggerPlaceholder:"30",seconds:"Seconds",model:"Model",modelPlaceholder:"openai/gpt-5.2",modelHelp:"Start typing to pick a known model, or enter a custom one.",thinking:"Thinking",thinkingPlaceholder:"low",thinkingHelp:"Use a suggested level or enter a provider-specific value.",bestEffortDelivery:"Best effort delivery",bestEffortHelp:"Do not fail the job if delivery itself fails.",cantAddYet:"Can't add job yet",fillRequired:"Fill the required fields below to enable submit.",fixFields:"Fix {count} field to continue.",fixFieldsPlural:"Fix {count} fields to continue.",saving:"Saving...",saveChanges:"Save changes",addJob:"Add job",cancel:"Cancel"},jobList:{allJobs:"all jobs",selectJob:"(select a job)",enabled:"enabled",disabled:"disabled",edit:"Edit",clone:"Clone",disable:"Disable",enable:"Enable",run:"Run",history:"History",remove:"Remove"},jobDetail:{system:"System",prompt:"Prompt",delivery:"Delivery",agent:"Agent"},jobState:{status:"Status",next:"Next",last:"Last"},runEntry:{noSummary:"No summary.",runAt:"Run at",openRunChat:"Open run chat",next:"Next {rel}",due:"Due {rel}"},errors:{nameRequired:"Name is required.",scheduleAtInvalid:"Enter a valid date/time.",everyAmountInvalid:"Interval must be greater than 0.",cronExprRequired:"Cron expression is required.",staggerAmountInvalid:"Stagger must be greater than 0.",systemTextRequired:"System text is required.",agentMessageRequired:"Agent message is required.",timeoutInvalid:"If set, timeout must be greater than 0 seconds.",webhookUrlRequired:"Webhook URL is required.",webhookUrlInvalid:"Webhook URL must start with http:// or https://.",invalidRunTime:"Invalid run time.",invalidIntervalAmount:"Invalid interval amount.",cronExprRequiredShort:"Cron expression required.",invalidStaggerAmount:"Invalid stagger amount.",systemEventTextRequired:"System event text required.",agentMessageRequiredShort:"Agent message required.",nameRequiredShort:"Name required."}}},tg="modulepreload",ng=function(e,t){return new URL(e,t).href},Xr={},ps=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let d=function(g){return Promise.all(g.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const r=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),a=l?.nonce||l?.getAttribute("nonce");i=d(n.map(g=>{if(g=ng(g,s),g in Xr)return;Xr[g]=!0;const u=g.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(s)for(let m=r.length-1;m>=0;m--){const S=r[m];if(S.href===g&&(!u||S.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${g}"]${f}`))return;const v=document.createElement("link");if(v.rel=u?"stylesheet":tg,u||(v.as="script"),v.crossOrigin="",v.href=g,a&&v.setAttribute("nonce",a),document.head.appendChild(v),u)return new Promise((m,S)=>{v.addEventListener("load",m),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function o(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return i.then(r=>{for(const l of r||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},Nt="en",Ql=["zh-CN","zh-TW","pt-BR","de"],sg={"zh-CN":{exportName:"zh_CN",loader:()=>ps(()=>import("./zh-CN-DpcDfKwj.js"),[],import.meta.url)},"zh-TW":{exportName:"zh_TW",loader:()=>ps(()=>import("./zh-TW-CrXJRxS8.js"),[],import.meta.url)},"pt-BR":{exportName:"pt_BR",loader:()=>ps(()=>import("./pt-BR-DtCy1Iqj.js"),[],import.meta.url)},de:{exportName:"de",loader:()=>ps(()=>import("./de-DCndbITT.js"),[],import.meta.url)}},Yl=[Nt,...Ql];function Xl(e){return e!=null&&Yl.includes(e)}function ig(e){return Ql.includes(e)}async function og(e){if(!ig(e))return null;const t=sg[e];return(await t.loader())[t.exportName]??null}class rg{constructor(){this.locale=Nt,this.translations={[Nt]:eg},this.subscribers=new Set}getLocale(){return this.locale}async setLocale(t){const n=t!==Nt&&!this.translations[t];if(!(this.locale===t&&!n)){if(n)try{const s=await og(t);if(!s)return;this.translations[t]=s}catch(s){console.error(`Failed to load locale: ${t}`,s);return}this.locale=t,this.notify()}}registerTranslation(t,n){this.translations[t]=n}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}notify(){this.subscribers.forEach(t=>t(this.locale))}t(t,n){const s=t.split(".");let i=this.translations[this.locale]||this.translations[Nt];for(const o of s)if(i&&typeof i=="object")i=i[o];else{i=void 0;break}if(i===void 0&&this.locale!==Nt){i=this.translations[Nt];for(const o of s)if(i&&typeof i=="object")i=i[o];else{i=void 0;break}}return typeof i!="string"?t:n?i.replace(/\{(\w+)\}/g,(o,r)=>n[r]||`{${r}}`):i}}const Jn=new rg,p=(e,t)=>Jn.t(e,t);class ag{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){this.unsubscribe=Jn.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){this.unsubscribe?.()}}async function Re(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function lg(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function cg(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function dg(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function ve(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function Zl(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(ve(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function No(e){return e.filter(t=>typeof t=="string").join(".")}function bt(e,t){const n=No(e),s=t[n];if(s)return s;const i=n.split(".");for(const[o,r]of Object.entries(t)){if(!o.includes("*"))continue;const l=o.split(".");if(l.length!==i.length)continue;let a=!0;for(let d=0;d<i.length;d+=1)if(l[d]!=="*"&&l[d]!==i[d]){a=!1;break}if(a)return r}}function ti(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Zr(e,t){const n=e.trim();if(n==="")return;const s=Number(n);return!Number.isFinite(s)||t&&!Number.isInteger(s)?e:s}function ea(e){const t=e.trim();return t==="true"?!0:t==="false"?!1:e}function pt(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let s=e;for(const i of t.allOf)s=pt(s,i);return s}const n=ve(t);if(t.anyOf||t.oneOf){const s=(t.anyOf??t.oneOf??[]).filter(i=>!(i.type==="null"||Array.isArray(i.type)&&i.type.includes("null")));if(s.length===1)return pt(e,s[0]);if(typeof e=="string")for(const i of s){const o=ve(i);if(o==="number"||o==="integer"){const r=Zr(e,o==="integer");if(r===void 0||typeof r=="number")return r}if(o==="boolean"){const r=ea(e);if(typeof r=="boolean")return r}}for(const i of s){const o=ve(i);if(o==="object"&&typeof e=="object"&&!Array.isArray(e)||o==="array"&&Array.isArray(e))return pt(e,i)}return e}if(n==="number"||n==="integer"){if(typeof e=="string"){const s=Zr(e,n==="integer");if(s===void 0||typeof s=="number")return s}return e}if(n==="boolean"){if(typeof e=="string"){const s=ea(e);if(typeof s=="boolean")return s}return e}if(n==="object"){if(typeof e!="object"||Array.isArray(e))return e;const s=e,i=t.properties??{},o=t.additionalProperties&&typeof t.additionalProperties=="object"?t.additionalProperties:null,r={};for(const[l,a]of Object.entries(s)){const d=i[l]??o,g=d?pt(a,d):a;g!==void 0&&(r[l]=g)}return r}if(n==="array"){if(!Array.isArray(e))return e;if(Array.isArray(t.items)){const i=t.items;return e.map((o,r)=>{const l=r<i.length?i[r]:void 0;return l?pt(o,l):o})}const s=t.items;return s?e.map(i=>pt(i,s)).filter(i=>i!==void 0):e}return e}function St(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function $n(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const Ts=globalThis,Mo=Ts.ShadowRoot&&(Ts.ShadyCSS===void 0||Ts.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),Hr=new WeakMap;let zl=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==Ro)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(Mo&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Hr.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Hr.set(n,t))}return t}toString(){return this.cssText}};const _u=e=>new zl(typeof e=="string"?e:e+"",void 0,Ro),Iu=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,o)=>s+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[o+1],e[0]);return new zl(n,e,Ro)},Mu=(e,t)=>{if(Mo)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Ts.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},zr=Mo?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return _u(n)})(e):e;const{is:Ru,defineProperty:Lu,getOwnPropertyDescriptor:Du,getOwnPropertyNames:Pu,getOwnPropertySymbols:Fu,getPrototypeOf:Nu}=Object,Xs=globalThis,jr=Xs.trustedTypes,Ou=jr?jr.emptyScript:"",Uu=Xs.reactiveElementPolyfillSupport,Bn=(e,t)=>e,Fs={toAttribute(e,t){switch(t){case Boolean:e=e?Ou:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Lo=(e,t)=>!Ru(e,t),Kr={attribute:!0,type:String,converter:Fs,reflect:!1,useDefault:!1,hasChanged:Lo};Symbol.metadata??=Symbol("metadata"),Xs.litPropertyMetadata??=new WeakMap;let cn=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=Kr){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,n);i!==void 0&&Lu(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:o}=Du(this.prototype,t)??{get(){return this[n]},set(r){this[n]=r}};return{get:i,set(r){const l=i?.call(this);o?.call(this,r),this.requestUpdate(t,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Kr}static _$Ei(){if(this.hasOwnProperty(Bn("elementProperties")))return;const t=Nu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Bn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Bn("properties"))){const n=this.properties,s=[...Pu(n),...Fu(n)];for(const i of s)this.createProperty(i,n[i])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[s,i]of n)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[n,s]of this.elementProperties){const i=this._$Eu(n,s);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)n.unshift(zr(i))}else t!==void 0&&n.push(zr(t));return n}static _$Eu(t,n){const s=n.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const s of n.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Mu(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,s){this._$AK(t,s)}_$ET(t,n){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(s.converter?.toAttribute!==void 0?s.converter:Fs).toAttribute(n,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,n){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),r=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Fs;this._$Em=i;const l=r.fromAttribute(n,o.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(t,n,s,i=!1,o){if(t!==void 0){const r=this.constructor;if(i===!1&&(o=this[t]),s??=r.getPropertyOptions(t),!((s.hasChanged??Lo)(o,n)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:o},r){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??n??this[t]),o!==!0||r!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){const{wrapped:r}=o,l=this[i];r!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,o,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(t){}firstUpdated(t){}};cn.elementStyles=[],cn.shadowRootOptions={mode:"open"},cn[Bn("elementProperties")]=new Map,cn[Bn("finalized")]=new Map,Uu?.({ReactiveElement:cn}),(Xs.reactiveElementVersions??=[]).push("2.1.2");const Do=globalThis,Wr=e=>e,Ns=Do.trustedTypes,qr=Ns?Ns.createPolicy("lit-html",{createHTML:e=>e}):void 0,jl="$lit$",ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Kl="?"+ht,Bu=`<${Kl}>`,Gt=document,qn=()=>Gt.createComment(""),Gn=e=>e===null||typeof e!="object"&&typeof e!="function",Po=Array.isArray,Hu=e=>Po(e)||typeof e?.[Symbol.iterator]=="function",Ai=`[
|
|
2
|
+
\f\r]`,_n=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gr=/-->/g,Vr=/>/g,Mt=RegExp(`>|${Ai}(?:([^\\s"'>=/]+)(${Ai}*=${Ai}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Jr=/'/g,Qr=/"/g,Wl=/^(?:script|style|textarea|title)$/i,ql=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),c=ql(1),Rt=ql(2),wt=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Yr=new WeakMap,Kt=Gt.createTreeWalker(Gt,129);function Gl(e,t){if(!Po(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return qr!==void 0?qr.createHTML(t):t}const zu=(e,t)=>{const n=e.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",r=_n;for(let l=0;l<n;l++){const a=e[l];let d,g,u=-1,f=0;for(;f<a.length&&(r.lastIndex=f,g=r.exec(a),g!==null);)f=r.lastIndex,r===_n?g[1]==="!--"?r=Gr:g[1]!==void 0?r=Vr:g[2]!==void 0?(Wl.test(g[2])&&(i=RegExp("</"+g[2],"g")),r=Mt):g[3]!==void 0&&(r=Mt):r===Mt?g[0]===">"?(r=i??_n,u=-1):g[1]===void 0?u=-2:(u=r.lastIndex-g[2].length,d=g[1],r=g[3]===void 0?Mt:g[3]==='"'?Qr:Jr):r===Qr||r===Jr?r=Mt:r===Gr||r===Vr?r=_n:(r=Mt,i=void 0);const v=r===Mt&&e[l+1].startsWith("/>")?" ":"";o+=r===_n?a+Bu:u>=0?(s.push(d),a.slice(0,u)+jl+a.slice(u)+ht+v):a+ht+(u===-2?l:v)}return[Gl(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class Vn{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let o=0,r=0;const l=t.length-1,a=this.parts,[d,g]=zu(t,n);if(this.el=Vn.createElement(d,s),Kt.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Kt.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(jl)){const f=g[r++],v=i.getAttribute(u).split(ht),m=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:m[2],strings:v,ctor:m[1]==="."?Ku:m[1]==="?"?Wu:m[1]==="@"?qu:ei}),i.removeAttribute(u)}else u.startsWith(ht)&&(a.push({type:6,index:o}),i.removeAttribute(u));if(Wl.test(i.tagName)){const u=i.textContent.split(ht),f=u.length-1;if(f>0){i.textContent=Ns?Ns.emptyScript:"";for(let v=0;v<f;v++)i.append(u[v],qn()),Kt.nextNode(),a.push({type:2,index:++o});i.append(u[f],qn())}}}else if(i.nodeType===8)if(i.data===Kl)a.push({type:2,index:o});else{let u=-1;for(;(u=i.data.indexOf(ht,u+1))!==-1;)a.push({type:7,index:o}),u+=ht.length-1}o++}}static createElement(t,n){const s=Gt.createElement("template");return s.innerHTML=t,s}}function yn(e,t,n=e,s){if(t===wt)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const o=Gn(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=yn(e,i._$AS(e,t.values),i,s)),t}class ju{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??Gt).importNode(n,!0);Kt.currentNode=i;let o=Kt.nextNode(),r=0,l=0,a=s[0];for(;a!==void 0;){if(r===a.index){let d;a.type===2?d=new Zs(o,o.nextSibling,this,t):a.type===1?d=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(d=new Gu(o,this,t)),this._$AV.push(d),a=s[++l]}r!==a?.index&&(o=Kt.nextNode(),r++)}return Kt.currentNode=Gt,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let Zs=class Vl{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=yn(this,t,n),Gn(t)?t===h||t==null||t===""?(this._$AH!==h&&this._$AR(),this._$AH=h):t!==this._$AH&&t!==wt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Hu(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==h&&Gn(this._$AH)?this._$AA.nextSibling.data=t:this.T(Gt.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Vn.createElement(Gl(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const o=new ju(i,this),r=o.u(this.options);o.p(n),this.T(r),this._$AH=o}}_$AC(t){let n=Yr.get(t.strings);return n===void 0&&Yr.set(t.strings,n=new Vn(t)),n}k(t){Po(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const o of t)i===n.length?n.push(s=new Vl(this.O(qn()),this.O(qn()),this,this.options)):s=n[i],s._$AI(o),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=Wr(t).nextSibling;Wr(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ei=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,o){this.type=1,this._$AH=h,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=h}_$AI(t,n=this,s,i){const o=this.strings;let r=!1;if(o===void 0)t=yn(this,t,n,0),r=!Gn(t)||t!==this._$AH&&t!==wt,r&&(this._$AH=t);else{const l=t;let a,d;for(t=o[0],a=0;a<o.length-1;a++)d=yn(this,l[s+a],n,a),d===wt&&(d=this._$AH[a]),r||=!Gn(d)||d!==this._$AH[a],d===h?t=h:t!==h&&(t+=(d??"")+o[a+1]),this._$AH[a]=d}r&&!i&&this.j(t)}j(t){t===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ku=class extends ei{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===h?void 0:t}},Wu=class extends ei{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==h)}},qu=class extends ei{constructor(t,n,s,i,o){super(t,n,s,i,o),this.type=5}_$AI(t,n=this){if((t=yn(this,t,n,0)??h)===wt)return;const s=this._$AH,i=t===h&&s!==h||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==h&&(s===h||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Gu=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){yn(this,t)}};const Vu={I:Zs},Ju=Do.litHtmlPolyfillSupport;Ju?.(Vn,Zs),(Do.litHtmlVersions??=[]).push("3.3.2");const Qu=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const o=n?.renderBefore??null;s._$litPart$=i=new Zs(t.insertBefore(qn(),o),o,void 0,n??{})}return i._$AI(e),i};const Fo=globalThis;let mn=class extends cn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Qu(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return wt}};mn._$litElement$=!0,mn.finalized=!0,Fo.litElementHydrateSupport?.({LitElement:mn});const Yu=Fo.litElementPolyfillSupport;Yu?.({LitElement:mn});(Fo.litElementVersions??=[]).push("4.2.2");const Jl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const Xu={attribute:!0,type:String,converter:Fs,reflect:!1,hasChanged:Lo},Zu=(e=Xu,t,n)=>{const{kind:s,metadata:i}=n;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(n.name,e),s==="accessor"){const{name:r}=n;return{set(l){const a=t.get.call(this);t.set.call(this,l),this.requestUpdate(r,a,e,!0,l)},init(l){return l!==void 0&&this.C(r,void 0,e,l),l}}}if(s==="setter"){const{name:r}=n;return function(l){const a=this[r];t.call(this,l),this.requestUpdate(r,a,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function ti(e){return(t,n)=>typeof n=="object"?Zu(e,t,n):((s,i,o)=>{const r=i.hasOwnProperty(o);return i.constructor.createProperty(o,s),r?Object.getOwnPropertyDescriptor(i,o):void 0})(e,t,n)}function x(e){return ti({...e,state:!0,attribute:!1})}const eg={common:{version:"Version",health:"Health",ok:"OK",offline:"Offline",connect:"Connect",refresh:"Refresh",enabled:"Enabled",disabled:"Disabled",na:"n/a",docs:"Docs",resources:"Resources"},nav:{chat:"Chat",control:"Control",agent:"Agent",settings:"Settings",expand:"Expand sidebar",collapse:"Collapse sidebar"},tabs:{agents:"Agents",overview:"Overview",channels:"Channels",instances:"Instances",sessions:"Sessions",usage:"Usage",cron:"Cron Jobs",skills:"Skills",market:"Skill Market",nodes:"Nodes",chat:"Chat",models:"Models",config:"Config",debug:"Debug",logs:"Logs"},subtitles:{agents:"Manage agent workspaces, tools, and identities.",overview:"Gateway status, entry points, and a fast health read.",channels:"Manage channels and settings.",instances:"Presence beacons from connected clients and nodes.",sessions:"Inspect active sessions and adjust per-session defaults.",usage:"Monitor API usage and costs.",cron:"Schedule wakeups and recurring agent runs.",skills:"Manage skill availability and API key injection.",market:"Install and enable Web3 skills from BitSeek.",nodes:"Paired devices, capabilities, and command exposure.",chat:"Direct gateway chat session for quick interventions.",models:"Manage the default model and OpenAI-compatible providers.",config:"Edit ~/.openclaw/openclaw.json safely.",debug:"Gateway snapshots, events, and manual RPC calls.",logs:"Live tail of the gateway file logs."},overview:{access:{title:"Gateway Access",subtitle:"Where the dashboard connects and how it authenticates.",wsUrl:"WebSocket URL",token:"Gateway Token",password:"Password (not stored)",sessionKey:"Default Session Key",language:"Language",connectHint:"Click Connect to apply connection changes.",trustedProxy:"Authenticated via trusted proxy."},snapshot:{title:"Snapshot",subtitle:"Latest gateway handshake information.",status:"Status",uptime:"Uptime",tickInterval:"Tick Interval",lastChannelsRefresh:"Last Channels Refresh",channelsHint:"Use Channels to link WhatsApp, Telegram, Discord, Signal, or iMessage."},stats:{instances:"Instances",instancesHint:"Presence beacons in the last 5 minutes.",sessions:"Sessions",sessionsHint:"Recent session keys tracked by the gateway.",cron:"Cron",cronNext:"Next wake {time}"},notes:{title:"Notes",subtitle:"Quick reminders for remote control setups.",tailscaleTitle:"Tailscale serve",tailscaleText:"Prefer serve mode to keep the gateway on loopback with tailnet auth.",sessionTitle:"Session hygiene",sessionText:"Use /new or sessions.patch to reset context.",cronTitle:"Cron reminders",cronText:"Use isolated sessions for recurring runs."},auth:{required:"This gateway requires auth. Add a token or password, then click Connect.",failed:"Auth failed. Re-copy a tokenized URL with {command}, or update the token, then click Connect."},pairing:{hint:"This device needs pairing approval from the gateway host.",mobileHint:"On mobile? Copy the full URL (including #token=...) from openclaw dashboard --no-open on your desktop."},insecure:{hint:"This page is HTTP, so the browser blocks device identity. Use HTTPS (Tailscale Serve) or open {url} on the gateway host.",stayHttp:"If you must stay on HTTP, set {config} (token-only)."}},chat:{disconnected:"Disconnected from gateway.",refreshTitle:"Refresh chat data",thinkingToggle:"Toggle assistant thinking/working output",focusToggle:"Toggle focus mode (hide sidebar + page header)",hideCronSessions:"Hide cron sessions",showCronSessions:"Show cron sessions",showCronSessionsHidden:"Show cron sessions ({count} hidden)",onboardingDisabled:"Disabled during onboarding"},languages:{en:"English",zhCN:"简体中文 (Simplified Chinese)",zhTW:"繁體中文 (Traditional Chinese)",ptBR:"Português (Brazilian Portuguese)",de:"Deutsch (German)"},cron:{summary:{enabled:"Enabled",yes:"Yes",no:"No",jobs:"Jobs",nextWake:"Next wake",refreshing:"Refreshing...",refresh:"Refresh"},jobs:{title:"Jobs",subtitle:"All scheduled jobs stored in the gateway.",shownOf:"{shown} shown of {total}",searchJobs:"Search jobs",searchPlaceholder:"Name, description, or agent",enabled:"Enabled",schedule:"Schedule",lastRun:"Last run",all:"All",sort:"Sort",nextRun:"Next run",recentlyUpdated:"Recently updated",name:"Name",direction:"Direction",ascending:"Ascending",descending:"Descending",reset:"Reset",noMatching:"No matching jobs.",loading:"Loading...",loadMore:"Load more jobs"},runs:{title:"Run history",subtitleAll:"Latest runs across all jobs.",subtitleJob:"Latest runs for {title}.",scope:"Scope",allJobs:"All jobs",selectedJob:"Selected job",searchRuns:"Search runs",searchPlaceholder:"Summary, error, or job",newestFirst:"Newest first",oldestFirst:"Oldest first",status:"Status",delivery:"Delivery",clear:"Clear",allStatuses:"All statuses",allDelivery:"All delivery",selectJobHint:"Select a job to inspect run history.",noMatching:"No matching runs.",loadMore:"Load more runs",runStatusOk:"OK",runStatusError:"Error",runStatusSkipped:"Skipped",runStatusUnknown:"Unknown",deliveryDelivered:"Delivered",deliveryNotDelivered:"Not delivered",deliveryUnknown:"Unknown",deliveryNotRequested:"Not requested"},form:{editJob:"Edit Job",newJob:"New Job",updateSubtitle:"Update the selected scheduled job.",createSubtitle:"Create a scheduled wakeup or agent run.",required:"Required",requiredSr:"required",basics:"Basics",basicsSub:"Name it, choose the assistant, and set enabled state.",fieldName:"Name",description:"Description",agentId:"Agent ID",namePlaceholder:"Morning brief",descriptionPlaceholder:"Optional context for this job",agentPlaceholder:"main or ops",agentHelp:"Start typing to pick a known agent, or enter a custom one.",schedule:"Schedule",scheduleSub:"Control when this job runs.",every:"Every",at:"At",cronOption:"Cron",runAt:"Run at",unit:"Unit",minutes:"Minutes",hours:"Hours",days:"Days",expression:"Expression",expressionPlaceholder:"0 7 * * *",everyAmountPlaceholder:"30",timezoneOptional:"Timezone (optional)",timezonePlaceholder:"America/Los_Angeles",timezoneHelp:"Pick a common timezone or enter any valid IANA timezone.",jitterHelp:"Need jitter? Use Advanced → Stagger window / Stagger unit.",execution:"Execution",executionSub:"Choose when to wake, and what this job should do.",session:"Session",main:"Main",isolated:"Isolated",sessionHelp:"Main posts a system event. Isolated runs a dedicated agent turn.",wakeMode:"Wake mode",now:"Now",nextHeartbeat:"Next heartbeat",wakeModeHelp:"Now triggers immediately. Next heartbeat waits for the next cycle.",payloadKind:"What should run?",systemEvent:"Post message to main timeline",agentTurn:"Run assistant task (isolated)",systemEventHelp:"Sends your text to the gateway main timeline (good for reminders/triggers).",agentTurnHelp:"Starts an assistant run in its own session using your prompt.",timeoutSeconds:"Timeout (seconds)",timeoutPlaceholder:"Optional, e.g. 90",timeoutHelp:"Optional. Leave blank to use the gateway default timeout behavior for this run.",mainTimelineMessage:"Main timeline message",assistantTaskPrompt:"Assistant task prompt",deliverySection:"Delivery",deliverySub:"Choose where run summaries are sent.",resultDelivery:"Result delivery",announceDefault:"Announce summary (default)",webhookPost:"Webhook POST",noneInternal:"None (internal)",deliveryHelp:"Announce posts a summary to chat. None keeps execution internal.",webhookUrl:"Webhook URL",channel:"Channel",webhookPlaceholder:"https://example.com/cron",channelHelp:"Choose which connected channel receives the summary.",webhookHelp:"Send run summaries to a webhook endpoint.",to:"To",toPlaceholder:"+1555... or chat id",toHelp:"Optional recipient override (chat id, phone, or user id).",advanced:"Advanced",advancedHelp:"Optional overrides for delivery guarantees, schedule jitter, and model controls.",deleteAfterRun:"Delete after run",deleteAfterRunHelp:"Best for one-shot reminders that should auto-clean up.",clearAgentOverride:"Clear agent override",clearAgentHelp:"Force this job to use the gateway default assistant.",exactTiming:"Exact timing (no stagger)",exactTimingHelp:"Run on exact cron boundaries with no spread.",staggerWindow:"Stagger window",staggerUnit:"Stagger unit",staggerPlaceholder:"30",seconds:"Seconds",model:"Model",modelPlaceholder:"openai/gpt-5.2",modelHelp:"Start typing to pick a known model, or enter a custom one.",thinking:"Thinking",thinkingPlaceholder:"low",thinkingHelp:"Use a suggested level or enter a provider-specific value.",bestEffortDelivery:"Best effort delivery",bestEffortHelp:"Do not fail the job if delivery itself fails.",cantAddYet:"Can't add job yet",fillRequired:"Fill the required fields below to enable submit.",fixFields:"Fix {count} field to continue.",fixFieldsPlural:"Fix {count} fields to continue.",saving:"Saving...",saveChanges:"Save changes",addJob:"Add job",cancel:"Cancel"},jobList:{allJobs:"all jobs",selectJob:"(select a job)",enabled:"enabled",disabled:"disabled",edit:"Edit",clone:"Clone",disable:"Disable",enable:"Enable",run:"Run",history:"History",remove:"Remove"},jobDetail:{system:"System",prompt:"Prompt",delivery:"Delivery",agent:"Agent"},jobState:{status:"Status",next:"Next",last:"Last"},runEntry:{noSummary:"No summary.",runAt:"Run at",openRunChat:"Open run chat",next:"Next {rel}",due:"Due {rel}"},errors:{nameRequired:"Name is required.",scheduleAtInvalid:"Enter a valid date/time.",everyAmountInvalid:"Interval must be greater than 0.",cronExprRequired:"Cron expression is required.",staggerAmountInvalid:"Stagger must be greater than 0.",systemTextRequired:"System text is required.",agentMessageRequired:"Agent message is required.",timeoutInvalid:"If set, timeout must be greater than 0 seconds.",webhookUrlRequired:"Webhook URL is required.",webhookUrlInvalid:"Webhook URL must start with http:// or https://.",invalidRunTime:"Invalid run time.",invalidIntervalAmount:"Invalid interval amount.",cronExprRequiredShort:"Cron expression required.",invalidStaggerAmount:"Invalid stagger amount.",systemEventTextRequired:"System event text required.",agentMessageRequiredShort:"Agent message required.",nameRequiredShort:"Name required."}}},tg="modulepreload",ng=function(e,t){return new URL(e,t).href},Xr={},ps=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let d=function(g){return Promise.all(g.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const r=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),a=l?.nonce||l?.getAttribute("nonce");i=d(n.map(g=>{if(g=ng(g,s),g in Xr)return;Xr[g]=!0;const u=g.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(s)for(let m=r.length-1;m>=0;m--){const S=r[m];if(S.href===g&&(!u||S.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${g}"]${f}`))return;const v=document.createElement("link");if(v.rel=u?"stylesheet":tg,u||(v.as="script"),v.crossOrigin="",v.href=g,a&&v.setAttribute("nonce",a),document.head.appendChild(v),u)return new Promise((m,S)=>{v.addEventListener("load",m),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function o(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return i.then(r=>{for(const l of r||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},Nt="en",Ql=["zh-CN","zh-TW","pt-BR","de"],sg={"zh-CN":{exportName:"zh_CN",loader:()=>ps(()=>import("./zh-CN-DpcDfKwj.js"),[],import.meta.url)},"zh-TW":{exportName:"zh_TW",loader:()=>ps(()=>import("./zh-TW-CrXJRxS8.js"),[],import.meta.url)},"pt-BR":{exportName:"pt_BR",loader:()=>ps(()=>import("./pt-BR-DtCy1Iqj.js"),[],import.meta.url)},de:{exportName:"de",loader:()=>ps(()=>import("./de-DCndbITT.js"),[],import.meta.url)}},Yl=[Nt,...Ql];function Xl(e){return e!=null&&Yl.includes(e)}function ig(e){return Ql.includes(e)}async function og(e){if(!ig(e))return null;const t=sg[e];return(await t.loader())[t.exportName]??null}class rg{constructor(){this.locale=Nt,this.translations={[Nt]:eg},this.subscribers=new Set}getLocale(){return this.locale}async setLocale(t){const n=t!==Nt&&!this.translations[t];if(!(this.locale===t&&!n)){if(n)try{const s=await og(t);if(!s)return;this.translations[t]=s}catch(s){console.error(`Failed to load locale: ${t}`,s);return}this.locale=t,this.notify()}}registerTranslation(t,n){this.translations[t]=n}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}notify(){this.subscribers.forEach(t=>t(this.locale))}t(t,n){const s=t.split(".");let i=this.translations[this.locale]||this.translations[Nt];for(const o of s)if(i&&typeof i=="object")i=i[o];else{i=void 0;break}if(i===void 0&&this.locale!==Nt){i=this.translations[Nt];for(const o of s)if(i&&typeof i=="object")i=i[o];else{i=void 0;break}}return typeof i!="string"?t:n?i.replace(/\{(\w+)\}/g,(o,r)=>n[r]||`{${r}}`):i}}const Jn=new rg,p=(e,t)=>Jn.t(e,t);class ag{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){this.unsubscribe=Jn.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){this.unsubscribe?.()}}async function Re(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function lg(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function cg(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function dg(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function ve(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function Zl(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(ve(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function No(e){return e.filter(t=>typeof t=="string").join(".")}function bt(e,t){const n=No(e),s=t[n];if(s)return s;const i=n.split(".");for(const[o,r]of Object.entries(t)){if(!o.includes("*"))continue;const l=o.split(".");if(l.length!==i.length)continue;let a=!0;for(let d=0;d<i.length;d+=1)if(l[d]!=="*"&&l[d]!==i[d]){a=!1;break}if(a)return r}}function ni(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Zr(e,t){const n=e.trim();if(n==="")return;const s=Number(n);return!Number.isFinite(s)||t&&!Number.isInteger(s)?e:s}function ea(e){const t=e.trim();return t==="true"?!0:t==="false"?!1:e}function pt(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let s=e;for(const i of t.allOf)s=pt(s,i);return s}const n=ve(t);if(t.anyOf||t.oneOf){const s=(t.anyOf??t.oneOf??[]).filter(i=>!(i.type==="null"||Array.isArray(i.type)&&i.type.includes("null")));if(s.length===1)return pt(e,s[0]);if(typeof e=="string")for(const i of s){const o=ve(i);if(o==="number"||o==="integer"){const r=Zr(e,o==="integer");if(r===void 0||typeof r=="number")return r}if(o==="boolean"){const r=ea(e);if(typeof r=="boolean")return r}}for(const i of s){const o=ve(i);if(o==="object"&&typeof e=="object"&&!Array.isArray(e)||o==="array"&&Array.isArray(e))return pt(e,i)}return e}if(n==="number"||n==="integer"){if(typeof e=="string"){const s=Zr(e,n==="integer");if(s===void 0||typeof s=="number")return s}return e}if(n==="boolean"){if(typeof e=="string"){const s=ea(e);if(typeof s=="boolean")return s}return e}if(n==="object"){if(typeof e!="object"||Array.isArray(e))return e;const s=e,i=t.properties??{},o=t.additionalProperties&&typeof t.additionalProperties=="object"?t.additionalProperties:null,r={};for(const[l,a]of Object.entries(s)){const d=i[l]??o,g=d?pt(a,d):a;g!==void 0&&(r[l]=g)}return r}if(n==="array"){if(!Array.isArray(e))return e;if(Array.isArray(t.items)){const i=t.items;return e.map((o,r)=>{const l=r<i.length?i[r]:void 0;return l?pt(o,l):o})}const s=t.items;return s?e.map(i=>pt(i,s)).filter(i=>i!==void 0):e}return e}function St(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function $n(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
4
4
|
`}function ec(e,t,n){if(t.length===0)return;let s=e;for(let o=0;o<t.length-1;o+=1){const r=t[o],l=t[o+1];if(typeof r=="number"){if(!Array.isArray(s))return;s[r]==null&&(s[r]=typeof l=="number"?[]:{}),s=s[r]}else{if(typeof s!="object"||s==null)return;const a=s;a[r]==null&&(a[r]=typeof l=="number"?[]:{}),s=a[r]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function tc(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const o=t[i];if(typeof o=="number"){if(!Array.isArray(n))return;n=n[o]}else{if(typeof n!="object"||n==null)return;n=n[o]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function Ae(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});gg(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function nc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});ug(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function ug(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function gg(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?$n(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=$n(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=St(t.config??{}),e.configFormOriginal=St(t.config??{}),e.configRawOriginal=n)}function fg(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function sc(e){if(e.configFormMode!=="form"||!e.configForm)return e.configRaw;const t=fg(e.configSchema),n=t?pt(e.configForm,t):e.configForm;return $n(n)}async function On(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=sc(e),n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await Ae(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function pg(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=sc(e),n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.apply",{raw:t,baseHash:n,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await Ae(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function ta(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function Me(e,t,n){const s=St(e.configForm??e.configSnapshot?.config??{});ec(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=$n(s))}function qe(e,t){const n=St(e.configForm??e.configSnapshot?.config??{});tc(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=$n(n))}function hg(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 mg(e){const{state:t,callbacks:n,accountId:s}=e,i=hg(t),o=(l,a,d={})=>{const{type:g="text",placeholder:u,maxLength:f,help:v}=d,m=t.values[l]??"",S=t.fieldErrors[l],C=`nostr-profile-${l}`;return g==="textarea"?c`
|
|
5
5
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
6
6
|
<label for="${C}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
@@ -121,21 +121,21 @@
|
|
|
121
121
|
</div>
|
|
122
122
|
`:h}
|
|
123
123
|
</div>
|
|
124
|
-
`}function vg(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 bg(e,t){await lg(e,t),await Re(e,!0)}async function yg(e){await cg(e),await Re(e,!0)}async function $g(e){await dg(e),await Re(e,!0)}async function xg(e){await On(e),await Ae(e),await Re(e,!0)}async function wg(e){await Ae(e),await Re(e,!0)}function Sg(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const o=s.trim(),r=i.join(":").trim();o&&r&&(t[o]=r)}return t}function ic(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function oc(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function kg(e){const t=e.hello?.auth?.deviceToken?.trim();if(t)return`Bearer ${t}`;const n=e.settings.token.trim();if(n)return`Bearer ${n}`;const s=e.password.trim();return s?`Bearer ${s}`:null}function rc(e){const t=kg(e);return t?{Authorization:t}:{}}function Ag(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=vg(n??void 0)}function Cg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Tg(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Eg(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function _g(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=ic(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(oc(n),{method:"PUT",headers:{"Content-Type":"application/json",...rc(e)},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const o=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Sg(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await Re(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Ig(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=ic(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(oc(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json",...rc(e)},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:a,success:null};return}const o=i.merged??i.imported??null,r=o?{...t.values,...o}:t.values,l=!!(r.banner||r.website||r.nip05||r.lud16);e.nostrProfileFormState={...t,importing:!1,values:r,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await Re(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function Mg(e){const t=(e??"").trim().toLowerCase();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const
|
|
124
|
+
`}function vg(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 bg(e,t){await lg(e,t),await Re(e,!0)}async function yg(e){await cg(e),await Re(e,!0)}async function $g(e){await dg(e),await Re(e,!0)}async function xg(e){await On(e),await Ae(e),await Re(e,!0)}async function wg(e){await Ae(e),await Re(e,!0)}function Sg(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const o=s.trim(),r=i.join(":").trim();o&&r&&(t[o]=r)}return t}function ic(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function oc(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function kg(e){const t=e.hello?.auth?.deviceToken?.trim();if(t)return`Bearer ${t}`;const n=e.settings.token.trim();if(n)return`Bearer ${n}`;const s=e.password.trim();return s?`Bearer ${s}`:null}function rc(e){const t=kg(e);return t?{Authorization:t}:{}}function Ag(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=vg(n??void 0)}function Cg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Tg(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Eg(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function _g(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=ic(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(oc(n),{method:"PUT",headers:{"Content-Type":"application/json",...rc(e)},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const o=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Sg(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await Re(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Ig(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=ic(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(oc(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json",...rc(e)},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:a,success:null};return}const o=i.merged??i.imported??null,r=o?{...t.values,...o}:t.values,l=!!(r.banner||r.website||r.nip05||r.lud16);e.nostrProfileFormState={...t,importing:!1,values:r,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await Re(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function Mg(e){const t=(e??"").trim().toLowerCase();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const Zi=450;function ss(e,t=!1,n=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const s=()=>{const i=e.querySelector(".chat-thread");if(i){const o=getComputedStyle(i).overflowY;if(o==="auto"||o==="scroll"||i.scrollHeight-i.clientHeight>1)return i}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const i=s();if(!i)return;const o=i.scrollHeight-i.scrollTop-i.clientHeight,r=t&&!e.chatHasAutoScrolled;if(!(r||e.chatUserNearBottom||o<Zi)){e.chatNewMessagesBelow=!0;return}r&&(e.chatHasAutoScrolled=!0);const a=n&&(typeof window>"u"||typeof window.matchMedia!="function"||!window.matchMedia("(prefers-reduced-motion: reduce)").matches),d=i.scrollHeight;typeof i.scrollTo=="function"?i.scrollTo({top:d,behavior:a?"smooth":"auto"}):i.scrollTop=d,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1;const g=r?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const u=s();if(!u)return;const f=u.scrollHeight-u.scrollTop-u.clientHeight;(r||e.chatUserNearBottom||f<Zi)&&(u.scrollTop=u.scrollHeight,e.chatUserNearBottom=!0)},g)})})}function ac(e,t=!1){e.logsScrollFrame&&cancelAnimationFrame(e.logsScrollFrame),e.updateComplete.then(()=>{e.logsScrollFrame=requestAnimationFrame(()=>{e.logsScrollFrame=null;const n=e.querySelector(".log-stream");if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;(t||s<80)&&(n.scrollTop=n.scrollHeight)})})}function Rg(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<Zi,e.chatUserNearBottom&&(e.chatNewMessagesBelow=!1)}function Lg(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 Dg(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
125
125
|
`)}
|
|
126
|
-
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${o}.log`,i.click(),URL.revokeObjectURL(s)}function Pg(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}async function ni(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const o=s;e.debugModels=Array.isArray(o?.models)?o?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Fg(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const Ng=2e3,Og=new Set(["trace","debug","info","warn","error","fatal"]);function Ug(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function Bg(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Og.has(t)?t:null}function Hg(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=Bg(n?.logLevelName??n?.level),o=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,r=Ug(o);let l=null;r&&(typeof r.subsystem=="string"?l=r.subsystem:typeof r.module=="string"&&(l=r.module)),!l&&o&&o.length<120&&(l=o);let a=null;return typeof t[1]=="string"?a=t[1]:!r&&typeof t[0]=="string"?a=t[0]:typeof t.message=="string"&&(a=t.message),{raw:e,time:s,level:i,subsystem:l,message:a??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Oo(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),o=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(Hg),r=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-Ng),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}async function si(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function zg(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{si(e,{quiet:!0})},5e3))}function jg(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function lc(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Oo(e,{quiet:!0})},2e3))}function cc(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function dc(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&ni(e)},3e3))}function uc(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function gc(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function fc(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function Es(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Uo(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}async function Hn(e,t){if(!(!e.client||!e.connected)&&!e.toolsCatalogLoading){e.toolsCatalogLoading=!0,e.toolsCatalogError=null;try{const n=await e.client.request("tools.catalog",{agentId:t??e.agentsSelectedId??void 0,includePlugins:!0});n&&(e.toolsCatalogResult=n)}catch(n){e.toolsCatalogError=String(n)}finally{e.toolsCatalogLoading=!1}}}const Kg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Ns={name:"",description:"",agentId:"",sessionKey:"",clearAgent:!1,enabled:!0,deleteAfterRun:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds",sessionTarget:"isolated",wakeMode:"now",payloadKind:"agentTurn",payloadText:"",payloadModel:"",payloadThinking:"",payloadLightContext:!1,deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",deliveryAccountId:"",deliveryBestEffort:!1,failureAlertMode:"inherit",failureAlertAfter:"2",failureAlertCooldownSeconds:"3600",failureAlertChannel:"last",failureAlertTo:"",failureAlertDeliveryMode:"announce",failureAlertAccountId:"",timeoutSeconds:""};function Bo(e,t){if(e==null||!Number.isFinite(e)||e<=0)return;if(e<1e3)return`${Math.round(e)}ms`;const n=t?.spaced?" ":"",s=Math.round(e/1e3),i=Math.floor(s/3600),o=Math.floor(s%3600/60),r=s%60;if(i>=24){const l=Math.floor(i/24),a=i%24;return a>0?`${l}d${n}${a}h`:`${l}d`}return i>0?o>0?`${i}h${n}${o}m`:`${i}h`:o>0?r>0?`${o}m${n}${r}s`:`${o}m`:`${r}s`}function Ho(e,t="n/a"){if(e==null||!Number.isFinite(e)||e<0)return t;if(e<1e3)return`${Math.round(e)}ms`;const n=Math.round(e/1e3);if(n<60)return`${n}s`;const s=Math.round(n/60);if(s<60)return`${s}m`;const i=Math.round(s/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}function ne(e,t){const n=t?.fallback??"n/a";if(e==null||!Number.isFinite(e))return n;const s=Date.now()-e,i=Math.abs(s),o=s>=0,r=Math.round(i/1e3);if(r<60)return o?"just now":"in <1m";const l=Math.round(r/60);if(l<60)return o?`${l}m ago`:`in ${l}m`;const a=Math.round(l/60);if(a<48)return o?`${a}h ago`:`in ${a}h`;const d=Math.round(a/24);return o?`${d}d ago`:`in ${d}d`}function Zi(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const o=(i.index??0)+i[1].length;t.push({start:o,end:o+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const o=i.index??0,r=o+i[0].length;t.some(a=>o>=a.start&&r<=a.end)||t.push({start:o,end:r})}return t.sort((i,o)=>i.start-o.start),t}function eo(e,t){return t.some(n=>e>=n.start&&e<n.end)}const Wg=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,hs=/<\s*\/?\s*final\b[^<>]*>/gi,sa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function qg(e,t){return e.trimStart()}function Gg(e,t){if(!e||!Wg.test(e))return e;let n=e;if(hs.test(n)){hs.lastIndex=0;const l=[],a=Zi(n);for(const d of n.matchAll(hs)){const g=d.index??0;l.push({start:g,length:d[0].length,inCode:eo(g,a)})}for(let d=l.length-1;d>=0;d--){const g=l[d];g.inCode||(n=n.slice(0,g.start)+n.slice(g.start+g.length))}}else hs.lastIndex=0;const s=Zi(n);sa.lastIndex=0;let i="",o=0,r=!1;for(const l of n.matchAll(sa)){const a=l.index??0,d=l[1]==="/";eo(a,s)||(r?d&&(r=!1):(i+=n.slice(o,a),d||(r=!0)),o=a+l[0].length)}return i+=n.slice(o),qg(i)}const ia=/<\s*(\/?)\s*relevant[-_]memories\b[^<>]*>/gi,Vg=/<\s*\/?\s*relevant[-_]memories\b/i;function Jg(e){if(!e||!Vg.test(e))return e;ia.lastIndex=0;const t=Zi(e);let n="",s=0,i=!1;for(const o of e.matchAll(ia)){const r=o.index??0;if(eo(r,t))continue;const l=o[1]==="/";i?l&&(i=!1):(n+=e.slice(s,r),l||(i=!0)),s=r+o[0].length}return i||(n+=e.slice(s)),n}function Qg(e){const t=Gg(e);return Jg(t).trimStart()}function kt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function to(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function no(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function pc(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Fe(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Yg(e){return Qg(e)}const _s="last";function Xg(e){return e.sessionTarget==="isolated"&&e.payloadKind==="agentTurn"}function zo(e){return e.deliveryMode!=="announce"||Xg(e)?e:{...e,deliveryMode:"none"}}function is(e){const t={};if(e.name.trim()||(t.name="cron.errors.nameRequired"),e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);Number.isFinite(n)||(t.scheduleAt="cron.errors.scheduleAtInvalid")}else if(e.scheduleKind==="every")Fe(e.everyAmount,0)<=0&&(t.everyAmount="cron.errors.everyAmountInvalid");else if(e.cronExpr.trim()||(t.cronExpr="cron.errors.cronExprRequired"),!e.scheduleExact){const n=e.staggerAmount.trim();n&&Fe(n,0)<=0&&(t.staggerAmount="cron.errors.staggerAmountInvalid")}if(e.payloadText.trim()||(t.payloadText=e.payloadKind==="systemEvent"?"cron.errors.systemTextRequired":"cron.errors.agentMessageRequired"),e.payloadKind==="agentTurn"){const n=e.timeoutSeconds.trim();n&&Fe(n,0)<=0&&(t.timeoutSeconds="cron.errors.timeoutInvalid")}if(e.deliveryMode==="webhook"){const n=e.deliveryTo.trim();n?/^https?:\/\//i.test(n)||(t.deliveryTo="cron.errors.webhookUrlInvalid"):t.deliveryTo="cron.errors.webhookUrlRequired"}if(e.failureAlertMode==="custom"){const n=e.failureAlertAfter.trim();if(n){const i=Fe(n,0);(!Number.isFinite(i)||i<=0)&&(t.failureAlertAfter="Failure alert threshold must be greater than 0.")}const s=e.failureAlertCooldownSeconds.trim();if(s){const i=Fe(s,-1);(!Number.isFinite(i)||i<0)&&(t.failureAlertCooldownSeconds="Cooldown must be 0 or greater.")}}return t}function hc(e){return Object.keys(e).length>0}async function os(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function Zg(e){if(!(!e.client||!e.connected))try{const n=(await e.client.request("models.list",{}))?.models;if(!Array.isArray(n)){e.cronModelSuggestions=[];return}const s=n.map(i=>{if(!i||typeof i!="object")return"";const o=i.id;return typeof o=="string"?o.trim():""}).filter(Boolean);e.cronModelSuggestions=Array.from(new Set(s)).toSorted((i,o)=>i.localeCompare(o))}catch{e.cronModelSuggestions=[]}}async function ii(e){return await jo(e,{append:!1})}function mc(e){const t=typeof e.totalRaw=="number"&&Number.isFinite(e.totalRaw)?Math.max(0,Math.floor(e.totalRaw)):e.pageCount,n=typeof e.limitRaw=="number"&&Number.isFinite(e.limitRaw)?Math.max(1,Math.floor(e.limitRaw)):Math.max(1,e.pageCount),s=typeof e.offsetRaw=="number"&&Number.isFinite(e.offsetRaw)?Math.max(0,Math.floor(e.offsetRaw)):0,i=typeof e.hasMoreRaw=="boolean"?e.hasMoreRaw:s+e.pageCount<Math.max(t,s+e.pageCount),o=typeof e.nextOffsetRaw=="number"&&Number.isFinite(e.nextOffsetRaw)?Math.max(0,Math.floor(e.nextOffsetRaw)):i?s+e.pageCount:null;return{total:t,limit:n,offset:s,hasMore:i,nextOffset:o}}async function jo(e,t){if(!e.client||!e.connected||e.cronLoading||e.cronJobsLoadingMore)return;const n=t?.append===!0;if(n){if(!e.cronJobsHasMore)return;e.cronJobsLoadingMore=!0}else e.cronLoading=!0;e.cronError=null;try{const s=n?Math.max(0,e.cronJobsNextOffset??e.cronJobs.length):0,i=await e.client.request("cron.list",{includeDisabled:e.cronJobsEnabledFilter==="all",limit:e.cronJobsLimit,offset:s,query:e.cronJobsQuery.trim()||void 0,enabled:e.cronJobsEnabledFilter,sortBy:e.cronJobsSortBy,sortDir:e.cronJobsSortDir}),o=Array.isArray(i.jobs)?i.jobs:[];e.cronJobs=n?[...e.cronJobs,...o]:o;const r=mc({totalRaw:i.total,limitRaw:i.limit,offsetRaw:i.offset,nextOffsetRaw:i.nextOffset,hasMoreRaw:i.hasMore,pageCount:o.length});e.cronJobsTotal=Math.max(r.total,e.cronJobs.length),e.cronJobsHasMore=r.hasMore,e.cronJobsNextOffset=r.nextOffset,e.cronEditingJobId&&!e.cronJobs.some(l=>l.id===e.cronEditingJobId)&&rs(e)}catch(s){e.cronError=String(s)}finally{n?e.cronJobsLoadingMore=!1:e.cronLoading=!1}}async function ef(e){await jo(e,{append:!0})}async function oa(e){await jo(e,{append:!1})}function ra(e,t){typeof t.cronJobsQuery=="string"&&(e.cronJobsQuery=t.cronJobsQuery),t.cronJobsEnabledFilter&&(e.cronJobsEnabledFilter=t.cronJobsEnabledFilter),t.cronJobsScheduleKindFilter&&(e.cronJobsScheduleKindFilter=t.cronJobsScheduleKindFilter),t.cronJobsLastStatusFilter&&(e.cronJobsLastStatusFilter=t.cronJobsLastStatusFilter),t.cronJobsSortBy&&(e.cronJobsSortBy=t.cronJobsSortBy),t.cronJobsSortDir&&(e.cronJobsSortDir=t.cronJobsSortDir)}function tf(e){return e.cronJobs.filter(t=>!(e.cronJobsScheduleKindFilter!=="all"&&t.schedule.kind!==e.cronJobsScheduleKindFilter||e.cronJobsLastStatusFilter!=="all"&&t.state?.lastStatus!==e.cronJobsLastStatusFilter))}function rs(e){e.cronEditingJobId=null}function vc(e){e.cronForm={...Ns},e.cronFieldErrors=is(e.cronForm)}function nf(e){const t=Date.parse(e);if(!Number.isFinite(t))return"";const n=new Date(t),s=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0"),r=String(n.getHours()).padStart(2,"0"),l=String(n.getMinutes()).padStart(2,"0");return`${s}-${i}-${o}T${r}:${l}`}function sf(e){if(e%864e5===0)return{everyAmount:String(Math.max(1,e/864e5)),everyUnit:"days"};if(e%36e5===0)return{everyAmount:String(Math.max(1,e/36e5)),everyUnit:"hours"};const t=Math.max(1,Math.ceil(e/6e4));return{everyAmount:String(t),everyUnit:"minutes"}}function of(e){return e===0?{scheduleExact:!0,staggerAmount:"",staggerUnit:"seconds"}:typeof e!="number"||!Number.isFinite(e)||e<0?{scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds"}:e%6e4===0?{scheduleExact:!1,staggerAmount:String(Math.max(1,e/6e4)),staggerUnit:"minutes"}:{scheduleExact:!1,staggerAmount:String(Math.max(1,Math.ceil(e/1e3))),staggerUnit:"seconds"}}function bc(e,t){const n=e.failureAlert,s={...t,name:e.name,description:e.description??"",agentId:e.agentId??"",sessionKey:e.sessionKey??"",clearAgent:!1,enabled:e.enabled,deleteAfterRun:e.deleteAfterRun??!1,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:t.everyAmount,everyUnit:t.everyUnit,cronExpr:t.cronExpr,cronTz:"",scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds",sessionTarget:e.sessionTarget,wakeMode:e.wakeMode,payloadKind:e.payload.kind,payloadText:e.payload.kind==="systemEvent"?e.payload.text:e.payload.message,payloadModel:e.payload.kind==="agentTurn"?e.payload.model??"":"",payloadThinking:e.payload.kind==="agentTurn"?e.payload.thinking??"":"",payloadLightContext:e.payload.kind==="agentTurn"?e.payload.lightContext===!0:!1,deliveryMode:e.delivery?.mode??"none",deliveryChannel:e.delivery?.channel??_s,deliveryTo:e.delivery?.to??"",deliveryAccountId:e.delivery?.accountId??"",deliveryBestEffort:e.delivery?.bestEffort??!1,failureAlertMode:n===!1?"disabled":n&&typeof n=="object"?"custom":"inherit",failureAlertAfter:n&&typeof n=="object"&&typeof n.after=="number"?String(n.after):Ns.failureAlertAfter,failureAlertCooldownSeconds:n&&typeof n=="object"&&typeof n.cooldownMs=="number"?String(Math.floor(n.cooldownMs/1e3)):Ns.failureAlertCooldownSeconds,failureAlertChannel:n&&typeof n=="object"?n.channel??_s:_s,failureAlertTo:n&&typeof n=="object"?n.to??"":"",failureAlertDeliveryMode:n&&typeof n=="object"?n.mode??"announce":"announce",failureAlertAccountId:n&&typeof n=="object"?n.accountId??"":"",timeoutSeconds:e.payload.kind==="agentTurn"&&typeof e.payload.timeoutSeconds=="number"?String(e.payload.timeoutSeconds):""};if(e.schedule.kind==="at")s.scheduleAt=nf(e.schedule.at);else if(e.schedule.kind==="every"){const i=sf(e.schedule.everyMs);s.everyAmount=i.everyAmount,s.everyUnit=i.everyUnit}else{s.cronExpr=e.schedule.expr,s.cronTz=e.schedule.tz??"";const i=of(e.schedule.staggerMs);s.scheduleExact=i.scheduleExact,s.staggerAmount=i.staggerAmount,s.staggerUnit=i.staggerUnit}return zo(s)}function rf(e){if(e.scheduleKind==="at"){const o=Date.parse(e.scheduleAt);if(!Number.isFinite(o))throw new Error(p("cron.errors.invalidRunTime"));return{kind:"at",at:new Date(o).toISOString()}}if(e.scheduleKind==="every"){const o=Fe(e.everyAmount,0);if(o<=0)throw new Error(p("cron.errors.invalidIntervalAmount"));const r=e.everyUnit;return{kind:"every",everyMs:o*(r==="minutes"?6e4:r==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error(p("cron.errors.cronExprRequiredShort"));if(e.scheduleExact)return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0,staggerMs:0};const n=e.staggerAmount.trim();if(!n)return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0};const s=Fe(n,0);if(s<=0)throw new Error(p("cron.errors.invalidStaggerAmount"));const i=e.staggerUnit==="minutes"?s*6e4:s*1e3;return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0,staggerMs:i}}function af(e){if(e.payloadKind==="systemEvent"){const r=e.payloadText.trim();if(!r)throw new Error(p("cron.errors.systemEventTextRequired"));return{kind:"systemEvent",text:r}}const t=e.payloadText.trim();if(!t)throw new Error(p("cron.errors.agentMessageRequiredShort"));const n={kind:"agentTurn",message:t},s=e.payloadModel.trim();s&&(n.model=s);const i=e.payloadThinking.trim();i&&(n.thinking=i);const o=Fe(e.timeoutSeconds,0);return o>0&&(n.timeoutSeconds=o),e.payloadLightContext&&(n.lightContext=!0),n}function lf(e){if(e.failureAlertMode==="disabled")return!1;if(e.failureAlertMode!=="custom")return;const t=Fe(e.failureAlertAfter.trim(),0),n=e.failureAlertCooldownSeconds.trim(),s=n.length>0?Fe(n,0):void 0,i=s!==void 0&&Number.isFinite(s)&&s>=0?Math.floor(s*1e3):void 0,o=e.failureAlertDeliveryMode,r=e.failureAlertAccountId.trim(),l={after:t>0?Math.floor(t):void 0,channel:e.failureAlertChannel.trim()||_s,to:e.failureAlertTo.trim()||void 0,...i!==void 0?{cooldownMs:i}:{}};return o&&(l.mode=o),l.accountId=r||void 0,l}async function cf(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=zo(e.cronForm);t!==e.cronForm&&(e.cronForm=t);const n=is(t);if(e.cronFieldErrors=n,hc(n))return;const s=rf(t),i=af(t),o=e.cronEditingJobId?e.cronJobs.find(v=>v.id===e.cronEditingJobId):void 0;if(i.kind==="agentTurn"){const v=o?.payload.kind==="agentTurn"?o.payload.lightContext:void 0;!t.payloadLightContext&&e.cronEditingJobId&&v!==void 0&&(i.lightContext=!1)}const r=t.deliveryMode,l=r&&r!=="none"?{mode:r,channel:r==="announce"?t.deliveryChannel.trim()||"last":void 0,to:t.deliveryTo.trim()||void 0,accountId:r==="announce"?t.deliveryAccountId.trim():void 0,bestEffort:t.deliveryBestEffort}:r==="none"?{mode:"none"}:void 0,a=lf(t),d=t.clearAgent?null:t.agentId.trim(),u=t.sessionKey.trim()||(o?.sessionKey?null:void 0),f={name:t.name.trim(),description:t.description.trim(),agentId:d===null?null:d||void 0,sessionKey:u,enabled:t.enabled,deleteAfterRun:t.deleteAfterRun,schedule:s,sessionTarget:t.sessionTarget,wakeMode:t.wakeMode,payload:i,delivery:l,failureAlert:a};if(!f.name)throw new Error(p("cron.errors.nameRequiredShort"));e.cronEditingJobId?(await e.client.request("cron.update",{id:e.cronEditingJobId,patch:f}),rs(e)):(await e.client.request("cron.add",f),vc(e)),await ii(e),await os(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function df(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await ii(e),await os(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function uf(e,t,n="force"){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:n}),e.cronRunsScope==="all"?await yt(e,null):await yt(e,t.id)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function gf(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronEditingJobId===t.id&&rs(e),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null),await ii(e),await os(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function yt(e,t,n){if(!e.client||!e.connected)return;const s=e.cronRunsScope,i=t??e.cronRunsJobId;if(s==="job"&&!i){e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null;return}const o=n?.append===!0;if(!(o&&!e.cronRunsHasMore))try{o&&(e.cronRunsLoadingMore=!0);const r=o?Math.max(0,e.cronRunsNextOffset??e.cronRuns.length):0,l=await e.client.request("cron.runs",{scope:s,id:s==="job"?i??void 0:void 0,limit:e.cronRunsLimit,offset:r,statuses:e.cronRunsStatuses.length>0?e.cronRunsStatuses:void 0,status:e.cronRunsStatusFilter,deliveryStatuses:e.cronRunsDeliveryStatuses.length>0?e.cronRunsDeliveryStatuses:void 0,query:e.cronRunsQuery.trim()||void 0,sortDir:e.cronRunsSortDir}),a=Array.isArray(l.entries)?l.entries:[];e.cronRuns=o&&(s==="all"||e.cronRunsJobId===i)?[...e.cronRuns,...a]:a,s==="job"&&(e.cronRunsJobId=i??null);const d=mc({totalRaw:l.total,limitRaw:l.limit,offsetRaw:l.offset,nextOffsetRaw:l.nextOffset,hasMoreRaw:l.hasMore,pageCount:a.length});e.cronRunsTotal=Math.max(d.total,e.cronRuns.length),e.cronRunsHasMore=d.hasMore,e.cronRunsNextOffset=d.nextOffset}catch(r){e.cronError=String(r)}finally{o&&(e.cronRunsLoadingMore=!1)}}async function ff(e){e.cronRunsScope==="job"&&!e.cronRunsJobId||await yt(e,e.cronRunsJobId,{append:!0})}function aa(e,t){t.cronRunsScope&&(e.cronRunsScope=t.cronRunsScope),Array.isArray(t.cronRunsStatuses)&&(e.cronRunsStatuses=t.cronRunsStatuses,e.cronRunsStatusFilter=t.cronRunsStatuses.length===1?t.cronRunsStatuses[0]:"all"),Array.isArray(t.cronRunsDeliveryStatuses)&&(e.cronRunsDeliveryStatuses=t.cronRunsDeliveryStatuses),t.cronRunsStatusFilter&&(e.cronRunsStatusFilter=t.cronRunsStatusFilter,e.cronRunsStatuses=t.cronRunsStatusFilter==="all"?[]:[t.cronRunsStatusFilter]),typeof t.cronRunsQuery=="string"&&(e.cronRunsQuery=t.cronRunsQuery),t.cronRunsSortDir&&(e.cronRunsSortDir=t.cronRunsSortDir)}function pf(e,t){e.cronEditingJobId=t.id,e.cronRunsJobId=t.id,e.cronForm=bc(t,e.cronForm),e.cronFieldErrors=is(e.cronForm)}function hf(e,t){const n=e.trim()||"Job",s=`${n} copy`;if(!t.has(s.toLowerCase()))return s;let i=2;for(;i<1e3;){const o=`${n} copy ${i}`;if(!t.has(o.toLowerCase()))return o;i+=1}return`${n} copy ${Date.now()}`}function mf(e,t){rs(e),e.cronRunsJobId=t.id;const n=new Set(e.cronJobs.map(i=>i.name.trim().toLowerCase())),s=bc(t,e.cronForm);s.name=hf(t.name,n),e.cronForm=s,e.cronFieldErrors=is(e.cronForm)}function vf(e){rs(e),vc(e)}function Ko(e){return e.trim()}function bf(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].toSorted()}function yf(e){const t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return null;const n=Ko(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function $f(e){const t=Ko(e.role),n=e.adapter.readStore(),s={version:1,deviceId:e.deviceId,tokens:n&&n.deviceId===e.deviceId&&n.tokens?{...n.tokens}:{}},i={token:e.token,role:t,scopes:bf(e.scopes),updatedAtMs:Date.now()};return s.tokens[t]=i,e.adapter.writeStore(s),i}function xf(e){const t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return;const n=Ko(e.role);if(!t.tokens[n])return;const s={version:1,deviceId:t.deviceId,tokens:{...t.tokens}};delete s.tokens[n],e.adapter.writeStore(s)}const yc="openclaw.device.auth.v1";function Wo(){try{const e=window.localStorage.getItem(yc);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function qo(e){try{window.localStorage.setItem(yc,JSON.stringify(e))}catch{}}function wf(e){return yf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role})}function $c(e){return $f({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role,token:e.token,scopes:e.scopes})}function xc(e){xf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role})}const wc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:Se,n:Is,Gx:la,Gy:ca,a:Ai,d:Ci,h:Sf}=wc,Vt=32,Go=64,kf=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},me=(e="")=>{const t=new Error(e);throw kf(t,me),t},Af=e=>typeof e=="bigint",Cf=e=>typeof e=="string",Tf=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Tt=(e,t,n="")=>{const s=Tf(e),i=e?.length,o=t!==void 0;if(!s||o&&i!==t){const r=n&&`"${n}" `,l=o?` of length ${t}`:"",a=s?`length=${i}`:`type=${typeof e}`;me(r+"expected Uint8Array"+l+", got "+a)}return e},oi=e=>new Uint8Array(e),Sc=e=>Uint8Array.from(e),kc=(e,t)=>e.toString(16).padStart(t,"0"),Ac=e=>Array.from(Tt(e)).map(t=>kc(t,2)).join(""),ot={_0:48,_9:57,A:65,F:70,a:97,f:102},da=e=>{if(e>=ot._0&&e<=ot._9)return e-ot._0;if(e>=ot.A&&e<=ot.F)return e-(ot.A-10);if(e>=ot.a&&e<=ot.f)return e-(ot.a-10)},Cc=e=>{const t="hex invalid";if(!Cf(e))return me(t);const n=e.length,s=n/2;if(n%2)return me(t);const i=oi(s);for(let o=0,r=0;o<s;o++,r+=2){const l=da(e.charCodeAt(r)),a=da(e.charCodeAt(r+1));if(l===void 0||a===void 0)return me(t);i[o]=l*16+a}return i},Tc=()=>globalThis?.crypto,Ef=()=>Tc()?.subtle??me("crypto.subtle must be defined, consider polyfill"),Qn=(...e)=>{const t=oi(e.reduce((s,i)=>s+Tt(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},_f=(e=Vt)=>Tc().getRandomValues(oi(e)),Os=BigInt,Ot=(e,t,n,s="bad number: out of range")=>Af(e)&&t<=e&&e<n?e:me(s),U=(e,t=Se)=>{const n=e%t;return n>=0n?n:t+n},Ec=e=>U(e,Is),If=(e,t)=>{(e===0n||t<=0n)&&me("no inverse n="+e+" mod="+t);let n=U(e,t),s=t,i=0n,o=1n;for(;n!==0n;){const r=s/n,l=s%n,a=i-o*r;s=n,n=l,i=o,o=a}return s===1n?U(i,t):me("no inverse")},Mf=e=>{const t=Rc[e];return typeof t!="function"&&me("hashes."+e+" not set"),t},Ti=e=>e instanceof Pe?e:me("Point expected"),so=2n**256n;class Pe{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const o=so;this.X=Ot(t,0n,o),this.Y=Ot(n,0n,o),this.Z=Ot(s,1n,o),this.T=Ot(i,0n,o),Object.freeze(this)}static CURVE(){return wc}static fromAffine(t){return new Pe(t.x,t.y,1n,U(t.x*t.y))}static fromBytes(t,n=!1){const s=Ci,i=Sc(Tt(t,Vt)),o=t[31];i[31]=o&-129;const r=Ic(i);Ot(r,0n,n?so:Se);const a=U(r*r),d=U(a-1n),g=U(s*a+1n);let{isValid:u,value:f}=Lf(d,g);u||me("bad point: y not sqrt");const v=(f&1n)===1n,m=(o&128)!==0;return!n&&f===0n&&m&&me("bad point: x==0, isLastByteOdd"),m!==v&&(f=U(-f)),new Pe(f,r,1n,U(f*r))}static fromHex(t,n){return Pe.fromBytes(Cc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Ai,n=Ci,s=this;if(s.is0())return me("bad point: ZERO");const{X:i,Y:o,Z:r,T:l}=s,a=U(i*i),d=U(o*o),g=U(r*r),u=U(g*g),f=U(a*t),v=U(g*U(f+d)),m=U(u+U(n*U(a*d)));if(v!==m)return me("bad point: equation left != right (1)");const S=U(i*o),C=U(r*l);return S!==C?me("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:o,Y:r,Z:l}=Ti(t),a=U(n*l),d=U(o*i),g=U(s*l),u=U(r*i);return a===d&&g===u}is0(){return this.equals(fn)}negate(){return new Pe(U(-this.X),this.Y,this.Z,U(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Ai,o=U(t*t),r=U(n*n),l=U(2n*U(s*s)),a=U(i*o),d=t+n,g=U(U(d*d)-o-r),u=a+r,f=u-l,v=a-r,m=U(g*f),S=U(u*v),C=U(g*v),R=U(f*u);return new Pe(m,S,R,C)}add(t){const{X:n,Y:s,Z:i,T:o}=this,{X:r,Y:l,Z:a,T:d}=Ti(t),g=Ai,u=Ci,f=U(n*r),v=U(s*l),m=U(o*u*d),S=U(i*a),C=U((n+s)*(r+l)-f-v),R=U(S-m),I=U(S+m),A=U(v-g*f),w=U(C*R),L=U(I*A),_=U(C*A),M=U(R*I);return new Pe(w,L,M,_)}subtract(t){return this.add(Ti(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return fn;if(Ot(t,1n,Is),t===1n)return this;if(this.equals(Jt))return Kf(t).p;let s=fn,i=Jt;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?s=s.add(o):n&&(i=i.add(o));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(fn))return{x:0n,y:1n};const i=If(s,Se);U(s*i)!==1n&&me("invalid inverse");const o=U(t*i),r=U(n*i);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=_c(n);return s[31]|=t&1n?128:0,s}toHex(){return Ac(this.toBytes())}clearCofactor(){return this.multiply(Os(Sf),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Is/2n,!1).double();return Is%2n&&(t=t.add(this)),t.is0()}}const Jt=new Pe(la,ca,1n,U(la*ca)),fn=new Pe(0n,1n,1n,0n);Pe.BASE=Jt;Pe.ZERO=fn;const _c=e=>Cc(kc(Ot(e,0n,so),Go)).reverse(),Ic=e=>Os("0x"+Ac(Sc(Tt(e)).reverse())),Ge=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=Se;return n},Rf=e=>{const n=e*e%Se*e%Se,s=Ge(n,2n)*n%Se,i=Ge(s,1n)*e%Se,o=Ge(i,5n)*i%Se,r=Ge(o,10n)*o%Se,l=Ge(r,20n)*r%Se,a=Ge(l,40n)*l%Se,d=Ge(a,80n)*a%Se,g=Ge(d,80n)*a%Se,u=Ge(g,10n)*o%Se;return{pow_p_5_8:Ge(u,2n)*e%Se,b2:n}},ua=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Lf=(e,t)=>{const n=U(t*t*t),s=U(n*n*t),i=Rf(e*s).pow_p_5_8;let o=U(e*n*i);const r=U(t*o*o),l=o,a=U(o*ua),d=r===e,g=r===U(-e),u=r===U(-e*ua);return d&&(o=l),(g||u)&&(o=a),(U(o)&1n)===1n&&(o=U(-o)),{isValid:d||g,value:o}},io=e=>Ec(Ic(e)),Vo=(...e)=>Rc.sha512Async(Qn(...e)),Df=(...e)=>Mf("sha512")(Qn(...e)),Mc=e=>{const t=e.slice(0,Vt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Vt,Go),s=io(t),i=Jt.multiply(s),o=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:o}},Jo=e=>Vo(Tt(e,Vt)).then(Mc),Pf=e=>Mc(Df(Tt(e,Vt))),Ff=e=>Jo(e).then(t=>t.pointBytes),Nf=e=>Vo(e.hashable).then(e.finish),Of=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,o=io(t),r=Jt.multiply(o).toBytes();return{hashable:Qn(r,s,n),finish:d=>{const g=Ec(o+io(d)*i);return Tt(Qn(r,_c(g)),Go)}}},Uf=async(e,t)=>{const n=Tt(e),s=await Jo(t),i=await Vo(s.prefix,n);return Nf(Of(s,i,n))},Rc={sha512Async:async e=>{const t=Ef(),n=Qn(e);return oi(await t.digest("SHA-512",n.buffer))},sha512:void 0},Bf=(e=_f(Vt))=>e,Hf={getExtendedPublicKeyAsync:Jo,getExtendedPublicKey:Pf,randomSecretKey:Bf},Us=8,zf=256,Lc=Math.ceil(zf/Us)+1,oo=2**(Us-1),jf=()=>{const e=[];let t=Jt,n=t;for(let s=0;s<Lc;s++){n=t,e.push(n);for(let i=1;i<oo;i++)n=n.add(t),e.push(n);t=n.double()}return e};let ga;const fa=(e,t)=>{const n=t.negate();return e?n:t},Kf=e=>{const t=ga||(ga=jf());let n=fn,s=Jt;const i=2**Us,o=i,r=Os(i-1),l=Os(Us);for(let a=0;a<Lc;a++){let d=Number(e&r);e>>=l,d>oo&&(d-=o,e+=1n);const g=a*oo,u=g,f=g+Math.abs(d)-1,v=a%2!==0,m=d<0;d===0?s=s.add(fa(v,t[u])):n=n.add(fa(m,t[f]))}return e!==0n&&me("invalid wnaf"),{p:n,f:s}},Ei="openclaw-device-identity-v1";function ro(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Dc(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let o=0;o<s.length;o+=1)i[o]=s.charCodeAt(o);return i}function Wf(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Pc(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Wf(new Uint8Array(t))}async function qf(){const e=Hf.randomSecretKey(),t=await Ff(e);return{deviceId:await Pc(t),publicKey:ro(t),privateKey:ro(e)}}async function Qo(){try{const n=localStorage.getItem(Ei);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await Pc(Dc(s.publicKey));if(i!==s.deviceId){const o={...s,deviceId:i};return localStorage.setItem(Ei,JSON.stringify(o)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await qf(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Ei,JSON.stringify(t)),e}async function Gf(e,t){const n=Dc(e),s=new TextEncoder().encode(t),i=await Uf(s,n);return ro(i)}async function Et(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Vf(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Et(e)}catch(n){e.devicesError=String(n)}}async function Jf(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Et(e)}catch(s){e.devicesError=String(s)}}async function Qf(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Qo(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&$c({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Et(e)}catch(n){e.devicesError=String(n)}}async function Yf(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await Qo();t.deviceId===s.deviceId&&xc({deviceId:s.deviceId,role:t.role}),await Et(e)}catch(s){e.devicesError=String(s)}}function Xf(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function Zf(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Yo(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Xf(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);ep(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function ep(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=St(t.file??{}))}async function tp(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=Zf(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await Yo(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function np(e,t,n){const s=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});ec(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function sp(e,t){const n=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});tc(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}function Fc(e){return e instanceof Error?e.message:String(e)}function pa(e,t,n){const s=t.trim();if(!s)return;const i={...e.marketMessages};n?i[s]=n:delete i[s],e.marketMessages=i}function xn(e){return e.state.installed?e.state.enabled?{kind:"disable",enabled:!1,successMessage:"Skill disabled."}:{kind:"enable",enabled:!0,successMessage:"Skill enabled."}:{kind:"install",successMessage:"Installed."}}async function Xo(e){if(!(!e.client||!e.connected||e.marketLoading)){e.marketLoading=!0,e.marketError=null;try{const t=await e.client.request("skills.market.catalog",{});e.marketCatalog=Array.isArray(t?.catalog)?t.catalog:[]}catch(t){e.marketError=Fc(t)}finally{e.marketLoading=!1}}}async function ip(e,t){if(!e.client||!e.connected)return;const n=e.marketCatalog.find(i=>i.skillKey===t);if(!n)return;const s=xn(n);e.marketBusyKey=t,e.marketError=null;try{let i=s.successMessage;if(s.kind==="install"){const o=await e.client.request("skills.market.installOrEnable",{skillKey:t});i=o?.action==="already-installed"?"Already installed.":o?.message?.trim()||s.successMessage}else await e.client.request("skills.update",{skillKey:t,enabled:s.enabled});await Xo(e),pa(e,t,{kind:"success",message:i})}catch(i){const o=Fc(i);e.marketError=o,pa(e,t,{kind:"error",message:o})}finally{e.marketBusyKey=null}}function Nc(e){return typeof e=="string"?e.trim()||void 0:!e||typeof e!="object"?void 0:e.primary?.trim()||void 0}const op=8192,Bs="bitseek",rp="bitseek/AUTO",Yn=16e3,ap=4096,lp={"gpt-5.1-codex":4e5,"gpt-5.1-codex-mini":4e5,"gpt-5.1-codex-max":4e5,"gpt-5.1":4e5,"gpt-5.2":4e5,"claude-opus-4-6":1048576,"claude-opus-4-5":2e5,"gemini-3-pro":1048576,"gemini-3-flash":1048576,"glm-4.7":204800};function ao(e,t){return`${e}/${t}`}function cp(e){const t=typeof e=="number"&&Number.isFinite(e)?Math.floor(e):0;return t>=Yn?t:Yn}function dp(e){if(typeof e=="string")return e.trim()||void 0;if(!e||typeof e!="object")return;const t=e.primary;return typeof t!="string"?void 0:t.trim()||void 0}function up(e){if(!e||typeof e!="object")return[];const t=e.fallbacks;return Array.isArray(t)?t.map(n=>typeof n=="string"?n.trim():"").filter(Boolean):[]}function Zo(e,t){const n=e.agents?.defaults,s=n?.model,i=n?.models,o=typeof s=="object"&&s!==null&&"fallbacks"in s?s.fallbacks:void 0;return{...e,agents:{...e.agents,defaults:{...n,model:{...o?{fallbacks:o}:{},primary:t},models:{...i,[t]:i?.[t]??{}}}}}}function gp(e){const t=e.trim();if(!t)return null;const n=t.indexOf("/");return n<=0||n>=t.length-1?null:{providerId:t.slice(0,n).trim(),modelId:t.slice(n+1).trim()}}function er(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t>0?t:null}function fp(e){const t=e.config.models?.providers??{};let n=null;for(const[s,i]of Object.entries(t))if(!(!i||!Array.isArray(i.models)||s===e.selectedProviderId))for(const o of i.models){if(o.id!==e.modelId)continue;const r=er(o.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function pp(e){if(!Array.isArray(e.catalogModels)||e.catalogModels.length===0)return null;const t=e.selectedProviderId.trim().toLowerCase();let n=null;for(const s of e.catalogModels){if((typeof s?.id=="string"?s.id.trim():"")!==e.modelId)continue;const o=typeof s?.provider=="string"?s.provider.trim().toLowerCase():"";if(o&&o===t)continue;const r=er(s?.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function hp(e){const t=e.trim().toLowerCase();return t?lp[t]??null:null}function mp(e){const t=gp(e.modelRef);if(!t)return e.config;const n=e.config.models?.providers??{},s=n[t.providerId];if(!s||!Array.isArray(s.models))return e.config;let i=!1;const o=s.models.map(r=>{if(r.id!==t.modelId)return r;const l=er(r.contextWindow);let a;if(t.providerId===Bs)a=op;else{const d=fp({config:e.config,selectedProviderId:t.providerId,modelId:t.modelId}),g=pp({selectedProviderId:t.providerId,modelId:t.modelId,catalogModels:e.catalogModels}),u=hp(t.modelId),f=d??g??u;a=f!=null?Math.max(f,Yn):Math.max(l??0,Yn)}return a===r.contextWindow?r:(i=!0,{...r,contextWindow:a})});return i?{...e.config,models:{...e.config.models,providers:{...n,[t.providerId]:{...s,models:o}}}}:e.config}function lo(e){const t=e.trim().toLowerCase();return t?t.replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,""):""}function Oc(e){try{const t=new URL(e),n=t.hostname.replace(/[^a-z0-9]+/gi,"-").toLowerCase(),s=t.port?`-${t.port}`:"",i=`custom-${n}${s}`;return lo(i)||"custom"}catch{return"custom"}}function vp(e){const t=e.config.models?.providers??{},n=lo(e.requestedProviderId?.trim()||"");if(n)return n;const s=Oc(e.baseUrl),i=lo(s)||"custom",o=t[i];if(!o?.baseUrl||o.baseUrl===e.baseUrl)return i;let r=2,l=`${i}-${r}`;for(;t[l];)r+=1,l=`${i}-${r}`;return l}function bp(e){try{new URL(e)}catch{throw new Error("Custom provider base URL must be a valid URL.")}}function yp(e){const t=e.alias.trim();if(!t)return;const n=e.cfg.agents?.defaults?.models??{},s=t.toLowerCase(),i=new Set((e.ignoreModelRefs??[]).map(o=>o.trim()).filter(Boolean));for(const[o,r]of Object.entries(n)){if(o===e.modelRef||i.has(o))continue;const l=r.alias,a=typeof l=="string"?l.trim().toLowerCase():"";if(a&&a===s)throw new Error(`Alias ${t} already points to ${o}.`)}}function $p(e){const t=e.baseUrl.trim();bp(t);const n=e.modelId.trim();if(!n)throw new Error("Custom provider model ID is required.");const s=vp({config:e.config,baseUrl:t,requestedProviderId:e.providerId}),i=e.config.models?.providers??{},o=i[s],r=Array.isArray(o?.models)?o.models:[],l=e.previousModelId?.trim(),a=l?r.filter(L=>L.id!==l):r,d=a.some(L=>L.id===n),g={id:n,name:`${n} (Custom Provider)`,contextWindow:Yn,maxTokens:ap,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!1},u=d?a.map(L=>L.id===n?{...L,contextWindow:cp(L.contextWindow)}:L):[...a,g],f=e.replaceApiKey===!0?e.apiKey?.trim():void 0,v={...o??{baseUrl:t,models:[],api:"openai-completions"},baseUrl:t,api:"openai-completions",models:u.length>0?u:[g]};e.replaceApiKey===!0&&(f?v.apiKey=f:delete v.apiKey);const m=ao(s,n),S=e.providerId?.trim()||s,C=l?ao(S,l):void 0,R=e.alias?.trim()??"";yp({cfg:e.config,alias:R,modelRef:m,ignoreModelRefs:C?[C]:[]});const I={...e.config.agents?.defaults?.models};C&&C!==m&&delete I[C];const A={...I[m]};return R?A.alias=R:delete A.alias,I[m]=A,{config:{...e.config,models:{...e.config.models,mode:e.config.models?.mode??"merge",providers:{...i,[s]:v}},agents:{...e.config.agents,defaults:{...e.config.agents?.defaults,models:I}}},providerId:s,modelId:n}}function ha(e,t){const n=t?[[t,e[t]]]:Object.entries(e),s=[];for(const[i,o]of n)if(!(!o||!Array.isArray(o.models)))for(const r of o.models){const l=typeof r?.id=="string"?r.id.trim():"";l&&s.push(ao(i,l))}return s}function xp(e){const t=ha(e,Bs);return t.length>0?t[0]:e[Bs]?rp:ha(e)[0]}function wp(e){const t=e.providerId.trim();if(!t||t===Bs)return e.config;const n=e.config.models?.providers??{};if(!n[t])return e.config;const s={...n};delete s[t];const i=`${t}/`,o=e.config.agents?.defaults,r=o?.models??{},l={};for(const[m,S]of Object.entries(r))m.startsWith(i)||(l[m]=S);const a=dp(o?.model),d=up(o?.model).filter(m=>!m.startsWith(i)),u=(a&&!a.startsWith(i)?a:void 0)??xp(s);let f={...e.config,models:{...e.config.models,providers:s},agents:{...e.config.agents,defaults:{...o,...Object.keys(l).length>0?{models:l}:{}}}};if(Object.keys(l).length===0&&(f={...f,agents:{...f.agents,defaults:{...f.agents?.defaults,models:void 0}}}),!u)return f;f=Zo(f,u);const v=d.filter(m=>m!==u);return v.length===0?f:{...f,agents:{...f.agents,defaults:{...f.agents?.defaults,model:{primary:u,fallbacks:v}}}}}const pn="__new__",Xn="bitseek",Sp=4e3,Hs=new WeakMap;function kp(e){const t=Hs.get(e);t&&(clearTimeout(t),Hs.delete(e))}function hn(e,t){if(e.modelsVerifyState=t,kp(e),t?.tone!=="success")return;const n=t,s=setTimeout(()=>{e.modelsVerifyState===n&&(e.modelsVerifyState=null),Hs.delete(e)},Sp);Hs.set(e,s)}function Ap(e){const t=e instanceof Error?e.message:String(e);return/invalid models\.verify params/i.test(t)&&/providerId/i.test(t)}function as(e){return St(e?.config??{})}function Cp(e){return!!(e&&e.api==="openai-completions"&&typeof e.baseUrl=="string"&&e.baseUrl.trim()&&Array.isArray(e.models)&&e.models.some(t=>typeof t?.id=="string"&&t.id.trim()))}function Tp(e,t,n){const s=n.startsWith(`${e}/`)?n.slice(e.length+1):"";return t.models.find(o=>o.id===s)?.id??t.models[0]?.id??""}function tr(e,t,n){return e.agents?.defaults?.models?.[`${t}/${n}`]?.alias?.trim()??""}function Ep(e){return e===Xn?"BitSeek":e}function Uc(e){const t=e.models?.providers??{};return Object.entries(t).filter(([,n])=>Cp(n)).map(([n,s])=>[n,s]).toSorted(([n],[s])=>n===Xn?-1:s===Xn?1:n.localeCompare(s))}function _p(e,t,n,s){const i=Tp(t,n,s),o=tr(e,t,i),r=t===Xn?"bitseek":"custom";return{providerId:t,kind:r,title:r==="bitseek"?"BitSeek":o||t,subtitle:r==="bitseek"?"Built-in provider":t,modelId:i,modelRef:`${t}/${i}`,baseUrl:n.baseUrl,apiKeyConfigured:n.apiKey!==void 0}}function Bc(e){const t=Nc(e.agents?.defaults?.model)??"";return Uc(e).map(([n,s])=>_p(e,n,s,t))}function Ip(e){const t=[];for(const[n,s]of Uc(e)){const i=Ep(n);for(const o of s.models){const r=typeof o?.id=="string"?o.id.trim():"";if(!r)continue;const l=`${n}/${r}`,a=tr(e,n,r),d=typeof o?.name=="string"?o.name.trim():"",g=a||d||r;t.push({modelRef:l,providerId:n,modelId:r,providerLabel:i,modelLabel:g,label:`${i} · ${g} (${l})`})}}return t}function Hc(e,t){const n=t.kind==="bitseek";return{kind:t.kind,originalProviderId:t.providerId,originalModelId:t.modelId,providerIdHint:t.providerId,displayName:tr(e,t.providerId,t.modelId),baseUrl:t.baseUrl,apiKey:"",apiKeyConfigured:t.apiKeyConfigured,apiKeyChanged:!1,modelId:t.modelId,saved:!0,canDelete:t.kind==="custom",readonlyModelIdentity:n}}function zs(){return{kind:"custom",originalProviderId:null,originalModelId:null,providerIdHint:"custom",displayName:"",baseUrl:"",apiKey:"",apiKeyConfigured:!1,apiKeyChanged:!1,modelId:"",saved:!1,canDelete:!1,readonlyModelIdentity:!1}}function ri(e){const t=as(e.configSnapshot),n=Bc(t),s=Ip(t),i=Nc(t.agents?.defaults?.model)??"",r=s.some(d=>d.modelRef===i)?i:s[0]?.modelRef??i,l=e.modelsSelectedProviderId===pn?pn:n.some(d=>d.providerId===e.modelsSelectedProviderId)?e.modelsSelectedProviderId:n[0]?.providerId??pn;if(e.modelsProviders=n,e.modelsSwitchableModels=s,e.modelsSelectedDefault=r,e.modelsSelectedProviderId=l,l===pn){e.modelsDraft=zs();return}const a=n.find(d=>d.providerId===l);e.modelsDraft=a?Hc(t,a):zs()}async function nr(e,t){const n=e.configSnapshot?.hash;return n?(await e.client?.request("config.set",{raw:$n(t),baseHash:n}),await Ae(e),ri(e),!0):(e.modelsError="Config hash missing; reload and retry.",!1)}async function zc(e){if(!(!e.client||!e.connected)){e.modelsLoading=!0,e.modelsError=null,e.modelsDefaultState=null;try{e.configSnapshot?.hash||await Ae(e),ri(e)}catch(t){e.modelsError=String(t)}finally{e.modelsLoading=!1}}}function ma(e,t){e.modelsSelectedProviderId=t,hn(e,null);const n=as(e.configSnapshot);if(t===pn){e.modelsDraft=zs();return}const s=Bc(n).find(i=>i.providerId===t);e.modelsDraft=s?Hc(n,s):zs()}function Mp(e,t,n){if(!e.modelsDraft||t!=="apiKey"&&e.modelsDraft.readonlyModelIdentity)return;const s={...e.modelsDraft,[t]:n};t==="baseUrl"&&!s.originalProviderId&&(s.providerIdHint=Oc(n.trim())||"custom"),t==="apiKey"&&(s.apiKeyChanged=!0),e.modelsDraft=s,hn(e,null)}async function Rp(e){if(!(!e.client||!e.connected||!e.modelsDraft)){e.modelsSaving=!0,e.modelsError=null;try{const t=e.modelsDraft;if(t.kind==="bitseek"){if(!t.apiKeyChanged)return;const d=t.apiKey.trim();if(!d)throw new Error("BitSeek API key cannot be empty.");await e.client.request("models.auth.set",{providerId:Xn,apiKey:d}),e.modelsDraft={...t,apiKey:"",apiKeyChanged:!1,apiKeyConfigured:!0},e.modelsVerifyState={tone:"success",message:"BitSeek API key saved."};return}const n=as(e.configSnapshot),s=t.originalProviderId&&t.originalModelId?`${t.originalProviderId}/${t.originalModelId}`:"",i=$p({config:n,baseUrl:t.baseUrl,modelId:t.modelId,providerId:t.originalProviderId??void 0,alias:t.displayName,apiKey:t.apiKeyChanged?t.apiKey:void 0,replaceApiKey:t.apiKeyChanged,previousModelId:t.originalModelId??void 0}),o=`${i.providerId}/${i.modelId}`,r=e.modelsSelectedDefault===s?o:e.modelsSelectedDefault,l=Zo(i.config,r||o);if(!await nr(e,l))return;e.modelsSelectedProviderId=i.providerId??null,ri(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Lp(e){if(!(!e.client||!e.connected||!e.modelsSelectedDefault.trim())){e.modelsDefaultSaving=!0,e.modelsError=null,e.modelsDefaultState=null;try{const t=e.modelsSelectedDefault.trim();let n=[];try{const o=await e.client.request("models.list",{});n=Array.isArray(o?.models)?o.models:[]}catch{n=[]}const s=mp({config:as(e.configSnapshot),modelRef:t,catalogModels:n}),i=Zo(s,t);await nr(e,i),e.modelsDefaultState={tone:"success",message:"Default model saved."}}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsDefaultSaving=!1}}}async function Dp(e){if(!(!e.client||!e.connected||!e.modelsDraft?.originalProviderId)&&e.modelsDraft.kind==="custom"){e.modelsSaving=!0,e.modelsError=null;try{const t=wp({config:as(e.configSnapshot),providerId:e.modelsDraft.originalProviderId});await nr(e,t),e.modelsSelectedProviderId=null,ri(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Pp(e){if(!e.client||!e.connected||!e.modelsDraft)return;const t=e.modelsDraft.apiKey.trim();e.modelsVerifyBusy=!0,hn(e,null),e.modelsError=null;try{const n={baseUrl:e.modelsDraft.baseUrl.trim(),modelId:e.modelsDraft.modelId.trim(),...e.modelsDraft.originalProviderId?{providerId:e.modelsDraft.originalProviderId}:{},...t?{apiKey:t}:{}};let s;try{s=await e.client.request("models.verify",n)}catch(i){if(!n.providerId||!Ap(i))throw i;const{providerId:o,...r}=n;s=await e.client.request("models.verify",r)}if(s.ok){hn(e,{tone:"success",message:s.status!==void 0?`Verification successful (HTTP ${s.status}).`:"Verification successful."});return}hn(e,{tone:"danger",message:s.status!==void 0?`Verification failed (HTTP ${s.status}).`:s.error||"Verification failed."})}catch(n){hn(e,{tone:"danger",message:n instanceof Error?n.message:String(n)})}finally{e.modelsVerifyBusy=!1}}function Fp(e,t){e.modelsSelectedDefault=t,e.modelsDefaultState=null}function Np(){return pn}async function sr(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function Yt(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??Fe(e.sessionsFilterActive,0),o=t?.limit??Fe(e.sessionsFilterLimit,0),r={includeGlobal:n,includeUnknown:s};i>0&&(r.activeMinutes=i),o>0&&(r.limit=o);const l=await e.client.request("sessions.list",r);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Op(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await Yt(e)}catch(i){e.sessionsError=String(i)}}async function Up(e,t){if(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
126
|
+
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${o}.log`,i.click(),URL.revokeObjectURL(s)}function Pg(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}async function si(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const o=s;e.debugModels=Array.isArray(o?.models)?o?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Fg(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const Ng=2e3,Og=new Set(["trace","debug","info","warn","error","fatal"]);function Ug(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function Bg(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Og.has(t)?t:null}function Hg(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=Bg(n?.logLevelName??n?.level),o=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,r=Ug(o);let l=null;r&&(typeof r.subsystem=="string"?l=r.subsystem:typeof r.module=="string"&&(l=r.module)),!l&&o&&o.length<120&&(l=o);let a=null;return typeof t[1]=="string"?a=t[1]:!r&&typeof t[0]=="string"?a=t[0]:typeof t.message=="string"&&(a=t.message),{raw:e,time:s,level:i,subsystem:l,message:a??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Oo(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),o=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(Hg),r=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-Ng),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}async function ii(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function zg(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{ii(e,{quiet:!0})},5e3))}function jg(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function lc(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Oo(e,{quiet:!0})},2e3))}function cc(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function dc(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&si(e)},3e3))}function uc(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function gc(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function fc(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function Es(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Uo(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}async function Hn(e,t){if(!(!e.client||!e.connected)&&!e.toolsCatalogLoading){e.toolsCatalogLoading=!0,e.toolsCatalogError=null;try{const n=await e.client.request("tools.catalog",{agentId:t??e.agentsSelectedId??void 0,includePlugins:!0});n&&(e.toolsCatalogResult=n)}catch(n){e.toolsCatalogError=String(n)}finally{e.toolsCatalogLoading=!1}}}const Kg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Os={name:"",description:"",agentId:"",sessionKey:"",clearAgent:!1,enabled:!0,deleteAfterRun:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds",sessionTarget:"isolated",wakeMode:"now",payloadKind:"agentTurn",payloadText:"",payloadModel:"",payloadThinking:"",payloadLightContext:!1,deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",deliveryAccountId:"",deliveryBestEffort:!1,failureAlertMode:"inherit",failureAlertAfter:"2",failureAlertCooldownSeconds:"3600",failureAlertChannel:"last",failureAlertTo:"",failureAlertDeliveryMode:"announce",failureAlertAccountId:"",timeoutSeconds:""};function Bo(e,t){if(e==null||!Number.isFinite(e)||e<=0)return;if(e<1e3)return`${Math.round(e)}ms`;const n=t?.spaced?" ":"",s=Math.round(e/1e3),i=Math.floor(s/3600),o=Math.floor(s%3600/60),r=s%60;if(i>=24){const l=Math.floor(i/24),a=i%24;return a>0?`${l}d${n}${a}h`:`${l}d`}return i>0?o>0?`${i}h${n}${o}m`:`${i}h`:o>0?r>0?`${o}m${n}${r}s`:`${o}m`:`${r}s`}function Ho(e,t="n/a"){if(e==null||!Number.isFinite(e)||e<0)return t;if(e<1e3)return`${Math.round(e)}ms`;const n=Math.round(e/1e3);if(n<60)return`${n}s`;const s=Math.round(n/60);if(s<60)return`${s}m`;const i=Math.round(s/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}function ne(e,t){const n=t?.fallback??"n/a";if(e==null||!Number.isFinite(e))return n;const s=Date.now()-e,i=Math.abs(s),o=s>=0,r=Math.round(i/1e3);if(r<60)return o?"just now":"in <1m";const l=Math.round(r/60);if(l<60)return o?`${l}m ago`:`in ${l}m`;const a=Math.round(l/60);if(a<48)return o?`${a}h ago`:`in ${a}h`;const d=Math.round(a/24);return o?`${d}d ago`:`in ${d}d`}function eo(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const o=(i.index??0)+i[1].length;t.push({start:o,end:o+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const o=i.index??0,r=o+i[0].length;t.some(a=>o>=a.start&&r<=a.end)||t.push({start:o,end:r})}return t.sort((i,o)=>i.start-o.start),t}function to(e,t){return t.some(n=>e>=n.start&&e<n.end)}const Wg=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,hs=/<\s*\/?\s*final\b[^<>]*>/gi,sa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function qg(e,t){return e.trimStart()}function Gg(e,t){if(!e||!Wg.test(e))return e;let n=e;if(hs.test(n)){hs.lastIndex=0;const l=[],a=eo(n);for(const d of n.matchAll(hs)){const g=d.index??0;l.push({start:g,length:d[0].length,inCode:to(g,a)})}for(let d=l.length-1;d>=0;d--){const g=l[d];g.inCode||(n=n.slice(0,g.start)+n.slice(g.start+g.length))}}else hs.lastIndex=0;const s=eo(n);sa.lastIndex=0;let i="",o=0,r=!1;for(const l of n.matchAll(sa)){const a=l.index??0,d=l[1]==="/";to(a,s)||(r?d&&(r=!1):(i+=n.slice(o,a),d||(r=!0)),o=a+l[0].length)}return i+=n.slice(o),qg(i)}const ia=/<\s*(\/?)\s*relevant[-_]memories\b[^<>]*>/gi,Vg=/<\s*\/?\s*relevant[-_]memories\b/i;function Jg(e){if(!e||!Vg.test(e))return e;ia.lastIndex=0;const t=eo(e);let n="",s=0,i=!1;for(const o of e.matchAll(ia)){const r=o.index??0;if(to(r,t))continue;const l=o[1]==="/";i?l&&(i=!1):(n+=e.slice(s,r),l||(i=!0)),s=r+o[0].length}return i||(n+=e.slice(s)),n}function Qg(e){const t=Gg(e);return Jg(t).trimStart()}function kt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function no(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function so(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function pc(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Ne(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Yg(e){return Qg(e)}const _s="last";function Xg(e){return e.sessionTarget==="isolated"&&e.payloadKind==="agentTurn"}function zo(e){return e.deliveryMode!=="announce"||Xg(e)?e:{...e,deliveryMode:"none"}}function is(e){const t={};if(e.name.trim()||(t.name="cron.errors.nameRequired"),e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);Number.isFinite(n)||(t.scheduleAt="cron.errors.scheduleAtInvalid")}else if(e.scheduleKind==="every")Ne(e.everyAmount,0)<=0&&(t.everyAmount="cron.errors.everyAmountInvalid");else if(e.cronExpr.trim()||(t.cronExpr="cron.errors.cronExprRequired"),!e.scheduleExact){const n=e.staggerAmount.trim();n&&Ne(n,0)<=0&&(t.staggerAmount="cron.errors.staggerAmountInvalid")}if(e.payloadText.trim()||(t.payloadText=e.payloadKind==="systemEvent"?"cron.errors.systemTextRequired":"cron.errors.agentMessageRequired"),e.payloadKind==="agentTurn"){const n=e.timeoutSeconds.trim();n&&Ne(n,0)<=0&&(t.timeoutSeconds="cron.errors.timeoutInvalid")}if(e.deliveryMode==="webhook"){const n=e.deliveryTo.trim();n?/^https?:\/\//i.test(n)||(t.deliveryTo="cron.errors.webhookUrlInvalid"):t.deliveryTo="cron.errors.webhookUrlRequired"}if(e.failureAlertMode==="custom"){const n=e.failureAlertAfter.trim();if(n){const i=Ne(n,0);(!Number.isFinite(i)||i<=0)&&(t.failureAlertAfter="Failure alert threshold must be greater than 0.")}const s=e.failureAlertCooldownSeconds.trim();if(s){const i=Ne(s,-1);(!Number.isFinite(i)||i<0)&&(t.failureAlertCooldownSeconds="Cooldown must be 0 or greater.")}}return t}function hc(e){return Object.keys(e).length>0}async function os(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function Zg(e){if(!(!e.client||!e.connected))try{const n=(await e.client.request("models.list",{}))?.models;if(!Array.isArray(n)){e.cronModelSuggestions=[];return}const s=n.map(i=>{if(!i||typeof i!="object")return"";const o=i.id;return typeof o=="string"?o.trim():""}).filter(Boolean);e.cronModelSuggestions=Array.from(new Set(s)).toSorted((i,o)=>i.localeCompare(o))}catch{e.cronModelSuggestions=[]}}async function oi(e){return await jo(e,{append:!1})}function mc(e){const t=typeof e.totalRaw=="number"&&Number.isFinite(e.totalRaw)?Math.max(0,Math.floor(e.totalRaw)):e.pageCount,n=typeof e.limitRaw=="number"&&Number.isFinite(e.limitRaw)?Math.max(1,Math.floor(e.limitRaw)):Math.max(1,e.pageCount),s=typeof e.offsetRaw=="number"&&Number.isFinite(e.offsetRaw)?Math.max(0,Math.floor(e.offsetRaw)):0,i=typeof e.hasMoreRaw=="boolean"?e.hasMoreRaw:s+e.pageCount<Math.max(t,s+e.pageCount),o=typeof e.nextOffsetRaw=="number"&&Number.isFinite(e.nextOffsetRaw)?Math.max(0,Math.floor(e.nextOffsetRaw)):i?s+e.pageCount:null;return{total:t,limit:n,offset:s,hasMore:i,nextOffset:o}}async function jo(e,t){if(!e.client||!e.connected||e.cronLoading||e.cronJobsLoadingMore)return;const n=t?.append===!0;if(n){if(!e.cronJobsHasMore)return;e.cronJobsLoadingMore=!0}else e.cronLoading=!0;e.cronError=null;try{const s=n?Math.max(0,e.cronJobsNextOffset??e.cronJobs.length):0,i=await e.client.request("cron.list",{includeDisabled:e.cronJobsEnabledFilter==="all",limit:e.cronJobsLimit,offset:s,query:e.cronJobsQuery.trim()||void 0,enabled:e.cronJobsEnabledFilter,sortBy:e.cronJobsSortBy,sortDir:e.cronJobsSortDir}),o=Array.isArray(i.jobs)?i.jobs:[];e.cronJobs=n?[...e.cronJobs,...o]:o;const r=mc({totalRaw:i.total,limitRaw:i.limit,offsetRaw:i.offset,nextOffsetRaw:i.nextOffset,hasMoreRaw:i.hasMore,pageCount:o.length});e.cronJobsTotal=Math.max(r.total,e.cronJobs.length),e.cronJobsHasMore=r.hasMore,e.cronJobsNextOffset=r.nextOffset,e.cronEditingJobId&&!e.cronJobs.some(l=>l.id===e.cronEditingJobId)&&rs(e)}catch(s){e.cronError=String(s)}finally{n?e.cronJobsLoadingMore=!1:e.cronLoading=!1}}async function ef(e){await jo(e,{append:!0})}async function oa(e){await jo(e,{append:!1})}function ra(e,t){typeof t.cronJobsQuery=="string"&&(e.cronJobsQuery=t.cronJobsQuery),t.cronJobsEnabledFilter&&(e.cronJobsEnabledFilter=t.cronJobsEnabledFilter),t.cronJobsScheduleKindFilter&&(e.cronJobsScheduleKindFilter=t.cronJobsScheduleKindFilter),t.cronJobsLastStatusFilter&&(e.cronJobsLastStatusFilter=t.cronJobsLastStatusFilter),t.cronJobsSortBy&&(e.cronJobsSortBy=t.cronJobsSortBy),t.cronJobsSortDir&&(e.cronJobsSortDir=t.cronJobsSortDir)}function tf(e){return e.cronJobs.filter(t=>!(e.cronJobsScheduleKindFilter!=="all"&&t.schedule.kind!==e.cronJobsScheduleKindFilter||e.cronJobsLastStatusFilter!=="all"&&t.state?.lastStatus!==e.cronJobsLastStatusFilter))}function rs(e){e.cronEditingJobId=null}function vc(e){e.cronForm={...Os},e.cronFieldErrors=is(e.cronForm)}function nf(e){const t=Date.parse(e);if(!Number.isFinite(t))return"";const n=new Date(t),s=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0"),r=String(n.getHours()).padStart(2,"0"),l=String(n.getMinutes()).padStart(2,"0");return`${s}-${i}-${o}T${r}:${l}`}function sf(e){if(e%864e5===0)return{everyAmount:String(Math.max(1,e/864e5)),everyUnit:"days"};if(e%36e5===0)return{everyAmount:String(Math.max(1,e/36e5)),everyUnit:"hours"};const t=Math.max(1,Math.ceil(e/6e4));return{everyAmount:String(t),everyUnit:"minutes"}}function of(e){return e===0?{scheduleExact:!0,staggerAmount:"",staggerUnit:"seconds"}:typeof e!="number"||!Number.isFinite(e)||e<0?{scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds"}:e%6e4===0?{scheduleExact:!1,staggerAmount:String(Math.max(1,e/6e4)),staggerUnit:"minutes"}:{scheduleExact:!1,staggerAmount:String(Math.max(1,Math.ceil(e/1e3))),staggerUnit:"seconds"}}function bc(e,t){const n=e.failureAlert,s={...t,name:e.name,description:e.description??"",agentId:e.agentId??"",sessionKey:e.sessionKey??"",clearAgent:!1,enabled:e.enabled,deleteAfterRun:e.deleteAfterRun??!1,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:t.everyAmount,everyUnit:t.everyUnit,cronExpr:t.cronExpr,cronTz:"",scheduleExact:!1,staggerAmount:"",staggerUnit:"seconds",sessionTarget:e.sessionTarget,wakeMode:e.wakeMode,payloadKind:e.payload.kind,payloadText:e.payload.kind==="systemEvent"?e.payload.text:e.payload.message,payloadModel:e.payload.kind==="agentTurn"?e.payload.model??"":"",payloadThinking:e.payload.kind==="agentTurn"?e.payload.thinking??"":"",payloadLightContext:e.payload.kind==="agentTurn"?e.payload.lightContext===!0:!1,deliveryMode:e.delivery?.mode??"none",deliveryChannel:e.delivery?.channel??_s,deliveryTo:e.delivery?.to??"",deliveryAccountId:e.delivery?.accountId??"",deliveryBestEffort:e.delivery?.bestEffort??!1,failureAlertMode:n===!1?"disabled":n&&typeof n=="object"?"custom":"inherit",failureAlertAfter:n&&typeof n=="object"&&typeof n.after=="number"?String(n.after):Os.failureAlertAfter,failureAlertCooldownSeconds:n&&typeof n=="object"&&typeof n.cooldownMs=="number"?String(Math.floor(n.cooldownMs/1e3)):Os.failureAlertCooldownSeconds,failureAlertChannel:n&&typeof n=="object"?n.channel??_s:_s,failureAlertTo:n&&typeof n=="object"?n.to??"":"",failureAlertDeliveryMode:n&&typeof n=="object"?n.mode??"announce":"announce",failureAlertAccountId:n&&typeof n=="object"?n.accountId??"":"",timeoutSeconds:e.payload.kind==="agentTurn"&&typeof e.payload.timeoutSeconds=="number"?String(e.payload.timeoutSeconds):""};if(e.schedule.kind==="at")s.scheduleAt=nf(e.schedule.at);else if(e.schedule.kind==="every"){const i=sf(e.schedule.everyMs);s.everyAmount=i.everyAmount,s.everyUnit=i.everyUnit}else{s.cronExpr=e.schedule.expr,s.cronTz=e.schedule.tz??"";const i=of(e.schedule.staggerMs);s.scheduleExact=i.scheduleExact,s.staggerAmount=i.staggerAmount,s.staggerUnit=i.staggerUnit}return zo(s)}function rf(e){if(e.scheduleKind==="at"){const o=Date.parse(e.scheduleAt);if(!Number.isFinite(o))throw new Error(p("cron.errors.invalidRunTime"));return{kind:"at",at:new Date(o).toISOString()}}if(e.scheduleKind==="every"){const o=Ne(e.everyAmount,0);if(o<=0)throw new Error(p("cron.errors.invalidIntervalAmount"));const r=e.everyUnit;return{kind:"every",everyMs:o*(r==="minutes"?6e4:r==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error(p("cron.errors.cronExprRequiredShort"));if(e.scheduleExact)return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0,staggerMs:0};const n=e.staggerAmount.trim();if(!n)return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0};const s=Ne(n,0);if(s<=0)throw new Error(p("cron.errors.invalidStaggerAmount"));const i=e.staggerUnit==="minutes"?s*6e4:s*1e3;return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0,staggerMs:i}}function af(e){if(e.payloadKind==="systemEvent"){const r=e.payloadText.trim();if(!r)throw new Error(p("cron.errors.systemEventTextRequired"));return{kind:"systemEvent",text:r}}const t=e.payloadText.trim();if(!t)throw new Error(p("cron.errors.agentMessageRequiredShort"));const n={kind:"agentTurn",message:t},s=e.payloadModel.trim();s&&(n.model=s);const i=e.payloadThinking.trim();i&&(n.thinking=i);const o=Ne(e.timeoutSeconds,0);return o>0&&(n.timeoutSeconds=o),e.payloadLightContext&&(n.lightContext=!0),n}function lf(e){if(e.failureAlertMode==="disabled")return!1;if(e.failureAlertMode!=="custom")return;const t=Ne(e.failureAlertAfter.trim(),0),n=e.failureAlertCooldownSeconds.trim(),s=n.length>0?Ne(n,0):void 0,i=s!==void 0&&Number.isFinite(s)&&s>=0?Math.floor(s*1e3):void 0,o=e.failureAlertDeliveryMode,r=e.failureAlertAccountId.trim(),l={after:t>0?Math.floor(t):void 0,channel:e.failureAlertChannel.trim()||_s,to:e.failureAlertTo.trim()||void 0,...i!==void 0?{cooldownMs:i}:{}};return o&&(l.mode=o),l.accountId=r||void 0,l}async function cf(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=zo(e.cronForm);t!==e.cronForm&&(e.cronForm=t);const n=is(t);if(e.cronFieldErrors=n,hc(n))return;const s=rf(t),i=af(t),o=e.cronEditingJobId?e.cronJobs.find(v=>v.id===e.cronEditingJobId):void 0;if(i.kind==="agentTurn"){const v=o?.payload.kind==="agentTurn"?o.payload.lightContext:void 0;!t.payloadLightContext&&e.cronEditingJobId&&v!==void 0&&(i.lightContext=!1)}const r=t.deliveryMode,l=r&&r!=="none"?{mode:r,channel:r==="announce"?t.deliveryChannel.trim()||"last":void 0,to:t.deliveryTo.trim()||void 0,accountId:r==="announce"?t.deliveryAccountId.trim():void 0,bestEffort:t.deliveryBestEffort}:r==="none"?{mode:"none"}:void 0,a=lf(t),d=t.clearAgent?null:t.agentId.trim(),u=t.sessionKey.trim()||(o?.sessionKey?null:void 0),f={name:t.name.trim(),description:t.description.trim(),agentId:d===null?null:d||void 0,sessionKey:u,enabled:t.enabled,deleteAfterRun:t.deleteAfterRun,schedule:s,sessionTarget:t.sessionTarget,wakeMode:t.wakeMode,payload:i,delivery:l,failureAlert:a};if(!f.name)throw new Error(p("cron.errors.nameRequiredShort"));e.cronEditingJobId?(await e.client.request("cron.update",{id:e.cronEditingJobId,patch:f}),rs(e)):(await e.client.request("cron.add",f),vc(e)),await oi(e),await os(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function df(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await oi(e),await os(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function uf(e,t,n="force"){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:n}),e.cronRunsScope==="all"?await yt(e,null):await yt(e,t.id)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function gf(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronEditingJobId===t.id&&rs(e),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null),await oi(e),await os(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function yt(e,t,n){if(!e.client||!e.connected)return;const s=e.cronRunsScope,i=t??e.cronRunsJobId;if(s==="job"&&!i){e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null;return}const o=n?.append===!0;if(!(o&&!e.cronRunsHasMore))try{o&&(e.cronRunsLoadingMore=!0);const r=o?Math.max(0,e.cronRunsNextOffset??e.cronRuns.length):0,l=await e.client.request("cron.runs",{scope:s,id:s==="job"?i??void 0:void 0,limit:e.cronRunsLimit,offset:r,statuses:e.cronRunsStatuses.length>0?e.cronRunsStatuses:void 0,status:e.cronRunsStatusFilter,deliveryStatuses:e.cronRunsDeliveryStatuses.length>0?e.cronRunsDeliveryStatuses:void 0,query:e.cronRunsQuery.trim()||void 0,sortDir:e.cronRunsSortDir}),a=Array.isArray(l.entries)?l.entries:[];e.cronRuns=o&&(s==="all"||e.cronRunsJobId===i)?[...e.cronRuns,...a]:a,s==="job"&&(e.cronRunsJobId=i??null);const d=mc({totalRaw:l.total,limitRaw:l.limit,offsetRaw:l.offset,nextOffsetRaw:l.nextOffset,hasMoreRaw:l.hasMore,pageCount:a.length});e.cronRunsTotal=Math.max(d.total,e.cronRuns.length),e.cronRunsHasMore=d.hasMore,e.cronRunsNextOffset=d.nextOffset}catch(r){e.cronError=String(r)}finally{o&&(e.cronRunsLoadingMore=!1)}}async function ff(e){e.cronRunsScope==="job"&&!e.cronRunsJobId||await yt(e,e.cronRunsJobId,{append:!0})}function aa(e,t){t.cronRunsScope&&(e.cronRunsScope=t.cronRunsScope),Array.isArray(t.cronRunsStatuses)&&(e.cronRunsStatuses=t.cronRunsStatuses,e.cronRunsStatusFilter=t.cronRunsStatuses.length===1?t.cronRunsStatuses[0]:"all"),Array.isArray(t.cronRunsDeliveryStatuses)&&(e.cronRunsDeliveryStatuses=t.cronRunsDeliveryStatuses),t.cronRunsStatusFilter&&(e.cronRunsStatusFilter=t.cronRunsStatusFilter,e.cronRunsStatuses=t.cronRunsStatusFilter==="all"?[]:[t.cronRunsStatusFilter]),typeof t.cronRunsQuery=="string"&&(e.cronRunsQuery=t.cronRunsQuery),t.cronRunsSortDir&&(e.cronRunsSortDir=t.cronRunsSortDir)}function pf(e,t){e.cronEditingJobId=t.id,e.cronRunsJobId=t.id,e.cronForm=bc(t,e.cronForm),e.cronFieldErrors=is(e.cronForm)}function hf(e,t){const n=e.trim()||"Job",s=`${n} copy`;if(!t.has(s.toLowerCase()))return s;let i=2;for(;i<1e3;){const o=`${n} copy ${i}`;if(!t.has(o.toLowerCase()))return o;i+=1}return`${n} copy ${Date.now()}`}function mf(e,t){rs(e),e.cronRunsJobId=t.id;const n=new Set(e.cronJobs.map(i=>i.name.trim().toLowerCase())),s=bc(t,e.cronForm);s.name=hf(t.name,n),e.cronForm=s,e.cronFieldErrors=is(e.cronForm)}function vf(e){rs(e),vc(e)}function Ko(e){return e.trim()}function bf(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].toSorted()}function yf(e){const t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return null;const n=Ko(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function $f(e){const t=Ko(e.role),n=e.adapter.readStore(),s={version:1,deviceId:e.deviceId,tokens:n&&n.deviceId===e.deviceId&&n.tokens?{...n.tokens}:{}},i={token:e.token,role:t,scopes:bf(e.scopes),updatedAtMs:Date.now()};return s.tokens[t]=i,e.adapter.writeStore(s),i}function xf(e){const t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return;const n=Ko(e.role);if(!t.tokens[n])return;const s={version:1,deviceId:t.deviceId,tokens:{...t.tokens}};delete s.tokens[n],e.adapter.writeStore(s)}const yc="openclaw.device.auth.v1";function Wo(){try{const e=window.localStorage.getItem(yc);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function qo(e){try{window.localStorage.setItem(yc,JSON.stringify(e))}catch{}}function wf(e){return yf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role})}function $c(e){return $f({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role,token:e.token,scopes:e.scopes})}function xc(e){xf({adapter:{readStore:Wo,writeStore:qo},deviceId:e.deviceId,role:e.role})}const wc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:Se,n:Is,Gx:la,Gy:ca,a:Ci,d:Ti,h:Sf}=wc,Vt=32,Go=64,kf=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},me=(e="")=>{const t=new Error(e);throw kf(t,me),t},Af=e=>typeof e=="bigint",Cf=e=>typeof e=="string",Tf=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Tt=(e,t,n="")=>{const s=Tf(e),i=e?.length,o=t!==void 0;if(!s||o&&i!==t){const r=n&&`"${n}" `,l=o?` of length ${t}`:"",a=s?`length=${i}`:`type=${typeof e}`;me(r+"expected Uint8Array"+l+", got "+a)}return e},ri=e=>new Uint8Array(e),Sc=e=>Uint8Array.from(e),kc=(e,t)=>e.toString(16).padStart(t,"0"),Ac=e=>Array.from(Tt(e)).map(t=>kc(t,2)).join(""),ot={_0:48,_9:57,A:65,F:70,a:97,f:102},da=e=>{if(e>=ot._0&&e<=ot._9)return e-ot._0;if(e>=ot.A&&e<=ot.F)return e-(ot.A-10);if(e>=ot.a&&e<=ot.f)return e-(ot.a-10)},Cc=e=>{const t="hex invalid";if(!Cf(e))return me(t);const n=e.length,s=n/2;if(n%2)return me(t);const i=ri(s);for(let o=0,r=0;o<s;o++,r+=2){const l=da(e.charCodeAt(r)),a=da(e.charCodeAt(r+1));if(l===void 0||a===void 0)return me(t);i[o]=l*16+a}return i},Tc=()=>globalThis?.crypto,Ef=()=>Tc()?.subtle??me("crypto.subtle must be defined, consider polyfill"),Qn=(...e)=>{const t=ri(e.reduce((s,i)=>s+Tt(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},_f=(e=Vt)=>Tc().getRandomValues(ri(e)),Us=BigInt,Ot=(e,t,n,s="bad number: out of range")=>Af(e)&&t<=e&&e<n?e:me(s),U=(e,t=Se)=>{const n=e%t;return n>=0n?n:t+n},Ec=e=>U(e,Is),If=(e,t)=>{(e===0n||t<=0n)&&me("no inverse n="+e+" mod="+t);let n=U(e,t),s=t,i=0n,o=1n;for(;n!==0n;){const r=s/n,l=s%n,a=i-o*r;s=n,n=l,i=o,o=a}return s===1n?U(i,t):me("no inverse")},Mf=e=>{const t=Rc[e];return typeof t!="function"&&me("hashes."+e+" not set"),t},Ei=e=>e instanceof Fe?e:me("Point expected"),io=2n**256n;class Fe{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const o=io;this.X=Ot(t,0n,o),this.Y=Ot(n,0n,o),this.Z=Ot(s,1n,o),this.T=Ot(i,0n,o),Object.freeze(this)}static CURVE(){return wc}static fromAffine(t){return new Fe(t.x,t.y,1n,U(t.x*t.y))}static fromBytes(t,n=!1){const s=Ti,i=Sc(Tt(t,Vt)),o=t[31];i[31]=o&-129;const r=Ic(i);Ot(r,0n,n?io:Se);const a=U(r*r),d=U(a-1n),g=U(s*a+1n);let{isValid:u,value:f}=Lf(d,g);u||me("bad point: y not sqrt");const v=(f&1n)===1n,m=(o&128)!==0;return!n&&f===0n&&m&&me("bad point: x==0, isLastByteOdd"),m!==v&&(f=U(-f)),new Fe(f,r,1n,U(f*r))}static fromHex(t,n){return Fe.fromBytes(Cc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Ci,n=Ti,s=this;if(s.is0())return me("bad point: ZERO");const{X:i,Y:o,Z:r,T:l}=s,a=U(i*i),d=U(o*o),g=U(r*r),u=U(g*g),f=U(a*t),v=U(g*U(f+d)),m=U(u+U(n*U(a*d)));if(v!==m)return me("bad point: equation left != right (1)");const S=U(i*o),C=U(r*l);return S!==C?me("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:o,Y:r,Z:l}=Ei(t),a=U(n*l),d=U(o*i),g=U(s*l),u=U(r*i);return a===d&&g===u}is0(){return this.equals(fn)}negate(){return new Fe(U(-this.X),this.Y,this.Z,U(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Ci,o=U(t*t),r=U(n*n),l=U(2n*U(s*s)),a=U(i*o),d=t+n,g=U(U(d*d)-o-r),u=a+r,f=u-l,v=a-r,m=U(g*f),S=U(u*v),C=U(g*v),R=U(f*u);return new Fe(m,S,R,C)}add(t){const{X:n,Y:s,Z:i,T:o}=this,{X:r,Y:l,Z:a,T:d}=Ei(t),g=Ci,u=Ti,f=U(n*r),v=U(s*l),m=U(o*u*d),S=U(i*a),C=U((n+s)*(r+l)-f-v),R=U(S-m),I=U(S+m),A=U(v-g*f),w=U(C*R),L=U(I*A),_=U(C*A),M=U(R*I);return new Fe(w,L,M,_)}subtract(t){return this.add(Ei(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return fn;if(Ot(t,1n,Is),t===1n)return this;if(this.equals(Jt))return Kf(t).p;let s=fn,i=Jt;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?s=s.add(o):n&&(i=i.add(o));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(fn))return{x:0n,y:1n};const i=If(s,Se);U(s*i)!==1n&&me("invalid inverse");const o=U(t*i),r=U(n*i);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=_c(n);return s[31]|=t&1n?128:0,s}toHex(){return Ac(this.toBytes())}clearCofactor(){return this.multiply(Us(Sf),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Is/2n,!1).double();return Is%2n&&(t=t.add(this)),t.is0()}}const Jt=new Fe(la,ca,1n,U(la*ca)),fn=new Fe(0n,1n,1n,0n);Fe.BASE=Jt;Fe.ZERO=fn;const _c=e=>Cc(kc(Ot(e,0n,io),Go)).reverse(),Ic=e=>Us("0x"+Ac(Sc(Tt(e)).reverse())),Ge=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=Se;return n},Rf=e=>{const n=e*e%Se*e%Se,s=Ge(n,2n)*n%Se,i=Ge(s,1n)*e%Se,o=Ge(i,5n)*i%Se,r=Ge(o,10n)*o%Se,l=Ge(r,20n)*r%Se,a=Ge(l,40n)*l%Se,d=Ge(a,80n)*a%Se,g=Ge(d,80n)*a%Se,u=Ge(g,10n)*o%Se;return{pow_p_5_8:Ge(u,2n)*e%Se,b2:n}},ua=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Lf=(e,t)=>{const n=U(t*t*t),s=U(n*n*t),i=Rf(e*s).pow_p_5_8;let o=U(e*n*i);const r=U(t*o*o),l=o,a=U(o*ua),d=r===e,g=r===U(-e),u=r===U(-e*ua);return d&&(o=l),(g||u)&&(o=a),(U(o)&1n)===1n&&(o=U(-o)),{isValid:d||g,value:o}},oo=e=>Ec(Ic(e)),Vo=(...e)=>Rc.sha512Async(Qn(...e)),Df=(...e)=>Mf("sha512")(Qn(...e)),Mc=e=>{const t=e.slice(0,Vt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Vt,Go),s=oo(t),i=Jt.multiply(s),o=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:o}},Jo=e=>Vo(Tt(e,Vt)).then(Mc),Pf=e=>Mc(Df(Tt(e,Vt))),Ff=e=>Jo(e).then(t=>t.pointBytes),Nf=e=>Vo(e.hashable).then(e.finish),Of=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,o=oo(t),r=Jt.multiply(o).toBytes();return{hashable:Qn(r,s,n),finish:d=>{const g=Ec(o+oo(d)*i);return Tt(Qn(r,_c(g)),Go)}}},Uf=async(e,t)=>{const n=Tt(e),s=await Jo(t),i=await Vo(s.prefix,n);return Nf(Of(s,i,n))},Rc={sha512Async:async e=>{const t=Ef(),n=Qn(e);return ri(await t.digest("SHA-512",n.buffer))},sha512:void 0},Bf=(e=_f(Vt))=>e,Hf={getExtendedPublicKeyAsync:Jo,getExtendedPublicKey:Pf,randomSecretKey:Bf},Bs=8,zf=256,Lc=Math.ceil(zf/Bs)+1,ro=2**(Bs-1),jf=()=>{const e=[];let t=Jt,n=t;for(let s=0;s<Lc;s++){n=t,e.push(n);for(let i=1;i<ro;i++)n=n.add(t),e.push(n);t=n.double()}return e};let ga;const fa=(e,t)=>{const n=t.negate();return e?n:t},Kf=e=>{const t=ga||(ga=jf());let n=fn,s=Jt;const i=2**Bs,o=i,r=Us(i-1),l=Us(Bs);for(let a=0;a<Lc;a++){let d=Number(e&r);e>>=l,d>ro&&(d-=o,e+=1n);const g=a*ro,u=g,f=g+Math.abs(d)-1,v=a%2!==0,m=d<0;d===0?s=s.add(fa(v,t[u])):n=n.add(fa(m,t[f]))}return e!==0n&&me("invalid wnaf"),{p:n,f:s}},_i="openclaw-device-identity-v1";function ao(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Dc(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let o=0;o<s.length;o+=1)i[o]=s.charCodeAt(o);return i}function Wf(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Pc(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Wf(new Uint8Array(t))}async function qf(){const e=Hf.randomSecretKey(),t=await Ff(e);return{deviceId:await Pc(t),publicKey:ao(t),privateKey:ao(e)}}async function Qo(){try{const n=localStorage.getItem(_i);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await Pc(Dc(s.publicKey));if(i!==s.deviceId){const o={...s,deviceId:i};return localStorage.setItem(_i,JSON.stringify(o)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await qf(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(_i,JSON.stringify(t)),e}async function Gf(e,t){const n=Dc(e),s=new TextEncoder().encode(t),i=await Uf(s,n);return ao(i)}async function Et(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Vf(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Et(e)}catch(n){e.devicesError=String(n)}}async function Jf(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Et(e)}catch(s){e.devicesError=String(s)}}async function Qf(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Qo(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&$c({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Et(e)}catch(n){e.devicesError=String(n)}}async function Yf(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await Qo();t.deviceId===s.deviceId&&xc({deviceId:s.deviceId,role:t.role}),await Et(e)}catch(s){e.devicesError=String(s)}}function Xf(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function Zf(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Yo(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Xf(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);ep(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function ep(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=St(t.file??{}))}async function tp(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=Zf(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await Yo(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function np(e,t,n){const s=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});ec(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function sp(e,t){const n=St(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});tc(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}function Fc(e){return e instanceof Error?e.message:String(e)}function pa(e,t,n){const s=t.trim();if(!s)return;const i={...e.marketMessages};n?i[s]=n:delete i[s],e.marketMessages=i}function xn(e){return e.state.installed?e.state.enabled?{kind:"disable",enabled:!1,successMessage:"Skill disabled."}:{kind:"enable",enabled:!0,successMessage:"Skill enabled."}:{kind:"install",successMessage:"Installed."}}async function Xo(e){if(!(!e.client||!e.connected||e.marketLoading)){e.marketLoading=!0,e.marketError=null;try{const t=await e.client.request("skills.market.catalog",{});e.marketCatalog=Array.isArray(t?.catalog)?t.catalog:[]}catch(t){e.marketError=Fc(t)}finally{e.marketLoading=!1}}}async function ip(e,t){if(!e.client||!e.connected)return;const n=e.marketCatalog.find(i=>i.skillKey===t);if(!n)return;const s=xn(n);e.marketBusyKey=t,e.marketError=null;try{let i=s.successMessage;if(s.kind==="install"){const o=await e.client.request("skills.market.installOrEnable",{skillKey:t});i=o?.action==="already-installed"?"Already installed.":o?.message?.trim()||s.successMessage}else await e.client.request("skills.update",{skillKey:t,enabled:s.enabled});await Xo(e),pa(e,t,{kind:"success",message:i})}catch(i){const o=Fc(i);e.marketError=o,pa(e,t,{kind:"error",message:o})}finally{e.marketBusyKey=null}}function Nc(e){return typeof e=="string"?e.trim()||void 0:!e||typeof e!="object"?void 0:e.primary?.trim()||void 0}const op=8192,Hs="bitseek",rp="bitseek/AUTO",Yn=16e3,ap=4096,lp={"gpt-5.1-codex":4e5,"gpt-5.1-codex-mini":4e5,"gpt-5.1-codex-max":4e5,"gpt-5.1":4e5,"gpt-5.2":4e5,"claude-opus-4-6":1048576,"claude-opus-4-5":2e5,"gemini-3-pro":1048576,"gemini-3-flash":1048576,"glm-4.7":204800};function lo(e,t){return`${e}/${t}`}function cp(e){const t=typeof e=="number"&&Number.isFinite(e)?Math.floor(e):0;return t>=Yn?t:Yn}function dp(e){if(typeof e=="string")return e.trim()||void 0;if(!e||typeof e!="object")return;const t=e.primary;return typeof t!="string"?void 0:t.trim()||void 0}function up(e){if(!e||typeof e!="object")return[];const t=e.fallbacks;return Array.isArray(t)?t.map(n=>typeof n=="string"?n.trim():"").filter(Boolean):[]}function Zo(e,t){const n=e.agents?.defaults,s=n?.model,i=n?.models,o=typeof s=="object"&&s!==null&&"fallbacks"in s?s.fallbacks:void 0;return{...e,agents:{...e.agents,defaults:{...n,model:{...o?{fallbacks:o}:{},primary:t},models:{...i,[t]:i?.[t]??{}}}}}}function gp(e){const t=e.trim();if(!t)return null;const n=t.indexOf("/");return n<=0||n>=t.length-1?null:{providerId:t.slice(0,n).trim(),modelId:t.slice(n+1).trim()}}function er(e){if(typeof e!="number"||!Number.isFinite(e))return null;const t=Math.floor(e);return t>0?t:null}function fp(e){const t=e.config.models?.providers??{};let n=null;for(const[s,i]of Object.entries(t))if(!(!i||!Array.isArray(i.models)||s===e.selectedProviderId))for(const o of i.models){if(o.id!==e.modelId)continue;const r=er(o.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function pp(e){if(!Array.isArray(e.catalogModels)||e.catalogModels.length===0)return null;const t=e.selectedProviderId.trim().toLowerCase();let n=null;for(const s of e.catalogModels){if((typeof s?.id=="string"?s.id.trim():"")!==e.modelId)continue;const o=typeof s?.provider=="string"?s.provider.trim().toLowerCase():"";if(o&&o===t)continue;const r=er(s?.contextWindow);r&&(n=n==null?r:Math.max(n,r))}return n}function hp(e){const t=e.trim().toLowerCase();return t?lp[t]??null:null}function mp(e){const t=gp(e.modelRef);if(!t)return e.config;const n=e.config.models?.providers??{},s=n[t.providerId];if(!s||!Array.isArray(s.models))return e.config;let i=!1;const o=s.models.map(r=>{if(r.id!==t.modelId)return r;const l=er(r.contextWindow);let a;if(t.providerId===Hs)a=op;else{const d=fp({config:e.config,selectedProviderId:t.providerId,modelId:t.modelId}),g=pp({selectedProviderId:t.providerId,modelId:t.modelId,catalogModels:e.catalogModels}),u=hp(t.modelId),f=d??g??u;a=f!=null?Math.max(f,Yn):Math.max(l??0,Yn)}return a===r.contextWindow?r:(i=!0,{...r,contextWindow:a})});return i?{...e.config,models:{...e.config.models,providers:{...n,[t.providerId]:{...s,models:o}}}}:e.config}function co(e){const t=e.trim().toLowerCase();return t?t.replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,""):""}function Oc(e){try{const t=new URL(e),n=t.hostname.replace(/[^a-z0-9]+/gi,"-").toLowerCase(),s=t.port?`-${t.port}`:"",i=`custom-${n}${s}`;return co(i)||"custom"}catch{return"custom"}}function vp(e){const t=e.config.models?.providers??{},n=co(e.requestedProviderId?.trim()||"");if(n)return n;const s=Oc(e.baseUrl),i=co(s)||"custom",o=t[i];if(!o?.baseUrl||o.baseUrl===e.baseUrl)return i;let r=2,l=`${i}-${r}`;for(;t[l];)r+=1,l=`${i}-${r}`;return l}function bp(e){try{new URL(e)}catch{throw new Error("Custom provider base URL must be a valid URL.")}}function yp(e){const t=e.alias.trim();if(!t)return;const n=e.cfg.agents?.defaults?.models??{},s=t.toLowerCase(),i=new Set((e.ignoreModelRefs??[]).map(o=>o.trim()).filter(Boolean));for(const[o,r]of Object.entries(n)){if(o===e.modelRef||i.has(o))continue;const l=r.alias,a=typeof l=="string"?l.trim().toLowerCase():"";if(a&&a===s)throw new Error(`Alias ${t} already points to ${o}.`)}}function $p(e){const t=e.baseUrl.trim();bp(t);const n=e.modelId.trim();if(!n)throw new Error("Custom provider model ID is required.");const s=vp({config:e.config,baseUrl:t,requestedProviderId:e.providerId}),i=e.config.models?.providers??{},o=i[s],r=Array.isArray(o?.models)?o.models:[],l=e.previousModelId?.trim(),a=l?r.filter(L=>L.id!==l):r,d=a.some(L=>L.id===n),g={id:n,name:`${n} (Custom Provider)`,contextWindow:Yn,maxTokens:ap,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!1},u=d?a.map(L=>L.id===n?{...L,contextWindow:cp(L.contextWindow)}:L):[...a,g],f=e.replaceApiKey===!0?e.apiKey?.trim():void 0,v={...o??{baseUrl:t,models:[],api:"openai-completions"},baseUrl:t,api:"openai-completions",models:u.length>0?u:[g]};e.replaceApiKey===!0&&(f?v.apiKey=f:delete v.apiKey);const m=lo(s,n),S=e.providerId?.trim()||s,C=l?lo(S,l):void 0,R=e.alias?.trim()??"";yp({cfg:e.config,alias:R,modelRef:m,ignoreModelRefs:C?[C]:[]});const I={...e.config.agents?.defaults?.models};C&&C!==m&&delete I[C];const A={...I[m]};return R?A.alias=R:delete A.alias,I[m]=A,{config:{...e.config,models:{...e.config.models,mode:e.config.models?.mode??"merge",providers:{...i,[s]:v}},agents:{...e.config.agents,defaults:{...e.config.agents?.defaults,models:I}}},providerId:s,modelId:n}}function ha(e,t){const n=t?[[t,e[t]]]:Object.entries(e),s=[];for(const[i,o]of n)if(!(!o||!Array.isArray(o.models)))for(const r of o.models){const l=typeof r?.id=="string"?r.id.trim():"";l&&s.push(lo(i,l))}return s}function xp(e){const t=ha(e,Hs);return t.length>0?t[0]:e[Hs]?rp:ha(e)[0]}function wp(e){const t=e.providerId.trim();if(!t||t===Hs)return e.config;const n=e.config.models?.providers??{};if(!n[t])return e.config;const s={...n};delete s[t];const i=`${t}/`,o=e.config.agents?.defaults,r=o?.models??{},l={};for(const[m,S]of Object.entries(r))m.startsWith(i)||(l[m]=S);const a=dp(o?.model),d=up(o?.model).filter(m=>!m.startsWith(i)),u=(a&&!a.startsWith(i)?a:void 0)??xp(s);let f={...e.config,models:{...e.config.models,providers:s},agents:{...e.config.agents,defaults:{...o,...Object.keys(l).length>0?{models:l}:{}}}};if(Object.keys(l).length===0&&(f={...f,agents:{...f.agents,defaults:{...f.agents?.defaults,models:void 0}}}),!u)return f;f=Zo(f,u);const v=d.filter(m=>m!==u);return v.length===0?f:{...f,agents:{...f.agents,defaults:{...f.agents?.defaults,model:{primary:u,fallbacks:v}}}}}const pn="__new__",Xn="bitseek",Sp=4e3,zs=new WeakMap;function kp(e){const t=zs.get(e);t&&(clearTimeout(t),zs.delete(e))}function hn(e,t){if(e.modelsVerifyState=t,kp(e),t?.tone!=="success")return;const n=t,s=setTimeout(()=>{e.modelsVerifyState===n&&(e.modelsVerifyState=null),zs.delete(e)},Sp);zs.set(e,s)}function Ap(e){const t=e instanceof Error?e.message:String(e);return/invalid models\.verify params/i.test(t)&&/providerId/i.test(t)}function as(e){return St(e?.config??{})}function Cp(e){return!!(e&&e.api==="openai-completions"&&typeof e.baseUrl=="string"&&e.baseUrl.trim()&&Array.isArray(e.models)&&e.models.some(t=>typeof t?.id=="string"&&t.id.trim()))}function Tp(e,t,n){const s=n.startsWith(`${e}/`)?n.slice(e.length+1):"";return t.models.find(o=>o.id===s)?.id??t.models[0]?.id??""}function tr(e,t,n){return e.agents?.defaults?.models?.[`${t}/${n}`]?.alias?.trim()??""}function Ep(e){return e===Xn?"BitSeek":e}function Uc(e){const t=e.models?.providers??{};return Object.entries(t).filter(([,n])=>Cp(n)).map(([n,s])=>[n,s]).toSorted(([n],[s])=>n===Xn?-1:s===Xn?1:n.localeCompare(s))}function _p(e,t,n,s){const i=Tp(t,n,s),o=tr(e,t,i),r=t===Xn?"bitseek":"custom";return{providerId:t,kind:r,title:r==="bitseek"?"BitSeek":o||t,subtitle:r==="bitseek"?"Built-in provider":t,modelId:i,modelRef:`${t}/${i}`,baseUrl:n.baseUrl,apiKeyConfigured:n.apiKey!==void 0}}function Bc(e){const t=Nc(e.agents?.defaults?.model)??"";return Uc(e).map(([n,s])=>_p(e,n,s,t))}function Ip(e){const t=[];for(const[n,s]of Uc(e)){const i=Ep(n);for(const o of s.models){const r=typeof o?.id=="string"?o.id.trim():"";if(!r)continue;const l=`${n}/${r}`,a=tr(e,n,r),d=typeof o?.name=="string"?o.name.trim():"",g=a||d||r;t.push({modelRef:l,providerId:n,modelId:r,providerLabel:i,modelLabel:g,label:`${i} · ${g} (${l})`})}}return t}function Hc(e,t){const n=t.kind==="bitseek";return{kind:t.kind,originalProviderId:t.providerId,originalModelId:t.modelId,providerIdHint:t.providerId,displayName:tr(e,t.providerId,t.modelId),baseUrl:t.baseUrl,apiKey:"",apiKeyConfigured:t.apiKeyConfigured,apiKeyChanged:!1,modelId:t.modelId,saved:!0,canDelete:t.kind==="custom",readonlyModelIdentity:n}}function js(){return{kind:"custom",originalProviderId:null,originalModelId:null,providerIdHint:"custom",displayName:"",baseUrl:"",apiKey:"",apiKeyConfigured:!1,apiKeyChanged:!1,modelId:"",saved:!1,canDelete:!1,readonlyModelIdentity:!1}}function ai(e){const t=as(e.configSnapshot),n=Bc(t),s=Ip(t),i=Nc(t.agents?.defaults?.model)??"",r=s.some(d=>d.modelRef===i)?i:s[0]?.modelRef??i,l=e.modelsSelectedProviderId===pn?pn:n.some(d=>d.providerId===e.modelsSelectedProviderId)?e.modelsSelectedProviderId:n[0]?.providerId??pn;if(e.modelsProviders=n,e.modelsSwitchableModels=s,e.modelsSelectedDefault=r,e.modelsSelectedProviderId=l,l===pn){e.modelsDraft=js();return}const a=n.find(d=>d.providerId===l);e.modelsDraft=a?Hc(t,a):js()}async function nr(e,t){const n=e.configSnapshot?.hash;return n?(await e.client?.request("config.set",{raw:$n(t),baseHash:n}),await Ae(e),ai(e),!0):(e.modelsError="Config hash missing; reload and retry.",!1)}async function zc(e){if(!(!e.client||!e.connected)){e.modelsLoading=!0,e.modelsError=null,e.modelsDefaultState=null;try{e.configSnapshot?.hash||await Ae(e),ai(e)}catch(t){e.modelsError=String(t)}finally{e.modelsLoading=!1}}}function ma(e,t){e.modelsSelectedProviderId=t,hn(e,null);const n=as(e.configSnapshot);if(t===pn){e.modelsDraft=js();return}const s=Bc(n).find(i=>i.providerId===t);e.modelsDraft=s?Hc(n,s):js()}function Mp(e,t,n){if(!e.modelsDraft||t!=="apiKey"&&e.modelsDraft.readonlyModelIdentity)return;const s={...e.modelsDraft,[t]:n};t==="baseUrl"&&!s.originalProviderId&&(s.providerIdHint=Oc(n.trim())||"custom"),t==="apiKey"&&(s.apiKeyChanged=!0),e.modelsDraft=s,hn(e,null)}async function Rp(e){if(!(!e.client||!e.connected||!e.modelsDraft)){e.modelsSaving=!0,e.modelsError=null;try{const t=e.modelsDraft;if(t.kind==="bitseek"){if(!t.apiKeyChanged)return;const d=t.apiKey.trim();if(!d)throw new Error("BitSeek API key cannot be empty.");await e.client.request("models.auth.set",{providerId:Xn,apiKey:d}),e.modelsDraft={...t,apiKey:"",apiKeyChanged:!1,apiKeyConfigured:!0},e.modelsVerifyState={tone:"success",message:"BitSeek API key saved."};return}const n=as(e.configSnapshot),s=t.originalProviderId&&t.originalModelId?`${t.originalProviderId}/${t.originalModelId}`:"",i=$p({config:n,baseUrl:t.baseUrl,modelId:t.modelId,providerId:t.originalProviderId??void 0,alias:t.displayName,apiKey:t.apiKeyChanged?t.apiKey:void 0,replaceApiKey:t.apiKeyChanged,previousModelId:t.originalModelId??void 0}),o=`${i.providerId}/${i.modelId}`,r=e.modelsSelectedDefault===s?o:e.modelsSelectedDefault,l=Zo(i.config,r||o);if(!await nr(e,l))return;e.modelsSelectedProviderId=i.providerId??null,ai(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Lp(e){if(!(!e.client||!e.connected||!e.modelsSelectedDefault.trim())){e.modelsDefaultSaving=!0,e.modelsError=null,e.modelsDefaultState=null;try{const t=e.modelsSelectedDefault.trim();let n=[];try{const o=await e.client.request("models.list",{});n=Array.isArray(o?.models)?o.models:[]}catch{n=[]}const s=mp({config:as(e.configSnapshot),modelRef:t,catalogModels:n}),i=Zo(s,t);await nr(e,i),e.modelsDefaultState={tone:"success",message:"Default model saved."}}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsDefaultSaving=!1}}}async function Dp(e){if(!(!e.client||!e.connected||!e.modelsDraft?.originalProviderId)&&e.modelsDraft.kind==="custom"){e.modelsSaving=!0,e.modelsError=null;try{const t=wp({config:as(e.configSnapshot),providerId:e.modelsDraft.originalProviderId});await nr(e,t),e.modelsSelectedProviderId=null,ai(e)}catch(t){e.modelsError=t instanceof Error?t.message:String(t)}finally{e.modelsSaving=!1}}}async function Pp(e){if(!e.client||!e.connected||!e.modelsDraft)return;const t=e.modelsDraft.apiKey.trim();e.modelsVerifyBusy=!0,hn(e,null),e.modelsError=null;try{const n={baseUrl:e.modelsDraft.baseUrl.trim(),modelId:e.modelsDraft.modelId.trim(),...e.modelsDraft.originalProviderId?{providerId:e.modelsDraft.originalProviderId}:{},...t?{apiKey:t}:{}};let s;try{s=await e.client.request("models.verify",n)}catch(i){if(!n.providerId||!Ap(i))throw i;const{providerId:o,...r}=n;s=await e.client.request("models.verify",r)}if(s.ok){hn(e,{tone:"success",message:s.status!==void 0?`Verification successful (HTTP ${s.status}).`:"Verification successful."});return}hn(e,{tone:"danger",message:s.status!==void 0?`Verification failed (HTTP ${s.status}).`:s.error||"Verification failed."})}catch(n){hn(e,{tone:"danger",message:n instanceof Error?n.message:String(n)})}finally{e.modelsVerifyBusy=!1}}function Fp(e,t){e.modelsSelectedDefault=t,e.modelsDefaultState=null}function Np(){return pn}async function sr(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function Yt(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??Ne(e.sessionsFilterActive,0),o=t?.limit??Ne(e.sessionsFilterLimit,0),r={includeGlobal:n,includeUnknown:s};i>0&&(r.activeMinutes=i),o>0&&(r.limit=o);const l=await e.client.request("sessions.list",r);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Op(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await Yt(e)}catch(i){e.sessionsError=String(i)}}async function Up(e,t){if(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
127
127
|
|
|
128
|
-
Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoading=!0,e.sessionsError=null;try{return await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),!0}catch(s){return e.sessionsError=String(s),!1}finally{e.sessionsLoading=!1}}async function Bp(e,t){return await Up(e,t)?(await Yt(e),!0):!1}function wn(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ai(e){return e instanceof Error?e.message:String(e)}async function ls(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=ai(n)}finally{e.skillsLoading=!1}}}function Hp(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function zp(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await ls(e),wn(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ai(s);e.skillsError=i,wn(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function jp(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await ls(e),wn(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ai(n);e.skillsError=s,wn(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Kp(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await ls(e),wn(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const o=ai(i);e.skillsError=o,wn(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const Wp=[{label:"chat",tabs:["chat"]},{label:"control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"agent",tabs:["agents","skills","market","nodes"]},{label:"settings",tabs:["models","config","debug","logs"]}],jc={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",market:"/market",nodes:"/nodes",chat:"/chat",models:"/models",config:"/config",debug:"/debug",logs:"/logs"},Kc=new Map(Object.entries(jc).map(([e,t])=>[t,e]));function Xt(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Zn(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function li(e,t=""){const n=Xt(t),s=jc[e];return n?`${n}${s}`:s}function Wc(e,t=""){const n=Xt(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=Zn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Kc.get(i)??null}function qc(e){let t=Zn(e);if(t.endsWith("/index.html")&&(t=Zn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(Kc.has(i)){const o=n.slice(0,s);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function qp(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";case"cron":return"loader";case"skills":return"zap";case"market":return"puzzle";case"nodes":return"monitor";case"models":return"folder";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function co(e){return p(`tabs.${e}`)}function Gp(e){return p(`subtitles.${e}`)}const Gc="openclaw.control.settings.v1";function Vp(){const t={gatewayUrl:(()=>{const n=location.protocol==="https:"?"wss":"ws",s=typeof window<"u"&&typeof window.__OPENCLAW_CONTROL_UI_BASE_PATH__=="string"&&window.__OPENCLAW_CONTROL_UI_BASE_PATH__.trim(),i=s?Xt(s):qc(location.pathname);return`${n}://${location.host}${i}`})(),token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"light",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(Gc);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed,locale:Xl(s.locale)?s.locale:void 0}}catch{return t}}function Jp(e){localStorage.setItem(Gc,JSON.stringify(e))}const ms=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Qp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,vs=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Yp=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const o=i.documentElement,r=i,l=Qp();if(!!r.startViewTransition&&!l){let d=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")d=ms(n.pointerClientX/window.innerWidth),g=ms(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(d=ms((u.left+u.width/2)/window.innerWidth),g=ms((u.top+u.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${d*100}%`),o.style.setProperty("--theme-switch-y",`${g*100}%`),o.classList.add("theme-transition");try{const u=r.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>vs(o)):vs(o)}catch{vs(o),t()}return}t(),vs(o)};function Xp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ir(e){return e==="system"?Xp():e}function At(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,Jp(n),t.theme!==e.theme&&(e.theme=t.theme,ci(e,ir(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Vc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&At(e,{...e.settings,lastActiveSessionKey:n})}function Zp(e){if(!window.location.search&&!window.location.hash)return;const t=new URL(window.location.href),n=new URLSearchParams(t.search),s=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash),i=n.get("token")??s.get("token"),o=n.get("password")??s.get("password"),r=n.get("session")??s.get("session"),l=n.get("gatewayUrl")??s.get("gatewayUrl");let a=!1;if(i!=null){const g=i.trim();g&&g!==e.settings.token&&At(e,{...e.settings,token:g}),n.delete("token"),s.delete("token"),a=!0}if(o!=null&&(n.delete("password"),s.delete("password"),a=!0),r!=null){const g=r.trim();g&&(e.sessionKey=g,At(e,{...e.settings,sessionKey:g,lastActiveSessionKey:g}))}if(l!=null){const g=l.trim();g&&g!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=g),n.delete("gatewayUrl"),s.delete("gatewayUrl"),a=!0}if(!a)return;t.search=n.toString();const d=s.toString();t.hash=d?`#${d}`:"",window.history.replaceState({},"",t.toString())}function eh(e,t){Yc(e,t,{refreshPolicy:"always",syncUrl:!0})}function th(e,t,n){Yp({nextTheme:t,applyTheme:()=>{e.theme=t,At(e,{...e.settings,theme:t}),ci(e,ir(t))},context:n,currentTheme:e.theme})}async function Jc(e){if(e.tab==="overview"&&await Zc(e),e.tab==="channels"&&await ch(e),e.tab==="instances"&&await sr(e),e.tab==="sessions"&&await Yt(e),e.tab==="cron"&&await js(e),e.tab==="skills"&&await ls(e),e.tab==="market"&&await Xo(e),e.tab==="agents"){await Uo(e),await Hn(e),await Ae(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&fc(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(gc(e,n),e.agentsPanel==="skills"&&Es(e,n),e.agentsPanel==="channels"&&Re(e,!1),e.agentsPanel==="cron"&&js(e))}e.tab==="models"&&await zc(e),e.tab==="nodes"&&(await si(e),await Et(e),await Ae(e),await Yo(e)),e.tab==="chat"&&(await gd(e),ss(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await nc(e),await Ae(e)),e.tab==="debug"&&(await ni(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Oo(e,{reset:!0}),ac(e,!0))}function nh(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Xt(e):qc(window.location.pathname)}function sh(e){e.theme=e.settings.theme??"system",ci(e,ir(e.theme))}function ci(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function ih(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&ci(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function oh(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function rh(e,t){if(typeof window>"u")return;const n=Wc(window.location.pathname,e.basePath)??"chat";Qc(e,n),Xc(e,n,t)}function ah(e){if(typeof window>"u")return;const t=Wc(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,At(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Qc(e,t)}function Qc(e,t){Yc(e,t,{refreshPolicy:"connected"})}function Yc(e,t,n){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?lc(e):cc(e),t==="debug"?dc(e):uc(e),(n.refreshPolicy==="always"||e.connected)&&Jc(e),n.syncUrl&&Xc(e,t,!1)}function Xc(e,t,n){if(typeof window>"u")return;const s=Zn(li(t,e.basePath)),i=Zn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),i!==s&&(o.pathname=s),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}function lh(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function Zc(e){await Promise.all([Re(e,!1),sr(e),Yt(e),os(e),ni(e)])}async function ch(e){await Promise.all([Re(e,!0),nc(e),Ae(e)])}async function js(e){const t=e;if(await Promise.all([Re(e,!1),os(t),ii(t),Zg(t)]),t.cronRunsScope==="all"){await yt(t,null);return}t.cronRunsJobId&&await yt(t,t.cronRunsJobId)}const va=50,dh=80,uh=12e4;function Ne(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function an(e,t){const n=Ne(t);if(!n)return null;const s=Ne(e);if(s){const o=`${s}/`;if(n.toLowerCase().startsWith(o.toLowerCase())){const r=n.slice(o.length).trim();if(r)return`${s}/${r}`}return`${s}/${n}`}const i=n.indexOf("/");if(i>0){const o=n.slice(0,i).trim(),r=n.slice(i+1).trim();if(o&&r)return`${o}/${r}`}return n}function gh(e){return Array.isArray(e)?e.map(t=>Ne(t)).filter(t=>!!t):[]}function fh(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const s=n,i=Ne(s.provider),o=Ne(s.model);if(!i||!o)continue;const r=Ne(s.reason)?.replace(/_/g," ")??Ne(s.code)??(typeof s.status=="number"?`HTTP ${s.status}`:null)??Ne(s.error)??"error";t.push({provider:i,model:o,reason:r})}return t}function ph(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const o=i;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
128
|
+
Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoading=!0,e.sessionsError=null;try{return await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),!0}catch(s){return e.sessionsError=String(s),!1}finally{e.sessionsLoading=!1}}async function Bp(e,t){return await Up(e,t)?(await Yt(e),!0):!1}function wn(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function li(e){return e instanceof Error?e.message:String(e)}async function ls(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=li(n)}finally{e.skillsLoading=!1}}}function Hp(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function zp(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await ls(e),wn(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=li(s);e.skillsError=i,wn(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function jp(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await ls(e),wn(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=li(n);e.skillsError=s,wn(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Kp(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await ls(e),wn(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const o=li(i);e.skillsError=o,wn(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const Wp=[{label:"chat",tabs:["chat"]},{label:"control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"agent",tabs:["agents","skills","market","nodes"]},{label:"settings",tabs:["models","config","debug","logs"]}],jc={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",market:"/market",nodes:"/nodes",chat:"/chat",models:"/models",config:"/config",debug:"/debug",logs:"/logs"},Kc=new Map(Object.entries(jc).map(([e,t])=>[t,e]));function Xt(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Zn(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function ci(e,t=""){const n=Xt(t),s=jc[e];return n?`${n}${s}`:s}function Wc(e,t=""){const n=Xt(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=Zn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Kc.get(i)??null}function qc(e){let t=Zn(e);if(t.endsWith("/index.html")&&(t=Zn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(Kc.has(i)){const o=n.slice(0,s);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function qp(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";case"cron":return"loader";case"skills":return"zap";case"market":return"puzzle";case"nodes":return"monitor";case"models":return"folder";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function uo(e){return p(`tabs.${e}`)}function Gp(e){return p(`subtitles.${e}`)}const Gc="openclaw.control.settings.v1";function Vp(){const t={gatewayUrl:(()=>{const n=location.protocol==="https:"?"wss":"ws",s=typeof window<"u"&&typeof window.__OPENCLAW_CONTROL_UI_BASE_PATH__=="string"&&window.__OPENCLAW_CONTROL_UI_BASE_PATH__.trim(),i=s?Xt(s):qc(location.pathname);return`${n}://${location.host}${i}`})(),token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"light",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(Gc);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed,locale:Xl(s.locale)?s.locale:void 0}}catch{return t}}function Jp(e){localStorage.setItem(Gc,JSON.stringify(e))}const ms=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Qp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,vs=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Yp=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const o=i.documentElement,r=i,l=Qp();if(!!r.startViewTransition&&!l){let d=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")d=ms(n.pointerClientX/window.innerWidth),g=ms(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(d=ms((u.left+u.width/2)/window.innerWidth),g=ms((u.top+u.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${d*100}%`),o.style.setProperty("--theme-switch-y",`${g*100}%`),o.classList.add("theme-transition");try{const u=r.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>vs(o)):vs(o)}catch{vs(o),t()}return}t(),vs(o)};function Xp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ir(e){return e==="system"?Xp():e}function At(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,Jp(n),t.theme!==e.theme&&(e.theme=t.theme,di(e,ir(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Vc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&At(e,{...e.settings,lastActiveSessionKey:n})}function Zp(e){if(!window.location.search&&!window.location.hash)return;const t=new URL(window.location.href),n=new URLSearchParams(t.search),s=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash),i=n.get("token")??s.get("token"),o=n.get("password")??s.get("password"),r=n.get("session")??s.get("session"),l=n.get("gatewayUrl")??s.get("gatewayUrl");let a=!1;if(i!=null){const g=i.trim();g&&g!==e.settings.token&&At(e,{...e.settings,token:g}),n.delete("token"),s.delete("token"),a=!0}if(o!=null&&(n.delete("password"),s.delete("password"),a=!0),r!=null){const g=r.trim();g&&(e.sessionKey=g,At(e,{...e.settings,sessionKey:g,lastActiveSessionKey:g}))}if(l!=null){const g=l.trim();g&&g!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=g),n.delete("gatewayUrl"),s.delete("gatewayUrl"),a=!0}if(!a)return;t.search=n.toString();const d=s.toString();t.hash=d?`#${d}`:"",window.history.replaceState({},"",t.toString())}function eh(e,t){Yc(e,t,{refreshPolicy:"always",syncUrl:!0})}function th(e,t,n){Yp({nextTheme:t,applyTheme:()=>{e.theme=t,At(e,{...e.settings,theme:t}),di(e,ir(t))},context:n,currentTheme:e.theme})}async function Jc(e){if(e.tab==="overview"&&await Zc(e),e.tab==="channels"&&await ch(e),e.tab==="instances"&&await sr(e),e.tab==="sessions"&&await Yt(e),e.tab==="cron"&&await Ks(e),e.tab==="skills"&&await ls(e),e.tab==="market"&&await Xo(e),e.tab==="agents"){await Uo(e),await Hn(e),await Ae(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&fc(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(gc(e,n),e.agentsPanel==="skills"&&Es(e,n),e.agentsPanel==="channels"&&Re(e,!1),e.agentsPanel==="cron"&&Ks(e))}e.tab==="models"&&await zc(e),e.tab==="nodes"&&(await ii(e),await Et(e),await Ae(e),await Yo(e)),e.tab==="chat"&&(await gd(e),ss(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await nc(e),await Ae(e)),e.tab==="debug"&&(await si(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Oo(e,{reset:!0}),ac(e,!0))}function nh(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Xt(e):qc(window.location.pathname)}function sh(e){e.theme=e.settings.theme??"system",di(e,ir(e.theme))}function di(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function ih(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&di(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function oh(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function rh(e,t){if(typeof window>"u")return;const n=Wc(window.location.pathname,e.basePath)??"chat";Qc(e,n),Xc(e,n,t)}function ah(e){if(typeof window>"u")return;const t=Wc(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,At(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Qc(e,t)}function Qc(e,t){Yc(e,t,{refreshPolicy:"connected"})}function Yc(e,t,n){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?lc(e):cc(e),t==="debug"?dc(e):uc(e),(n.refreshPolicy==="always"||e.connected)&&Jc(e),n.syncUrl&&Xc(e,t,!1)}function Xc(e,t,n){if(typeof window>"u")return;const s=Zn(ci(t,e.basePath)),i=Zn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),i!==s&&(o.pathname=s),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}function lh(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function Zc(e){await Promise.all([Re(e,!1),sr(e),Yt(e),os(e),si(e)])}async function ch(e){await Promise.all([Re(e,!0),nc(e),Ae(e)])}async function Ks(e){const t=e;if(await Promise.all([Re(e,!1),os(t),oi(t),Zg(t)]),t.cronRunsScope==="all"){await yt(t,null);return}t.cronRunsJobId&&await yt(t,t.cronRunsJobId)}const va=50,dh=80,uh=12e4;function Oe(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function an(e,t){const n=Oe(t);if(!n)return null;const s=Oe(e);if(s){const o=`${s}/`;if(n.toLowerCase().startsWith(o.toLowerCase())){const r=n.slice(o.length).trim();if(r)return`${s}/${r}`}return`${s}/${n}`}const i=n.indexOf("/");if(i>0){const o=n.slice(0,i).trim(),r=n.slice(i+1).trim();if(o&&r)return`${o}/${r}`}return n}function gh(e){return Array.isArray(e)?e.map(t=>Oe(t)).filter(t=>!!t):[]}function fh(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const s=n,i=Oe(s.provider),o=Oe(s.model);if(!i||!o)continue;const r=Oe(s.reason)?.replace(/_/g," ")??Oe(s.code)??(typeof s.status=="number"?`HTTP ${s.status}`:null)??Oe(s.error)??"error";t.push({provider:i,model:o,reason:r})}return t}function ph(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const o=i;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
129
129
|
`)}function ba(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=ph(e);let n;if(typeof e=="string")n=e;else if(t)n=t;else try{n=JSON.stringify(e,null,2)}catch{n=String(e)}const s=pc(n,uh);return s.truncated?`${s.text}
|
|
130
130
|
|
|
131
|
-
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function hh(e){const t=[];return t.push({type:"toolcall",name:e.name,arguments:e.args??{}}),e.output&&t.push({type:"toolresult",name:e.name,text:e.output}),{role:"assistant",toolCallId:e.toolCallId,runId:e.runId,content:t,timestamp:e.startedAt}}function mh(e){if(e.toolStreamOrder.length<=va)return;const t=e.toolStreamOrder.length-va,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function vh(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function
|
|
131
|
+
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function hh(e){const t=[];return t.push({type:"toolcall",name:e.name,arguments:e.args??{}}),e.output&&t.push({type:"toolresult",name:e.name,text:e.output}),{role:"assistant",toolCallId:e.toolCallId,runId:e.runId,content:t,timestamp:e.startedAt}}function mh(e){if(e.toolStreamOrder.length<=va)return;const t=e.toolStreamOrder.length-va,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function vh(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function go(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),vh(e)}function bh(e,t=!1){if(t){go(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>go(e),dh))}function ui(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],go(e)}const yh=5e3,$h=8e3;function xh(e,t){const n=t.data??{},s=typeof n.phase=="string"?n.phase:"";e.compactionClearTimer!=null&&(window.clearTimeout(e.compactionClearTimer),e.compactionClearTimer=null),s==="start"?e.compactionStatus={active:!0,startedAt:Date.now(),completedAt:null}:s==="end"&&(e.compactionStatus={active:!1,startedAt:e.compactionStatus?.startedAt??null,completedAt:Date.now()},e.compactionClearTimer=window.setTimeout(()=>{e.compactionStatus=null,e.compactionClearTimer=null},yh))}function ed(e,t,n){const s=typeof t.sessionKey=="string"?t.sessionKey:void 0;return s&&s!==e.sessionKey?{accepted:!1}:!e.chatRunId&&n?.allowSessionScopedWhenIdle&&s?{accepted:!0,sessionKey:s}:!s&&e.chatRunId&&t.runId!==e.chatRunId?{accepted:!1}:e.chatRunId&&t.runId!==e.chatRunId?{accepted:!1}:e.chatRunId?{accepted:!0,sessionKey:s}:{accepted:!1}}function wh(e,t){const n=t.data??{},s=t.stream==="fallback"?"fallback":Oe(n.phase);if(t.stream==="lifecycle"&&s!=="fallback"&&s!=="fallback_cleared"||!ed(e,t,{allowSessionScopedWhenIdle:!0}).accepted)return;const o=an(n.selectedProvider,n.selectedModel)??an(n.fromProvider,n.fromModel),r=an(n.activeProvider,n.activeModel)??an(n.toProvider,n.toModel),l=an(n.previousActiveProvider,n.previousActiveModel)??Oe(n.previousActiveModel);if(!o||!r||s==="fallback"&&o===r)return;const a=Oe(n.reasonSummary)??Oe(n.reason),d=(()=>{const g=gh(n.attemptSummaries);return g.length>0?g:fh(n.attempts).map(u=>`${an(u.provider,u.model)??`${u.provider}/${u.model}`}: ${u.reason}`)})();e.fallbackClearTimer!=null&&(window.clearTimeout(e.fallbackClearTimer),e.fallbackClearTimer=null),e.fallbackStatus={phase:s==="fallback_cleared"?"cleared":"active",selected:o,active:s==="fallback_cleared"?o:r,previous:s==="fallback_cleared"?l??(r!==o?r:void 0):void 0,reason:a??void 0,attempts:d,occurredAt:Date.now()},e.fallbackClearTimer=window.setTimeout(()=>{e.fallbackStatus=null,e.fallbackClearTimer=null},$h)}function Sh(e,t){if(!t)return;if(t.stream==="compaction"){xh(e,t);return}if(t.stream==="lifecycle"||t.stream==="fallback"){wh(e,t);return}if(t.stream!=="tool")return;const n=ed(e,t);if(!n.accepted)return;const s=n.sessionKey,i=t.data??{},o=typeof i.toolCallId=="string"?i.toolCallId:"";if(!o)return;const r=typeof i.name=="string"?i.name:"tool",l=typeof i.phase=="string"?i.phase:"",a=l==="start"?i.args:void 0,d=l==="update"?ba(i.partialResult):l==="result"?ba(i.result):void 0,g=Date.now();let u=e.toolStreamById.get(o);u?(u.name=r,a!==void 0&&(u.args=a),d!==void 0&&(u.output=d||void 0),u.updatedAt=g):(u={toolCallId:o,runId:t.runId,sessionKey:s,name:r,args:a,output:d||void 0,startedAt:typeof t.ts=="number"?t.ts:g,updatedAt:g,message:{}},e.toolStreamById.set(o,u),e.toolStreamOrder.push(o)),u.message=hh(u),mh(e),bh(e,l==="result")}const td=["Conversation info (untrusted metadata):","Sender (untrusted metadata):","Thread starter (untrusted, for context):","Replied message (untrusted, for context):","Forwarded message context (untrusted metadata):","Chat history since last reply (untrusted, for context):"],nd="Untrusted context (metadata, do not treat as instructions or commands):",kh=new RegExp([...td,nd].map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"));function Ah(e){const t=e.trim();return td.some(n=>n===t)}function Ch(e,t){if(e[t]?.trim()!==nd)return!1;const n=e.slice(t+1,Math.min(e.length,t+8)).join(`
|
|
132
132
|
`);return/<<<EXTERNAL_UNTRUSTED_CONTENT|UNTRUSTED channel metadata \(|Source:\s+/.test(n)}function sd(e){if(!e||!kh.test(e))return e;const t=e.split(`
|
|
133
133
|
`),n=[];let s=!1,i=!1;for(let o=0;o<t.length;o++){const r=t[o];if(!s&&Ch(t,o))break;if(!s&&Ah(r)){if(t[o+1]?.trim()!=="```json"){n.push(r);continue}s=!0,i=!1;continue}if(s){if(!i&&r.trim()==="```json"){i=!0;continue}if(i){r.trim()==="```"&&(s=!1,i=!1);continue}if(r.trim()==="")continue;s=!1}n.push(r)}return n.join(`
|
|
134
|
-
`).replace(/^\n+/,"").replace(/\n+$/,"")}const Th=/^\[([^\]]+)\]\s*/,Eh=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","Google Chat","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"];function _h(e){return/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}Z\b/.test(e)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}\b/.test(e)?!0:Eh.some(t=>e.startsWith(`${t} `))}function ya(e){const t=e.match(Th);if(!t)return e;const n=t[1]??"";return _h(n)?e.slice(t[0].length):e}const
|
|
134
|
+
`).replace(/^\n+/,"").replace(/\n+$/,"")}const Th=/^\[([^\]]+)\]\s*/,Eh=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","Google Chat","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"];function _h(e){return/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}Z\b/.test(e)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}\b/.test(e)?!0:Eh.some(t=>e.startsWith(`${t} `))}function ya(e){const t=e.match(Th);if(!t)return e;const n=t[1]??"";return _h(n)?e.slice(t[0].length):e}const Ii=new WeakMap,Mi=new WeakMap;function Ih(e,t){const n=t.toLowerCase()==="user";return t==="assistant"?Yg(e):n?sd(ya(e)):ya(e)}function Ws(e){const t=e,n=typeof t.role=="string"?t.role:"",s=od(e);return s?Ih(s,n):null}function id(e){if(!e||typeof e!="object")return Ws(e);const t=e;if(Ii.has(t))return Ii.get(t)??null;const n=Ws(e);return Ii.set(t,n),n}function $a(e){const n=e.content,s=[];if(Array.isArray(n))for(const l of n){const a=l;if(a.type==="thinking"&&typeof a.thinking=="string"){const d=a.thinking.trim();d&&s.push(d)}}if(s.length>0)return s.join(`
|
|
135
135
|
`);const i=od(e);if(!i)return null;const r=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(l=>(l[1]??"").trim()).filter(Boolean);return r.length>0?r.join(`
|
|
136
|
-
`):null}function Mh(e){if(!e||typeof e!="object")return $a(e);const t=e;if(
|
|
136
|
+
`):null}function Mh(e){if(!e||typeof e!="object")return $a(e);const t=e;if(Mi.has(t))return Mi.get(t)??null;const n=$a(e);return Mi.set(t,n),n}function od(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const o=i;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
|
|
137
137
|
`)}return typeof t.text=="string"?t.text:null}function Rh(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean).map(s=>`_${s}_`);return n.length?["_Reasoning:_",...n].join(`
|
|
138
|
-
`):""}let xa=!1;function wa(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Lh(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function Dh(){xa||(xa=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function ui(e=globalThis.crypto){if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),wa(t)}return Dh(),wa(Lh())}const Ph=/^\s*NO_REPLY\s*$/;function zn(e){return Ph.test(e)}function Ms(e){if(!e||typeof e!="object")return!1;const t=e;if((typeof t.role=="string"?t.role.toLowerCase():"")!=="assistant")return!1;if(typeof t.text=="string")return zn(t.text);const s=Ks(e);return typeof s=="string"&&zn(s)}async function es(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200}),n=Array.isArray(t.messages)?t.messages:[];e.chatMessages=n.filter(s=>!Ms(s)),e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Fh(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}function rd(e,t){if(!e||typeof e!="object")return null;const n=e,s=n.role;if(typeof s=="string"){if((t.roleCaseSensitive?s:s.toLowerCase())!=="assistant")return null}else if(t.roleRequirement==="required")return null;return t.requireContentArray?Array.isArray(n.content)?n:null:!("content"in n)&&!(t.allowTextField&&"text"in n)?null:n}function Nh(e){return rd(e,{roleRequirement:"required",roleCaseSensitive:!0,requireContentArray:!0})}function Sa(e){return rd(e,{roleRequirement:"optional",allowTextField:!0})}async function Oh(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const o=Date.now(),r=[];if(s&&r.push({type:"text",text:s}),i)for(const d of n)r.push({type:"image",source:{type:"base64",media_type:d.mimeType,data:d.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:r,timestamp:o}],e.chatSending=!0,e.lastError=null;const l=ui();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=o;const a=i?n.map(d=>{const g=Fh(d.dataUrl);return g?{type:"image",mimeType:g.mimeType,content:g.content}:null}).filter(d=>d!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:a}),l}catch(d){const g=String(d);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=g,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+g}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Uh(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Bh(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId){if(t.state==="final"){const n=Sa(t.message);return n&&!Ms(n)?(e.chatMessages=[...e.chatMessages,n],null):"final"}return null}if(t.state==="delta"){const n=Ks(t.message);if(typeof n=="string"&&!zn(n)){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else if(t.state==="final"){const n=Sa(t.message);n&&!Ms(n)?e.chatMessages=[...e.chatMessages,n]:e.chatStream?.trim()&&!zn(e.chatStream)&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:e.chatStream}],timestamp:Date.now()}]),e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else if(t.state==="aborted"){const n=Nh(t.message);if(n&&!Ms(n))e.chatMessages=[...e.chatMessages,n];else{const s=e.chatStream??"";s.trim()&&!zn(s)&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:s}],timestamp:Date.now()}])}e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const ad=120;function ld(e){return e.chatSending||!!e.chatRunId}function Hh(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function zh(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function cd(e){e.connected&&(e.chatMessage="",await Uh(e))}function jh(e,t,n,s){const i=t.trim(),o=!!(n&&n.length>0);!i&&!o||(e.chatQueue=[...e.chatQueue,{id:ui(),text:i,createdAt:Date.now(),attachments:o?n?.map(r=>({...r})):void 0,refreshSessions:s}])}async function dd(e,t,n){di(e);const s=await Oh(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Vc(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),ss(e),i&&!e.chatRunId&&ud(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function ud(e){if(!e.connected||ld(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await dd(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function Kh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wh(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],l=r.length>0;if(!i&&!l)return;if(Hh(i)){await cd(e);return}const a=zh(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),ld(e)){jh(e,i,r,a);return}await dd(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:a})}async function gd(e,t){await Promise.all([es(e),Yt(e,{activeMinutes:ad}),go(e)]),t?.scheduleScroll!==!1&&ss(e)}const qh=ud;function Gh(e){const t=Mg(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vh(e,t){const n=Xt(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function go(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vh(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),o=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const Jh="update.available";function Qh(e){if(!e||e.state!=="final")return!1;if(!e.message||typeof e.message!="object")return!0;const t=e.message,n=typeof t.role=="string"?t.role.toLowerCase():"";return!!(n&&n!=="assistant")}function ka(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}const Yh=50,Xh=200,Zh="Assistant";function or(e){const t=ka(e?.name,Yh)??Zh,n=ka(e?.avatar??void 0,Xh)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}async function fd(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const o=or(i);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function fo(e){return typeof e=="object"&&e!==null}function em(e){if(!fo(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!fo(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!o?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:o}}function tm(e){if(!fo(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function pd(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function nm(e,t){const n=pd(e).filter(s=>s.id!==t.id);return n.push(t),n}function Aa(e,t){return pd(e).filter(n=>n.id!==t)}function sm(e){const t=e.scopes.join(","),n=e.token??"";return["v2",e.deviceId,e.clientId,e.clientMode,e.role,t,String(e.signedAtMs),n,e.nonce].join("|")}const hd={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},Ca=hd,po={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(hd));new Set(Object.values(po));const xe={AUTH_REQUIRED:"AUTH_REQUIRED",AUTH_UNAUTHORIZED:"AUTH_UNAUTHORIZED",AUTH_TOKEN_MISSING:"AUTH_TOKEN_MISSING",AUTH_TOKEN_MISMATCH:"AUTH_TOKEN_MISMATCH",AUTH_TOKEN_NOT_CONFIGURED:"AUTH_TOKEN_NOT_CONFIGURED",AUTH_PASSWORD_MISSING:"AUTH_PASSWORD_MISSING",AUTH_PASSWORD_MISMATCH:"AUTH_PASSWORD_MISMATCH",AUTH_PASSWORD_NOT_CONFIGURED:"AUTH_PASSWORD_NOT_CONFIGURED",AUTH_DEVICE_TOKEN_MISMATCH:"AUTH_DEVICE_TOKEN_MISMATCH",AUTH_RATE_LIMITED:"AUTH_RATE_LIMITED",AUTH_TAILSCALE_IDENTITY_MISSING:"AUTH_TAILSCALE_IDENTITY_MISSING",AUTH_TAILSCALE_PROXY_MISSING:"AUTH_TAILSCALE_PROXY_MISSING",AUTH_TAILSCALE_WHOIS_FAILED:"AUTH_TAILSCALE_WHOIS_FAILED",AUTH_TAILSCALE_IDENTITY_MISMATCH:"AUTH_TAILSCALE_IDENTITY_MISMATCH",CONTROL_UI_DEVICE_IDENTITY_REQUIRED:"CONTROL_UI_DEVICE_IDENTITY_REQUIRED",DEVICE_IDENTITY_REQUIRED:"DEVICE_IDENTITY_REQUIRED",PAIRING_REQUIRED:"PAIRING_REQUIRED"};function im(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.code;return typeof t=="string"&&t.trim().length>0?t:null}class Ta extends Error{constructor(t){super(t.message),this.name="GatewayRequestError",this.gatewayCode=t.code,this.details=t.details}}function om(e){return im(e?.details)}const rm=4008;class am{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.pendingConnectError=void 0,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",t=>{const n=String(t.reason??""),s=this.pendingConnectError;this.pendingConnectError=void 0,this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n,error:s}),this.scheduleReconnect()}),this.ws.addEventListener("error",()=>{}))}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,o=!1,r=this.opts.token;if(t){i=await Qo();const g=wf({deviceId:i.deviceId,role:s})?.token;r=g??this.opts.token,o=!!(g&&this.opts.token)}const l=r||this.opts.password?{token:r,password:this.opts.password}:void 0;let a;if(t&&i){const g=Date.now(),u=this.connectNonce??"",f=sm({deviceId:i.deviceId,clientId:this.opts.clientName??Ca.CONTROL_UI,clientMode:this.opts.mode??po.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:r??null,nonce:u}),v=await Gf(i.privateKey,f);a={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:g,nonce:u}}const d={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ca.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??po.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:a,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",d).then(g=>{g?.auth?.deviceToken&&i&&$c({deviceId:i.deviceId,role:g.auth.role??s,token:g.auth.deviceToken,scopes:g.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(g)}).catch(g=>{g instanceof Ta?this.pendingConnectError={code:g.gatewayCode,message:g.message,details:g.details}:this.pendingConnectError=void 0,o&&i&&xc({deviceId:i.deviceId,role:s}),this.ws?.close(rm,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const r=i.payload,l=r&&typeof r.nonce=="string"?r.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const o=typeof i.seq=="number"?i.seq:null;o!==null&&(this.lastSeq!==null&&o>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:o}),this.lastSeq=o);try{this.opts.onEvent?.(i)}catch(r){console.error("[gateway] event handler error:",r)}return}if(s.type==="res"){const i=n,o=this.pending.get(i.id);if(!o)return;this.pending.delete(i.id),i.ok?o.resolve(i.payload):o.reject(new Ta({code:i.error?.code??"UNAVAILABLE",message:i.error?.message??"request failed",details:i.error?.details}));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=ui(),i={type:"req",id:s,method:t,params:n},o=new Promise((r,l)=>{this.pending.set(s,{resolve:a=>r(a),reject:l})});return this.ws.send(JSON.stringify(i)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Mi(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",o=t.defaultAgentId?.trim();return n==="main"||n===i||o&&(n===`agent:${o}:main`||n===`agent:${o}:${i}`)?s:n}function lm(e,t){if(!t?.mainSessionKey)return;const n=Mi(e.sessionKey,t),s=Mi(e.settings.sessionKey,t),i=Mi(e.settings.lastActiveSessionKey,t),o=n||s||e.sessionKey,r={...e.settings,sessionKey:s||o,lastActiveSessionKey:i||o},l=r.sessionKey!==e.settings.sessionKey||r.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),l&&At(e,r)}function md(e){e.lastError=null,e.lastErrorCode=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=e.client,n=new am({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",instanceId:e.clientInstanceId,onHello:s=>{e.client===n&&(e.connected=!0,e.lastError=null,e.lastErrorCode=null,e.hello=s,fm(e,s),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,di(e),fd(e),Uo(e),Hn(e),Ae(e),si(e,{quiet:!0}),Et(e,{quiet:!0}),Jc(e))},onClose:({code:s,reason:i,error:o})=>{if(e.client===n)if(e.connected=!1,e.lastErrorCode=om(o)??(typeof o?.code=="string"?o.code:null),s!==1012){if(o?.message){e.lastError=o.message;return}e.lastError=`disconnected (${s}): ${i||"no reason"}`}else e.lastError=null,e.lastErrorCode=null},onEvent:s=>{e.client===n&&cm(e,s)},onGap:({expected:s,received:i})=>{e.client===n&&(e.lastError=`event gap detected (expected seq ${s}, got ${i}); refresh recommended`,e.lastErrorCode=null)}});e.client=n,t?.stop(),n.start()}function cm(e,t){try{gm(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function dm(e,t,n){if(n!=="final"&&n!=="error"&&n!=="aborted")return;di(e),qh(e);const s=t?.runId;!s||!e.refreshSessionsAfterChat.has(s)||(e.refreshSessionsAfterChat.delete(s),n==="final"&&Yt(e,{activeMinutes:ad}))}function um(e,t){t?.sessionKey&&Vc(e,t.sessionKey);const n=Bh(e,t);dm(e,t,n),n==="final"&&Qh(t)&&es(e)}function gm(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;Sh(e,t.payload);return}if(t.event==="chat"){um(e,t.payload);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&js(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Et(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=em(t.payload);if(n){e.execApprovalQueue=nm(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Aa(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=tm(t.payload);n&&(e.execApprovalQueue=Aa(e.execApprovalQueue,n.id));return}if(t.event===Jh){const n=t.payload;e.updateAvailable=n?.updateAvailable??null}}function fm(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&lm(e,n.sessionDefaults),e.updateAvailable=n?.updateAvailable??null}const Ea="/__openclaw/control-ui-config.json";async function pm(e){if(typeof window>"u"||typeof fetch!="function")return;const t=Xt(e.basePath??""),n=t?`${t}${Ea}`:Ea;try{const s=await fetch(n,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin"});if(!s.ok)return;const i=await s.json(),o=or({agentId:i.assistantAgentId??null,name:i.assistantName,avatar:i.assistantAvatar??null});e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function hm(e){e.basePath=nh(),pm(e),Zp(e),rh(e,!0),sh(e),ih(e),window.addEventListener("popstate",e.popStateHandler),md(e),zg(e),e.tab==="logs"&&lc(e),e.tab==="debug"&&dc(e)}function mm(e){Pg(e)}function vm(e){window.removeEventListener("popstate",e.popStateHandler),jg(e),cc(e),uc(e),e.client?.stop(),e.client=null,e.connected=!1,oh(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function bm(e,t){if(!(e.tab==="chat"&&e.chatManualRefreshInFlight)){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&!e.chatLoading;ss(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&ac(e,t.has("tab")||t.has("logsAutoFollow"))}}const vd="openclaw.control.usage.date-params.v1",ym="__default__",$m=/unexpected property ['"]mode['"]/i,xm=/unexpected property ['"]utcoffset['"]/i,wm=/invalid sessions\.usage params/i;let Ri=null;function bd(){return typeof window<"u"&&window.localStorage?window.localStorage:typeof localStorage<"u"?localStorage:null}function Sm(){const e=bd();if(!e)return new Set;try{const t=e.getItem(vd);if(!t)return new Set;const n=JSON.parse(t);return!n||!Array.isArray(n.unsupportedGatewayKeys)?new Set:new Set(n.unsupportedGatewayKeys.filter(s=>typeof s=="string").map(s=>s.trim()).filter(Boolean))}catch{return new Set}}function km(e){const t=bd();if(t)try{t.setItem(vd,JSON.stringify({unsupportedGatewayKeys:Array.from(e)}))}catch{}}function yd(){return Ri||(Ri=Sm()),Ri}function Am(e){const t=e?.trim();if(!t)return ym;try{const n=new URL(t),s=n.pathname==="/"?"":n.pathname;return`${n.protocol}//${n.host}${s}`.toLowerCase()}catch{return t.toLowerCase()}}function $d(e){return Am(e.settings?.gatewayUrl)}function Cm(e){return!yd().has($d(e))}function Tm(e){const t=yd();t.add($d(e)),km(t)}function Em(e){const t=xd(e);return wm.test(t)&&($m.test(t)||xm.test(t))}const _m=e=>{const t=-e,n=t>=0?"+":"-",s=Math.abs(t),i=Math.floor(s/60),o=s%60;return o===0?`UTC${n}${i}`:`UTC${n}${i}:${o.toString().padStart(2,"0")}`},Im=(e,t)=>{if(t)return e==="utc"?{mode:"utc"}:{mode:"specific",utcOffset:_m(new Date().getTimezoneOffset())}};function xd(e){if(typeof e=="string")return e;if(e instanceof Error&&typeof e.message=="string"&&e.message.trim())return e.message;if(e&&typeof e=="object")try{const t=JSON.stringify(e);if(t)return t}catch{}return"request failed"}async function ho(e,t){const n=e.client;if(!(!n||!e.connected)&&!e.usageLoading){e.usageLoading=!0,e.usageError=null;try{const s=t?.startDate??e.usageStartDate,i=t?.endDate??e.usageEndDate,o=async a=>{const d=Im(e.usageTimeZone,a);return await Promise.all([n.request("sessions.usage",{startDate:s,endDate:i,...d,limit:1e3,includeContextWeight:!0}),n.request("usage.cost",{startDate:s,endDate:i,...d})])},r=(a,d)=>{a&&(e.usageResult=a),d&&(e.usageCostSummary=d)},l=Cm(e);try{const[a,d]=await o(l);r(a,d)}catch(a){if(l&&Em(a)){Tm(e);const[d,g]=await o(!1);r(d,g)}else throw a}}catch(s){e.usageError=xd(s)}finally{e.usageLoading=!1}}}async function Mm(e,t){if(!(!e.client||!e.connected)&&!e.usageTimeSeriesLoading){e.usageTimeSeriesLoading=!0,e.usageTimeSeries=null;try{const n=await e.client.request("sessions.usage.timeseries",{key:t});n&&(e.usageTimeSeries=n)}catch{e.usageTimeSeries=null}finally{e.usageTimeSeriesLoading=!1}}}async function Rm(e,t){if(!(!e.client||!e.connected)&&!e.usageSessionLogsLoading){e.usageSessionLogsLoading=!0,e.usageSessionLogs=null;try{const n=await e.client.request("sessions.usage.logs",{key:t,limit:1e3});n&&Array.isArray(n.logs)&&(e.usageSessionLogs=n.logs)}catch{e.usageSessionLogs=null}finally{e.usageSessionLogsLoading=!1}}}const Lm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),Ws=e=>e.trim().toLowerCase(),Dm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},Ut=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith("$")&&(t=t.slice(1));let n=1;t.endsWith("k")?(n=1e3,t=t.slice(0,-1)):t.endsWith("m")&&(n=1e6,t=t.slice(0,-1));const s=Number(t);return Number.isFinite(s)?s*n:null},rr=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const o=s.slice(0,i),r=s.slice(i+1);return{key:o,value:r,raw:s}}return{value:s,raw:s}}),Pm=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),_a=e=>{const t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(const n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},Ia=e=>{const t=new Set;e.model&&t.add(e.model.toLowerCase());for(const n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},Fm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),Nm=(e,t)=>{const n=Ws(t.value??"");if(!n)return!0;if(!t.key)return Pm(e).some(i=>i.includes(n));switch(Ws(t.key)){case"agent":return e.agentId?.toLowerCase().includes(n)??!1;case"channel":return e.channel?.toLowerCase().includes(n)??!1;case"chat":return e.chatType?.toLowerCase().includes(n)??!1;case"provider":return _a(e).some(i=>i.includes(n));case"model":return Ia(e).some(i=>i.includes(n));case"tool":return Fm(e).some(i=>i.includes(n));case"label":return e.label?.toLowerCase().includes(n)??!1;case"key":case"session":case"id":if(n.includes("*")||n.includes("?")){const i=Dm(n);return i.test(e.key)||(e.sessionId?i.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case"has":switch(n){case"tools":return(e.usage?.toolUsage?.totalCalls??0)>0;case"errors":return(e.usage?.messageCounts?.errors??0)>0;case"context":return!!e.contextWeight;case"usage":return!!e.usage;case"model":return Ia(e).length>0;case"provider":return _a(e).length>0;default:return!0}case"mintokens":{const i=Ut(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=Ut(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=Ut(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=Ut(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=Ut(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=Ut(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},Om=(e,t)=>{const n=rr(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const o of n){if(!o.key)continue;const r=Ws(o.key);if(!Lm.has(r)){s.push(`Unknown filter: ${o.key}`);continue}if(o.value===""&&s.push(`Missing value for ${o.key}`),r==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);o.value&&!l.has(Ws(o.value))&&s.push(`Unknown has:${o.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(r)&&o.value&&Ut(o.value)===null&&s.push(`Invalid number for ${o.key}`)}return{sessions:e.filter(o=>n.every(r=>Nm(o,r))),warnings:s}};function wd(e){const t=e.split(`
|
|
138
|
+
`):""}let xa=!1;function wa(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Lh(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function Dh(){xa||(xa=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function gi(e=globalThis.crypto){if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),wa(t)}return Dh(),wa(Lh())}const Ph=/^\s*NO_REPLY\s*$/;function zn(e){return Ph.test(e)}function Ms(e){if(!e||typeof e!="object")return!1;const t=e;if((typeof t.role=="string"?t.role.toLowerCase():"")!=="assistant")return!1;if(typeof t.text=="string")return zn(t.text);const s=Ws(e);return typeof s=="string"&&zn(s)}async function es(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200}),n=Array.isArray(t.messages)?t.messages:[];e.chatMessages=n.filter(s=>!Ms(s)),e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Fh(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}function rd(e,t){if(!e||typeof e!="object")return null;const n=e,s=n.role;if(typeof s=="string"){if((t.roleCaseSensitive?s:s.toLowerCase())!=="assistant")return null}else if(t.roleRequirement==="required")return null;return t.requireContentArray?Array.isArray(n.content)?n:null:!("content"in n)&&!(t.allowTextField&&"text"in n)?null:n}function Nh(e){return rd(e,{roleRequirement:"required",roleCaseSensitive:!0,requireContentArray:!0})}function Sa(e){return rd(e,{roleRequirement:"optional",allowTextField:!0})}async function Oh(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const o=Date.now(),r=[];if(s&&r.push({type:"text",text:s}),i)for(const d of n)r.push({type:"image",source:{type:"base64",media_type:d.mimeType,data:d.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:r,timestamp:o}],e.chatSending=!0,e.lastError=null;const l=gi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=o;const a=i?n.map(d=>{const g=Fh(d.dataUrl);return g?{type:"image",mimeType:g.mimeType,content:g.content}:null}).filter(d=>d!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:a}),l}catch(d){const g=String(d);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=g,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+g}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Uh(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Bh(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId){if(t.state==="final"){const n=Sa(t.message);return n&&!Ms(n)?(e.chatMessages=[...e.chatMessages,n],null):"final"}return null}if(t.state==="delta"){const n=Ws(t.message);if(typeof n=="string"&&!zn(n)){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else if(t.state==="final"){const n=Sa(t.message);n&&!Ms(n)?e.chatMessages=[...e.chatMessages,n]:e.chatStream?.trim()&&!zn(e.chatStream)&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:e.chatStream}],timestamp:Date.now()}]),e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else if(t.state==="aborted"){const n=Nh(t.message);if(n&&!Ms(n))e.chatMessages=[...e.chatMessages,n];else{const s=e.chatStream??"";s.trim()&&!zn(s)&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:s}],timestamp:Date.now()}])}e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const ad=120;function ld(e){return e.chatSending||!!e.chatRunId}function Hh(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function zh(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function cd(e){e.connected&&(e.chatMessage="",await Uh(e))}function jh(e,t,n,s){const i=t.trim(),o=!!(n&&n.length>0);!i&&!o||(e.chatQueue=[...e.chatQueue,{id:gi(),text:i,createdAt:Date.now(),attachments:o?n?.map(r=>({...r})):void 0,refreshSessions:s}])}async function dd(e,t,n){ui(e);const s=await Oh(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Vc(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),ss(e),i&&!e.chatRunId&&ud(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function ud(e){if(!e.connected||ld(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await dd(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function Kh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wh(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],l=r.length>0;if(!i&&!l)return;if(Hh(i)){await cd(e);return}const a=zh(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),ld(e)){jh(e,i,r,a);return}await dd(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:a})}async function gd(e,t){await Promise.all([es(e),Yt(e,{activeMinutes:ad}),fo(e)]),t?.scheduleScroll!==!1&&ss(e)}const qh=ud;function Gh(e){const t=Mg(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vh(e,t){const n=Xt(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function fo(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vh(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),o=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const Jh="update.available";function Qh(e){if(!e||e.state!=="final")return!1;if(!e.message||typeof e.message!="object")return!0;const t=e.message,n=typeof t.role=="string"?t.role.toLowerCase():"";return!!(n&&n!=="assistant")}function ka(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}const Yh=50,Xh=200,Zh="Assistant";function or(e){const t=ka(e?.name,Yh)??Zh,n=ka(e?.avatar??void 0,Xh)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}async function fd(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const o=or(i);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function po(e){return typeof e=="object"&&e!==null}function em(e){if(!po(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!po(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!o?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:o}}function tm(e){if(!po(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function pd(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function nm(e,t){const n=pd(e).filter(s=>s.id!==t.id);return n.push(t),n}function Aa(e,t){return pd(e).filter(n=>n.id!==t)}function sm(e){const t=e.scopes.join(","),n=e.token??"";return["v2",e.deviceId,e.clientId,e.clientMode,e.role,t,String(e.signedAtMs),n,e.nonce].join("|")}const hd={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},Ca=hd,ho={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(hd));new Set(Object.values(ho));const xe={AUTH_REQUIRED:"AUTH_REQUIRED",AUTH_UNAUTHORIZED:"AUTH_UNAUTHORIZED",AUTH_TOKEN_MISSING:"AUTH_TOKEN_MISSING",AUTH_TOKEN_MISMATCH:"AUTH_TOKEN_MISMATCH",AUTH_TOKEN_NOT_CONFIGURED:"AUTH_TOKEN_NOT_CONFIGURED",AUTH_PASSWORD_MISSING:"AUTH_PASSWORD_MISSING",AUTH_PASSWORD_MISMATCH:"AUTH_PASSWORD_MISMATCH",AUTH_PASSWORD_NOT_CONFIGURED:"AUTH_PASSWORD_NOT_CONFIGURED",AUTH_DEVICE_TOKEN_MISMATCH:"AUTH_DEVICE_TOKEN_MISMATCH",AUTH_RATE_LIMITED:"AUTH_RATE_LIMITED",AUTH_TAILSCALE_IDENTITY_MISSING:"AUTH_TAILSCALE_IDENTITY_MISSING",AUTH_TAILSCALE_PROXY_MISSING:"AUTH_TAILSCALE_PROXY_MISSING",AUTH_TAILSCALE_WHOIS_FAILED:"AUTH_TAILSCALE_WHOIS_FAILED",AUTH_TAILSCALE_IDENTITY_MISMATCH:"AUTH_TAILSCALE_IDENTITY_MISMATCH",CONTROL_UI_DEVICE_IDENTITY_REQUIRED:"CONTROL_UI_DEVICE_IDENTITY_REQUIRED",DEVICE_IDENTITY_REQUIRED:"DEVICE_IDENTITY_REQUIRED",PAIRING_REQUIRED:"PAIRING_REQUIRED"};function im(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.code;return typeof t=="string"&&t.trim().length>0?t:null}class Ta extends Error{constructor(t){super(t.message),this.name="GatewayRequestError",this.gatewayCode=t.code,this.details=t.details}}function om(e){return im(e?.details)}const rm=4008;class am{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.pendingConnectError=void 0,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",t=>{const n=String(t.reason??""),s=this.pendingConnectError;this.pendingConnectError=void 0,this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n,error:s}),this.scheduleReconnect()}),this.ws.addEventListener("error",()=>{}))}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,o=!1,r=this.opts.token;if(t){i=await Qo();const g=wf({deviceId:i.deviceId,role:s})?.token;r=g??this.opts.token,o=!!(g&&this.opts.token)}const l=r||this.opts.password?{token:r,password:this.opts.password}:void 0;let a;if(t&&i){const g=Date.now(),u=this.connectNonce??"",f=sm({deviceId:i.deviceId,clientId:this.opts.clientName??Ca.CONTROL_UI,clientMode:this.opts.mode??ho.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:r??null,nonce:u}),v=await Gf(i.privateKey,f);a={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:g,nonce:u}}const d={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ca.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??ho.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:a,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",d).then(g=>{g?.auth?.deviceToken&&i&&$c({deviceId:i.deviceId,role:g.auth.role??s,token:g.auth.deviceToken,scopes:g.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(g)}).catch(g=>{g instanceof Ta?this.pendingConnectError={code:g.gatewayCode,message:g.message,details:g.details}:this.pendingConnectError=void 0,o&&i&&xc({deviceId:i.deviceId,role:s}),this.ws?.close(rm,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const r=i.payload,l=r&&typeof r.nonce=="string"?r.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const o=typeof i.seq=="number"?i.seq:null;o!==null&&(this.lastSeq!==null&&o>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:o}),this.lastSeq=o);try{this.opts.onEvent?.(i)}catch(r){console.error("[gateway] event handler error:",r)}return}if(s.type==="res"){const i=n,o=this.pending.get(i.id);if(!o)return;this.pending.delete(i.id),i.ok?o.resolve(i.payload):o.reject(new Ta({code:i.error?.code??"UNAVAILABLE",message:i.error?.message??"request failed",details:i.error?.details}));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=gi(),i={type:"req",id:s,method:t,params:n},o=new Promise((r,l)=>{this.pending.set(s,{resolve:a=>r(a),reject:l})});return this.ws.send(JSON.stringify(i)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ri(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",o=t.defaultAgentId?.trim();return n==="main"||n===i||o&&(n===`agent:${o}:main`||n===`agent:${o}:${i}`)?s:n}function lm(e,t){if(!t?.mainSessionKey)return;const n=Ri(e.sessionKey,t),s=Ri(e.settings.sessionKey,t),i=Ri(e.settings.lastActiveSessionKey,t),o=n||s||e.sessionKey,r={...e.settings,sessionKey:s||o,lastActiveSessionKey:i||o},l=r.sessionKey!==e.settings.sessionKey||r.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),l&&At(e,r)}function md(e){e.lastError=null,e.lastErrorCode=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=e.client,n=new am({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",instanceId:e.clientInstanceId,onHello:s=>{e.client===n&&(e.connected=!0,e.lastError=null,e.lastErrorCode=null,e.hello=s,fm(e,s),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,ui(e),fd(e),Uo(e),Hn(e),Ae(e),ii(e,{quiet:!0}),Et(e,{quiet:!0}),Jc(e))},onClose:({code:s,reason:i,error:o})=>{if(e.client===n)if(e.connected=!1,e.lastErrorCode=om(o)??(typeof o?.code=="string"?o.code:null),s!==1012){if(o?.message){e.lastError=o.message;return}e.lastError=`disconnected (${s}): ${i||"no reason"}`}else e.lastError=null,e.lastErrorCode=null},onEvent:s=>{e.client===n&&cm(e,s)},onGap:({expected:s,received:i})=>{e.client===n&&(e.lastError=`event gap detected (expected seq ${s}, got ${i}); refresh recommended`,e.lastErrorCode=null)}});e.client=n,t?.stop(),n.start()}function cm(e,t){try{gm(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function dm(e,t,n){if(n!=="final"&&n!=="error"&&n!=="aborted")return;ui(e),qh(e);const s=t?.runId;!s||!e.refreshSessionsAfterChat.has(s)||(e.refreshSessionsAfterChat.delete(s),n==="final"&&Yt(e,{activeMinutes:ad}))}function um(e,t){t?.sessionKey&&Vc(e,t.sessionKey);const n=Bh(e,t);dm(e,t,n),n==="final"&&Qh(t)&&es(e)}function gm(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;Sh(e,t.payload);return}if(t.event==="chat"){um(e,t.payload);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&Ks(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Et(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=em(t.payload);if(n){e.execApprovalQueue=nm(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Aa(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=tm(t.payload);n&&(e.execApprovalQueue=Aa(e.execApprovalQueue,n.id));return}if(t.event===Jh){const n=t.payload;e.updateAvailable=n?.updateAvailable??null}}function fm(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&lm(e,n.sessionDefaults),e.updateAvailable=n?.updateAvailable??null}const Ea="/__openclaw/control-ui-config.json";async function pm(e){if(typeof window>"u"||typeof fetch!="function")return;const t=Xt(e.basePath??""),n=t?`${t}${Ea}`:Ea;try{const s=await fetch(n,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin"});if(!s.ok)return;const i=await s.json(),o=or({agentId:i.assistantAgentId??null,name:i.assistantName,avatar:i.assistantAvatar??null});e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function hm(e){e.basePath=nh(),pm(e),Zp(e),rh(e,!0),sh(e),ih(e),window.addEventListener("popstate",e.popStateHandler),md(e),zg(e),e.tab==="logs"&&lc(e),e.tab==="debug"&&dc(e)}function mm(e){Pg(e)}function vm(e){window.removeEventListener("popstate",e.popStateHandler),jg(e),cc(e),uc(e),e.client?.stop(),e.client=null,e.connected=!1,oh(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function bm(e,t){if(!(e.tab==="chat"&&e.chatManualRefreshInFlight)){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&!e.chatLoading;ss(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&ac(e,t.has("tab")||t.has("logsAutoFollow"))}}const vd="openclaw.control.usage.date-params.v1",ym="__default__",$m=/unexpected property ['"]mode['"]/i,xm=/unexpected property ['"]utcoffset['"]/i,wm=/invalid sessions\.usage params/i;let Li=null;function bd(){return typeof window<"u"&&window.localStorage?window.localStorage:typeof localStorage<"u"?localStorage:null}function Sm(){const e=bd();if(!e)return new Set;try{const t=e.getItem(vd);if(!t)return new Set;const n=JSON.parse(t);return!n||!Array.isArray(n.unsupportedGatewayKeys)?new Set:new Set(n.unsupportedGatewayKeys.filter(s=>typeof s=="string").map(s=>s.trim()).filter(Boolean))}catch{return new Set}}function km(e){const t=bd();if(t)try{t.setItem(vd,JSON.stringify({unsupportedGatewayKeys:Array.from(e)}))}catch{}}function yd(){return Li||(Li=Sm()),Li}function Am(e){const t=e?.trim();if(!t)return ym;try{const n=new URL(t),s=n.pathname==="/"?"":n.pathname;return`${n.protocol}//${n.host}${s}`.toLowerCase()}catch{return t.toLowerCase()}}function $d(e){return Am(e.settings?.gatewayUrl)}function Cm(e){return!yd().has($d(e))}function Tm(e){const t=yd();t.add($d(e)),km(t)}function Em(e){const t=xd(e);return wm.test(t)&&($m.test(t)||xm.test(t))}const _m=e=>{const t=-e,n=t>=0?"+":"-",s=Math.abs(t),i=Math.floor(s/60),o=s%60;return o===0?`UTC${n}${i}`:`UTC${n}${i}:${o.toString().padStart(2,"0")}`},Im=(e,t)=>{if(t)return e==="utc"?{mode:"utc"}:{mode:"specific",utcOffset:_m(new Date().getTimezoneOffset())}};function xd(e){if(typeof e=="string")return e;if(e instanceof Error&&typeof e.message=="string"&&e.message.trim())return e.message;if(e&&typeof e=="object")try{const t=JSON.stringify(e);if(t)return t}catch{}return"request failed"}async function mo(e,t){const n=e.client;if(!(!n||!e.connected)&&!e.usageLoading){e.usageLoading=!0,e.usageError=null;try{const s=t?.startDate??e.usageStartDate,i=t?.endDate??e.usageEndDate,o=async a=>{const d=Im(e.usageTimeZone,a);return await Promise.all([n.request("sessions.usage",{startDate:s,endDate:i,...d,limit:1e3,includeContextWeight:!0}),n.request("usage.cost",{startDate:s,endDate:i,...d})])},r=(a,d)=>{a&&(e.usageResult=a),d&&(e.usageCostSummary=d)},l=Cm(e);try{const[a,d]=await o(l);r(a,d)}catch(a){if(l&&Em(a)){Tm(e);const[d,g]=await o(!1);r(d,g)}else throw a}}catch(s){e.usageError=xd(s)}finally{e.usageLoading=!1}}}async function Mm(e,t){if(!(!e.client||!e.connected)&&!e.usageTimeSeriesLoading){e.usageTimeSeriesLoading=!0,e.usageTimeSeries=null;try{const n=await e.client.request("sessions.usage.timeseries",{key:t});n&&(e.usageTimeSeries=n)}catch{e.usageTimeSeries=null}finally{e.usageTimeSeriesLoading=!1}}}async function Rm(e,t){if(!(!e.client||!e.connected)&&!e.usageSessionLogsLoading){e.usageSessionLogsLoading=!0,e.usageSessionLogs=null;try{const n=await e.client.request("sessions.usage.logs",{key:t,limit:1e3});n&&Array.isArray(n.logs)&&(e.usageSessionLogs=n.logs)}catch{e.usageSessionLogs=null}finally{e.usageSessionLogsLoading=!1}}}const Lm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),qs=e=>e.trim().toLowerCase(),Dm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},Ut=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith("$")&&(t=t.slice(1));let n=1;t.endsWith("k")?(n=1e3,t=t.slice(0,-1)):t.endsWith("m")&&(n=1e6,t=t.slice(0,-1));const s=Number(t);return Number.isFinite(s)?s*n:null},rr=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const o=s.slice(0,i),r=s.slice(i+1);return{key:o,value:r,raw:s}}return{value:s,raw:s}}),Pm=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),_a=e=>{const t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(const n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},Ia=e=>{const t=new Set;e.model&&t.add(e.model.toLowerCase());for(const n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},Fm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),Nm=(e,t)=>{const n=qs(t.value??"");if(!n)return!0;if(!t.key)return Pm(e).some(i=>i.includes(n));switch(qs(t.key)){case"agent":return e.agentId?.toLowerCase().includes(n)??!1;case"channel":return e.channel?.toLowerCase().includes(n)??!1;case"chat":return e.chatType?.toLowerCase().includes(n)??!1;case"provider":return _a(e).some(i=>i.includes(n));case"model":return Ia(e).some(i=>i.includes(n));case"tool":return Fm(e).some(i=>i.includes(n));case"label":return e.label?.toLowerCase().includes(n)??!1;case"key":case"session":case"id":if(n.includes("*")||n.includes("?")){const i=Dm(n);return i.test(e.key)||(e.sessionId?i.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case"has":switch(n){case"tools":return(e.usage?.toolUsage?.totalCalls??0)>0;case"errors":return(e.usage?.messageCounts?.errors??0)>0;case"context":return!!e.contextWeight;case"usage":return!!e.usage;case"model":return Ia(e).length>0;case"provider":return _a(e).length>0;default:return!0}case"mintokens":{const i=Ut(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=Ut(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=Ut(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=Ut(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=Ut(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=Ut(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},Om=(e,t)=>{const n=rr(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const o of n){if(!o.key)continue;const r=qs(o.key);if(!Lm.has(r)){s.push(`Unknown filter: ${o.key}`);continue}if(o.value===""&&s.push(`Missing value for ${o.key}`),r==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);o.value&&!l.has(qs(o.value))&&s.push(`Unknown has:${o.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(r)&&o.value&&Ut(o.value)===null&&s.push(`Invalid number for ${o.key}`)}return{sessions:e.filter(o=>n.every(r=>Nm(o,r))),warnings:s}};function wd(e){const t=e.split(`
|
|
139
139
|
`),n=new Map,s=[];for(const l of t){const a=/^\[Tool:\s*([^\]]+)\]/.exec(l.trim());if(a){const d=a[1];n.set(d,(n.get(d)??0)+1);continue}l.trim().startsWith("[Tool Result]")||s.push(l)}const i=Array.from(n.entries()).toSorted((l,a)=>a[1]-l[1]),o=i.reduce((l,[,a])=>l+a,0),r=i.length>0?`Tools: ${i.map(([l,a])=>`${l}×${a}`).join(", ")} (${o} calls)`:"";return{tools:i,summary:r,cleanContent:s.join(`
|
|
140
140
|
`).trim()}}function Um(e,t){!t||t.count<=0||(e.count+=t.count,e.sum+=t.avgMs*t.count,e.min=Math.min(e.min,t.minMs),e.max=Math.max(e.max,t.maxMs),e.p95Max=Math.max(e.p95Max,t.p95Ms))}function Bm(e,t){for(const n of t??[]){const s=e.get(n.date)??{date:n.date,count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};s.count+=n.count,s.sum+=n.avgMs*n.count,s.min=Math.min(s.min,n.minMs),s.max=Math.max(s.max,n.maxMs),s.p95Max=Math.max(s.p95Max,n.p95Ms),e.set(n.date,s)}}function Hm(e){return{byChannel:Array.from(e.byChannelMap.entries()).map(([t,n])=>({channel:t,totals:n})).toSorted((t,n)=>n.totals.totalCost-t.totals.totalCost),latency:e.latencyTotals.count>0?{count:e.latencyTotals.count,avgMs:e.latencyTotals.sum/e.latencyTotals.count,minMs:e.latencyTotals.min===Number.POSITIVE_INFINITY?0:e.latencyTotals.min,maxMs:e.latencyTotals.max,p95Ms:e.latencyTotals.p95Max}:void 0,dailyLatency:Array.from(e.dailyLatencyMap.values()).map(t=>({date:t.date,count:t.count,avgMs:t.count?t.sum/t.count:0,minMs:t.min===Number.POSITIVE_INFINITY?0:t.min,maxMs:t.max,p95Ms:t.p95Max})).toSorted((t,n)=>t.date.localeCompare(n.date)),modelDaily:Array.from(e.modelDailyMap.values()).toSorted((t,n)=>t.date.localeCompare(n.date)||n.cost-t.cost),daily:Array.from(e.dailyMap.values()).toSorted((t,n)=>t.date.localeCompare(n.date))}}const zm=4;function Lt(e){return Math.round(e/zm)}function H(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function jm(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function Km(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:24},()=>0);for(const i of e){const o=i.usage;if(!o?.messageCounts||o.messageCounts.total===0)continue;const r=o.firstActivity??i.updatedAt,l=o.lastActivity??i.updatedAt;if(!r||!l)continue;const a=Math.min(r,l),d=Math.max(r,l),u=Math.max(d-a,1)/6e4;let f=a;for(;f<d;){const v=new Date(f),m=ar(v,t),S=lr(v,t),C=Math.min(S.getTime(),d),I=Math.max((C-f)/6e4,0)/u;n[m]+=o.messageCounts.errors*I,s[m]+=o.messageCounts.total*I,f=C+1}}return s.map((i,o)=>{const r=n[o],l=i>0?r/i:0;return{hour:o,rate:l,errors:r,msgs:i}}).filter(i=>i.msgs>0&&i.errors>0).toSorted((i,o)=>o.rate-i.rate).slice(0,5).map(i=>({label:jm(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const Wm=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ar(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function qm(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function lr(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function Gm(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:7},()=>0);let i=0,o=!1;for(const l of e){const a=l.usage;if(!a||!a.totalTokens||a.totalTokens<=0)continue;i+=a.totalTokens;const d=a.firstActivity??l.updatedAt,g=a.lastActivity??l.updatedAt;if(!d||!g)continue;o=!0;const u=Math.min(d,g),f=Math.max(d,g),m=Math.max(f-u,1)/6e4;let S=u;for(;S<f;){const C=new Date(S),R=ar(C,t),I=qm(C,t),A=lr(C,t),w=Math.min(A.getTime(),f),_=Math.max((w-S)/6e4,0)/m;n[R]+=a.totalTokens*_,s[I]+=a.totalTokens*_,S=w+1}}const r=Wm.map((l,a)=>({label:l,tokens:s[a]}));return{hasData:o,totalTokens:i,hourTotals:n,weekdayTotals:r}}function Vm(e,t,n,s){const i=Gm(e,t);if(!i.hasData)return c`
|
|
141
141
|
<div class="card usage-mosaic">
|
|
@@ -201,8 +201,8 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
201
201
|
</div>
|
|
202
202
|
</div>
|
|
203
203
|
</div>
|
|
204
|
-
`}function se(e,t=2){return`$${e.toFixed(t)}`}function
|
|
205
|
-
`)},ev=e=>{const t=[
|
|
204
|
+
`}function se(e,t=2){return`$${e.toFixed(t)}`}function Di(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Sd(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const[,n,s,i]=t,o=new Date(Date.UTC(Number(n),Number(s)-1,Number(i)));return Number.isNaN(o.valueOf())?null:o}function kd(e){const t=Sd(e);return t?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e}function Jm(e){const t=Sd(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):e}const bs=()=>({input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),ys=(e,t)=>{e.input+=t.input??0,e.output+=t.output??0,e.cacheRead+=t.cacheRead??0,e.cacheWrite+=t.cacheWrite??0,e.totalTokens+=t.totalTokens??0,e.totalCost+=t.totalCost??0,e.inputCost+=t.inputCost??0,e.outputCost+=t.outputCost??0,e.cacheReadCost+=t.cacheReadCost??0,e.cacheWriteCost+=t.cacheWriteCost??0,e.missingCostEntries+=t.missingCostEntries??0},Qm=(e,t)=>{if(e.length===0)return t??{messages:{total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},tools:{totalCalls:0,uniqueTools:0,tools:[]},byModel:[],byProvider:[],byAgent:[],byChannel:[],daily:[]};const n={total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},s=new Map,i=new Map,o=new Map,r=new Map,l=new Map,a=new Map,d=new Map,g=new Map,u={count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};for(const v of e){const m=v.usage;if(m){if(m.messageCounts&&(n.total+=m.messageCounts.total,n.user+=m.messageCounts.user,n.assistant+=m.messageCounts.assistant,n.toolCalls+=m.messageCounts.toolCalls,n.toolResults+=m.messageCounts.toolResults,n.errors+=m.messageCounts.errors),m.toolUsage)for(const S of m.toolUsage.tools)s.set(S.name,(s.get(S.name)??0)+S.count);if(m.modelUsage)for(const S of m.modelUsage){const C=`${S.provider??"unknown"}::${S.model??"unknown"}`,R=i.get(C)??{provider:S.provider,model:S.model,count:0,totals:bs()};R.count+=S.count,ys(R.totals,S.totals),i.set(C,R);const I=S.provider??"unknown",A=o.get(I)??{provider:S.provider,model:void 0,count:0,totals:bs()};A.count+=S.count,ys(A.totals,S.totals),o.set(I,A)}if(Um(u,m.latency),v.agentId){const S=r.get(v.agentId)??bs();ys(S,m),r.set(v.agentId,S)}if(v.channel){const S=l.get(v.channel)??bs();ys(S,m),l.set(v.channel,S)}for(const S of m.dailyBreakdown??[]){const C=a.get(S.date)??{date:S.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};C.tokens+=S.tokens,C.cost+=S.cost,a.set(S.date,C)}for(const S of m.dailyMessageCounts??[]){const C=a.get(S.date)??{date:S.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};C.messages+=S.total,C.toolCalls+=S.toolCalls,C.errors+=S.errors,a.set(S.date,C)}Bm(d,m.dailyLatency);for(const S of m.dailyModelUsage??[]){const C=`${S.date}::${S.provider??"unknown"}::${S.model??"unknown"}`,R=g.get(C)??{date:S.date,provider:S.provider,model:S.model,tokens:0,cost:0,count:0};R.tokens+=S.tokens,R.cost+=S.cost,R.count+=S.count,g.set(C,R)}}}const f=Hm({byChannelMap:l,latencyTotals:u,dailyLatencyMap:d,modelDailyMap:g,dailyMap:a});return{messages:n,tools:{totalCalls:Array.from(s.values()).reduce((v,m)=>v+m,0),uniqueTools:s.size,tools:Array.from(s.entries()).map(([v,m])=>({name:v,count:m})).toSorted((v,m)=>m.count-v.count)},byModel:Array.from(i.values()).toSorted((v,m)=>m.totals.totalCost-v.totals.totalCost),byProvider:Array.from(o.values()).toSorted((v,m)=>m.totals.totalCost-v.totals.totalCost),byAgent:Array.from(r.entries()).map(([v,m])=>({agentId:v,totals:m})).toSorted((v,m)=>m.totals.totalCost-v.totals.totalCost),...f}},Ym=(e,t,n)=>{let s=0,i=0;for(const g of e){const u=g.usage?.durationMs??0;u>0&&(s+=u,i+=1)}const o=i?s/i:0,r=t&&s>0?t.totalTokens/(s/6e4):void 0,l=t&&s>0?t.totalCost/(s/6e4):void 0,a=n.messages.total?n.messages.errors/n.messages.total:0,d=n.daily.filter(g=>g.messages>0&&g.errors>0).map(g=>({date:g.date,errors:g.errors,messages:g.messages,rate:g.errors/g.messages})).toSorted((g,u)=>u.rate-g.rate||u.errors-g.errors)[0];return{durationSumMs:s,durationCount:i,avgDurationMs:o,throughputTokensPerMin:r,throughputCostPerMin:l,errorRate:a,peakErrorDay:d}};function Pi(e,t,n="text/plain"){const s=new Blob([t],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e,o.click(),URL.revokeObjectURL(i)}function Xm(e){return/[",\n]/.test(e)?`"${e.replaceAll('"','""')}"`:e}function Gs(e){return e.map(t=>t==null?"":Xm(String(t))).join(",")}const Zm=e=>{const t=[Gs(["key","label","agentId","channel","provider","model","updatedAt","durationMs","messages","errors","toolCalls","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","totalCost"])];for(const n of e){const s=n.usage;t.push(Gs([n.key,n.label??"",n.agentId??"",n.channel??"",n.modelProvider??n.providerOverride??"",n.model??n.modelOverride??"",n.updatedAt?new Date(n.updatedAt).toISOString():"",s?.durationMs??"",s?.messageCounts?.total??"",s?.messageCounts?.errors??"",s?.messageCounts?.toolCalls??"",s?.input??"",s?.output??"",s?.cacheRead??"",s?.cacheWrite??"",s?.totalTokens??"",s?.totalCost??""]))}return t.join(`
|
|
205
|
+
`)},ev=e=>{const t=[Gs(["date","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","inputCost","outputCost","cacheReadCost","cacheWriteCost","totalCost"])];for(const n of e)t.push(Gs([n.date,n.input,n.output,n.cacheRead,n.cacheWrite,n.totalTokens,n.inputCost??"",n.outputCost??"",n.cacheReadCost??"",n.cacheWriteCost??"",n.totalCost]));return t.join(`
|
|
206
206
|
`)},tv=(e,t,n)=>{const s=e.trim();if(!s)return[];const i=s.length?s.split(/\s+/):[],o=i.length?i[i.length-1]:"",[r,l]=o.includes(":")?[o.slice(0,o.indexOf(":")),o.slice(o.indexOf(":")+1)]:["",""],a=r.toLowerCase(),d=l.toLowerCase(),g=I=>{const A=new Set;for(const w of I)w&&A.add(w);return Array.from(A)},u=g(t.map(I=>I.agentId)).slice(0,6),f=g(t.map(I=>I.channel)).slice(0,6),v=g([...t.map(I=>I.modelProvider),...t.map(I=>I.providerOverride),...n?.byProvider.map(I=>I.provider)??[]]).slice(0,6),m=g([...t.map(I=>I.model),...n?.byModel.map(I=>I.model)??[]]).slice(0,6),S=g(n?.tools.tools.map(I=>I.name)??[]).slice(0,6);if(!a)return[{label:"agent:",value:"agent:"},{label:"channel:",value:"channel:"},{label:"provider:",value:"provider:"},{label:"model:",value:"model:"},{label:"tool:",value:"tool:"},{label:"has:errors",value:"has:errors"},{label:"has:tools",value:"has:tools"},{label:"minTokens:",value:"minTokens:"},{label:"maxCost:",value:"maxCost:"}];const C=[],R=(I,A)=>{for(const w of A)(!d||w.toLowerCase().includes(d))&&C.push({label:`${I}:${w}`,value:`${I}:${w}`})};switch(a){case"agent":R("agent",u);break;case"channel":R("channel",f);break;case"provider":R("provider",v);break;case"model":R("model",m);break;case"tool":R("tool",S);break;case"has":["errors","tools","context","usage","model","provider"].forEach(I=>{(!d||I.includes(d))&&C.push({label:`has:${I}`,value:`has:${I}`})});break}return C},nv=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/);return s[s.length-1]=t,`${s.join(" ")} `},Ht=e=>e.trim().toLowerCase(),sv=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/),i=s[s.length-1]??"",o=t.includes(":")?t.split(":")[0]:null,r=i.includes(":")?i.split(":")[0]:null;return i.endsWith(":")&&o&&r===o?(s[s.length-1]=t,`${s.join(" ")} `):s.includes(t)?`${s.join(" ")} `:`${s.join(" ")} ${t} `},Ma=(e,t)=>{const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>i!==t);return s.length?`${s.join(" ")} `:""},Ra=(e,t,n)=>{const s=Ht(t),o=[...rr(e).filter(r=>Ht(r.key??"")!==s).map(r=>r.raw),...n.map(r=>`${t}:${r}`)];return o.length?`${o.join(" ")} `:""};function mt(e,t){return t===0?0:e/t*100}function iv(e){const t=e.totalCost||0;return{input:{tokens:e.input,cost:e.inputCost||0,pct:mt(e.inputCost||0,t)},output:{tokens:e.output,cost:e.outputCost||0,pct:mt(e.outputCost||0,t)},cacheRead:{tokens:e.cacheRead,cost:e.cacheReadCost||0,pct:mt(e.cacheReadCost||0,t)},cacheWrite:{tokens:e.cacheWrite,cost:e.cacheWriteCost||0,pct:mt(e.cacheWriteCost||0,t)},totalCost:t}}function ov(e,t,n,s,i,o,r,l){if(!(e.length>0||t.length>0||n.length>0))return h;const d=n.length===1?s.find(m=>m.key===n[0]):null,g=d?(d.label||d.key).slice(0,20)+((d.label||d.key).length>20?"…":""):n.length===1?n[0].slice(0,8)+"…":`${n.length} sessions`,u=d?d.label||d.key:n.length===1?n[0]:n.join(", "),f=e.length===1?e[0]:`${e.length} days`,v=t.length===1?`${t[0]}:00`:`${t.length} hours`;return c`
|
|
207
207
|
<div class="active-filters">
|
|
208
208
|
${e.length>0?c`
|
|
@@ -265,7 +265,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
265
265
|
class="daily-bar"
|
|
266
266
|
style="height: ${m.toFixed(1)}%; display: flex; flex-direction: column;"
|
|
267
267
|
>
|
|
268
|
-
${(()=>{const _=A.reduce((M,
|
|
268
|
+
${(()=>{const _=A.reduce((M,K)=>M+K.value,0)||1;return A.map(M=>c`
|
|
269
269
|
<div
|
|
270
270
|
class="cost-segment ${M.class}"
|
|
271
271
|
style="height: ${M.value/_*100}%"
|
|
@@ -343,7 +343,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
343
343
|
</div>
|
|
344
344
|
`}
|
|
345
345
|
</div>
|
|
346
|
-
`}function lv(e,t,n,s,i,o,r){if(!e)return h;const l=t.messages.total?Math.round(e.totalTokens/t.messages.total):0,a=t.messages.total?e.totalCost/t.messages.total:0,d=e.input+e.cacheRead,g=d>0?e.cacheRead/d:0,u=d>0?`${(g*100).toFixed(1)}%`:"—",f=n.errorRate*100,v=n.throughputTokensPerMin!==void 0?`${H(Math.round(n.throughputTokensPerMin))} tok/min`:"—",m=n.throughputCostPerMin!==void 0?`${se(n.throughputCostPerMin,4)} / min`:"—",S=n.durationCount>0?Bo(n.avgDurationMs,{spaced:!0})??"—":"—",C="Cache hit rate = cache read / (input + cache read). Higher is better.",R="Error rate = errors / total messages. Lower is better.",I="Throughput shows tokens per minute over active time. Higher is better.",A="Average tokens per message in this range.",w=s?"Average cost per message when providers report costs. Cost data is missing for some or all sessions in this range.":"Average cost per message when providers report costs.",L=t.daily.filter(T=>T.messages>0&&T.errors>0).map(T=>{const N=T.errors/T.messages;return{label:kd(T.date),value:`${(N*100).toFixed(2)}%`,sub:`${T.errors} errors · ${T.messages} msgs · ${H(T.tokens)}`,rate:N}}).toSorted((T,N)=>N.rate-T.rate).slice(0,5).map(({rate:T,...N})=>N),_=t.byModel.slice(0,5).map(T=>({label:T.model??"unknown",value:se(T.totals.totalCost),sub:`${H(T.totals.totalTokens)} · ${T.count} msgs`})),M=t.byProvider.slice(0,5).map(T=>({label:T.provider??"unknown",value:se(T.totals.totalCost),sub:`${H(T.totals.totalTokens)} · ${T.count} msgs`})),
|
|
346
|
+
`}function lv(e,t,n,s,i,o,r){if(!e)return h;const l=t.messages.total?Math.round(e.totalTokens/t.messages.total):0,a=t.messages.total?e.totalCost/t.messages.total:0,d=e.input+e.cacheRead,g=d>0?e.cacheRead/d:0,u=d>0?`${(g*100).toFixed(1)}%`:"—",f=n.errorRate*100,v=n.throughputTokensPerMin!==void 0?`${H(Math.round(n.throughputTokensPerMin))} tok/min`:"—",m=n.throughputCostPerMin!==void 0?`${se(n.throughputCostPerMin,4)} / min`:"—",S=n.durationCount>0?Bo(n.avgDurationMs,{spaced:!0})??"—":"—",C="Cache hit rate = cache read / (input + cache read). Higher is better.",R="Error rate = errors / total messages. Lower is better.",I="Throughput shows tokens per minute over active time. Higher is better.",A="Average tokens per message in this range.",w=s?"Average cost per message when providers report costs. Cost data is missing for some or all sessions in this range.":"Average cost per message when providers report costs.",L=t.daily.filter(T=>T.messages>0&&T.errors>0).map(T=>{const N=T.errors/T.messages;return{label:kd(T.date),value:`${(N*100).toFixed(2)}%`,sub:`${T.errors} errors · ${T.messages} msgs · ${H(T.tokens)}`,rate:N}}).toSorted((T,N)=>N.rate-T.rate).slice(0,5).map(({rate:T,...N})=>N),_=t.byModel.slice(0,5).map(T=>({label:T.model??"unknown",value:se(T.totals.totalCost),sub:`${H(T.totals.totalTokens)} · ${T.count} msgs`})),M=t.byProvider.slice(0,5).map(T=>({label:T.provider??"unknown",value:se(T.totals.totalCost),sub:`${H(T.totals.totalTokens)} · ${T.count} msgs`})),K=t.tools.tools.slice(0,6).map(T=>({label:T.name,value:`${T.count}`,sub:"calls"})),G=t.byAgent.slice(0,5).map(T=>({label:T.agentId,value:se(T.totals.totalCost),sub:H(T.totals.totalTokens)})),b=t.byChannel.slice(0,5).map(T=>({label:T.channel,value:se(T.totals.totalCost),sub:H(T.totals.totalTokens)}));return c`
|
|
347
347
|
<section class="card" style="margin-top: 16px;">
|
|
348
348
|
<div class="card-title">Usage Overview</div>
|
|
349
349
|
<div class="usage-summary-grid">
|
|
@@ -429,14 +429,14 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
429
429
|
<div class="usage-insights-grid">
|
|
430
430
|
${zt("Top Models",_,"No model data")}
|
|
431
431
|
${zt("Top Providers",M,"No provider data")}
|
|
432
|
-
${zt("Top Tools",
|
|
432
|
+
${zt("Top Tools",K,"No tool calls")}
|
|
433
433
|
${zt("Top Agents",G,"No agent data")}
|
|
434
434
|
${zt("Top Channels",b,"No channel data")}
|
|
435
435
|
${La("Peak Error Days",L,"No error data")}
|
|
436
436
|
${La("Peak Error Hours",i,"No error data")}
|
|
437
437
|
</div>
|
|
438
438
|
</section>
|
|
439
|
-
`}function cv(e,t,n,s,i,o,r,l,a,d,g,u,f,v,m){const S=E=>f.includes(E),C=E=>{const O=E.label||E.key;return O.startsWith("agent:")&&O.includes("?token=")?O.slice(0,O.indexOf("?token=")):O},R=async E=>{const O=C(E);try{await navigator.clipboard.writeText(O)}catch{}},I=E=>{const O=[];return S("channel")&&E.channel&&O.push(`channel:${E.channel}`),S("agent")&&E.agentId&&O.push(`agent:${E.agentId}`),S("provider")&&(E.modelProvider||E.providerOverride)&&O.push(`provider:${E.modelProvider??E.providerOverride}`),S("model")&&E.model&&O.push(`model:${E.model}`),S("messages")&&E.usage?.messageCounts&&O.push(`msgs:${E.usage.messageCounts.total}`),S("tools")&&E.usage?.toolUsage&&O.push(`tools:${E.usage.toolUsage.totalCalls}`),S("errors")&&E.usage?.messageCounts&&O.push(`errors:${E.usage.messageCounts.errors}`),S("duration")&&E.usage?.durationMs&&O.push(`dur:${Bo(E.usage.durationMs,{spaced:!0})??"—"}`),O},A=E=>{const O=E.usage;if(!O)return 0;if(n.length>0&&O.dailyBreakdown&&O.dailyBreakdown.length>0){const q=O.dailyBreakdown.filter(oe=>n.includes(oe.date));return s?q.reduce((oe,re)=>oe+re.tokens,0):q.reduce((oe,re)=>oe+re.cost,0)}return s?O.totalTokens??0:O.totalCost??0},w=[...e].toSorted((E,O)=>{switch(i){case"recent":return(O.updatedAt??0)-(E.updatedAt??0);case"messages":return(O.usage?.messageCounts?.total??0)-(E.usage?.messageCounts?.total??0);case"errors":return(O.usage?.messageCounts?.errors??0)-(E.usage?.messageCounts?.errors??0);case"cost":return A(O)-A(E);default:return A(O)-A(E)}}),L=o==="asc"?w.toReversed():w,_=L.reduce((E,O)=>E+A(O),0),M=L.length?_/L.length:0,
|
|
439
|
+
`}function cv(e,t,n,s,i,o,r,l,a,d,g,u,f,v,m){const S=E=>f.includes(E),C=E=>{const O=E.label||E.key;return O.startsWith("agent:")&&O.includes("?token=")?O.slice(0,O.indexOf("?token=")):O},R=async E=>{const O=C(E);try{await navigator.clipboard.writeText(O)}catch{}},I=E=>{const O=[];return S("channel")&&E.channel&&O.push(`channel:${E.channel}`),S("agent")&&E.agentId&&O.push(`agent:${E.agentId}`),S("provider")&&(E.modelProvider||E.providerOverride)&&O.push(`provider:${E.modelProvider??E.providerOverride}`),S("model")&&E.model&&O.push(`model:${E.model}`),S("messages")&&E.usage?.messageCounts&&O.push(`msgs:${E.usage.messageCounts.total}`),S("tools")&&E.usage?.toolUsage&&O.push(`tools:${E.usage.toolUsage.totalCalls}`),S("errors")&&E.usage?.messageCounts&&O.push(`errors:${E.usage.messageCounts.errors}`),S("duration")&&E.usage?.durationMs&&O.push(`dur:${Bo(E.usage.durationMs,{spaced:!0})??"—"}`),O},A=E=>{const O=E.usage;if(!O)return 0;if(n.length>0&&O.dailyBreakdown&&O.dailyBreakdown.length>0){const q=O.dailyBreakdown.filter(oe=>n.includes(oe.date));return s?q.reduce((oe,re)=>oe+re.tokens,0):q.reduce((oe,re)=>oe+re.cost,0)}return s?O.totalTokens??0:O.totalCost??0},w=[...e].toSorted((E,O)=>{switch(i){case"recent":return(O.updatedAt??0)-(E.updatedAt??0);case"messages":return(O.usage?.messageCounts?.total??0)-(E.usage?.messageCounts?.total??0);case"errors":return(O.usage?.messageCounts?.errors??0)-(E.usage?.messageCounts?.errors??0);case"cost":return A(O)-A(E);default:return A(O)-A(E)}}),L=o==="asc"?w.toReversed():w,_=L.reduce((E,O)=>E+A(O),0),M=L.length?_/L.length:0,K=L.reduce((E,O)=>E+(O.usage?.messageCounts?.errors??0),0),G=(E,O)=>{const q=A(E),oe=C(E),re=I(E);return c`
|
|
440
440
|
<div
|
|
441
441
|
class="session-bar-row ${O?"selected":""}"
|
|
442
442
|
@click=${D=>a(E.key,D.shiftKey)}
|
|
@@ -458,7 +458,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
458
458
|
<div class="session-bar-value">${s?H(q):se(q)}</div>
|
|
459
459
|
</div>
|
|
460
460
|
</div>
|
|
461
|
-
`},b=new Set(t),T=L.filter(E=>b.has(E.key)),N=T.length,
|
|
461
|
+
`},b=new Set(t),T=L.filter(E=>b.has(E.key)),N=T.length,W=new Map(L.map(E=>[E.key,E])),V=r.map(E=>W.get(E)).filter(E=>!!E);return c`
|
|
462
462
|
<div class="card sessions-card">
|
|
463
463
|
<div class="sessions-card-header">
|
|
464
464
|
<div class="card-title">Sessions</div>
|
|
@@ -469,7 +469,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
469
469
|
<div class="sessions-card-meta">
|
|
470
470
|
<div class="sessions-card-stats">
|
|
471
471
|
<span>${s?H(M):se(M)} avg</span>
|
|
472
|
-
<span>${
|
|
472
|
+
<span>${K} errors</span>
|
|
473
473
|
</div>
|
|
474
474
|
<div class="chart-toggle small">
|
|
475
475
|
<button
|
|
@@ -533,7 +533,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
533
533
|
</div>
|
|
534
534
|
`:h}
|
|
535
535
|
</div>
|
|
536
|
-
`}const dv=.75,uv=8,gv=.06,$s=5,
|
|
536
|
+
`}const dv=.75,uv=8,gv=.06,$s=5,Pe=12,ft=.7;function vt(e,t){return!t||t<=0?0:e/t*100}function fv(){return h}function Ad(e){return e<1e12?e*1e3:e}function pv(e,t,n){const s=Math.min(t,n),i=Math.max(t,n);return e.filter(o=>{if(o.timestamp<=0)return!0;const r=Ad(o.timestamp);return r>=s&&r<=i})}function hv(e,t,n){const s=t||e.usage;if(!s)return c`
|
|
537
537
|
<div class="muted">No usage data for this session.</div>
|
|
538
538
|
`;const i=u=>u?new Date(u).toLocaleString():"—",o=[];e.channel&&o.push(`channel:${e.channel}`),e.agentId&&o.push(`agent:${e.agentId}`),(e.modelProvider||e.providerOverride)&&o.push(`provider:${e.modelProvider??e.providerOverride}`),e.model&&o.push(`model:${e.model}`);const r=s.toolUsage?.tools.slice(0,6)??[];let l,a,d;if(n){const u=new Map;for(const f of n){const{tools:v}=wd(f.content);for(const[m]of v)u.set(m,(u.get(m)||0)+1)}d=r.map(f=>({label:f.name,value:`${u.get(f.name)??0}`,sub:"calls"})),l=[...u.values()].reduce((f,v)=>f+v,0),a=u.size}else d=r.map(u=>({label:u.name,value:`${u.count}`,sub:"calls"})),l=s.toolUsage?.totalCalls??0,a=s.toolUsage?.uniqueTools??0;const g=s.modelUsage?.slice(0,6).map(u=>({label:u.model??"unknown",value:se(u.totals.totalCost),sub:H(u.totals.totalTokens)}))??[];return c`
|
|
539
539
|
${o.length>0?c`<div class="usage-badges">${o.map(u=>c`<span class="usage-badge">${u}</span>`)}</div>`:h}
|
|
@@ -563,7 +563,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
563
563
|
${zt("Top Tools",d,"No tool calls")}
|
|
564
564
|
${zt("Model Mix",g,"No model data")}
|
|
565
565
|
</div>
|
|
566
|
-
`}function mv(e,t,n,s){const i=Math.min(n,s),o=Math.max(n,s),r=t.filter(S=>S.timestamp>=i&&S.timestamp<=o);if(r.length===0)return;let l=0,a=0,d=0,g=0,u=0,f=0,v=0,m=0;for(const S of r)l+=S.totalTokens||0,a+=S.cost||0,u+=S.input||0,f+=S.output||0,v+=S.cacheRead||0,m+=S.cacheWrite||0,S.output>0&&g++,S.input>0&&d++;return{...e,totalTokens:l,totalCost:a,input:u,output:f,cacheRead:v,cacheWrite:m,durationMs:r[r.length-1].timestamp-r[0].timestamp,firstActivity:r[0].timestamp,lastActivity:r[r.length-1].timestamp,messageCounts:{total:r.length,user:d,assistant:g,toolCalls:0,toolResults:0,errors:0}}}function vv(e,t,n,s,i,o,r,l,a,d,g,u,f,v,m,S,C,R,I,A,w,L,_,M,
|
|
566
|
+
`}function mv(e,t,n,s){const i=Math.min(n,s),o=Math.max(n,s),r=t.filter(S=>S.timestamp>=i&&S.timestamp<=o);if(r.length===0)return;let l=0,a=0,d=0,g=0,u=0,f=0,v=0,m=0;for(const S of r)l+=S.totalTokens||0,a+=S.cost||0,u+=S.input||0,f+=S.output||0,v+=S.cacheRead||0,m+=S.cacheWrite||0,S.output>0&&g++,S.input>0&&d++;return{...e,totalTokens:l,totalCost:a,input:u,output:f,cacheRead:v,cacheWrite:m,durationMs:r[r.length-1].timestamp-r[0].timestamp,firstActivity:r[0].timestamp,lastActivity:r[r.length-1].timestamp,messageCounts:{total:r.length,user:d,assistant:g,toolCalls:0,toolResults:0,errors:0}}}function vv(e,t,n,s,i,o,r,l,a,d,g,u,f,v,m,S,C,R,I,A,w,L,_,M,K,G){const b=e.label||e.key,T=b.length>50?b.slice(0,50)+"…":b,N=e.usage,W=l!==null&&a!==null,V=l!==null&&a!==null&&t?.points&&N?mv(N,t.points,l,a):void 0,E=V?{totalTokens:V.totalTokens,totalCost:V.totalCost}:{totalTokens:N?.totalTokens??0,totalCost:N?.totalCost??0},O=V?" (filtered)":"";return c`
|
|
567
567
|
<div class="card session-detail-panel">
|
|
568
568
|
<div class="session-detail-header">
|
|
569
569
|
<div class="session-detail-header-left">
|
|
@@ -586,8 +586,8 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
586
586
|
${bv(t,n,s,i,o,r,g,u,f,l,a,d)}
|
|
587
587
|
</div>
|
|
588
588
|
<div class="session-detail-bottom">
|
|
589
|
-
${$v(v,m,S,C,R,I,A,w,L,_,
|
|
590
|
-
${yv(e.contextWeight,N,M,
|
|
589
|
+
${$v(v,m,S,C,R,I,A,w,L,_,W?l:null,W?a:null)}
|
|
590
|
+
${yv(e.contextWeight,N,M,K)}
|
|
591
591
|
</div>
|
|
592
592
|
</div>
|
|
593
593
|
</div>
|
|
@@ -599,11 +599,11 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
599
599
|
<div class="session-timeseries-compact">
|
|
600
600
|
<div class="muted" style="padding: 20px; text-align: center">No timeline data</div>
|
|
601
601
|
</div>
|
|
602
|
-
`;let f=e.points;if(r||l||a&&a.length>0){const
|
|
602
|
+
`;let f=e.points;if(r||l||a&&a.length>0){const z=r?new Date(r+"T00:00:00").getTime():0,le=l?new Date(l+"T23:59:59").getTime():1/0;f=e.points.filter(de=>{if(de.timestamp<z||de.timestamp>le)return!1;if(a&&a.length>0){const be=new Date(de.timestamp),Le=`${be.getFullYear()}-${String(be.getMonth()+1).padStart(2,"0")}-${String(be.getDate()).padStart(2,"0")}`;return a.includes(Le)}return!0})}if(f.length<2)return c`
|
|
603
603
|
<div class="session-timeseries-compact">
|
|
604
604
|
<div class="muted" style="padding: 20px; text-align: center">No data in range</div>
|
|
605
605
|
</div>
|
|
606
|
-
`;let v=0,m=0,S=0,C=0,R=0,I=0;f=f.map(
|
|
606
|
+
`;let v=0,m=0,S=0,C=0,R=0,I=0;f=f.map(z=>(v+=z.totalTokens,m+=z.cost,S+=z.output,C+=z.input,R+=z.cacheRead,I+=z.cacheWrite,{...z,cumulativeTokens:v,cumulativeCost:m}));const A=d!=null&&g!=null,w=A?Math.min(d,g):0,L=A?Math.max(d,g):1/0;let _=0,M=f.length;if(A){_=f.findIndex(le=>le.timestamp>=w),_===-1&&(_=f.length);const z=f.findIndex(le=>le.timestamp>L);M=z===-1?f.length:z}const K=A?f.slice(_,M):f;let G=0,b=0,T=0,N=0;for(const z of K)G+=z.output,b+=z.input,T+=z.cacheRead,N+=z.cacheWrite;const W=400,V=100,E={top:8,right:4,bottom:14,left:30},O=W-E.left-E.right,q=V-E.top-E.bottom,oe=n==="cumulative",re=n==="per-turn"&&i==="by-type",D=G+b+T+N,F=f.map(z=>oe?z.cumulativeTokens:re?z.input+z.output+z.cacheRead+z.cacheWrite:z.totalTokens),J=Math.max(...F,1),Y=O/f.length,ue=Math.min(uv,Math.max(1,Y*dv)),ee=Y-ue,ae=E.left+_*(ue+ee),X=M>=f.length?E.left+(f.length-1)*(ue+ee)+ue:E.left+(M-1)*(ue+ee)+ue;return c`
|
|
607
607
|
<div class="session-timeseries-compact">
|
|
608
608
|
<div class="timeseries-header-row">
|
|
609
609
|
<div class="card-title" style="font-size: 12px; color: var(--text);">Usage Over Time</div>
|
|
@@ -647,24 +647,24 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
647
647
|
</div>
|
|
648
648
|
<div class="timeseries-chart-wrapper" style="position: relative; cursor: crosshair;">
|
|
649
649
|
<svg
|
|
650
|
-
viewBox="0 0 ${
|
|
650
|
+
viewBox="0 0 ${W} ${V+18}"
|
|
651
651
|
class="timeseries-svg"
|
|
652
652
|
style="width: 100%; height: auto; display: block;"
|
|
653
653
|
>
|
|
654
654
|
<!-- Y axis -->
|
|
655
655
|
<line x1="${E.left}" y1="${E.top}" x2="${E.left}" y2="${E.top+q}" stroke="var(--border)" />
|
|
656
656
|
<!-- X axis -->
|
|
657
|
-
<line x1="${E.left}" y1="${E.top+q}" x2="${
|
|
657
|
+
<line x1="${E.left}" y1="${E.top+q}" x2="${W-E.right}" y2="${E.top+q}" stroke="var(--border)" />
|
|
658
658
|
<!-- Y axis labels -->
|
|
659
659
|
<text x="${E.left-4}" y="${E.top+5}" text-anchor="end" class="ts-axis-label">${H(J)}</text>
|
|
660
660
|
<text x="${E.left-4}" y="${E.top+q}" text-anchor="end" class="ts-axis-label">0</text>
|
|
661
661
|
<!-- X axis labels (first and last) -->
|
|
662
662
|
${f.length>0?Rt`
|
|
663
663
|
<text x="${E.left}" y="${E.top+q+10}" text-anchor="start" class="ts-axis-label">${new Date(f[0].timestamp).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}</text>
|
|
664
|
-
<text x="${
|
|
664
|
+
<text x="${W-E.right}" y="${E.top+q+10}" text-anchor="end" class="ts-axis-label">${new Date(f[f.length-1].timestamp).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}</text>
|
|
665
665
|
`:h}
|
|
666
666
|
<!-- Bars -->
|
|
667
|
-
${f.map((
|
|
667
|
+
${f.map((z,le)=>{const de=F[le],be=E.left+le*(ue+ee),Le=de/J*q,Xe=E.top+q-Le,ye=[new Date(z.timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),`${H(de)} tokens`];re&&(ye.push(`Out ${H(z.output)}`),ye.push(`In ${H(z.input)}`),ye.push(`CW ${H(z.cacheWrite)}`),ye.push(`CR ${H(z.cacheRead)}`));const je=ye.join(" · "),Ze=A&&(le<_||le>=M);if(!re)return Rt`<rect x="${be}" y="${Xe}" width="${ue}" height="${Le}" class="ts-bar${Ze?" dimmed":""}" rx="1"><title>${je}</title></rect>`;const et=[{value:z.output,cls:"output"},{value:z.input,cls:"input"},{value:z.cacheWrite,cls:"cache-write"},{value:z.cacheRead,cls:"cache-read"}];let tt=E.top+q;const ct=Ze?" dimmed":"";return Rt`
|
|
668
668
|
${et.map(dt=>{if(dt.value<=0||de<=0)return h;const _t=Le*(dt.value/de);return tt-=_t,Rt`<rect x="${be}" y="${tt}" width="${ue}" height="${_t}" class="ts-bar ${dt.cls}${ct}" rx="1"><title>${je}</title></rect>`})}
|
|
669
669
|
`})}
|
|
670
670
|
<!-- Selection highlight overlay (always visible between handles) -->
|
|
@@ -682,22 +682,22 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
682
682
|
<!-- Left cursor line + handle -->
|
|
683
683
|
${Rt`
|
|
684
684
|
<line x1="${ae}" y1="${E.top}" x2="${ae}" y2="${E.top+q}" stroke="var(--accent)" stroke-width="0.8" opacity="0.7" />
|
|
685
|
-
<rect x="${ae-$s/2}" y="${E.top+q/2-
|
|
686
|
-
<line x1="${ae-ft}" y1="${E.top+q/2-
|
|
687
|
-
<line x1="${ae+ft}" y1="${E.top+q/2-
|
|
685
|
+
<rect x="${ae-$s/2}" y="${E.top+q/2-Pe/2}" width="${$s}" height="${Pe}" rx="1.5" fill="var(--accent)" class="cursor-handle" />
|
|
686
|
+
<line x1="${ae-ft}" y1="${E.top+q/2-Pe/5}" x2="${ae-ft}" y2="${E.top+q/2+Pe/5}" stroke="var(--bg)" stroke-width="0.4" pointer-events="none" />
|
|
687
|
+
<line x1="${ae+ft}" y1="${E.top+q/2-Pe/5}" x2="${ae+ft}" y2="${E.top+q/2+Pe/5}" stroke="var(--bg)" stroke-width="0.4" pointer-events="none" />
|
|
688
688
|
`}
|
|
689
689
|
<!-- Right cursor line + handle -->
|
|
690
690
|
${Rt`
|
|
691
691
|
<line x1="${X}" y1="${E.top}" x2="${X}" y2="${E.top+q}" stroke="var(--accent)" stroke-width="0.8" opacity="0.7" />
|
|
692
|
-
<rect x="${X-$s/2}" y="${E.top+q/2-
|
|
693
|
-
<line x1="${X-ft}" y1="${E.top+q/2-
|
|
694
|
-
<line x1="${X+ft}" y1="${E.top+q/2-
|
|
692
|
+
<rect x="${X-$s/2}" y="${E.top+q/2-Pe/2}" width="${$s}" height="${Pe}" rx="1.5" fill="var(--accent)" class="cursor-handle" />
|
|
693
|
+
<line x1="${X-ft}" y1="${E.top+q/2-Pe/5}" x2="${X-ft}" y2="${E.top+q/2+Pe/5}" stroke="var(--bg)" stroke-width="0.4" pointer-events="none" />
|
|
694
|
+
<line x1="${X+ft}" y1="${E.top+q/2-Pe/5}" x2="${X+ft}" y2="${E.top+q/2+Pe/5}" stroke="var(--bg)" stroke-width="0.4" pointer-events="none" />
|
|
695
695
|
`}
|
|
696
696
|
</svg>
|
|
697
697
|
<!-- Handle drag zones (only on handles, not full chart) -->
|
|
698
|
-
${(()=>{const
|
|
698
|
+
${(()=>{const z=`${(ae/W*100).toFixed(1)}%`,le=`${(X/W*100).toFixed(1)}%`,de=be=>Le=>{if(!u)return;Le.preventDefault(),Le.stopPropagation();const lt=Le.currentTarget.closest(".timeseries-chart-wrapper")?.querySelector("svg");if(!lt)return;const ye=lt.getBoundingClientRect(),je=ye.width,Ze=E.left/W*je,tt=(W-E.right)/W*je-Ze,ct=Ke=>{const _e=Math.max(0,Math.min(1,(Ke-ye.left-Ze)/tt));return Math.min(Math.floor(_e*f.length),f.length-1)},dt=be==="left"?ae:X,_t=ye.left+dt/W*je,bi=Le.clientX-_t;document.body.style.cursor="col-resize";const tn=Ke=>{const _e=Ke.clientX-bi,Tn=ct(_e),nn=f[Tn];if(nn)if(be==="left"){const gt=g??f[f.length-1].timestamp;u(Math.min(nn.timestamp,gt),gt)}else{const gt=d??f[0].timestamp;u(gt,Math.max(nn.timestamp,gt))}},ut=()=>{document.body.style.cursor="",document.removeEventListener("mousemove",tn),document.removeEventListener("mouseup",ut)};document.addEventListener("mousemove",tn),document.addEventListener("mouseup",ut)};return c`
|
|
699
699
|
<div class="chart-handle-zone chart-handle-left"
|
|
700
|
-
style="left: ${
|
|
700
|
+
style="left: ${z};"
|
|
701
701
|
@mousedown=${de("left")}></div>
|
|
702
702
|
<div class="chart-handle-zone chart-handle-right"
|
|
703
703
|
style="left: ${le};"
|
|
@@ -709,7 +709,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
709
709
|
<span style="color: var(--accent);">▶ Turns ${_+1}–${M} of ${f.length}</span> ·
|
|
710
710
|
${new Date(w).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}–${new Date(L).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})} ·
|
|
711
711
|
${H(G+b+T+N)} ·
|
|
712
|
-
${se(
|
|
712
|
+
${se(K.reduce((z,le)=>z+(le.cost||0),0))}
|
|
713
713
|
`:c`${f.length} msgs · ${H(v)} · ${se(m)}`}
|
|
714
714
|
</div>
|
|
715
715
|
${re?c`
|
|
@@ -822,7 +822,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
822
822
|
<div class="session-logs-header">Conversation</div>
|
|
823
823
|
<div class="muted" style="padding: 20px; text-align: center">No messages</div>
|
|
824
824
|
</div>
|
|
825
|
-
`;const f=i.query.trim().toLowerCase(),v=e.map(L=>{const _=wd(L.content),M=_.cleanContent||L.content;return{log:L,toolInfo:_,cleanContent:M}}),m=Array.from(new Set(v.flatMap(L=>L.toolInfo.tools.map(([_])=>_)))).toSorted((L,_)=>L.localeCompare(_)),S=v.filter(L=>{if(g!=null&&u!=null){const _=L.log.timestamp;if(_>0){const M=Math.min(g,u),
|
|
825
|
+
`;const f=i.query.trim().toLowerCase(),v=e.map(L=>{const _=wd(L.content),M=_.cleanContent||L.content;return{log:L,toolInfo:_,cleanContent:M}}),m=Array.from(new Set(v.flatMap(L=>L.toolInfo.tools.map(([_])=>_)))).toSorted((L,_)=>L.localeCompare(_)),S=v.filter(L=>{if(g!=null&&u!=null){const _=L.log.timestamp;if(_>0){const M=Math.min(g,u),K=Math.max(g,u),G=Ad(_);if(G<M||G>K)return!1}}return!(i.roles.length>0&&!i.roles.includes(L.log.role)||i.hasTools&&L.toolInfo.tools.length===0||i.tools.length>0&&!L.toolInfo.tools.some(([M])=>i.tools.includes(M))||f&&!L.cleanContent.toLowerCase().includes(f))}),C=i.roles.length>0||i.tools.length>0||i.hasTools||f,R=g!=null&&u!=null,I=C||R?`${S.length} of ${e.length} ${R?"(timeline filtered)":""}`:`${e.length}`,A=new Set(i.roles),w=new Set(i.tools);return c`
|
|
826
826
|
<div class="session-logs-compact">
|
|
827
827
|
<div class="session-logs-header">
|
|
828
828
|
<span>Conversation <span style="font-weight: normal; color: var(--muted);">(${I} messages)</span></span>
|
|
@@ -867,14 +867,14 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
867
867
|
</button>
|
|
868
868
|
</div>
|
|
869
869
|
<div class="session-logs-list">
|
|
870
|
-
${S.map(L=>{const{log:_,toolInfo:M,cleanContent:
|
|
870
|
+
${S.map(L=>{const{log:_,toolInfo:M,cleanContent:K}=L,G=_.role==="user"?"user":"assistant",b=_.role==="user"?"You":_.role==="assistant"?"Assistant":"Tool";return c`
|
|
871
871
|
<div class="session-log-entry ${G}">
|
|
872
872
|
<div class="session-log-meta">
|
|
873
873
|
<span class="session-log-role">${b}</span>
|
|
874
874
|
<span>${new Date(_.timestamp).toLocaleString()}</span>
|
|
875
875
|
${_.tokens?c`<span>${H(_.tokens)}</span>`:h}
|
|
876
876
|
</div>
|
|
877
|
-
<div class="session-log-content">${
|
|
877
|
+
<div class="session-log-content">${K}</div>
|
|
878
878
|
${M.tools.length>0?c`
|
|
879
879
|
<details class="session-log-tools" ?open=${n}>
|
|
880
880
|
<summary>${M.summary}</summary>
|
|
@@ -2890,10 +2890,10 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2890
2890
|
</div>
|
|
2891
2891
|
</div>
|
|
2892
2892
|
</section>
|
|
2893
|
-
`;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((D,F)=>{const J=t?D.usage?.totalTokens??0:D.usage?.totalCost??0;return(t?F.usage?.totalTokens??0:F.usage?.totalCost??0)-J}),o=e.selectedDays.length>0?i.filter(D=>{if(D.usage?.activityDates?.length)return D.usage.activityDates.some(Y=>e.selectedDays.includes(Y));if(!D.updatedAt)return!1;const F=new Date(D.updatedAt),J=`${F.getFullYear()}-${String(F.getMonth()+1).padStart(2,"0")}-${String(F.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(J)}):i,r=(D,F)=>{if(F.length===0)return!0;const J=D.usage,Y=J?.firstActivity??D.updatedAt,ue=J?.lastActivity??D.updatedAt;if(!Y||!ue)return!1;const ee=Math.min(Y,ue),ae=Math.max(Y,ue);let X=ee;for(;X<=ae;){const
|
|
2893
|
+
`;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((D,F)=>{const J=t?D.usage?.totalTokens??0:D.usage?.totalCost??0;return(t?F.usage?.totalTokens??0:F.usage?.totalCost??0)-J}),o=e.selectedDays.length>0?i.filter(D=>{if(D.usage?.activityDates?.length)return D.usage.activityDates.some(Y=>e.selectedDays.includes(Y));if(!D.updatedAt)return!1;const F=new Date(D.updatedAt),J=`${F.getFullYear()}-${String(F.getMonth()+1).padStart(2,"0")}-${String(F.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(J)}):i,r=(D,F)=>{if(F.length===0)return!0;const J=D.usage,Y=J?.firstActivity??D.updatedAt,ue=J?.lastActivity??D.updatedAt;if(!Y||!ue)return!1;const ee=Math.min(Y,ue),ae=Math.max(Y,ue);let X=ee;for(;X<=ae;){const z=new Date(X),le=ar(z,e.timeZone);if(F.includes(le))return!0;const de=lr(z,e.timeZone);X=Math.min(de.getTime(),ae)+1}return!1},l=e.selectedHours.length>0?o.filter(D=>r(D,e.selectedHours)):o,a=Om(l,e.query),d=a.sessions,g=a.warnings,u=tv(e.queryDraft,i,e.aggregates),f=rr(e.query),v=D=>{const F=Ht(D);return f.filter(J=>Ht(J.key??"")===F).map(J=>J.value).filter(Boolean)},m=D=>{const F=new Set;for(const J of D)J&&F.add(J);return Array.from(F)},S=m(i.map(D=>D.agentId)).slice(0,12),C=m(i.map(D=>D.channel)).slice(0,12),R=m([...i.map(D=>D.modelProvider),...i.map(D=>D.providerOverride),...e.aggregates?.byProvider.map(D=>D.provider)??[]]).slice(0,12),I=m([...i.map(D=>D.model),...e.aggregates?.byModel.map(D=>D.model)??[]]).slice(0,12),A=m(e.aggregates?.tools.tools.map(D=>D.name)??[]).slice(0,12),w=e.selectedSessions.length===1?e.sessions.find(D=>D.key===e.selectedSessions[0])??d.find(D=>D.key===e.selectedSessions[0]):null,L=D=>D.reduce((F,J)=>J.usage?Pa(F,J.usage):F,Da()),_=D=>e.costDaily.filter(J=>D.includes(J.date)).reduce((J,Y)=>Pa(J,Y),Da());let M,K;const G=i.length;if(e.selectedSessions.length>0){const D=d.filter(F=>e.selectedSessions.includes(F.key));M=L(D),K=D.length}else e.selectedDays.length>0&&e.selectedHours.length===0?(M=_(e.selectedDays),K=d.length):e.selectedHours.length>0||n?(M=L(d),K=d.length):(M=e.totals,K=G);const b=e.selectedSessions.length>0?d.filter(D=>e.selectedSessions.includes(D.key)):n||e.selectedHours.length>0?d:e.selectedDays.length>0?o:i,T=Qm(b,e.aggregates),N=e.selectedSessions.length>0?(()=>{const D=d.filter(J=>e.selectedSessions.includes(J.key)),F=new Set;for(const J of D)for(const Y of J.usage?.activityDates??[])F.add(Y);return F.size>0?e.costDaily.filter(J=>F.has(J.date)):e.costDaily})():e.costDaily,W=Ym(b,M,T),V=!e.loading&&!e.totals&&e.sessions.length===0,E=(M?.missingCostEntries??0)>0||(M?M.totalTokens>0&&M.totalCost===0&&M.input+M.output+M.cacheRead+M.cacheWrite>0:!1),O=[{label:"Today",days:1},{label:"7d",days:7},{label:"30d",days:30}],q=D=>{const F=new Date,J=new Date;J.setDate(J.getDate()-(D-1)),e.onStartDateChange(Di(J)),e.onEndDateChange(Di(F))},oe=(D,F,J)=>{if(J.length===0)return h;const Y=v(D),ue=new Set(Y.map(X=>Ht(X))),ee=J.length>0&&J.every(X=>ue.has(Ht(X))),ae=Y.length;return c`
|
|
2894
2894
|
<details
|
|
2895
2895
|
class="usage-filter-select"
|
|
2896
|
-
@toggle=${X=>{const
|
|
2896
|
+
@toggle=${X=>{const z=X.currentTarget;if(!z.open)return;const le=de=>{de.composedPath().includes(z)||(z.open=!1,window.removeEventListener("click",le,!0))};window.addEventListener("click",le,!0)}}
|
|
2897
2897
|
>
|
|
2898
2898
|
<summary>
|
|
2899
2899
|
<span>${F}</span>
|
|
@@ -2919,11 +2919,11 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2919
2919
|
</button>
|
|
2920
2920
|
</div>
|
|
2921
2921
|
<div class="usage-filter-options">
|
|
2922
|
-
${J.map(X=>{const
|
|
2922
|
+
${J.map(X=>{const z=ue.has(Ht(X));return c`
|
|
2923
2923
|
<label class="usage-filter-option">
|
|
2924
2924
|
<input
|
|
2925
2925
|
type="checkbox"
|
|
2926
|
-
.checked=${
|
|
2926
|
+
.checked=${z}
|
|
2927
2927
|
@change=${le=>{const de=le.target,be=`${D}:${X}`;e.onQueryDraftChange(de.checked?sv(e.queryDraft,be):Ma(e.queryDraft,be))}}
|
|
2928
2928
|
/>
|
|
2929
2929
|
<span>${X}</span>
|
|
@@ -2932,7 +2932,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2932
2932
|
</div>
|
|
2933
2933
|
</div>
|
|
2934
2934
|
</details>
|
|
2935
|
-
`},re=
|
|
2935
|
+
`},re=Di(new Date);return c`
|
|
2936
2936
|
<style>${kv}</style>
|
|
2937
2937
|
|
|
2938
2938
|
<section class="usage-page-header">
|
|
@@ -2960,8 +2960,8 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2960
2960
|
<strong>${se(M.totalCost)}</strong> cost
|
|
2961
2961
|
</span>
|
|
2962
2962
|
<span class="usage-metric-badge">
|
|
2963
|
-
<strong>${
|
|
2964
|
-
session${
|
|
2963
|
+
<strong>${K}</strong>
|
|
2964
|
+
session${K!==1?"s":""}
|
|
2965
2965
|
</span>
|
|
2966
2966
|
`:h}
|
|
2967
2967
|
<button
|
|
@@ -2980,21 +2980,21 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
2980
2980
|
<div class="usage-export-list">
|
|
2981
2981
|
<button
|
|
2982
2982
|
class="usage-export-item"
|
|
2983
|
-
@click=${()=>
|
|
2983
|
+
@click=${()=>Pi(`openclaw-usage-sessions-${re}.csv`,Zm(d),"text/csv")}
|
|
2984
2984
|
?disabled=${d.length===0}
|
|
2985
2985
|
>
|
|
2986
2986
|
Sessions CSV
|
|
2987
2987
|
</button>
|
|
2988
2988
|
<button
|
|
2989
2989
|
class="usage-export-item"
|
|
2990
|
-
@click=${()=>
|
|
2990
|
+
@click=${()=>Pi(`openclaw-usage-daily-${re}.csv`,ev(N),"text/csv")}
|
|
2991
2991
|
?disabled=${N.length===0}
|
|
2992
2992
|
>
|
|
2993
2993
|
Daily CSV
|
|
2994
2994
|
</button>
|
|
2995
2995
|
<button
|
|
2996
2996
|
class="usage-export-item"
|
|
2997
|
-
@click=${()=>
|
|
2997
|
+
@click=${()=>Pi(`openclaw-usage-${re}.json`,JSON.stringify({totals:M,sessions:d,daily:N,aggregates:T},null,2),"application/json")}
|
|
2998
2998
|
?disabled=${d.length===0&&N.length===0}
|
|
2999
2999
|
>
|
|
3000
3000
|
JSON
|
|
@@ -3137,7 +3137,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3137
3137
|
`:h}
|
|
3138
3138
|
</section>
|
|
3139
3139
|
|
|
3140
|
-
${lv(M,T,
|
|
3140
|
+
${lv(M,T,W,E,Km(b,e.timeZone),K,G)}
|
|
3141
3141
|
|
|
3142
3142
|
${Vm(b,e.timeZone,e.selectedHours,e.onSelectHour)}
|
|
3143
3143
|
|
|
@@ -3156,7 +3156,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3156
3156
|
|
|
3157
3157
|
<!-- Session Detail Panel (when selected) or Empty State -->
|
|
3158
3158
|
${w?vv(w,e.timeSeries,e.timeSeriesLoading,e.timeSeriesMode,e.onTimeSeriesModeChange,e.timeSeriesBreakdownMode,e.onTimeSeriesBreakdownChange,e.timeSeriesCursorStart,e.timeSeriesCursorEnd,e.onTimeSeriesCursorRangeChange,e.startDate,e.endDate,e.selectedDays,e.sessionLogs,e.sessionLogsLoading,e.sessionLogsExpanded,e.onToggleSessionLogsExpanded,{roles:e.logFilterRoles,tools:e.logFilterTools,hasTools:e.logFilterHasTools,query:e.logFilterQuery},e.onLogFilterRolesChange,e.onLogFilterToolsChange,e.onLogFilterHasToolsChange,e.onLogFilterQueryChange,e.onLogFilterClear,e.contextExpanded,e.onToggleContextExpanded,e.onClearSessions):fv()}
|
|
3159
|
-
`}let
|
|
3159
|
+
`}let Fi=null;const Fa=e=>{Fi&&clearTimeout(Fi),Fi=window.setTimeout(()=>{mo(e)},400)};function Cv(e){return e.tab!=="usage"?h:Av({loading:e.usageLoading,error:e.usageError,startDate:e.usageStartDate,endDate:e.usageEndDate,sessions:e.usageResult?.sessions??[],sessionsLimitReached:(e.usageResult?.sessions?.length??0)>=1e3,totals:e.usageResult?.totals??null,aggregates:e.usageResult?.aggregates??null,costDaily:e.usageCostSummary?.daily??[],selectedSessions:e.usageSelectedSessions,selectedDays:e.usageSelectedDays,selectedHours:e.usageSelectedHours,chartMode:e.usageChartMode,dailyChartMode:e.usageDailyChartMode,timeSeriesMode:e.usageTimeSeriesMode,timeSeriesBreakdownMode:e.usageTimeSeriesBreakdownMode,timeSeries:e.usageTimeSeries,timeSeriesLoading:e.usageTimeSeriesLoading,timeSeriesCursorStart:e.usageTimeSeriesCursorStart,timeSeriesCursorEnd:e.usageTimeSeriesCursorEnd,sessionLogs:e.usageSessionLogs,sessionLogsLoading:e.usageSessionLogsLoading,sessionLogsExpanded:e.usageSessionLogsExpanded,logFilterRoles:e.usageLogFilterRoles,logFilterTools:e.usageLogFilterTools,logFilterHasTools:e.usageLogFilterHasTools,logFilterQuery:e.usageLogFilterQuery,query:e.usageQuery,queryDraft:e.usageQueryDraft,sessionSort:e.usageSessionSort,sessionSortDir:e.usageSessionSortDir,recentSessions:e.usageRecentSessions,sessionsTab:e.usageSessionsTab,visibleColumns:e.usageVisibleColumns,timeZone:e.usageTimeZone,contextExpanded:e.usageContextExpanded,headerPinned:e.usageHeaderPinned,onStartDateChange:t=>{e.usageStartDate=t,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],Fa(e)},onEndDateChange:t=>{e.usageEndDate=t,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],Fa(e)},onRefresh:()=>mo(e),onTimeZoneChange:t=>{e.usageTimeZone=t,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],mo(e)},onToggleContextExpanded:()=>{e.usageContextExpanded=!e.usageContextExpanded},onToggleSessionLogsExpanded:()=>{e.usageSessionLogsExpanded=!e.usageSessionLogsExpanded},onLogFilterRolesChange:t=>{e.usageLogFilterRoles=t},onLogFilterToolsChange:t=>{e.usageLogFilterTools=t},onLogFilterHasToolsChange:t=>{e.usageLogFilterHasTools=t},onLogFilterQueryChange:t=>{e.usageLogFilterQuery=t},onLogFilterClear:()=>{e.usageLogFilterRoles=[],e.usageLogFilterTools=[],e.usageLogFilterHasTools=!1,e.usageLogFilterQuery=""},onToggleHeaderPinned:()=>{e.usageHeaderPinned=!e.usageHeaderPinned},onSelectHour:(t,n)=>{if(n&&e.usageSelectedHours.length>0){const s=Array.from({length:24},(l,a)=>a),i=e.usageSelectedHours[e.usageSelectedHours.length-1],o=s.indexOf(i),r=s.indexOf(t);if(o!==-1&&r!==-1){const[l,a]=o<r?[o,r]:[r,o],d=s.slice(l,a+1);e.usageSelectedHours=[...new Set([...e.usageSelectedHours,...d])]}}else e.usageSelectedHours.includes(t)?e.usageSelectedHours=e.usageSelectedHours.filter(s=>s!==t):e.usageSelectedHours=[...e.usageSelectedHours,t]},onQueryDraftChange:t=>{e.usageQueryDraft=t,e.usageQueryDebounceTimer&&window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=window.setTimeout(()=>{e.usageQuery=e.usageQueryDraft,e.usageQueryDebounceTimer=null},250)},onApplyQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQuery=e.usageQueryDraft},onClearQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQueryDraft="",e.usageQuery=""},onSessionSortChange:t=>{e.usageSessionSort=t},onSessionSortDirChange:t=>{e.usageSessionSortDir=t},onSessionsTabChange:t=>{e.usageSessionsTab=t},onToggleColumn:t=>{e.usageVisibleColumns.includes(t)?e.usageVisibleColumns=e.usageVisibleColumns.filter(n=>n!==t):e.usageVisibleColumns=[...e.usageVisibleColumns,t]},onSelectSession:(t,n)=>{if(e.usageTimeSeries=null,e.usageSessionLogs=null,e.usageRecentSessions=[t,...e.usageRecentSessions.filter(s=>s!==t)].slice(0,8),n&&e.usageSelectedSessions.length>0){const s=e.usageChartMode==="tokens",o=[...e.usageResult?.sessions??[]].toSorted((d,g)=>{const u=s?d.usage?.totalTokens??0:d.usage?.totalCost??0;return(s?g.usage?.totalTokens??0:g.usage?.totalCost??0)-u}).map(d=>d.key),r=e.usageSelectedSessions[e.usageSelectedSessions.length-1],l=o.indexOf(r),a=o.indexOf(t);if(l!==-1&&a!==-1){const[d,g]=l<a?[l,a]:[a,l],u=o.slice(d,g+1),f=[...new Set([...e.usageSelectedSessions,...u])];e.usageSelectedSessions=f}}else e.usageSelectedSessions.length===1&&e.usageSelectedSessions[0]===t?e.usageSelectedSessions=[]:e.usageSelectedSessions=[t];e.usageTimeSeriesCursorStart=null,e.usageTimeSeriesCursorEnd=null,e.usageSelectedSessions.length===1&&(Mm(e,e.usageSelectedSessions[0]),Rm(e,e.usageSelectedSessions[0]))},onSelectDay:(t,n)=>{if(n&&e.usageSelectedDays.length>0){const s=(e.usageCostSummary?.daily??[]).map(l=>l.date),i=e.usageSelectedDays[e.usageSelectedDays.length-1],o=s.indexOf(i),r=s.indexOf(t);if(o!==-1&&r!==-1){const[l,a]=o<r?[o,r]:[r,o],d=s.slice(l,a+1),g=[...new Set([...e.usageSelectedDays,...d])];e.usageSelectedDays=g}}else e.usageSelectedDays.includes(t)?e.usageSelectedDays=e.usageSelectedDays.filter(s=>s!==t):e.usageSelectedDays=[t]},onChartModeChange:t=>{e.usageChartMode=t},onDailyChartModeChange:t=>{e.usageDailyChartMode=t},onTimeSeriesModeChange:t=>{e.usageTimeSeriesMode=t},onTimeSeriesBreakdownChange:t=>{e.usageTimeSeriesBreakdownMode=t},onTimeSeriesCursorRangeChange:(t,n)=>{e.usageTimeSeriesCursorStart=t,e.usageTimeSeriesCursorEnd=n},onClearDays:()=>{e.usageSelectedDays=[]},onClearHours:()=>{e.usageSelectedHours=[]},onClearSessions:()=>{e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null},onClearFilters:()=>{e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null}})}const cr={CHILD:2},dr=e=>(...t)=>({_$litDirective$:e,values:t});let ur=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:Tv}=Vu,Na=e=>e,Ev=e=>e.strings===void 0,Oa=()=>document.createComment(""),In=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=s.insertBefore(Oa(),i),r=s.insertBefore(Oa(),i);n=new Tv(o,r,e,e.options)}else{const o=n._$AB.nextSibling,r=n._$AM,l=r!==e;if(l){let a;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(a=e._$AU)!==r._$AU&&n._$AP(a)}if(o!==i||l){let a=n._$AA;for(;a!==o;){const d=Na(a).nextSibling;Na(s).insertBefore(a,i),a=d}}}return n},Dt=(e,t,n=e)=>(e._$AI(t,n),e),_v={},Iv=(e,t=_v)=>e._$AH=t,Mv=e=>e._$AH,Ni=e=>{e._$AR(),e._$AA.remove()};const Ua=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Cd=dr(class extends ur{constructor(e){if(super(e),e.type!==cr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],o=[];let r=0;for(const l of e)i[r]=s?s(l,r):r,o[r]=n(l,r),r++;return{values:o,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Mv(e),{values:o,keys:r}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=r,o;const l=this.ut??=[],a=[];let d,g,u=0,f=i.length-1,v=0,m=o.length-1;for(;u<=f&&v<=m;)if(i[u]===null)u++;else if(i[f]===null)f--;else if(l[u]===r[v])a[v]=Dt(i[u],o[v]),u++,v++;else if(l[f]===r[m])a[m]=Dt(i[f],o[m]),f--,m--;else if(l[u]===r[m])a[m]=Dt(i[u],o[m]),In(e,a[m+1],i[u]),u++,m--;else if(l[f]===r[v])a[v]=Dt(i[f],o[v]),In(e,i[u],i[f]),f--,v++;else if(d===void 0&&(d=Ua(r,v,m),g=Ua(l,u,f)),d.has(l[u]))if(d.has(l[f])){const S=g.get(r[v]),C=S!==void 0?i[S]:null;if(C===null){const R=In(e,i[u]);Dt(R,o[v]),a[v]=R}else a[v]=Dt(C,o[v]),In(e,i[u],C),i[S]=null;v++}else Ni(i[f]),f--;else Ni(i[u]),u++;for(;v<=m;){const S=In(e,a[m+1]);Dt(S,o[v]),a[v++]=S}for(;u<=f;){const S=i[u++];S!==null&&Ni(S)}return this.ut=r,Iv(e,a),wt}}),he={messageSquare:c`
|
|
3160
3160
|
<svg viewBox="0 0 24 24">
|
|
3161
3161
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
3162
3162
|
</svg>
|
|
@@ -3344,15 +3344,15 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3344
3344
|
d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"
|
|
3345
3345
|
/>
|
|
3346
3346
|
</svg>
|
|
3347
|
-
`};function Rv(e){const t=e.hello?.snapshot,n=t?.sessionDefaults?.mainSessionKey?.trim();if(n)return n;const s=t?.sessionDefaults?.mainKey?.trim();return s||"main"}function Lv(e,t){e.sessionKey=t,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:t,lastActiveSessionKey:t})}function Dv(e,t){const n=
|
|
3347
|
+
`};function Rv(e){const t=e.hello?.snapshot,n=t?.sessionDefaults?.mainSessionKey?.trim();if(n)return n;const s=t?.sessionDefaults?.mainKey?.trim();return s||"main"}function Lv(e,t){e.sessionKey=t,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:t,lastActiveSessionKey:t})}function Dv(e,t){const n=ci(t,e.basePath);return c`
|
|
3348
3348
|
<a
|
|
3349
3349
|
href=${n}
|
|
3350
3350
|
class="nav-item ${e.tab===t?"active":""}"
|
|
3351
3351
|
@click=${s=>{if(!(s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey)){if(s.preventDefault(),t==="chat"){const i=Rv(e);e.sessionKey!==i&&(Lv(e,i),e.loadAssistantIdentity())}e.setTab(t)}}}
|
|
3352
|
-
title=${
|
|
3352
|
+
title=${uo(t)}
|
|
3353
3353
|
>
|
|
3354
3354
|
<span class="nav-item__icon" aria-hidden="true">${he[qp(t)]}</span>
|
|
3355
|
-
<span class="nav-item__text">${
|
|
3355
|
+
<span class="nav-item__text">${uo(t)}</span>
|
|
3356
3356
|
</a>
|
|
3357
3357
|
`}function Pv(e){return c`
|
|
3358
3358
|
<span style="position: relative; display: inline-flex; align-items: center;">
|
|
@@ -3466,7 +3466,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3466
3466
|
${Pv(s)}
|
|
3467
3467
|
</button>
|
|
3468
3468
|
</div>
|
|
3469
|
-
`}function Nv(e,t){const n=e?.snapshot,s=n?.sessionDefaults?.mainSessionKey?.trim();if(s)return s;const i=n?.sessionDefaults?.mainKey?.trim();return i||(t?.sessions?.some(o=>o.key==="main")?"main":null)}const Rs={bluebubbles:"iMessage",telegram:"Telegram",discord:"Discord",signal:"Signal",slack:"Slack",whatsapp:"WhatsApp",matrix:"Matrix",email:"Email",sms:"SMS"},Ov=Object.keys(Rs);function Ba(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Uv(e){const t=e.toLowerCase();if(e==="main"||e==="agent:main:main")return{prefix:"",fallbackName:"Main Session"};if(e.includes(":subagent:"))return{prefix:"Subagent:",fallbackName:"Subagent:"};if(t.startsWith("cron:")||e.includes(":cron:"))return{prefix:"Cron:",fallbackName:"Cron Job:"};const n=e.match(/^agent:[^:]+:([^:]+):direct:(.+)$/);if(n){const i=n[1],o=n[2];return{prefix:"",fallbackName:`${Rs[i]??Ba(i)} · ${o}`}}const s=e.match(/^agent:[^:]+:([^:]+):group:(.+)$/);if(s){const i=s[1];return{prefix:"",fallbackName:`${Rs[i]??Ba(i)} Group`}}for(const i of Ov)if(e===i||e.startsWith(`${i}:`))return{prefix:"",fallbackName:`${Rs[i]} Session`};return{prefix:"",fallbackName:e}}function
|
|
3469
|
+
`}function Nv(e,t){const n=e?.snapshot,s=n?.sessionDefaults?.mainSessionKey?.trim();if(s)return s;const i=n?.sessionDefaults?.mainKey?.trim();return i||(t?.sessions?.some(o=>o.key==="main")?"main":null)}const Rs={bluebubbles:"iMessage",telegram:"Telegram",discord:"Discord",signal:"Signal",slack:"Slack",whatsapp:"WhatsApp",matrix:"Matrix",email:"Email",sms:"SMS"},Ov=Object.keys(Rs);function Ba(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Uv(e){const t=e.toLowerCase();if(e==="main"||e==="agent:main:main")return{prefix:"",fallbackName:"Main Session"};if(e.includes(":subagent:"))return{prefix:"Subagent:",fallbackName:"Subagent:"};if(t.startsWith("cron:")||e.includes(":cron:"))return{prefix:"Cron:",fallbackName:"Cron Job:"};const n=e.match(/^agent:[^:]+:([^:]+):direct:(.+)$/);if(n){const i=n[1],o=n[2];return{prefix:"",fallbackName:`${Rs[i]??Ba(i)} · ${o}`}}const s=e.match(/^agent:[^:]+:([^:]+):group:(.+)$/);if(s){const i=s[1];return{prefix:"",fallbackName:`${Rs[i]??Ba(i)} Group`}}for(const i of Ov)if(e===i||e.startsWith(`${i}:`))return{prefix:"",fallbackName:`${Rs[i]} Session`};return{prefix:"",fallbackName:e}}function Oi(e,t){const n=t?.label?.trim()||"",s=t?.displayName?.trim()||"",{prefix:i,fallbackName:o}=Uv(e),r=l=>i?new RegExp(`^${i.replace(/[.*+?^${}()|[\\]\\]/g,"\\$&")}\\s*`,"i").test(l)?l:`${i} ${l}`:l;return n&&n!==e?r(n):s&&s!==e?r(s):o}function Td(e){const t=e.trim().toLowerCase();if(!t)return!1;if(t.startsWith("cron:"))return!0;if(!t.startsWith("agent:"))return!1;const n=t.split(":").filter(Boolean);return n.length<3?!1:n.slice(2).join(":").startsWith("cron:")}function Bv(e,t,n,s=!1){const i=new Set,o=[],r=n&&t?.sessions?.find(a=>a.key===n),l=t?.sessions?.find(a=>a.key===e);if(n&&(i.add(n),o.push({key:n,displayName:Oi(n,r||void 0)})),i.has(e)||(i.add(e),o.push({key:e,displayName:Oi(e,l)})),t?.sessions)for(const a of t.sessions)!i.has(a.key)&&!(s&&Td(a.key))&&(i.add(a.key),o.push({key:a.key,displayName:Oi(a.key,a)}));return o}function Hv(e,t){return t?.sessions?t.sessions.filter(n=>Td(n.key)&&n.key!==e).length:0}const zv=["system","light","dark"];function jv(e){const t=Math.max(0,zv.indexOf(e.theme)),n=s=>i=>{const r={element:i.currentTarget};(i.clientX||i.clientY)&&(r.pointerClientX=i.clientX,r.pointerClientY=i.clientY),e.setTheme(s,r)};return c`
|
|
3470
3470
|
<div class="theme-toggle" style="--theme-index: ${t};">
|
|
3471
3471
|
<div class="theme-toggle__track" role="group" aria-label="Theme">
|
|
3472
3472
|
<span class="theme-toggle__indicator"></span>
|
|
@@ -3523,9 +3523,9 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3523
3523
|
<line x1="8" x2="16" y1="21" y2="21"></line>
|
|
3524
3524
|
<line x1="12" x2="12" y1="17" y2="21"></line>
|
|
3525
3525
|
</svg>
|
|
3526
|
-
`}function Ed(e,t){if(!e)return e;const s=e.files.some(i=>i.name===t.name)?e.files.map(i=>i.name===t.name?t:i):[...e.files,t];return{...e,files:s}}async function Oi(e,t){if(!(!e.client||!e.connected||e.agentFilesLoading)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const n=await e.client.request("agents.files.list",{agentId:t});n&&(e.agentFilesList=n,e.agentFileActive&&!n.files.some(s=>s.name===e.agentFileActive)&&(e.agentFileActive=null))}catch(n){e.agentFilesError=String(n)}finally{e.agentFilesLoading=!1}}}async function Gv(e,t,n,s){if(!(!e.client||!e.connected||e.agentFilesLoading)&&!Object.hasOwn(e.agentFileContents,n)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.get",{agentId:t,name:n});if(i?.file){const o=i.file.content??"",r=e.agentFileContents[n]??"",l=e.agentFileDrafts[n],a=s?.preserveDraft??!0;e.agentFilesList=Ed(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:o},(!a||!Object.hasOwn(e.agentFileDrafts,n)||l===r)&&(e.agentFileDrafts={...e.agentFileDrafts,[n]:o})}}catch(i){e.agentFilesError=String(i)}finally{e.agentFilesLoading=!1}}}async function Vv(e,t,n,s){if(!(!e.client||!e.connected||e.agentFileSaving)){e.agentFileSaving=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.set",{agentId:t,name:n,content:s});i?.file&&(e.agentFilesList=Ed(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:s},e.agentFileDrafts={...e.agentFileDrafts,[n]:s})}catch(i){e.agentFilesError=String(i)}finally{e.agentFileSaving=!1}}}const Ha=["noopener","noreferrer"],dn="_blank";function un(e){const t=[],n=new Set(Ha);for(const s of"".split(/\s+/)){const i=s.trim().toLowerCase();!i||n.has(i)||(n.add(i),t.push(i))}return[...Ha,...t].join(" ")}const Jv=[{id:"fs",label:"Files"},{id:"runtime",label:"Runtime"},{id:"web",label:"Web"},{id:"memory",label:"Memory"},{id:"sessions",label:"Sessions"},{id:"ui",label:"UI"},{id:"messaging",label:"Messaging"},{id:"automation",label:"Automation"},{id:"nodes",label:"Nodes"},{id:"agents",label:"Agents"},{id:"media",label:"Media"}],ts=[{id:"read",label:"read",description:"Read file contents",sectionId:"fs",profiles:["coding"]},{id:"write",label:"write",description:"Create or overwrite files",sectionId:"fs",profiles:["coding"]},{id:"edit",label:"edit",description:"Make precise edits",sectionId:"fs",profiles:["coding"]},{id:"apply_patch",label:"apply_patch",description:"Patch files (OpenAI)",sectionId:"fs",profiles:["coding"]},{id:"exec",label:"exec",description:"Run shell commands",sectionId:"runtime",profiles:["coding"]},{id:"process",label:"process",description:"Manage background processes",sectionId:"runtime",profiles:["coding"]},{id:"web_search",label:"web_search",description:"Search the web",sectionId:"web",profiles:[],includeInOpenClawGroup:!0},{id:"web_fetch",label:"web_fetch",description:"Fetch web content",sectionId:"web",profiles:[],includeInOpenClawGroup:!0},{id:"memory_search",label:"memory_search",description:"Semantic search",sectionId:"memory",profiles:["coding"],includeInOpenClawGroup:!0},{id:"memory_get",label:"memory_get",description:"Read memory files",sectionId:"memory",profiles:["coding"],includeInOpenClawGroup:!0},{id:"sessions_list",label:"sessions_list",description:"List sessions",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_history",label:"sessions_history",description:"Session history",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_send",label:"sessions_send",description:"Send to session",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_spawn",label:"sessions_spawn",description:"Spawn sub-agent",sectionId:"sessions",profiles:["coding"],includeInOpenClawGroup:!0},{id:"subagents",label:"subagents",description:"Manage sub-agents",sectionId:"sessions",profiles:["coding"],includeInOpenClawGroup:!0},{id:"session_status",label:"session_status",description:"Session status",sectionId:"sessions",profiles:["minimal","coding","messaging"],includeInOpenClawGroup:!0},{id:"browser",label:"browser",description:"Control web browser",sectionId:"ui",profiles:[],includeInOpenClawGroup:!0},{id:"canvas",label:"canvas",description:"Control canvases",sectionId:"ui",profiles:[],includeInOpenClawGroup:!0},{id:"message",label:"message",description:"Send messages",sectionId:"messaging",profiles:["messaging"],includeInOpenClawGroup:!0},{id:"cron",label:"cron",description:"Schedule tasks",sectionId:"automation",profiles:["coding"],includeInOpenClawGroup:!0},{id:"gateway",label:"gateway",description:"Gateway control",sectionId:"automation",profiles:[],includeInOpenClawGroup:!0},{id:"nodes",label:"nodes",description:"Nodes + devices",sectionId:"nodes",profiles:[],includeInOpenClawGroup:!0},{id:"agents_list",label:"agents_list",description:"List agents",sectionId:"agents",profiles:[],includeInOpenClawGroup:!0},{id:"image",label:"image",description:"Image understanding",sectionId:"media",profiles:["coding"],includeInOpenClawGroup:!0},{id:"tts",label:"tts",description:"Text-to-speech conversion",sectionId:"media",profiles:[],includeInOpenClawGroup:!0}];new Map(ts.map(e=>[e.id,e]));function Ui(e){return ts.filter(t=>t.profiles.includes(e)).map(t=>t.id)}const Qv={minimal:{allow:Ui("minimal")},coding:{allow:Ui("coding")},messaging:{allow:Ui("messaging")},full:{}};function Yv(){const e=new Map;for(const n of ts){const s=`group:${n.sectionId}`,i=e.get(s)??[];i.push(n.id),e.set(s,i)}return{"group:openclaw":ts.filter(n=>n.includeInOpenClawGroup).map(n=>n.id),...Object.fromEntries(e.entries())}}const Xv=Yv(),Zv=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function eb(e){if(!e)return;const t=Qv[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function tb(){return Jv.map(e=>({id:e.id,label:e.label,tools:ts.filter(t=>t.sectionId===e.id).map(t=>({id:t.id,label:t.label,description:t.description}))})).filter(e=>e.tools.length>0)}const nb={bash:"exec","apply-patch":"apply_patch"},sb={...Xv};function Ye(e){const t=e.trim().toLowerCase();return nb[t]??t}function ib(e){return e?e.map(Ye).filter(Boolean):[]}function ob(e){const t=ib(e),n=[];for(const s of t){const i=sb[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function rb(e){return eb(e)}const ab=tb(),lb=Zv;function mo(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function xs(e){const t=e.trim();if(!t||t.length>16)return!1;let n=!1;for(let s=0;s<t.length;s+=1)if(t.charCodeAt(s)>127){n=!0;break}return!(!n||t.includes("://")||t.includes("/")||t.includes("."))}function gi(e,t){const n=t?.emoji?.trim();if(n&&xs(n))return n;const s=e.identity?.emoji?.trim();if(s&&xs(s))return s;const i=t?.avatar?.trim();if(i&&xs(i))return i;const o=e.identity?.avatar?.trim();return o&&xs(o)?o:""}function _d(e,t){return t&&e===t?"default":null}function cb(e){if(e==null||!Number.isFinite(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s+=1;return`${n.toFixed(n<10?1:0)} ${t[s]}`}function fi(e,t){const n=e;return{entry:(n?.agents?.list??[]).find(o=>o?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function za(e,t,n,s,i){const o=fi(t,e.id),l=(n&&n.agentId===e.id?n.workspace:null)||o.entry?.workspace||o.defaults?.workspace||"default",a=o.entry?.model?jn(o.entry?.model):jn(o.defaults?.model),d=i?.name?.trim()||e.identity?.name?.trim()||e.name?.trim()||o.entry?.name||e.id,g=gi(e,i)||"-",u=Array.isArray(o.entry?.skills)?o.entry?.skills:null,f=u?.length??null;return{workspace:l,model:a,identityName:d,identityEmoji:g,skillsLabel:u?`${f} selected`:"all skills",isDefault:!!(s&&e.id===s)}}function jn(e){if(!e)return"-";if(typeof e=="string")return e.trim()||"-";if(typeof e=="object"&&e){const t=e,n=t.primary?.trim();if(n){const s=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return s>0?`${n} (+${s} fallback)`:n}}return"-"}function ja(e){const t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function Ka(e){if(!e)return null;if(typeof e=="string")return e.trim()||null;if(typeof e=="object"&&e){const t=e;return(typeof t.primary=="string"?t.primary:typeof t.model=="string"?t.model:typeof t.id=="string"?t.id:typeof t.value=="string"?t.value:null)?.trim()||null}return null}function Wa(e){if(!e||typeof e=="string")return null;if(typeof e=="object"&&e){const t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(s=>typeof s=="string"):null}return null}function db(e,t){return Wa(e)??Wa(t)}function Bt(e,t){if(typeof t!="string")return;const n=t.trim();n&&e.add(n)}function qa(e,t){if(!t)return;if(typeof t=="string"){Bt(e,t);return}if(typeof t!="object")return;const n=t;Bt(e,n.primary),Bt(e,n.model),Bt(e,n.id),Bt(e,n.value);const s=Array.isArray(n.fallbacks)?n.fallbacks:Array.isArray(n.fallback)?n.fallback:[];for(const i of s)Bt(e,i)}function vo(e){const t=Array.from(e),n=Array.from({length:t.length},()=>""),s=(o,r,l)=>{let a=o,d=r,g=o;for(;a<r&&d<l;)n[g++]=t[a].localeCompare(t[d])<=0?t[a++]:t[d++];for(;a<r;)n[g++]=t[a++];for(;d<l;)n[g++]=t[d++];for(let u=o;u<l;u+=1)t[u]=n[u]},i=(o,r)=>{if(r-o<=1)return;const l=o+r>>>1;i(o,l),i(l,r),s(o,l,r)};return i(0,t.length),t}function ub(e){if(!e||typeof e!="object")return[];const t=e.agents;if(!t||typeof t!="object")return[];const n=new Set,s=t.defaults;if(s&&typeof s=="object"){const o=s;qa(n,o.model);const r=o.models;if(r&&typeof r=="object")for(const l of Object.keys(r))Bt(n,l)}const i=t.list;if(i&&typeof i=="object")for(const o of Object.values(i))!o||typeof o!="object"||qa(n,o.model);return vo(n)}function gb(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function fb(e){const n=e?.agents?.defaults?.models;if(!n||typeof n!="object")return[];const s=[];for(const[i,o]of Object.entries(n)){const r=i.trim();if(!r)continue;const l=o&&typeof o=="object"&&"alias"in o&&typeof o.alias=="string"?o.alias?.trim():void 0,a=l&&l!==r?`${l} (${r})`:r;s.push({value:r,label:a})}return s}function pb(e,t){const n=fb(e),s=t?n.some(i=>i.value===t):!1;return t&&!s&&n.unshift({value:t,label:`Current (${t})`}),n.length===0?c`
|
|
3526
|
+
`}function Ed(e,t){if(!e)return e;const s=e.files.some(i=>i.name===t.name)?e.files.map(i=>i.name===t.name?t:i):[...e.files,t];return{...e,files:s}}async function Ui(e,t){if(!(!e.client||!e.connected||e.agentFilesLoading)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const n=await e.client.request("agents.files.list",{agentId:t});n&&(e.agentFilesList=n,e.agentFileActive&&!n.files.some(s=>s.name===e.agentFileActive)&&(e.agentFileActive=null))}catch(n){e.agentFilesError=String(n)}finally{e.agentFilesLoading=!1}}}async function Gv(e,t,n,s){if(!(!e.client||!e.connected||e.agentFilesLoading)&&!Object.hasOwn(e.agentFileContents,n)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.get",{agentId:t,name:n});if(i?.file){const o=i.file.content??"",r=e.agentFileContents[n]??"",l=e.agentFileDrafts[n],a=s?.preserveDraft??!0;e.agentFilesList=Ed(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:o},(!a||!Object.hasOwn(e.agentFileDrafts,n)||l===r)&&(e.agentFileDrafts={...e.agentFileDrafts,[n]:o})}}catch(i){e.agentFilesError=String(i)}finally{e.agentFilesLoading=!1}}}async function Vv(e,t,n,s){if(!(!e.client||!e.connected||e.agentFileSaving)){e.agentFileSaving=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.set",{agentId:t,name:n,content:s});i?.file&&(e.agentFilesList=Ed(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:s},e.agentFileDrafts={...e.agentFileDrafts,[n]:s})}catch(i){e.agentFilesError=String(i)}finally{e.agentFileSaving=!1}}}const Ha=["noopener","noreferrer"],dn="_blank";function un(e){const t=[],n=new Set(Ha);for(const s of"".split(/\s+/)){const i=s.trim().toLowerCase();!i||n.has(i)||(n.add(i),t.push(i))}return[...Ha,...t].join(" ")}const Jv=[{id:"fs",label:"Files"},{id:"runtime",label:"Runtime"},{id:"web",label:"Web"},{id:"memory",label:"Memory"},{id:"sessions",label:"Sessions"},{id:"ui",label:"UI"},{id:"messaging",label:"Messaging"},{id:"automation",label:"Automation"},{id:"nodes",label:"Nodes"},{id:"agents",label:"Agents"},{id:"media",label:"Media"}],ts=[{id:"read",label:"read",description:"Read file contents",sectionId:"fs",profiles:["coding"]},{id:"write",label:"write",description:"Create or overwrite files",sectionId:"fs",profiles:["coding"]},{id:"edit",label:"edit",description:"Make precise edits",sectionId:"fs",profiles:["coding"]},{id:"apply_patch",label:"apply_patch",description:"Patch files (OpenAI)",sectionId:"fs",profiles:["coding"]},{id:"exec",label:"exec",description:"Run shell commands",sectionId:"runtime",profiles:["coding"]},{id:"process",label:"process",description:"Manage background processes",sectionId:"runtime",profiles:["coding"]},{id:"web_search",label:"web_search",description:"Search the web",sectionId:"web",profiles:[],includeInOpenClawGroup:!0},{id:"web_fetch",label:"web_fetch",description:"Fetch web content",sectionId:"web",profiles:[],includeInOpenClawGroup:!0},{id:"memory_search",label:"memory_search",description:"Semantic search",sectionId:"memory",profiles:["coding"],includeInOpenClawGroup:!0},{id:"memory_get",label:"memory_get",description:"Read memory files",sectionId:"memory",profiles:["coding"],includeInOpenClawGroup:!0},{id:"sessions_list",label:"sessions_list",description:"List sessions",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_history",label:"sessions_history",description:"Session history",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_send",label:"sessions_send",description:"Send to session",sectionId:"sessions",profiles:["coding","messaging"],includeInOpenClawGroup:!0},{id:"sessions_spawn",label:"sessions_spawn",description:"Spawn sub-agent",sectionId:"sessions",profiles:["coding"],includeInOpenClawGroup:!0},{id:"subagents",label:"subagents",description:"Manage sub-agents",sectionId:"sessions",profiles:["coding"],includeInOpenClawGroup:!0},{id:"session_status",label:"session_status",description:"Session status",sectionId:"sessions",profiles:["minimal","coding","messaging"],includeInOpenClawGroup:!0},{id:"browser",label:"browser",description:"Control web browser",sectionId:"ui",profiles:[],includeInOpenClawGroup:!0},{id:"canvas",label:"canvas",description:"Control canvases",sectionId:"ui",profiles:[],includeInOpenClawGroup:!0},{id:"message",label:"message",description:"Send messages",sectionId:"messaging",profiles:["messaging"],includeInOpenClawGroup:!0},{id:"cron",label:"cron",description:"Schedule tasks",sectionId:"automation",profiles:["coding"],includeInOpenClawGroup:!0},{id:"gateway",label:"gateway",description:"Gateway control",sectionId:"automation",profiles:[],includeInOpenClawGroup:!0},{id:"nodes",label:"nodes",description:"Nodes + devices",sectionId:"nodes",profiles:[],includeInOpenClawGroup:!0},{id:"agents_list",label:"agents_list",description:"List agents",sectionId:"agents",profiles:[],includeInOpenClawGroup:!0},{id:"image",label:"image",description:"Image understanding",sectionId:"media",profiles:["coding"],includeInOpenClawGroup:!0},{id:"tts",label:"tts",description:"Text-to-speech conversion",sectionId:"media",profiles:[],includeInOpenClawGroup:!0}];new Map(ts.map(e=>[e.id,e]));function Bi(e){return ts.filter(t=>t.profiles.includes(e)).map(t=>t.id)}const Qv={minimal:{allow:Bi("minimal")},coding:{allow:Bi("coding")},messaging:{allow:Bi("messaging")},full:{}};function Yv(){const e=new Map;for(const n of ts){const s=`group:${n.sectionId}`,i=e.get(s)??[];i.push(n.id),e.set(s,i)}return{"group:openclaw":ts.filter(n=>n.includeInOpenClawGroup).map(n=>n.id),...Object.fromEntries(e.entries())}}const Xv=Yv(),Zv=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function eb(e){if(!e)return;const t=Qv[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function tb(){return Jv.map(e=>({id:e.id,label:e.label,tools:ts.filter(t=>t.sectionId===e.id).map(t=>({id:t.id,label:t.label,description:t.description}))})).filter(e=>e.tools.length>0)}const nb={bash:"exec","apply-patch":"apply_patch"},sb={...Xv};function Ye(e){const t=e.trim().toLowerCase();return nb[t]??t}function ib(e){return e?e.map(Ye).filter(Boolean):[]}function ob(e){const t=ib(e),n=[];for(const s of t){const i=sb[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function rb(e){return eb(e)}const ab=tb(),lb=Zv;function vo(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function xs(e){const t=e.trim();if(!t||t.length>16)return!1;let n=!1;for(let s=0;s<t.length;s+=1)if(t.charCodeAt(s)>127){n=!0;break}return!(!n||t.includes("://")||t.includes("/")||t.includes("."))}function fi(e,t){const n=t?.emoji?.trim();if(n&&xs(n))return n;const s=e.identity?.emoji?.trim();if(s&&xs(s))return s;const i=t?.avatar?.trim();if(i&&xs(i))return i;const o=e.identity?.avatar?.trim();return o&&xs(o)?o:""}function _d(e,t){return t&&e===t?"default":null}function cb(e){if(e==null||!Number.isFinite(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s+=1;return`${n.toFixed(n<10?1:0)} ${t[s]}`}function pi(e,t){const n=e;return{entry:(n?.agents?.list??[]).find(o=>o?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function za(e,t,n,s,i){const o=pi(t,e.id),l=(n&&n.agentId===e.id?n.workspace:null)||o.entry?.workspace||o.defaults?.workspace||"default",a=o.entry?.model?jn(o.entry?.model):jn(o.defaults?.model),d=i?.name?.trim()||e.identity?.name?.trim()||e.name?.trim()||o.entry?.name||e.id,g=fi(e,i)||"-",u=Array.isArray(o.entry?.skills)?o.entry?.skills:null,f=u?.length??null;return{workspace:l,model:a,identityName:d,identityEmoji:g,skillsLabel:u?`${f} selected`:"all skills",isDefault:!!(s&&e.id===s)}}function jn(e){if(!e)return"-";if(typeof e=="string")return e.trim()||"-";if(typeof e=="object"&&e){const t=e,n=t.primary?.trim();if(n){const s=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return s>0?`${n} (+${s} fallback)`:n}}return"-"}function ja(e){const t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function Ka(e){if(!e)return null;if(typeof e=="string")return e.trim()||null;if(typeof e=="object"&&e){const t=e;return(typeof t.primary=="string"?t.primary:typeof t.model=="string"?t.model:typeof t.id=="string"?t.id:typeof t.value=="string"?t.value:null)?.trim()||null}return null}function Wa(e){if(!e||typeof e=="string")return null;if(typeof e=="object"&&e){const t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(s=>typeof s=="string"):null}return null}function db(e,t){return Wa(e)??Wa(t)}function Bt(e,t){if(typeof t!="string")return;const n=t.trim();n&&e.add(n)}function qa(e,t){if(!t)return;if(typeof t=="string"){Bt(e,t);return}if(typeof t!="object")return;const n=t;Bt(e,n.primary),Bt(e,n.model),Bt(e,n.id),Bt(e,n.value);const s=Array.isArray(n.fallbacks)?n.fallbacks:Array.isArray(n.fallback)?n.fallback:[];for(const i of s)Bt(e,i)}function bo(e){const t=Array.from(e),n=Array.from({length:t.length},()=>""),s=(o,r,l)=>{let a=o,d=r,g=o;for(;a<r&&d<l;)n[g++]=t[a].localeCompare(t[d])<=0?t[a++]:t[d++];for(;a<r;)n[g++]=t[a++];for(;d<l;)n[g++]=t[d++];for(let u=o;u<l;u+=1)t[u]=n[u]},i=(o,r)=>{if(r-o<=1)return;const l=o+r>>>1;i(o,l),i(l,r),s(o,l,r)};return i(0,t.length),t}function ub(e){if(!e||typeof e!="object")return[];const t=e.agents;if(!t||typeof t!="object")return[];const n=new Set,s=t.defaults;if(s&&typeof s=="object"){const o=s;qa(n,o.model);const r=o.models;if(r&&typeof r=="object")for(const l of Object.keys(r))Bt(n,l)}const i=t.list;if(i&&typeof i=="object")for(const o of Object.values(i))!o||typeof o!="object"||qa(n,o.model);return bo(n)}function gb(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function fb(e){const n=e?.agents?.defaults?.models;if(!n||typeof n!="object")return[];const s=[];for(const[i,o]of Object.entries(n)){const r=i.trim();if(!r)continue;const l=o&&typeof o=="object"&&"alias"in o&&typeof o.alias=="string"?o.alias?.trim():void 0,a=l&&l!==r?`${l} (${r})`:r;s.push({value:r,label:a})}return s}function pb(e,t){const n=fb(e),s=t?n.some(i=>i.value===t):!1;return t&&!s&&n.unshift({value:t,label:`Current (${t})`}),n.length===0?c`
|
|
3527
3527
|
<option value="" disabled>No configured models</option>
|
|
3528
|
-
`:n.map(i=>c`<option value=${i.value}>${i.label}</option>`)}function hb(e){const t=Ye(e);if(!t)return{kind:"exact",value:""};if(t==="*")return{kind:"all"};if(!t.includes("*"))return{kind:"exact",value:t};const n=t.replace(/[.*+?^${}()|[\\]\\]/g,"\\$&");return{kind:"regex",value:new RegExp(`^${n.replaceAll("\\*",".*")}$`)}}function
|
|
3528
|
+
`:n.map(i=>c`<option value=${i.value}>${i.label}</option>`)}function hb(e){const t=Ye(e);if(!t)return{kind:"exact",value:""};if(t==="*")return{kind:"all"};if(!t.includes("*"))return{kind:"exact",value:t};const n=t.replace(/[.*+?^${}()|[\\]\\]/g,"\\$&");return{kind:"regex",value:new RegExp(`^${n.replaceAll("\\*",".*")}$`)}}function yo(e){return Array.isArray(e)?ob(e).map(hb).filter(t=>t.kind!=="exact"||t.value.length>0):[]}function Kn(e,t){for(const n of t)if(n.kind==="all"||n.kind==="exact"&&e===n.value||n.kind==="regex"&&n.value.test(e))return!0;return!1}function mb(e,t){if(!t)return!0;const n=Ye(e),s=yo(t.deny);if(Kn(n,s))return!1;const i=yo(t.allow);return!!(i.length===0||Kn(n,i)||n==="apply_patch"&&Kn("exec",i))}function Ga(e,t){if(!Array.isArray(t)||t.length===0)return!1;const n=Ye(e),s=yo(t);return!!(Kn(n,s)||n==="apply_patch"&&Kn("exec",s))}function vb(e){return rb(e)??void 0}function bb(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function yb(e){const t=e.ts??null;return t?ne(t):"n/a"}function gr(e){return e?`${new Date(e).toLocaleDateString(void 0,{weekday:"short"})}, ${kt(e)} (${ne(e)})`:"n/a"}function $b(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function xb(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function wb(e){const t=e.state??{},n=t.nextRunAtMs?kt(t.nextRunAtMs):"n/a",s=t.lastRunAtMs?kt(t.lastRunAtMs):"n/a";return`${t.lastStatus??"n/a"} · next ${n} · last ${s}`}function Id(e){const t=e.schedule;if(t.kind==="at"){const n=Date.parse(t.at);return Number.isFinite(n)?`At ${kt(n)}`:`At ${t.at}`}return t.kind==="every"?`Every ${Ho(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function Sb(e){const t=e.payload;if(t.kind==="systemEvent")return`System: ${t.text}`;const n=`Agent: ${t.message}`,s=e.delivery;if(s&&s.mode!=="none"){const i=s.mode==="webhook"?s.to?` (${s.to})`:"":s.channel||s.to?` (${s.channel??"last"}${s.to?` -> ${s.to}`:""})`:"";return`${n} · ${s.mode}${i}`}return n}function Md(e,t){if(!e)return null;const s=(e.channels??{})[t];if(s&&typeof s=="object")return s;const i=e[t];return i&&typeof i=="object"?i:null}function Rd(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function kb(e){const t=Md(e.configForm,e.channelId);return t?e.fields.flatMap(n=>n in t?[{label:n,value:Rd(t[n])}]:[]):[]}function Ld(e,t){return c`
|
|
3529
3529
|
<section class="card">
|
|
3530
3530
|
<div class="card-title">Agent Context</div>
|
|
3531
3531
|
<div class="card-sub">${t}</div>
|
|
@@ -3757,7 +3757,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3757
3757
|
<span class="chip chip-warn">disabled</span>
|
|
3758
3758
|
`:h}
|
|
3759
3759
|
</div>
|
|
3760
|
-
`}function Lb(e){const t=
|
|
3760
|
+
`}function Lb(e){const t=pi(e.configForm,e.agentId),n=t.entry?.tools??{},s=t.globalTools??{},i=n.profile??s.profile??"full",o=n.profile?"agent override":s.profile?"global default":"default",r=Array.isArray(n.allow)&&n.allow.length>0,l=Array.isArray(s.allow)&&s.allow.length>0,a=!!e.configForm&&!e.configLoading&&!e.configSaving&&!r,d=r?[]:Array.isArray(n.alsoAllow)?n.alsoAllow:[],g=r?[]:Array.isArray(n.deny)?n.deny:[],u=r?{allow:n.allow??[],deny:n.deny??[]}:vb(i)??void 0,f=e.toolsCatalogResult?.groups?.length&&e.toolsCatalogResult.agentId===e.agentId?e.toolsCatalogResult.groups:ab,v=e.toolsCatalogResult?.profiles?.length&&e.toolsCatalogResult.agentId===e.agentId?e.toolsCatalogResult.profiles:lb,m=f.flatMap(A=>A.tools.map(w=>w.id)),S=A=>{const w=mb(A,u),L=Ga(A,d),_=Ga(A,g);return{allowed:(w||L)&&!_,baseAllowed:w,denied:_}},C=m.filter(A=>S(A).allowed).length,R=(A,w)=>{const L=new Set(d.map(G=>Ye(G)).filter(G=>G.length>0)),_=new Set(g.map(G=>Ye(G)).filter(G=>G.length>0)),M=S(A).baseAllowed,K=Ye(A);w?(_.delete(K),M||L.add(K)):(L.delete(K),_.add(K)),e.onOverridesChange(e.agentId,[...L],[..._])},I=A=>{const w=new Set(d.map(_=>Ye(_)).filter(_=>_.length>0)),L=new Set(g.map(_=>Ye(_)).filter(_=>_.length>0));for(const _ of m){const M=S(_).baseAllowed,K=Ye(_);A?(L.delete(K),M||w.add(K)):(w.delete(K),L.add(K))}e.onOverridesChange(e.agentId,[...w],[...L])};return c`
|
|
3761
3761
|
<section class="card">
|
|
3762
3762
|
<div class="row" style="justify-content: space-between;">
|
|
3763
3763
|
<div>
|
|
@@ -3857,13 +3857,13 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3857
3857
|
`:h}
|
|
3858
3858
|
</div>
|
|
3859
3859
|
<div class="agent-tools-list">
|
|
3860
|
-
${A.tools.map(w=>{const{allowed:L}=S(w.id),_=w,M=_.source==="plugin"?_.pluginId?`plugin:${_.pluginId}`:"plugin":"core",
|
|
3860
|
+
${A.tools.map(w=>{const{allowed:L}=S(w.id),_=w,M=_.source==="plugin"?_.pluginId?`plugin:${_.pluginId}`:"plugin":"core",K=_.optional===!0;return c`
|
|
3861
3861
|
<div class="agent-tool-row">
|
|
3862
3862
|
<div>
|
|
3863
3863
|
<div class="agent-tool-title mono">
|
|
3864
3864
|
${w.label}
|
|
3865
3865
|
<span class="mono" style="margin-left: 8px; opacity: 0.8;">${M}</span>
|
|
3866
|
-
${
|
|
3866
|
+
${K?c`
|
|
3867
3867
|
<span class="mono" style="margin-left: 6px; opacity: 0.8">optional</span>
|
|
3868
3868
|
`:h}
|
|
3869
3869
|
</div>
|
|
@@ -3888,7 +3888,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
3888
3888
|
<div class="card-sub" style="margin-top: 10px">Refreshing tool catalog…</div>
|
|
3889
3889
|
`:h}
|
|
3890
3890
|
</section>
|
|
3891
|
-
`}function Db(e){const t=!!e.configForm&&!e.configLoading&&!e.configSaving,n=
|
|
3891
|
+
`}function Db(e){const t=!!e.configForm&&!e.configLoading&&!e.configSaving,n=pi(e.configForm,e.agentId),s=Array.isArray(n.entry?.skills)?n.entry?.skills:void 0,i=new Set((s??[]).map(v=>v.trim()).filter(Boolean)),o=s!==void 0,r=!!(e.report&&e.activeAgentId===e.agentId),l=r?e.report?.skills??[]:[],a=e.filter.trim().toLowerCase(),d=a?l.filter(v=>[v.name,v.description,v.source].join(" ").toLowerCase().includes(a)):l,g=Dd(d),u=o?l.filter(v=>i.has(v.name)).length:l.length,f=l.length;return c`
|
|
3892
3892
|
<section class="card">
|
|
3893
3893
|
<div class="row" style="justify-content: space-between;">
|
|
3894
3894
|
<div>
|
|
@@ -4011,13 +4011,13 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4011
4011
|
<div class="agent-list" style="margin-top: 12px;">
|
|
4012
4012
|
${t.length===0?c`
|
|
4013
4013
|
<div class="muted">No agents found.</div>
|
|
4014
|
-
`:t.map(o=>{const r=_d(o.id,n),l=
|
|
4014
|
+
`:t.map(o=>{const r=_d(o.id,n),l=fi(o,e.agentIdentityById[o.id]??null),a=vo(o),{primary:d,secondary:g}=Ob(a);return c`
|
|
4015
4015
|
<button
|
|
4016
4016
|
type="button"
|
|
4017
4017
|
class="agent-row ${s===o.id?"active":""}"
|
|
4018
4018
|
@click=${()=>e.onSelectAgent(o.id)}
|
|
4019
4019
|
>
|
|
4020
|
-
<div class="agent-avatar">${l||
|
|
4020
|
+
<div class="agent-avatar">${l||vo(o).slice(0,1)}</div>
|
|
4021
4021
|
<div class="agent-info">
|
|
4022
4022
|
<div class="agent-title">${d}</div>
|
|
4023
4023
|
${g?c`<div class="agent-sub">${g}</div>`:h}
|
|
@@ -4045,7 +4045,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4045
4045
|
`}
|
|
4046
4046
|
</section>
|
|
4047
4047
|
</div>
|
|
4048
|
-
`}function Ob(e){const t=e.trim();if(!t)return{primary:"-",secondary:null};const n=" · ",s=t.indexOf(n);if(s===-1)return{primary:t,secondary:null};const i=t.slice(0,s).trim(),o=t.slice(s+n.length).trim();return{primary:i||t,secondary:o||null}}function Ub(e,t,n){const s=_d(e.id,t),i=
|
|
4048
|
+
`}function Ob(e){const t=e.trim();if(!t)return{primary:"-",secondary:null};const n=" · ",s=t.indexOf(n);if(s===-1)return{primary:t,secondary:null};const i=t.slice(0,s).trim(),o=t.slice(s+n.length).trim();return{primary:i||t,secondary:o||null}}function Ub(e,t,n){const s=_d(e.id,t),i=vo(e),o=e.identity?.theme?.trim()||"Agent workspace and routing.",r=fi(e,n);return c`
|
|
4049
4049
|
<section class="card agent-header">
|
|
4050
4050
|
<div class="agent-header-main">
|
|
4051
4051
|
<div class="agent-avatar agent-avatar--lg">${r||i.slice(0,1)}</div>
|
|
@@ -4071,7 +4071,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4071
4071
|
</button>
|
|
4072
4072
|
`)}
|
|
4073
4073
|
</div>
|
|
4074
|
-
`}function Hb(e){const{agent:t,configForm:n,agentFilesList:s,agentIdentity:i,agentIdentityLoading:o,agentIdentityError:r,configLoading:l,configSaving:a,configDirty:d,onConfigReload:g,onConfigSave:u,onModelChange:f,onModelFallbacksChange:v}=e,m=
|
|
4074
|
+
`}function Hb(e){const{agent:t,configForm:n,agentFilesList:s,agentIdentity:i,agentIdentityLoading:o,agentIdentityError:r,configLoading:l,configSaving:a,configDirty:d,onConfigReload:g,onConfigSave:u,onModelChange:f,onModelFallbacksChange:v}=e,m=pi(n,t.id),C=(s&&s.agentId===t.id?s.workspace:null)||m.entry?.workspace||m.defaults?.workspace||"default",R=m.entry?.model?jn(m.entry?.model):jn(m.defaults?.model),I=jn(m.defaults?.model),A=Ka(m.entry?.model)||(R!=="-"?ja(R):null),w=Ka(m.defaults?.model)||(I!=="-"?ja(I):null),L=A??w??null,_=db(m.entry?.model,m.defaults?.model),M=_?_.join(", "):"",K=i?.name?.trim()||t.identity?.name?.trim()||t.name?.trim()||m.entry?.name||"-",b=fi(t,i)||"-",T=Array.isArray(m.entry?.skills)?m.entry?.skills:null,N=T?.length??null,W=o?"Loading…":r?"Unavailable":"",V=!!(e.defaultId&&t.id===e.defaultId);return c`
|
|
4075
4075
|
<section class="card">
|
|
4076
4076
|
<div class="card-title">Overview</div>
|
|
4077
4077
|
<div class="card-sub">Workspace paths and identity metadata.</div>
|
|
@@ -4086,8 +4086,8 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4086
4086
|
</div>
|
|
4087
4087
|
<div class="agent-kv">
|
|
4088
4088
|
<div class="label">Identity Name</div>
|
|
4089
|
-
<div>${
|
|
4090
|
-
${
|
|
4089
|
+
<div>${K}</div>
|
|
4090
|
+
${W?c`<div class="agent-kv-sub muted">${W}</div>`:h}
|
|
4091
4091
|
</div>
|
|
4092
4092
|
<div class="agent-kv">
|
|
4093
4093
|
<div class="label">Default</div>
|
|
@@ -4203,7 +4203,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4203
4203
|
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
|
|
4204
4204
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
|
|
4205
4205
|
</svg>
|
|
4206
|
-
`};function kn(e){return!!(e&&(e.text.length>0||e.tags.length>0))}function Od(e){const t=[],n=new Set;return{text:e.trim().replace(/(^|\s)tag:([^\s]+)/gi,(o,r,l)=>{const a=l.trim().toLowerCase();return a&&!n.has(a)&&(n.add(a),t.push(a)),r}).trim().toLowerCase(),tags:t}}function Va(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const s of e){if(typeof s!="string")continue;const i=s.trim();if(!i)continue;const o=i.toLowerCase();t.has(o)||(t.add(o),n.push(i))}return n}function Zt(e,t,n){const s=bt(e,n),i=s?.label??t.title??
|
|
4206
|
+
`};function kn(e){return!!(e&&(e.text.length>0||e.tags.length>0))}function Od(e){const t=[],n=new Set;return{text:e.trim().replace(/(^|\s)tag:([^\s]+)/gi,(o,r,l)=>{const a=l.trim().toLowerCase();return a&&!n.has(a)&&(n.add(a),t.push(a)),r}).trim().toLowerCase(),tags:t}}function Va(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const s of e){if(typeof s!="string")continue;const i=s.trim();if(!i)continue;const o=i.toLowerCase();t.has(o)||(t.add(o),n.push(i))}return n}function Zt(e,t,n){const s=bt(e,n),i=s?.label??t.title??ni(String(e.at(-1))),o=s?.help??t.description,r=Va(t["x-tags"]??t.tags),l=Va(s?.tags);return{label:i,help:o,tags:l.length>0?l:r}}function Wb(e,t){if(!e)return!0;for(const n of t)if(n&&n.toLowerCase().includes(e))return!0;return!1}function qb(e,t){if(e.length===0)return!0;const n=new Set(t.map(s=>s.toLowerCase()));return e.every(s=>n.has(s))}function fr(e){const{schema:t,path:n,hints:s,criteria:i}=e;if(!kn(i))return!0;const{label:o,help:r,tags:l}=Zt(n,t,s);if(!qb(i.tags,l))return!1;if(!i.text)return!0;const a=n.filter(g=>typeof g=="string").join("."),d=t.enum&&t.enum.length>0?t.enum.map(g=>String(g)).join(" "):"";return Wb(i.text,[o,r,t.title,t.description,a,d])}function vn(e){const{schema:t,value:n,path:s,hints:i,criteria:o}=e;if(!kn(o)||fr({schema:t,path:s,hints:i,criteria:o}))return!0;const r=ve(t);if(r==="object"){const l=n??t.default,a=l&&typeof l=="object"&&!Array.isArray(l)?l:{},d=t.properties??{};for(const[u,f]of Object.entries(d))if(vn({schema:f,value:a[u],path:[...s,u],hints:i,criteria:o}))return!0;const g=t.additionalProperties;if(g&&typeof g=="object"){const u=new Set(Object.keys(d));for(const[f,v]of Object.entries(a))if(!u.has(f)&&vn({schema:g,value:v,path:[...s,f],hints:i,criteria:o}))return!0}return!1}if(r==="array"){const l=Array.isArray(t.items)?t.items[0]:t.items;if(!l)return!1;const a=Array.isArray(n)?n:Array.isArray(t.default)?t.default:[];if(a.length===0)return!1;for(let d=0;d<a.length;d+=1)if(vn({schema:l,value:a[d],path:[...s,d],hints:i,criteria:o}))return!0}return!1}function $t(e){return e.length===0?h:c`
|
|
4207
4207
|
<div class="cfg-tags">
|
|
4208
4208
|
${e.map(t=>c`<span class="cfg-tag">${t}</span>`)}
|
|
4209
4209
|
</div>
|
|
@@ -4338,8 +4338,8 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4338
4338
|
`)}
|
|
4339
4339
|
</select>
|
|
4340
4340
|
</div>
|
|
4341
|
-
`}function Vb(e){const{schema:t,value:n,path:s,hints:i,unsupported:o,disabled:r,onPatch:l,searchCriteria:a}=e,d=e.showLabel??!0,{label:g,help:u,tags:f}=Zt(s,t,i),m=(a&&kn(a)?fr({schema:t,path:s,hints:i,criteria:a}):!1)?void 0:a,S=n??t.default,C=S&&typeof S=="object"&&!Array.isArray(S)?S:{},R=t.properties??{},A=Object.entries(R).toSorted((
|
|
4342
|
-
${A.map(([
|
|
4341
|
+
`}function Vb(e){const{schema:t,value:n,path:s,hints:i,unsupported:o,disabled:r,onPatch:l,searchCriteria:a}=e,d=e.showLabel??!0,{label:g,help:u,tags:f}=Zt(s,t,i),m=(a&&kn(a)?fr({schema:t,path:s,hints:i,criteria:a}):!1)?void 0:a,S=n??t.default,C=S&&typeof S=="object"&&!Array.isArray(S)?S:{},R=t.properties??{},A=Object.entries(R).toSorted((K,G)=>{const b=bt([...s,K[0]],i)?.order??0,T=bt([...s,G[0]],i)?.order??0;return b!==T?b-T:K[0].localeCompare(G[0])}),w=new Set(Object.keys(R)),L=t.additionalProperties,_=!!L&&typeof L=="object",M=c`
|
|
4342
|
+
${A.map(([K,G])=>Ct({schema:G,value:C[K],path:[...s,K],hints:i,unsupported:o,disabled:r,searchCriteria:m,onPatch:l}))}
|
|
4343
4343
|
${_?Qb({schema:L,value:C,path:s,hints:i,unsupported:o,disabled:r,reservedKeys:w,searchCriteria:m,onPatch:l}):h}
|
|
4344
4344
|
`;return s.length===1?c`
|
|
4345
4345
|
<div class="cfg-fields">
|
|
@@ -4673,7 +4673,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4673
4673
|
</div>
|
|
4674
4674
|
`:c`
|
|
4675
4675
|
<div class="config-form config-form--modern">
|
|
4676
|
-
${u?(()=>{const{sectionKey:f,subsectionKey:v,schema:m}=u,S=bt([f,v],e.uiHints),C=S?.label??m.title??
|
|
4676
|
+
${u?(()=>{const{sectionKey:f,subsectionKey:v,schema:m}=u,S=bt([f,v],e.uiHints),C=S?.label??m.title??ni(v),R=S?.help??m.description??"",I=n[f],A=I&&typeof I=="object"?I[v]:void 0,w=`config-section-${f}-${v}`;return c`
|
|
4677
4677
|
<section class="config-section-card" id=${w}>
|
|
4678
4678
|
<div class="config-section-card__header">
|
|
4679
4679
|
<span class="config-section-card__icon">${Xa(f)}</span>
|
|
@@ -4905,7 +4905,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4905
4905
|
`:h}
|
|
4906
4906
|
</div>
|
|
4907
4907
|
</div>
|
|
4908
|
-
`},R=()=>{if(S&&r)return mg({state:o,callbacks:r,accountId:s[0]?.accountId??"default"});const I=a?.profile??n?.profile,{name:A,displayName:w,about:L,picture:_,nip05:M}=I??{},
|
|
4908
|
+
`},R=()=>{if(S&&r)return mg({state:o,callbacks:r,accountId:s[0]?.accountId??"default"});const I=a?.profile??n?.profile,{name:A,displayName:w,about:L,picture:_,nip05:M}=I??{},K=A||w||L||_||M;return c`
|
|
4909
4909
|
<div style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
|
|
4910
4910
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
|
4911
4911
|
<div style="font-weight: 500;">Profile</div>
|
|
@@ -4919,7 +4919,7 @@ Deletes the session entry and archives its transcript.`))return!1;e.sessionsLoad
|
|
|
4919
4919
|
</button>
|
|
4920
4920
|
`:h}
|
|
4921
4921
|
</div>
|
|
4922
|
-
${
|
|
4922
|
+
${K?c`
|
|
4923
4923
|
<div class="status-list">
|
|
4924
4924
|
${_?c`
|
|
4925
4925
|
<div style="margin-bottom: 8px;">
|
|
@@ -5327,11 +5327,11 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
5327
5327
|
`:h}
|
|
5328
5328
|
</div>
|
|
5329
5329
|
</div>
|
|
5330
|
-
`}const Wn=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Wn(s,t);return!0},Gs=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},jd=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Ry(t)}};function Iy(e){this._$AN!==void 0?(Gs(this),this._$AM=e,jd(this)):this._$AM=e}function My(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let o=n;o<s.length;o++)Wn(s[o],!1),Gs(s[o]);else s!=null&&(Wn(s,!1),Gs(s));else Wn(this,e)}const Ry=e=>{e.type==cr.CHILD&&(e._$AP??=My,e._$AQ??=Iy)};class Ly extends ur{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),jd(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Wn(this,t),Gs(this))}setValue(t){if(Ev(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Bi=new WeakMap,Dy=dr(class extends Ly{render(e){return h}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),h}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Bi.get(t);n===void 0&&(n=new WeakMap,Bi.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"?Bi.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 yo extends ur{constructor(t){if(super(t),this.it=h,t.type!==cr.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===h||t==null)return this._t=void 0,this.it=t;if(t===wt)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}yo.directiveName="unsafeHTML",yo.resultType=1;const $o=dr(yo);const{entries:Kd,setPrototypeOf:el,isFrozen:Py,getPrototypeOf:Fy,getOwnPropertyDescriptor:Ny}=Object;let{freeze:Te,seal:Oe,create:xo}=Object,{apply:wo,construct:So}=typeof Reflect<"u"&&Reflect;Te||(Te=function(t){return t});Oe||(Oe=function(t){return t});wo||(wo=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;o<s;o++)i[o-2]=arguments[o];return t.apply(n,i)});So||(So=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Ss=Ee(Array.prototype.forEach),Oy=Ee(Array.prototype.lastIndexOf),tl=Ee(Array.prototype.pop),Mn=Ee(Array.prototype.push),Uy=Ee(Array.prototype.splice),Ls=Ee(String.prototype.toLowerCase),Hi=Ee(String.prototype.toString),zi=Ee(String.prototype.match),Rn=Ee(String.prototype.replace),By=Ee(String.prototype.indexOf),Hy=Ee(String.prototype.trim),Ue=Ee(Object.prototype.hasOwnProperty),ke=Ee(RegExp.prototype.test),Ln=zy(TypeError);function Ee(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return wo(e,t,s)}}function zy(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return So(e,n)}}function Q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ls;el&&el(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const o=n(i);o!==i&&(Py(t)||(t[s]=o),i=o)}e[i]=!0}return e}function jy(e){for(let t=0;t<e.length;t++)Ue(e,t)||(e[t]=null);return e}function Ve(e){const t=xo(null);for(const[n,s]of Kd(e))Ue(e,n)&&(Array.isArray(s)?t[n]=jy(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Ve(s):t[n]=s);return t}function Dn(e,t){for(;e!==null;){const s=Ny(e,t);if(s){if(s.get)return Ee(s.get);if(typeof s.value=="function")return Ee(s.value)}e=Fy(e)}function n(){return null}return n}const nl=Te(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ji=Te(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ki=Te(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ky=Te(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Wi=Te(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Wy=Te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sl=Te(["#text"]),il=Te(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),qi=Te(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ol=Te(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ks=Te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qy=Oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Gy=Oe(/<%[\w\W]*|[\w\W]*%>/gm),Vy=Oe(/\$\{[\w\W]*/gm),Jy=Oe(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qy=Oe(/^aria-[\-\w]+$/),Wd=Oe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yy=Oe(/^(?:\w+script|data):/i),Xy=Oe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qd=Oe(/^html$/i),Zy=Oe(/^[a-z][.\w]*(-[.\w]+)+$/i);var rl=Object.freeze({__proto__:null,ARIA_ATTR:Qy,ATTR_WHITESPACE:Xy,CUSTOM_ELEMENT:Zy,DATA_ATTR:Jy,DOCTYPE_NAME:qd,ERB_EXPR:Gy,IS_ALLOWED_URI:Wd,IS_SCRIPT_OR_DATA:Yy,MUSTACHE_EXPR:qy,TMPLIT_EXPR:Vy});const Pn={element:1,text:3,progressingInstruction:7,comment:8,document:9},e0=function(){return typeof window>"u"?null:window},t0=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const o="dompurify"+(s?"#"+s:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},al=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Gd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e0();const t=z=>Gd(z);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Pn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:l,Element:a,NodeFilter:d,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:v}=e,m=a.prototype,S=Dn(m,"cloneNode"),C=Dn(m,"remove"),R=Dn(m,"nextSibling"),I=Dn(m,"childNodes"),A=Dn(m,"parentNode");if(typeof r=="function"){const z=n.createElement("template");z.content&&z.content.ownerDocument&&(n=z.content.ownerDocument)}let w,L="";const{implementation:_,createNodeIterator:M,createDocumentFragment:j,getElementsByTagName:G}=n,{importNode:b}=s;let T=al();t.isSupported=typeof Kd=="function"&&typeof A=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:K,TMPLIT_EXPR:V,DATA_ATTR:E,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:q,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:re}=rl;let{IS_ALLOWED_URI:D}=rl,F=null;const J=Q({},[...nl,...ji,...Ki,...Wi,...sl]);let Y=null;const ue=Q({},[...il,...qi,...ol,...ks]);let ee=Object.seal(xo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ae=null,X=null;const W=Object.seal(xo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,de=!0,be=!1,Le=!0,Xe=!1,lt=!0,ye=!1,je=!1,Ze=!1,et=!1,tt=!1,ct=!1,dt=!0,_t=!1;const vi="user-content-";let tn=!0,ut=!1,Ke={},_e=null;const Tn=Q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let nn=null;const gt=Q({},["audio","video","img","source","image","track"]);let bi=null;const Er=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ds="http://www.w3.org/1998/Math/MathML",us="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let sn=nt,yi=!1,$i=null;const wu=Q({},[ds,us,nt],Hi);let gs=Q({},["mi","mo","mn","ms","mtext"]),fs=Q({},["annotation-xml"]);const Su=Q({},["title","style","font","a","script"]);let En=null;const ku=["application/xhtml+xml","text/html"],Au="text/html";let pe=null,on=null;const Cu=n.createElement("form"),_r=function(k){return k instanceof RegExp||k instanceof Function},xi=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(on&&on===k)){if((!k||typeof k!="object")&&(k={}),k=Ve(k),En=ku.indexOf(k.PARSER_MEDIA_TYPE)===-1?Au:k.PARSER_MEDIA_TYPE,pe=En==="application/xhtml+xml"?Hi:Ls,F=Ue(k,"ALLOWED_TAGS")?Q({},k.ALLOWED_TAGS,pe):J,Y=Ue(k,"ALLOWED_ATTR")?Q({},k.ALLOWED_ATTR,pe):ue,$i=Ue(k,"ALLOWED_NAMESPACES")?Q({},k.ALLOWED_NAMESPACES,Hi):wu,bi=Ue(k,"ADD_URI_SAFE_ATTR")?Q(Ve(Er),k.ADD_URI_SAFE_ATTR,pe):Er,nn=Ue(k,"ADD_DATA_URI_TAGS")?Q(Ve(gt),k.ADD_DATA_URI_TAGS,pe):gt,_e=Ue(k,"FORBID_CONTENTS")?Q({},k.FORBID_CONTENTS,pe):Tn,ae=Ue(k,"FORBID_TAGS")?Q({},k.FORBID_TAGS,pe):Ve({}),X=Ue(k,"FORBID_ATTR")?Q({},k.FORBID_ATTR,pe):Ve({}),Ke=Ue(k,"USE_PROFILES")?k.USE_PROFILES:!1,le=k.ALLOW_ARIA_ATTR!==!1,de=k.ALLOW_DATA_ATTR!==!1,be=k.ALLOW_UNKNOWN_PROTOCOLS||!1,Le=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Xe=k.SAFE_FOR_TEMPLATES||!1,lt=k.SAFE_FOR_XML!==!1,ye=k.WHOLE_DOCUMENT||!1,et=k.RETURN_DOM||!1,tt=k.RETURN_DOM_FRAGMENT||!1,ct=k.RETURN_TRUSTED_TYPE||!1,Ze=k.FORCE_BODY||!1,dt=k.SANITIZE_DOM!==!1,_t=k.SANITIZE_NAMED_PROPS||!1,tn=k.KEEP_CONTENT!==!1,ut=k.IN_PLACE||!1,D=k.ALLOWED_URI_REGEXP||Wd,sn=k.NAMESPACE||nt,gs=k.MATHML_TEXT_INTEGRATION_POINTS||gs,fs=k.HTML_INTEGRATION_POINTS||fs,ee=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&_r(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&_r(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Xe&&(de=!1),tt&&(et=!0),Ke&&(F=Q({},sl),Y=[],Ke.html===!0&&(Q(F,nl),Q(Y,il)),Ke.svg===!0&&(Q(F,ji),Q(Y,qi),Q(Y,ks)),Ke.svgFilters===!0&&(Q(F,Ki),Q(Y,qi),Q(Y,ks)),Ke.mathMl===!0&&(Q(F,Wi),Q(Y,ol),Q(Y,ks))),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?W.tagCheck=k.ADD_TAGS:(F===J&&(F=Ve(F)),Q(F,k.ADD_TAGS,pe))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?W.attributeCheck=k.ADD_ATTR:(Y===ue&&(Y=Ve(Y)),Q(Y,k.ADD_ATTR,pe))),k.ADD_URI_SAFE_ATTR&&Q(bi,k.ADD_URI_SAFE_ATTR,pe),k.FORBID_CONTENTS&&(_e===Tn&&(_e=Ve(_e)),Q(_e,k.FORBID_CONTENTS,pe)),k.ADD_FORBID_CONTENTS&&(_e===Tn&&(_e=Ve(_e)),Q(_e,k.ADD_FORBID_CONTENTS,pe)),tn&&(F["#text"]=!0),ye&&Q(F,["html","head","body"]),F.table&&(Q(F,["tbody"]),delete ae.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ln('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ln('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=k.TRUSTED_TYPES_POLICY,L=w.createHTML("")}else w===void 0&&(w=t0(v,i)),w!==null&&typeof L=="string"&&(L=w.createHTML(""));Te&&Te(k),on=k}},Ir=Q({},[...ji,...Ki,...Ky]),Mr=Q({},[...Wi,...Wy]),Tu=function(k){let P=A(k);(!P||!P.tagName)&&(P={namespaceURI:sn,tagName:"template"});const B=Ls(k.tagName),ce=Ls(P.tagName);return $i[k.namespaceURI]?k.namespaceURI===us?P.namespaceURI===nt?B==="svg":P.namespaceURI===ds?B==="svg"&&(ce==="annotation-xml"||gs[ce]):!!Ir[B]:k.namespaceURI===ds?P.namespaceURI===nt?B==="math":P.namespaceURI===us?B==="math"&&fs[ce]:!!Mr[B]:k.namespaceURI===nt?P.namespaceURI===us&&!fs[ce]||P.namespaceURI===ds&&!gs[ce]?!1:!Mr[B]&&(Su[B]||!Ir[B]):!!(En==="application/xhtml+xml"&&$i[k.namespaceURI]):!1},We=function(k){Mn(t.removed,{element:k});try{A(k).removeChild(k)}catch{C(k)}},It=function(k,P){try{Mn(t.removed,{attribute:P.getAttributeNode(k),from:P})}catch{Mn(t.removed,{attribute:null,from:P})}if(P.removeAttribute(k),k==="is")if(et||tt)try{We(P)}catch{}else try{P.setAttribute(k,"")}catch{}},Rr=function(k){let P=null,B=null;if(Ze)k="<remove></remove>"+k;else{const ge=zi(k,/^[\r\n\t ]+/);B=ge&&ge[0]}En==="application/xhtml+xml"&&sn===nt&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const ce=w?w.createHTML(k):k;if(sn===nt)try{P=new f().parseFromString(ce,En)}catch{}if(!P||!P.documentElement){P=_.createDocument(sn,"template",null);try{P.documentElement.innerHTML=yi?L:ce}catch{}}const we=P.body||P.documentElement;return k&&B&&we.insertBefore(n.createTextNode(B),we.childNodes[0]||null),sn===nt?G.call(P,ye?"html":"body")[0]:ye?P.documentElement:we},Lr=function(k){return M.call(k.ownerDocument||k,k,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},wi=function(k){return k instanceof u&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof g)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Dr=function(k){return typeof l=="function"&&k instanceof l};function st(z,k,P){Ss(z,B=>{B.call(t,k,P,on)})}const Pr=function(k){let P=null;if(st(T.beforeSanitizeElements,k,null),wi(k))return We(k),!0;const B=pe(k.nodeName);if(st(T.uponSanitizeElement,k,{tagName:B,allowedTags:F}),lt&&k.hasChildNodes()&&!Dr(k.firstElementChild)&&ke(/<[/\w!]/g,k.innerHTML)&&ke(/<[/\w!]/g,k.textContent)||k.nodeType===Pn.progressingInstruction||lt&&k.nodeType===Pn.comment&&ke(/<[/\w]/g,k.data))return We(k),!0;if(!(W.tagCheck instanceof Function&&W.tagCheck(B))&&(!F[B]||ae[B])){if(!ae[B]&&Nr(B)&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,B)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(B)))return!1;if(tn&&!_e[B]){const ce=A(k)||k.parentNode,we=I(k)||k.childNodes;if(we&&ce){const ge=we.length;for(let Ie=ge-1;Ie>=0;--Ie){const it=S(we[Ie],!0);it.__removalCount=(k.__removalCount||0)+1,ce.insertBefore(it,R(k))}}}return We(k),!0}return k instanceof a&&!Tu(k)||(B==="noscript"||B==="noembed"||B==="noframes")&&ke(/<\/no(script|embed|frames)/i,k.innerHTML)?(We(k),!0):(Xe&&k.nodeType===Pn.text&&(P=k.textContent,Ss([N,K,V],ce=>{P=Rn(P,ce," ")}),k.textContent!==P&&(Mn(t.removed,{element:k.cloneNode()}),k.textContent=P)),st(T.afterSanitizeElements,k,null),!1)},Fr=function(k,P,B){if(dt&&(P==="id"||P==="name")&&(B in n||B in Cu))return!1;if(!(de&&!X[P]&&ke(E,P))){if(!(le&&ke(O,P))){if(!(W.attributeCheck instanceof Function&&W.attributeCheck(P,k))){if(!Y[P]||X[P]){if(!(Nr(k)&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,k)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(k))&&(ee.attributeNameCheck instanceof RegExp&&ke(ee.attributeNameCheck,P)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(P,k))||P==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,B)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(B))))return!1}else if(!bi[P]){if(!ke(D,Rn(B,oe,""))){if(!((P==="src"||P==="xlink:href"||P==="href")&&k!=="script"&&By(B,"data:")===0&&nn[k])){if(!(be&&!ke(q,Rn(B,oe,"")))){if(B)return!1}}}}}}}return!0},Nr=function(k){return k!=="annotation-xml"&&zi(k,re)},Or=function(k){st(T.beforeSanitizeAttributes,k,null);const{attributes:P}=k;if(!P||wi(k))return;const B={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let ce=P.length;for(;ce--;){const we=P[ce],{name:ge,namespaceURI:Ie,value:it}=we,rn=pe(ge),Si=it;let $e=ge==="value"?Si:Hy(Si);if(B.attrName=rn,B.attrValue=$e,B.keepAttr=!0,B.forceKeepAttr=void 0,st(T.uponSanitizeAttribute,k,B),$e=B.attrValue,_t&&(rn==="id"||rn==="name")&&(It(ge,k),$e=vi+$e),lt&&ke(/((--!?|])>)|<\/(style|title|textarea)/i,$e)){It(ge,k);continue}if(rn==="attributename"&&zi($e,"href")){It(ge,k);continue}if(B.forceKeepAttr)continue;if(!B.keepAttr){It(ge,k);continue}if(!Le&&ke(/\/>/i,$e)){It(ge,k);continue}Xe&&Ss([N,K,V],Br=>{$e=Rn($e,Br," ")});const Ur=pe(k.nodeName);if(!Fr(Ur,rn,$e)){It(ge,k);continue}if(w&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Ie)switch(v.getAttributeType(Ur,rn)){case"TrustedHTML":{$e=w.createHTML($e);break}case"TrustedScriptURL":{$e=w.createScriptURL($e);break}}if($e!==Si)try{Ie?k.setAttributeNS(Ie,ge,$e):k.setAttribute(ge,$e),wi(k)?We(k):tl(t.removed)}catch{It(ge,k)}}st(T.afterSanitizeAttributes,k,null)},Eu=function z(k){let P=null;const B=Lr(k);for(st(T.beforeSanitizeShadowDOM,k,null);P=B.nextNode();)st(T.uponSanitizeShadowNode,P,null),Pr(P),Or(P),P.content instanceof o&&z(P.content);st(T.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(z){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=null,B=null,ce=null,we=null;if(yi=!z,yi&&(z="<!-->"),typeof z!="string"&&!Dr(z))if(typeof z.toString=="function"){if(z=z.toString(),typeof z!="string")throw Ln("dirty is not a string, aborting")}else throw Ln("toString is not a function");if(!t.isSupported)return z;if(je||xi(k),t.removed=[],typeof z=="string"&&(ut=!1),ut){if(z.nodeName){const it=pe(z.nodeName);if(!F[it]||ae[it])throw Ln("root node is forbidden and cannot be sanitized in-place")}}else if(z instanceof l)P=Rr("<!---->"),B=P.ownerDocument.importNode(z,!0),B.nodeType===Pn.element&&B.nodeName==="BODY"||B.nodeName==="HTML"?P=B:P.appendChild(B);else{if(!et&&!Xe&&!ye&&z.indexOf("<")===-1)return w&&ct?w.createHTML(z):z;if(P=Rr(z),!P)return et?null:ct?L:""}P&&Ze&&We(P.firstChild);const ge=Lr(ut?z:P);for(;ce=ge.nextNode();)Pr(ce),Or(ce),ce.content instanceof o&&Eu(ce.content);if(ut)return z;if(et){if(tt)for(we=j.call(P.ownerDocument);P.firstChild;)we.appendChild(P.firstChild);else we=P;return(Y.shadowroot||Y.shadowrootmode)&&(we=b.call(s,we,!0)),we}let Ie=ye?P.outerHTML:P.innerHTML;return ye&&F["!doctype"]&&P.ownerDocument&&P.ownerDocument.doctype&&P.ownerDocument.doctype.name&&ke(qd,P.ownerDocument.doctype.name)&&(Ie="<!DOCTYPE "+P.ownerDocument.doctype.name+`>
|
|
5331
|
-
`+Ie),Xe&&Ss([N,
|
|
5332
|
-
]`).replace("lheading",Qd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},h0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,m0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Xd=/^( {2,}|\\)\n(?!\s*$)/,v0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
5330
|
+
`}const Wn=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Wn(s,t);return!0},Vs=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},jd=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Ry(t)}};function Iy(e){this._$AN!==void 0?(Vs(this),this._$AM=e,jd(this)):this._$AM=e}function My(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let o=n;o<s.length;o++)Wn(s[o],!1),Vs(s[o]);else s!=null&&(Wn(s,!1),Vs(s));else Wn(this,e)}const Ry=e=>{e.type==cr.CHILD&&(e._$AP??=My,e._$AQ??=Iy)};class Ly extends ur{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),jd(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Wn(this,t),Vs(this))}setValue(t){if(Ev(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Hi=new WeakMap,Dy=dr(class extends Ly{render(e){return h}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),h}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Hi.get(t);n===void 0&&(n=new WeakMap,Hi.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Hi.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class $o extends ur{constructor(t){if(super(t),this.it=h,t.type!==cr.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===h||t==null)return this._t=void 0,this.it=t;if(t===wt)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}$o.directiveName="unsafeHTML",$o.resultType=1;const xo=dr($o);const{entries:Kd,setPrototypeOf:el,isFrozen:Py,getPrototypeOf:Fy,getOwnPropertyDescriptor:Ny}=Object;let{freeze:Te,seal:Ue,create:Ls}=Object,{apply:wo,construct:So}=typeof Reflect<"u"&&Reflect;Te||(Te=function(t){return t});Ue||(Ue=function(t){return t});wo||(wo=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;o<s;o++)i[o-2]=arguments[o];return t.apply(n,i)});So||(So=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Ss=Ee(Array.prototype.forEach),Oy=Ee(Array.prototype.lastIndexOf),tl=Ee(Array.prototype.pop),Mn=Ee(Array.prototype.push),Uy=Ee(Array.prototype.splice),Ds=Ee(String.prototype.toLowerCase),zi=Ee(String.prototype.toString),ji=Ee(String.prototype.match),Rn=Ee(String.prototype.replace),By=Ee(String.prototype.indexOf),Hy=Ee(String.prototype.trim),De=Ee(Object.prototype.hasOwnProperty),ke=Ee(RegExp.prototype.test),Ln=zy(TypeError);function Ee(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return wo(e,t,s)}}function zy(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return So(e,n)}}function Q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ds;el&&el(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const o=n(i);o!==i&&(Py(t)||(t[s]=o),i=o)}e[i]=!0}return e}function jy(e){for(let t=0;t<e.length;t++)De(e,t)||(e[t]=null);return e}function Ve(e){const t=Ls(null);for(const[n,s]of Kd(e))De(e,n)&&(Array.isArray(s)?t[n]=jy(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Ve(s):t[n]=s);return t}function Dn(e,t){for(;e!==null;){const s=Ny(e,t);if(s){if(s.get)return Ee(s.get);if(typeof s.value=="function")return Ee(s.value)}e=Fy(e)}function n(){return null}return n}const nl=Te(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ki=Te(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Wi=Te(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ky=Te(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),qi=Te(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Wy=Te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sl=Te(["#text"]),il=Te(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Gi=Te(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ol=Te(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ks=Te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qy=Ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Gy=Ue(/<%[\w\W]*|[\w\W]*%>/gm),Vy=Ue(/\$\{[\w\W]*/gm),Jy=Ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qy=Ue(/^aria-[\-\w]+$/),Wd=Ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yy=Ue(/^(?:\w+script|data):/i),Xy=Ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qd=Ue(/^html$/i),Zy=Ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var rl=Object.freeze({__proto__:null,ARIA_ATTR:Qy,ATTR_WHITESPACE:Xy,CUSTOM_ELEMENT:Zy,DATA_ATTR:Jy,DOCTYPE_NAME:qd,ERB_EXPR:Gy,IS_ALLOWED_URI:Wd,IS_SCRIPT_OR_DATA:Yy,MUSTACHE_EXPR:qy,TMPLIT_EXPR:Vy});const Pn={element:1,text:3,progressingInstruction:7,comment:8,document:9},e0=function(){return typeof window>"u"?null:window},t0=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const o="dompurify"+(s?"#"+s:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},al=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Gd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e0();const t=j=>Gd(j);if(t.version="3.3.3",t.removed=[],!e||!e.document||e.document.nodeType!==Pn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:l,Element:a,NodeFilter:d,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:v}=e,m=a.prototype,S=Dn(m,"cloneNode"),C=Dn(m,"remove"),R=Dn(m,"nextSibling"),I=Dn(m,"childNodes"),A=Dn(m,"parentNode");if(typeof r=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let w,L="";const{implementation:_,createNodeIterator:M,createDocumentFragment:K,getElementsByTagName:G}=n,{importNode:b}=s;let T=al();t.isSupported=typeof Kd=="function"&&typeof A=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:W,TMPLIT_EXPR:V,DATA_ATTR:E,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:q,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:re}=rl;let{IS_ALLOWED_URI:D}=rl,F=null;const J=Q({},[...nl,...Ki,...Wi,...qi,...sl]);let Y=null;const ue=Q({},[...il,...Gi,...ol,...ks]);let ee=Object.seal(Ls(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ae=null,X=null;const z=Object.seal(Ls(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,de=!0,be=!1,Le=!0,Xe=!1,lt=!0,ye=!1,je=!1,Ze=!1,et=!1,tt=!1,ct=!1,dt=!0,_t=!1;const bi="user-content-";let tn=!0,ut=!1,Ke={},_e=null;const Tn=Q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let nn=null;const gt=Q({},["audio","video","img","source","image","track"]);let yi=null;const Er=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ds="http://www.w3.org/1998/Math/MathML",us="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let sn=nt,$i=!1,xi=null;const wu=Q({},[ds,us,nt],zi);let gs=Q({},["mi","mo","mn","ms","mtext"]),fs=Q({},["annotation-xml"]);const Su=Q({},["title","style","font","a","script"]);let En=null;const ku=["application/xhtml+xml","text/html"],Au="text/html";let pe=null,on=null;const Cu=n.createElement("form"),_r=function(k){return k instanceof RegExp||k instanceof Function},wi=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(on&&on===k)){if((!k||typeof k!="object")&&(k={}),k=Ve(k),En=ku.indexOf(k.PARSER_MEDIA_TYPE)===-1?Au:k.PARSER_MEDIA_TYPE,pe=En==="application/xhtml+xml"?zi:Ds,F=De(k,"ALLOWED_TAGS")?Q({},k.ALLOWED_TAGS,pe):J,Y=De(k,"ALLOWED_ATTR")?Q({},k.ALLOWED_ATTR,pe):ue,xi=De(k,"ALLOWED_NAMESPACES")?Q({},k.ALLOWED_NAMESPACES,zi):wu,yi=De(k,"ADD_URI_SAFE_ATTR")?Q(Ve(Er),k.ADD_URI_SAFE_ATTR,pe):Er,nn=De(k,"ADD_DATA_URI_TAGS")?Q(Ve(gt),k.ADD_DATA_URI_TAGS,pe):gt,_e=De(k,"FORBID_CONTENTS")?Q({},k.FORBID_CONTENTS,pe):Tn,ae=De(k,"FORBID_TAGS")?Q({},k.FORBID_TAGS,pe):Ve({}),X=De(k,"FORBID_ATTR")?Q({},k.FORBID_ATTR,pe):Ve({}),Ke=De(k,"USE_PROFILES")?k.USE_PROFILES:!1,le=k.ALLOW_ARIA_ATTR!==!1,de=k.ALLOW_DATA_ATTR!==!1,be=k.ALLOW_UNKNOWN_PROTOCOLS||!1,Le=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Xe=k.SAFE_FOR_TEMPLATES||!1,lt=k.SAFE_FOR_XML!==!1,ye=k.WHOLE_DOCUMENT||!1,et=k.RETURN_DOM||!1,tt=k.RETURN_DOM_FRAGMENT||!1,ct=k.RETURN_TRUSTED_TYPE||!1,Ze=k.FORCE_BODY||!1,dt=k.SANITIZE_DOM!==!1,_t=k.SANITIZE_NAMED_PROPS||!1,tn=k.KEEP_CONTENT!==!1,ut=k.IN_PLACE||!1,D=k.ALLOWED_URI_REGEXP||Wd,sn=k.NAMESPACE||nt,gs=k.MATHML_TEXT_INTEGRATION_POINTS||gs,fs=k.HTML_INTEGRATION_POINTS||fs,ee=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&_r(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&_r(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Xe&&(de=!1),tt&&(et=!0),Ke&&(F=Q({},sl),Y=Ls(null),Ke.html===!0&&(Q(F,nl),Q(Y,il)),Ke.svg===!0&&(Q(F,Ki),Q(Y,Gi),Q(Y,ks)),Ke.svgFilters===!0&&(Q(F,Wi),Q(Y,Gi),Q(Y,ks)),Ke.mathMl===!0&&(Q(F,qi),Q(Y,ol),Q(Y,ks))),De(k,"ADD_TAGS")||(z.tagCheck=null),De(k,"ADD_ATTR")||(z.attributeCheck=null),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?z.tagCheck=k.ADD_TAGS:(F===J&&(F=Ve(F)),Q(F,k.ADD_TAGS,pe))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?z.attributeCheck=k.ADD_ATTR:(Y===ue&&(Y=Ve(Y)),Q(Y,k.ADD_ATTR,pe))),k.ADD_URI_SAFE_ATTR&&Q(yi,k.ADD_URI_SAFE_ATTR,pe),k.FORBID_CONTENTS&&(_e===Tn&&(_e=Ve(_e)),Q(_e,k.FORBID_CONTENTS,pe)),k.ADD_FORBID_CONTENTS&&(_e===Tn&&(_e=Ve(_e)),Q(_e,k.ADD_FORBID_CONTENTS,pe)),tn&&(F["#text"]=!0),ye&&Q(F,["html","head","body"]),F.table&&(Q(F,["tbody"]),delete ae.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ln('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ln('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=k.TRUSTED_TYPES_POLICY,L=w.createHTML("")}else w===void 0&&(w=t0(v,i)),w!==null&&typeof L=="string"&&(L=w.createHTML(""));Te&&Te(k),on=k}},Ir=Q({},[...Ki,...Wi,...Ky]),Mr=Q({},[...qi,...Wy]),Tu=function(k){let P=A(k);(!P||!P.tagName)&&(P={namespaceURI:sn,tagName:"template"});const B=Ds(k.tagName),ce=Ds(P.tagName);return xi[k.namespaceURI]?k.namespaceURI===us?P.namespaceURI===nt?B==="svg":P.namespaceURI===ds?B==="svg"&&(ce==="annotation-xml"||gs[ce]):!!Ir[B]:k.namespaceURI===ds?P.namespaceURI===nt?B==="math":P.namespaceURI===us?B==="math"&&fs[ce]:!!Mr[B]:k.namespaceURI===nt?P.namespaceURI===us&&!fs[ce]||P.namespaceURI===ds&&!gs[ce]?!1:!Mr[B]&&(Su[B]||!Ir[B]):!!(En==="application/xhtml+xml"&&xi[k.namespaceURI]):!1},We=function(k){Mn(t.removed,{element:k});try{A(k).removeChild(k)}catch{C(k)}},It=function(k,P){try{Mn(t.removed,{attribute:P.getAttributeNode(k),from:P})}catch{Mn(t.removed,{attribute:null,from:P})}if(P.removeAttribute(k),k==="is")if(et||tt)try{We(P)}catch{}else try{P.setAttribute(k,"")}catch{}},Rr=function(k){let P=null,B=null;if(Ze)k="<remove></remove>"+k;else{const ge=ji(k,/^[\r\n\t ]+/);B=ge&&ge[0]}En==="application/xhtml+xml"&&sn===nt&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const ce=w?w.createHTML(k):k;if(sn===nt)try{P=new f().parseFromString(ce,En)}catch{}if(!P||!P.documentElement){P=_.createDocument(sn,"template",null);try{P.documentElement.innerHTML=$i?L:ce}catch{}}const we=P.body||P.documentElement;return k&&B&&we.insertBefore(n.createTextNode(B),we.childNodes[0]||null),sn===nt?G.call(P,ye?"html":"body")[0]:ye?P.documentElement:we},Lr=function(k){return M.call(k.ownerDocument||k,k,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Si=function(k){return k instanceof u&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof g)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Dr=function(k){return typeof l=="function"&&k instanceof l};function st(j,k,P){Ss(j,B=>{B.call(t,k,P,on)})}const Pr=function(k){let P=null;if(st(T.beforeSanitizeElements,k,null),Si(k))return We(k),!0;const B=pe(k.nodeName);if(st(T.uponSanitizeElement,k,{tagName:B,allowedTags:F}),lt&&k.hasChildNodes()&&!Dr(k.firstElementChild)&&ke(/<[/\w!]/g,k.innerHTML)&&ke(/<[/\w!]/g,k.textContent)||k.nodeType===Pn.progressingInstruction||lt&&k.nodeType===Pn.comment&&ke(/<[/\w]/g,k.data))return We(k),!0;if(!(z.tagCheck instanceof Function&&z.tagCheck(B))&&(!F[B]||ae[B])){if(!ae[B]&&Nr(B)&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,B)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(B)))return!1;if(tn&&!_e[B]){const ce=A(k)||k.parentNode,we=I(k)||k.childNodes;if(we&&ce){const ge=we.length;for(let Ie=ge-1;Ie>=0;--Ie){const it=S(we[Ie],!0);it.__removalCount=(k.__removalCount||0)+1,ce.insertBefore(it,R(k))}}}return We(k),!0}return k instanceof a&&!Tu(k)||(B==="noscript"||B==="noembed"||B==="noframes")&&ke(/<\/no(script|embed|frames)/i,k.innerHTML)?(We(k),!0):(Xe&&k.nodeType===Pn.text&&(P=k.textContent,Ss([N,W,V],ce=>{P=Rn(P,ce," ")}),k.textContent!==P&&(Mn(t.removed,{element:k.cloneNode()}),k.textContent=P)),st(T.afterSanitizeElements,k,null),!1)},Fr=function(k,P,B){if(X[P]||dt&&(P==="id"||P==="name")&&(B in n||B in Cu))return!1;if(!(de&&!X[P]&&ke(E,P))){if(!(le&&ke(O,P))){if(!(z.attributeCheck instanceof Function&&z.attributeCheck(P,k))){if(!Y[P]||X[P]){if(!(Nr(k)&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,k)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(k))&&(ee.attributeNameCheck instanceof RegExp&&ke(ee.attributeNameCheck,P)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(P,k))||P==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&ke(ee.tagNameCheck,B)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(B))))return!1}else if(!yi[P]){if(!ke(D,Rn(B,oe,""))){if(!((P==="src"||P==="xlink:href"||P==="href")&&k!=="script"&&By(B,"data:")===0&&nn[k])){if(!(be&&!ke(q,Rn(B,oe,"")))){if(B)return!1}}}}}}}return!0},Nr=function(k){return k!=="annotation-xml"&&ji(k,re)},Or=function(k){st(T.beforeSanitizeAttributes,k,null);const{attributes:P}=k;if(!P||Si(k))return;const B={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let ce=P.length;for(;ce--;){const we=P[ce],{name:ge,namespaceURI:Ie,value:it}=we,rn=pe(ge),ki=it;let $e=ge==="value"?ki:Hy(ki);if(B.attrName=rn,B.attrValue=$e,B.keepAttr=!0,B.forceKeepAttr=void 0,st(T.uponSanitizeAttribute,k,B),$e=B.attrValue,_t&&(rn==="id"||rn==="name")&&(It(ge,k),$e=bi+$e),lt&&ke(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$e)){It(ge,k);continue}if(rn==="attributename"&&ji($e,"href")){It(ge,k);continue}if(B.forceKeepAttr)continue;if(!B.keepAttr){It(ge,k);continue}if(!Le&&ke(/\/>/i,$e)){It(ge,k);continue}Xe&&Ss([N,W,V],Br=>{$e=Rn($e,Br," ")});const Ur=pe(k.nodeName);if(!Fr(Ur,rn,$e)){It(ge,k);continue}if(w&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Ie)switch(v.getAttributeType(Ur,rn)){case"TrustedHTML":{$e=w.createHTML($e);break}case"TrustedScriptURL":{$e=w.createScriptURL($e);break}}if($e!==ki)try{Ie?k.setAttributeNS(Ie,ge,$e):k.setAttribute(ge,$e),Si(k)?We(k):tl(t.removed)}catch{It(ge,k)}}st(T.afterSanitizeAttributes,k,null)},Eu=function j(k){let P=null;const B=Lr(k);for(st(T.beforeSanitizeShadowDOM,k,null);P=B.nextNode();)st(T.uponSanitizeShadowNode,P,null),Pr(P),Or(P),P.content instanceof o&&j(P.content);st(T.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(j){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=null,B=null,ce=null,we=null;if($i=!j,$i&&(j="<!-->"),typeof j!="string"&&!Dr(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Ln("dirty is not a string, aborting")}else throw Ln("toString is not a function");if(!t.isSupported)return j;if(je||wi(k),t.removed=[],typeof j=="string"&&(ut=!1),ut){if(j.nodeName){const it=pe(j.nodeName);if(!F[it]||ae[it])throw Ln("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof l)P=Rr("<!---->"),B=P.ownerDocument.importNode(j,!0),B.nodeType===Pn.element&&B.nodeName==="BODY"||B.nodeName==="HTML"?P=B:P.appendChild(B);else{if(!et&&!Xe&&!ye&&j.indexOf("<")===-1)return w&&ct?w.createHTML(j):j;if(P=Rr(j),!P)return et?null:ct?L:""}P&&Ze&&We(P.firstChild);const ge=Lr(ut?j:P);for(;ce=ge.nextNode();)Pr(ce),Or(ce),ce.content instanceof o&&Eu(ce.content);if(ut)return j;if(et){if(tt)for(we=K.call(P.ownerDocument);P.firstChild;)we.appendChild(P.firstChild);else we=P;return(Y.shadowroot||Y.shadowrootmode)&&(we=b.call(s,we,!0)),we}let Ie=ye?P.outerHTML:P.innerHTML;return ye&&F["!doctype"]&&P.ownerDocument&&P.ownerDocument.doctype&&P.ownerDocument.doctype.name&&ke(qd,P.ownerDocument.doctype.name)&&(Ie="<!DOCTYPE "+P.ownerDocument.doctype.name+`>
|
|
5331
|
+
`+Ie),Xe&&Ss([N,W,V],it=>{Ie=Rn(Ie,it," ")}),w&&ct?w.createHTML(Ie):Ie},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};wi(j),je=!0},t.clearConfig=function(){on=null,je=!1},t.isValidAttribute=function(j,k,P){on||wi({});const B=pe(j),ce=pe(k);return Fr(B,ce,P)},t.addHook=function(j,k){typeof k=="function"&&Mn(T[j],k)},t.removeHook=function(j,k){if(k!==void 0){const P=Oy(T[j],k);return P===-1?void 0:Uy(T[j],P,1)[0]}return tl(T[j])},t.removeHooks=function(j){T[j]=[]},t.removeAllHooks=function(){T=al()},t}var ko=Gd();function hr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var en=hr();function Vd(e){en=e}var jt={exec:()=>null};function Z(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(Ce.caret,"$1"),n=n.replace(i,r),s},getRegex:()=>new RegExp(n,t)};return s}var n0=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ce={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},s0=/^(?:[ \t]*(?:\n|$))+/,i0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,o0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,r0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,mr=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Jd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qd=Z(Jd).replace(/bull/g,mr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),a0=Z(Jd).replace(/bull/g,mr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),vr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,l0=/^[^\n]+/,br=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,c0=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",br).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),d0=Z(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mr).getRegex(),hi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,u0=Z("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",yr).replace("tag",hi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Yd=Z(vr).replace("hr",cs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hi).getRegex(),g0=Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Yd).getRegex(),$r={blockquote:g0,code:i0,def:c0,fences:o0,heading:r0,hr:cs,html:u0,lheading:Qd,list:d0,newline:s0,paragraph:Yd,table:jt,text:l0},ll=Z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hi).getRegex(),f0={...$r,lheading:a0,table:ll,paragraph:Z(vr).replace("hr",cs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ll).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",hi).getRegex()},p0={...$r,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:jt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(vr).replace("hr",cs).replace("heading",` *#{1,6} *[^
|
|
5332
|
+
]`).replace("lheading",Qd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},h0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,m0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Xd=/^( {2,}|\\)\n(?!\s*$)/,v0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,mi=/[\p{P}\p{S}]/u,xr=/[\s\p{P}\p{S}]/u,Zd=/[^\s\p{P}\p{S}]/u,b0=Z(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,xr).getRegex(),eu=/(?!~)[\p{P}\p{S}]/u,y0=/(?!~)[\s\p{P}\p{S}]/u,$0=/(?:[^\s\p{P}\p{S}]|~)/u,tu=/(?![*_])[\p{P}\p{S}]/u,x0=/(?![*_])[\s\p{P}\p{S}]/u,w0=/(?:[^\s\p{P}\p{S}]|[*_])/u,S0=Z(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",n0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),nu=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,k0=Z(nu,"u").replace(/punct/g,mi).getRegex(),A0=Z(nu,"u").replace(/punct/g,eu).getRegex(),su="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",C0=Z(su,"gu").replace(/notPunctSpace/g,Zd).replace(/punctSpace/g,xr).replace(/punct/g,mi).getRegex(),T0=Z(su,"gu").replace(/notPunctSpace/g,$0).replace(/punctSpace/g,y0).replace(/punct/g,eu).getRegex(),E0=Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Zd).replace(/punctSpace/g,xr).replace(/punct/g,mi).getRegex(),_0=Z(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,tu).getRegex(),I0="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",M0=Z(I0,"gu").replace(/notPunctSpace/g,w0).replace(/punctSpace/g,x0).replace(/punct/g,tu).getRegex(),R0=Z(/\\(punct)/,"gu").replace(/punct/g,mi).getRegex(),L0=Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),D0=Z(yr).replace("(?:-->|$)","-->").getRegex(),P0=Z("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",D0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Js=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,F0=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Js).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),iu=Z(/^!?\[(label)\]\[(ref)\]/).replace("label",Js).replace("ref",br).getRegex(),ou=Z(/^!?\[(ref)\](?:\[\])?/).replace("ref",br).getRegex(),N0=Z("reflink|nolink(?!\\()","g").replace("reflink",iu).replace("nolink",ou).getRegex(),cl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,wr={_backpedal:jt,anyPunctuation:R0,autolink:L0,blockSkip:S0,br:Xd,code:m0,del:jt,delLDelim:jt,delRDelim:jt,emStrongLDelim:k0,emStrongRDelimAst:C0,emStrongRDelimUnd:E0,escape:h0,link:F0,nolink:ou,punctuation:b0,reflink:iu,reflinkSearch:N0,tag:P0,text:v0,url:jt},O0={...wr,link:Z(/^!?\[(label)\]\((.*?)\)/).replace("label",Js).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Js).getRegex()},Ao={...wr,emStrongRDelimAst:T0,emStrongLDelim:A0,delLDelim:_0,delRDelim:M0,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",cl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Z(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",cl).getRegex()},U0={...Ao,br:Z(Xd).replace("{2,}","*").getRegex(),text:Z(Ao.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},As={normal:$r,gfm:f0,pedantic:p0},Fn={normal:wr,gfm:Ao,breaks:U0,pedantic:O0},B0={"&":"&","<":"<",">":">",'"':""","'":"'"},dl=e=>B0[e];function Je(e,t){if(t){if(Ce.escapeTest.test(e))return e.replace(Ce.escapeReplace,dl)}else if(Ce.escapeTestNoEncode.test(e))return e.replace(Ce.escapeReplaceNoEncode,dl);return e}function ul(e){try{e=encodeURI(e).replace(Ce.percentDecode,"%")}catch{return null}return e}function gl(e,t){let n=e.replace(Ce.findPipe,(o,r,l)=>{let a=!1,d=r;for(;--d>=0&&l[d]==="\\";)a=!a;return a?"|":" |"}),s=n.split(Ce.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(Ce.slashPipe,"|");return s}function Nn(e,t,n){let s=e.length;if(s===0)return"";let i=0;for(;i<s&&e.charAt(s-i-1)===t;)i++;return e.slice(0,s-i)}function H0(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function z0(e,t=0){let n=t,s="";for(let i of e)if(i===" "){let o=4-n%4;s+=" ".repeat(o),n+=o}else s+=i,n++;return s}function fl(e,t,n,s,i){let o=t.href,r=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:r,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,a}function j0(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
|
|
5333
5333
|
`).map(o=>{let r=o.match(n.other.beginningSpace);if(r===null)return o;let[l]=r;return l.length>=i.length?o.slice(i.length):o}).join(`
|
|
5334
|
-
`)}var
|
|
5334
|
+
`)}var Qs=class{options;rules;lexer;constructor(e){this.options=e||en}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Nn(n,`
|
|
5335
5335
|
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=j0(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=Nn(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Nn(t[0],`
|
|
5336
5336
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Nn(t[0],`
|
|
5337
5337
|
`).split(`
|
|
@@ -5353,7 +5353,7 @@ ${g}`:g;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
5353
5353
|
`+f}v=!f.trim(),d+=L+`
|
|
5354
5354
|
`,e=e.substring(L.length+1),u=_.slice(m)}}i.loose||(r?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(r=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),i.raw+=d}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let a of i.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(a.raw);if(d){let g={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};a.checked=g.checked,i.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=g.raw+a.tokens[0].raw,a.tokens[0].text=g.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(g)):a.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):a.tokens.unshift(g)}}if(!i.loose){let d=a.tokens.filter(u=>u.type==="space"),g=d.length>0&&d.some(u=>this.rules.other.anyLine.test(u.raw));i.loose=g}}if(i.loose)for(let a of i.items){a.loose=!0;for(let d of a.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=gl(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
5355
5355
|
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let r of s)this.rules.other.tableAlignRight.test(r)?o.align.push("right"):this.rules.other.tableAlignCenter.test(r)?o.align.push("center"):this.rules.other.tableAlignLeft.test(r)?o.align.push("left"):o.align.push(null);for(let r=0;r<n.length;r++)o.header.push({text:n[r],tokens:this.lexer.inline(n[r]),header:!0,align:o.align[r]});for(let r of i)o.rows.push(gl(r,o.header.length).map((l,a)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[a]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
5356
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Nn(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=H0(t[2],"()");if(o===-2)return;if(o>-1){let r=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],i=o[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),fl(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return fl(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,o,r,l=i,a=0,d=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(s=d.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){l+=r;continue}else if((s[5]||s[6])&&i%3&&!((i+r)%3)){a+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+a);let g=[...s[0]][0].length,u=e.slice(0,i+s.index+g+r);if(Math.min(i,r)%2){let v=u.slice(1,-1);return{type:"em",raw:u,text:v,tokens:this.lexer.inlineTokens(v)}}let f=u.slice(2,-2);return{type:"strong",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,o,r,l=i,a=this.rules.inline.delRDelim;for(a.lastIndex=0,t=t.slice(-1*e.length+i);(s=a.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o||(r=[...o].length,r!==i))continue;if(s[3]||s[4]){l+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l);let d=[...s[0]][0].length,g=e.slice(0,i+s.index+d+r),u=g.slice(i,-i);return{type:"del",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},He=class Co{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||en,this.options.tokenizer=this.options.tokenizer||new
|
|
5356
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Nn(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=H0(t[2],"()");if(o===-2)return;if(o>-1){let r=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],i=o[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),fl(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return fl(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,o,r,l=i,a=0,d=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(s=d.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){l+=r;continue}else if((s[5]||s[6])&&i%3&&!((i+r)%3)){a+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+a);let g=[...s[0]][0].length,u=e.slice(0,i+s.index+g+r);if(Math.min(i,r)%2){let v=u.slice(1,-1);return{type:"em",raw:u,text:v,tokens:this.lexer.inlineTokens(v)}}let f=u.slice(2,-2);return{type:"strong",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,o,r,l=i,a=this.rules.inline.delRDelim;for(a.lastIndex=0,t=t.slice(-1*e.length+i);(s=a.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o||(r=[...o].length,r!==i))continue;if(s[3]||s[4]){l+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l);let d=[...s[0]][0].length,g=e.slice(0,i+s.index+d+r),u=g.slice(i,-i);return{type:"del",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},He=class Co{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||en,this.options.tokenizer=this.options.tokenizer||new Qs,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Ce,block:As.normal,inline:Fn.normal};this.options.pedantic?(n.block=As.pedantic,n.inline=Fn.pedantic):this.options.gfm&&(n.block=As.gfm,this.options.breaks?n.inline=Fn.breaks:n.inline=Fn.gfm),this.tokenizer.rules=n}static get rules(){return{block:As,inline:Fn}}static lex(t,n){return new Co(n).lex(t)}static lexInline(t,n){return new Co(n).inlineTokens(t)}lex(t){t=t.replace(Ce.carriageReturn,`
|
|
5357
5357
|
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(Ce.tabCharGlobal," ").replace(Ce.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(r=>(i=r.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let r=n.at(-1);i.raw.length===1&&r!==void 0?r.raw+=`
|
|
5358
5358
|
`:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let r=n.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(`
|
|
5359
5359
|
`)?"":`
|
|
@@ -5367,7 +5367,7 @@ ${g}`:g;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
5367
5367
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):n.push(i),s=o.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let r=n.at(-1);r?.type==="text"?(r.raw+=(r.raw.endsWith(`
|
|
5368
5368
|
`)?"":`
|
|
5369
5369
|
`)+i.raw,r.text+=`
|
|
5370
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):n.push(i);continue}if(t){let r="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)o=i[2]?i[2].length:0,s=s.slice(0,i.index+o)+"["+"a".repeat(i[0].length-o-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,l="";for(;t;){r||(l=""),r=!1;let a;if(this.options.extensions?.inline?.some(g=>(a=g.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.escape(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.tag(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.link(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(a.raw.length);let g=n.at(-1);a.type==="text"&&g?.type==="text"?(g.raw+=a.raw,g.text+=a.text):n.push(a);continue}if(a=this.tokenizer.emStrong(t,s,l)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.codespan(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.br(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.del(t,s,l)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.autolink(t)){t=t.substring(a.raw.length),n.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(t))){t=t.substring(a.raw.length),n.push(a);continue}let d=t;if(this.options.extensions?.startInline){let g=1/0,u=t.slice(1),f;this.options.extensions.startInline.forEach(v=>{f=v.call({lexer:this},u),typeof f=="number"&&f>=0&&(g=Math.min(g,f))}),g<1/0&&g>=0&&(d=t.substring(0,g+1))}if(a=this.tokenizer.inlineText(d)){t=t.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(l=a.raw.slice(-1)),r=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=a.raw,g.text+=a.text):n.push(a);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},
|
|
5370
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):n.push(i);continue}if(t){let r="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)o=i[2]?i[2].length:0,s=s.slice(0,i.index+o)+"["+"a".repeat(i[0].length-o-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,l="";for(;t;){r||(l=""),r=!1;let a;if(this.options.extensions?.inline?.some(g=>(a=g.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.escape(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.tag(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.link(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(a.raw.length);let g=n.at(-1);a.type==="text"&&g?.type==="text"?(g.raw+=a.raw,g.text+=a.text):n.push(a);continue}if(a=this.tokenizer.emStrong(t,s,l)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.codespan(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.br(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.del(t,s,l)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.autolink(t)){t=t.substring(a.raw.length),n.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(t))){t=t.substring(a.raw.length),n.push(a);continue}let d=t;if(this.options.extensions?.startInline){let g=1/0,u=t.slice(1),f;this.options.extensions.startInline.forEach(v=>{f=v.call({lexer:this},u),typeof f=="number"&&f>=0&&(g=Math.min(g,f))}),g<1/0&&g>=0&&(d=t.substring(0,g+1))}if(a=this.tokenizer.inlineText(d)){t=t.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(l=a.raw.slice(-1)),r=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=a.raw,g.text+=a.text):n.push(a);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},Ys=class{options;parser;constructor(e){this.options=e||en}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(Ce.notSpaceStart)?.[0],i=e.replace(Ce.endingNewline,"")+`
|
|
5371
5371
|
`;return s?'<pre><code class="language-'+Je(s)+'">'+(n?i:Je(i,!0))+`</code></pre>
|
|
5372
5372
|
`:"<pre><code>"+(n?i:Je(i,!0))+`</code></pre>
|
|
5373
5373
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
@@ -5385,10 +5385,10 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
5385
5385
|
`}tablerow({text:e}){return`<tr>
|
|
5386
5386
|
${e}</tr>
|
|
5387
5387
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
5388
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Je(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=ul(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+Je(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=ul(e);if(i===null)return Je(n);e=i;let o=`<img src="${e}" alt="${Je(n)}"`;return t&&(o+=` title="${Je(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Je(e.text)}},Sr=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},ze=class To{options;renderer;textRenderer;constructor(t){this.options=t||en,this.options.renderer=this.options.renderer||new
|
|
5389
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Je(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},Qt=new K0;function te(e,t){return Qt.parse(e,t)}te.options=te.setOptions=function(e){return Qt.setOptions(e),te.defaults=Qt.defaults,Vd(te.defaults),te};te.getDefaults=hr;te.defaults=en;te.use=function(...e){return Qt.use(...e),te.defaults=Qt.defaults,Vd(te.defaults),te};te.walkTokens=function(e,t){return Qt.walkTokens(e,t)};te.parseInline=Qt.parseInline;te.Parser=ze;te.parser=ze.parse;te.Renderer=
|
|
5388
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Je(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=ul(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+Je(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=ul(e);if(i===null)return Je(n);e=i;let o=`<img src="${e}" alt="${Je(n)}"`;return t&&(o+=` title="${Je(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Je(e.text)}},Sr=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},ze=class To{options;renderer;textRenderer;constructor(t){this.options=t||en,this.options.renderer=this.options.renderer||new Ys,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Sr}static parse(t,n){return new To(n).parse(t)}static parseInline(t,n){return new To(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let r=i,l=this.options.extensions.renderers[r.type].call({parser:this},r);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(r.type)){n+=l||"";continue}}let o=i;switch(o.type){case"space":{n+=this.renderer.space(o);break}case"hr":{n+=this.renderer.hr(o);break}case"heading":{n+=this.renderer.heading(o);break}case"code":{n+=this.renderer.code(o);break}case"table":{n+=this.renderer.table(o);break}case"blockquote":{n+=this.renderer.blockquote(o);break}case"list":{n+=this.renderer.list(o);break}case"checkbox":{n+=this.renderer.checkbox(o);break}case"html":{n+=this.renderer.html(o);break}case"def":{n+=this.renderer.def(o);break}case"paragraph":{n+=this.renderer.paragraph(o);break}case"text":{n+=this.renderer.text(o);break}default:{let r='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let o=t[i];if(this.options.extensions?.renderers?.[o.type]){let l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){s+=l||"";continue}}let r=o;switch(r.type){case"escape":{s+=n.text(r);break}case"html":{s+=n.html(r);break}case"link":{s+=n.link(r);break}case"image":{s+=n.image(r);break}case"checkbox":{s+=n.checkbox(r);break}case"strong":{s+=n.strong(r);break}case"em":{s+=n.em(r);break}case"codespan":{s+=n.codespan(r);break}case"br":{s+=n.br(r);break}case"del":{s+=n.del(r);break}case"text":{s+=n.text(r);break}default:{let l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},Un=class{options;block;constructor(e){this.options=e||en}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?He.lex:He.lexInline}provideParser(){return this.block?ze.parse:ze.parseInline}},K0=class{defaults=hr();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ze;Renderer=Ys;TextRenderer=Sr;Lexer=He;Tokenizer=Qs;Hooks=Un;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let o of i.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of i.rows)for(let r of o)n=n.concat(this.walkTokens(r.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(o=>{let r=i[o].flat(1/0);n=n.concat(this.walkTokens(r,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=t.renderers[i.name];o?t.renderers[i.name]=function(...r){let l=i.renderer.apply(this,r);return l===!1&&(l=o.apply(this,r)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[i.level];o?o.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new Ys(this.defaults);for(let o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let r=o,l=n.renderer[r],a=i[r];i[r]=(...d)=>{let g=l.apply(i,d);return g===!1&&(g=a.apply(i,d)),g||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Qs(this.defaults);for(let o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let r=o,l=n.tokenizer[r],a=i[r];i[r]=(...d)=>{let g=l.apply(i,d);return g===!1&&(g=a.apply(i,d)),g}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Un;for(let o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let r=o,l=n.hooks[r],a=i[r];Un.passThroughHooks.has(o)?i[r]=d=>{if(this.defaults.async&&Un.passThroughHooksRespectAsync.has(o))return(async()=>{let u=await l.call(i,d);return a.call(i,u)})();let g=l.call(i,d);return a.call(i,g)}:i[r]=(...d)=>{if(this.defaults.async)return(async()=>{let u=await l.apply(i,d);return u===!1&&(u=await a.apply(i,d)),u})();let g=l.apply(i,d);return g===!1&&(g=a.apply(i,d)),g}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,o=n.walkTokens;s.walkTokens=function(r){let l=[];return l.push(o.call(this,r)),i&&(l=l.concat(i.call(this,r))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return He.lex(e,t??this.defaults)}parser(e,t){return ze.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let r=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?He.lex:He.lexInline)(r,i),a=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser():e?ze.parse:ze.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let r=(i.hooks?i.hooks.provideLexer():e?He.lex:He.lexInline)(t,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?ze.parse:ze.parseInline)(r,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(r){return o(r)}}}onError(e,t){return n=>{if(n.message+=`
|
|
5389
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Je(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},Qt=new K0;function te(e,t){return Qt.parse(e,t)}te.options=te.setOptions=function(e){return Qt.setOptions(e),te.defaults=Qt.defaults,Vd(te.defaults),te};te.getDefaults=hr;te.defaults=en;te.use=function(...e){return Qt.use(...e),te.defaults=Qt.defaults,Vd(te.defaults),te};te.walkTokens=function(e,t){return Qt.walkTokens(e,t)};te.parseInline=Qt.parseInline;te.Parser=ze;te.parser=ze.parse;te.Renderer=Ys;te.TextRenderer=Sr;te.Lexer=He;te.lexer=He.lex;te.Tokenizer=Qs;te.Hooks=Un;te.parse=te;te.options;te.setOptions;te.use;te.walkTokens;te.parseInline;ze.parse;He.lex;const W0=["a","b","blockquote","br","code","del","em","h1","h2","h3","h4","hr","i","li","ol","p","pre","strong","table","tbody","td","th","thead","tr","ul","img"],q0=["class","href","rel","target","title","start","src","alt"],pl={ALLOWED_TAGS:W0,ALLOWED_ATTR:q0,ADD_DATA_URI_TAGS:["img"]};let hl=!1;const G0=14e4,V0=4e4,J0=200,Vi=5e4,Wt=new Map;function Q0(e){const t=Wt.get(e);return t===void 0?null:(Wt.delete(e),Wt.set(e,t),t)}function ml(e,t){if(Wt.set(e,t),Wt.size<=J0)return;const n=Wt.keys().next().value;n&&Wt.delete(n)}function Y0(){hl||(hl=!0,ko.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function Eo(e){const t=e.trim();if(!t)return"";if(Y0(),t.length<=Vi){const r=Q0(t);if(r!==null)return r}const n=pc(t,G0),s=n.truncated?`
|
|
5390
5390
|
|
|
5391
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>V0){const l=`<pre class="code-block">${au(`${n.text}${s}`)}</pre>`,a=ko.sanitize(l,pl);return t.length<=
|
|
5391
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>V0){const l=`<pre class="code-block">${au(`${n.text}${s}`)}</pre>`,a=ko.sanitize(l,pl);return t.length<=Vi&&ml(t,a),a}const i=te.parse(`${n.text}${s}`,{renderer:ru,gfm:!0,breaks:!0}),o=ko.sanitize(i,pl);return t.length<=Vi&&ml(t,o),o}const ru=new te.Renderer;ru.html=({text:e})=>au(e);function au(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Ps="data:",X0=new Set(["http:","https:","blob:"]),Z0=new Set(["image/svg+xml"]);function e$(e){if(!e.toLowerCase().startsWith(Ps))return!1;const t=e.indexOf(",");if(t<Ps.length)return!1;const s=e.slice(Ps.length,t).split(";")[0]?.trim().toLowerCase()??"";return s.startsWith("image/")?!Z0.has(s):!1}function t$(e,t,n={}){const s=e.trim();if(!s)return null;if(n.allowDataImage===!0&&e$(s))return s;if(s.toLowerCase().startsWith(Ps))return null;try{const i=new URL(s,t);return X0.has(i.protocol.toLowerCase())?i.toString():null}catch{return null}}function n$(e,t={}){const n=t.baseHref??window.location.href,s=t$(e,n,t);if(!s)return null;const i=window.open(s,"_blank","noopener,noreferrer");return i&&(i.opener=null),i}const s$=new RegExp("\\p{Script=Hebrew}|\\p{Script=Arabic}|\\p{Script=Syriac}|\\p{Script=Thaana}|\\p{Script=Nko}|\\p{Script=Samaritan}|\\p{Script=Mandaic}|\\p{Script=Adlam}|\\p{Script=Phoenician}|\\p{Script=Lydian}","u");function lu(e,t=/[\s\p{P}\p{S}]/u){if(!e)return"ltr";for(const n of e)if(!t.test(n))return s$.test(n)?"rtl":"ltr";return"ltr"}const i$=1500,o$=2e3,cu="Copy as markdown",r$="Copied",a$="Copy failed";async function l$(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Cs(e,t){e.title=t,e.setAttribute("aria-label",t)}function c$(e){const t=e.label??cu;return c`
|
|
5392
5392
|
<button
|
|
5393
5393
|
class="chat-copy-btn"
|
|
5394
5394
|
type="button"
|
|
@@ -5401,8 +5401,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
|
|
|
5401
5401
|
<span class="chat-copy-btn__icon-check">${he.check}</span>
|
|
5402
5402
|
</span>
|
|
5403
5403
|
</button>
|
|
5404
|
-
`}function d$(e){return c$({text:()=>e,label:cu})}function du(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,o=Array.isArray(i)?i:null,r=Array.isArray(o)&&o.some(u=>{const f=u,v=(typeof f.type=="string"?f.type:"").toLowerCase();return v==="toolresult"||v==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||r||l)&&(n="toolResult");let a=[];typeof t.content=="string"?a=[{type:"text",text:t.content}]:Array.isArray(t.content)?a=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(a=[{type:"text",text:t.text}]);const d=typeof t.timestamp=="number"?t.timestamp:Date.now(),g=typeof t.id=="string"?t.id:void 0;return(n==="user"||n==="User")&&(a=a.map(u=>u.type==="text"&&typeof u.text=="string"?{...u,text:sd(u.text)}:u)),{role:n,content:a,timestamp:d,id:g}}function kr(e){const t=e.toLowerCase();return e==="user"||e==="User"?e:e==="assistant"?"assistant":e==="system"?"system":t==="toolresult"||t==="tool_result"||t==="tool"||t==="function"?"tool":e}function uu(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const u$={emoji:"🧩",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},g$={bash:{emoji:"🛠️",title:"Bash",detailKeys:["command"]},process:{emoji:"🧰",title:"Process",detailKeys:["sessionId"]},read:{emoji:"📖",title:"Read",detailKeys:["path"]},write:{emoji:"✍️",title:"Write",detailKeys:["path"]},edit:{emoji:"📝",title:"Edit",detailKeys:["path"]},attach:{emoji:"📎",title:"Attach",detailKeys:["path","url","fileName"]},browser:{emoji:"🌐",title:"Browser",actions:{status:{label:"status"},start:{label:"start"},stop:{label:"stop"},tabs:{label:"tabs"},open:{label:"open",detailKeys:["targetUrl"]},focus:{label:"focus",detailKeys:["targetId"]},close:{label:"close",detailKeys:["targetId"]},snapshot:{label:"snapshot",detailKeys:["targetUrl","targetId","ref","element","format"]},screenshot:{label:"screenshot",detailKeys:["targetUrl","targetId","ref","element"]},navigate:{label:"navigate",detailKeys:["targetUrl","targetId"]},console:{label:"console",detailKeys:["level","targetId"]},pdf:{label:"pdf",detailKeys:["targetId"]},upload:{label:"upload",detailKeys:["paths","ref","inputRef","element","targetId"]},dialog:{label:"dialog",detailKeys:["accept","promptText","targetId"]},act:{label:"act",detailKeys:["request.kind","request.ref","request.selector","request.text","request.value"]}}},canvas:{emoji:"🖼️",title:"Canvas",actions:{present:{label:"present",detailKeys:["target","node","nodeId"]},hide:{label:"hide",detailKeys:["node","nodeId"]},navigate:{label:"navigate",detailKeys:["url","node","nodeId"]},eval:{label:"eval",detailKeys:["javaScript","node","nodeId"]},snapshot:{label:"snapshot",detailKeys:["format","node","nodeId"]},a2ui_push:{label:"A2UI push",detailKeys:["jsonlPath","node","nodeId"]},a2ui_reset:{label:"A2UI reset",detailKeys:["node","nodeId"]}}},nodes:{emoji:"📱",title:"Nodes",actions:{status:{label:"status"},describe:{label:"describe",detailKeys:["node","nodeId"]},pending:{label:"pending"},approve:{label:"approve",detailKeys:["requestId"]},reject:{label:"reject",detailKeys:["requestId"]},notify:{label:"notify",detailKeys:["node","nodeId","title","body"]},camera_snap:{label:"camera snap",detailKeys:["node","nodeId","facing","deviceId"]},camera_list:{label:"camera list",detailKeys:["node","nodeId"]},camera_clip:{label:"camera clip",detailKeys:["node","nodeId","facing","duration","durationMs"]},screen_record:{label:"screen record",detailKeys:["node","nodeId","duration","durationMs","fps","screenIndex"]}}},cron:{emoji:"⏰",title:"Cron",actions:{status:{label:"status"},list:{label:"list"},add:{label:"add",detailKeys:["job.name","job.id","job.schedule","job.cron"]},update:{label:"update",detailKeys:["id"]},remove:{label:"remove",detailKeys:["id"]},run:{label:"run",detailKeys:["id"]},runs:{label:"runs",detailKeys:["id"]},wake:{label:"wake",detailKeys:["text","mode"]}}},gateway:{emoji:"🔌",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]}}},whatsapp_login:{emoji:"🟢",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{emoji:"💬",title:"Discord",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sticker:{label:"sticker",detailKeys:["to","stickerIds"]},poll:{label:"poll",detailKeys:["question","to"]},permissions:{label:"permissions",detailKeys:["channelId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},threadCreate:{label:"thread create",detailKeys:["channelId","name"]},threadList:{label:"thread list",detailKeys:["guildId","channelId"]},threadReply:{label:"thread reply",detailKeys:["channelId","content"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},searchMessages:{label:"search",detailKeys:["guildId","content"]},memberInfo:{label:"member",detailKeys:["guildId","userId"]},roleInfo:{label:"roles",detailKeys:["guildId"]},emojiList:{label:"emoji list",detailKeys:["guildId"]},roleAdd:{label:"role add",detailKeys:["guildId","userId","roleId"]},roleRemove:{label:"role remove",detailKeys:["guildId","userId","roleId"]},channelInfo:{label:"channel",detailKeys:["channelId"]},channelList:{label:"channels",detailKeys:["guildId"]},voiceStatus:{label:"voice",detailKeys:["guildId","userId"]},eventList:{label:"events",detailKeys:["guildId"]},eventCreate:{label:"event create",detailKeys:["guildId","name"]},timeout:{label:"timeout",detailKeys:["guildId","userId"]},kick:{label:"kick",detailKeys:["guildId","userId"]},ban:{label:"ban",detailKeys:["guildId","userId"]}}}},f$={fallback:u$,tools:g$};function An(e){return e&&typeof e=="object"?e:void 0}function p$(e){return(e??"tool").trim()}function h$(e){const t=e.replace(/_/g," ").trim();return t?t.split(/\s+/).map(n=>n.length<=2&&n.toUpperCase()===n?n:`${n.at(0)?.toUpperCase()??""}${n.slice(1)}`).join(" "):"Tool"}function m$(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function v$(e){if(!e||typeof e!="object")return;const t=e.action;return typeof t!="string"?void 0:t.trim()||void 0}function b$(e){return F$({toolKey:e.toolKey,args:e.args,meta:e.meta,action:v$(e.args),spec:e.spec,fallbackDetailKeys:e.fallbackDetailKeys,detailMode:e.detailMode,detailCoerce:e.detailCoerce,detailMaxEntries:e.detailMaxEntries,detailFormatKey:e.detailFormatKey})}function _o(e,t={}){const n=t.maxStringChars??160,s=t.maxArrayEntries??3;if(e!=null){if(typeof e=="string"){const i=e.trim();if(!i)return;const o=i.split(/\r?\n/)[0]?.trim()??"";return o?o.length>n?`${o.slice(0,Math.max(0,n-3))}…`:o:void 0}if(typeof e=="boolean")return!e&&!t.includeFalse?void 0:e?"true":"false";if(typeof e=="number")return Number.isFinite(e)?e===0&&!t.includeZero?void 0:String(e):t.includeNonFinite?String(e):void 0;if(Array.isArray(e)){const i=e.map(r=>_o(r,t)).filter(r=>!!r);if(i.length===0)return;const o=i.slice(0,s).join(", ");return i.length>s?`${o}…`:o}}}function vl(e,t){if(!e||typeof e!="object")return;let n=e;for(const s of t.split(".")){if(!s||!n||typeof n!="object")return;n=n[s]}return n}function gu(e){const t=An(e);if(t)for(const n of[t.path,t.file_path,t.filePath]){if(typeof n!="string")continue;const s=n.trim();if(s)return s}}function y$(e){const t=An(e);if(!t)return;const n=gu(t);if(!n)return;const s=typeof t.offset=="number"&&Number.isFinite(t.offset)?Math.floor(t.offset):void 0,i=typeof t.limit=="number"&&Number.isFinite(t.limit)?Math.floor(t.limit):void 0,o=s!==void 0?Math.max(1,s):void 0,r=i!==void 0?Math.max(1,i):void 0;return o!==void 0&&r!==void 0?`${r===1?"line":"lines"} ${o}-${o+r-1} from ${n}`:o!==void 0?`from line ${o} in ${n}`:r!==void 0?`first ${r} ${r===1?"line":"lines"} of ${n}`:`from ${n}`}function $$(e,t){const n=An(t);if(!n)return;const s=gu(n)??(typeof n.url=="string"?n.url.trim():void 0);if(!s)return;if(e==="attach")return`from ${s}`;const i=e==="edit"?"in":"to",o=typeof n.content=="string"?n.content:typeof n.newText=="string"?n.newText:typeof n.new_string=="string"?n.new_string:void 0;return o&&o.length>0?`${i} ${s} (${o.length} chars)`:`${i} ${s}`}function x$(e){const t=An(e);if(!t)return;const n=typeof t.query=="string"?t.query.trim():void 0,s=typeof t.count=="number"&&Number.isFinite(t.count)&&t.count>0?Math.floor(t.count):void 0;if(n)return s!==void 0?`for "${n}" (top ${s})`:`for "${n}"`}function w$(e){const t=An(e);if(!t)return;const n=typeof t.url=="string"?t.url.trim():void 0;if(!n)return;const s=typeof t.extractMode=="string"?t.extractMode.trim():void 0,i=typeof t.maxChars=="number"&&Number.isFinite(t.maxChars)&&t.maxChars>0?Math.floor(t.maxChars):void 0,o=[s?`mode ${s}`:void 0,i!==void 0?`max ${i} chars`:void 0].filter(r=>!!r).join(", ");return o?`from ${n} (${o})`:`from ${n}`}function Ar(e){if(!e)return e;const t=e.trim();return t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))?t.slice(1,-1).trim():t}function qt(e,t=48){if(!e)return[];const n=[];let s="",i,o=!1;for(let r=0;r<e.length;r+=1){const l=e[r];if(o){s+=l,o=!1;continue}if(l==="\\"){o=!0;continue}if(i){l===i?i=void 0:s+=l;continue}if(l==='"'||l==="'"){i=l;continue}if(/\s/.test(l)){if(!s)continue;if(n.push(s),n.length>=t)return n;s="";continue}s+=l}return s&&n.push(s),n}function Cn(e){if(!e)return;const t=Ar(e)??e;return(t.split(/[/]/).at(-1)??t).trim().toLowerCase()}function Pt(e,t){const n=new Set(t);for(let s=0;s<e.length;s+=1){const i=e[s];if(i){if(n.has(i)){const o=e[s+1];if(o&&!o.startsWith("-"))return o;continue}for(const o of t)if(o.startsWith("--")&&i.startsWith(`${o}=`))return i.slice(o.length+1)}}}function gn(e,t=1,n=[]){const s=[],i=new Set(n);for(let o=t;o<e.length;o+=1){const r=e[o];if(r){if(r==="--"){for(let l=o+1;l<e.length;l+=1){const a=e[l];a&&s.push(a)}break}if(r.startsWith("--")){if(r.includes("="))continue;i.has(r)&&(o+=1);continue}if(r.startsWith("-")){i.has(r)&&(o+=1);continue}s.push(r)}}return s}function rt(e,t=1,n=[]){return gn(e,t,n)[0]}function Vi(e){if(e.length===0)return e;let t=0;if(Cn(e[0])==="env"){for(t=1;t<e.length;){const n=e[t];if(!n)break;if(n.startsWith("-")){t+=1;continue}if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(n)){t+=1;continue}break}return e.slice(t)}for(;t<e.length&&/^[A-Za-z_][A-Za-z0-9_]*=/.test(e[t]);)t+=1;return e.slice(t)}function S$(e){const t=qt(e,10);if(t.length<3)return e;const n=Cn(t[0]);if(!(n==="bash"||n==="sh"||n==="zsh"||n==="fish"))return e;const s=t.findIndex((o,r)=>r>0&&(o==="-c"||o==="-lc"||o==="-ic"));if(s===-1)return e;const i=t.slice(s+1).join(" ").trim();return i?Ar(i)??e:e}function Cr(e,t){let n,s=!1;for(let i=0;i<e.length;i+=1){const o=e[i];if(s){s=!1;continue}if(o==="\\"){s=!0;continue}if(n){o===n&&(n=void 0);continue}if(o==='"'||o==="'"){n=o;continue}if(t(o,i)===!1)return}}function k$(e){const t=[];let n=0;return Cr(e,(s,i)=>s===";"?(t.push(e.slice(n,i)),n=i+1,!0):((s==="&"||s==="|")&&e[i+1]===s&&(t.push(e.slice(n,i)),n=i+2),!0)),t.push(e.slice(n)),t.map(s=>s.trim()).filter(s=>s.length>0)}function A$(e){const t=[];let n=0;return Cr(e,(s,i)=>(s==="|"&&e[i-1]!=="|"&&e[i+1]!=="|"&&(t.push(e.slice(n,i)),n=i+1),!0)),t.push(e.slice(n)),t.map(s=>s.trim()).filter(s=>s.length>0)}function C$(e){const t=qt(e,3),n=Cn(t[0]);if(n==="cd"||n==="pushd")return t[1]||void 0}function T$(e){const t=Cn(qt(e,2)[0]);return t==="cd"||t==="pushd"||t==="popd"}function E$(e){return Cn(qt(e,2)[0])==="popd"}function _$(e){let t=e.trim(),n;for(let s=0;s<4;s+=1){let i;Cr(t,(a,d)=>{if(a==="&"&&t[d+1]==="&")return i={index:d,length:2},!1;if(a==="|"&&t[d+1]==="|")return i={index:d,length:2,isOr:!0},!1;if(a===";"||a===`
|
|
5405
|
-
`)return i={index:d,length:1},!1});const o=(i?t.slice(0,i.index):t).trim(),r=(i?!i.isOr:s>0)&&T$(o);if(!(o.startsWith("set ")||o.startsWith("export ")||o.startsWith("unset ")||r)||(r&&(E$(o)?n=void 0:n=C$(o)??n),t=i?t.slice(i.index+i.length).trimStart():"",!t))break}return{command:t.trim(),chdirPath:n}}function
|
|
5404
|
+
`}function d$(e){return c$({text:()=>e,label:cu})}function du(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,o=Array.isArray(i)?i:null,r=Array.isArray(o)&&o.some(u=>{const f=u,v=(typeof f.type=="string"?f.type:"").toLowerCase();return v==="toolresult"||v==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||r||l)&&(n="toolResult");let a=[];typeof t.content=="string"?a=[{type:"text",text:t.content}]:Array.isArray(t.content)?a=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(a=[{type:"text",text:t.text}]);const d=typeof t.timestamp=="number"?t.timestamp:Date.now(),g=typeof t.id=="string"?t.id:void 0;return(n==="user"||n==="User")&&(a=a.map(u=>u.type==="text"&&typeof u.text=="string"?{...u,text:sd(u.text)}:u)),{role:n,content:a,timestamp:d,id:g}}function kr(e){const t=e.toLowerCase();return e==="user"||e==="User"?e:e==="assistant"?"assistant":e==="system"?"system":t==="toolresult"||t==="tool_result"||t==="tool"||t==="function"?"tool":e}function uu(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const u$={emoji:"🧩",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},g$={bash:{emoji:"🛠️",title:"Bash",detailKeys:["command"]},process:{emoji:"🧰",title:"Process",detailKeys:["sessionId"]},read:{emoji:"📖",title:"Read",detailKeys:["path"]},write:{emoji:"✍️",title:"Write",detailKeys:["path"]},edit:{emoji:"📝",title:"Edit",detailKeys:["path"]},attach:{emoji:"📎",title:"Attach",detailKeys:["path","url","fileName"]},browser:{emoji:"🌐",title:"Browser",actions:{status:{label:"status"},start:{label:"start"},stop:{label:"stop"},tabs:{label:"tabs"},open:{label:"open",detailKeys:["targetUrl"]},focus:{label:"focus",detailKeys:["targetId"]},close:{label:"close",detailKeys:["targetId"]},snapshot:{label:"snapshot",detailKeys:["targetUrl","targetId","ref","element","format"]},screenshot:{label:"screenshot",detailKeys:["targetUrl","targetId","ref","element"]},navigate:{label:"navigate",detailKeys:["targetUrl","targetId"]},console:{label:"console",detailKeys:["level","targetId"]},pdf:{label:"pdf",detailKeys:["targetId"]},upload:{label:"upload",detailKeys:["paths","ref","inputRef","element","targetId"]},dialog:{label:"dialog",detailKeys:["accept","promptText","targetId"]},act:{label:"act",detailKeys:["request.kind","request.ref","request.selector","request.text","request.value"]}}},canvas:{emoji:"🖼️",title:"Canvas",actions:{present:{label:"present",detailKeys:["target","node","nodeId"]},hide:{label:"hide",detailKeys:["node","nodeId"]},navigate:{label:"navigate",detailKeys:["url","node","nodeId"]},eval:{label:"eval",detailKeys:["javaScript","node","nodeId"]},snapshot:{label:"snapshot",detailKeys:["format","node","nodeId"]},a2ui_push:{label:"A2UI push",detailKeys:["jsonlPath","node","nodeId"]},a2ui_reset:{label:"A2UI reset",detailKeys:["node","nodeId"]}}},nodes:{emoji:"📱",title:"Nodes",actions:{status:{label:"status"},describe:{label:"describe",detailKeys:["node","nodeId"]},pending:{label:"pending"},approve:{label:"approve",detailKeys:["requestId"]},reject:{label:"reject",detailKeys:["requestId"]},notify:{label:"notify",detailKeys:["node","nodeId","title","body"]},camera_snap:{label:"camera snap",detailKeys:["node","nodeId","facing","deviceId"]},camera_list:{label:"camera list",detailKeys:["node","nodeId"]},camera_clip:{label:"camera clip",detailKeys:["node","nodeId","facing","duration","durationMs"]},screen_record:{label:"screen record",detailKeys:["node","nodeId","duration","durationMs","fps","screenIndex"]}}},cron:{emoji:"⏰",title:"Cron",actions:{status:{label:"status"},list:{label:"list"},add:{label:"add",detailKeys:["job.name","job.id","job.schedule","job.cron"]},update:{label:"update",detailKeys:["id"]},remove:{label:"remove",detailKeys:["id"]},run:{label:"run",detailKeys:["id"]},runs:{label:"runs",detailKeys:["id"]},wake:{label:"wake",detailKeys:["text","mode"]}}},gateway:{emoji:"🔌",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]}}},whatsapp_login:{emoji:"🟢",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{emoji:"💬",title:"Discord",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sticker:{label:"sticker",detailKeys:["to","stickerIds"]},poll:{label:"poll",detailKeys:["question","to"]},permissions:{label:"permissions",detailKeys:["channelId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},threadCreate:{label:"thread create",detailKeys:["channelId","name"]},threadList:{label:"thread list",detailKeys:["guildId","channelId"]},threadReply:{label:"thread reply",detailKeys:["channelId","content"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},searchMessages:{label:"search",detailKeys:["guildId","content"]},memberInfo:{label:"member",detailKeys:["guildId","userId"]},roleInfo:{label:"roles",detailKeys:["guildId"]},emojiList:{label:"emoji list",detailKeys:["guildId"]},roleAdd:{label:"role add",detailKeys:["guildId","userId","roleId"]},roleRemove:{label:"role remove",detailKeys:["guildId","userId","roleId"]},channelInfo:{label:"channel",detailKeys:["channelId"]},channelList:{label:"channels",detailKeys:["guildId"]},voiceStatus:{label:"voice",detailKeys:["guildId","userId"]},eventList:{label:"events",detailKeys:["guildId"]},eventCreate:{label:"event create",detailKeys:["guildId","name"]},timeout:{label:"timeout",detailKeys:["guildId","userId"]},kick:{label:"kick",detailKeys:["guildId","userId"]},ban:{label:"ban",detailKeys:["guildId","userId"]}}}},f$={fallback:u$,tools:g$};function An(e){return e&&typeof e=="object"?e:void 0}function p$(e){return(e??"tool").trim()}function h$(e){const t=e.replace(/_/g," ").trim();return t?t.split(/\s+/).map(n=>n.length<=2&&n.toUpperCase()===n?n:`${n.at(0)?.toUpperCase()??""}${n.slice(1)}`).join(" "):"Tool"}function m$(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function v$(e){if(!e||typeof e!="object")return;const t=e.action;return typeof t!="string"?void 0:t.trim()||void 0}function b$(e){return F$({toolKey:e.toolKey,args:e.args,meta:e.meta,action:v$(e.args),spec:e.spec,fallbackDetailKeys:e.fallbackDetailKeys,detailMode:e.detailMode,detailCoerce:e.detailCoerce,detailMaxEntries:e.detailMaxEntries,detailFormatKey:e.detailFormatKey})}function _o(e,t={}){const n=t.maxStringChars??160,s=t.maxArrayEntries??3;if(e!=null){if(typeof e=="string"){const i=e.trim();if(!i)return;const o=i.split(/\r?\n/)[0]?.trim()??"";return o?o.length>n?`${o.slice(0,Math.max(0,n-3))}…`:o:void 0}if(typeof e=="boolean")return!e&&!t.includeFalse?void 0:e?"true":"false";if(typeof e=="number")return Number.isFinite(e)?e===0&&!t.includeZero?void 0:String(e):t.includeNonFinite?String(e):void 0;if(Array.isArray(e)){const i=e.map(r=>_o(r,t)).filter(r=>!!r);if(i.length===0)return;const o=i.slice(0,s).join(", ");return i.length>s?`${o}…`:o}}}function vl(e,t){if(!e||typeof e!="object")return;let n=e;for(const s of t.split(".")){if(!s||!n||typeof n!="object")return;n=n[s]}return n}function gu(e){const t=An(e);if(t)for(const n of[t.path,t.file_path,t.filePath]){if(typeof n!="string")continue;const s=n.trim();if(s)return s}}function y$(e){const t=An(e);if(!t)return;const n=gu(t);if(!n)return;const s=typeof t.offset=="number"&&Number.isFinite(t.offset)?Math.floor(t.offset):void 0,i=typeof t.limit=="number"&&Number.isFinite(t.limit)?Math.floor(t.limit):void 0,o=s!==void 0?Math.max(1,s):void 0,r=i!==void 0?Math.max(1,i):void 0;return o!==void 0&&r!==void 0?`${r===1?"line":"lines"} ${o}-${o+r-1} from ${n}`:o!==void 0?`from line ${o} in ${n}`:r!==void 0?`first ${r} ${r===1?"line":"lines"} of ${n}`:`from ${n}`}function $$(e,t){const n=An(t);if(!n)return;const s=gu(n)??(typeof n.url=="string"?n.url.trim():void 0);if(!s)return;if(e==="attach")return`from ${s}`;const i=e==="edit"?"in":"to",o=typeof n.content=="string"?n.content:typeof n.newText=="string"?n.newText:typeof n.new_string=="string"?n.new_string:void 0;return o&&o.length>0?`${i} ${s} (${o.length} chars)`:`${i} ${s}`}function x$(e){const t=An(e);if(!t)return;const n=typeof t.query=="string"?t.query.trim():void 0,s=typeof t.count=="number"&&Number.isFinite(t.count)&&t.count>0?Math.floor(t.count):void 0;if(n)return s!==void 0?`for "${n}" (top ${s})`:`for "${n}"`}function w$(e){const t=An(e);if(!t)return;const n=typeof t.url=="string"?t.url.trim():void 0;if(!n)return;const s=typeof t.extractMode=="string"?t.extractMode.trim():void 0,i=typeof t.maxChars=="number"&&Number.isFinite(t.maxChars)&&t.maxChars>0?Math.floor(t.maxChars):void 0,o=[s?`mode ${s}`:void 0,i!==void 0?`max ${i} chars`:void 0].filter(r=>!!r).join(", ");return o?`from ${n} (${o})`:`from ${n}`}function Ar(e){if(!e)return e;const t=e.trim();return t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))?t.slice(1,-1).trim():t}function qt(e,t=48){if(!e)return[];const n=[];let s="",i,o=!1;for(let r=0;r<e.length;r+=1){const l=e[r];if(o){s+=l,o=!1;continue}if(l==="\\"){o=!0;continue}if(i){l===i?i=void 0:s+=l;continue}if(l==='"'||l==="'"){i=l;continue}if(/\s/.test(l)){if(!s)continue;if(n.push(s),n.length>=t)return n;s="";continue}s+=l}return s&&n.push(s),n}function Cn(e){if(!e)return;const t=Ar(e)??e;return(t.split(/[/]/).at(-1)??t).trim().toLowerCase()}function Pt(e,t){const n=new Set(t);for(let s=0;s<e.length;s+=1){const i=e[s];if(i){if(n.has(i)){const o=e[s+1];if(o&&!o.startsWith("-"))return o;continue}for(const o of t)if(o.startsWith("--")&&i.startsWith(`${o}=`))return i.slice(o.length+1)}}}function gn(e,t=1,n=[]){const s=[],i=new Set(n);for(let o=t;o<e.length;o+=1){const r=e[o];if(r){if(r==="--"){for(let l=o+1;l<e.length;l+=1){const a=e[l];a&&s.push(a)}break}if(r.startsWith("--")){if(r.includes("="))continue;i.has(r)&&(o+=1);continue}if(r.startsWith("-")){i.has(r)&&(o+=1);continue}s.push(r)}}return s}function rt(e,t=1,n=[]){return gn(e,t,n)[0]}function Ji(e){if(e.length===0)return e;let t=0;if(Cn(e[0])==="env"){for(t=1;t<e.length;){const n=e[t];if(!n)break;if(n.startsWith("-")){t+=1;continue}if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(n)){t+=1;continue}break}return e.slice(t)}for(;t<e.length&&/^[A-Za-z_][A-Za-z0-9_]*=/.test(e[t]);)t+=1;return e.slice(t)}function S$(e){const t=qt(e,10);if(t.length<3)return e;const n=Cn(t[0]);if(!(n==="bash"||n==="sh"||n==="zsh"||n==="fish"))return e;const s=t.findIndex((o,r)=>r>0&&(o==="-c"||o==="-lc"||o==="-ic"));if(s===-1)return e;const i=t.slice(s+1).join(" ").trim();return i?Ar(i)??e:e}function Cr(e,t){let n,s=!1;for(let i=0;i<e.length;i+=1){const o=e[i];if(s){s=!1;continue}if(o==="\\"){s=!0;continue}if(n){o===n&&(n=void 0);continue}if(o==='"'||o==="'"){n=o;continue}if(t(o,i)===!1)return}}function k$(e){const t=[];let n=0;return Cr(e,(s,i)=>s===";"?(t.push(e.slice(n,i)),n=i+1,!0):((s==="&"||s==="|")&&e[i+1]===s&&(t.push(e.slice(n,i)),n=i+2),!0)),t.push(e.slice(n)),t.map(s=>s.trim()).filter(s=>s.length>0)}function A$(e){const t=[];let n=0;return Cr(e,(s,i)=>(s==="|"&&e[i-1]!=="|"&&e[i+1]!=="|"&&(t.push(e.slice(n,i)),n=i+1),!0)),t.push(e.slice(n)),t.map(s=>s.trim()).filter(s=>s.length>0)}function C$(e){const t=qt(e,3),n=Cn(t[0]);if(n==="cd"||n==="pushd")return t[1]||void 0}function T$(e){const t=Cn(qt(e,2)[0]);return t==="cd"||t==="pushd"||t==="popd"}function E$(e){return Cn(qt(e,2)[0])==="popd"}function _$(e){let t=e.trim(),n;for(let s=0;s<4;s+=1){let i;Cr(t,(a,d)=>{if(a==="&"&&t[d+1]==="&")return i={index:d,length:2},!1;if(a==="|"&&t[d+1]==="|")return i={index:d,length:2,isOr:!0},!1;if(a===";"||a===`
|
|
5405
|
+
`)return i={index:d,length:1},!1});const o=(i?t.slice(0,i.index):t).trim(),r=(i?!i.isOr:s>0)&&T$(o);if(!(o.startsWith("set ")||o.startsWith("export ")||o.startsWith("unset ")||r)||(r&&(E$(o)?n=void 0:n=C$(o)??n),t=i?t.slice(i.index+i.length).trimStart():"",!t))break}return{command:t.trim(),chdirPath:n}}function Qi(e){if(e.length===0)return"run command";const t=Cn(e[0])??"command";if(t==="git"){const s=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--config-env"]),i=Pt(e,["-C"]);let o;for(let l=1;l<e.length;l+=1){const a=e[l];if(a){if(a==="--"){o=rt(e,l+1);break}if(a.startsWith("--")){if(a.includes("="))continue;s.has(a)&&(l+=1);continue}if(a.startsWith("-")){s.has(a)&&(l+=1);continue}o=a;break}}const r={status:"check git status",diff:"check git diff",log:"view git history",show:"show git object",branch:"list git branches",checkout:"switch git branch",switch:"switch git branch",commit:"create git commit",pull:"pull git changes",push:"push git changes",fetch:"fetch git changes",merge:"merge git changes",rebase:"rebase git branch",add:"stage git changes",restore:"restore git files",reset:"reset git state",stash:"stash git changes"};return o&&r[o]?r[o]:!o||o.startsWith("/")||o.startsWith("~")||o.includes("/")?i?`run git command in ${i}`:"run git command":`run git ${o}`}if(t==="grep"||t==="rg"||t==="ripgrep"){const s=gn(e,1,["-e","--regexp","-f","--file","-m","--max-count","-A","--after-context","-B","--before-context","-C","--context"]),i=Pt(e,["-e","--regexp"])??s[0],o=s.length>1?s.at(-1):void 0;return i?o?`search "${i}" in ${o}`:`search "${i}"`:"search text"}if(t==="find"){const s=e[1]&&!e[1].startsWith("-")?e[1]:".",i=Pt(e,["-name","-iname"]);return i?`find files named "${i}" in ${s}`:`find files in ${s}`}if(t==="ls"){const s=rt(e,1);return s?`list files in ${s}`:"list files"}if(t==="head"||t==="tail"){const s=Pt(e,["-n","--lines"])??e.slice(1).find(a=>/^-\d+$/.test(a))?.slice(1),i=gn(e,1,["-n","--lines"]);let o=i.at(-1);o&&/^\d+$/.test(o)&&i.length===1&&(o=void 0);const r=t==="head"?"first":"last",l=s==="1"?"line":"lines";return s&&o?`show ${r} ${s} ${l} of ${o}`:s?`show ${r} ${s} ${l}`:o?`show ${o}`:`show ${t} output`}if(t==="cat"){const s=rt(e,1);return s?`show ${s}`:"show output"}if(t==="sed"){const s=Pt(e,["-e","--expression"]),i=gn(e,1,["-e","--expression","-f","--file"]),o=s??i[0],r=s?i[0]:i[1];if(o){const l=(Ar(o)??o).replace(/\s+/g,""),a=l.match(/^([0-9]+),([0-9]+)p$/);if(a)return r?`print lines ${a[1]}-${a[2]} from ${r}`:`print lines ${a[1]}-${a[2]}`;const d=l.match(/^([0-9]+)p$/);if(d)return r?`print line ${d[1]} from ${r}`:`print line ${d[1]}`}return r?`run sed on ${r}`:"run sed transform"}if(t==="printf"||t==="echo")return"print text";if(t==="cp"||t==="mv"){const s=gn(e,1,["-t","--target-directory","-S","--suffix"]),i=s[0],o=s[1],r=t==="cp"?"copy":"move";return i&&o?`${r} ${i} to ${o}`:i?`${r} ${i}`:`${r} files`}if(t==="rm"){const s=rt(e,1);return s?`remove ${s}`:"remove files"}if(t==="mkdir"){const s=rt(e,1);return s?`create folder ${s}`:"create folder"}if(t==="touch"){const s=rt(e,1);return s?`create file ${s}`:"create file"}if(t==="curl"||t==="wget"){const s=e.find(i=>/^https?:\/\//i.test(i));return s?`fetch ${s}`:"fetch url"}if(t==="npm"||t==="pnpm"||t==="yarn"||t==="bun"){const s=gn(e,1,["--prefix","-C","--cwd","--config"]),i=s[0]??"command";return{install:"install dependencies",test:"run tests",build:"run build",start:"start app",lint:"run lint",run:s[1]?`run ${s[1]}`:"run script"}[i]??`run ${t} ${i}`}if(t==="node"||t==="python"||t==="python3"||t==="ruby"||t==="php"){if(e.slice(1).find(a=>a.startsWith("<<")))return`run ${t} inline script (heredoc)`;if((t==="node"?Pt(e,["-e","--eval"]):t==="python"||t==="python3"?Pt(e,["-c"]):void 0)!==void 0)return`run ${t} inline script`;const l=rt(e,1,t==="node"?["-e","--eval","-m"]:["-c","-e","--eval","-m"]);return l?t==="node"?`${e.includes("--check")||e.includes("-c")?"check js syntax for":"run node script"} ${l}`:`run ${t} ${l}`:`run ${t}`}if(t==="openclaw"){const s=rt(e,1);return s?`run openclaw ${s}`:"run openclaw"}const n=rt(e,1);return!n||n.length>48?`run ${t}`:/^[A-Za-z0-9._/-]+$/.test(n)?`run ${t} ${n}`:`run ${t}`}function I$(e){const t=A$(e);if(t.length>1){const n=Qi(Ji(qt(t[0]))),s=Qi(Ji(qt(t[t.length-1]))),i=t.length>2?` (+${t.length-2} steps)`:"";return`${n} -> ${s}${i}`}return Qi(Ji(qt(e)))}function bl(e){const{command:t,chdirPath:n}=_$(e);if(!t)return n?{text:"",chdirPath:n}:void 0;const s=k$(t);if(s.length===0)return;const i=s.map(l=>I$(l)),o=i.length===1?i[0]:i.join(" → "),r=i.every(l=>fu(l));return{text:o,chdirPath:n,allGeneric:r}}const M$=["check git","view git","show git","list git","switch git","create git","pull git","push git","fetch git","merge git","rebase git","stage git","restore git","reset git","stash git","search ","find files","list files","show first","show last","print line","print text","copy ","move ","remove ","create folder","create file","fetch http","install dependencies","run tests","run build","start app","run lint","run openclaw","run node script","run node ","run python","run ruby","run php","run sed","run git ","run npm ","run pnpm ","run yarn ","run bun ","check js syntax"];function fu(e){return e==="run command"?!0:e.startsWith("run ")?!M$.some(t=>e.startsWith(t)):!1}function R$(e,t=120){const n=e.replace(/\s*\n\s*/g," ").replace(/\s{2,}/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function L$(e){const t=An(e);if(!t)return;const n=typeof t.command=="string"?t.command.trim():void 0;if(!n)return;const s=S$(n),i=bl(s)??bl(n),o=i?.text||"run command",l=(typeof t.workdir=="string"?t.workdir:typeof t.cwd=="string"?t.cwd:void 0)?.trim()||i?.chdirPath||void 0,a=R$(s);if(i?.allGeneric!==!1&&fu(o))return l?`${a} (in ${l})`:a;const d=l?`${o} (in ${l})`:o;return a&&a!==d&&a!==o?`${d}
|
|
5406
5406
|
|
|
5407
5407
|
\`${a}\``:d}function D$(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function P$(e,t,n){if(n.mode==="first"){for(const r of t){const l=vl(e,r),a=_o(l,n.coerce);if(a)return a}return}const s=[];for(const r of t){const l=vl(e,r),a=_o(l,n.coerce);a&&s.push({label:n.formatKey?n.formatKey(r):r,value:a})}if(s.length===0)return;if(s.length===1)return s[0].value;const i=new Set,o=[];for(const r of s){const l=`${r.label}:${r.value}`;i.has(l)||(i.add(l),o.push(r))}if(o.length!==0)return o.slice(0,n.maxEntries??8).map(r=>`${r.label} ${r.value}`).join(" · ")}function F$(e){const t=D$(e.spec,e.action),n=e.toolKey==="web_search"?"search":e.toolKey==="web_fetch"?"fetch":e.toolKey.replace(/_/g," ").replace(/\./g," "),s=m$(t?.label??e.action??n);let i;e.toolKey==="exec"&&(i=L$(e.args)),!i&&e.toolKey==="read"&&(i=y$(e.args)),!i&&(e.toolKey==="write"||e.toolKey==="edit"||e.toolKey==="attach")&&(i=$$(e.toolKey,e.args)),!i&&e.toolKey==="web_search"&&(i=x$(e.args)),!i&&e.toolKey==="web_fetch"&&(i=w$(e.args));const o=t?.detailKeys??e.spec?.detailKeys??e.fallbackDetailKeys??[];return!i&&o.length>0&&(i=P$(e.args,o,{mode:e.detailMode,coerce:e.detailCoerce,maxEntries:e.detailMaxEntries,formatKey:e.detailFormatKey})),!i&&e.meta&&(i=e.meta),{verb:s,detail:i}}function N$(e,t={}){if(!e)return;const n=e.includes(" · ")?e.split(" · ").map(s=>s.trim()).filter(s=>s.length>0).join(", "):e;if(n)return t.prefixWithWith?`with ${n}`:n}const O$={"🧩":"puzzle","🛠️":"wrench","🧰":"wrench","📖":"fileText","✍️":"edit","📝":"penLine","📎":"paperclip","🌐":"globe","📺":"monitor","🧾":"fileText","🔐":"settings","💻":"monitor","🔌":"plug","💬":"messageSquare"},U$={icon:"messageSquare",title:"Slack",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},memberInfo:{label:"member",detailKeys:["userId"]},emojiList:{label:"emoji list"}}};function B$(e){return e?O$[e]??"puzzle":"puzzle"}function pu(e){return{icon:B$(e?.emoji),title:e?.title,label:e?.label,detailKeys:e?.detailKeys,actions:e?.actions}}const hu=f$,yl=pu(hu.fallback??{emoji:"🧩"}),mu=Object.fromEntries(Object.entries(hu.tools??{}).map(([e,t])=>[e,pu(t)]));mu.slack=U$;function H$(e){if(!e)return e;const t=[{re:/^\/Users\/[^/]+(\/|$)/,replacement:"~$1"},{re:/^\/home\/[^/]+(\/|$)/,replacement:"~$1"},{re:/^C:\\Users\\[^\\]+(\\|$)/i,replacement:"~$1"}];for(const n of t)if(n.re.test(e))return e.replace(n.re,n.replacement);return e}function z$(e){const t=p$(e.name),n=t.toLowerCase(),s=mu[n],i=s?.icon??yl.icon??"puzzle",o=s?.title??h$(t),r=s?.label??o;let{verb:l,detail:a}=b$({toolKey:n,args:e.args,meta:e.meta,spec:s,fallbackDetailKeys:yl.detailKeys,detailMode:"first",detailCoerce:{includeFalse:!0,includeZero:!0}});return a&&(a=H$(a)),{name:t,icon:i,title:o,label:r,verb:l,detail:a}}function j$(e){return N$(e.detail,{prefixWithWith:!0})}const K$=80,W$=2,$l=100;function q$(e){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{const n=JSON.parse(t);return"```json\n"+JSON.stringify(n,null,2)+"\n```"}catch{}return e}function G$(e){const t=e.split(`
|
|
5408
5408
|
`),n=t.slice(0,W$),s=n.join(`
|
|
@@ -5485,8 +5485,8 @@ ${s?`**Command:** \`${s}\`
|
|
|
5485
5485
|
<div class="${C}">
|
|
5486
5486
|
${S?d$(m):h}
|
|
5487
5487
|
${sx(a)}
|
|
5488
|
-
${v?c`<div class="chat-thinking">${
|
|
5489
|
-
${m?c`<div class="chat-text" dir="${lu(m)}">${
|
|
5488
|
+
${v?c`<div class="chat-thinking">${xo(Eo(v))}</div>`:h}
|
|
5489
|
+
${m?c`<div class="chat-text" dir="${lu(m)}">${xo(Eo(m))}</div>`:h}
|
|
5490
5490
|
${r.map(R=>xl(R,n))}
|
|
5491
5491
|
</div>
|
|
5492
5492
|
`}function ix(e){return c`
|
|
@@ -5503,12 +5503,12 @@ ${s?`**Command:** \`${s}\`
|
|
|
5503
5503
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
5504
5504
|
View Raw Text
|
|
5505
5505
|
</button>
|
|
5506
|
-
`:e.content?c`<div class="sidebar-markdown">${
|
|
5506
|
+
`:e.content?c`<div class="sidebar-markdown">${xo(Eo(e.content))}</div>`:c`
|
|
5507
5507
|
<div class="muted">No content available</div>
|
|
5508
5508
|
`}
|
|
5509
5509
|
</div>
|
|
5510
5510
|
</div>
|
|
5511
|
-
`}var ox=Object.defineProperty,rx=Object.getOwnPropertyDescriptor,
|
|
5511
|
+
`}var ox=Object.defineProperty,rx=Object.getOwnPropertyDescriptor,vi=(e,t,n,s)=>{for(var i=s>1?void 0:s?rx(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(i=(s?r(t,n,i):r(i))||i);return s&&i&&ox(t,n,i),i};let Sn=class extends mn{constructor(){super(...arguments),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.isDragging=!1,this.startX=0,this.startRatio=0,this.handleMouseDown=e=>{this.isDragging=!0,this.startX=e.clientX,this.startRatio=this.splitRatio,this.classList.add("dragging"),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),e.preventDefault()},this.handleMouseMove=e=>{if(!this.isDragging)return;const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect().width,i=(e.clientX-this.startX)/n;let o=this.startRatio+i;o=Math.max(this.minRatio,Math.min(this.maxRatio,o)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:o},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return h}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this.handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};Sn.styles=Iu`
|
|
5512
5512
|
:host {
|
|
5513
5513
|
width: 4px;
|
|
5514
5514
|
cursor: col-resize;
|
|
@@ -5531,7 +5531,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
5531
5531
|
:host(.dragging) {
|
|
5532
5532
|
background: var(--accent, #007bff);
|
|
5533
5533
|
}
|
|
5534
|
-
`;
|
|
5534
|
+
`;vi([ti({type:Number})],Sn.prototype,"splitRatio",2);vi([ti({type:Number})],Sn.prototype,"minRatio",2);vi([ti({type:Number})],Sn.prototype,"maxRatio",2);Sn=vi([Jl("resizable-divider")],Sn);const ax=5e3,lx=8e3;function wl(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function cx(e){return e?e.active?c`
|
|
5535
5535
|
<div class="compaction-indicator compaction-indicator--active" role="status" aria-live="polite">
|
|
5536
5536
|
${he.loader} Compacting context...
|
|
5537
5537
|
</div>
|
|
@@ -5898,7 +5898,7 @@ ${e.sidebarContent}
|
|
|
5898
5898
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
5899
5899
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
5900
5900
|
</svg>
|
|
5901
|
-
`},Al=[{key:"env",label:"Environment"},{key:"update",label:"Updates"},{key:"agents",label:"Agents"},{key:"auth",label:"Authentication"},{key:"channels",label:"Channels"},{key:"messages",label:"Messages"},{key:"commands",label:"Commands"},{key:"hooks",label:"Hooks"},{key:"skills",label:"Skills"},{key:"tools",label:"Tools"},{key:"gateway",label:"Gateway"},{key:"wizard",label:"Setup Wizard"}],Cl="__all__";function Tl(e){return Io[e]??Io.default}function xx(e,t){const n=pr[e];return n||{label:t?.title??
|
|
5901
|
+
`},Al=[{key:"env",label:"Environment"},{key:"update",label:"Updates"},{key:"agents",label:"Agents"},{key:"auth",label:"Authentication"},{key:"channels",label:"Channels"},{key:"messages",label:"Messages"},{key:"commands",label:"Commands"},{key:"hooks",label:"Hooks"},{key:"skills",label:"Skills"},{key:"tools",label:"Tools"},{key:"gateway",label:"Gateway"},{key:"wizard",label:"Setup Wizard"}],Cl="__all__";function Tl(e){return Io[e]??Io.default}function xx(e,t){const n=pr[e];return n||{label:t?.title??ni(e),description:t?.description??""}}function wx(e){const{key:t,schema:n,uiHints:s}=e;if(!n||ve(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([o,r])=>{const l=bt([t,o],s),a=l?.label??r.title??ni(o),d=l?.help??r.description??"",g=l?.order??50;return{key:o,label:a,description:d,order:g}});return i.sort((o,r)=>o.order!==r.order?o.order-r.order:o.key.localeCompare(r.key)),i}function Sx(e,t){if(!e||!t)return[];const n=[];function s(i,o,r){if(i===o)return;if(typeof i!=typeof o){n.push({path:r,from:i,to:o});return}if(typeof i!="object"||i===null||o===null){i!==o&&n.push({path:r,from:i,to:o});return}if(Array.isArray(i)&&Array.isArray(o)){JSON.stringify(i)!==JSON.stringify(o)&&n.push({path:r,from:i,to:o});return}const l=i,a=o,d=new Set([...Object.keys(l),...Object.keys(a)]);for(const g of d)s(l[g],a[g],r?`${r}.${g}`:g)}return s(e,t,""),n}function El(e,t=40){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length<=t?n:n.slice(0,t-3)+"..."}function kx(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=Bd(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},o=Al.filter(M=>M.key in i),r=new Set(Al.map(M=>M.key)),l=Object.keys(i).filter(M=>!r.has(M)).map(M=>({key:M,label:M.charAt(0).toUpperCase()+M.slice(1)})),a=[...o,...l],d=e.activeSection&&n.schema&&ve(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,g=e.activeSection?xx(e.activeSection,d):null,u=e.activeSection?wx({key:e.activeSection,schema:d,uiHints:e.uiHints}):[],f=e.formMode==="form"&&!!e.activeSection&&u.length>0,v=e.activeSubsection===Cl,m=e.searchQuery||v?null:e.activeSubsection??u[0]?.key??null,S=e.formMode==="form"?Sx(e.originalValue,e.formValue):[],C=e.formMode==="raw"&&e.raw!==e.originalRaw,R=e.formMode==="form"?S.length>0:C,I=!!e.formValue&&!e.loading&&!!n.schema,A=e.connected&&!e.saving&&R&&(e.formMode==="raw"?!0:I),w=e.connected&&!e.applying&&!e.updating&&R&&(e.formMode==="raw"?!0:I),L=e.connected&&!e.applying&&!e.updating,_=new Set(bx(e.searchQuery));return c`
|
|
5902
5902
|
<div class="config-layout">
|
|
5903
5903
|
<!-- Sidebar -->
|
|
5904
5904
|
<aside class="config-sidebar">
|
|
@@ -5958,13 +5958,13 @@ ${e.sidebarContent}
|
|
|
5958
5958
|
<span class="config-search__tag-caret" aria-hidden="true">▾</span>
|
|
5959
5959
|
</summary>
|
|
5960
5960
|
<div class="config-search__tag-menu">
|
|
5961
|
-
${$x.map(M=>{const
|
|
5961
|
+
${$x.map(M=>{const K=_.has(M);return c`
|
|
5962
5962
|
<button
|
|
5963
5963
|
type="button"
|
|
5964
|
-
class="config-search__tag-option ${
|
|
5964
|
+
class="config-search__tag-option ${K?"active":""}"
|
|
5965
5965
|
data-tag="${M}"
|
|
5966
|
-
aria-pressed=${
|
|
5967
|
-
@click=${()=>{const G=
|
|
5966
|
+
aria-pressed=${K?"true":"false"}
|
|
5967
|
+
@click=${()=>{const G=K?Array.from(_).filter(b=>b!==M):[..._,M];e.onSearchChange(yx(e.searchQuery,G))}}
|
|
5968
5968
|
>
|
|
5969
5969
|
tag:${M}
|
|
5970
5970
|
</button>
|
|
@@ -7046,7 +7046,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7046
7046
|
</span>
|
|
7047
7047
|
</div>
|
|
7048
7048
|
</div>
|
|
7049
|
-
`}function Ox(e){switch(e){case"ok":return p("cron.runs.runStatusOk");case"error":return p("cron.runs.runStatusError");case"skipped":return p("cron.runs.runStatusSkipped");default:return p("cron.runs.runStatusUnknown")}}function Ux(e){switch(e){case"delivered":return p("cron.runs.deliveryDelivered");case"not-delivered":return p("cron.runs.deliveryNotDelivered");case"not-requested":return p("cron.runs.deliveryNotRequested");case"unknown":return p("cron.runs.deliveryUnknown");default:return p("cron.runs.deliveryUnknown")}}function Bx(e,t){const n=typeof e.sessionKey=="string"&&e.sessionKey.trim().length>0?`${
|
|
7049
|
+
`}function Ox(e){switch(e){case"ok":return p("cron.runs.runStatusOk");case"error":return p("cron.runs.runStatusError");case"skipped":return p("cron.runs.runStatusSkipped");default:return p("cron.runs.runStatusUnknown")}}function Ux(e){switch(e){case"delivered":return p("cron.runs.deliveryDelivered");case"not-delivered":return p("cron.runs.deliveryNotDelivered");case"not-requested":return p("cron.runs.deliveryNotRequested");case"unknown":return p("cron.runs.deliveryUnknown");default:return p("cron.runs.deliveryUnknown")}}function Bx(e,t){const n=typeof e.sessionKey=="string"&&e.sessionKey.trim().length>0?`${ci("chat",t)}?session=${encodeURIComponent(e.sessionKey)}`:null,s=Ox(e.status??"unknown"),i=Ux(e.deliveryStatus??"not-requested"),o=e.usage,r=o&&typeof o.total_tokens=="number"?`${o.total_tokens} tokens`:o&&typeof o.input_tokens=="number"&&typeof o.output_tokens=="number"?`${o.input_tokens} in / ${o.output_tokens} out`:null;return c`
|
|
7050
7050
|
<div class="list-item cron-run-entry">
|
|
7051
7051
|
<div class="list-main cron-run-entry__main">
|
|
7052
7052
|
<div class="list-title cron-run-entry__title">
|
|
@@ -7528,7 +7528,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7528
7528
|
updated.
|
|
7529
7529
|
</div>
|
|
7530
7530
|
`:h}
|
|
7531
|
-
<div class="form-grid" style="margin-top: 16px;">
|
|
7531
|
+
<div class="form-grid models-provider-form-grid" style="margin-top: 16px;">
|
|
7532
7532
|
<label class="field">
|
|
7533
7533
|
<span>Display name</span>
|
|
7534
7534
|
<input
|
|
@@ -7543,7 +7543,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7543
7543
|
<input .value=${e.draft.providerIdHint} disabled />
|
|
7544
7544
|
</label>
|
|
7545
7545
|
<label class="field">
|
|
7546
|
-
<span>Base URL</span>
|
|
7546
|
+
<span>Base URL <span class="muted" style="font-size: 11px;">end with /v1</span></span>
|
|
7547
7547
|
<input
|
|
7548
7548
|
.value=${e.draft.baseUrl}
|
|
7549
7549
|
?disabled=${e.draft.readonlyModelIdentity}
|
|
@@ -7560,7 +7560,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7560
7560
|
@input=${i=>e.onDraftChange("modelId",i.target.value)}
|
|
7561
7561
|
/>
|
|
7562
7562
|
</label>
|
|
7563
|
-
<label class="field
|
|
7563
|
+
<label class="field full">
|
|
7564
7564
|
<span>API Key</span>
|
|
7565
7565
|
<input
|
|
7566
7566
|
type="password"
|
|
@@ -7814,7 +7814,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7814
7814
|
<div class="muted">No allowlist entries yet.</div>
|
|
7815
7815
|
`:n.map((s,i)=>yw(e,s,i))}
|
|
7816
7816
|
</div>
|
|
7817
|
-
`}function yw(e,t,n){const s=t.lastUsedAt?ne(t.lastUsedAt):"never",i=t.lastUsedCommand?
|
|
7817
|
+
`}function yw(e,t,n){const s=t.lastUsedAt?ne(t.lastUsedAt):"never",i=t.lastUsedCommand?so(t.lastUsedCommand,120):null,o=t.lastResolvedPath?so(t.lastResolvedPath,120):null;return c`
|
|
7818
7818
|
<div class="list-item">
|
|
7819
7819
|
<div class="list-main">
|
|
7820
7820
|
<div class="list-title">${t.pattern?.trim()?t.pattern:"New pattern"}</div>
|
|
@@ -7907,7 +7907,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7907
7907
|
</div>
|
|
7908
7908
|
</div>
|
|
7909
7909
|
</div>
|
|
7910
|
-
`}function kw(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${
|
|
7910
|
+
`}function kw(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${no(e.roles)}`,o=`scopes: ${no(e.scopes)}`,r=Array.isArray(e.tokens)?e.tokens:[];return c`
|
|
7911
7911
|
<div class="list-item">
|
|
7912
7912
|
<div class="list-main">
|
|
7913
7913
|
<div class="list-title">${n}</div>
|
|
@@ -7923,7 +7923,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7923
7923
|
`}
|
|
7924
7924
|
</div>
|
|
7925
7925
|
</div>
|
|
7926
|
-
`}function Aw(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${
|
|
7926
|
+
`}function Aw(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${no(t.scopes)}`,o=ne(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return c`
|
|
7927
7927
|
<div class="row" style="justify-content: space-between; gap: 8px;">
|
|
7928
7928
|
<div class="list-sub">${t.role} · ${s} · ${i} · ${o}</div>
|
|
7929
7929
|
<div class="row" style="justify-content: flex-end; gap: 6px; flex-wrap: wrap;">
|
|
@@ -8337,7 +8337,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8337
8337
|
`:t.map(n=>Kw(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
|
|
8338
8338
|
</div>
|
|
8339
8339
|
</section>
|
|
8340
|
-
`}function Kw(e,t,n,s,i){const o=e.updatedAt?ne(e.updatedAt):"n/a",r=e.thinkingLevel??"",l=xu(e.modelProvider),a=Hw(r,l),d=Bl(Uw(e.modelProvider),a),g=e.verboseLevel??"",u=Bw(Fw,g),f=e.reasoningLevel??"",v=Bl(Nw,f),m=typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName.trim():null,S=typeof e.label=="string"?e.label.trim():"",C=!!(m&&m!==e.key&&m!==S),R=e.kind!=="global",I=R?`${
|
|
8340
|
+
`}function Kw(e,t,n,s,i){const o=e.updatedAt?ne(e.updatedAt):"n/a",r=e.thinkingLevel??"",l=xu(e.modelProvider),a=Hw(r,l),d=Bl(Uw(e.modelProvider),a),g=e.verboseLevel??"",u=Bw(Fw,g),f=e.reasoningLevel??"",v=Bl(Nw,f),m=typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName.trim():null,S=typeof e.label=="string"?e.label.trim():"",C=!!(m&&m!==e.key&&m!==S),R=e.kind!=="global",I=R?`${ci("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return c`
|
|
8341
8341
|
<div class="table-row">
|
|
8342
8342
|
<div class="mono session-key-cell">
|
|
8343
8343
|
${R?c`<a href=${I} class="session-link">${e.key}</a>`:e.key}
|
|
@@ -8440,7 +8440,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8440
8440
|
<div class="list-title">
|
|
8441
8441
|
${e.emoji?`${e.emoji} `:""}${e.name}
|
|
8442
8442
|
</div>
|
|
8443
|
-
<div class="list-sub">${
|
|
8443
|
+
<div class="list-sub">${so(e.description,140)}</div>
|
|
8444
8444
|
${Nd({skill:e,showBundledBadge:r})}
|
|
8445
8445
|
${l.length>0?c`
|
|
8446
8446
|
<div class="muted" style="margin-top: 6px;">
|
|
@@ -8496,7 +8496,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8496
8496
|
`:h}
|
|
8497
8497
|
</div>
|
|
8498
8498
|
</div>
|
|
8499
|
-
`}const Gw=["off","minimal","low","medium","high"],Vw=["UTC","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","Europe/London","Europe/Berlin","Asia/Tokyo"],Jw=new Set(["chat","overview","market","models"]);function Qw(e){return/^https?:\/\//i.test(e.trim())}function
|
|
8499
|
+
`}const Gw=["off","minimal","low","medium","high"],Vw=["UTC","America/Los_Angeles","America/Denver","America/Chicago","America/New_York","Europe/London","Europe/Berlin","Asia/Tokyo"],Jw=new Set(["chat","overview","market","models"]);function Qw(e){return/^https?:\/\//i.test(e.trim())}function Yi(e){return typeof e=="string"?e.trim():""}function Hl(e){const t=new Set,n=[];for(const s of e){const i=s.trim();if(!i)continue;const o=i.toLowerCase();t.has(o)||(t.add(o),n.push(i))}return n}function Yw(e){const t=typeof e.hello?.server?.version=="string"&&e.hello.server.version.trim()||e.updateAvailable?.currentVersion||p("common.na"),n=e.updateAvailable&&e.updateAvailable.latestVersion!==e.updateAvailable.currentVersion?e.updateAvailable:null,s=n?"warn":"ok",i=e.presenceEntries.length,o=e.sessionsResult?.count??null,r=e.cronStatus?.nextWakeAtMs??null,l=e.connected?null:p("chat.disconnected"),a=e.tab==="chat",d=a&&(e.settings.chatFocusMode||e.onboarding),g=e.onboarding?!1:e.settings.chatShowThinking,u=e.configForm??e.configSnapshot?.config,f=u?.bitseek?.advancedMode===!0,v=async()=>{if(!e.client||!e.connected||e.configSaving||!e.configSnapshot?.hash&&(await Ae(e),!e.configSnapshot?.hash))return;!f?Me(e,["bitseek","advancedMode"],!0):qe(e,["bitseek","advancedMode"]),await On(e)},m=Xt(e.basePath??""),S=m?`${m}/favicon.svg`:"/favicon.svg",C=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null,R=bo(new Set([...e.agentsList?.agents?.map(b=>b.id.trim())??[],...e.cronJobs.map(b=>typeof b.agentId=="string"?b.agentId.trim():"").filter(Boolean)].filter(Boolean))),I=bo(new Set([...e.cronModelSuggestions,...ub(u),...e.cronJobs.map(b=>b.payload.kind!=="agentTurn"||typeof b.payload.model!="string"?"":b.payload.model.trim()).filter(Boolean)].filter(Boolean))),A=tf(e),w=e.cronForm.deliveryChannel&&e.cronForm.deliveryChannel.trim()?e.cronForm.deliveryChannel.trim():"last",L=e.cronJobs.map(b=>Yi(b.delivery?.to)).filter(Boolean),_=(w==="last"?Object.values(e.channelsSnapshot?.channelAccounts??{}).flat():e.channelsSnapshot?.channelAccounts?.[w]??[]).flatMap(b=>[Yi(b.accountId),Yi(b.name)]).filter(Boolean),M=Hl([...L,..._]),K=Hl(_),G=e.cronForm.deliveryMode==="webhook"?M.filter(b=>Qw(b)):M;return c`
|
|
8500
8500
|
<div class="shell ${a?"shell--chat":""} ${d?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
|
|
8501
8501
|
<header class="topbar">
|
|
8502
8502
|
<div class="topbar-left">
|
|
@@ -8546,8 +8546,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8546
8546
|
</div>
|
|
8547
8547
|
</header>
|
|
8548
8548
|
<aside class="nav ${e.settings.navCollapsed?"nav--collapsed":""}">
|
|
8549
|
-
${Wp.map(b=>{const T=f?b.tabs:b.tabs.filter(V=>Jw.has(V));if(T.length===0)return h;const N=e.settings.navGroupsCollapsed[b.label]??!1,
|
|
8550
|
-
<div class="nav-group ${N&&!
|
|
8549
|
+
${Wp.map(b=>{const T=f?b.tabs:b.tabs.filter(V=>Jw.has(V));if(T.length===0)return h;const N=e.settings.navGroupsCollapsed[b.label]??!1,W=T.some(V=>V===e.tab);return c`
|
|
8550
|
+
<div class="nav-group ${N&&!W?"nav-group--collapsed":""}">
|
|
8551
8551
|
<button
|
|
8552
8552
|
class="nav-label"
|
|
8553
8553
|
@click=${()=>{const V={...e.settings.navGroupsCollapsed};V[b.label]=!N,e.applySettings({...e.settings,navGroupsCollapsed:V})}}
|
|
@@ -8591,7 +8591,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8591
8591
|
</div>`:h}
|
|
8592
8592
|
<section class="content-header">
|
|
8593
8593
|
<div>
|
|
8594
|
-
${e.tab==="usage"?h:c`<div class="page-title">${
|
|
8594
|
+
${e.tab==="usage"?h:c`<div class="page-title">${uo(e.tab)}</div>`}
|
|
8595
8595
|
${e.tab==="usage"?h:c`<div class="page-sub">${Gp(e.tab)}</div>`}
|
|
8596
8596
|
</div>
|
|
8597
8597
|
<div class="page-meta">
|
|
@@ -8610,30 +8610,30 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
8610
8610
|
|
|
8611
8611
|
${Cv(e)}
|
|
8612
8612
|
|
|
8613
|
-
${e.tab==="cron"?Rx({basePath:e.basePath,loading:e.cronLoading,jobsLoadingMore:e.cronJobsLoadingMore,status:e.cronStatus,jobs:A,jobsTotal:e.cronJobsTotal,jobsHasMore:e.cronJobsHasMore,jobsQuery:e.cronJobsQuery,jobsEnabledFilter:e.cronJobsEnabledFilter,jobsScheduleKindFilter:e.cronJobsScheduleKindFilter,jobsLastStatusFilter:e.cronJobsLastStatusFilter,jobsSortBy:e.cronJobsSortBy,jobsSortDir:e.cronJobsSortDir,error:e.cronError,busy:e.cronBusy,form:e.cronForm,fieldErrors:e.cronFieldErrors,canSubmit:!hc(e.cronFieldErrors),editingJobId:e.cronEditingJobId,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(b=>b.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,runsTotal:e.cronRunsTotal,runsHasMore:e.cronRunsHasMore,runsLoadingMore:e.cronRunsLoadingMore,runsScope:e.cronRunsScope,runsStatuses:e.cronRunsStatuses,runsDeliveryStatuses:e.cronRunsDeliveryStatuses,runsStatusFilter:e.cronRunsStatusFilter,runsQuery:e.cronRunsQuery,runsSortDir:e.cronRunsSortDir,agentSuggestions:R,modelSuggestions:I,thinkingSuggestions:Gw,timezoneSuggestions:Vw,deliveryToSuggestions:G,accountSuggestions:
|
|
8613
|
+
${e.tab==="cron"?Rx({basePath:e.basePath,loading:e.cronLoading,jobsLoadingMore:e.cronJobsLoadingMore,status:e.cronStatus,jobs:A,jobsTotal:e.cronJobsTotal,jobsHasMore:e.cronJobsHasMore,jobsQuery:e.cronJobsQuery,jobsEnabledFilter:e.cronJobsEnabledFilter,jobsScheduleKindFilter:e.cronJobsScheduleKindFilter,jobsLastStatusFilter:e.cronJobsLastStatusFilter,jobsSortBy:e.cronJobsSortBy,jobsSortDir:e.cronJobsSortDir,error:e.cronError,busy:e.cronBusy,form:e.cronForm,fieldErrors:e.cronFieldErrors,canSubmit:!hc(e.cronFieldErrors),editingJobId:e.cronEditingJobId,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(b=>b.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,runsTotal:e.cronRunsTotal,runsHasMore:e.cronRunsHasMore,runsLoadingMore:e.cronRunsLoadingMore,runsScope:e.cronRunsScope,runsStatuses:e.cronRunsStatuses,runsDeliveryStatuses:e.cronRunsDeliveryStatuses,runsStatusFilter:e.cronRunsStatusFilter,runsQuery:e.cronRunsQuery,runsSortDir:e.cronRunsSortDir,agentSuggestions:R,modelSuggestions:I,thinkingSuggestions:Gw,timezoneSuggestions:Vw,deliveryToSuggestions:G,accountSuggestions:K,onFormChange:b=>{e.cronForm=zo({...e.cronForm,...b}),e.cronFieldErrors=is(e.cronForm)},onRefresh:()=>e.loadCron(),onAdd:()=>cf(e),onEdit:b=>pf(e,b),onClone:b=>mf(e,b),onCancelEdit:()=>vf(e),onToggle:(b,T)=>df(e,b,T),onRun:(b,T)=>uf(e,b,T??"force"),onRemove:b=>gf(e,b),onLoadRuns:async b=>{aa(e,{cronRunsScope:"job"}),await yt(e,b)},onLoadMoreJobs:()=>ef(e),onJobsFiltersChange:async b=>{ra(e,b),(typeof b.cronJobsQuery=="string"||b.cronJobsEnabledFilter||b.cronJobsSortBy||b.cronJobsSortDir)&&await oa(e)},onJobsFiltersReset:async()=>{ra(e,{cronJobsQuery:"",cronJobsEnabledFilter:"all",cronJobsScheduleKindFilter:"all",cronJobsLastStatusFilter:"all",cronJobsSortBy:"nextRunAtMs",cronJobsSortDir:"asc"}),await oa(e)},onLoadMoreRuns:()=>ff(e),onRunsFiltersChange:async b=>{if(aa(e,b),e.cronRunsScope==="all"){await yt(e,null);return}await yt(e,e.cronRunsJobId)}}):h}
|
|
8614
8614
|
|
|
8615
|
-
${e.tab==="agents"?Nb({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:C,activePanel:e.agentsPanel,configForm:u,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,channelsLoading:e.channelsLoading,channelsError:e.channelsError,channelsSnapshot:e.channelsSnapshot,channelsLastSuccess:e.channelsLastSuccess,cronLoading:e.cronLoading,cronStatus:e.cronStatus,cronJobs:e.cronJobs,cronError:e.cronError,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFilesList:e.agentFilesList,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,agentIdentityLoading:e.agentIdentityLoading,agentIdentityError:e.agentIdentityError,agentIdentityById:e.agentIdentityById,agentSkillsLoading:e.agentSkillsLoading,agentSkillsReport:e.agentSkillsReport,agentSkillsError:e.agentSkillsError,agentSkillsAgentId:e.agentSkillsAgentId,toolsCatalogLoading:e.toolsCatalogLoading,toolsCatalogError:e.toolsCatalogError,toolsCatalogResult:e.toolsCatalogResult,skillsFilter:e.skillsFilter,onRefresh:async()=>{await Uo(e);const b=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null;await Hn(e,b);const T=e.agentsList?.agents?.map(N=>N.id)??[];T.length>0&&fc(e,T)},onSelectAgent:b=>{e.agentsSelectedId!==b&&(e.agentsSelectedId=b,e.agentFilesList=null,e.agentFilesError=null,e.agentFilesLoading=!1,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,gc(e,b),e.agentsPanel==="tools"&&Hn(e,b),e.agentsPanel==="files"&&
|
|
8615
|
+
${e.tab==="agents"?Nb({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:C,activePanel:e.agentsPanel,configForm:u,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,channelsLoading:e.channelsLoading,channelsError:e.channelsError,channelsSnapshot:e.channelsSnapshot,channelsLastSuccess:e.channelsLastSuccess,cronLoading:e.cronLoading,cronStatus:e.cronStatus,cronJobs:e.cronJobs,cronError:e.cronError,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFilesList:e.agentFilesList,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,agentIdentityLoading:e.agentIdentityLoading,agentIdentityError:e.agentIdentityError,agentIdentityById:e.agentIdentityById,agentSkillsLoading:e.agentSkillsLoading,agentSkillsReport:e.agentSkillsReport,agentSkillsError:e.agentSkillsError,agentSkillsAgentId:e.agentSkillsAgentId,toolsCatalogLoading:e.toolsCatalogLoading,toolsCatalogError:e.toolsCatalogError,toolsCatalogResult:e.toolsCatalogResult,skillsFilter:e.skillsFilter,onRefresh:async()=>{await Uo(e);const b=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null;await Hn(e,b);const T=e.agentsList?.agents?.map(N=>N.id)??[];T.length>0&&fc(e,T)},onSelectAgent:b=>{e.agentsSelectedId!==b&&(e.agentsSelectedId=b,e.agentFilesList=null,e.agentFilesError=null,e.agentFilesLoading=!1,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,gc(e,b),e.agentsPanel==="tools"&&Hn(e,b),e.agentsPanel==="files"&&Ui(e,b),e.agentsPanel==="skills"&&Es(e,b))},onSelectPanel:b=>{e.agentsPanel=b,b==="files"&&C&&e.agentFilesList?.agentId!==C&&(e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},Ui(e,C)),b==="tools"&&Hn(e,C),b==="skills"&&C&&Es(e,C),b==="channels"&&Re(e,!1),b==="cron"&&e.loadCron()},onLoadFiles:b=>Ui(e,b),onSelectFile:b=>{e.agentFileActive=b,C&&Gv(e,C,b)},onFileDraftChange:(b,T)=>{e.agentFileDrafts={...e.agentFileDrafts,[b]:T}},onFileReset:b=>{const T=e.agentFileContents[b]??"";e.agentFileDrafts={...e.agentFileDrafts,[b]:T}},onFileSave:b=>{if(!C)return;const T=e.agentFileDrafts[b]??e.agentFileContents[b]??"";Vv(e,C,b,T)},onToolsProfileChange:(b,T,N)=>{if(!u)return;const W=u.agents?.list;if(!Array.isArray(W))return;const V=W.findIndex(O=>O&&typeof O=="object"&&"id"in O&&O.id===b);if(V<0)return;const E=["agents","list",V,"tools"];T?Me(e,[...E,"profile"],T):qe(e,[...E,"profile"]),N&&qe(e,[...E,"allow"])},onToolsOverridesChange:(b,T,N)=>{if(!u)return;const W=u.agents?.list;if(!Array.isArray(W))return;const V=W.findIndex(O=>O&&typeof O=="object"&&"id"in O&&O.id===b);if(V<0)return;const E=["agents","list",V,"tools"];T.length>0?Me(e,[...E,"alsoAllow"],T):qe(e,[...E,"alsoAllow"]),N.length>0?Me(e,[...E,"deny"],N):qe(e,[...E,"deny"])},onConfigReload:()=>Ae(e),onConfigSave:()=>On(e),onChannelsRefresh:()=>Re(e,!1),onCronRefresh:()=>e.loadCron(),onSkillsFilterChange:b=>e.skillsFilter=b,onSkillsRefresh:()=>{C&&Es(e,C)},onAgentSkillToggle:(b,T,N)=>{if(!u)return;const W=u.agents?.list;if(!Array.isArray(W))return;const V=W.findIndex(F=>F&&typeof F=="object"&&"id"in F&&F.id===b);if(V<0)return;const E=W[V],O=T.trim();if(!O)return;const q=e.agentSkillsReport?.skills?.map(F=>F.name).filter(Boolean)??[],re=(Array.isArray(E.skills)?E.skills.map(F=>String(F).trim()).filter(Boolean):void 0)??q,D=new Set(re);N?D.add(O):D.delete(O),Me(e,["agents","list",V,"skills"],[...D])},onAgentSkillsClear:b=>{if(!u)return;const T=u.agents?.list;if(!Array.isArray(T))return;const N=T.findIndex(W=>W&&typeof W=="object"&&"id"in W&&W.id===b);N<0||qe(e,["agents","list",N,"skills"])},onAgentSkillsDisableAll:b=>{if(!u)return;const T=u.agents?.list;if(!Array.isArray(T))return;const N=T.findIndex(W=>W&&typeof W=="object"&&"id"in W&&W.id===b);N<0||Me(e,["agents","list",N,"skills"],[])},onModelChange:(b,T)=>{if(!u)return;const N=u.agents?.list;if(!Array.isArray(N))return;const W=N.findIndex(q=>q&&typeof q=="object"&&"id"in q&&q.id===b);if(W<0)return;const V=["agents","list",W,"model"];if(!T){qe(e,V);return}const O=N[W]?.model;if(O&&typeof O=="object"&&!Array.isArray(O)){const q=O.fallbacks,oe={primary:T,...Array.isArray(q)?{fallbacks:q}:{}};Me(e,V,oe)}else Me(e,V,T)},onModelFallbacksChange:(b,T)=>{if(!u)return;const N=u.agents?.list;if(!Array.isArray(N))return;const W=N.findIndex(F=>F&&typeof F=="object"&&"id"in F&&F.id===b);if(W<0)return;const V=["agents","list",W,"model"],E=N[W],O=T.map(F=>F.trim()).filter(Boolean),q=E.model,re=(()=>{if(typeof q=="string")return q.trim()||null;if(q&&typeof q=="object"&&!Array.isArray(q)){const F=q.primary;if(typeof F=="string")return F.trim()||null}return null})();if(O.length===0){re?Me(e,V,re):qe(e,V);return}Me(e,V,re?{primary:re,fallbacks:O}:{fallbacks:O})}}):h}
|
|
8616
8616
|
|
|
8617
8617
|
${e.tab==="skills"?Ww({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:b=>e.skillsFilter=b,onRefresh:()=>ls(e,{clearMessages:!0}),onToggle:(b,T)=>zp(e,b,T),onEdit:(b,T)=>Hp(e,b,T),onSaveKey:b=>jp(e,b),onInstall:(b,T,N)=>Kp(e,b,T,N)}):h}
|
|
8618
8618
|
|
|
8619
8619
|
${e.tab==="market"?ow({loading:e.marketLoading,catalog:e.marketCatalog,error:e.marketError,filter:e.marketFilter,busyKey:e.marketBusyKey,messages:e.marketMessages,onFilterChange:b=>e.marketFilter=b,onRefresh:()=>Xo(e),onAction:b=>ip(e,b)}):h}
|
|
8620
8620
|
|
|
8621
|
-
${e.tab==="nodes"?xw({loading:e.nodesLoading,nodes:e.nodes,devicesLoading:e.devicesLoading,devicesError:e.devicesError,devicesList:e.devicesList,configForm:e.configForm??e.configSnapshot?.config,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,configFormMode:e.configFormMode,execApprovalsLoading:e.execApprovalsLoading,execApprovalsSaving:e.execApprovalsSaving,execApprovalsDirty:e.execApprovalsDirty,execApprovalsSnapshot:e.execApprovalsSnapshot,execApprovalsForm:e.execApprovalsForm,execApprovalsSelectedAgent:e.execApprovalsSelectedAgent,execApprovalsTarget:e.execApprovalsTarget,execApprovalsTargetNodeId:e.execApprovalsTargetNodeId,onRefresh:()=>
|
|
8621
|
+
${e.tab==="nodes"?xw({loading:e.nodesLoading,nodes:e.nodes,devicesLoading:e.devicesLoading,devicesError:e.devicesError,devicesList:e.devicesList,configForm:e.configForm??e.configSnapshot?.config,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,configFormMode:e.configFormMode,execApprovalsLoading:e.execApprovalsLoading,execApprovalsSaving:e.execApprovalsSaving,execApprovalsDirty:e.execApprovalsDirty,execApprovalsSnapshot:e.execApprovalsSnapshot,execApprovalsForm:e.execApprovalsForm,execApprovalsSelectedAgent:e.execApprovalsSelectedAgent,execApprovalsTarget:e.execApprovalsTarget,execApprovalsTargetNodeId:e.execApprovalsTargetNodeId,onRefresh:()=>ii(e),onDevicesRefresh:()=>Et(e),onDeviceApprove:b=>Vf(e,b),onDeviceReject:b=>Jf(e,b),onDeviceRotate:(b,T,N)=>Qf(e,{deviceId:b,role:T,scopes:N}),onDeviceRevoke:(b,T)=>Yf(e,{deviceId:b,role:T}),onLoadConfig:()=>Ae(e),onLoadExecApprovals:()=>{const b=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Yo(e,b)},onBindDefault:b=>{b?Me(e,["tools","exec","node"],b):qe(e,["tools","exec","node"])},onBindAgent:(b,T)=>{const N=["agents","list",b,"tools","exec","node"];T?Me(e,N,T):qe(e,N)},onSaveBindings:()=>On(e),onExecApprovalsTargetChange:(b,T)=>{e.execApprovalsTarget=b,e.execApprovalsTargetNodeId=T,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:b=>{e.execApprovalsSelectedAgent=b},onExecApprovalsPatch:(b,T)=>np(e,b,T),onExecApprovalsRemove:b=>sp(e,b),onSaveExecApprovals:()=>{const b=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return tp(e,b)}}):h}
|
|
8622
8622
|
|
|
8623
|
-
${e.tab==="chat"?hx({sessionKey:e.sessionKey,onSessionKeyChange:b=>{e.sessionKey=b,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:b,lastActiveSessionKey:b}),e.loadAssistantIdentity(),es(e),
|
|
8623
|
+
${e.tab==="chat"?hx({sessionKey:e.sessionKey,onSessionKeyChange:b=>{e.sessionKey=b,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:b,lastActiveSessionKey:b}),e.loadAssistantIdentity(),es(e),fo(e)},thinkingLevel:e.chatThinkingLevel,showThinking:g,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,fallbackStatus:e.fallbackStatus,brandAvatarUrl:S,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:d,onRefresh:()=>(e.resetToolStream(),Promise.all([es(e),fo(e)])),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:b=>e.handleChatScroll(b),onDraftChange:b=>e.chatMessage=b,attachments:e.chatAttachments,onAttachmentsChange:b=>e.chatAttachments=b,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:b=>e.removeQueuedMessage(b),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),showNewMessages:e.chatNewMessagesBelow&&!e.chatManualRefreshInFlight,onScrollToBottom:()=>e.scrollToBottom(),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:b=>e.handleOpenSidebar(b),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:b=>e.handleSplitRatioChange(b),assistantName:e.assistantName}):h}
|
|
8624
8624
|
|
|
8625
8625
|
${e.tab==="models"?rw({loading:e.modelsLoading,saving:e.modelsSaving,defaultSaving:e.modelsDefaultSaving,verifyBusy:e.modelsVerifyBusy,error:e.modelsError,providers:e.modelsProviders,modelOptions:e.modelsSwitchableModels,selectedProviderId:e.modelsSelectedProviderId,selectedDefault:e.modelsSelectedDefault,draft:e.modelsDraft,defaultState:e.modelsDefaultState,verifyState:e.modelsVerifyState,onReload:()=>zc(e),onSelectProvider:b=>ma(e,b),onAddProvider:()=>ma(e,Np()),onDraftChange:(b,T)=>Mp(e,b,T),onDefaultChange:b=>Fp(e,b),onSaveDefault:()=>Lp(e),onVerify:()=>Pp(e),onSave:()=>Rp(e),onDelete:()=>Dp(e)}):h}
|
|
8626
8626
|
|
|
8627
8627
|
${e.tab==="config"?kx({raw:e.configRaw,originalRaw:e.configRawOriginal,valid:e.configValid,issues:e.configIssues,loading:e.configLoading,saving:e.configSaving,applying:e.configApplying,updating:e.updateRunning,connected:e.connected,schema:e.configSchema,schemaLoading:e.configSchemaLoading,uiHints:e.configUiHints,formMode:e.configFormMode,formValue:e.configForm,originalValue:e.configFormOriginal,searchQuery:e.configSearchQuery,activeSection:e.configActiveSection,activeSubsection:e.configActiveSubsection,onRawChange:b=>{e.configRaw=b},onFormModeChange:b=>e.configFormMode=b,onFormPatch:(b,T)=>Me(e,b,T),onSearchChange:b=>e.configSearchQuery=b,onSectionChange:b=>{e.configActiveSection=b,e.configActiveSubsection=null},onSubsectionChange:b=>e.configActiveSubsection=b,onReload:()=>Ae(e),onSave:()=>On(e),onApply:()=>pg(e),onUpdate:()=>ta(e)}):h}
|
|
8628
8628
|
|
|
8629
|
-
${e.tab==="debug"?Hx({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:b=>e.debugCallMethod=b,onCallParamsChange:b=>e.debugCallParams=b,onRefresh:()=>
|
|
8629
|
+
${e.tab==="debug"?Hx({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:b=>e.debugCallMethod=b,onCallParamsChange:b=>e.debugCallParams=b,onRefresh:()=>si(e),onCall:()=>Fg(e)}):h}
|
|
8630
8630
|
|
|
8631
8631
|
${e.tab==="logs"?Jx({loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:b=>e.logsFilterText=b,onLevelToggle:(b,T)=>{e.logsLevelFilters={...e.logsLevelFilters,[b]:T}},onToggleAutoFollow:b=>e.logsAutoFollow=b,onRefresh:()=>Oo(e,{reset:!0}),onExport:(b,T)=>e.exportLogs(b,T),onScroll:b=>e.handleLogsScroll(b)}):h}
|
|
8632
8632
|
</main>
|
|
8633
8633
|
${jx(e)}
|
|
8634
8634
|
${Kx(e)}
|
|
8635
8635
|
</div>
|
|
8636
|
-
`}var Xw=Object.defineProperty,Zw=Object.getOwnPropertyDescriptor,$=(e,t,n,s)=>{for(var i=s>1?void 0:s?Zw(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(i=(s?r(t,n,i):r(i))||i);return s&&i&&Xw(t,n,i),i};const
|
|
8636
|
+
`}var Xw=Object.defineProperty,Zw=Object.getOwnPropertyDescriptor,$=(e,t,n,s)=>{for(var i=s>1?void 0:s?Zw(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(i=(s?r(t,n,i):r(i))||i);return s&&i&&Xw(t,n,i),i};const Xi=or({});function e1(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let y=class extends mn{constructor(){super(),this.i18nController=new ag(this),this.clientInstanceId=gi(),this.settings=Vp(),this.password="",this.tab="chat",this.onboarding=e1(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="light",this.hello=null,this.lastError=null,this.lastErrorCode=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=Xi.name,this.assistantAvatar=Xi.avatar,this.assistantAgentId=Xi.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.fallbackStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.chatManualRefreshInFlight=!1,this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
|
|
8637
8637
|
}
|
|
8638
|
-
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.modelsLoading=!1,this.modelsSaving=!1,this.modelsDefaultSaving=!1,this.modelsVerifyBusy=!1,this.modelsError=null,this.modelsProviders=[],this.modelsSwitchableModels=[],this.modelsSelectedProviderId=null,this.modelsSelectedDefault="",this.modelsDraft=null,this.modelsDefaultState=null,this.modelsVerifyState=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.toolsCatalogLoading=!1,this.toolsCatalogError=null,this.toolsCatalogResult=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.sessionsHideCron=!0,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageTimeSeriesCursorStart=null,this.usageTimeSeriesCursorEnd=null,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobsLoadingMore=!1,this.cronJobs=[],this.cronJobsTotal=0,this.cronJobsHasMore=!1,this.cronJobsNextOffset=null,this.cronJobsLimit=50,this.cronJobsQuery="",this.cronJobsEnabledFilter="all",this.cronJobsScheduleKindFilter="all",this.cronJobsLastStatusFilter="all",this.cronJobsSortBy="nextRunAtMs",this.cronJobsSortDir="asc",this.cronStatus=null,this.cronError=null,this.cronForm={...Ns},this.cronFieldErrors={},this.cronEditingJobId=null,this.cronRunsJobId=null,this.cronRunsLoadingMore=!1,this.cronRuns=[],this.cronRunsTotal=0,this.cronRunsHasMore=!1,this.cronRunsNextOffset=null,this.cronRunsLimit=50,this.cronRunsScope="all",this.cronRunsStatuses=[],this.cronRunsDeliveryStatuses=[],this.cronRunsStatusFilter="all",this.cronRunsQuery="",this.cronRunsSortDir="desc",this.cronModelSuggestions=[],this.cronBusy=!1,this.updateAvailable=null,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.marketLoading=!1,this.marketCatalog=[],this.marketError=null,this.marketFilter="",this.marketBusyKey=null,this.marketMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...Kg},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>ah(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,Xl(this.settings.locale)&&Jn.setLocale(this.settings.locale)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),hm(this)}firstUpdated(){mm(this)}disconnectedCallback(){vm(this),super.disconnectedCallback()}updated(e){bm(this,e)}connect(){md(this)}handleChatScroll(e){Rg(this,e)}handleLogsScroll(e){Lg(this,e)}exportLogs(e,t){Dg(e,t)}resetToolStream(){di(this)}resetChatScroll(){na(this)}scrollToBottom(e){na(this),ss(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await fd(this)}applySettings(e){At(this,e)}setTab(e){eh(this,e)}setTheme(e,t){th(this,e,t)}async loadOverview(){await Zc(this)}async loadCron(){await js(this)}async handleAbortChat(){await cd(this)}removeQueuedMessage(e){Kh(this,e)}async handleSendChat(e,t){await Wh(this,e,t)}async handleWhatsAppStart(e){await bg(this,e)}async handleWhatsAppWait(){await yg(this)}async handleWhatsAppLogout(){await $g(this)}async handleChannelConfigSave(){await xg(this)}async handleChannelConfigReload(){await wg(this)}handleNostrProfileEdit(e,t){Ag(this,e,t)}handleNostrProfileCancel(){Cg(this)}handleNostrProfileFieldChange(e,t){Tg(this,e,t)}async handleNostrProfileSave(){await _g(this)}async handleNostrProfileImport(){await Ig(this)}handleNostrProfileToggleAdvanced(){Eg(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,At(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return Yw(this)}};$([x()],y.prototype,"settings",2);$([x()],y.prototype,"password",2);$([x()],y.prototype,"tab",2);$([x()],y.prototype,"onboarding",2);$([x()],y.prototype,"connected",2);$([x()],y.prototype,"theme",2);$([x()],y.prototype,"themeResolved",2);$([x()],y.prototype,"hello",2);$([x()],y.prototype,"lastError",2);$([x()],y.prototype,"lastErrorCode",2);$([x()],y.prototype,"eventLog",2);$([x()],y.prototype,"assistantName",2);$([x()],y.prototype,"assistantAvatar",2);$([x()],y.prototype,"assistantAgentId",2);$([x()],y.prototype,"sessionKey",2);$([x()],y.prototype,"chatLoading",2);$([x()],y.prototype,"chatSending",2);$([x()],y.prototype,"chatMessage",2);$([x()],y.prototype,"chatMessages",2);$([x()],y.prototype,"chatToolMessages",2);$([x()],y.prototype,"chatStream",2);$([x()],y.prototype,"chatStreamStartedAt",2);$([x()],y.prototype,"chatRunId",2);$([x()],y.prototype,"compactionStatus",2);$([x()],y.prototype,"fallbackStatus",2);$([x()],y.prototype,"chatAvatarUrl",2);$([x()],y.prototype,"chatThinkingLevel",2);$([x()],y.prototype,"chatQueue",2);$([x()],y.prototype,"chatAttachments",2);$([x()],y.prototype,"chatManualRefreshInFlight",2);$([x()],y.prototype,"sidebarOpen",2);$([x()],y.prototype,"sidebarContent",2);$([x()],y.prototype,"sidebarError",2);$([x()],y.prototype,"splitRatio",2);$([x()],y.prototype,"nodesLoading",2);$([x()],y.prototype,"nodes",2);$([x()],y.prototype,"devicesLoading",2);$([x()],y.prototype,"devicesError",2);$([x()],y.prototype,"devicesList",2);$([x()],y.prototype,"execApprovalsLoading",2);$([x()],y.prototype,"execApprovalsSaving",2);$([x()],y.prototype,"execApprovalsDirty",2);$([x()],y.prototype,"execApprovalsSnapshot",2);$([x()],y.prototype,"execApprovalsForm",2);$([x()],y.prototype,"execApprovalsSelectedAgent",2);$([x()],y.prototype,"execApprovalsTarget",2);$([x()],y.prototype,"execApprovalsTargetNodeId",2);$([x()],y.prototype,"execApprovalQueue",2);$([x()],y.prototype,"execApprovalBusy",2);$([x()],y.prototype,"execApprovalError",2);$([x()],y.prototype,"pendingGatewayUrl",2);$([x()],y.prototype,"configLoading",2);$([x()],y.prototype,"configRaw",2);$([x()],y.prototype,"configRawOriginal",2);$([x()],y.prototype,"configValid",2);$([x()],y.prototype,"configIssues",2);$([x()],y.prototype,"configSaving",2);$([x()],y.prototype,"configApplying",2);$([x()],y.prototype,"updateRunning",2);$([x()],y.prototype,"applySessionKey",2);$([x()],y.prototype,"configSnapshot",2);$([x()],y.prototype,"configSchema",2);$([x()],y.prototype,"configSchemaVersion",2);$([x()],y.prototype,"configSchemaLoading",2);$([x()],y.prototype,"configUiHints",2);$([x()],y.prototype,"configForm",2);$([x()],y.prototype,"configFormOriginal",2);$([x()],y.prototype,"configFormDirty",2);$([x()],y.prototype,"configFormMode",2);$([x()],y.prototype,"configSearchQuery",2);$([x()],y.prototype,"configActiveSection",2);$([x()],y.prototype,"configActiveSubsection",2);$([x()],y.prototype,"modelsLoading",2);$([x()],y.prototype,"modelsSaving",2);$([x()],y.prototype,"modelsDefaultSaving",2);$([x()],y.prototype,"modelsVerifyBusy",2);$([x()],y.prototype,"modelsError",2);$([x()],y.prototype,"modelsProviders",2);$([x()],y.prototype,"modelsSwitchableModels",2);$([x()],y.prototype,"modelsSelectedProviderId",2);$([x()],y.prototype,"modelsSelectedDefault",2);$([x()],y.prototype,"modelsDraft",2);$([x()],y.prototype,"modelsDefaultState",2);$([x()],y.prototype,"modelsVerifyState",2);$([x()],y.prototype,"channelsLoading",2);$([x()],y.prototype,"channelsSnapshot",2);$([x()],y.prototype,"channelsError",2);$([x()],y.prototype,"channelsLastSuccess",2);$([x()],y.prototype,"whatsappLoginMessage",2);$([x()],y.prototype,"whatsappLoginQrDataUrl",2);$([x()],y.prototype,"whatsappLoginConnected",2);$([x()],y.prototype,"whatsappBusy",2);$([x()],y.prototype,"nostrProfileFormState",2);$([x()],y.prototype,"nostrProfileAccountId",2);$([x()],y.prototype,"presenceLoading",2);$([x()],y.prototype,"presenceEntries",2);$([x()],y.prototype,"presenceError",2);$([x()],y.prototype,"presenceStatus",2);$([x()],y.prototype,"agentsLoading",2);$([x()],y.prototype,"agentsList",2);$([x()],y.prototype,"agentsError",2);$([x()],y.prototype,"agentsSelectedId",2);$([x()],y.prototype,"toolsCatalogLoading",2);$([x()],y.prototype,"toolsCatalogError",2);$([x()],y.prototype,"toolsCatalogResult",2);$([x()],y.prototype,"agentsPanel",2);$([x()],y.prototype,"agentFilesLoading",2);$([x()],y.prototype,"agentFilesError",2);$([x()],y.prototype,"agentFilesList",2);$([x()],y.prototype,"agentFileContents",2);$([x()],y.prototype,"agentFileDrafts",2);$([x()],y.prototype,"agentFileActive",2);$([x()],y.prototype,"agentFileSaving",2);$([x()],y.prototype,"agentIdentityLoading",2);$([x()],y.prototype,"agentIdentityError",2);$([x()],y.prototype,"agentIdentityById",2);$([x()],y.prototype,"agentSkillsLoading",2);$([x()],y.prototype,"agentSkillsError",2);$([x()],y.prototype,"agentSkillsReport",2);$([x()],y.prototype,"agentSkillsAgentId",2);$([x()],y.prototype,"sessionsLoading",2);$([x()],y.prototype,"sessionsResult",2);$([x()],y.prototype,"sessionsError",2);$([x()],y.prototype,"sessionsFilterActive",2);$([x()],y.prototype,"sessionsFilterLimit",2);$([x()],y.prototype,"sessionsIncludeGlobal",2);$([x()],y.prototype,"sessionsIncludeUnknown",2);$([x()],y.prototype,"sessionsHideCron",2);$([x()],y.prototype,"usageLoading",2);$([x()],y.prototype,"usageResult",2);$([x()],y.prototype,"usageCostSummary",2);$([x()],y.prototype,"usageError",2);$([x()],y.prototype,"usageStartDate",2);$([x()],y.prototype,"usageEndDate",2);$([x()],y.prototype,"usageSelectedSessions",2);$([x()],y.prototype,"usageSelectedDays",2);$([x()],y.prototype,"usageSelectedHours",2);$([x()],y.prototype,"usageChartMode",2);$([x()],y.prototype,"usageDailyChartMode",2);$([x()],y.prototype,"usageTimeSeriesMode",2);$([x()],y.prototype,"usageTimeSeriesBreakdownMode",2);$([x()],y.prototype,"usageTimeSeries",2);$([x()],y.prototype,"usageTimeSeriesLoading",2);$([x()],y.prototype,"usageTimeSeriesCursorStart",2);$([x()],y.prototype,"usageTimeSeriesCursorEnd",2);$([x()],y.prototype,"usageSessionLogs",2);$([x()],y.prototype,"usageSessionLogsLoading",2);$([x()],y.prototype,"usageSessionLogsExpanded",2);$([x()],y.prototype,"usageQuery",2);$([x()],y.prototype,"usageQueryDraft",2);$([x()],y.prototype,"usageSessionSort",2);$([x()],y.prototype,"usageSessionSortDir",2);$([x()],y.prototype,"usageRecentSessions",2);$([x()],y.prototype,"usageTimeZone",2);$([x()],y.prototype,"usageContextExpanded",2);$([x()],y.prototype,"usageHeaderPinned",2);$([x()],y.prototype,"usageSessionsTab",2);$([x()],y.prototype,"usageVisibleColumns",2);$([x()],y.prototype,"usageLogFilterRoles",2);$([x()],y.prototype,"usageLogFilterTools",2);$([x()],y.prototype,"usageLogFilterHasTools",2);$([x()],y.prototype,"usageLogFilterQuery",2);$([x()],y.prototype,"cronLoading",2);$([x()],y.prototype,"cronJobsLoadingMore",2);$([x()],y.prototype,"cronJobs",2);$([x()],y.prototype,"cronJobsTotal",2);$([x()],y.prototype,"cronJobsHasMore",2);$([x()],y.prototype,"cronJobsNextOffset",2);$([x()],y.prototype,"cronJobsLimit",2);$([x()],y.prototype,"cronJobsQuery",2);$([x()],y.prototype,"cronJobsEnabledFilter",2);$([x()],y.prototype,"cronJobsScheduleKindFilter",2);$([x()],y.prototype,"cronJobsLastStatusFilter",2);$([x()],y.prototype,"cronJobsSortBy",2);$([x()],y.prototype,"cronJobsSortDir",2);$([x()],y.prototype,"cronStatus",2);$([x()],y.prototype,"cronError",2);$([x()],y.prototype,"cronForm",2);$([x()],y.prototype,"cronFieldErrors",2);$([x()],y.prototype,"cronEditingJobId",2);$([x()],y.prototype,"cronRunsJobId",2);$([x()],y.prototype,"cronRunsLoadingMore",2);$([x()],y.prototype,"cronRuns",2);$([x()],y.prototype,"cronRunsTotal",2);$([x()],y.prototype,"cronRunsHasMore",2);$([x()],y.prototype,"cronRunsNextOffset",2);$([x()],y.prototype,"cronRunsLimit",2);$([x()],y.prototype,"cronRunsScope",2);$([x()],y.prototype,"cronRunsStatuses",2);$([x()],y.prototype,"cronRunsDeliveryStatuses",2);$([x()],y.prototype,"cronRunsStatusFilter",2);$([x()],y.prototype,"cronRunsQuery",2);$([x()],y.prototype,"cronRunsSortDir",2);$([x()],y.prototype,"cronModelSuggestions",2);$([x()],y.prototype,"cronBusy",2);$([x()],y.prototype,"updateAvailable",2);$([x()],y.prototype,"skillsLoading",2);$([x()],y.prototype,"skillsReport",2);$([x()],y.prototype,"skillsError",2);$([x()],y.prototype,"skillsFilter",2);$([x()],y.prototype,"skillEdits",2);$([x()],y.prototype,"skillsBusyKey",2);$([x()],y.prototype,"skillMessages",2);$([x()],y.prototype,"marketLoading",2);$([x()],y.prototype,"marketCatalog",2);$([x()],y.prototype,"marketError",2);$([x()],y.prototype,"marketFilter",2);$([x()],y.prototype,"marketBusyKey",2);$([x()],y.prototype,"marketMessages",2);$([x()],y.prototype,"debugLoading",2);$([x()],y.prototype,"debugStatus",2);$([x()],y.prototype,"debugHealth",2);$([x()],y.prototype,"debugModels",2);$([x()],y.prototype,"debugHeartbeat",2);$([x()],y.prototype,"debugCallMethod",2);$([x()],y.prototype,"debugCallParams",2);$([x()],y.prototype,"debugCallResult",2);$([x()],y.prototype,"debugCallError",2);$([x()],y.prototype,"logsLoading",2);$([x()],y.prototype,"logsError",2);$([x()],y.prototype,"logsFile",2);$([x()],y.prototype,"logsEntries",2);$([x()],y.prototype,"logsFilterText",2);$([x()],y.prototype,"logsLevelFilters",2);$([x()],y.prototype,"logsAutoFollow",2);$([x()],y.prototype,"logsTruncated",2);$([x()],y.prototype,"logsCursor",2);$([x()],y.prototype,"logsLastFetchAt",2);$([x()],y.prototype,"logsLimit",2);$([x()],y.prototype,"logsMaxBytes",2);$([x()],y.prototype,"logsAtBottom",2);$([x()],y.prototype,"chatNewMessagesBelow",2);y=$([Jl("openclaw-app")],y);
|
|
8639
|
-
//# sourceMappingURL=index-
|
|
8638
|
+
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.modelsLoading=!1,this.modelsSaving=!1,this.modelsDefaultSaving=!1,this.modelsVerifyBusy=!1,this.modelsError=null,this.modelsProviders=[],this.modelsSwitchableModels=[],this.modelsSelectedProviderId=null,this.modelsSelectedDefault="",this.modelsDraft=null,this.modelsDefaultState=null,this.modelsVerifyState=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.toolsCatalogLoading=!1,this.toolsCatalogError=null,this.toolsCatalogResult=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.sessionsHideCron=!0,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageTimeSeriesCursorStart=null,this.usageTimeSeriesCursorEnd=null,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobsLoadingMore=!1,this.cronJobs=[],this.cronJobsTotal=0,this.cronJobsHasMore=!1,this.cronJobsNextOffset=null,this.cronJobsLimit=50,this.cronJobsQuery="",this.cronJobsEnabledFilter="all",this.cronJobsScheduleKindFilter="all",this.cronJobsLastStatusFilter="all",this.cronJobsSortBy="nextRunAtMs",this.cronJobsSortDir="asc",this.cronStatus=null,this.cronError=null,this.cronForm={...Os},this.cronFieldErrors={},this.cronEditingJobId=null,this.cronRunsJobId=null,this.cronRunsLoadingMore=!1,this.cronRuns=[],this.cronRunsTotal=0,this.cronRunsHasMore=!1,this.cronRunsNextOffset=null,this.cronRunsLimit=50,this.cronRunsScope="all",this.cronRunsStatuses=[],this.cronRunsDeliveryStatuses=[],this.cronRunsStatusFilter="all",this.cronRunsQuery="",this.cronRunsSortDir="desc",this.cronModelSuggestions=[],this.cronBusy=!1,this.updateAvailable=null,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.marketLoading=!1,this.marketCatalog=[],this.marketError=null,this.marketFilter="",this.marketBusyKey=null,this.marketMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...Kg},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>ah(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,Xl(this.settings.locale)&&Jn.setLocale(this.settings.locale)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),hm(this)}firstUpdated(){mm(this)}disconnectedCallback(){vm(this),super.disconnectedCallback()}updated(e){bm(this,e)}connect(){md(this)}handleChatScroll(e){Rg(this,e)}handleLogsScroll(e){Lg(this,e)}exportLogs(e,t){Dg(e,t)}resetToolStream(){ui(this)}resetChatScroll(){na(this)}scrollToBottom(e){na(this),ss(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await fd(this)}applySettings(e){At(this,e)}setTab(e){eh(this,e)}setTheme(e,t){th(this,e,t)}async loadOverview(){await Zc(this)}async loadCron(){await Ks(this)}async handleAbortChat(){await cd(this)}removeQueuedMessage(e){Kh(this,e)}async handleSendChat(e,t){await Wh(this,e,t)}async handleWhatsAppStart(e){await bg(this,e)}async handleWhatsAppWait(){await yg(this)}async handleWhatsAppLogout(){await $g(this)}async handleChannelConfigSave(){await xg(this)}async handleChannelConfigReload(){await wg(this)}handleNostrProfileEdit(e,t){Ag(this,e,t)}handleNostrProfileCancel(){Cg(this)}handleNostrProfileFieldChange(e,t){Tg(this,e,t)}async handleNostrProfileSave(){await _g(this)}async handleNostrProfileImport(){await Ig(this)}handleNostrProfileToggleAdvanced(){Eg(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,At(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return Yw(this)}};$([x()],y.prototype,"settings",2);$([x()],y.prototype,"password",2);$([x()],y.prototype,"tab",2);$([x()],y.prototype,"onboarding",2);$([x()],y.prototype,"connected",2);$([x()],y.prototype,"theme",2);$([x()],y.prototype,"themeResolved",2);$([x()],y.prototype,"hello",2);$([x()],y.prototype,"lastError",2);$([x()],y.prototype,"lastErrorCode",2);$([x()],y.prototype,"eventLog",2);$([x()],y.prototype,"assistantName",2);$([x()],y.prototype,"assistantAvatar",2);$([x()],y.prototype,"assistantAgentId",2);$([x()],y.prototype,"sessionKey",2);$([x()],y.prototype,"chatLoading",2);$([x()],y.prototype,"chatSending",2);$([x()],y.prototype,"chatMessage",2);$([x()],y.prototype,"chatMessages",2);$([x()],y.prototype,"chatToolMessages",2);$([x()],y.prototype,"chatStream",2);$([x()],y.prototype,"chatStreamStartedAt",2);$([x()],y.prototype,"chatRunId",2);$([x()],y.prototype,"compactionStatus",2);$([x()],y.prototype,"fallbackStatus",2);$([x()],y.prototype,"chatAvatarUrl",2);$([x()],y.prototype,"chatThinkingLevel",2);$([x()],y.prototype,"chatQueue",2);$([x()],y.prototype,"chatAttachments",2);$([x()],y.prototype,"chatManualRefreshInFlight",2);$([x()],y.prototype,"sidebarOpen",2);$([x()],y.prototype,"sidebarContent",2);$([x()],y.prototype,"sidebarError",2);$([x()],y.prototype,"splitRatio",2);$([x()],y.prototype,"nodesLoading",2);$([x()],y.prototype,"nodes",2);$([x()],y.prototype,"devicesLoading",2);$([x()],y.prototype,"devicesError",2);$([x()],y.prototype,"devicesList",2);$([x()],y.prototype,"execApprovalsLoading",2);$([x()],y.prototype,"execApprovalsSaving",2);$([x()],y.prototype,"execApprovalsDirty",2);$([x()],y.prototype,"execApprovalsSnapshot",2);$([x()],y.prototype,"execApprovalsForm",2);$([x()],y.prototype,"execApprovalsSelectedAgent",2);$([x()],y.prototype,"execApprovalsTarget",2);$([x()],y.prototype,"execApprovalsTargetNodeId",2);$([x()],y.prototype,"execApprovalQueue",2);$([x()],y.prototype,"execApprovalBusy",2);$([x()],y.prototype,"execApprovalError",2);$([x()],y.prototype,"pendingGatewayUrl",2);$([x()],y.prototype,"configLoading",2);$([x()],y.prototype,"configRaw",2);$([x()],y.prototype,"configRawOriginal",2);$([x()],y.prototype,"configValid",2);$([x()],y.prototype,"configIssues",2);$([x()],y.prototype,"configSaving",2);$([x()],y.prototype,"configApplying",2);$([x()],y.prototype,"updateRunning",2);$([x()],y.prototype,"applySessionKey",2);$([x()],y.prototype,"configSnapshot",2);$([x()],y.prototype,"configSchema",2);$([x()],y.prototype,"configSchemaVersion",2);$([x()],y.prototype,"configSchemaLoading",2);$([x()],y.prototype,"configUiHints",2);$([x()],y.prototype,"configForm",2);$([x()],y.prototype,"configFormOriginal",2);$([x()],y.prototype,"configFormDirty",2);$([x()],y.prototype,"configFormMode",2);$([x()],y.prototype,"configSearchQuery",2);$([x()],y.prototype,"configActiveSection",2);$([x()],y.prototype,"configActiveSubsection",2);$([x()],y.prototype,"modelsLoading",2);$([x()],y.prototype,"modelsSaving",2);$([x()],y.prototype,"modelsDefaultSaving",2);$([x()],y.prototype,"modelsVerifyBusy",2);$([x()],y.prototype,"modelsError",2);$([x()],y.prototype,"modelsProviders",2);$([x()],y.prototype,"modelsSwitchableModels",2);$([x()],y.prototype,"modelsSelectedProviderId",2);$([x()],y.prototype,"modelsSelectedDefault",2);$([x()],y.prototype,"modelsDraft",2);$([x()],y.prototype,"modelsDefaultState",2);$([x()],y.prototype,"modelsVerifyState",2);$([x()],y.prototype,"channelsLoading",2);$([x()],y.prototype,"channelsSnapshot",2);$([x()],y.prototype,"channelsError",2);$([x()],y.prototype,"channelsLastSuccess",2);$([x()],y.prototype,"whatsappLoginMessage",2);$([x()],y.prototype,"whatsappLoginQrDataUrl",2);$([x()],y.prototype,"whatsappLoginConnected",2);$([x()],y.prototype,"whatsappBusy",2);$([x()],y.prototype,"nostrProfileFormState",2);$([x()],y.prototype,"nostrProfileAccountId",2);$([x()],y.prototype,"presenceLoading",2);$([x()],y.prototype,"presenceEntries",2);$([x()],y.prototype,"presenceError",2);$([x()],y.prototype,"presenceStatus",2);$([x()],y.prototype,"agentsLoading",2);$([x()],y.prototype,"agentsList",2);$([x()],y.prototype,"agentsError",2);$([x()],y.prototype,"agentsSelectedId",2);$([x()],y.prototype,"toolsCatalogLoading",2);$([x()],y.prototype,"toolsCatalogError",2);$([x()],y.prototype,"toolsCatalogResult",2);$([x()],y.prototype,"agentsPanel",2);$([x()],y.prototype,"agentFilesLoading",2);$([x()],y.prototype,"agentFilesError",2);$([x()],y.prototype,"agentFilesList",2);$([x()],y.prototype,"agentFileContents",2);$([x()],y.prototype,"agentFileDrafts",2);$([x()],y.prototype,"agentFileActive",2);$([x()],y.prototype,"agentFileSaving",2);$([x()],y.prototype,"agentIdentityLoading",2);$([x()],y.prototype,"agentIdentityError",2);$([x()],y.prototype,"agentIdentityById",2);$([x()],y.prototype,"agentSkillsLoading",2);$([x()],y.prototype,"agentSkillsError",2);$([x()],y.prototype,"agentSkillsReport",2);$([x()],y.prototype,"agentSkillsAgentId",2);$([x()],y.prototype,"sessionsLoading",2);$([x()],y.prototype,"sessionsResult",2);$([x()],y.prototype,"sessionsError",2);$([x()],y.prototype,"sessionsFilterActive",2);$([x()],y.prototype,"sessionsFilterLimit",2);$([x()],y.prototype,"sessionsIncludeGlobal",2);$([x()],y.prototype,"sessionsIncludeUnknown",2);$([x()],y.prototype,"sessionsHideCron",2);$([x()],y.prototype,"usageLoading",2);$([x()],y.prototype,"usageResult",2);$([x()],y.prototype,"usageCostSummary",2);$([x()],y.prototype,"usageError",2);$([x()],y.prototype,"usageStartDate",2);$([x()],y.prototype,"usageEndDate",2);$([x()],y.prototype,"usageSelectedSessions",2);$([x()],y.prototype,"usageSelectedDays",2);$([x()],y.prototype,"usageSelectedHours",2);$([x()],y.prototype,"usageChartMode",2);$([x()],y.prototype,"usageDailyChartMode",2);$([x()],y.prototype,"usageTimeSeriesMode",2);$([x()],y.prototype,"usageTimeSeriesBreakdownMode",2);$([x()],y.prototype,"usageTimeSeries",2);$([x()],y.prototype,"usageTimeSeriesLoading",2);$([x()],y.prototype,"usageTimeSeriesCursorStart",2);$([x()],y.prototype,"usageTimeSeriesCursorEnd",2);$([x()],y.prototype,"usageSessionLogs",2);$([x()],y.prototype,"usageSessionLogsLoading",2);$([x()],y.prototype,"usageSessionLogsExpanded",2);$([x()],y.prototype,"usageQuery",2);$([x()],y.prototype,"usageQueryDraft",2);$([x()],y.prototype,"usageSessionSort",2);$([x()],y.prototype,"usageSessionSortDir",2);$([x()],y.prototype,"usageRecentSessions",2);$([x()],y.prototype,"usageTimeZone",2);$([x()],y.prototype,"usageContextExpanded",2);$([x()],y.prototype,"usageHeaderPinned",2);$([x()],y.prototype,"usageSessionsTab",2);$([x()],y.prototype,"usageVisibleColumns",2);$([x()],y.prototype,"usageLogFilterRoles",2);$([x()],y.prototype,"usageLogFilterTools",2);$([x()],y.prototype,"usageLogFilterHasTools",2);$([x()],y.prototype,"usageLogFilterQuery",2);$([x()],y.prototype,"cronLoading",2);$([x()],y.prototype,"cronJobsLoadingMore",2);$([x()],y.prototype,"cronJobs",2);$([x()],y.prototype,"cronJobsTotal",2);$([x()],y.prototype,"cronJobsHasMore",2);$([x()],y.prototype,"cronJobsNextOffset",2);$([x()],y.prototype,"cronJobsLimit",2);$([x()],y.prototype,"cronJobsQuery",2);$([x()],y.prototype,"cronJobsEnabledFilter",2);$([x()],y.prototype,"cronJobsScheduleKindFilter",2);$([x()],y.prototype,"cronJobsLastStatusFilter",2);$([x()],y.prototype,"cronJobsSortBy",2);$([x()],y.prototype,"cronJobsSortDir",2);$([x()],y.prototype,"cronStatus",2);$([x()],y.prototype,"cronError",2);$([x()],y.prototype,"cronForm",2);$([x()],y.prototype,"cronFieldErrors",2);$([x()],y.prototype,"cronEditingJobId",2);$([x()],y.prototype,"cronRunsJobId",2);$([x()],y.prototype,"cronRunsLoadingMore",2);$([x()],y.prototype,"cronRuns",2);$([x()],y.prototype,"cronRunsTotal",2);$([x()],y.prototype,"cronRunsHasMore",2);$([x()],y.prototype,"cronRunsNextOffset",2);$([x()],y.prototype,"cronRunsLimit",2);$([x()],y.prototype,"cronRunsScope",2);$([x()],y.prototype,"cronRunsStatuses",2);$([x()],y.prototype,"cronRunsDeliveryStatuses",2);$([x()],y.prototype,"cronRunsStatusFilter",2);$([x()],y.prototype,"cronRunsQuery",2);$([x()],y.prototype,"cronRunsSortDir",2);$([x()],y.prototype,"cronModelSuggestions",2);$([x()],y.prototype,"cronBusy",2);$([x()],y.prototype,"updateAvailable",2);$([x()],y.prototype,"skillsLoading",2);$([x()],y.prototype,"skillsReport",2);$([x()],y.prototype,"skillsError",2);$([x()],y.prototype,"skillsFilter",2);$([x()],y.prototype,"skillEdits",2);$([x()],y.prototype,"skillsBusyKey",2);$([x()],y.prototype,"skillMessages",2);$([x()],y.prototype,"marketLoading",2);$([x()],y.prototype,"marketCatalog",2);$([x()],y.prototype,"marketError",2);$([x()],y.prototype,"marketFilter",2);$([x()],y.prototype,"marketBusyKey",2);$([x()],y.prototype,"marketMessages",2);$([x()],y.prototype,"debugLoading",2);$([x()],y.prototype,"debugStatus",2);$([x()],y.prototype,"debugHealth",2);$([x()],y.prototype,"debugModels",2);$([x()],y.prototype,"debugHeartbeat",2);$([x()],y.prototype,"debugCallMethod",2);$([x()],y.prototype,"debugCallParams",2);$([x()],y.prototype,"debugCallResult",2);$([x()],y.prototype,"debugCallError",2);$([x()],y.prototype,"logsLoading",2);$([x()],y.prototype,"logsError",2);$([x()],y.prototype,"logsFile",2);$([x()],y.prototype,"logsEntries",2);$([x()],y.prototype,"logsFilterText",2);$([x()],y.prototype,"logsLevelFilters",2);$([x()],y.prototype,"logsAutoFollow",2);$([x()],y.prototype,"logsTruncated",2);$([x()],y.prototype,"logsCursor",2);$([x()],y.prototype,"logsLastFetchAt",2);$([x()],y.prototype,"logsLimit",2);$([x()],y.prototype,"logsMaxBytes",2);$([x()],y.prototype,"logsAtBottom",2);$([x()],y.prototype,"chatNewMessagesBelow",2);y=$([Jl("openclaw-app")],y);
|
|
8639
|
+
//# sourceMappingURL=index-CKSSOzJL.js.map
|