@poolzin/pool-bot 2026.4.29 → 2026.4.30
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/build-info.json +3 -3
- package/dist/control-ui/assets/{index-1DWuMa4l.js → index-CAx-3zc2.js} +532 -545
- package/dist/control-ui/assets/index-CAx-3zc2.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/infra/heartbeat-runner.d.ts.map +1 -1
- package/dist/infra/heartbeat-runner.js +10 -2
- package/dist/process/command-queue.d.ts +7 -0
- package/dist/process/command-queue.d.ts.map +1 -1
- package/dist/process/command-queue.js +26 -1
- package/package.json +1 -1
- package/dist/control-ui/assets/index-1DWuMa4l.js.map +0 -1
|
@@ -1,74 +1,61 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const hl=!1,nn=globalThis,Gs=nn.ShadowRoot&&(nn.ShadyCSS===void 0||nn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ys=Symbol(),ea=new WeakMap;class yo{constructor(t,n,s){if(this._$cssResult$=!0,s!==Ys)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this._strings=n}get styleSheet(){let t=this._styleSheet;const n=this._strings;if(Gs&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=ea.get(n)),t===void 0&&((this._styleSheet=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ea.set(n,t))}return t}toString(){return this.cssText}}const fl=e=>{if(e._$cssResult$===!0)return e.cssText;if(typeof e=="number")return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)},gl=e=>new yo(typeof e=="string"?e:String(e),void 0,Ys),ml=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,a)=>s+fl(i)+e[a+1],e[0]);return new yo(n,e,Ys)},vl=(e,t)=>{if(Gs)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=nn.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},yl=e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return gl(t)},ta=Gs||hl?e=>e:e=>e instanceof CSSStyleSheet?yl(e):e;const{is:bl,defineProperty:wl,getOwnPropertyDescriptor:na,getOwnPropertyNames:$l,getOwnPropertySymbols:xl,getPrototypeOf:sa}=Object,se=globalThis;let le;const ia=se.trustedTypes,kl=ia?ia.emptyScript:"",bo=se.reactiveElementPolyfillSupportDevMode;se.litIssuedWarnings??=new Set,le=(e,t)=>{t+=` See https://lit.dev/msg/${e} for more information.`,!se.litIssuedWarnings.has(t)&&!se.litIssuedWarnings.has(e)&&(console.warn(t),se.litIssuedWarnings.add(t))},queueMicrotask(()=>{le("dev-mode","Lit is in dev mode. Not recommended for production!"),se.ShadyDOM?.inUse&&bo===void 0&&le("polyfill-support-missing","Shadow DOM is being polyfilled via `ShadyDOM` but the `polyfill-support` module has not been loaded.")});const Sl=e=>{se.emitLitDebugLogEvents&&se.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))},ot=(e,t)=>e,rn={toAttribute(e,t){switch(t){case Boolean:e=e?kl:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e);break}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}break}return n}},Qs=(e,t)=>!bl(e,t),aa={attribute:!0,type:String,converter:rn,reflect:!1,useDefault:!1,hasChanged:Qs};Symbol.metadata??=Symbol("metadata");se.litPropertyMetadata??=new WeakMap;class Se extends HTMLElement{static addInitializer(t){this.__prepare(),(this._initializers??=[]).push(t)}static get observedAttributes(){return this.finalize(),this.__attributeToPropertyMap&&[...this.__attributeToPropertyMap.keys()]}static createProperty(t,n=aa){if(n.state&&(n.attribute=!1),this.__prepare(),this.prototype.hasOwnProperty(t)&&(n=Object.create(n),n.wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){const s=Symbol.for(`${String(t)} (@property() cache)`),i=this.getPropertyDescriptor(t,s,n);i!==void 0&&wl(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=na(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};if(i==null){if("value"in(na(this.prototype,t)??{}))throw new Error(`Field ${JSON.stringify(String(t))} on ${this.name} was declared as a reactive property but it's actually declared as a value on the prototype. Usually this is due to using @property or @state on a method.`);le("reactive-property-without-getter",`Field ${JSON.stringify(String(t))} on ${this.name} was declared as a reactive property but it does not have a getter. This will be an error in a future version of Lit.`)}return{get:i,set(o){const c=i?.call(this);a?.call(this,o),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??aa}static __prepare(){if(this.hasOwnProperty(ot("elementProperties")))return;const t=sa(this);t.finalize(),t._initializers!==void 0&&(this._initializers=[...t._initializers]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ot("finalized")))return;if(this.finalized=!0,this.__prepare(),this.hasOwnProperty(ot("properties"))){const n=this.properties,s=[...$l(n),...xl(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.__attributeToPropertyMap=new Map;for(const[n,s]of this.elementProperties){const i=this.__attributeNameForProperty(n,s);i!==void 0&&this.__attributeToPropertyMap.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles),this.hasOwnProperty("createProperty")&&le("no-override-create-property","Overriding ReactiveElement.createProperty() is deprecated. The override will not be called with standard decorators"),this.hasOwnProperty("getPropertyDescriptor")&&le("no-override-get-property-descriptor","Overriding ReactiveElement.getPropertyDescriptor() is deprecated. The override will not be called with standard decorators")}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)n.unshift(ta(i))}else t!==void 0&&n.push(ta(t));return n}static __attributeNameForProperty(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.__instanceProperties=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.__reflectingProperty=null,this.__initialize()}__initialize(){this.__updatePromise=new Promise(t=>this.enableUpdating=t),this._$changedProperties=new Map,this.__saveInstanceProperties(),this.requestUpdate(),this.constructor._initializers?.forEach(t=>t(this))}addController(t){(this.__controllers??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this.__controllers?.delete(t)}__saveInstanceProperties(){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.__instanceProperties=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return vl(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this.__controllers?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this.__controllers?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,s){this._$attributeToProperty(t,s)}__propertyToAttribute(t,n){const i=this.constructor.elementProperties.get(t),a=this.constructor.__attributeNameForProperty(t,i);if(a!==void 0&&i.reflect===!0){const c=(i.converter?.toAttribute!==void 0?i.converter:rn).toAttribute(n,i.type);this.constructor.enabledWarnings.includes("migration")&&c===void 0&&le("undefined-attribute-value",`The attribute value for the ${t} property is undefined on element ${this.localName}. The attribute will be removed, but in the previous version of \`ReactiveElement\`, the attribute would not have changed.`),this.__reflectingProperty=t,c==null?this.removeAttribute(a):this.setAttribute(a,c),this.__reflectingProperty=null}}_$attributeToProperty(t,n){const s=this.constructor,i=s.__attributeToPropertyMap.get(t);if(i!==void 0&&this.__reflectingProperty!==i){const a=s.getPropertyOptions(i),o=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:rn;this.__reflectingProperty=i;const c=o.fromAttribute(n,a.type);this[i]=c??this.__defaultValues?.get(i)??c,this.__reflectingProperty=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){t instanceof Event&&le("","The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()");const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),(s.hasChanged??Qs)(a,n)||s.useDefault&&s.reflect&&a===this.__defaultValues?.get(t)&&!this.hasAttribute(o.__attributeNameForProperty(t,s)))this._$changeProperty(t,n,s);else return}this.isUpdatePending===!1&&(this.__updatePromise=this.__enqueueUpdate())}_$changeProperty(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this.__defaultValues??=new Map).has(t)&&(this.__defaultValues.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$changedProperties.has(t)||(!this.hasUpdated&&!s&&(n=void 0),this._$changedProperties.set(t,n)),i===!0&&this.__reflectingProperty!==t&&(this.__reflectingProperties??=new Set).add(t))}async __enqueueUpdate(){this.isUpdatePending=!0;try{await this.__updatePromise}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){const t=this.performUpdate();return this.constructor.enabledWarnings.includes("async-perform-update")&&typeof t?.then=="function"&&le("async-perform-update",`Element ${this.localName} returned a Promise from performUpdate(). This behavior is deprecated and will be removed in a future version of ReactiveElement.`),t}performUpdate(){if(!this.isUpdatePending)return;if(Sl?.({kind:"update"}),!this.hasUpdated){this.renderRoot??=this.createRenderRoot();{const a=[...this.constructor.elementProperties.keys()].filter(o=>this.hasOwnProperty(o)&&o in sa(this));if(a.length)throw new Error(`The following properties on element ${this.localName} will not trigger updates as expected because they are set using class fields: ${a.join(", ")}. Native class fields and some compiled output will overwrite accessors used for detecting changes. See https://lit.dev/msg/class-field-shadowing for more information.`)}if(this.__instanceProperties){for(const[i,a]of this.__instanceProperties)this[i]=a;this.__instanceProperties=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,c=this[i];o===!0&&!this._$changedProperties.has(i)&&c!==void 0&&this._$changeProperty(i,void 0,a,c)}}let t=!1;const n=this._$changedProperties;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this.__controllers?.forEach(s=>s.hostUpdate?.()),this.update(n)):this.__markUpdated()}catch(s){throw t=!1,this.__markUpdated(),s}t&&this._$didUpdate(n)}willUpdate(t){}_$didUpdate(t){this.__controllers?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t),this.isUpdatePending&&this.constructor.enabledWarnings.includes("change-in-update")&&le("change-in-update",`Element ${this.localName} scheduled an update (generally because a property was set) after an update completed, causing a new update to be scheduled. This is inefficient and should be avoided unless the next update can only be scheduled as a side effect of the previous update.`)}__markUpdated(){this._$changedProperties=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.__updatePromise}shouldUpdate(t){return!0}update(t){this.__reflectingProperties&&=this.__reflectingProperties.forEach(n=>this.__propertyToAttribute(n,this[n])),this.__markUpdated()}updated(t){}firstUpdated(t){}}Se.elementStyles=[];Se.shadowRootOptions={mode:"open"};Se[ot("elementProperties")]=new Map;Se[ot("finalized")]=new Map;bo?.({ReactiveElement:Se});{Se.enabledWarnings=["change-in-update","async-perform-update"];const e=function(t){t.hasOwnProperty(ot("enabledWarnings"))||(t.enabledWarnings=t.enabledWarnings.slice())};Se.enableWarning=function(t){e(this),this.enabledWarnings.includes(t)||this.enabledWarnings.push(t)},Se.disableWarning=function(t){e(this);const n=this.enabledWarnings.indexOf(t);n>=0&&this.enabledWarnings.splice(n,1)}}(se.reactiveElementVersions??=[]).push("2.1.2");se.reactiveElementVersions.length>1&&queueMicrotask(()=>{le("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});const te=globalThis,L=e=>{te.emitLitDebugLogEvents&&te.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))};let Al=0,Rt;te.litIssuedWarnings??=new Set,Rt=(e,t)=>{t+=e?` See https://lit.dev/msg/${e} for more information.`:"",!te.litIssuedWarnings.has(t)&&!te.litIssuedWarnings.has(e)&&(console.warn(t),te.litIssuedWarnings.add(t))},queueMicrotask(()=>{Rt("dev-mode","Lit is in dev mode. Not recommended for production!")});const re=te.ShadyDOM?.inUse&&te.ShadyDOM?.noPatch===!0?te.ShadyDOM.wrap:e=>e,ln=te.trustedTypes,oa=ln?ln.createPolicy("lit-html",{createHTML:e=>e}):void 0,_l=e=>e,mn=(e,t,n)=>_l,Tl=e=>{if(je!==mn)throw new Error("Attempted to overwrite existing lit-html security policy. setSanitizeDOMValueFactory should be called at most once.");je=e},Cl=()=>{je=mn},$s=(e,t,n)=>je(e,t,n),wo="$lit$",ke=`lit$${Math.random().toFixed(9).slice(2)}$`,$o="?"+ke,El=`<${$o}>`,He=document,Mt=()=>He.createComment(""),It=e=>e===null||typeof e!="object"&&typeof e!="function",Js=Array.isArray,Rl=e=>Js(e)||typeof e?.[Symbol.iterator]=="function",Zn=`[
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]`,Il=`[^\\s"'>=/]`,vt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ra=1,Xn=2,Ll=3,la=/-->/g,ca=/>/g,De=new RegExp(`>|${Zn}(?:(${Il}+)(${Zn}*=${Zn}*(?:${Ml}|("|')|))|$)`,"g"),Pl=0,da=1,Nl=2,ua=3,es=/'/g,ts=/"/g,xo=/^(?:script|style|textarea|title)$/i,Ol=1,xs=2,ks=3,Zs=1,cn=2,Dl=3,Bl=4,Fl=5,Xs=6,Ul=7,Kl=e=>(t,...n)=>(t.some(s=>s===void 0)&&console.warn(`Some template strings are undefined.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
and include information about your build tooling, if any.
|
|
15
|
-
`.trim().replace(/\n */g,`
|
|
16
|
-
`),new Error(n)}return oa!==void 0?oa.createHTML(t):t}const zl=(e,t)=>{const n=e.length-1,s=[];let i=t===xs?"<svg>":t===ks?"<math>":"",a,o=vt;for(let l=0;l<n;l++){const u=e[l];let d=-1,p,f=0,m;for(;f<u.length&&(o.lastIndex=f,m=o.exec(u),m!==null);)if(f=o.lastIndex,o===vt){if(m[ra]==="!--")o=la;else if(m[ra]!==void 0)o=ca;else if(m[Xn]!==void 0)xo.test(m[Xn])&&(a=new RegExp(`</${m[Xn]}`,"g")),o=De;else if(m[Ll]!==void 0)throw new Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else o===De?m[Pl]===">"?(o=a??vt,d=-1):m[da]===void 0?d=-2:(d=o.lastIndex-m[Nl].length,p=m[da],o=m[ua]===void 0?De:m[ua]==='"'?ts:es):o===ts||o===es?o=De:o===la||o===ca?o=vt:(o=De,a=void 0);console.assert(d===-1||o===De||o===es||o===ts,"unexpected parse state B");const v=o===De&&e[l+1].startsWith("/>")?" ":"";i+=o===vt?u+El:d>=0?(s.push(p),u.slice(0,d)+wo+u.slice(d)+ke+v):u+ke+(d===-2?l:v)}const c=i+(e[n]||"<?>")+(t===xs?"</svg>":t===ks?"</math>":"");return[ko(e,c),s]};class Lt{constructor({strings:t,["_$litType$"]:n},s){this.parts=[];let i,a=0,o=0;const c=t.length-1,l=this.parts,[u,d]=zl(t,n);if(this.el=Lt.createElement(u,s),Ke.currentNode=this.el.content,n===xs||n===ks){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Ke.nextNode())!==null&&l.length<c;){if(i.nodeType===1){{const p=i.localName;if(/^(?:textarea|template)$/i.test(p)&&i.innerHTML.includes(ke)){const f=`Expressions are not supported inside \`${p}\` elements. See https://lit.dev/msg/expression-in-${p} for more information.`;if(p==="template")throw new Error(f);Rt("",f)}}if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(wo)){const f=d[o++],v=i.getAttribute(p).split(ke),$=/([.?@])?(.*)/.exec(f);l.push({type:Zs,index:a,name:$[2],strings:v,ctor:$[1]==="."?jl:$[1]==="?"?Vl:$[1]==="@"?Wl:yn}),i.removeAttribute(p)}else p.startsWith(ke)&&(l.push({type:Xs,index:a}),i.removeAttribute(p));if(xo.test(i.tagName)){const p=i.textContent.split(ke),f=p.length-1;if(f>0){i.textContent=ln?ln.emptyScript:"";for(let m=0;m<f;m++)i.append(p[m],Mt()),Ke.nextNode(),l.push({type:cn,index:++a});i.append(p[f],Mt())}}}else if(i.nodeType===8)if(i.data===$o)l.push({type:cn,index:a});else{let f=-1;for(;(f=i.data.indexOf(ke,f+1))!==-1;)l.push({type:Ul,index:a}),f+=ke.length-1}a++}if(d.length!==o)throw new Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+t.join("${...}")+"`");L&&L({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:t})}static createElement(t,n){const s=He.createElement("template");return s.innerHTML=t,s}}function rt(e,t,n=e,s){if(t===Ie)return t;let i=s!==void 0?n.__directives?.[s]:n.__directive;const a=It(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$notifyDirectiveConnectionChanged?.(!1),a===void 0?i=void 0:(i=new a(e),i._$initialize(e,n,s)),s!==void 0?(n.__directives??=[])[s]=i:n.__directive=i),i!==void 0&&(t=rt(e,i._$resolve(e,t.values),i,s)),t}class Hl{constructor(t,n){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=t,this._$parent=n}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(t){const{el:{content:n},parts:s}=this._$template,i=(t?.creationScope??He).importNode(n,!0);Ke.currentNode=i;let a=Ke.nextNode(),o=0,c=0,l=s[0];for(;l!==void 0;){if(o===l.index){let u;l.type===cn?u=new vn(a,a.nextSibling,this,t):l.type===Zs?u=new l.ctor(a,l.name,l.strings,this,t):l.type===Xs&&(u=new ql(a,this,t)),this._$parts.push(u),l=s[++c]}o!==l?.index&&(a=Ke.nextNode(),o++)}return Ke.currentNode=He,i}_update(t){let n=0;for(const s of this._$parts)s!==void 0&&(L&&L({kind:"set part",part:s,value:t[n],valueIndex:n,values:t,templateInstance:this}),s.strings!==void 0?(s._$setValue(t,s,n),n+=s.strings.length-2):s._$setValue(t[n])),n++}}let vn=class So{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(t,n,s,i){this.type=cn,this._$committedValue=g,this._$disconnectableChildren=void 0,this._$startNode=t,this._$endNode=n,this._$parent=s,this.options=i,this.__isConnected=i?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let t=re(this._$startNode).parentNode;const n=this._$parent;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(t,n=this){if(this.parentNode===null)throw new Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(t=rt(this,t,n),It(t))t===g||t==null||t===""?(this._$committedValue!==g&&(L&&L({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear()),this._$committedValue=g):t!==this._$committedValue&&t!==Ie&&this._commitText(t);else if(t._$litType$!==void 0)this._commitTemplateResult(t);else if(t.nodeType!==void 0){if(this.options?.host===t){this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),console.warn("Attempted to render the template host",t,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");return}this._commitNode(t)}else Rl(t)?this._commitIterable(t):this._commitText(t)}_insert(t){return re(re(this._$startNode).parentNode).insertBefore(t,this._$endNode)}_commitNode(t){if(this._$committedValue!==t){if(this._$clear(),je!==mn){const n=this._$startNode.parentNode?.nodeName;if(n==="STYLE"||n==="SCRIPT"){let s="Forbidden";throw n==="STYLE"?s="Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.":s="Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.",new Error(s)}}L&&L({kind:"commit node",start:this._$startNode,parent:this._$parent,value:t,options:this.options}),this._$committedValue=this._insert(t)}}_commitText(t){if(this._$committedValue!==g&&It(this._$committedValue)){const n=re(this._$startNode).nextSibling;this._textSanitizer===void 0&&(this._textSanitizer=$s(n,"data","property")),t=this._textSanitizer(t),L&&L({kind:"commit text",node:n,value:t,options:this.options}),n.data=t}else{const n=He.createTextNode("");this._commitNode(n),this._textSanitizer===void 0&&(this._textSanitizer=$s(n,"data","property")),t=this._textSanitizer(t),L&&L({kind:"commit text",node:n,value:t,options:this.options}),n.data=t}this._$committedValue=t}_commitTemplateResult(t){const{values:n,["_$litType$"]:s}=t,i=typeof s=="number"?this._$getTemplate(t):(s.el===void 0&&(s.el=Lt.createElement(ko(s.h,s.h[0]),this.options)),s);if(this._$committedValue?._$template===i)L&&L({kind:"template updating",template:i,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:n}),this._$committedValue._update(n);else{const a=new Hl(i,this),o=a._clone(this.options);L&&L({kind:"template instantiated",template:i,instance:a,parts:a._$parts,options:this.options,fragment:o,values:n}),a._update(n),L&&L({kind:"template instantiated and updated",template:i,instance:a,parts:a._$parts,options:this.options,fragment:o,values:n}),this._commitNode(o),this._$committedValue=a}}_$getTemplate(t){let n=pa.get(t.strings);return n===void 0&&pa.set(t.strings,n=new Lt(t)),n}_commitIterable(t){Js(this._$committedValue)||(this._$committedValue=[],this._$clear());const n=this._$committedValue;let s=0,i;for(const a of t)s===n.length?n.push(i=new So(this._insert(Mt()),this._insert(Mt()),this,this.options)):i=n[s],i._$setValue(a),s++;s<n.length&&(this._$clear(i&&re(i._$endNode).nextSibling,s),n.length=s)}_$clear(t=re(this._$startNode).nextSibling,n){for(this._$notifyConnectionChanged?.(!1,!0,n);t!==this._$endNode;){const s=re(t).nextSibling;re(t).remove(),t=s}}setConnected(t){if(this._$parent===void 0)this.__isConnected=t,this._$notifyConnectionChanged?.(t);else throw new Error("part.setConnected() may only be called on a RootPart returned from render().")}};class yn{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(t,n,s,i,a){this.type=Zs,this._$committedValue=g,this._$disconnectableChildren=void 0,this.element=t,this.name=n,this._$parent=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$committedValue=new Array(s.length-1).fill(new String),this.strings=s):this._$committedValue=g,this._sanitizer=void 0}_$setValue(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=rt(this,t,n,0),o=!It(t)||t!==this._$committedValue&&t!==Ie,o&&(this._$committedValue=t);else{const c=t;t=a[0];let l,u;for(l=0;l<a.length-1;l++)u=rt(this,c[s+l],n,l),u===Ie&&(u=this._$committedValue[l]),o||=!It(u)||u!==this._$committedValue[l],u===g?t=g:t!==g&&(t+=(u??"")+a[l+1]),this._$committedValue[l]=u}o&&!i&&this._commitValue(t)}_commitValue(t){t===g?re(this.element).removeAttribute(this.name):(this._sanitizer===void 0&&(this._sanitizer=je(this.element,this.name,"attribute")),t=this._sanitizer(t??""),L&&L({kind:"commit attribute",element:this.element,name:this.name,value:t,options:this.options}),re(this.element).setAttribute(this.name,t??""))}}class jl extends yn{constructor(){super(...arguments),this.type=Dl}_commitValue(t){this._sanitizer===void 0&&(this._sanitizer=je(this.element,this.name,"property")),t=this._sanitizer(t),L&&L({kind:"commit property",element:this.element,name:this.name,value:t,options:this.options}),this.element[this.name]=t===g?void 0:t}}class Vl extends yn{constructor(){super(...arguments),this.type=Bl}_commitValue(t){L&&L({kind:"commit boolean attribute",element:this.element,name:this.name,value:!!(t&&t!==g),options:this.options}),re(this.element).toggleAttribute(this.name,!!t&&t!==g)}}class Wl extends yn{constructor(t,n,s,i,a){if(super(t,n,s,i,a),this.type=Fl,this.strings!==void 0)throw new Error(`A \`<${t.localName}>\` has a \`@${n}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(t,n=this){if(t=rt(this,t,n,0)??g,t===Ie)return;const s=this._$committedValue,i=t===g&&s!==g||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==g&&(s===g||i);L&&L({kind:"commit event listener",element:this.element,name:this.name,value:t,options:this.options,removeListener:i,addListener:a,oldListener:s}),i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$committedValue=t}handleEvent(t){typeof this._$committedValue=="function"?this._$committedValue.call(this.options?.host??this.element,t):this._$committedValue.handleEvent(t)}}class ql{constructor(t,n,s){this.element=t,this.type=Xs,this._$disconnectableChildren=void 0,this._$parent=n,this.options=s}get _$isConnected(){return this._$parent._$isConnected}_$setValue(t){L&&L({kind:"commit to element binding",element:this.element,value:t,options:this.options}),rt(this,t)}}const Gl={_ChildPart:vn},Yl=te.litHtmlPolyfillSupportDevMode;Yl?.(Lt,vn);(te.litHtmlVersions??=[]).push("3.3.2");te.litHtmlVersions.length>1&&queueMicrotask(()=>{Rt("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});const sn=(e,t,n)=>{if(t==null)throw new TypeError(`The container to render into may not be ${t}`);const s=Al++,i=n?.renderBefore??t;let a=i._$litPart$;if(L&&L({kind:"begin render",id:s,value:e,container:t,options:n,part:a}),a===void 0){const o=n?.renderBefore??null;i._$litPart$=a=new vn(t.insertBefore(Mt(),o),o,void 0,n??{})}return a._$setValue(e),L&&L({kind:"end render",id:s,value:e,container:t,options:n,part:a}),a};sn.setSanitizer=Tl,sn.createSanitizer=$s,sn._testOnlyClearSanitizerFactoryDoNotCallOrElse=Cl;const Ql=(e,t)=>e,Ee=globalThis;let Ao;Ee.litIssuedWarnings??=new Set,Ao=(e,t)=>{t+=` See https://lit.dev/msg/${e} for more information.`,!Ee.litIssuedWarnings.has(t)&&!Ee.litIssuedWarnings.has(e)&&(console.warn(t),Ee.litIssuedWarnings.add(t))};class pt extends Se{constructor(){super(...arguments),this.renderOptions={host:this},this.__childPart=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.__childPart=sn(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.__childPart?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.__childPart?.setConnected(!1)}render(){return Ie}}pt._$litElement$=!0;pt[Ql("finalized")]=!0;Ee.litElementHydrateSupport?.({LitElement:pt});const Jl=Ee.litElementPolyfillSupportDevMode;Jl?.({LitElement:pt});(Ee.litElementVersions??=[]).push("4.2.2");Ee.litElementVersions.length>1&&queueMicrotask(()=>{Ao("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});const _o=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};let To;globalThis.litIssuedWarnings??=new Set,To=(e,t)=>{t+=` See https://lit.dev/msg/${e} for more information.`,!globalThis.litIssuedWarnings.has(t)&&!globalThis.litIssuedWarnings.has(e)&&(console.warn(t),globalThis.litIssuedWarnings.add(t))};const Zl=(e,t,n)=>{const s=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),s?Object.getOwnPropertyDescriptor(t,n):void 0},Xl={attribute:!0,type:String,converter:rn,reflect:!1,hasChanged:Qs},ec=(e=Xl,t,n)=>{const{kind:s,metadata:i}=n;i==null&&To("missing-class-metadata",`The class ${t} is missing decorator metadata. This could mean that you're using a compiler that supports decorators but doesn't support decorator metadata, such as TypeScript 5.1. Please update your compiler.`);let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&(e=Object.create(e),e.wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(c){const l=t.get.call(this);t.set.call(this,c),this.requestUpdate(o,l,e,!0,c)},init(c){return c!==void 0&&this._$changeProperty(o,void 0,e,c),c}}}else if(s==="setter"){const{name:o}=n;return function(c){const l=this[o];t.call(this,c),this.requestUpdate(o,l,e,!0,c)}}throw new Error(`Unsupported decorator location: ${s}`)};function bn(e){return(t,n)=>typeof n=="object"?ec(e,t,n):Zl(e,t,n)}function w(e){return bn({...e,state:!0,attribute:!1})}globalThis.litIssuedWarnings??=new Set;const tc=50,nc=200,sc="Assistant";function ha(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function Ss(e){const t=ha(e?.name,tc)??sc,n=ha(e?.avatar??void 0,nc)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function ic(){return Ss(typeof window>"u"?{}:{name:window.__CLAWDBOT_ASSISTANT_NAME__,avatar:window.__CLAWDBOT_ASSISTANT_AVATAR__})}const Co="poolbot.control.settings.v1";function ac(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{},personality:"default",skin:"default"};try{const n=localStorage.getItem(Co);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,personality:typeof s.personality=="string"&&s.personality.trim()?s.personality.trim():t.personality,skin:typeof s.skin=="string"&&s.skin.trim()?s.skin.trim():t.skin}}catch{return t}}function oc(e){localStorage.setItem(Co,JSON.stringify(e))}function Eo(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const rc=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","cron"]},{label:"Agent",tabs:["skills","nodes"]},{label:"Insights",tabs:["usage"]},{label:"Settings",tabs:["config","debug","logs"]}],Ro={overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",cron:"/cron",skills:"/skills",nodes:"/nodes",usage:"/usage",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},Mo=new Map(Object.entries(Ro).map(([e,t])=>[t,e]));function wn(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Pt(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 $n(e,t=""){const n=wn(t),s=Ro[e];return n?`${n}${s}`:s}function Io(e,t=""){const n=wn(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=Pt(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Mo.get(i)??null}function lc(e){let t=Pt(e);if(t.endsWith("/index.html")&&(t=Pt(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(Mo.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function cc(e){switch(e){case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"usage":return"barChart";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function As(e){switch(e){case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"usage":return"Usage & Costs";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function dc(e){switch(e){case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"usage":return"Token usage, cost breakdown, and session analytics.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.poolbot/poolbot.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const G={messageSquare:r`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:r`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:r`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:r`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:r`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:r`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:r`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:r`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:r`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:r`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,menu:r`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:r`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:r`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:r`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:r`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:r`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:r`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:r`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,wrench:r`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:r`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:r`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:r`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:r`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,eye:r`<svg viewBox="0 0 24 24"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`,eyeOff:r`<svg viewBox="0 0 24 24"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:r`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:r`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,shield:r`<svg viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="m9 12 2 2 4-4"/></svg>`,plug:r`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:r`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`},uc=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Gt=/<\s*\/?\s*final\b[^<>]*>/gi,fa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function ga(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(l=>a>=l.start&&o<=l.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function ma(e,t){return t.some(n=>e>=n.start&&e<n.end)}function pc(e,t){return e.trimStart()}function hc(e,t){if(!e||!uc.test(e))return e;let n=e;if(Gt.test(n)){Gt.lastIndex=0;const c=[],l=ga(n);for(const u of n.matchAll(Gt)){const d=u.index??0;c.push({start:d,length:u[0].length,inCode:ma(d,l)})}for(let u=c.length-1;u>=0;u--){const d=c[u];d.inCode||(n=n.slice(0,d.start)+n.slice(d.start+d.length))}}else Gt.lastIndex=0;const s=ga(n);fa.lastIndex=0;let i="",a=0,o=!1;for(const c of n.matchAll(fa)){const l=c.index??0,u=c[1]==="/";ma(l,s)||(o?u&&(o=!1):(i+=n.slice(a,l),u||(o=!0)),a=l+c[0].length)}return i+=n.slice(a),pc(i)}function Nt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function D(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0)return"just now";const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const s=Math.round(n/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);return i<48?`${i}h ago`:`${Math.round(i/24)}d ago`}const xn=D;function fc(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const s=Math.round(n/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function _s(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Ts(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function Lo(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 dn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ns(e){return hc(e)}const gc=/^\[([^\]]+)\]\s*/,mc=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],ss=new WeakMap,is=new WeakMap;function vc(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:mc.some(t=>e.startsWith(`${t} `))}function as(e){const t=e.match(gc);if(!t)return e;const n=t[1]??"";return vc(n)?e.slice(t[0].length):e}function Cs(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?ns(s):as(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
|
|
17
|
-
`);return n==="assistant"?ns(a):as(a)}}return typeof t.text=="string"?n==="assistant"?ns(t.text):as(t.text):null}function Po(e){if(!e||typeof e!="object")return Cs(e);const t=e;if(ss.has(t))return ss.get(t)??null;const n=Cs(e);return ss.set(t,n),n}function va(e){const n=e.content,s=[];if(Array.isArray(n))for(const c of n){const l=c;if(l.type==="thinking"&&typeof l.thinking=="string"){const u=l.thinking.trim();u&&s.push(u)}}if(s.length>0)return s.join(`
|
|
18
|
-
`);const i=bc(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(c=>(c[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
|
|
19
|
-
`):null}function yc(e){if(!e||typeof e!="object")return va(e);const t=e;if(is.has(t))return is.get(t)??null;const n=va(e);return is.set(t,n),n}function bc(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
|
|
20
|
-
`)}return typeof t.text=="string"?t.text:null}function wc(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(`
|
|
21
|
-
`):""}let ya=!1;function ba(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 $c(){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 xc(){ya||(ya=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function ei(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),ba(t)}return xc(),ba($c())}async function lt(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function kc(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Sc(e,t,n){if(!e.client||!e.connected)return!1;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return!1;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const c=ei();e.chatRunId=c,e.chatStream="",e.chatStreamStartedAt=a;const l=i?n.map(u=>{const d=kc(u.dataUrl);return d?{type:"image",mimeType:d.mimeType,content:d.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:c,attachments:l}),!0}catch(u){const d=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=d,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+d}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function Ac(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 _c(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=Cs(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}async function ht(e){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const t={includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown},n=dn(e.sessionsFilterActive,0),s=dn(e.sessionsFilterLimit,0);n>0&&(t.activeMinutes=n),s>0&&(t.limit=s);const i=await e.client.request("sessions.list",t);i&&(e.sessionsResult=i)}catch(t){e.sessionsError=String(t)}finally{e.sessionsLoading=!1}}}async function Tc(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 ht(e)}catch(i){e.sessionsError=String(i)}}async function Cc(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
22
|
-
|
|
23
|
-
Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await ht(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}const wa=50,Ec=80,Rc=12e4;function Mc(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
24
|
-
`)}function $a(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Mc(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=Lo(n,Rc);return s.truncated?`${s.text}
|
|
25
|
-
|
|
26
|
-
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function Ic(e){const t=[];return t.push({type:"toolcall",name:e.name,arguments:e.args??{}}),e.output&&t.push({type:"toolresult",name:e.name,text:e.output}),{role:"assistant",toolCallId:e.toolCallId,runId:e.runId,content:t,timestamp:e.startedAt}}function Lc(e){if(e.toolStreamOrder.length<=wa)return;const t=e.toolStreamOrder.length-wa,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function Pc(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function Es(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Pc(e)}function Nc(e,t=!1){if(t){Es(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>Es(e),Ec))}function kn(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],Es(e)}const Oc=5e3;function Dc(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},Oc))}function Bc(e,t){if(!t)return;if(t.stream==="compaction"){Dc(e,t);return}if(t.stream!=="tool")return;const n=typeof t.sessionKey=="string"?t.sessionKey:void 0;if(n&&n!==e.sessionKey||!n&&e.chatRunId&&t.runId!==e.chatRunId||e.chatRunId&&t.runId!==e.chatRunId||!e.chatRunId)return;const s=t.data??{},i=typeof s.toolCallId=="string"?s.toolCallId:"";if(!i)return;const a=typeof s.name=="string"?s.name:"tool",o=typeof s.phase=="string"?s.phase:"",c=o==="start"?s.args:void 0,l=o==="update"?$a(s.partialResult):o==="result"?$a(s.result):void 0,u=Date.now();let d=e.toolStreamById.get(i);d?(d.name=a,c!==void 0&&(d.args=c),l!==void 0&&(d.output=l),d.updatedAt=u):(d={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:c,output:l,startedAt:typeof t.ts=="number"?t.ts:u,updatedAt:u,message:{}},e.toolStreamById.set(i,d),e.toolStreamOrder.push(i)),d.message=Ic(d),Lc(e),Nc(e,o==="result")}function Sn(e,t=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const n=()=>{const s=e.querySelector(".chat-thread");if(s){const i=getComputedStyle(s).overflowY;if(i==="auto"||i==="scroll"||s.scrollHeight-s.clientHeight>1)return s}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const s=n();if(!s)return;const i=s.scrollHeight-s.scrollTop-s.clientHeight;if(!(t||e.chatUserNearBottom||i<200))return;t&&(e.chatHasAutoScrolled=!0),s.scrollTop=s.scrollHeight,e.chatUserNearBottom=!0;const o=t?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const c=n();if(!c)return;const l=c.scrollHeight-c.scrollTop-c.clientHeight;(t||e.chatUserNearBottom||l<200)&&(c.scrollTop=c.scrollHeight,e.chatUserNearBottom=!0)},o)})})}function No(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 Fc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<200}function Uc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function Kc(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0}function zc(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const Vt=globalThis,Rs=Vt.ShadowRoot&&(Vt.ShadyCSS===void 0||Vt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Is=Symbol(),Di=new WeakMap;let Xa=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==Is)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(Rs&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Di.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Di.set(n,t))}return t}toString(){return this.cssText}};const Wr=e=>new Xa(typeof e=="string"?e:e+"",void 0,Is),Gr=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,a)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[a+1],e[0]);return new Xa(n,e,Is)},Yr=(e,t)=>{if(Rs)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Vt.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},Bi=Rs?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Wr(n)})(e):e;const{is:Qr,defineProperty:Jr,getOwnPropertyDescriptor:Zr,getOwnPropertyNames:Xr,getOwnPropertySymbols:el,getPrototypeOf:tl}=Object,sn=globalThis,Fi=sn.trustedTypes,nl=Fi?Fi.emptyScript:"",sl=sn.reactiveElementPolyfillSupport,bt=(e,t)=>e,Yt={toAttribute(e,t){switch(t){case Boolean:e=e?nl: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}},Ps=(e,t)=>!Qr(e,t),Ui={attribute:!0,type:String,converter:Yt,reflect:!1,useDefault:!1,hasChanged:Ps};Symbol.metadata??=Symbol("metadata"),sn.litPropertyMetadata??=new WeakMap;let Qe=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=Ui){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&&Jr(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=Zr(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const c=i?.call(this);a?.call(this,o),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ui}static _$Ei(){if(this.hasOwnProperty(bt("elementProperties")))return;const t=tl(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(bt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(bt("properties"))){const n=this.properties,s=[...Xr(n),...el(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(Bi(i))}else t!==void 0&&n.push(Bi(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 Yr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,s){this._$AK(t,s)}_$ET(t,n){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const a=(s.converter?.toAttribute!==void 0?s.converter:Yt).toAttribute(n,s.type);this._$Em=t,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(t,n){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const a=s.getPropertyOptions(i),o=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Yt;this._$Em=i;const c=o.fromAttribute(n,a.type);this[i]=c??this._$Ej?.get(i)??c,this._$Em=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??Ps)(a,n)||s.useDefault&&s.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,c=this[i];o!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,a,c)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(t){}firstUpdated(t){}};Qe.elementStyles=[],Qe.shadowRootOptions={mode:"open"},Qe[bt("elementProperties")]=new Map,Qe[bt("finalized")]=new Map,sl?.({ReactiveElement:Qe}),(sn.reactiveElementVersions??=[]).push("2.1.2");const Ns=globalThis,Ki=e=>e,Qt=Ns.trustedTypes,Hi=Qt?Qt.createPolicy("lit-html",{createHTML:e=>e}):void 0,eo="$lit$",xe=`lit$${Math.random().toFixed(9).slice(2)}$`,to="?"+xe,il=`<${to}>`,Oe=document,xt=()=>Oe.createComment(""),kt=e=>e===null||typeof e!="object"&&typeof e!="function",Os=Array.isArray,al=e=>Os(e)||typeof e?.[Symbol.iterator]=="function",Un=`[
|
|
2
|
+
\f\r]`,lt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zi=/-->/g,ji=/>/g,Le=RegExp(`>|${Un}(?:([^\\s"'>=/]+)(${Un}*=${Un}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),qi=/'/g,Vi=/"/g,no=/^(?:script|style|textarea|title)$/i,ol=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=ol(1),Se=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Wi=new WeakMap,Pe=Oe.createTreeWalker(Oe,129);function so(e,t){if(!Os(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hi!==void 0?Hi.createHTML(t):t}const rl=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=lt;for(let c=0;c<n;c++){const l=e[c];let p,d,u=-1,g=0;for(;g<l.length&&(o.lastIndex=g,d=o.exec(l),d!==null);)g=o.lastIndex,o===lt?d[1]==="!--"?o=zi:d[1]!==void 0?o=ji:d[2]!==void 0?(no.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=Le):d[3]!==void 0&&(o=Le):o===Le?d[0]===">"?(o=i??lt,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,p=d[1],o=d[3]===void 0?Le:d[3]==='"'?Vi:qi):o===Vi||o===qi?o=Le:o===zi||o===ji?o=lt:(o=Le,i=void 0);const v=o===Le&&e[c+1].startsWith("/>")?" ":"";a+=o===lt?l+il:u>=0?(s.push(p),l.slice(0,u)+eo+l.slice(u)+xe+v):l+xe+(u===-2?c:v)}return[so(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let os=class io{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const c=t.length-1,l=this.parts,[p,d]=rl(t,n);if(this.el=io.createElement(p,s),Pe.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Pe.nextNode())!==null&&l.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(eo)){const g=d[o++],v=i.getAttribute(u).split(xe),w=/([.?@])?(.*)/.exec(g);l.push({type:1,index:a,name:w[2],strings:v,ctor:w[1]==="."?cl:w[1]==="?"?dl:w[1]==="@"?ul:on}),i.removeAttribute(u)}else u.startsWith(xe)&&(l.push({type:6,index:a}),i.removeAttribute(u));if(no.test(i.tagName)){const u=i.textContent.split(xe),g=u.length-1;if(g>0){i.textContent=Qt?Qt.emptyScript:"";for(let v=0;v<g;v++)i.append(u[v],xt()),Pe.nextNode(),l.push({type:2,index:++a});i.append(u[g],xt())}}}else if(i.nodeType===8)if(i.data===to)l.push({type:2,index:a});else{let u=-1;for(;(u=i.data.indexOf(xe,u+1))!==-1;)l.push({type:7,index:a}),u+=xe.length-1}a++}}static createElement(t,n){const s=Oe.createElement("template");return s.innerHTML=t,s}};function Xe(e,t,n=e,s){if(t===Se)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=kt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=Xe(e,i._$AS(e,t.values),i,s)),t}class ll{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??Oe).importNode(n,!0);Pe.currentNode=i;let a=Pe.nextNode(),o=0,c=0,l=s[0];for(;l!==void 0;){if(o===l.index){let p;l.type===2?p=new an(a,a.nextSibling,this,t):l.type===1?p=new l.ctor(a,l.name,l.strings,this,t):l.type===6&&(p=new pl(a,this,t)),this._$AV.push(p),l=s[++c]}o!==l?.index&&(a=Pe.nextNode(),o++)}return Pe.currentNode=Oe,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let an=class ao{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Xe(this,t,n),kt(t)?t===f||t==null||t===""?(this._$AH!==f&&this._$AR(),this._$AH=f):t!==this._$AH&&t!==Se&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):al(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==f&&kt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Oe.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=os.createElement(so(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new ll(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Wi.get(t.strings);return n===void 0&&Wi.set(t.strings,n=new os(t)),n}k(t){Os(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new ao(this.O(xt()),this.O(xt()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=Ki(t).nextSibling;Ki(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class on{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=f,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=f}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=Xe(this,t,n,0),o=!kt(t)||t!==this._$AH&&t!==Se,o&&(this._$AH=t);else{const c=t;let l,p;for(t=a[0],l=0;l<a.length-1;l++)p=Xe(this,c[s+l],n,l),p===Se&&(p=this._$AH[l]),o||=!kt(p)||p!==this._$AH[l],p===f?t=f:t!==f&&(t+=(p??"")+a[l+1]),this._$AH[l]=p}o&&!i&&this.j(t)}j(t){t===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let cl=class extends on{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===f?void 0:t}},dl=class extends on{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==f)}},ul=class extends on{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=Xe(this,t,n,0)??f)===Se)return;const s=this._$AH,i=t===f&&s!==f||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==f&&(s===f||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},pl=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){Xe(this,t)}};const hl={I:an},fl=Ns.litHtmlPolyfillSupport;fl?.(os,an),(Ns.litHtmlVersions??=[]).push("3.3.2");const gl=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new an(t.insertBefore(xt(),a),a,void 0,n??{})}return i._$AI(e),i};const Ds=globalThis;let Ze=class extends Qe{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=gl(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Se}};Ze._$litElement$=!0,Ze.finalized=!0,Ds.litElementHydrateSupport?.({LitElement:Ze});const vl=Ds.litElementPolyfillSupport;vl?.({LitElement:Ze});(Ds.litElementVersions??=[]).push("4.2.2");const oo=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const ml={attribute:!0,type:String,converter:Yt,reflect:!1,hasChanged:Ps},yl=(e=ml,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(c){const l=t.get.call(this);t.set.call(this,c),this.requestUpdate(o,l,e,!0,c)},init(c){return c!==void 0&&this.C(o,void 0,e,c),c}}}if(s==="setter"){const{name:o}=n;return function(c){const l=this[o];t.call(this,c),this.requestUpdate(o,l,e,!0,c)}}throw Error("Unsupported decorator location: "+s)};function rn(e){return(t,n)=>typeof n=="object"?yl(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function b(e){return rn({...e,state:!0,attribute:!1})}const bl=50,wl=200,$l="Assistant";function Gi(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function rs(e){const t=Gi(e?.name,bl)??$l,n=Gi(e?.avatar??void 0,wl)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function xl(){return rs(typeof window>"u"?{}:{name:window.__CLAWDBOT_ASSISTANT_NAME__,avatar:window.__CLAWDBOT_ASSISTANT_AVATAR__})}const ro="poolbot.control.settings.v1";function kl(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{},personality:"default",skin:"default"};try{const n=localStorage.getItem(ro);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,personality:typeof s.personality=="string"&&s.personality.trim()?s.personality.trim():t.personality,skin:typeof s.skin=="string"&&s.skin.trim()?s.skin.trim():t.skin}}catch{return t}}function Al(e){localStorage.setItem(ro,JSON.stringify(e))}function lo(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const Sl=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","cron"]},{label:"Agent",tabs:["skills","nodes"]},{label:"Insights",tabs:["usage"]},{label:"Settings",tabs:["config","debug","logs"]}],co={overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",cron:"/cron",skills:"/skills",nodes:"/nodes",usage:"/usage",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},uo=new Map(Object.entries(co).map(([e,t])=>[t,e]));function ln(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function At(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 cn(e,t=""){const n=ln(t),s=co[e];return n?`${n}${s}`:s}function po(e,t=""){const n=ln(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=At(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":uo.get(i)??null}function _l(e){let t=At(e);if(t.endsWith("/index.html")&&(t=At(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(uo.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function Cl(e){switch(e){case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"usage":return"barChart";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function ls(e){switch(e){case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"usage":return"Usage & Costs";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function Tl(e){switch(e){case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"usage":return"Token usage, cost breakdown, and session analytics.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.poolbot/poolbot.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const W={messageSquare:r`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:r`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:r`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:r`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:r`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:r`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:r`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:r`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:r`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:r`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,menu:r`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:r`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:r`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:r`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:r`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:r`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:r`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:r`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,wrench:r`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:r`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:r`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:r`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:r`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,eye:r`<svg viewBox="0 0 24 24"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`,eyeOff:r`<svg viewBox="0 0 24 24"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:r`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:r`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,shield:r`<svg viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="m9 12 2 2 4-4"/></svg>`,plug:r`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:r`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:r`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`},El=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Bt=/<\s*\/?\s*final\b[^<>]*>/gi,Yi=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Qi(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(l=>a>=l.start&&o<=l.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Ji(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Ll(e,t){return e.trimStart()}function Ml(e,t){if(!e||!El.test(e))return e;let n=e;if(Bt.test(n)){Bt.lastIndex=0;const c=[],l=Qi(n);for(const p of n.matchAll(Bt)){const d=p.index??0;c.push({start:d,length:p[0].length,inCode:Ji(d,l)})}for(let p=c.length-1;p>=0;p--){const d=c[p];d.inCode||(n=n.slice(0,d.start)+n.slice(d.start+d.length))}}else Bt.lastIndex=0;const s=Qi(n);Yi.lastIndex=0;let i="",a=0,o=!1;for(const c of n.matchAll(Yi)){const l=c.index??0,p=c[1]==="/";Ji(l,s)||(o?p&&(o=!1):(i+=n.slice(a,l),p||(o=!0)),a=l+c[0].length)}return i+=n.slice(a),Ll(i)}function St(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function O(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0)return"just now";const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const s=Math.round(n/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);return i<48?`${i}h ago`:`${Math.round(i/24)}d ago`}const dn=O;function Rl(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const s=Math.round(n/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function cs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function ds(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function ho(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 Jt(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Kn(e){return Ml(e)}const Il=/^\[([^\]]+)\]\s*/,Pl=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Hn=new WeakMap,zn=new WeakMap;function Nl(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:Pl.some(t=>e.startsWith(`${t} `))}function jn(e){const t=e.match(Il);if(!t)return e;const n=t[1]??"";return Nl(n)?e.slice(t[0].length):e}function us(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?Kn(s):jn(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
|
|
4
|
+
`);return n==="assistant"?Kn(a):jn(a)}}return typeof t.text=="string"?n==="assistant"?Kn(t.text):jn(t.text):null}function fo(e){if(!e||typeof e!="object")return us(e);const t=e;if(Hn.has(t))return Hn.get(t)??null;const n=us(e);return Hn.set(t,n),n}function Zi(e){const n=e.content,s=[];if(Array.isArray(n))for(const c of n){const l=c;if(l.type==="thinking"&&typeof l.thinking=="string"){const p=l.thinking.trim();p&&s.push(p)}}if(s.length>0)return s.join(`
|
|
5
|
+
`);const i=Dl(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(c=>(c[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
|
|
6
|
+
`):null}function Ol(e){if(!e||typeof e!="object")return Zi(e);const t=e;if(zn.has(t))return zn.get(t)??null;const n=Zi(e);return zn.set(t,n),n}function Dl(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
|
|
7
|
+
`)}return typeof t.text=="string"?t.text:null}function Bl(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean).map(s=>`_${s}_`);return n.length?["_Reasoning:_",...n].join(`
|
|
8
|
+
`):""}let Xi=!1;function ea(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 Fl(){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 Ul(){Xi||(Xi=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Bs(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),ea(t)}return Ul(),ea(Fl())}async function et(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Kl(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Hl(e,t,n){if(!e.client||!e.connected)return!1;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return!1;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const p of n)o.push({type:"image",source:{type:"base64",media_type:p.mimeType,data:p.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const c=Bs();e.chatRunId=c,e.chatStream="",e.chatStreamStartedAt=a;const l=i?n.map(p=>{const d=Kl(p.dataUrl);return d?{type:"image",mimeType:d.mimeType,content:d.content}:null}).filter(p=>p!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:c,attachments:l}),!0}catch(p){const d=String(p);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=d,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+d}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function zl(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 jl(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=us(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}async function it(e){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const t={includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown},n=Jt(e.sessionsFilterActive,0),s=Jt(e.sessionsFilterLimit,0);n>0&&(t.activeMinutes=n),s>0&&(t.limit=s);const i=await e.client.request("sessions.list",t);i&&(e.sessionsResult=i)}catch(t){e.sessionsError=String(t)}finally{e.sessionsLoading=!1}}}async function ql(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 it(e)}catch(i){e.sessionsError=String(i)}}async function Vl(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
9
|
+
|
|
10
|
+
Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await it(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}const ta=50,Wl=80,Gl=12e4;function Yl(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
11
|
+
`)}function na(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Yl(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=ho(n,Gl);return s.truncated?`${s.text}
|
|
12
|
+
|
|
13
|
+
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function Ql(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 Jl(e){if(e.toolStreamOrder.length<=ta)return;const t=e.toolStreamOrder.length-ta,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function Zl(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function ps(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Zl(e)}function Xl(e,t=!1){if(t){ps(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>ps(e),Wl))}function un(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],ps(e)}const ec=5e3;function tc(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},ec))}function nc(e,t){if(!t)return;if(t.stream==="compaction"){tc(e,t);return}if(t.stream!=="tool")return;const n=typeof t.sessionKey=="string"?t.sessionKey:void 0;if(n&&n!==e.sessionKey||!n&&e.chatRunId&&t.runId!==e.chatRunId||e.chatRunId&&t.runId!==e.chatRunId||!e.chatRunId)return;const s=t.data??{},i=typeof s.toolCallId=="string"?s.toolCallId:"";if(!i)return;const a=typeof s.name=="string"?s.name:"tool",o=typeof s.phase=="string"?s.phase:"",c=o==="start"?s.args:void 0,l=o==="update"?na(s.partialResult):o==="result"?na(s.result):void 0,p=Date.now();let d=e.toolStreamById.get(i);d?(d.name=a,c!==void 0&&(d.args=c),l!==void 0&&(d.output=l),d.updatedAt=p):(d={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:c,output:l,startedAt:typeof t.ts=="number"?t.ts:p,updatedAt:p,message:{}},e.toolStreamById.set(i,d),e.toolStreamOrder.push(i)),d.message=Ql(d),Jl(e),Xl(e,o==="result")}function pn(e,t=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const n=()=>{const s=e.querySelector(".chat-thread");if(s){const i=getComputedStyle(s).overflowY;if(i==="auto"||i==="scroll"||s.scrollHeight-s.clientHeight>1)return s}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const s=n();if(!s)return;const i=s.scrollHeight-s.scrollTop-s.clientHeight;if(!(t||e.chatUserNearBottom||i<200))return;t&&(e.chatHasAutoScrolled=!0),s.scrollTop=s.scrollHeight,e.chatUserNearBottom=!0;const o=t?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const c=n();if(!c)return;const l=c.scrollHeight-c.scrollTop-c.clientHeight;(t||e.chatUserNearBottom||l<200)&&(c.scrollTop=c.scrollHeight,e.chatUserNearBottom=!0)},o)})})}function go(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 sc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<200}function ic(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function ac(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0}function oc(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
27
14
|
`)}
|
|
28
|
-
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`poolbot-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function
|
|
29
|
-
`}function Oo(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],c=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof c=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const l=s;l[o]==null&&(l[o]=typeof c=="number"?[]:{}),s=l[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function Do(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function Ae(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Vc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function Bo(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});jc(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function jc(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Vc(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?ct(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=ct(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=Ve(t.config??{}),e.configFormOriginal=Ve(t.config??{}),e.configRawOriginal=n)}async function Rs(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?ct(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await Ae(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function Wc(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?ct(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.apply",{raw:t,baseHash:n,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await Ae(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function qc(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 Yt(e,t,n){const s=Ve(e.configForm??e.configSnapshot?.config??{});Oo(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=ct(s))}function xa(e,t){const n=Ve(e.configForm??e.configSnapshot?.config??{});Do(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=ct(n))}async function Bt(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 An(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function Gc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=dn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function Yc(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=dn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function Qc(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=Gc(e.cronForm),n=Yc(e.cronForm),s=e.cronForm.agentId.trim(),i={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!i.name)throw new Error("Name required.");await e.client.request("cron.add",i),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await An(e),await Bt(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function Jc(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 An(e),await Bt(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function Zc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await Fo(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Xc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await An(e),await Bt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Fo(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function ue(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 ed(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 td(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 nd(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}async function _n(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function sd(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 id=2e3,ad=new Set(["trace","debug","info","warn","error","fatal"]);function od(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 rd(e){if(typeof e!="string")return null;const t=e.toLowerCase();return ad.has(t)?t:null}function ld(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=rd(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=od(a);let c=null;o&&(typeof o.subsystem=="string"?c=o.subsystem:typeof o.module=="string"&&(c=o.module)),!c&&a&&a.length<120&&(c=a);let l=null;return typeof t[1]=="string"?l=t[1]:!o&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:s,level:i,subsystem:c,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function ti(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(c=>typeof c=="string"):[]).map(ld),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-id),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}const Uo={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:q,n:an,Gx:ka,Gy:Sa,a:os,d:rs,h:cd}=Uo,We=32,ni=64,dd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},H=(e="")=>{const t=new Error(e);throw dd(t,H),t},ud=e=>typeof e=="bigint",pd=e=>typeof e=="string",hd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Le=(e,t,n="")=>{const s=hd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,c=a?` of length ${t}`:"",l=s?`length=${i}`:`type=${typeof e}`;H(o+"expected Uint8Array"+c+", got "+l)}return e},Tn=e=>new Uint8Array(e),Ko=e=>Uint8Array.from(e),zo=(e,t)=>e.toString(16).padStart(t,"0"),Ho=e=>Array.from(Le(e)).map(t=>zo(t,2)).join(""),$e={_0:48,_9:57,A:65,F:70,a:97,f:102},Aa=e=>{if(e>=$e._0&&e<=$e._9)return e-$e._0;if(e>=$e.A&&e<=$e.F)return e-($e.A-10);if(e>=$e.a&&e<=$e.f)return e-($e.a-10)},jo=e=>{const t="hex invalid";if(!pd(e))return H(t);const n=e.length,s=n/2;if(n%2)return H(t);const i=Tn(s);for(let a=0,o=0;a<s;a++,o+=2){const c=Aa(e.charCodeAt(o)),l=Aa(e.charCodeAt(o+1));if(c===void 0||l===void 0)return H(t);i[a]=c*16+l}return i},Vo=()=>globalThis?.crypto,fd=()=>Vo()?.subtle??H("crypto.subtle must be defined, consider polyfill"),Ot=(...e)=>{const t=Tn(e.reduce((s,i)=>s+Le(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},gd=(e=We)=>Vo().getRandomValues(Tn(e)),un=BigInt,Ue=(e,t,n,s="bad number: out of range")=>ud(e)&&t<=e&&e<n?e:H(s),S=(e,t=q)=>{const n=e%t;return n>=0n?n:t+n},Wo=e=>S(e,an),md=(e,t)=>{(e===0n||t<=0n)&&H("no inverse n="+e+" mod="+t);let n=S(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,c=s%n,l=i-a*o;s=n,n=c,i=a,a=l}return s===1n?S(i,t):H("no inverse")},vd=e=>{const t=Qo[e];return typeof t!="function"&&H("hashes."+e+" not set"),t},ls=e=>e instanceof ne?e:H("Point expected"),Ms=2n**256n;class ne{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Ms;this.X=Ue(t,0n,a),this.Y=Ue(n,0n,a),this.Z=Ue(s,1n,a),this.T=Ue(i,0n,a),Object.freeze(this)}static CURVE(){return Uo}static fromAffine(t){return new ne(t.x,t.y,1n,S(t.x*t.y))}static fromBytes(t,n=!1){const s=rs,i=Ko(Le(t,We)),a=t[31];i[31]=a&-129;const o=Go(i);Ue(o,0n,n?Ms:q);const l=S(o*o),u=S(l-1n),d=S(s*l+1n);let{isValid:p,value:f}=bd(u,d);p||H("bad point: y not sqrt");const m=(f&1n)===1n,v=(a&128)!==0;return!n&&f===0n&&v&&H("bad point: x==0, isLastByteOdd"),v!==m&&(f=S(-f)),new ne(f,o,1n,S(f*o))}static fromHex(t,n){return ne.fromBytes(jo(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=os,n=rs,s=this;if(s.is0())return H("bad point: ZERO");const{X:i,Y:a,Z:o,T:c}=s,l=S(i*i),u=S(a*a),d=S(o*o),p=S(d*d),f=S(l*t),m=S(d*S(f+u)),v=S(p+S(n*S(l*u)));if(m!==v)return H("bad point: equation left != right (1)");const $=S(i*a),k=S(o*c);return $!==k?H("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:c}=ls(t),l=S(n*c),u=S(a*i),d=S(s*c),p=S(o*i);return l===u&&d===p}is0(){return this.equals(at)}negate(){return new ne(S(-this.X),this.Y,this.Z,S(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=os,a=S(t*t),o=S(n*n),c=S(2n*S(s*s)),l=S(i*a),u=t+n,d=S(S(u*u)-a-o),p=l+o,f=p-c,m=l-o,v=S(d*f),$=S(p*m),k=S(d*m),_=S(f*p);return new ne(v,$,_,k)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:c,Z:l,T:u}=ls(t),d=os,p=rs,f=S(n*o),m=S(s*c),v=S(a*p*u),$=S(i*l),k=S((n+s)*(o+c)-f-m),_=S($-v),M=S($+v),N=S(m-d*f),R=S(k*_),C=S(M*N),E=S(k*N),ve=S(_*M);return new ne(R,C,ve,E)}subtract(t){return this.add(ls(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return at;if(Ue(t,1n,an),t===1n)return this;if(this.equals(qe))return Rd(t).p;let s=at,i=qe;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(at))return{x:0n,y:1n};const i=md(s,q);S(s*i)!==1n&&H("invalid inverse");const a=S(t*i),o=S(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=qo(n);return s[31]|=t&1n?128:0,s}toHex(){return Ho(this.toBytes())}clearCofactor(){return this.multiply(un(cd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(an/2n,!1).double();return an%2n&&(t=t.add(this)),t.is0()}}const qe=new ne(ka,Sa,1n,S(ka*Sa)),at=new ne(0n,1n,1n,0n);ne.BASE=qe;ne.ZERO=at;const qo=e=>jo(zo(Ue(e,0n,Ms),ni)).reverse(),Go=e=>un("0x"+Ho(Ko(Le(e)).reverse())),fe=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=q;return n},yd=e=>{const n=e*e%q*e%q,s=fe(n,2n)*n%q,i=fe(s,1n)*e%q,a=fe(i,5n)*i%q,o=fe(a,10n)*a%q,c=fe(o,20n)*o%q,l=fe(c,40n)*c%q,u=fe(l,80n)*l%q,d=fe(u,80n)*l%q,p=fe(d,10n)*a%q;return{pow_p_5_8:fe(p,2n)*e%q,b2:n}},_a=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,bd=(e,t)=>{const n=S(t*t*t),s=S(n*n*t),i=yd(e*s).pow_p_5_8;let a=S(e*n*i);const o=S(t*a*a),c=a,l=S(a*_a),u=o===e,d=o===S(-e),p=o===S(-e*_a);return u&&(a=c),(d||p)&&(a=l),(S(a)&1n)===1n&&(a=S(-a)),{isValid:u||d,value:a}},Is=e=>Wo(Go(e)),si=(...e)=>Qo.sha512Async(Ot(...e)),wd=(...e)=>vd("sha512")(Ot(...e)),Yo=e=>{const t=e.slice(0,We);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(We,ni),s=Is(t),i=qe.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},ii=e=>si(Le(e,We)).then(Yo),$d=e=>Yo(wd(Le(e,We))),xd=e=>ii(e).then(t=>t.pointBytes),kd=e=>si(e.hashable).then(e.finish),Sd=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Is(t),o=qe.multiply(a).toBytes();return{hashable:Ot(o,s,n),finish:u=>{const d=Wo(a+Is(u)*i);return Le(Ot(o,qo(d)),ni)}}},Ad=async(e,t)=>{const n=Le(e),s=await ii(t),i=await si(s.prefix,n);return kd(Sd(s,i,n))},Qo={sha512Async:async e=>{const t=fd(),n=Ot(e);return Tn(await t.digest("SHA-512",n.buffer))},sha512:void 0},_d=(e=gd(We))=>e,Td={getExtendedPublicKeyAsync:ii,getExtendedPublicKey:$d,randomSecretKey:_d},pn=8,Cd=256,Jo=Math.ceil(Cd/pn)+1,Ls=2**(pn-1),Ed=()=>{const e=[];let t=qe,n=t;for(let s=0;s<Jo;s++){n=t,e.push(n);for(let i=1;i<Ls;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Ta;const Ca=(e,t)=>{const n=t.negate();return e?n:t},Rd=e=>{const t=Ta||(Ta=Ed());let n=at,s=qe;const i=2**pn,a=i,o=un(i-1),c=un(pn);for(let l=0;l<Jo;l++){let u=Number(e&o);e>>=c,u>Ls&&(u-=a,e+=1n);const d=l*Ls,p=d,f=d+Math.abs(u)-1,m=l%2!==0,v=u<0;u===0?s=s.add(Ca(m,t[p])):n=n.add(Ca(v,t[f]))}return e!==0n&&H("invalid wnaf"),{p:n,f:s}},cs="poolbot-device-identity-v1";function Ps(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Zo(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Md(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Xo(e){const t=await crypto.subtle.digest("SHA-256",e);return Md(new Uint8Array(t))}async function Id(){const e=Td.randomSecretKey(),t=await xd(e);return{deviceId:await Xo(t),publicKey:Ps(t),privateKey:Ps(e)}}async function ai(){try{const n=localStorage.getItem(cs);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 Xo(Zo(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(cs,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Id(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(cs,JSON.stringify(t)),e}async function Ld(e,t){const n=Zo(e),s=new TextEncoder().encode(t),i=await Ad(s,n);return Ps(i)}const er="poolbot.device.auth.v1";function oi(e){return e.trim()}function Pd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].sort()}function ri(){try{const e=window.localStorage.getItem(er);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 tr(e){try{window.localStorage.setItem(er,JSON.stringify(e))}catch{}}function Nd(e){const t=ri();if(!t||t.deviceId!==e.deviceId)return null;const n=oi(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function nr(e){const t=oi(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=ri();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:Pd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,tr(n),i}function sr(e){const t=ri();if(!t||t.deviceId!==e.deviceId)return;const n=oi(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],tr(s)}async function Pe(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 Od(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Pe(e)}catch(n){e.devicesError=String(n)}}async function Dd(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 Pe(e)}catch(s){e.devicesError=String(s)}}async function Bd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await ai(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&nr({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 Pe(e)}catch(n){e.devicesError=String(n)}}async function Fd(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 ai();t.deviceId===s.deviceId&&sr({deviceId:s.deviceId,role:t.role}),await Pe(e)}catch(s){e.devicesError=String(s)}}async function Cn(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 Ud(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 Kd(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 li(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Ud(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);zd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function zd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=Ve(t.file??{}))}async function Hd(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=Kd(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 li(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function jd(e,t,n){const s=Ve(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});Oo(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function Vd(e,t){const n=Ve(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});Do(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function ci(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function dt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function En(e){return e instanceof Error?e.message:String(e)}async function Ft(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=En(n)}finally{e.skillsLoading=!1}}}function Wd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function qd(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 Ft(e),dt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=En(s);e.skillsError=i,dt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Gd(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 Ft(e),dt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=En(n);e.skillsError=s,dt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Yd(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 Ft(e),dt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=En(i);e.skillsError=a,dt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}function Qd(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function di(e){return e==="system"?Qd():e}const Qt=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Jd=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Jt=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Zd=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,c=Jd();if(!!o.startViewTransition&&!c){let u=.5,d=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=Qt(n.pointerClientX/window.innerWidth),d=Qt(n.pointerClientY/window.innerHeight);else if(n?.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(u=Qt((p.left+p.width/2)/window.innerWidth),d=Qt((p.top+p.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${d*100}%`),a.classList.add("theme-transition");try{const p=o.startViewTransition?.(()=>{t()});p?.finished?p.finished.finally(()=>Jt(a)):Jt(a)}catch{Jt(a),t()}return}t(),Jt(a)};function Xd(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Cn(e,{quiet:!0})},5e3))}function eu(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function ui(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&ti(e,{quiet:!0})},2e3))}function pi(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function hi(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&_n(e)},3e3))}function fi(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Re(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,oc(n),t.theme!==e.theme&&(e.theme=t.theme,Rn(e,di(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function ir(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Re(e,{...e.settings,lastActiveSessionKey:n})}function tu(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),a=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&Re(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(s!=null){const l=s.trim();l&&(e.password=l),t.delete("password"),o=!0}if(i!=null){const l=i.trim();l&&(e.sessionKey=l,Re(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(a!=null){const l=a.trim();l&&l!==e.settings.gatewayUrl&&Re(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),o=!0}if(!o)return;const c=new URL(window.location.href);c.search=t.toString(),window.history.replaceState({},"",c.toString())}function nu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?ui(e):pi(e),t==="debug"?hi(e):fi(e),gi(e),or(e,t,!1)}function su(e,t,n){Zd({nextTheme:t,applyTheme:()=>{e.theme=t,Re(e,{...e.settings,theme:t}),Rn(e,di(t))},context:n,currentTheme:e.theme})}async function gi(e){e.tab==="overview"&&await rr(e),e.tab==="channels"&&await uu(e),e.tab==="instances"&&await ci(e),e.tab==="sessions"&&await ht(e),e.tab==="cron"&&await mi(e),e.tab==="skills"&&await Ft(e),e.tab==="nodes"&&(await Cn(e),await Pe(e),await Ae(e),await li(e)),e.tab==="chat"&&(await mu(e),Sn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await Bo(e),await Ae(e)),e.tab==="debug"&&(await _n(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await ti(e,{reset:!0}),No(e,!0))}function iu(){if(typeof window>"u")return"";const e=window.__CLAWDBOT_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?wn(e):lc(window.location.pathname)}function au(e){e.theme=e.settings.theme??"system",Rn(e,di(e.theme))}function Rn(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function ou(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"&&Rn(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function ru(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 lu(e,t){if(typeof window>"u")return;const n=Io(window.location.pathname,e.basePath)??"chat";ar(e,n),or(e,n,t)}function cu(e){if(typeof window>"u")return;const t=Io(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Re(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),ar(e,t)}function ar(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?ui(e):pi(e),t==="debug"?hi(e):fi(e),e.connected&&gi(e)}function or(e,t,n){if(typeof window>"u")return;const s=Pt($n(t,e.basePath)),i=Pt(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function du(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 rr(e){await Promise.all([ue(e,!1),ci(e),ht(e),Bt(e),_n(e)])}async function uu(e){await Promise.all([ue(e,!0),Bo(e),Ae(e)])}async function mi(e){await Promise.all([ue(e,!1),Bt(e),An(e)])}function lr(e){return e.chatSending||!!e.chatRunId}function pu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}async function cr(e){e.connected&&(e.chatMessage="",await Ac(e))}function hu(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:ei(),text:s,createdAt:Date.now(),attachments:i?n?.map(a=>({...a})):void 0}])}async function dr(e,t,n){kn(e);const s=await Sc(e,t,n?.attachments);return!s&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!s&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),s&&ir(e,e.sessionKey),s&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),s&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),Sn(e),s&&!e.chatRunId&&ur(e),s}async function ur(e){if(!e.connected||lr(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await dr(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function fu(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function gu(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],c=o.length>0;if(!(!i&&!c)){if(pu(i)){await cr(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),lr(e)){hu(e,i,o);return}await dr(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:c?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft)})}}async function mu(e){await Promise.all([lt(e),ht(e),Ns(e)]),Sn(e,!0)}const vu=ur;function yu(e){const t=Eo(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function bu(e,t){const n=wn(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function Ns(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=yu(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=bu(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const pr={CHILD:2},hr=e=>(...t)=>({_$litDirective$:e,values:t});class fr{constructor(t){}get _$isConnected(){return this._$parent._$isConnected}_$initialize(t,n,s){this.__part=t,this._$parent=n,this.__attributeIndex=s}_$resolve(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}}const{_ChildPart:wu}=Gl,st=window.ShadyDOM?.inUse&&window.ShadyDOM?.noPatch===!0?window.ShadyDOM.wrap:e=>e,Ea=()=>document.createComment(""),yt=(e,t,n)=>{const s=st(e._$startNode).parentNode,i=t===void 0?e._$endNode:t._$startNode;if(n===void 0){const a=st(s).insertBefore(Ea(),i),o=st(s).insertBefore(Ea(),i);n=new wu(a,o,e,e.options)}else{const a=st(n._$endNode).nextSibling,o=n._$parent,c=o!==e;if(c){n._$reparentDisconnectables?.(e),n._$parent=e;let l;n._$notifyConnectionChanged!==void 0&&(l=e._$isConnected)!==o._$isConnected&&n._$notifyConnectionChanged(l)}if(a!==i||c){let l=n._$startNode;for(;l!==a;){const u=st(l).nextSibling;st(s).insertBefore(l,i),l=u}}}return n},Be=(e,t,n=e)=>(e._$setValue(t,n),e),$u={},xu=(e,t=$u)=>e._$committedValue=t,ku=e=>e._$committedValue,ds=e=>{e._$clear(),e._$startNode.remove()};const Ra=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s};class Su extends fr{constructor(t){if(super(t),t.type!==pr.CHILD)throw new Error("repeat() can only be used in text expressions")}_getValuesAndKeys(t,n,s){let i;s===void 0?s=n:n!==void 0&&(i=n);const a=[],o=[];let c=0;for(const l of t)a[c]=i?i(l,c):c,o[c]=s(l,c),c++;return{values:o,keys:a}}render(t,n,s){return this._getValuesAndKeys(t,n,s).values}update(t,[n,s,i]){const a=ku(t),{values:o,keys:c}=this._getValuesAndKeys(n,s,i);if(!Array.isArray(a))return this._itemKeys=c,o;const l=this._itemKeys??=[],u=[];let d,p,f=0,m=a.length-1,v=0,$=o.length-1;for(;f<=m&&v<=$;)if(a[f]===null)f++;else if(a[m]===null)m--;else if(l[f]===c[v])u[v]=Be(a[f],o[v]),f++,v++;else if(l[m]===c[$])u[$]=Be(a[m],o[$]),m--,$--;else if(l[f]===c[$])u[$]=Be(a[f],o[$]),yt(t,u[$+1],a[f]),f++,$--;else if(l[m]===c[v])u[v]=Be(a[m],o[v]),yt(t,a[f],a[m]),m--,v++;else if(d===void 0&&(d=Ra(c,v,$),p=Ra(l,f,m)),!d.has(l[f]))ds(a[f]),f++;else if(!d.has(l[m]))ds(a[m]),m--;else{const k=p.get(c[v]),_=k!==void 0?a[k]:null;if(_===null){const M=yt(t,a[f]);Be(M,o[v]),u[v]=M}else u[v]=Be(_,o[v]),yt(t,a[f],_),a[k]=null;v++}for(;v<=$;){const k=yt(t,u[$+1]);Be(k,o[v]),u[v++]=k}for(;f<=m;){const k=a[f++];k!==null&&ds(k)}return this._itemKeys=c,xu(t,u),Ie}}const gr=hr(Su);function mr(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(p=>{const m=String(p.type??"").toLowerCase();return m==="toolresult"||m==="tool_result"}),c=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||c)&&(n="toolResult");let l=[];typeof t.content=="string"?l=[{type:"text",text:t.content}]:Array.isArray(t.content)?l=t.content.map(p=>({type:p.type||"text",text:p.text,name:p.name,args:p.args||p.arguments})):typeof t.text=="string"&&(l=[{type:"text",text:t.text}]);const u=typeof t.timestamp=="number"?t.timestamp:Date.now(),d=typeof t.id=="string"?t.id:void 0;return{role:n,content:l,timestamp:u,id:d}}function vi(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 vr(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const Au=1;class yi extends fr{constructor(t){if(super(t),this._value=g,t.type!==pr.CHILD)throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`)}render(t){if(t===g||t==null)return this._templateResult=void 0,this._value=t;if(t===Ie)return t;if(typeof t!="string")throw new Error(`${this.constructor.directiveName}() called with a non-string value`);if(t===this._value)return this._templateResult;this._value=t;const n=[t];return n.raw=n,this._templateResult={_$litType$:this.constructor.resultType,strings:n,values:[]}}}yi.directiveName="unsafeHTML";yi.resultType=Au;const Os=hr(yi);const{entries:yr,setPrototypeOf:Ma,isFrozen:_u,getPrototypeOf:Tu,getOwnPropertyDescriptor:Cu}=Object;let{freeze:Z,seal:ae,create:Ds}=Object,{apply:Bs,construct:Fs}=typeof Reflect<"u"&&Reflect;Z||(Z=function(t){return t});ae||(ae=function(t){return t});Bs||(Bs=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});Fs||(Fs=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 Zt=X(Array.prototype.forEach),Eu=X(Array.prototype.lastIndexOf),Ia=X(Array.prototype.pop),bt=X(Array.prototype.push),Ru=X(Array.prototype.splice),on=X(String.prototype.toLowerCase),us=X(String.prototype.toString),ps=X(String.prototype.match),wt=X(String.prototype.replace),Mu=X(String.prototype.indexOf),Iu=X(String.prototype.trim),oe=X(Object.prototype.hasOwnProperty),Q=X(RegExp.prototype.test),$t=Lu(TypeError);function X(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 Bs(e,t,s)}}function Lu(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return Fs(e,n)}}function I(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:on;Ma&&Ma(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(_u(t)||(t[s]=a),i=a)}e[i]=!0}return e}function Pu(e){for(let t=0;t<e.length;t++)oe(e,t)||(e[t]=null);return e}function ge(e){const t=Ds(null);for(const[n,s]of yr(e))oe(e,n)&&(Array.isArray(s)?t[n]=Pu(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=ge(s):t[n]=s);return t}function xt(e,t){for(;e!==null;){const s=Cu(e,t);if(s){if(s.get)return X(s.get);if(typeof s.value=="function")return X(s.value)}e=Tu(e)}function n(){return null}return n}const La=Z(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),hs=Z(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),fs=Z(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Nu=Z(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),gs=Z(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ou=Z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Pa=Z(["#text"]),Na=Z(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ms=Z(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Oa=Z(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Xt=Z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Du=ae(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Bu=ae(/<%[\w\W]*|[\w\W]*%>/gm),Fu=ae(/\$\{[\w\W]*/gm),Uu=ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ku=ae(/^aria-[\-\w]+$/),br=ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zu=ae(/^(?:\w+script|data):/i),Hu=ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wr=ae(/^html$/i),ju=ae(/^[a-z][.\w]*(-[.\w]+)+$/i);var Da=Object.freeze({__proto__:null,ARIA_ATTR:Ku,ATTR_WHITESPACE:Hu,CUSTOM_ELEMENT:ju,DATA_ATTR:Uu,DOCTYPE_NAME:wr,ERB_EXPR:Bu,IS_ALLOWED_URI:br,IS_SCRIPT_OR_DATA:zu,MUSTACHE_EXPR:Du,TMPLIT_EXPR:Fu});const kt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Vu=function(){return typeof window>"u"?null:window},Wu=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Ba=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function $r(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Vu();const t=T=>$r(T);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==kt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:c,Element:l,NodeFilter:u,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:m}=e,v=l.prototype,$=xt(v,"cloneNode"),k=xt(v,"remove"),_=xt(v,"nextSibling"),M=xt(v,"childNodes"),N=xt(v,"parentNode");if(typeof o=="function"){const T=n.createElement("template");T.content&&T.content.ownerDocument&&(n=T.content.ownerDocument)}let R,C="";const{implementation:E,createNodeIterator:ve,createDocumentFragment:Nn,getElementsByTagName:On}=n,{importNode:el}=s;let Y=Ba();t.isSupported=typeof yr=="function"&&typeof N=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Dn,ERB_EXPR:Bn,TMPLIT_EXPR:Fn,DATA_ATTR:tl,ARIA_ATTR:nl,IS_SCRIPT_OR_DATA:sl,ATTR_WHITESPACE:Ri,CUSTOM_ELEMENT:il}=Da;let{IS_ALLOWED_URI:Mi}=Da,z=null;const Ii=I({},[...La,...hs,...fs,...gs,...Pa]);let j=null;const Li=I({},[...Na,...ms,...Oa,...Xt]);let F=Object.seal(Ds(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}})),ft=null,Un=null;const Qe=Object.seal(Ds(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Pi=!0,Kn=!0,Ni=!1,Oi=!0,Je=!1,Kt=!0,Ne=!1,zn=!1,Hn=!1,Ze=!1,zt=!1,Ht=!1,Di=!0,Bi=!1;const al="user-content-";let jn=!0,gt=!1,Xe={},pe=null;const Vn=I({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Fi=null;const Ui=I({},["audio","video","img","source","image","track"]);let Wn=null;const Ki=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jt="http://www.w3.org/1998/Math/MathML",Vt="http://www.w3.org/2000/svg",ye="http://www.w3.org/1999/xhtml";let et=ye,qn=!1,Gn=null;const ol=I({},[jt,Vt,ye],us);let Wt=I({},["mi","mo","mn","ms","mtext"]),qt=I({},["annotation-xml"]);const rl=I({},["title","style","font","a","script"]);let mt=null;const ll=["application/xhtml+xml","text/html"],cl="text/html";let K=null,tt=null;const dl=n.createElement("form"),zi=function(h){return h instanceof RegExp||h instanceof Function},Yn=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(tt&&tt===h)){if((!h||typeof h!="object")&&(h={}),h=ge(h),mt=ll.indexOf(h.PARSER_MEDIA_TYPE)===-1?cl:h.PARSER_MEDIA_TYPE,K=mt==="application/xhtml+xml"?us:on,z=oe(h,"ALLOWED_TAGS")?I({},h.ALLOWED_TAGS,K):Ii,j=oe(h,"ALLOWED_ATTR")?I({},h.ALLOWED_ATTR,K):Li,Gn=oe(h,"ALLOWED_NAMESPACES")?I({},h.ALLOWED_NAMESPACES,us):ol,Wn=oe(h,"ADD_URI_SAFE_ATTR")?I(ge(Ki),h.ADD_URI_SAFE_ATTR,K):Ki,Fi=oe(h,"ADD_DATA_URI_TAGS")?I(ge(Ui),h.ADD_DATA_URI_TAGS,K):Ui,pe=oe(h,"FORBID_CONTENTS")?I({},h.FORBID_CONTENTS,K):Vn,ft=oe(h,"FORBID_TAGS")?I({},h.FORBID_TAGS,K):ge({}),Un=oe(h,"FORBID_ATTR")?I({},h.FORBID_ATTR,K):ge({}),Xe=oe(h,"USE_PROFILES")?h.USE_PROFILES:!1,Pi=h.ALLOW_ARIA_ATTR!==!1,Kn=h.ALLOW_DATA_ATTR!==!1,Ni=h.ALLOW_UNKNOWN_PROTOCOLS||!1,Oi=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Je=h.SAFE_FOR_TEMPLATES||!1,Kt=h.SAFE_FOR_XML!==!1,Ne=h.WHOLE_DOCUMENT||!1,Ze=h.RETURN_DOM||!1,zt=h.RETURN_DOM_FRAGMENT||!1,Ht=h.RETURN_TRUSTED_TYPE||!1,Hn=h.FORCE_BODY||!1,Di=h.SANITIZE_DOM!==!1,Bi=h.SANITIZE_NAMED_PROPS||!1,jn=h.KEEP_CONTENT!==!1,gt=h.IN_PLACE||!1,Mi=h.ALLOWED_URI_REGEXP||br,et=h.NAMESPACE||ye,Wt=h.MATHML_TEXT_INTEGRATION_POINTS||Wt,qt=h.HTML_INTEGRATION_POINTS||qt,F=h.CUSTOM_ELEMENT_HANDLING||{},h.CUSTOM_ELEMENT_HANDLING&&zi(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(F.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&zi(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(F.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(F.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Je&&(Kn=!1),zt&&(Ze=!0),Xe&&(z=I({},Pa),j=[],Xe.html===!0&&(I(z,La),I(j,Na)),Xe.svg===!0&&(I(z,hs),I(j,ms),I(j,Xt)),Xe.svgFilters===!0&&(I(z,fs),I(j,ms),I(j,Xt)),Xe.mathMl===!0&&(I(z,gs),I(j,Oa),I(j,Xt))),h.ADD_TAGS&&(typeof h.ADD_TAGS=="function"?Qe.tagCheck=h.ADD_TAGS:(z===Ii&&(z=ge(z)),I(z,h.ADD_TAGS,K))),h.ADD_ATTR&&(typeof h.ADD_ATTR=="function"?Qe.attributeCheck=h.ADD_ATTR:(j===Li&&(j=ge(j)),I(j,h.ADD_ATTR,K))),h.ADD_URI_SAFE_ATTR&&I(Wn,h.ADD_URI_SAFE_ATTR,K),h.FORBID_CONTENTS&&(pe===Vn&&(pe=ge(pe)),I(pe,h.FORBID_CONTENTS,K)),h.ADD_FORBID_CONTENTS&&(pe===Vn&&(pe=ge(pe)),I(pe,h.ADD_FORBID_CONTENTS,K)),jn&&(z["#text"]=!0),Ne&&I(z,["html","head","body"]),z.table&&(I(z,["tbody"]),delete ft.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw $t('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $t('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=h.TRUSTED_TYPES_POLICY,C=R.createHTML("")}else R===void 0&&(R=Wu(m,i)),R!==null&&typeof C=="string"&&(C=R.createHTML(""));Z&&Z(h),tt=h}},Hi=I({},[...hs,...fs,...Nu]),ji=I({},[...gs,...Ou]),ul=function(h){let x=N(h);(!x||!x.tagName)&&(x={namespaceURI:et,tagName:"template"});const A=on(h.tagName),B=on(x.tagName);return Gn[h.namespaceURI]?h.namespaceURI===Vt?x.namespaceURI===ye?A==="svg":x.namespaceURI===jt?A==="svg"&&(B==="annotation-xml"||Wt[B]):!!Hi[A]:h.namespaceURI===jt?x.namespaceURI===ye?A==="math":x.namespaceURI===Vt?A==="math"&&qt[B]:!!ji[A]:h.namespaceURI===ye?x.namespaceURI===Vt&&!qt[B]||x.namespaceURI===jt&&!Wt[B]?!1:!ji[A]&&(rl[A]||!Hi[A]):!!(mt==="application/xhtml+xml"&&Gn[h.namespaceURI]):!1},he=function(h){bt(t.removed,{element:h});try{N(h).removeChild(h)}catch{k(h)}},Oe=function(h,x){try{bt(t.removed,{attribute:x.getAttributeNode(h),from:x})}catch{bt(t.removed,{attribute:null,from:x})}if(x.removeAttribute(h),h==="is")if(Ze||zt)try{he(x)}catch{}else try{x.setAttribute(h,"")}catch{}},Vi=function(h){let x=null,A=null;if(Hn)h="<remove></remove>"+h;else{const U=ps(h,/^[\r\n\t ]+/);A=U&&U[0]}mt==="application/xhtml+xml"&&et===ye&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const B=R?R.createHTML(h):h;if(et===ye)try{x=new f().parseFromString(B,mt)}catch{}if(!x||!x.documentElement){x=E.createDocument(et,"template",null);try{x.documentElement.innerHTML=qn?C:B}catch{}}const W=x.body||x.documentElement;return h&&A&&W.insertBefore(n.createTextNode(A),W.childNodes[0]||null),et===ye?On.call(x,Ne?"html":"body")[0]:Ne?x.documentElement:W},Wi=function(h){return ve.call(h.ownerDocument||h,h,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Qn=function(h){return h instanceof p&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof d)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},qi=function(h){return typeof c=="function"&&h instanceof c};function be(T,h,x){Zt(T,A=>{A.call(t,h,x,tt)})}const Gi=function(h){let x=null;if(be(Y.beforeSanitizeElements,h,null),Qn(h))return he(h),!0;const A=K(h.nodeName);if(be(Y.uponSanitizeElement,h,{tagName:A,allowedTags:z}),Kt&&h.hasChildNodes()&&!qi(h.firstElementChild)&&Q(/<[/\w!]/g,h.innerHTML)&&Q(/<[/\w!]/g,h.textContent)||h.nodeType===kt.progressingInstruction||Kt&&h.nodeType===kt.comment&&Q(/<[/\w]/g,h.data))return he(h),!0;if(!(Qe.tagCheck instanceof Function&&Qe.tagCheck(A))&&(!z[A]||ft[A])){if(!ft[A]&&Qi(A)&&(F.tagNameCheck instanceof RegExp&&Q(F.tagNameCheck,A)||F.tagNameCheck instanceof Function&&F.tagNameCheck(A)))return!1;if(jn&&!pe[A]){const B=N(h)||h.parentNode,W=M(h)||h.childNodes;if(W&&B){const U=W.length;for(let ee=U-1;ee>=0;--ee){const we=$(W[ee],!0);we.__removalCount=(h.__removalCount||0)+1,B.insertBefore(we,_(h))}}}return he(h),!0}return h instanceof l&&!ul(h)||(A==="noscript"||A==="noembed"||A==="noframes")&&Q(/<\/no(script|embed|frames)/i,h.innerHTML)?(he(h),!0):(Je&&h.nodeType===kt.text&&(x=h.textContent,Zt([Dn,Bn,Fn],B=>{x=wt(x,B," ")}),h.textContent!==x&&(bt(t.removed,{element:h.cloneNode()}),h.textContent=x)),be(Y.afterSanitizeElements,h,null),!1)},Yi=function(h,x,A){if(Di&&(x==="id"||x==="name")&&(A in n||A in dl))return!1;if(!(Kn&&!Un[x]&&Q(tl,x))){if(!(Pi&&Q(nl,x))){if(!(Qe.attributeCheck instanceof Function&&Qe.attributeCheck(x,h))){if(!j[x]||Un[x]){if(!(Qi(h)&&(F.tagNameCheck instanceof RegExp&&Q(F.tagNameCheck,h)||F.tagNameCheck instanceof Function&&F.tagNameCheck(h))&&(F.attributeNameCheck instanceof RegExp&&Q(F.attributeNameCheck,x)||F.attributeNameCheck instanceof Function&&F.attributeNameCheck(x,h))||x==="is"&&F.allowCustomizedBuiltInElements&&(F.tagNameCheck instanceof RegExp&&Q(F.tagNameCheck,A)||F.tagNameCheck instanceof Function&&F.tagNameCheck(A))))return!1}else if(!Wn[x]){if(!Q(Mi,wt(A,Ri,""))){if(!((x==="src"||x==="xlink:href"||x==="href")&&h!=="script"&&Mu(A,"data:")===0&&Fi[h])){if(!(Ni&&!Q(sl,wt(A,Ri,"")))){if(A)return!1}}}}}}}return!0},Qi=function(h){return h!=="annotation-xml"&&ps(h,il)},Ji=function(h){be(Y.beforeSanitizeAttributes,h,null);const{attributes:x}=h;if(!x||Qn(h))return;const A={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let B=x.length;for(;B--;){const W=x[B],{name:U,namespaceURI:ee,value:we}=W,nt=K(U),Jn=we;let V=U==="value"?Jn:Iu(Jn);if(A.attrName=nt,A.attrValue=V,A.keepAttr=!0,A.forceKeepAttr=void 0,be(Y.uponSanitizeAttribute,h,A),V=A.attrValue,Bi&&(nt==="id"||nt==="name")&&(Oe(U,h),V=al+V),Kt&&Q(/((--!?|])>)|<\/(style|title|textarea)/i,V)){Oe(U,h);continue}if(nt==="attributename"&&ps(V,"href")){Oe(U,h);continue}if(A.forceKeepAttr)continue;if(!A.keepAttr){Oe(U,h);continue}if(!Oi&&Q(/\/>/i,V)){Oe(U,h);continue}Je&&Zt([Dn,Bn,Fn],Xi=>{V=wt(V,Xi," ")});const Zi=K(h.nodeName);if(!Yi(Zi,nt,V)){Oe(U,h);continue}if(R&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!ee)switch(m.getAttributeType(Zi,nt)){case"TrustedHTML":{V=R.createHTML(V);break}case"TrustedScriptURL":{V=R.createScriptURL(V);break}}if(V!==Jn)try{ee?h.setAttributeNS(ee,U,V):h.setAttribute(U,V),Qn(h)?he(h):Ia(t.removed)}catch{Oe(U,h)}}be(Y.afterSanitizeAttributes,h,null)},pl=function T(h){let x=null;const A=Wi(h);for(be(Y.beforeSanitizeShadowDOM,h,null);x=A.nextNode();)be(Y.uponSanitizeShadowNode,x,null),Gi(x),Ji(x),x.content instanceof a&&T(x.content);be(Y.afterSanitizeShadowDOM,h,null)};return t.sanitize=function(T){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,A=null,B=null,W=null;if(qn=!T,qn&&(T="<!-->"),typeof T!="string"&&!qi(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw $t("dirty is not a string, aborting")}else throw $t("toString is not a function");if(!t.isSupported)return T;if(zn||Yn(h),t.removed=[],typeof T=="string"&&(gt=!1),gt){if(T.nodeName){const we=K(T.nodeName);if(!z[we]||ft[we])throw $t("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof c)x=Vi("<!---->"),A=x.ownerDocument.importNode(T,!0),A.nodeType===kt.element&&A.nodeName==="BODY"||A.nodeName==="HTML"?x=A:x.appendChild(A);else{if(!Ze&&!Je&&!Ne&&T.indexOf("<")===-1)return R&&Ht?R.createHTML(T):T;if(x=Vi(T),!x)return Ze?null:Ht?C:""}x&&Hn&&he(x.firstChild);const U=Wi(gt?T:x);for(;B=U.nextNode();)Gi(B),Ji(B),B.content instanceof a&&pl(B.content);if(gt)return T;if(Ze){if(zt)for(W=Nn.call(x.ownerDocument);x.firstChild;)W.appendChild(x.firstChild);else W=x;return(j.shadowroot||j.shadowrootmode)&&(W=el.call(s,W,!0)),W}let ee=Ne?x.outerHTML:x.innerHTML;return Ne&&z["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&Q(wr,x.ownerDocument.doctype.name)&&(ee="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
30
|
-
`+
|
|
31
|
-
]`).replace("lheading",
|
|
15
|
+
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`poolbot-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function rc(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}function De(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function tt(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
16
|
+
`}function vo(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],c=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof c=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const l=s;l[o]==null&&(l[o]=typeof c=="number"?[]:{}),s=l[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function mo(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function ye(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});cc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function yo(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});lc(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function lc(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function cc(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?tt(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=tt(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=De(t.config??{}),e.configFormOriginal=De(t.config??{}),e.configRawOriginal=n)}async function hs(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?tt(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await ye(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function dc(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?tt(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.apply",{raw:t,baseHash:n,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await ye(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function uc(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 Ft(e,t,n){const s=De(e.configForm??e.configSnapshot?.config??{});vo(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=tt(s))}function sa(e,t){const n=De(e.configForm??e.configSnapshot?.config??{});mo(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=tt(n))}async function Tt(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function hn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function pc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=Jt(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function hc(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=Jt(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function fc(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=pc(e.cronForm),n=hc(e.cronForm),s=e.cronForm.agentId.trim(),i={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!i.name)throw new Error("Name required.");await e.client.request("cron.add",i),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await hn(e),await Tt(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function gc(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 hn(e),await Tt(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function vc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await bo(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function mc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await hn(e),await Tt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function bo(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function oe(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function yc(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 bc(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 wc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}async function fn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function $c(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 xc=2e3,kc=new Set(["trace","debug","info","warn","error","fatal"]);function Ac(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 Sc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return kc.has(t)?t:null}function _c(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=Sc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=Ac(a);let c=null;o&&(typeof o.subsystem=="string"?c=o.subsystem:typeof o.module=="string"&&(c=o.module)),!c&&a&&a.length<120&&(c=a);let l=null;return typeof t[1]=="string"?l=t[1]:!o&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:s,level:i,subsystem:c,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Fs(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(c=>typeof c=="string"):[]).map(_c),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-xc),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}const wo={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:V,n:Wt,Gx:ia,Gy:aa,a:qn,d:Vn,h:Cc}=wo,Be=32,Us=64,Tc=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},H=(e="")=>{const t=new Error(e);throw Tc(t,H),t},Ec=e=>typeof e=="bigint",Lc=e=>typeof e=="string",Mc=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",_e=(e,t,n="")=>{const s=Mc(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,c=a?` of length ${t}`:"",l=s?`length=${i}`:`type=${typeof e}`;H(o+"expected Uint8Array"+c+", got "+l)}return e},gn=e=>new Uint8Array(e),$o=e=>Uint8Array.from(e),xo=(e,t)=>e.toString(16).padStart(t,"0"),ko=e=>Array.from(_e(e)).map(t=>xo(t,2)).join(""),ve={_0:48,_9:57,A:65,F:70,a:97,f:102},oa=e=>{if(e>=ve._0&&e<=ve._9)return e-ve._0;if(e>=ve.A&&e<=ve.F)return e-(ve.A-10);if(e>=ve.a&&e<=ve.f)return e-(ve.a-10)},Ao=e=>{const t="hex invalid";if(!Lc(e))return H(t);const n=e.length,s=n/2;if(n%2)return H(t);const i=gn(s);for(let a=0,o=0;a<s;a++,o+=2){const c=oa(e.charCodeAt(o)),l=oa(e.charCodeAt(o+1));if(c===void 0||l===void 0)return H(t);i[a]=c*16+l}return i},So=()=>globalThis?.crypto,Rc=()=>So()?.subtle??H("crypto.subtle must be defined, consider polyfill"),_t=(...e)=>{const t=gn(e.reduce((s,i)=>s+_e(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},Ic=(e=Be)=>So().getRandomValues(gn(e)),Zt=BigInt,Ie=(e,t,n,s="bad number: out of range")=>Ec(e)&&t<=e&&e<n?e:H(s),A=(e,t=V)=>{const n=e%t;return n>=0n?n:t+n},_o=e=>A(e,Wt),Pc=(e,t)=>{(e===0n||t<=0n)&&H("no inverse n="+e+" mod="+t);let n=A(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,c=s%n,l=i-a*o;s=n,n=c,i=a,a=l}return s===1n?A(i,t):H("no inverse")},Nc=e=>{const t=Lo[e];return typeof t!="function"&&H("hashes."+e+" not set"),t},Wn=e=>e instanceof ee?e:H("Point expected"),fs=2n**256n;class ee{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=fs;this.X=Ie(t,0n,a),this.Y=Ie(n,0n,a),this.Z=Ie(s,1n,a),this.T=Ie(i,0n,a),Object.freeze(this)}static CURVE(){return wo}static fromAffine(t){return new ee(t.x,t.y,1n,A(t.x*t.y))}static fromBytes(t,n=!1){const s=Vn,i=$o(_e(t,Be)),a=t[31];i[31]=a&-129;const o=To(i);Ie(o,0n,n?fs:V);const l=A(o*o),p=A(l-1n),d=A(s*l+1n);let{isValid:u,value:g}=Dc(p,d);u||H("bad point: y not sqrt");const v=(g&1n)===1n,w=(a&128)!==0;return!n&&g===0n&&w&&H("bad point: x==0, isLastByteOdd"),w!==v&&(g=A(-g)),new ee(g,o,1n,A(g*o))}static fromHex(t,n){return ee.fromBytes(Ao(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=qn,n=Vn,s=this;if(s.is0())return H("bad point: ZERO");const{X:i,Y:a,Z:o,T:c}=s,l=A(i*i),p=A(a*a),d=A(o*o),u=A(d*d),g=A(l*t),v=A(d*A(g+p)),w=A(u+A(n*A(l*p)));if(v!==w)return H("bad point: equation left != right (1)");const $=A(i*a),k=A(o*c);return $!==k?H("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:c}=Wn(t),l=A(n*c),p=A(a*i),d=A(s*c),u=A(o*i);return l===p&&d===u}is0(){return this.equals(Je)}negate(){return new ee(A(-this.X),this.Y,this.Z,A(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=qn,a=A(t*t),o=A(n*n),c=A(2n*A(s*s)),l=A(i*a),p=t+n,d=A(A(p*p)-a-o),u=l+o,g=u-c,v=l-o,w=A(d*g),$=A(u*v),k=A(d*v),_=A(g*u);return new ee(w,$,_,k)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:c,Z:l,T:p}=Wn(t),d=qn,u=Vn,g=A(n*o),v=A(s*c),w=A(a*u*p),$=A(i*l),k=A((n+s)*(o+c)-g-v),_=A($-w),M=A($+w),P=A(v-d*g),L=A(k*_),T=A(M*P),E=A(k*P),pe=A(_*M);return new ee(L,T,pe,E)}subtract(t){return this.add(Wn(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Je;if(Ie(t,1n,Wt),t===1n)return this;if(this.equals(Fe))return Gc(t).p;let s=Je,i=Fe;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(Je))return{x:0n,y:1n};const i=Pc(s,V);A(s*i)!==1n&&H("invalid inverse");const a=A(t*i),o=A(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Co(n);return s[31]|=t&1n?128:0,s}toHex(){return ko(this.toBytes())}clearCofactor(){return this.multiply(Zt(Cc),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Wt/2n,!1).double();return Wt%2n&&(t=t.add(this)),t.is0()}}const Fe=new ee(ia,aa,1n,A(ia*aa)),Je=new ee(0n,1n,1n,0n);ee.BASE=Fe;ee.ZERO=Je;const Co=e=>Ao(xo(Ie(e,0n,fs),Us)).reverse(),To=e=>Zt("0x"+ko($o(_e(e)).reverse())),ce=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=V;return n},Oc=e=>{const n=e*e%V*e%V,s=ce(n,2n)*n%V,i=ce(s,1n)*e%V,a=ce(i,5n)*i%V,o=ce(a,10n)*a%V,c=ce(o,20n)*o%V,l=ce(c,40n)*c%V,p=ce(l,80n)*l%V,d=ce(p,80n)*l%V,u=ce(d,10n)*a%V;return{pow_p_5_8:ce(u,2n)*e%V,b2:n}},ra=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Dc=(e,t)=>{const n=A(t*t*t),s=A(n*n*t),i=Oc(e*s).pow_p_5_8;let a=A(e*n*i);const o=A(t*a*a),c=a,l=A(a*ra),p=o===e,d=o===A(-e),u=o===A(-e*ra);return p&&(a=c),(d||u)&&(a=l),(A(a)&1n)===1n&&(a=A(-a)),{isValid:p||d,value:a}},gs=e=>_o(To(e)),Ks=(...e)=>Lo.sha512Async(_t(...e)),Bc=(...e)=>Nc("sha512")(_t(...e)),Eo=e=>{const t=e.slice(0,Be);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Be,Us),s=gs(t),i=Fe.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Hs=e=>Ks(_e(e,Be)).then(Eo),Fc=e=>Eo(Bc(_e(e,Be))),Uc=e=>Hs(e).then(t=>t.pointBytes),Kc=e=>Ks(e.hashable).then(e.finish),Hc=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=gs(t),o=Fe.multiply(a).toBytes();return{hashable:_t(o,s,n),finish:p=>{const d=_o(a+gs(p)*i);return _e(_t(o,Co(d)),Us)}}},zc=async(e,t)=>{const n=_e(e),s=await Hs(t),i=await Ks(s.prefix,n);return Kc(Hc(s,i,n))},Lo={sha512Async:async e=>{const t=Rc(),n=_t(e);return gn(await t.digest("SHA-512",n.buffer))},sha512:void 0},jc=(e=Ic(Be))=>e,qc={getExtendedPublicKeyAsync:Hs,getExtendedPublicKey:Fc,randomSecretKey:jc},Xt=8,Vc=256,Mo=Math.ceil(Vc/Xt)+1,vs=2**(Xt-1),Wc=()=>{const e=[];let t=Fe,n=t;for(let s=0;s<Mo;s++){n=t,e.push(n);for(let i=1;i<vs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let la;const ca=(e,t)=>{const n=t.negate();return e?n:t},Gc=e=>{const t=la||(la=Wc());let n=Je,s=Fe;const i=2**Xt,a=i,o=Zt(i-1),c=Zt(Xt);for(let l=0;l<Mo;l++){let p=Number(e&o);e>>=c,p>vs&&(p-=a,e+=1n);const d=l*vs,u=d,g=d+Math.abs(p)-1,v=l%2!==0,w=p<0;p===0?s=s.add(ca(v,t[u])):n=n.add(ca(w,t[g]))}return e!==0n&&H("invalid wnaf"),{p:n,f:s}},Gn="poolbot-device-identity-v1";function ms(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Ro(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Yc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Io(e){const t=await crypto.subtle.digest("SHA-256",e);return Yc(new Uint8Array(t))}async function Qc(){const e=qc.randomSecretKey(),t=await Uc(e);return{deviceId:await Io(t),publicKey:ms(t),privateKey:ms(e)}}async function zs(){try{const n=localStorage.getItem(Gn);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 Io(Ro(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Gn,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Qc(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Gn,JSON.stringify(t)),e}async function Jc(e,t){const n=Ro(e),s=new TextEncoder().encode(t),i=await zc(s,n);return ms(i)}const Po="poolbot.device.auth.v1";function js(e){return e.trim()}function Zc(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].sort()}function qs(){try{const e=window.localStorage.getItem(Po);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 No(e){try{window.localStorage.setItem(Po,JSON.stringify(e))}catch{}}function Xc(e){const t=qs();if(!t||t.deviceId!==e.deviceId)return null;const n=js(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Oo(e){const t=js(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=qs();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:Zc(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,No(n),i}function Do(e){const t=qs();if(!t||t.deviceId!==e.deviceId)return;const n=js(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],No(s)}async function Ce(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function ed(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Ce(e)}catch(n){e.devicesError=String(n)}}async function td(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Ce(e)}catch(s){e.devicesError=String(s)}}async function nd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await zs(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Oo({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Ce(e)}catch(n){e.devicesError=String(n)}}async function sd(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 zs();t.deviceId===s.deviceId&&Do({deviceId:s.deviceId,role:t.role}),await Ce(e)}catch(s){e.devicesError=String(s)}}async function vn(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 id(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 ad(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 Vs(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=id(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);od(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function od(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=De(t.file??{}))}async function rd(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=ad(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 Vs(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function ld(e,t,n){const s=De(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});vo(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function cd(e,t){const n=De(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});mo(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Ws(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function nt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function mn(e){return e instanceof Error?e.message:String(e)}async function Et(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=mn(n)}finally{e.skillsLoading=!1}}}function dd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function ud(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 Et(e),nt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=mn(s);e.skillsError=i,nt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function pd(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 Et(e),nt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=mn(n);e.skillsError=s,nt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function hd(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 Et(e),nt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=mn(i);e.skillsError=a,nt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}function fd(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Gs(e){return e==="system"?fd():e}const Ut=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,gd=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Kt=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},vd=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,c=gd();if(!!o.startViewTransition&&!c){let p=.5,d=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")p=Ut(n.pointerClientX/window.innerWidth),d=Ut(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(p=Ut((u.left+u.width/2)/window.innerWidth),d=Ut((u.top+u.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${p*100}%`),a.style.setProperty("--theme-switch-y",`${d*100}%`),a.classList.add("theme-transition");try{const u=o.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>Kt(a)):Kt(a)}catch{Kt(a),t()}return}t(),Kt(a)};function md(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{vn(e,{quiet:!0})},5e3))}function yd(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Ys(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Fs(e,{quiet:!0})},2e3))}function Qs(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Js(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&fn(e)},3e3))}function Zs(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function ke(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,Al(n),t.theme!==e.theme&&(e.theme=t.theme,yn(e,Gs(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Bo(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&ke(e,{...e.settings,lastActiveSessionKey:n})}function bd(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),a=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&ke(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(s!=null){const l=s.trim();l&&(e.password=l),t.delete("password"),o=!0}if(i!=null){const l=i.trim();l&&(e.sessionKey=l,ke(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(a!=null){const l=a.trim();l&&l!==e.settings.gatewayUrl&&ke(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),o=!0}if(!o)return;const c=new URL(window.location.href);c.search=t.toString(),window.history.replaceState({},"",c.toString())}function wd(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ys(e):Qs(e),t==="debug"?Js(e):Zs(e),Xs(e),Uo(e,t,!1)}function $d(e,t,n){vd({nextTheme:t,applyTheme:()=>{e.theme=t,ke(e,{...e.settings,theme:t}),yn(e,Gs(t))},context:n,currentTheme:e.theme})}async function Xs(e){e.tab==="overview"&&await Ko(e),e.tab==="channels"&&await Ed(e),e.tab==="instances"&&await Ws(e),e.tab==="sessions"&&await it(e),e.tab==="cron"&&await ei(e),e.tab==="skills"&&await Et(e),e.tab==="nodes"&&(await vn(e),await Ce(e),await ye(e),await Vs(e)),e.tab==="chat"&&(await Pd(e),pn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await yo(e),await ye(e)),e.tab==="debug"&&(await fn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Fs(e,{reset:!0}),go(e,!0))}function xd(){if(typeof window>"u")return"";const e=window.__CLAWDBOT_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ln(e):_l(window.location.pathname)}function kd(e){e.theme=e.settings.theme??"system",yn(e,Gs(e.theme))}function yn(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Ad(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"&&yn(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Sd(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function _d(e,t){if(typeof window>"u")return;const n=po(window.location.pathname,e.basePath)??"chat";Fo(e,n),Uo(e,n,t)}function Cd(e){if(typeof window>"u")return;const t=po(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,ke(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Fo(e,t)}function Fo(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ys(e):Qs(e),t==="debug"?Js(e):Zs(e),e.connected&&Xs(e)}function Uo(e,t,n){if(typeof window>"u")return;const s=At(cn(t,e.basePath)),i=At(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function Td(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 Ko(e){await Promise.all([oe(e,!1),Ws(e),it(e),Tt(e),fn(e)])}async function Ed(e){await Promise.all([oe(e,!0),yo(e),ye(e)])}async function ei(e){await Promise.all([oe(e,!1),Tt(e),hn(e)])}function Ho(e){return e.chatSending||!!e.chatRunId}function Ld(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}async function zo(e){e.connected&&(e.chatMessage="",await zl(e))}function Md(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Bs(),text:s,createdAt:Date.now(),attachments:i?n?.map(a=>({...a})):void 0}])}async function jo(e,t,n){un(e);const s=await Hl(e,t,n?.attachments);return!s&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!s&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),s&&Bo(e,e.sessionKey),s&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),s&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),pn(e),s&&!e.chatRunId&&qo(e),s}async function qo(e){if(!e.connected||Ho(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await jo(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Rd(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Id(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],c=o.length>0;if(!(!i&&!c)){if(Ld(i)){await zo(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Ho(e)){Md(e,i,o);return}await jo(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:c?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft)})}}async function Pd(e){await Promise.all([et(e),it(e),ys(e)]),pn(e,!0)}const Nd=qo;function Od(e){const t=lo(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Dd(e,t){const n=ln(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function ys(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Od(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Dd(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const Vo={CHILD:2},Wo=e=>(...t)=>({_$litDirective$:e,values:t});let Go=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:Bd}=hl,da=e=>e,ua=()=>document.createComment(""),ct=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(ua(),i),o=s.insertBefore(ua(),i);n=new Bd(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,c=o!==e;if(c){let l;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(l=e._$AU)!==o._$AU&&n._$AP(l)}if(a!==i||c){let l=n._$AA;for(;l!==a;){const p=da(l).nextSibling;da(s).insertBefore(l,i),l=p}}}return n},Me=(e,t,n=e)=>(e._$AI(t,n),e),Fd={},Ud=(e,t=Fd)=>e._$AH=t,Kd=e=>e._$AH,Yn=e=>{e._$AR(),e._$AA.remove()};const pa=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Yo=Wo(class extends Go{constructor(e){if(super(e),e.type!==Vo.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const c of e)i[o]=s?s(c,o):o,a[o]=n(c,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Kd(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const c=this.ut??=[],l=[];let p,d,u=0,g=i.length-1,v=0,w=a.length-1;for(;u<=g&&v<=w;)if(i[u]===null)u++;else if(i[g]===null)g--;else if(c[u]===o[v])l[v]=Me(i[u],a[v]),u++,v++;else if(c[g]===o[w])l[w]=Me(i[g],a[w]),g--,w--;else if(c[u]===o[w])l[w]=Me(i[u],a[w]),ct(e,l[w+1],i[u]),u++,w--;else if(c[g]===o[v])l[v]=Me(i[g],a[v]),ct(e,i[u],i[g]),g--,v++;else if(p===void 0&&(p=pa(o,v,w),d=pa(c,u,g)),p.has(c[u]))if(p.has(c[g])){const $=d.get(o[v]),k=$!==void 0?i[$]:null;if(k===null){const _=ct(e,i[u]);Me(_,a[v]),l[v]=_}else l[v]=Me(k,a[v]),ct(e,i[u],k),i[$]=null;v++}else Yn(i[g]),g--;else Yn(i[u]),u++;for(;v<=w;){const $=ct(e,l[w+1]);Me($,a[v]),l[v++]=$}for(;u<=g;){const $=i[u++];$!==null&&Yn($)}return this.ut=o,Ud(e,l),Se}});function Qo(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(u=>{const v=String(u.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),c=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||c)&&(n="toolResult");let l=[];typeof t.content=="string"?l=[{type:"text",text:t.content}]:Array.isArray(t.content)?l=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(l=[{type:"text",text:t.text}]);const p=typeof t.timestamp=="number"?t.timestamp:Date.now(),d=typeof t.id=="string"?t.id:void 0;return{role:n,content:l,timestamp:p,id:d}}function ti(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 Jo(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}class bs extends Go{constructor(t){if(super(t),this.it=f,t.type!==Vo.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===f||t==null)return this._t=void 0,this.it=t;if(t===Se)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}bs.directiveName="unsafeHTML",bs.resultType=1;const ws=Wo(bs);const{entries:Zo,setPrototypeOf:ha,isFrozen:Hd,getPrototypeOf:zd,getOwnPropertyDescriptor:jd}=Object;let{freeze:J,seal:ne,create:$s}=Object,{apply:xs,construct:ks}=typeof Reflect<"u"&&Reflect;J||(J=function(t){return t});ne||(ne=function(t){return t});xs||(xs=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});ks||(ks=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 Ht=Z(Array.prototype.forEach),qd=Z(Array.prototype.lastIndexOf),fa=Z(Array.prototype.pop),dt=Z(Array.prototype.push),Vd=Z(Array.prototype.splice),Gt=Z(String.prototype.toLowerCase),Qn=Z(String.prototype.toString),Jn=Z(String.prototype.match),ut=Z(String.prototype.replace),Wd=Z(String.prototype.indexOf),Gd=Z(String.prototype.trim),se=Z(Object.prototype.hasOwnProperty),Y=Z(RegExp.prototype.test),pt=Yd(TypeError);function Z(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 xs(e,t,s)}}function Yd(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return ks(e,n)}}function R(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Gt;ha&&ha(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(Hd(t)||(t[s]=a),i=a)}e[i]=!0}return e}function Qd(e){for(let t=0;t<e.length;t++)se(e,t)||(e[t]=null);return e}function de(e){const t=$s(null);for(const[n,s]of Zo(e))se(e,n)&&(Array.isArray(s)?t[n]=Qd(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=de(s):t[n]=s);return t}function ht(e,t){for(;e!==null;){const s=jd(e,t);if(s){if(s.get)return Z(s.get);if(typeof s.value=="function")return Z(s.value)}e=zd(e)}function n(){return null}return n}const ga=J(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Zn=J(["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"]),Xn=J(["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"]),Jd=J(["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"]),es=J(["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"]),Zd=J(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),va=J(["#text"]),ma=J(["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"]),ts=J(["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"]),ya=J(["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"]),zt=J(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Xd=ne(/\{\{[\w\W]*|[\w\W]*\}\}/gm),eu=ne(/<%[\w\W]*|[\w\W]*%>/gm),tu=ne(/\$\{[\w\W]*/gm),nu=ne(/^data-[\-\w.\u00B7-\uFFFF]+$/),su=ne(/^aria-[\-\w]+$/),Xo=ne(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),iu=ne(/^(?:\w+script|data):/i),au=ne(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),er=ne(/^html$/i),ou=ne(/^[a-z][.\w]*(-[.\w]+)+$/i);var ba=Object.freeze({__proto__:null,ARIA_ATTR:su,ATTR_WHITESPACE:au,CUSTOM_ELEMENT:ou,DATA_ATTR:nu,DOCTYPE_NAME:er,ERB_EXPR:eu,IS_ALLOWED_URI:Xo,IS_SCRIPT_OR_DATA:iu,MUSTACHE_EXPR:Xd,TMPLIT_EXPR:tu});const ft={element:1,text:3,progressingInstruction:7,comment:8,document:9},ru=function(){return typeof window>"u"?null:window},lu=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},wa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function tr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ru();const t=C=>tr(C);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==ft.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:c,Element:l,NodeFilter:p,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:v}=e,w=l.prototype,$=ht(w,"cloneNode"),k=ht(w,"remove"),_=ht(w,"nextSibling"),M=ht(w,"childNodes"),P=ht(w,"parentNode");if(typeof o=="function"){const C=n.createElement("template");C.content&&C.content.ownerDocument&&(n=C.content.ownerDocument)}let L,T="";const{implementation:E,createNodeIterator:pe,createDocumentFragment:kn,getElementsByTagName:An}=n,{importNode:Pr}=s;let G=wa();t.isSupported=typeof Zo=="function"&&typeof P=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Sn,ERB_EXPR:_n,TMPLIT_EXPR:Cn,DATA_ATTR:Nr,ARIA_ATTR:Or,IS_SCRIPT_OR_DATA:Dr,ATTR_WHITESPACE:hi,CUSTOM_ELEMENT:Br}=ba;let{IS_ALLOWED_URI:fi}=ba,K=null;const gi=R({},[...ga,...Zn,...Xn,...es,...va]);let z=null;const vi=R({},[...ma,...ts,...ya,...zt]);let B=Object.seal($s(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}})),at=null,Tn=null;const He=Object.seal($s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let mi=!0,En=!0,yi=!1,bi=!0,ze=!1,Mt=!0,Te=!1,Ln=!1,Mn=!1,je=!1,Rt=!1,It=!1,wi=!0,$i=!1;const Fr="user-content-";let Rn=!0,ot=!1,qe={},re=null;const In=R({},["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 xi=null;const ki=R({},["audio","video","img","source","image","track"]);let Pn=null;const Ai=R({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pt="http://www.w3.org/1998/Math/MathML",Nt="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml";let Ve=he,Nn=!1,On=null;const Ur=R({},[Pt,Nt,he],Qn);let Ot=R({},["mi","mo","mn","ms","mtext"]),Dt=R({},["annotation-xml"]);const Kr=R({},["title","style","font","a","script"]);let rt=null;const Hr=["application/xhtml+xml","text/html"],zr="text/html";let U=null,We=null;const jr=n.createElement("form"),Si=function(h){return h instanceof RegExp||h instanceof Function},Dn=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(We&&We===h)){if((!h||typeof h!="object")&&(h={}),h=de(h),rt=Hr.indexOf(h.PARSER_MEDIA_TYPE)===-1?zr:h.PARSER_MEDIA_TYPE,U=rt==="application/xhtml+xml"?Qn:Gt,K=se(h,"ALLOWED_TAGS")?R({},h.ALLOWED_TAGS,U):gi,z=se(h,"ALLOWED_ATTR")?R({},h.ALLOWED_ATTR,U):vi,On=se(h,"ALLOWED_NAMESPACES")?R({},h.ALLOWED_NAMESPACES,Qn):Ur,Pn=se(h,"ADD_URI_SAFE_ATTR")?R(de(Ai),h.ADD_URI_SAFE_ATTR,U):Ai,xi=se(h,"ADD_DATA_URI_TAGS")?R(de(ki),h.ADD_DATA_URI_TAGS,U):ki,re=se(h,"FORBID_CONTENTS")?R({},h.FORBID_CONTENTS,U):In,at=se(h,"FORBID_TAGS")?R({},h.FORBID_TAGS,U):de({}),Tn=se(h,"FORBID_ATTR")?R({},h.FORBID_ATTR,U):de({}),qe=se(h,"USE_PROFILES")?h.USE_PROFILES:!1,mi=h.ALLOW_ARIA_ATTR!==!1,En=h.ALLOW_DATA_ATTR!==!1,yi=h.ALLOW_UNKNOWN_PROTOCOLS||!1,bi=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=h.SAFE_FOR_TEMPLATES||!1,Mt=h.SAFE_FOR_XML!==!1,Te=h.WHOLE_DOCUMENT||!1,je=h.RETURN_DOM||!1,Rt=h.RETURN_DOM_FRAGMENT||!1,It=h.RETURN_TRUSTED_TYPE||!1,Mn=h.FORCE_BODY||!1,wi=h.SANITIZE_DOM!==!1,$i=h.SANITIZE_NAMED_PROPS||!1,Rn=h.KEEP_CONTENT!==!1,ot=h.IN_PLACE||!1,fi=h.ALLOWED_URI_REGEXP||Xo,Ve=h.NAMESPACE||he,Ot=h.MATHML_TEXT_INTEGRATION_POINTS||Ot,Dt=h.HTML_INTEGRATION_POINTS||Dt,B=h.CUSTOM_ELEMENT_HANDLING||{},h.CUSTOM_ELEMENT_HANDLING&&Si(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&Si(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(B.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ze&&(En=!1),Rt&&(je=!0),qe&&(K=R({},va),z=[],qe.html===!0&&(R(K,ga),R(z,ma)),qe.svg===!0&&(R(K,Zn),R(z,ts),R(z,zt)),qe.svgFilters===!0&&(R(K,Xn),R(z,ts),R(z,zt)),qe.mathMl===!0&&(R(K,es),R(z,ya),R(z,zt))),h.ADD_TAGS&&(typeof h.ADD_TAGS=="function"?He.tagCheck=h.ADD_TAGS:(K===gi&&(K=de(K)),R(K,h.ADD_TAGS,U))),h.ADD_ATTR&&(typeof h.ADD_ATTR=="function"?He.attributeCheck=h.ADD_ATTR:(z===vi&&(z=de(z)),R(z,h.ADD_ATTR,U))),h.ADD_URI_SAFE_ATTR&&R(Pn,h.ADD_URI_SAFE_ATTR,U),h.FORBID_CONTENTS&&(re===In&&(re=de(re)),R(re,h.FORBID_CONTENTS,U)),h.ADD_FORBID_CONTENTS&&(re===In&&(re=de(re)),R(re,h.ADD_FORBID_CONTENTS,U)),Rn&&(K["#text"]=!0),Te&&R(K,["html","head","body"]),K.table&&(R(K,["tbody"]),delete at.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw pt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw pt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=h.TRUSTED_TYPES_POLICY,T=L.createHTML("")}else L===void 0&&(L=lu(v,i)),L!==null&&typeof T=="string"&&(T=L.createHTML(""));J&&J(h),We=h}},_i=R({},[...Zn,...Xn,...Jd]),Ci=R({},[...es,...Zd]),qr=function(h){let x=P(h);(!x||!x.tagName)&&(x={namespaceURI:Ve,tagName:"template"});const S=Gt(h.tagName),D=Gt(x.tagName);return On[h.namespaceURI]?h.namespaceURI===Nt?x.namespaceURI===he?S==="svg":x.namespaceURI===Pt?S==="svg"&&(D==="annotation-xml"||Ot[D]):!!_i[S]:h.namespaceURI===Pt?x.namespaceURI===he?S==="math":x.namespaceURI===Nt?S==="math"&&Dt[D]:!!Ci[S]:h.namespaceURI===he?x.namespaceURI===Nt&&!Dt[D]||x.namespaceURI===Pt&&!Ot[D]?!1:!Ci[S]&&(Kr[S]||!_i[S]):!!(rt==="application/xhtml+xml"&&On[h.namespaceURI]):!1},le=function(h){dt(t.removed,{element:h});try{P(h).removeChild(h)}catch{k(h)}},Ee=function(h,x){try{dt(t.removed,{attribute:x.getAttributeNode(h),from:x})}catch{dt(t.removed,{attribute:null,from:x})}if(x.removeAttribute(h),h==="is")if(je||Rt)try{le(x)}catch{}else try{x.setAttribute(h,"")}catch{}},Ti=function(h){let x=null,S=null;if(Mn)h="<remove></remove>"+h;else{const F=Jn(h,/^[\r\n\t ]+/);S=F&&F[0]}rt==="application/xhtml+xml"&&Ve===he&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const D=L?L.createHTML(h):h;if(Ve===he)try{x=new g().parseFromString(D,rt)}catch{}if(!x||!x.documentElement){x=E.createDocument(Ve,"template",null);try{x.documentElement.innerHTML=Nn?T:D}catch{}}const q=x.body||x.documentElement;return h&&S&&q.insertBefore(n.createTextNode(S),q.childNodes[0]||null),Ve===he?An.call(x,Te?"html":"body")[0]:Te?x.documentElement:q},Ei=function(h){return pe.call(h.ownerDocument||h,h,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Bn=function(h){return h instanceof u&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof d)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},Li=function(h){return typeof c=="function"&&h instanceof c};function fe(C,h,x){Ht(C,S=>{S.call(t,h,x,We)})}const Mi=function(h){let x=null;if(fe(G.beforeSanitizeElements,h,null),Bn(h))return le(h),!0;const S=U(h.nodeName);if(fe(G.uponSanitizeElement,h,{tagName:S,allowedTags:K}),Mt&&h.hasChildNodes()&&!Li(h.firstElementChild)&&Y(/<[/\w!]/g,h.innerHTML)&&Y(/<[/\w!]/g,h.textContent)||h.nodeType===ft.progressingInstruction||Mt&&h.nodeType===ft.comment&&Y(/<[/\w]/g,h.data))return le(h),!0;if(!(He.tagCheck instanceof Function&&He.tagCheck(S))&&(!K[S]||at[S])){if(!at[S]&&Ii(S)&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,S)||B.tagNameCheck instanceof Function&&B.tagNameCheck(S)))return!1;if(Rn&&!re[S]){const D=P(h)||h.parentNode,q=M(h)||h.childNodes;if(q&&D){const F=q.length;for(let X=F-1;X>=0;--X){const ge=$(q[X],!0);ge.__removalCount=(h.__removalCount||0)+1,D.insertBefore(ge,_(h))}}}return le(h),!0}return h instanceof l&&!qr(h)||(S==="noscript"||S==="noembed"||S==="noframes")&&Y(/<\/no(script|embed|frames)/i,h.innerHTML)?(le(h),!0):(ze&&h.nodeType===ft.text&&(x=h.textContent,Ht([Sn,_n,Cn],D=>{x=ut(x,D," ")}),h.textContent!==x&&(dt(t.removed,{element:h.cloneNode()}),h.textContent=x)),fe(G.afterSanitizeElements,h,null),!1)},Ri=function(h,x,S){if(wi&&(x==="id"||x==="name")&&(S in n||S in jr))return!1;if(!(En&&!Tn[x]&&Y(Nr,x))){if(!(mi&&Y(Or,x))){if(!(He.attributeCheck instanceof Function&&He.attributeCheck(x,h))){if(!z[x]||Tn[x]){if(!(Ii(h)&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,h)||B.tagNameCheck instanceof Function&&B.tagNameCheck(h))&&(B.attributeNameCheck instanceof RegExp&&Y(B.attributeNameCheck,x)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(x,h))||x==="is"&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,S)||B.tagNameCheck instanceof Function&&B.tagNameCheck(S))))return!1}else if(!Pn[x]){if(!Y(fi,ut(S,hi,""))){if(!((x==="src"||x==="xlink:href"||x==="href")&&h!=="script"&&Wd(S,"data:")===0&&xi[h])){if(!(yi&&!Y(Dr,ut(S,hi,"")))){if(S)return!1}}}}}}}return!0},Ii=function(h){return h!=="annotation-xml"&&Jn(h,Br)},Pi=function(h){fe(G.beforeSanitizeAttributes,h,null);const{attributes:x}=h;if(!x||Bn(h))return;const S={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let D=x.length;for(;D--;){const q=x[D],{name:F,namespaceURI:X,value:ge}=q,Ge=U(F),Fn=ge;let j=F==="value"?Fn:Gd(Fn);if(S.attrName=Ge,S.attrValue=j,S.keepAttr=!0,S.forceKeepAttr=void 0,fe(G.uponSanitizeAttribute,h,S),j=S.attrValue,$i&&(Ge==="id"||Ge==="name")&&(Ee(F,h),j=Fr+j),Mt&&Y(/((--!?|])>)|<\/(style|title|textarea)/i,j)){Ee(F,h);continue}if(Ge==="attributename"&&Jn(j,"href")){Ee(F,h);continue}if(S.forceKeepAttr)continue;if(!S.keepAttr){Ee(F,h);continue}if(!bi&&Y(/\/>/i,j)){Ee(F,h);continue}ze&&Ht([Sn,_n,Cn],Oi=>{j=ut(j,Oi," ")});const Ni=U(h.nodeName);if(!Ri(Ni,Ge,j)){Ee(F,h);continue}if(L&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!X)switch(v.getAttributeType(Ni,Ge)){case"TrustedHTML":{j=L.createHTML(j);break}case"TrustedScriptURL":{j=L.createScriptURL(j);break}}if(j!==Fn)try{X?h.setAttributeNS(X,F,j):h.setAttribute(F,j),Bn(h)?le(h):fa(t.removed)}catch{Ee(F,h)}}fe(G.afterSanitizeAttributes,h,null)},Vr=function C(h){let x=null;const S=Ei(h);for(fe(G.beforeSanitizeShadowDOM,h,null);x=S.nextNode();)fe(G.uponSanitizeShadowNode,x,null),Mi(x),Pi(x),x.content instanceof a&&C(x.content);fe(G.afterSanitizeShadowDOM,h,null)};return t.sanitize=function(C){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,S=null,D=null,q=null;if(Nn=!C,Nn&&(C="<!-->"),typeof C!="string"&&!Li(C))if(typeof C.toString=="function"){if(C=C.toString(),typeof C!="string")throw pt("dirty is not a string, aborting")}else throw pt("toString is not a function");if(!t.isSupported)return C;if(Ln||Dn(h),t.removed=[],typeof C=="string"&&(ot=!1),ot){if(C.nodeName){const ge=U(C.nodeName);if(!K[ge]||at[ge])throw pt("root node is forbidden and cannot be sanitized in-place")}}else if(C instanceof c)x=Ti("<!---->"),S=x.ownerDocument.importNode(C,!0),S.nodeType===ft.element&&S.nodeName==="BODY"||S.nodeName==="HTML"?x=S:x.appendChild(S);else{if(!je&&!ze&&!Te&&C.indexOf("<")===-1)return L&&It?L.createHTML(C):C;if(x=Ti(C),!x)return je?null:It?T:""}x&&Mn&&le(x.firstChild);const F=Ei(ot?C:x);for(;D=F.nextNode();)Mi(D),Pi(D),D.content instanceof a&&Vr(D.content);if(ot)return C;if(je){if(Rt)for(q=kn.call(x.ownerDocument);x.firstChild;)q.appendChild(x.firstChild);else q=x;return(z.shadowroot||z.shadowrootmode)&&(q=Pr.call(s,q,!0)),q}let X=Te?x.outerHTML:x.innerHTML;return Te&&K["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&Y(er,x.ownerDocument.doctype.name)&&(X="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
17
|
+
`+X),ze&&Ht([Sn,_n,Cn],ge=>{X=ut(X,ge," ")}),L&&It?L.createHTML(X):X},t.setConfig=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Dn(C),Ln=!0},t.clearConfig=function(){We=null,Ln=!1},t.isValidAttribute=function(C,h,x){We||Dn({});const S=U(C),D=U(h);return Ri(S,D,x)},t.addHook=function(C,h){typeof h=="function"&&dt(G[C],h)},t.removeHook=function(C,h){if(h!==void 0){const x=qd(G[C],h);return x===-1?void 0:Vd(G[C],x,1)[0]}return fa(G[C])},t.removeHooks=function(C){G[C]=[]},t.removeAllHooks=function(){G=wa()},t}var As=tr();function ni(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ke=ni();function nr(e){Ke=e}var wt={exec:()=>null};function I(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(Q.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var cu=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Q={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},du=/^(?:[ \t]*(?:\n|$))+/,uu=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,pu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Lt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,hu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,si=/(?:[*+-]|\d{1,9}[.)])/,sr=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ir=I(sr).replace(/bull/g,si).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(),fu=I(sr).replace(/bull/g,si).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(),ii=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,gu=/^[^\n]+/,ai=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,vu=I(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ai).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),mu=I(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,si).getRegex(),bn="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",oi=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,yu=I("^ {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",oi).replace("tag",bn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ar=I(ii).replace("hr",Lt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bn).getRegex(),bu=I(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ar).getRegex(),ri={blockquote:bu,code:uu,def:vu,fences:pu,heading:hu,hr:Lt,html:yu,lheading:ir,list:mu,newline:du,paragraph:ar,table:wt,text:gu},$a=I("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Lt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bn).getRegex(),wu={...ri,lheading:fu,table:$a,paragraph:I(ii).replace("hr",Lt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$a).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bn).getRegex()},$u={...ri,html:I(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",oi).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:wt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:I(ii).replace("hr",Lt).replace("heading",` *#{1,6} *[^
|
|
18
|
+
]`).replace("lheading",ir).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xu=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ku=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,or=/^( {2,}|\\)\n(?!\s*$)/,Au=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,wn=/[\p{P}\p{S}]/u,li=/[\s\p{P}\p{S}]/u,rr=/[^\s\p{P}\p{S}]/u,Su=I(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,li).getRegex(),lr=/(?!~)[\p{P}\p{S}]/u,_u=/(?!~)[\s\p{P}\p{S}]/u,Cu=/(?:[^\s\p{P}\p{S}]|~)/u,Tu=I(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",cu?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),cr=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Eu=I(cr,"u").replace(/punct/g,wn).getRegex(),Lu=I(cr,"u").replace(/punct/g,lr).getRegex(),dr="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Mu=I(dr,"gu").replace(/notPunctSpace/g,rr).replace(/punctSpace/g,li).replace(/punct/g,wn).getRegex(),Ru=I(dr,"gu").replace(/notPunctSpace/g,Cu).replace(/punctSpace/g,_u).replace(/punct/g,lr).getRegex(),Iu=I("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,rr).replace(/punctSpace/g,li).replace(/punct/g,wn).getRegex(),Pu=I(/\\(punct)/,"gu").replace(/punct/g,wn).getRegex(),Nu=I(/^<(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(),Ou=I(oi).replace("(?:-->|$)","-->").getRegex(),Du=I("^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",Ou).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),en=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Bu=I(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",en).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ur=I(/^!?\[(label)\]\[(ref)\]/).replace("label",en).replace("ref",ai).getRegex(),pr=I(/^!?\[(ref)\](?:\[\])?/).replace("ref",ai).getRegex(),Fu=I("reflink|nolink(?!\\()","g").replace("reflink",ur).replace("nolink",pr).getRegex(),xa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ci={_backpedal:wt,anyPunctuation:Pu,autolink:Nu,blockSkip:Tu,br:or,code:ku,del:wt,emStrongLDelim:Eu,emStrongRDelimAst:Mu,emStrongRDelimUnd:Iu,escape:xu,link:Bu,nolink:pr,punctuation:Su,reflink:ur,reflinkSearch:Fu,tag:Du,text:Au,url:wt},Uu={...ci,link:I(/^!?\[(label)\]\((.*?)\)/).replace("label",en).getRegex(),reflink:I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",en).getRegex()},Ss={...ci,emStrongRDelimAst:Ru,emStrongLDelim:Lu,url:I(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",xa).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:I(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",xa).getRegex()},Ku={...Ss,br:I(or).replace("{2,}","*").getRegex(),text:I(Ss.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},jt={normal:ri,gfm:wu,pedantic:$u},gt={normal:ci,gfm:Ss,breaks:Ku,pedantic:Uu},Hu={"&":"&","<":"<",">":">",'"':""","'":"'"},ka=e=>Hu[e];function me(e,t){if(t){if(Q.escapeTest.test(e))return e.replace(Q.escapeReplace,ka)}else if(Q.escapeTestNoEncode.test(e))return e.replace(Q.escapeReplaceNoEncode,ka);return e}function Aa(e){try{e=encodeURI(e).replace(Q.percentDecode,"%")}catch{return null}return e}function Sa(e,t){let n=e.replace(Q.findPipe,(a,o,c)=>{let l=!1,p=o;for(;--p>=0&&c[p]==="\\";)l=!l;return l?"|":" |"}),s=n.split(Q.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(Q.slashPipe,"|");return s}function vt(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 zu(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 _a(e,t,n,s,i){let a=t.href,o=t.title||null,c=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:c,tokens:s.inlineTokens(c)};return s.state.inLink=!1,l}function ju(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
|
|
32
19
|
`).map(a=>{let o=a.match(n.other.beginningSpace);if(o===null)return a;let[c]=o;return c.length>=i.length?a.slice(i.length):a}).join(`
|
|
33
|
-
`)}var
|
|
34
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=
|
|
35
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=
|
|
20
|
+
`)}var tn=class{options;rules;lexer;constructor(e){this.options=e||Ke}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:vt(n,`
|
|
21
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=ju(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=vt(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:vt(t[0],`
|
|
22
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=vt(t[0],`
|
|
36
23
|
`).split(`
|
|
37
|
-
`),s="",i="",a=[];for(;n.length>0;){let o=!1,c=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))c.push(n[l]),o=!0;else if(!o)c.push(n[l]);else break;n=n.slice(l);let
|
|
38
|
-
`),d=
|
|
24
|
+
`),s="",i="",a=[];for(;n.length>0;){let o=!1,c=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))c.push(n[l]),o=!0;else if(!o)c.push(n[l]);else break;n=n.slice(l);let p=c.join(`
|
|
25
|
+
`),d=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
39
26
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
40
|
-
${
|
|
41
|
-
${d}`:d;let
|
|
27
|
+
${p}`:p,i=i?`${i}
|
|
28
|
+
${d}`:d;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,a,!0),this.lexer.state.top=u,n.length===0)break;let g=a.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let v=g,w=v.raw+`
|
|
42
29
|
`+n.join(`
|
|
43
|
-
`),$=this.blockquote(
|
|
30
|
+
`),$=this.blockquote(w);a[a.length-1]=$,s=s.substring(0,s.length-v.raw.length)+$.raw,i=i.substring(0,i.length-v.text.length)+$.text;break}else if(g?.type==="list"){let v=g,w=v.raw+`
|
|
44
31
|
`+n.join(`
|
|
45
|
-
`),$=this.list(
|
|
46
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let l=!1,
|
|
47
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,$=>" ".repeat(3*$.length)),
|
|
48
|
-
`,1)[0],
|
|
49
|
-
`,e=e.substring(
|
|
50
|
-
`,1)[0],
|
|
51
|
-
`+
|
|
52
|
-
`+
|
|
53
|
-
`,e=e.substring(
|
|
54
|
-
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(
|
|
55
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=
|
|
56
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(
|
|
32
|
+
`),$=this.list(w);a[a.length-1]=$,s=s.substring(0,s.length-g.raw.length)+$.raw,i=i.substring(0,i.length-v.raw.length)+$.raw,n=w.substring(a.at(-1).raw.length).split(`
|
|
33
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let l=!1,p="",d="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let u=t[2].split(`
|
|
34
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,$=>" ".repeat(3*$.length)),g=e.split(`
|
|
35
|
+
`,1)[0],v=!u.trim(),w=0;if(this.options.pedantic?(w=2,d=u.trimStart()):v?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,d=u.slice(w),w+=t[1].length),v&&this.rules.other.blankLine.test(g)&&(p+=g+`
|
|
36
|
+
`,e=e.substring(g.length+1),l=!0),!l){let $=this.rules.other.nextBulletRegex(w),k=this.rules.other.hrRegex(w),_=this.rules.other.fencesBeginRegex(w),M=this.rules.other.headingBeginRegex(w),P=this.rules.other.htmlBeginRegex(w);for(;e;){let L=e.split(`
|
|
37
|
+
`,1)[0],T;if(g=L,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),T=g):T=g.replace(this.rules.other.tabCharGlobal," "),_.test(g)||M.test(g)||P.test(g)||$.test(g)||k.test(g))break;if(T.search(this.rules.other.nonSpaceChar)>=w||!g.trim())d+=`
|
|
38
|
+
`+T.slice(w);else{if(v||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(u)||M.test(u)||k.test(u))break;d+=`
|
|
39
|
+
`+g}!v&&!g.trim()&&(v=!0),p+=L+`
|
|
40
|
+
`,e=e.substring(L.length+1),u=T.slice(w)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(o=!0)),i.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),i.raw+=p}let c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=d.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=d.raw+l.tokens[0].raw,l.tokens[0].text=d.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(d)):l.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):l.tokens.unshift(d)}}if(!i.loose){let p=l.tokens.filter(u=>u.type==="space"),d=p.length>0&&p.some(u=>this.rules.other.anyLine.test(u.raw));i.loose=d}}if(i.loose)for(let l of i.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Sa(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
41
|
+
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(Sa(o,a.header.length).map((c,l)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:a.align[l]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
42
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=vt(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=zu(t[2],"()");if(a===-2)return;if(a>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),_a(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return _a(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,c=i,l=0,p=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+i);(s=p.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){c+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+l);let d=[...s[0]][0].length,u=e.slice(0,i+s.index+d+o);if(Math.min(i,o)%2){let v=u.slice(1,-1);return{type:"em",raw:u,text:v,tokens:this.lexer.inlineTokens(v)}}let g=u.slice(2,-2);return{type:"strong",raw:u,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},ie=class _s{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ke,this.options.tokenizer=this.options.tokenizer||new tn,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:Q,block:jt.normal,inline:gt.normal};this.options.pedantic?(n.block=jt.pedantic,n.inline=gt.pedantic):this.options.gfm&&(n.block=jt.gfm,this.options.breaks?n.inline=gt.breaks:n.inline=gt.gfm),this.tokenizer.rules=n}static get rules(){return{block:jt,inline:gt}}static lex(t,n){return new _s(n).lex(t)}static lexInline(t,n){return new _s(n).inlineTokens(t)}lex(t){t=t.replace(Q.carriageReturn,`
|
|
43
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(Q.tabCharGlobal," ").replace(Q.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
57
44
|
`:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
58
45
|
`)?"":`
|
|
59
46
|
`)+i.raw,o.text+=`
|
|
60
47
|
`+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
61
48
|
`)?"":`
|
|
62
49
|
`)+i.raw,o.text+=`
|
|
63
|
-
`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),n.push(i);continue}let a=t;if(this.options.extensions?.startBlock){let o=1/0,c=t.slice(1),l;this.options.extensions.startBlock.forEach(
|
|
50
|
+
`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),n.push(i);continue}let a=t;if(this.options.extensions?.startBlock){let o=1/0,c=t.slice(1),l;this.options.extensions.startBlock.forEach(p=>{l=p.call({lexer:this},c),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(a=t.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let o=n.at(-1);s&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
64
51
|
`)?"":`
|
|
65
52
|
`)+i.raw,o.text+=`
|
|
66
53
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),s=a.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
67
54
|
`)?"":`
|
|
68
55
|
`)+i.raw,o.text+=`
|
|
69
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)a=i[2]?i[2].length:0,s=s.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,c="";for(;t;){o||(c=""),o=!1;let l;if(this.options.extensions?.inline?.some(d=>(l=d.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let d=n.at(-1);l.type==="text"&&d?.type==="text"?(d.raw+=l.raw,d.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(t,s,c)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),n.push(l);continue}let
|
|
70
|
-
`;return s?'<pre><code class="language-'+
|
|
71
|
-
`:"<pre><code>"+(n?i:
|
|
56
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)a=i[2]?i[2].length:0,s=s.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,c="";for(;t;){o||(c=""),o=!1;let l;if(this.options.extensions?.inline?.some(d=>(l=d.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let d=n.at(-1);l.type==="text"&&d?.type==="text"?(d.raw+=l.raw,d.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(t,s,c)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),n.push(l);continue}let p=t;if(this.options.extensions?.startInline){let d=1/0,u=t.slice(1),g;this.options.extensions.startInline.forEach(v=>{g=v.call({lexer:this},u),typeof g=="number"&&g>=0&&(d=Math.min(d,g))}),d<1/0&&d>=0&&(p=t.substring(0,d+1))}if(l=this.tokenizer.inlineText(p)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(c=l.raw.slice(-1)),o=!0;let d=n.at(-1);d?.type==="text"?(d.raw+=l.raw,d.text+=l.text):n.push(l);continue}if(t){let d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}},nn=class{options;parser;constructor(e){this.options=e||Ke}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(Q.notSpaceStart)?.[0],i=e.replace(Q.endingNewline,"")+`
|
|
57
|
+
`;return s?'<pre><code class="language-'+me(s)+'">'+(n?i:me(i,!0))+`</code></pre>
|
|
58
|
+
`:"<pre><code>"+(n?i:me(i,!0))+`</code></pre>
|
|
72
59
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
73
60
|
${this.parser.parse(e)}</blockquote>
|
|
74
61
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
@@ -84,36 +71,36 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
84
71
|
`}tablerow({text:e}){return`<tr>
|
|
85
72
|
${e}</tr>
|
|
86
73
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
87
|
-
`}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>${
|
|
88
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+
|
|
74
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${me(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=Aa(e);if(i===null)return s;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+me(t)+'"'),a+=">"+s+"</a>",a}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Aa(e);if(i===null)return me(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${me(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:me(e.text)}},di=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}},ae=class Cs{options;renderer;textRenderer;constructor(t){this.options=t||Ke,this.options.renderer=this.options.renderer||new nn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new di}static parse(t,n){return new Cs(n).parse(t)}static parseInline(t,n){return new Cs(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=c||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=c||"";continue}}let o=a;switch(o.type){case"escape":{s+=n.text(o);break}case"html":{s+=n.html(o);break}case"link":{s+=n.link(o);break}case"image":{s+=n.image(o);break}case"checkbox":{s+=n.checkbox(o);break}case"strong":{s+=n.strong(o);break}case"em":{s+=n.em(o);break}case"codespan":{s+=n.codespan(o);break}case"br":{s+=n.br(o);break}case"del":{s+=n.del(o);break}case"text":{s+=n.text(o);break}default:{let c='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}},mt=class{options;block;constructor(e){this.options=e||Ke}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?ie.lex:ie.lexInline}provideParser(){return this.block?ae.parse:ae.parseInline}},qu=class{defaults=ni();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ae;Renderer=nn;TextRenderer=di;Lexer=ie;Tokenizer=tn;Hooks=mt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...o){let c=i.renderer.apply(this,o);return c===!1&&(c=a.apply(this,o)),c}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new nn(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,c=n.renderer[o],l=i[o];i[o]=(...p)=>{let d=c.apply(i,p);return d===!1&&(d=l.apply(i,p)),d||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new tn(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,c=n.tokenizer[o],l=i[o];i[o]=(...p)=>{let d=c.apply(i,p);return d===!1&&(d=l.apply(i,p)),d}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new mt;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,c=n.hooks[o],l=i[o];mt.passThroughHooks.has(a)?i[o]=p=>{if(this.defaults.async&&mt.passThroughHooksRespectAsync.has(a))return(async()=>{let u=await c.call(i,p);return l.call(i,u)})();let d=c.call(i,p);return l.call(i,d)}:i[o]=(...p)=>{if(this.defaults.async)return(async()=>{let u=await c.apply(i,p);return u===!1&&(u=await l.apply(i,p)),u})();let d=c.apply(i,p);return d===!1&&(d=l.apply(i,p)),d}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let c=[];return c.push(a.call(this,o)),i&&(c=c.concat(i.call(this,o))),c}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ie.lex(e,t??this.defaults)}parser(e,t){return ae.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(t):t,c=await(i.hooks?await i.hooks.provideLexer():e?ie.lex:ie.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(c):c;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let p=await(i.hooks?await i.hooks.provideParser():e?ae.parse:ae.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(p):p})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?ie.lex:ie.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let c=(i.hooks?i.hooks.provideParser():e?ae.parse:ae.parseInline)(o,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
75
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+me(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},Ue=new qu;function N(e,t){return Ue.parse(e,t)}N.options=N.setOptions=function(e){return Ue.setOptions(e),N.defaults=Ue.defaults,nr(N.defaults),N};N.getDefaults=ni;N.defaults=Ke;N.use=function(...e){return Ue.use(...e),N.defaults=Ue.defaults,nr(N.defaults),N};N.walkTokens=function(e,t){return Ue.walkTokens(e,t)};N.parseInline=Ue.parseInline;N.Parser=ae;N.parser=ae.parse;N.Renderer=nn;N.TextRenderer=di;N.Lexer=ie;N.lexer=ie.lex;N.Tokenizer=tn;N.Hooks=mt;N.parse=N;N.options;N.setOptions;N.use;N.walkTokens;N.parseInline;ae.parse;ie.lex;N.setOptions({gfm:!0,breaks:!0,mangle:!1});const Ca=["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"],Ta=["class","href","rel","target","title","start"];let Ea=!1;const Vu=14e4,Wu=4e4,Gu=200,ns=5e4,Ne=new Map;function Yu(e){const t=Ne.get(e);return t===void 0?null:(Ne.delete(e),Ne.set(e,t),t)}function La(e,t){if(Ne.set(e,t),Ne.size<=Gu)return;const n=Ne.keys().next().value;n&&Ne.delete(n)}function Qu(){Ea||(Ea=!0,As.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function Ts(e){const t=e.trim();if(!t)return"";if(Qu(),t.length<=ns){const o=Yu(t);if(o!==null)return o}const n=ho(t,Vu),s=n.truncated?`
|
|
89
76
|
|
|
90
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>
|
|
77
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>Wu){const c=`<pre class="code-block">${Ju(`${n.text}${s}`)}</pre>`,l=As.sanitize(c,{ALLOWED_TAGS:Ca,ALLOWED_ATTR:Ta});return t.length<=ns&&La(t,l),l}const i=N.parse(`${n.text}${s}`),a=As.sanitize(i,{ALLOWED_TAGS:Ca,ALLOWED_ATTR:Ta});return t.length<=ns&&La(t,a),a}function Ju(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Zu=1500,Xu=2e3,hr="Copy as markdown",ep="Copied",tp="Copy failed";async function np(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function qt(e,t){e.title=t,e.setAttribute("aria-label",t)}function sp(e){const t=e.label??hr;return r`
|
|
91
78
|
<button
|
|
92
79
|
class="chat-copy-btn"
|
|
93
80
|
type="button"
|
|
94
81
|
title=${t}
|
|
95
82
|
aria-label=${t}
|
|
96
|
-
@click=${async n=>{const s=n.currentTarget;if(s?.querySelector(".chat-copy-btn__icon"),!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await
|
|
83
|
+
@click=${async n=>{const s=n.currentTarget;if(s?.querySelector(".chat-copy-btn__icon"),!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await np(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",qt(s,tp),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,qt(s,t))},Xu);return}s.dataset.copied="1",qt(s,ep),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,qt(s,t))},Zu)}}}
|
|
97
84
|
>
|
|
98
85
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
99
|
-
<span class="chat-copy-btn__icon-copy">${
|
|
100
|
-
<span class="chat-copy-btn__icon-check">${
|
|
86
|
+
<span class="chat-copy-btn__icon-copy">${W.copy}</span>
|
|
87
|
+
<span class="chat-copy-btn__icon-check">${W.check}</span>
|
|
101
88
|
</span>
|
|
102
89
|
</button>
|
|
103
|
-
`}function
|
|
104
|
-
`),n=t.slice(0,
|
|
105
|
-
`);return s.length>
|
|
90
|
+
`}function ip(e){return sp({text:()=>e,label:hr})}const ap={icon:"puzzle",emoji:"⚡",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},op={bash:{icon:"wrench",emoji:"💻",title:"Bash",detailKeys:["command"]},process:{icon:"wrench",emoji:"⚙️",title:"Process",detailKeys:["sessionId"]},read:{icon:"fileText",emoji:"📖",title:"Read",detailKeys:["path"]},write:{icon:"edit",emoji:"✍️",title:"Write",detailKeys:["path"]},edit:{icon:"penLine",emoji:"✏️",title:"Edit",detailKeys:["path"]},attach:{icon:"paperclip",emoji:"📎",title:"Attach",detailKeys:["path","url","fileName"]},browser:{icon:"globe",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:{icon:"image",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:{icon:"smartphone",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:{icon:"loader",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:{icon:"plug",emoji:"🔌",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]},"config.get":{label:"config get"},"config.schema":{label:"config schema"},"config.apply":{label:"config apply",detailKeys:["restartDelayMs"]},"update.run":{label:"update run",detailKeys:["restartDelayMs"]}}},whatsapp_login:{icon:"circle",emoji:"💬",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{icon:"messageSquare",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"]}}},slack:{icon:"messageSquare",emoji:"🟣",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"}}}},rp={fallback:ap,tools:op},fr=rp,ss=fr.fallback??{icon:"puzzle"},lp=fr.tools??{};function cp(e){return(e??"tool").trim()}function dp(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 up(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function gr(e){if(e!=null){if(typeof e=="string"){const t=e.trim();if(!t)return;const n=t.split(/\r?\n/)[0]?.trim()??"";return n?n.length>160?`${n.slice(0,157)}…`:n:void 0}if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const t=e.map(s=>gr(s)).filter(s=>!!s);if(t.length===0)return;const n=t.slice(0,3).join(", ");return t.length>3?`${n}…`:n}}}function pp(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 hp(e,t){for(const n of t){const s=pp(e,n),i=gr(s);if(i)return i}}function fp(e){if(!e||typeof e!="object")return;const t=e,n=typeof t.path=="string"?t.path:void 0;if(!n)return;const s=typeof t.offset=="number"?t.offset:void 0,i=typeof t.limit=="number"?t.limit:void 0;return s!==void 0&&i!==void 0?`${n}:${s}-${s+i}`:n}function gp(e){if(!e||typeof e!="object")return;const t=e;return typeof t.path=="string"?t.path:void 0}function vp(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function vr(e){const t=cp(e.name),n=t.toLowerCase(),s=lp[n],i=s?.icon??ss.icon??"puzzle",a=s?.emoji??ss.emoji??"⚡",o=s?.title??dp(t),c=s?.label??t,l=e.args&&typeof e.args=="object"?e.args.action:void 0,p=typeof l=="string"?l.trim():void 0,d=vp(s,p),u=up(d?.label??p);let g;n==="read"&&(g=fp(e.args)),!g&&(n==="write"||n==="edit"||n==="attach")&&(g=gp(e.args));const v=d?.detailKeys??s?.detailKeys??ss.detailKeys??[];return!g&&v.length>0&&(g=hp(e.args,v)),!g&&e.meta&&(g=e.meta),g&&(g=mp(g)),{name:t,icon:i,emoji:a,title:o,label:c,verb:u,detail:g}}function mr(e){const t=[];if(e.verb&&t.push(e.verb),e.detail&&t.push(e.detail),t.length!==0)return t.join(" · ")}function mp(e){return e&&e.replace(/\/Users\/[^/]+/g,"~").replace(/\/home\/[^/]+/g,"~")}const yp=80,bp=2,Ma=100;function wp(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 $p(e){const t=e.split(`
|
|
91
|
+
`),n=t.slice(0,bp),s=n.join(`
|
|
92
|
+
`);return s.length>Ma?s.slice(0,Ma)+"…":n.length<t.length?s+"…":s}function xp(e,t){const n=vr({name:e.name,args:e.args}),s=n.emoji??"⚡",i=mr(n),a=t?.status?`chat-activity-item--${t.status}`:"",o=t?.duration!=null?`${(t.duration/1e3).toFixed(1)}s`:"",c=t?.status==="running"?"◌":t?.status==="error"?"✕":"┊";return r`
|
|
106
93
|
<div class="chat-activity-item ${a}">
|
|
107
94
|
<span class="chat-activity-prefix">${c}</span>
|
|
108
95
|
<span class="chat-activity-emoji">${s}</span>
|
|
109
96
|
<span class="chat-activity-name">${n.label}</span>
|
|
110
|
-
${i?r`<span class="chat-activity-detail">${i}</span>`:
|
|
111
|
-
${o?r`<span class="chat-activity-duration">${o}</span>`:
|
|
112
|
-
${t?.status==="success"?r`<span class="chat-activity-check">✓</span>`:
|
|
97
|
+
${i?r`<span class="chat-activity-detail">${i}</span>`:f}
|
|
98
|
+
${o?r`<span class="chat-activity-duration">${o}</span>`:f}
|
|
99
|
+
${t?.status==="success"?r`<span class="chat-activity-check">✓</span>`:f}
|
|
113
100
|
</div>
|
|
114
|
-
`}function
|
|
101
|
+
`}function kp(e,t){if(e.length===0)return f;const n=3,s=e.length>n+2;return r`
|
|
115
102
|
<div class="${s?"chat-activity-feed chat-activity-feed--collapsed":"chat-activity-feed"}">
|
|
116
|
-
${e.map(a=>
|
|
103
|
+
${e.map(a=>xp(a,{status:"success"}))}
|
|
117
104
|
${s?r`
|
|
118
105
|
<button
|
|
119
106
|
class="chat-activity-expand"
|
|
@@ -121,36 +108,36 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
|
|
|
121
108
|
>
|
|
122
109
|
┊ +${e.length-n} more
|
|
123
110
|
</button>
|
|
124
|
-
`:
|
|
111
|
+
`:f}
|
|
125
112
|
</div>
|
|
126
|
-
`}function
|
|
113
|
+
`}function Ap(e){const t=e,n=Sp(t.content),s=[];for(const i of n){const a=String(i.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(a)||typeof i.name=="string"&&i.arguments!=null)&&s.push({kind:"call",name:i.name??"tool",args:_p(i.arguments??i.args)})}for(const i of n){const a=String(i.type??"").toLowerCase();if(a!=="toolresult"&&a!=="tool_result")continue;const o=Cp(i),c=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:c,text:o})}if(Jo(e)&&!s.some(i=>i.kind==="result")){const i=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",a=fo(e)??void 0;s.push({kind:"result",name:i,text:a})}return s}function Ra(e,t){const n=vr({name:e.name,args:e.args}),s=mr(n),i=!!e.text?.trim(),a=!!t,o=a?()=>{if(i){t(wp(e.text));return}const u=`## ${n.label}
|
|
127
114
|
|
|
128
115
|
${s?`**Command:** \`${s}\`
|
|
129
116
|
|
|
130
|
-
`:""}*No output — tool completed successfully.*`;t(
|
|
117
|
+
`:""}*No output — tool completed successfully.*`;t(u)}:void 0,c=i&&(e.text?.length??0)<=yp,l=i&&!c,p=i&&c,d=!i;return r`
|
|
131
118
|
<div
|
|
132
119
|
class="chat-tool-card ${a?"chat-tool-card--clickable":""}"
|
|
133
120
|
@click=${o}
|
|
134
|
-
role=${a?"button":
|
|
135
|
-
tabindex=${a?"0":
|
|
136
|
-
@keydown=${a?
|
|
121
|
+
role=${a?"button":f}
|
|
122
|
+
tabindex=${a?"0":f}
|
|
123
|
+
@keydown=${a?u=>{u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),o?.())}:f}
|
|
137
124
|
>
|
|
138
125
|
<div class="chat-tool-card__header">
|
|
139
126
|
<div class="chat-tool-card__title">
|
|
140
|
-
<span class="chat-tool-card__icon">${
|
|
127
|
+
<span class="chat-tool-card__icon">${W[n.icon]}</span>
|
|
141
128
|
<span>${n.label}</span>
|
|
142
129
|
</div>
|
|
143
|
-
${a?r`<span class="chat-tool-card__action">${i?"View":""} ${
|
|
144
|
-
${d&&!a?r`<span class="chat-tool-card__status">${
|
|
130
|
+
${a?r`<span class="chat-tool-card__action">${i?"View":""} ${W.check}</span>`:f}
|
|
131
|
+
${d&&!a?r`<span class="chat-tool-card__status">${W.check}</span>`:f}
|
|
145
132
|
</div>
|
|
146
|
-
${s?r`<div class="chat-tool-card__detail">${s}</div>`:
|
|
147
|
-
${d?r`<div class="chat-tool-card__status-text muted">Completed</div>`:
|
|
148
|
-
${l?r`<div class="chat-tool-card__preview mono">${
|
|
149
|
-
${
|
|
133
|
+
${s?r`<div class="chat-tool-card__detail">${s}</div>`:f}
|
|
134
|
+
${d?r`<div class="chat-tool-card__status-text muted">Completed</div>`:f}
|
|
135
|
+
${l?r`<div class="chat-tool-card__preview mono">${$p(e.text)}</div>`:f}
|
|
136
|
+
${p?r`<div class="chat-tool-card__inline mono">${e.text}</div>`:f}
|
|
150
137
|
</div>
|
|
151
|
-
`}function
|
|
138
|
+
`}function Sp(e){return Array.isArray(e)?e.filter(Boolean):[]}function _p(e){if(typeof e!="string")return e;const t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(t)}catch{return e}}function Cp(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}const Ia=["thinking","analyzing","processing","pondering","musing","considering","reasoning","reflecting","examining","investigating","exploring","deliberating"];let Pa=0;function Tp(){const e=Ia[Pa%Ia.length];return Pa++,e}function Ep(e){const n=e.content,s=[];if(Array.isArray(n))for(const i of n){if(typeof i!="object"||i===null)continue;const a=i;if(a.type==="image"){const o=a.source;if(o?.type==="base64"&&typeof o.data=="string"){const c=o.data,l=o.media_type||"image/png",p=c.startsWith("data:")?c:`data:${l};base64,${c}`;s.push({url:p})}else typeof a.url=="string"&&s.push({url:a.url})}else if(a.type==="image_url"){const o=a.image_url;typeof o?.url=="string"&&s.push({url:o.url})}}return s}function Lp(e){const t=Tp();return r`
|
|
152
139
|
<div class="chat-group assistant">
|
|
153
|
-
${
|
|
140
|
+
${ui("assistant",e)}
|
|
154
141
|
<div class="chat-group-messages">
|
|
155
142
|
<div class="chat-bubble chat-reading-indicator" aria-hidden="true">
|
|
156
143
|
<span class="chat-reading-indicator__dots">
|
|
@@ -160,33 +147,33 @@ ${s?`**Command:** \`${s}\`
|
|
|
160
147
|
</div>
|
|
161
148
|
</div>
|
|
162
149
|
</div>
|
|
163
|
-
`}function
|
|
150
|
+
`}function Mp(e,t,n,s){const i=new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),a=s?.name??"Assistant";return r`
|
|
164
151
|
<div class="chat-group assistant">
|
|
165
|
-
${
|
|
152
|
+
${ui("assistant",s)}
|
|
166
153
|
<div class="chat-group-messages">
|
|
167
|
-
${
|
|
154
|
+
${yr({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!0,showReasoning:!1},n)}
|
|
168
155
|
<div class="chat-group-footer">
|
|
169
156
|
<span class="chat-sender-name">${a}</span>
|
|
170
157
|
<span class="chat-group-timestamp">${i}</span>
|
|
171
158
|
</div>
|
|
172
159
|
</div>
|
|
173
160
|
</div>
|
|
174
|
-
`}function
|
|
161
|
+
`}function Rp(e,t){const n=ti(e.role),s=t.assistantName??"Assistant",i=n==="user"?"You":n==="assistant"?s:n,a=n==="user"?"user":n==="assistant"?"assistant":"other",o=new Date(e.timestamp).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return r`
|
|
175
162
|
<div class="chat-group ${a}">
|
|
176
|
-
${
|
|
163
|
+
${ui(e.role,{name:s,avatar:t.assistantAvatar??null})}
|
|
177
164
|
<div class="chat-group-messages">
|
|
178
|
-
${e.messages.map((c,l)=>
|
|
165
|
+
${e.messages.map((c,l)=>yr(c.message,{isStreaming:e.isStreaming&&l===e.messages.length-1,showReasoning:t.showReasoning},t.onOpenSidebar))}
|
|
179
166
|
<div class="chat-group-footer">
|
|
180
167
|
<span class="chat-sender-name">${i}</span>
|
|
181
168
|
<span class="chat-group-timestamp">${o}</span>
|
|
182
169
|
</div>
|
|
183
170
|
</div>
|
|
184
171
|
</div>
|
|
185
|
-
`}function
|
|
172
|
+
`}function ui(e,t){const n=ti(e),s=t?.name?.trim()||"Assistant",i=t?.avatar?.trim()||"",a=n==="user"?"U":n==="assistant"?s.charAt(0).toUpperCase()||"A":n==="tool"?"⚙":"?",o=n==="user"?"user":n==="assistant"?"assistant":n==="tool"?"tool":"other";return i&&n==="assistant"?Ip(i)?r`<img
|
|
186
173
|
class="chat-avatar ${o}"
|
|
187
174
|
src="${i}"
|
|
188
175
|
alt="${s}"
|
|
189
|
-
/>`:r`<div class="chat-avatar ${o}">${i}</div>`:r`<div class="chat-avatar ${o}">${a}</div>`}function
|
|
176
|
+
/>`:r`<div class="chat-avatar ${o}">${i}</div>`:r`<div class="chat-avatar ${o}">${a}</div>`}function Ip(e){return/^https?:\/\//i.test(e)||/^data:image\//i.test(e)||e.startsWith("/")}function Pp(e){return e.length===0?f:r`
|
|
190
177
|
<div class="chat-message-images">
|
|
191
178
|
${e.map(t=>r`
|
|
192
179
|
<img
|
|
@@ -197,20 +184,20 @@ ${s?`**Command:** \`${s}\`
|
|
|
197
184
|
/>
|
|
198
185
|
`)}
|
|
199
186
|
</div>
|
|
200
|
-
`}function
|
|
187
|
+
`}function yr(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",a=Jo(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",o=Ap(e),c=o.length>0,l=Ep(e),p=l.length>0,d=fo(e),u=t.showReasoning&&i==="assistant"?Ol(e):null,g=d?.trim()?d:null,v=u?Bl(u):null,w=g,$=i==="assistant"&&!!w?.trim(),k=["chat-bubble",$?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!w&&c&&a?r`${o.map(_=>Ra(_,n))}`:!w&&!c&&!p?f:r`
|
|
201
188
|
<div class="${k}">
|
|
202
|
-
${$?
|
|
203
|
-
${
|
|
204
|
-
${
|
|
205
|
-
${
|
|
206
|
-
${o.length>1?
|
|
189
|
+
${$?ip(w):f}
|
|
190
|
+
${Pp(l)}
|
|
191
|
+
${v?r`<div class="chat-thinking">${ws(Ts(v))}</div>`:f}
|
|
192
|
+
${w?r`<div class="chat-text">${ws(Ts(w))}</div>`:f}
|
|
193
|
+
${o.length>1?kp(o):o.map(_=>Ra(_,n))}
|
|
207
194
|
</div>
|
|
208
|
-
`}function
|
|
195
|
+
`}function Np(e){return r`
|
|
209
196
|
<div class="sidebar-panel">
|
|
210
197
|
<div class="sidebar-header">
|
|
211
198
|
<div class="sidebar-title">Tool Output</div>
|
|
212
199
|
<button @click=${e.onClose} class="btn" title="Close sidebar">
|
|
213
|
-
${
|
|
200
|
+
${W.x}
|
|
214
201
|
</button>
|
|
215
202
|
</div>
|
|
216
203
|
<div class="sidebar-content">
|
|
@@ -219,10 +206,10 @@ ${s?`**Command:** \`${s}\`
|
|
|
219
206
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
220
207
|
View Raw Text
|
|
221
208
|
</button>
|
|
222
|
-
`:e.content?r`<div class="sidebar-markdown">${
|
|
209
|
+
`:e.content?r`<div class="sidebar-markdown">${ws(Ts(e.content))}</div>`:r`<div class="muted">No content available</div>`}
|
|
223
210
|
</div>
|
|
224
211
|
</div>
|
|
225
|
-
`}var
|
|
212
|
+
`}var Op=Object.defineProperty,Dp=Object.getOwnPropertyDescriptor,$n=(e,t,n,s)=>{for(var i=s>1?void 0:s?Dp(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&Op(t,n,i),i};let st=class extends Ze{constructor(){super(...arguments),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.isDragging=!1,this.startX=0,this.startRatio=0,this.handleMouseDown=e=>{this.isDragging=!0,this.startX=e.clientX,this.startRatio=this.splitRatio,this.classList.add("dragging"),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),e.preventDefault()},this.handleMouseMove=e=>{if(!this.isDragging)return;const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect().width,i=(e.clientX-this.startX)/n;let a=this.startRatio+i;a=Math.max(this.minRatio,Math.min(this.maxRatio,a)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:a},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return r``}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this.handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};st.styles=Gr`
|
|
226
213
|
:host {
|
|
227
214
|
width: 4px;
|
|
228
215
|
cursor: col-resize;
|
|
@@ -248,15 +235,15 @@ ${s?`**Command:** \`${s}\`
|
|
|
248
235
|
:host(.dragging) {
|
|
249
236
|
background: var(--accent, #007bff);
|
|
250
237
|
}
|
|
251
|
-
|
|
238
|
+
`;$n([rn({type:Number})],st.prototype,"splitRatio",2);$n([rn({type:Number})],st.prototype,"minRatio",2);$n([rn({type:Number})],st.prototype,"maxRatio",2);st=$n([oo("resizable-divider")],st);const Bp=5e3;function Fp(e){return e?e.active?r`
|
|
252
239
|
<div class="callout info compaction-indicator compaction-indicator--active">
|
|
253
|
-
${
|
|
240
|
+
${W.loader} Compacting context...
|
|
254
241
|
</div>
|
|
255
|
-
`:e.completedAt&&Date.now()-e.completedAt<
|
|
242
|
+
`:e.completedAt&&Date.now()-e.completedAt<Bp?r`
|
|
256
243
|
<div class="callout success compaction-indicator compaction-indicator--complete">
|
|
257
|
-
${
|
|
244
|
+
${W.check} Context compacted
|
|
258
245
|
</div>
|
|
259
|
-
`:
|
|
246
|
+
`:f:f}function Up(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Kp(e,t){const n=e.clipboardData?.items;if(!n||!t.onAttachmentsChange)return;const s=[];for(let i=0;i<n.length;i++){const a=n[i];a.type.startsWith("image/")&&s.push(a)}if(s.length!==0){e.preventDefault();for(const i of s){const a=i.getAsFile();if(!a)continue;const o=new FileReader;o.onload=()=>{const c=o.result,l={id:Up(),dataUrl:c,mimeType:a.type},p=t.attachments??[];t.onAttachmentsChange?.([...p,l])},o.readAsDataURL(a)}}}function Hp(e){const t=e.attachments??[];return t.length===0?f:r`
|
|
260
247
|
<div class="chat-attachments">
|
|
261
248
|
${t.map(n=>r`
|
|
262
249
|
<div class="chat-attachment">
|
|
@@ -271,28 +258,28 @@ ${s?`**Command:** \`${s}\`
|
|
|
271
258
|
aria-label="Remove attachment"
|
|
272
259
|
@click=${()=>{const s=(e.attachments??[]).filter(i=>i.id!==n.id);e.onAttachmentsChange?.(s)}}
|
|
273
260
|
>
|
|
274
|
-
${
|
|
261
|
+
${W.x}
|
|
275
262
|
</button>
|
|
276
263
|
</div>
|
|
277
264
|
`)}
|
|
278
265
|
</div>
|
|
279
|
-
`}function
|
|
266
|
+
`}function zp(e){const t=e.connected,n=e.sending||e.stream!==null,s=!!(e.canAbort&&e.onAbort),a=e.sessions?.sessions?.find(v=>v.key===e.sessionKey)?.reasoningLevel??"off",o=e.showThinking&&a!=="off",c={name:e.assistantName,avatar:e.assistantAvatar??e.assistantAvatarUrl??null},l=(e.attachments?.length??0)>0,p=e.connected?l?"Add a message or paste more images...":"Message (↩ to send, Shift+↩ for line breaks, paste images)":"Connect to the gateway to start chatting…",d=e.splitRatio??.6,u=!!(e.sidebarOpen&&e.onCloseSidebar),g=r`
|
|
280
267
|
<div
|
|
281
268
|
class="chat-thread"
|
|
282
269
|
role="log"
|
|
283
270
|
aria-live="polite"
|
|
284
271
|
@scroll=${e.onChatScroll}
|
|
285
272
|
>
|
|
286
|
-
${e.loading?r`<div class="muted">Loading chat…</div>`:
|
|
287
|
-
${
|
|
273
|
+
${e.loading?r`<div class="muted">Loading chat…</div>`:f}
|
|
274
|
+
${Yo(qp(e),v=>v.key,v=>v.kind==="reading-indicator"?Lp(c):v.kind==="stream"?Mp(v.text,v.startedAt,e.onOpenSidebar,c):v.kind==="group"?Rp(v,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName,assistantAvatar:c.avatar}):f)}
|
|
288
275
|
</div>
|
|
289
276
|
`;return r`
|
|
290
277
|
<section class="card chat">
|
|
291
|
-
${e.disabledReason?r`<div class="callout">${e.disabledReason}</div>`:
|
|
278
|
+
${e.disabledReason?r`<div class="callout">${e.disabledReason}</div>`:f}
|
|
292
279
|
|
|
293
|
-
${e.error?r`<div class="callout danger">${e.error}</div>`:
|
|
280
|
+
${e.error?r`<div class="callout danger">${e.error}</div>`:f}
|
|
294
281
|
|
|
295
|
-
${
|
|
282
|
+
${Fp(e.compactionStatus)}
|
|
296
283
|
|
|
297
284
|
${e.focusMode?r`
|
|
298
285
|
<button
|
|
@@ -302,68 +289,68 @@ ${s?`**Command:** \`${s}\`
|
|
|
302
289
|
aria-label="Exit focus mode"
|
|
303
290
|
title="Exit focus mode"
|
|
304
291
|
>
|
|
305
|
-
${
|
|
292
|
+
${W.x}
|
|
306
293
|
</button>
|
|
307
|
-
`:
|
|
294
|
+
`:f}
|
|
308
295
|
|
|
309
296
|
<div
|
|
310
|
-
class="chat-split-container ${
|
|
297
|
+
class="chat-split-container ${u?"chat-split-container--open":""}"
|
|
311
298
|
>
|
|
312
299
|
<div
|
|
313
300
|
class="chat-main"
|
|
314
|
-
style="flex: ${
|
|
301
|
+
style="flex: ${u?`0 0 ${d*100}%`:"1 1 100%"}"
|
|
315
302
|
>
|
|
316
|
-
${
|
|
303
|
+
${g}
|
|
317
304
|
</div>
|
|
318
305
|
|
|
319
|
-
${
|
|
306
|
+
${u?r`
|
|
320
307
|
<resizable-divider
|
|
321
308
|
.splitRatio=${d}
|
|
322
|
-
@resize=${
|
|
309
|
+
@resize=${v=>e.onSplitRatioChange?.(v.detail.splitRatio)}
|
|
323
310
|
></resizable-divider>
|
|
324
311
|
<div class="chat-sidebar">
|
|
325
|
-
${
|
|
312
|
+
${Np({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
|
|
326
313
|
${e.sidebarContent}
|
|
327
314
|
\`\`\``)}})}
|
|
328
315
|
</div>
|
|
329
|
-
`:
|
|
316
|
+
`:f}
|
|
330
317
|
</div>
|
|
331
318
|
|
|
332
319
|
${e.queue.length?r`
|
|
333
320
|
<div class="chat-queue" role="status" aria-live="polite">
|
|
334
321
|
<div class="chat-queue__title">Queued (${e.queue.length})</div>
|
|
335
322
|
<div class="chat-queue__list">
|
|
336
|
-
${e.queue.map(
|
|
323
|
+
${e.queue.map(v=>r`
|
|
337
324
|
<div class="chat-queue__item">
|
|
338
325
|
<div class="chat-queue__text">
|
|
339
|
-
${
|
|
326
|
+
${v.text||(v.attachments?.length?`Image (${v.attachments.length})`:"")}
|
|
340
327
|
</div>
|
|
341
328
|
<button
|
|
342
329
|
class="btn chat-queue__remove"
|
|
343
330
|
type="button"
|
|
344
331
|
aria-label="Remove queued message"
|
|
345
|
-
@click=${()=>e.onQueueRemove(
|
|
332
|
+
@click=${()=>e.onQueueRemove(v.id)}
|
|
346
333
|
>
|
|
347
|
-
${
|
|
334
|
+
${W.x}
|
|
348
335
|
</button>
|
|
349
336
|
</div>
|
|
350
337
|
`)}
|
|
351
338
|
</div>
|
|
352
339
|
</div>
|
|
353
|
-
`:
|
|
340
|
+
`:f}
|
|
354
341
|
|
|
355
342
|
<div class="chat-compose">
|
|
356
|
-
${
|
|
343
|
+
${Hp(e)}
|
|
357
344
|
<div class="chat-compose__row">
|
|
358
345
|
<label class="field chat-compose__field">
|
|
359
346
|
<span>Message</span>
|
|
360
347
|
<textarea
|
|
361
348
|
.value=${e.draft}
|
|
362
349
|
?disabled=${!e.connected}
|
|
363
|
-
@keydown=${
|
|
364
|
-
@input=${
|
|
365
|
-
@paste=${
|
|
366
|
-
placeholder=${
|
|
350
|
+
@keydown=${v=>{v.key==="Enter"&&(v.isComposing||v.keyCode===229||v.shiftKey||e.connected&&(v.preventDefault(),t&&e.onSend()))}}
|
|
351
|
+
@input=${v=>e.onDraftChange(v.target.value)}
|
|
352
|
+
@paste=${v=>Kp(v,e)}
|
|
353
|
+
placeholder=${p}
|
|
367
354
|
></textarea>
|
|
368
355
|
</label>
|
|
369
356
|
<div class="chat-compose__actions">
|
|
@@ -385,18 +372,18 @@ ${e.sidebarContent}
|
|
|
385
372
|
</div>
|
|
386
373
|
</div>
|
|
387
374
|
</section>
|
|
388
|
-
`}const
|
|
389
|
-
<div class="cfg-field__label">${
|
|
375
|
+
`}const Na=200;function jp(e){const t=[];let n=null;for(const s of e){if(s.kind!=="message"){n&&(t.push(n),n=null),t.push(s);continue}const i=Qo(s.message),a=ti(i.role),o=i.timestamp||Date.now();!n||n.role!==a?(n&&t.push(n),n={kind:"group",key:`group:${a}:${s.key}`,role:a,messages:[{message:s.message,key:s.key}],timestamp:o,isStreaming:!1}):n.messages.push({message:s.message,key:s.key})}return n&&t.push(n),t}function qp(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Na);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Na} messages (${i} hidden).`,timestamp:Date.now()}});for(let a=i;a<n.length;a++){const o=n[a],c=Qo(o);!e.showThinking&&c.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:Oa(o,a),message:o})}if(e.showThinking)for(let a=0;a<s.length;a++)t.push({kind:"message",key:Oa(s[a],a+n.length),message:s[a]});if(e.stream!==null){const a=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:a,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:a})}return jp(t)}function Oa(e,t){const n=e,s=typeof n.toolCallId=="string"?n.toolCallId:"";if(s)return`tool:${s}`;const i=typeof n.id=="string"?n.id:"";if(i)return`msg:${i}`;const a=typeof n.messageId=="string"?n.messageId:"";if(a)return`msg:${a}`;const o=typeof n.timestamp=="number"?n.timestamp:null,c=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${c}:${o}:${t}`:`msg:${c}:${t}`}function ue(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function br(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(ue(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function xn(e){return e.filter(t=>typeof t=="string").join(".")}function te(e,t){const n=xn(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const c=a.split(".");if(c.length!==i.length)continue;let l=!0;for(let p=0;p<i.length;p+=1)if(c[p]!=="*"&&c[p]!==i[p]){l=!1;break}if(l)return o}}function we(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Vp(e){const t=xn(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}const Wp=new Set(["title","description","default","nullable"]);function Gp(e){return Object.keys(e??{}).filter(n=>!Wp.has(n)).length===0}function Yp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const Ct={chevronDown:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>`,plus:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>`,minus:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>`,trash:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>`,edit:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>`};function be(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:c}=e,l=e.showLabel??!0,p=ue(t),d=te(s,i),u=d?.label??t.title??we(String(s.at(-1))),g=d?.help??t.description,v=xn(s);if(a.has(v))return r`<div class="cfg-field cfg-field--error">
|
|
376
|
+
<div class="cfg-field__label">${u}</div>
|
|
390
377
|
<div class="cfg-field__error">Unsupported schema node. Use Raw mode.</div>
|
|
391
|
-
</div>`;if(t.anyOf||t.oneOf){const $=(t.anyOf??t.oneOf??[]).filter(
|
|
378
|
+
</div>`;if(t.anyOf||t.oneOf){const $=(t.anyOf??t.oneOf??[]).filter(T=>!(T.type==="null"||Array.isArray(T.type)&&T.type.includes("null")));if($.length===1)return be({...e,schema:$[0]});const k=T=>{if(T.const!==void 0)return T.const;if(T.enum&&T.enum.length===1)return T.enum[0]},_=$.map(k),M=_.every(T=>T!==void 0);if(M&&_.length>0&&_.length<=5){const T=n??t.default;return r`
|
|
392
379
|
<div class="cfg-field">
|
|
393
|
-
${l?r`<label class="cfg-field__label">${
|
|
394
|
-
${
|
|
380
|
+
${l?r`<label class="cfg-field__label">${u}</label>`:f}
|
|
381
|
+
${g?r`<div class="cfg-field__help">${g}</div>`:f}
|
|
395
382
|
<div class="cfg-segmented">
|
|
396
|
-
${_.map((E,
|
|
383
|
+
${_.map((E,pe)=>r`
|
|
397
384
|
<button
|
|
398
385
|
type="button"
|
|
399
|
-
class="cfg-segmented__btn ${E===
|
|
386
|
+
class="cfg-segmented__btn ${E===T||String(E)===String(T)?"active":""}"
|
|
400
387
|
?disabled=${o}
|
|
401
388
|
@click=${()=>c(s,E)}
|
|
402
389
|
>
|
|
@@ -405,12 +392,12 @@ ${e.sidebarContent}
|
|
|
405
392
|
`)}
|
|
406
393
|
</div>
|
|
407
394
|
</div>
|
|
408
|
-
`}if(M&&_.length>5)return
|
|
395
|
+
`}if(M&&_.length>5)return Ba({...e,options:_,value:n??t.default});const P=new Set($.map(T=>ue(T)).filter(Boolean)),L=new Set([...P].map(T=>T==="integer"?"number":T));if([...L].every(T=>["string","number","boolean"].includes(T))){const T=L.has("string"),E=L.has("number");if(L.has("boolean")&&L.size===1)return be({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(T||E)return Da({...e,inputType:E&&!T?"number":"text"})}}if(t.enum){const w=t.enum;if(w.length<=5){const $=n??t.default;return r`
|
|
409
396
|
<div class="cfg-field">
|
|
410
|
-
${l?r`<label class="cfg-field__label">${
|
|
411
|
-
${
|
|
397
|
+
${l?r`<label class="cfg-field__label">${u}</label>`:f}
|
|
398
|
+
${g?r`<div class="cfg-field__help">${g}</div>`:f}
|
|
412
399
|
<div class="cfg-segmented">
|
|
413
|
-
${
|
|
400
|
+
${w.map(k=>r`
|
|
414
401
|
<button
|
|
415
402
|
type="button"
|
|
416
403
|
class="cfg-segmented__btn ${k===$||String(k)===String($)?"active":""}"
|
|
@@ -422,37 +409,37 @@ ${e.sidebarContent}
|
|
|
422
409
|
`)}
|
|
423
410
|
</div>
|
|
424
411
|
</div>
|
|
425
|
-
`}return
|
|
412
|
+
`}return Ba({...e,options:w,value:n??t.default})}if(p==="object")return Jp(e);if(p==="array")return Zp(e);if(p==="boolean"){const w=typeof n=="boolean"?n:typeof t.default=="boolean"?t.default:!1;return r`
|
|
426
413
|
<label class="cfg-toggle-row ${o?"disabled":""}">
|
|
427
414
|
<div class="cfg-toggle-row__content">
|
|
428
|
-
<span class="cfg-toggle-row__label">${
|
|
429
|
-
${
|
|
415
|
+
<span class="cfg-toggle-row__label">${u}</span>
|
|
416
|
+
${g?r`<span class="cfg-toggle-row__help">${g}</span>`:f}
|
|
430
417
|
</div>
|
|
431
418
|
<div class="cfg-toggle">
|
|
432
419
|
<input
|
|
433
420
|
type="checkbox"
|
|
434
|
-
.checked=${
|
|
421
|
+
.checked=${w}
|
|
435
422
|
?disabled=${o}
|
|
436
423
|
@change=${$=>c(s,$.target.checked)}
|
|
437
424
|
/>
|
|
438
425
|
<span class="cfg-toggle__track"></span>
|
|
439
426
|
</div>
|
|
440
427
|
</label>
|
|
441
|
-
`}return
|
|
428
|
+
`}return p==="number"||p==="integer"?Qp(e):p==="string"?Da({...e,inputType:"text"}):r`
|
|
442
429
|
<div class="cfg-field cfg-field--error">
|
|
443
|
-
<div class="cfg-field__label">${
|
|
444
|
-
<div class="cfg-field__error">Unsupported type: ${
|
|
430
|
+
<div class="cfg-field__label">${u}</div>
|
|
431
|
+
<div class="cfg-field__error">Unsupported type: ${p}. Use Raw mode.</div>
|
|
445
432
|
</div>
|
|
446
|
-
`}function
|
|
433
|
+
`}function Da(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:c}=e,l=e.showLabel??!0,p=te(s,i),d=p?.label??t.title??we(String(s.at(-1))),u=p?.help??t.description,g=p?.sensitive??Vp(s),v=p?.placeholder??(g?"••••":t.default!==void 0?`Default: ${t.default}`:""),w=n??"";return r`
|
|
447
434
|
<div class="cfg-field">
|
|
448
|
-
${l?r`<label class="cfg-field__label">${d}</label>`:
|
|
449
|
-
${
|
|
435
|
+
${l?r`<label class="cfg-field__label">${d}</label>`:f}
|
|
436
|
+
${u?r`<div class="cfg-field__help">${u}</div>`:f}
|
|
450
437
|
<div class="cfg-input-wrap">
|
|
451
438
|
<input
|
|
452
|
-
type=${
|
|
439
|
+
type=${g?"password":c}
|
|
453
440
|
class="cfg-input"
|
|
454
|
-
placeholder=${
|
|
455
|
-
.value=${
|
|
441
|
+
placeholder=${v}
|
|
442
|
+
.value=${w==null?"":String(w)}
|
|
456
443
|
?disabled=${a}
|
|
457
444
|
@input=${$=>{const k=$.target.value;if(c==="number"){if(k.trim()===""){o(s,void 0);return}const _=Number(k);o(s,Number.isNaN(_)?k:_);return}o(s,k)}}
|
|
458
445
|
/>
|
|
@@ -464,97 +451,97 @@ ${e.sidebarContent}
|
|
|
464
451
|
?disabled=${a}
|
|
465
452
|
@click=${()=>o(s,t.default)}
|
|
466
453
|
>↺</button>
|
|
467
|
-
`:
|
|
454
|
+
`:f}
|
|
468
455
|
</div>
|
|
469
456
|
</div>
|
|
470
|
-
`}function
|
|
457
|
+
`}function Qp(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,c=e.showLabel??!0,l=te(s,i),p=l?.label??t.title??we(String(s.at(-1))),d=l?.help??t.description,u=n??t.default??"",g=typeof u=="number"?u:0;return r`
|
|
471
458
|
<div class="cfg-field">
|
|
472
|
-
${c?r`<label class="cfg-field__label">${
|
|
473
|
-
${d?r`<div class="cfg-field__help">${d}</div>`:
|
|
459
|
+
${c?r`<label class="cfg-field__label">${p}</label>`:f}
|
|
460
|
+
${d?r`<div class="cfg-field__help">${d}</div>`:f}
|
|
474
461
|
<div class="cfg-number">
|
|
475
462
|
<button
|
|
476
463
|
type="button"
|
|
477
464
|
class="cfg-number__btn"
|
|
478
465
|
?disabled=${a}
|
|
479
|
-
@click=${()=>o(s,
|
|
466
|
+
@click=${()=>o(s,g-1)}
|
|
480
467
|
>−</button>
|
|
481
468
|
<input
|
|
482
469
|
type="number"
|
|
483
470
|
class="cfg-number__input"
|
|
484
|
-
.value=${
|
|
471
|
+
.value=${u==null?"":String(u)}
|
|
485
472
|
?disabled=${a}
|
|
486
|
-
@input=${
|
|
473
|
+
@input=${v=>{const w=v.target.value,$=w===""?void 0:Number(w);o(s,$)}}
|
|
487
474
|
/>
|
|
488
475
|
<button
|
|
489
476
|
type="button"
|
|
490
477
|
class="cfg-number__btn"
|
|
491
478
|
?disabled=${a}
|
|
492
|
-
@click=${()=>o(s,
|
|
479
|
+
@click=${()=>o(s,g+1)}
|
|
493
480
|
>+</button>
|
|
494
481
|
</div>
|
|
495
482
|
</div>
|
|
496
|
-
`}function
|
|
483
|
+
`}function Ba(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:c}=e,l=e.showLabel??!0,p=te(s,i),d=p?.label??t.title??we(String(s.at(-1))),u=p?.help??t.description,g=n??t.default,v=o.findIndex($=>$===g||String($)===String(g)),w="__unset__";return r`
|
|
497
484
|
<div class="cfg-field">
|
|
498
|
-
${l?r`<label class="cfg-field__label">${d}</label>`:
|
|
499
|
-
${
|
|
485
|
+
${l?r`<label class="cfg-field__label">${d}</label>`:f}
|
|
486
|
+
${u?r`<div class="cfg-field__help">${u}</div>`:f}
|
|
500
487
|
<select
|
|
501
488
|
class="cfg-select"
|
|
502
489
|
?disabled=${a}
|
|
503
|
-
.value=${
|
|
504
|
-
@change=${$=>{const k=$.target.value;c(s,k===
|
|
490
|
+
.value=${v>=0?String(v):w}
|
|
491
|
+
@change=${$=>{const k=$.target.value;c(s,k===w?void 0:o[Number(k)])}}
|
|
505
492
|
>
|
|
506
|
-
<option value=${
|
|
493
|
+
<option value=${w}>Select...</option>
|
|
507
494
|
${o.map(($,k)=>r`
|
|
508
495
|
<option value=${String(k)}>${String($)}</option>
|
|
509
496
|
`)}
|
|
510
497
|
</select>
|
|
511
498
|
</div>
|
|
512
|
-
`}function
|
|
499
|
+
`}function Jp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:c}=e;e.showLabel;const l=te(s,i),p=l?.label??t.title??we(String(s.at(-1))),d=l?.help??t.description,u=n??t.default,g=u&&typeof u=="object"&&!Array.isArray(u)?u:{},v=t.properties??{},$=Object.entries(v).sort((P,L)=>{const T=te([...s,P[0]],i)?.order??0,E=te([...s,L[0]],i)?.order??0;return T!==E?T-E:P[0].localeCompare(L[0])}),k=new Set(Object.keys(v)),_=t.additionalProperties,M=!!_&&typeof _=="object";return s.length===1?r`
|
|
513
500
|
<div class="cfg-fields">
|
|
514
|
-
${$.map(([
|
|
515
|
-
${M?
|
|
501
|
+
${$.map(([P,L])=>be({schema:L,value:g[P],path:[...s,P],hints:i,unsupported:a,disabled:o,onPatch:c}))}
|
|
502
|
+
${M?Fa({schema:_,value:g,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:k,onPatch:c}):f}
|
|
516
503
|
</div>
|
|
517
504
|
`:r`
|
|
518
505
|
<details class="cfg-object" open>
|
|
519
506
|
<summary class="cfg-object__header">
|
|
520
|
-
<span class="cfg-object__title">${
|
|
521
|
-
<span class="cfg-object__chevron">${
|
|
507
|
+
<span class="cfg-object__title">${p}</span>
|
|
508
|
+
<span class="cfg-object__chevron">${Ct.chevronDown}</span>
|
|
522
509
|
</summary>
|
|
523
|
-
${d?r`<div class="cfg-object__help">${d}</div>`:
|
|
510
|
+
${d?r`<div class="cfg-object__help">${d}</div>`:f}
|
|
524
511
|
<div class="cfg-object__content">
|
|
525
|
-
${$.map(([
|
|
526
|
-
${M?
|
|
512
|
+
${$.map(([P,L])=>be({schema:L,value:g[P],path:[...s,P],hints:i,unsupported:a,disabled:o,onPatch:c}))}
|
|
513
|
+
${M?Fa({schema:_,value:g,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:k,onPatch:c}):f}
|
|
527
514
|
</div>
|
|
528
515
|
</details>
|
|
529
|
-
`}function
|
|
516
|
+
`}function Zp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:c}=e,l=e.showLabel??!0,p=te(s,i),d=p?.label??t.title??we(String(s.at(-1))),u=p?.help??t.description,g=Array.isArray(t.items)?t.items[0]:t.items;if(!g)return r`
|
|
530
517
|
<div class="cfg-field cfg-field--error">
|
|
531
518
|
<div class="cfg-field__label">${d}</div>
|
|
532
519
|
<div class="cfg-field__error">Unsupported array schema. Use Raw mode.</div>
|
|
533
520
|
</div>
|
|
534
|
-
`;const
|
|
521
|
+
`;const v=Array.isArray(n)?n:Array.isArray(t.default)?t.default:[];return r`
|
|
535
522
|
<div class="cfg-array">
|
|
536
523
|
<div class="cfg-array__header">
|
|
537
|
-
${l?r`<span class="cfg-array__label">${d}</span>`:
|
|
538
|
-
<span class="cfg-array__count">${
|
|
524
|
+
${l?r`<span class="cfg-array__label">${d}</span>`:f}
|
|
525
|
+
<span class="cfg-array__count">${v.length} item${v.length!==1?"s":""}</span>
|
|
539
526
|
<button
|
|
540
527
|
type="button"
|
|
541
528
|
class="cfg-array__add"
|
|
542
529
|
?disabled=${o}
|
|
543
|
-
@click=${()=>{const
|
|
530
|
+
@click=${()=>{const w=[...v,br(g)];c(s,w)}}
|
|
544
531
|
>
|
|
545
|
-
<span class="cfg-array__add-icon">${
|
|
532
|
+
<span class="cfg-array__add-icon">${Ct.plus}</span>
|
|
546
533
|
Add
|
|
547
534
|
</button>
|
|
548
535
|
</div>
|
|
549
|
-
${
|
|
536
|
+
${u?r`<div class="cfg-array__help">${u}</div>`:f}
|
|
550
537
|
|
|
551
|
-
${
|
|
538
|
+
${v.length===0?r`
|
|
552
539
|
<div class="cfg-array__empty">
|
|
553
540
|
No items yet. Click "Add" to create one.
|
|
554
541
|
</div>
|
|
555
542
|
`:r`
|
|
556
543
|
<div class="cfg-array__items">
|
|
557
|
-
${
|
|
544
|
+
${v.map((w,$)=>r`
|
|
558
545
|
<div class="cfg-array__item">
|
|
559
546
|
<div class="cfg-array__item-header">
|
|
560
547
|
<span class="cfg-array__item-index">#${$+1}</span>
|
|
@@ -563,20 +550,20 @@ ${e.sidebarContent}
|
|
|
563
550
|
class="cfg-array__item-remove"
|
|
564
551
|
title="Remove item"
|
|
565
552
|
?disabled=${o}
|
|
566
|
-
@click=${()=>{const k=[...
|
|
553
|
+
@click=${()=>{const k=[...v];k.splice($,1),c(s,k)}}
|
|
567
554
|
>
|
|
568
|
-
${
|
|
555
|
+
${Ct.trash}
|
|
569
556
|
</button>
|
|
570
557
|
</div>
|
|
571
558
|
<div class="cfg-array__item-content">
|
|
572
|
-
${
|
|
559
|
+
${be({schema:g,value:w,path:[...s,$],hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:c})}
|
|
573
560
|
</div>
|
|
574
561
|
</div>
|
|
575
562
|
`)}
|
|
576
563
|
</div>
|
|
577
564
|
`}
|
|
578
565
|
</div>
|
|
579
|
-
`}function
|
|
566
|
+
`}function Fa(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:c,onPatch:l}=e,p=Gp(t),d=Object.entries(n??{}).filter(([u])=>!c.has(u));return r`
|
|
580
567
|
<div class="cfg-map">
|
|
581
568
|
<div class="cfg-map__header">
|
|
582
569
|
<span class="cfg-map__label">Custom entries</span>
|
|
@@ -584,9 +571,9 @@ ${e.sidebarContent}
|
|
|
584
571
|
type="button"
|
|
585
572
|
class="cfg-map__add"
|
|
586
573
|
?disabled=${o}
|
|
587
|
-
@click=${()=>{const
|
|
574
|
+
@click=${()=>{const u={...n??{}};let g=1,v=`custom-${g}`;for(;v in u;)g+=1,v=`custom-${g}`;u[v]=p?{}:br(t),l(s,u)}}
|
|
588
575
|
>
|
|
589
|
-
<span class="cfg-map__add-icon">${
|
|
576
|
+
<span class="cfg-map__add-icon">${Ct.plus}</span>
|
|
590
577
|
Add Entry
|
|
591
578
|
</button>
|
|
592
579
|
</div>
|
|
@@ -595,82 +582,82 @@ ${e.sidebarContent}
|
|
|
595
582
|
<div class="cfg-map__empty">No custom entries.</div>
|
|
596
583
|
`:r`
|
|
597
584
|
<div class="cfg-map__items">
|
|
598
|
-
${d.map(([
|
|
585
|
+
${d.map(([u,g])=>{const v=[...s,u],w=Yp(g);return r`
|
|
599
586
|
<div class="cfg-map__item">
|
|
600
587
|
<div class="cfg-map__item-key">
|
|
601
588
|
<input
|
|
602
589
|
type="text"
|
|
603
590
|
class="cfg-input cfg-input--sm"
|
|
604
591
|
placeholder="Key"
|
|
605
|
-
.value=${
|
|
592
|
+
.value=${u}
|
|
606
593
|
?disabled=${o}
|
|
607
|
-
@change=${$=>{const k=$.target.value.trim();if(!k||k===
|
|
594
|
+
@change=${$=>{const k=$.target.value.trim();if(!k||k===u)return;const _={...n??{}};k in _||(_[k]=_[u],delete _[u],l(s,_))}}
|
|
608
595
|
/>
|
|
609
596
|
</div>
|
|
610
597
|
<div class="cfg-map__item-value">
|
|
611
|
-
${
|
|
598
|
+
${p?r`
|
|
612
599
|
<textarea
|
|
613
600
|
class="cfg-textarea cfg-textarea--sm"
|
|
614
601
|
placeholder="JSON value"
|
|
615
602
|
rows="2"
|
|
616
|
-
.value=${
|
|
603
|
+
.value=${w}
|
|
617
604
|
?disabled=${o}
|
|
618
|
-
@change=${$=>{const k=$.target,_=k.value.trim();if(!_){l(
|
|
605
|
+
@change=${$=>{const k=$.target,_=k.value.trim();if(!_){l(v,void 0);return}try{l(v,JSON.parse(_))}catch{k.value=w}}}
|
|
619
606
|
></textarea>
|
|
620
|
-
`:
|
|
607
|
+
`:be({schema:t,value:g,path:v,hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:l})}
|
|
621
608
|
</div>
|
|
622
609
|
<button
|
|
623
610
|
type="button"
|
|
624
611
|
class="cfg-map__item-remove"
|
|
625
612
|
title="Remove entry"
|
|
626
613
|
?disabled=${o}
|
|
627
|
-
@click=${()=>{const $={...n??{}};delete $[
|
|
614
|
+
@click=${()=>{const $={...n??{}};delete $[u],l(s,$)}}
|
|
628
615
|
>
|
|
629
|
-
${
|
|
616
|
+
${Ct.trash}
|
|
630
617
|
</button>
|
|
631
618
|
</div>
|
|
632
619
|
`})}
|
|
633
620
|
</div>
|
|
634
621
|
`}
|
|
635
622
|
</div>
|
|
636
|
-
`}const io={env:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},Ei={env:{label:"Environment Variables",description:"Environment variables passed to the gateway process"},update:{label:"Updates",description:"Auto-update settings and release channel"},agents:{label:"Agents",description:"Agent configurations, models, and identities"},auth:{label:"Authentication",description:"API keys and authentication profiles"},channels:{label:"Channels",description:"Messaging channels (Telegram, Discord, Slack, etc.)"},messages:{label:"Messages",description:"Message handling and routing settings"},commands:{label:"Commands",description:"Custom slash commands"},hooks:{label:"Hooks",description:"Webhooks and event hooks"},skills:{label:"Skills",description:"Skill packs and capabilities"},tools:{label:"Tools",description:"Tool configurations (browser, search, etc.)"},gateway:{label:"Gateway",description:"Gateway server settings (port, auth, binding)"},wizard:{label:"Setup Wizard",description:"Setup wizard state and history"},meta:{label:"Metadata",description:"Gateway metadata and version information"},logging:{label:"Logging",description:"Log levels and output configuration"},browser:{label:"Browser",description:"Browser automation settings"},ui:{label:"UI",description:"User interface preferences"},models:{label:"Models",description:"AI model configurations and providers"},bindings:{label:"Bindings",description:"Key bindings and shortcuts"},broadcast:{label:"Broadcast",description:"Broadcast and notification settings"},audio:{label:"Audio",description:"Audio input/output settings"},session:{label:"Session",description:"Session management and persistence"},cron:{label:"Cron",description:"Scheduled tasks and automation"},web:{label:"Web",description:"Web server and API settings"},discovery:{label:"Discovery",description:"Service discovery and networking"},canvasHost:{label:"Canvas Host",description:"Canvas rendering and display"},talk:{label:"Talk",description:"Voice and speech settings"},plugins:{label:"Plugins",description:"Plugin management and extensions"}};function ao(e){return io[e]??io.default}function Dh(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=Ei[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:Tt(t,s)}function Tt(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||Tt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&Tt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&Tt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&Tt(s,t))return!0}return!1}function Bh(e){if(!e.schema)return r`<div class="muted">Schema unavailable.</div>`;const t=e.schema,n=e.value??{};if(me(t)!=="object"||!t.properties)return r`<div class="callout danger">Unsupported schema. Use Raw.</div>`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,c=e.activeSubsection??null,u=Object.entries(i).sort((p,f)=>{const m=ie([p[0]],e.uiHints)?.order??50,v=ie([f[0]],e.uiHints)?.order??50;return m!==v?m-v:p[0].localeCompare(f[0])}).filter(([p,f])=>!(o&&p!==o||a&&!Dh(p,f,a)));let d=null;if(o&&c&&u.length===1){const p=u[0]?.[1];p&&me(p)==="object"&&p.properties&&p.properties[c]&&(d={sectionKey:o,subsectionKey:c,schema:p.properties[c]})}return u.length===0?r`
|
|
623
|
+
`}const Ua={env:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},pi={env:{label:"Environment Variables",description:"Environment variables passed to the gateway process"},update:{label:"Updates",description:"Auto-update settings and release channel"},agents:{label:"Agents",description:"Agent configurations, models, and identities"},auth:{label:"Authentication",description:"API keys and authentication profiles"},channels:{label:"Channels",description:"Messaging channels (Telegram, Discord, Slack, etc.)"},messages:{label:"Messages",description:"Message handling and routing settings"},commands:{label:"Commands",description:"Custom slash commands"},hooks:{label:"Hooks",description:"Webhooks and event hooks"},skills:{label:"Skills",description:"Skill packs and capabilities"},tools:{label:"Tools",description:"Tool configurations (browser, search, etc.)"},gateway:{label:"Gateway",description:"Gateway server settings (port, auth, binding)"},wizard:{label:"Setup Wizard",description:"Setup wizard state and history"},meta:{label:"Metadata",description:"Gateway metadata and version information"},logging:{label:"Logging",description:"Log levels and output configuration"},browser:{label:"Browser",description:"Browser automation settings"},ui:{label:"UI",description:"User interface preferences"},models:{label:"Models",description:"AI model configurations and providers"},bindings:{label:"Bindings",description:"Key bindings and shortcuts"},broadcast:{label:"Broadcast",description:"Broadcast and notification settings"},audio:{label:"Audio",description:"Audio input/output settings"},session:{label:"Session",description:"Session management and persistence"},cron:{label:"Cron",description:"Scheduled tasks and automation"},web:{label:"Web",description:"Web server and API settings"},discovery:{label:"Discovery",description:"Service discovery and networking"},canvasHost:{label:"Canvas Host",description:"Canvas rendering and display"},talk:{label:"Talk",description:"Voice and speech settings"},plugins:{label:"Plugins",description:"Plugin management and extensions"}};function Ka(e){return Ua[e]??Ua.default}function Xp(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=pi[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:yt(t,s)}function yt(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||yt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&yt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&yt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&yt(s,t))return!0}return!1}function eh(e){if(!e.schema)return r`<div class="muted">Schema unavailable.</div>`;const t=e.schema,n=e.value??{};if(ue(t)!=="object"||!t.properties)return r`<div class="callout danger">Unsupported schema. Use Raw.</div>`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,c=e.activeSubsection??null,p=Object.entries(i).sort((u,g)=>{const v=te([u[0]],e.uiHints)?.order??50,w=te([g[0]],e.uiHints)?.order??50;return v!==w?v-w:u[0].localeCompare(g[0])}).filter(([u,g])=>!(o&&u!==o||a&&!Xp(u,g,a)));let d=null;if(o&&c&&p.length===1){const u=p[0]?.[1];u&&ue(u)==="object"&&u.properties&&u.properties[c]&&(d={sectionKey:o,subsectionKey:c,schema:u.properties[c]})}return p.length===0?r`
|
|
637
624
|
<div class="config-empty">
|
|
638
|
-
<div class="config-empty__icon">${
|
|
625
|
+
<div class="config-empty__icon">${W.search}</div>
|
|
639
626
|
<div class="config-empty__text">
|
|
640
627
|
${a?`No settings match "${a}"`:"No settings in this section"}
|
|
641
628
|
</div>
|
|
642
629
|
</div>
|
|
643
630
|
`:r`
|
|
644
631
|
<div class="config-form config-form--modern">
|
|
645
|
-
${d?(()=>{const{sectionKey:
|
|
646
|
-
<section class="config-section-card" id=${
|
|
632
|
+
${d?(()=>{const{sectionKey:u,subsectionKey:g,schema:v}=d,w=te([u,g],e.uiHints),$=w?.label??v.title??we(g),k=w?.help??v.description??"",_=n[u],M=_&&typeof _=="object"?_[g]:void 0,P=`config-section-${u}-${g}`;return r`
|
|
633
|
+
<section class="config-section-card" id=${P}>
|
|
647
634
|
<div class="config-section-card__header">
|
|
648
|
-
<span class="config-section-card__icon">${
|
|
635
|
+
<span class="config-section-card__icon">${Ka(u)}</span>
|
|
649
636
|
<div class="config-section-card__titles">
|
|
650
637
|
<h3 class="config-section-card__title">${$}</h3>
|
|
651
|
-
${k?r`<p class="config-section-card__desc">${k}</p>`:
|
|
638
|
+
${k?r`<p class="config-section-card__desc">${k}</p>`:f}
|
|
652
639
|
</div>
|
|
653
640
|
</div>
|
|
654
641
|
<div class="config-section-card__content">
|
|
655
|
-
${
|
|
642
|
+
${be({schema:v,value:M,path:[u,g],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
|
|
656
643
|
</div>
|
|
657
644
|
</section>
|
|
658
|
-
`})():
|
|
659
|
-
<section class="config-section-card" id="config-section-${
|
|
645
|
+
`})():p.map(([u,g])=>{const v=pi[u]??{label:u.charAt(0).toUpperCase()+u.slice(1),description:g.description??""};return r`
|
|
646
|
+
<section class="config-section-card" id="config-section-${u}">
|
|
660
647
|
<div class="config-section-card__header">
|
|
661
|
-
<span class="config-section-card__icon">${
|
|
648
|
+
<span class="config-section-card__icon">${Ka(u)}</span>
|
|
662
649
|
<div class="config-section-card__titles">
|
|
663
|
-
<h3 class="config-section-card__title">${
|
|
664
|
-
${
|
|
650
|
+
<h3 class="config-section-card__title">${v.label}</h3>
|
|
651
|
+
${v.description?r`<p class="config-section-card__desc">${v.description}</p>`:f}
|
|
665
652
|
</div>
|
|
666
653
|
</div>
|
|
667
654
|
<div class="config-section-card__content">
|
|
668
|
-
${
|
|
655
|
+
${be({schema:g,value:n[u],path:[u],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
|
|
669
656
|
</div>
|
|
670
657
|
</section>
|
|
671
658
|
`})}
|
|
672
659
|
</div>
|
|
673
|
-
`}const Fh=new Set(["title","description","default","nullable"]);function Uh(e){return Object.keys(e??{}).filter(n=>!Fh.has(n)).length===0}function Ur(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function Kr(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:Et(e,[])}function Et(e,t){const n=new Set,s={...e},i=Pn(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const c=Kh(e,t);return c||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=me(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:c,nullable:l}=Ur(s.enum);s.enum=c,l&&(s.nullable=!0),c.length===0&&n.add(i)}if(o==="object"){const c=e.properties??{},l={};for(const[u,d]of Object.entries(c)){const p=Et(d,[...t,u]);p.schema&&(l[u]=p.schema);for(const f of p.unsupportedPaths)n.add(f)}if(s.properties=l,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!Uh(e.additionalProperties)){const u=Et(e.additionalProperties,[...t,"*"]);s.additionalProperties=u.schema??e.additionalProperties,u.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const c=Array.isArray(e.items)?e.items[0]:e.items;if(!c)n.add(i);else{const l=Et(c,[...t,"*"]);s.items=l.schema??c,l.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function Kh(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const c of n){if(!c||typeof c!="object")return null;if(Array.isArray(c.enum)){const{enumValues:l,nullable:u}=Ur(c.enum);s.push(...l),u&&(a=!0);continue}if("const"in c){if(c.const==null){a=!0;continue}s.push(c.const);continue}if(me(c)==="null"){a=!0;continue}i.push(c)}if(s.length>0&&i.length===0){const c=[];for(const l of s)c.some(u=>Object.is(u,l))||c.push(l);return{schema:{...e,enum:c,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const c=Et(i[0],t);return c.schema&&(c.schema.nullable=a||c.schema.nullable),c}const o=["string","number","integer","boolean"];return i.length>0&&s.length===0&&i.every(c=>c.type&&o.includes(String(c.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}const Vs={all:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>`,env:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},oo=[{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"}],ro="__all__";function lo(e){return Vs[e]??Vs.default}function zh(e,t){const n=Ei[e];return n||{label:t?.title??Te(e),description:t?.description??""}}function Hh(e){const{key:t,schema:n,uiHints:s}=e;if(!n||me(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const c=ie([t,a],s),l=c?.label??o.title??Te(a),u=c?.help??o.description??"",d=c?.order??50;return{key:a,label:l,description:u,order:d}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function jh(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const c=i,l=a,u=new Set([...Object.keys(c),...Object.keys(l)]);for(const d of u)s(c[d],l[d],o?`${o}.${d}`:d)}return s(e,t,""),n}function co(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 Vh(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=Kr(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=oo.filter(E=>E.key in i),o=new Set(oo.map(E=>E.key)),c=Object.keys(i).filter(E=>!o.has(E)).map(E=>({key:E,label:E.charAt(0).toUpperCase()+E.slice(1)})),l=[...a,...c],u=e.activeSection&&n.schema&&me(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,d=e.activeSection?zh(e.activeSection,u):null,p=e.activeSection?Hh({key:e.activeSection,schema:u,uiHints:e.uiHints}):[],f=e.formMode==="form"&&!!e.activeSection&&p.length>0,m=e.activeSubsection===ro,v=e.searchQuery||m?null:e.activeSubsection??p[0]?.key??null,$=e.formMode==="form"?jh(e.originalValue,e.formValue):[],k=e.formMode==="raw"&&e.raw!==e.originalRaw,_=e.formMode==="form"?$.length>0:k,M=!!e.formValue&&!e.loading&&!!n.schema,N=e.connected&&!e.saving&&_&&(e.formMode==="raw"?!0:M),R=e.connected&&!e.applying&&!e.updating&&_&&(e.formMode==="raw"?!0:M),C=e.connected&&!e.applying&&!e.updating;return r`
|
|
660
|
+
`}const th=new Set(["title","description","default","nullable"]);function nh(e){return Object.keys(e??{}).filter(n=>!th.has(n)).length===0}function wr(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function $r(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:$t(e,[])}function $t(e,t){const n=new Set,s={...e},i=xn(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const c=sh(e,t);return c||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=ue(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:c,nullable:l}=wr(s.enum);s.enum=c,l&&(s.nullable=!0),c.length===0&&n.add(i)}if(o==="object"){const c=e.properties??{},l={};for(const[p,d]of Object.entries(c)){const u=$t(d,[...t,p]);u.schema&&(l[p]=u.schema);for(const g of u.unsupportedPaths)n.add(g)}if(s.properties=l,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!nh(e.additionalProperties)){const p=$t(e.additionalProperties,[...t,"*"]);s.additionalProperties=p.schema??e.additionalProperties,p.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const c=Array.isArray(e.items)?e.items[0]:e.items;if(!c)n.add(i);else{const l=$t(c,[...t,"*"]);s.items=l.schema??c,l.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function sh(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const c of n){if(!c||typeof c!="object")return null;if(Array.isArray(c.enum)){const{enumValues:l,nullable:p}=wr(c.enum);s.push(...l),p&&(a=!0);continue}if("const"in c){if(c.const==null){a=!0;continue}s.push(c.const);continue}if(ue(c)==="null"){a=!0;continue}i.push(c)}if(s.length>0&&i.length===0){const c=[];for(const l of s)c.some(p=>Object.is(p,l))||c.push(l);return{schema:{...e,enum:c,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const c=$t(i[0],t);return c.schema&&(c.schema.nullable=a||c.schema.nullable),c}const o=["string","number","integer","boolean"];return i.length>0&&s.length===0&&i.every(c=>c.type&&o.includes(String(c.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}const Es={all:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>`,env:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},Ha=[{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"}],za="__all__";function ja(e){return Es[e]??Es.default}function ih(e,t){const n=pi[e];return n||{label:t?.title??we(e),description:t?.description??""}}function ah(e){const{key:t,schema:n,uiHints:s}=e;if(!n||ue(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const c=te([t,a],s),l=c?.label??o.title??we(a),p=c?.help??o.description??"",d=c?.order??50;return{key:a,label:l,description:p,order:d}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function oh(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const c=i,l=a,p=new Set([...Object.keys(c),...Object.keys(l)]);for(const d of p)s(c[d],l[d],o?`${o}.${d}`:d)}return s(e,t,""),n}function qa(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 rh(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=$r(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=Ha.filter(E=>E.key in i),o=new Set(Ha.map(E=>E.key)),c=Object.keys(i).filter(E=>!o.has(E)).map(E=>({key:E,label:E.charAt(0).toUpperCase()+E.slice(1)})),l=[...a,...c],p=e.activeSection&&n.schema&&ue(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,d=e.activeSection?ih(e.activeSection,p):null,u=e.activeSection?ah({key:e.activeSection,schema:p,uiHints:e.uiHints}):[],g=e.formMode==="form"&&!!e.activeSection&&u.length>0,v=e.activeSubsection===za,w=e.searchQuery||v?null:e.activeSubsection??u[0]?.key??null,$=e.formMode==="form"?oh(e.originalValue,e.formValue):[],k=e.formMode==="raw"&&e.raw!==e.originalRaw,_=e.formMode==="form"?$.length>0:k,M=!!e.formValue&&!e.loading&&!!n.schema,P=e.connected&&!e.saving&&_&&(e.formMode==="raw"?!0:M),L=e.connected&&!e.applying&&!e.updating&&_&&(e.formMode==="raw"?!0:M),T=e.connected&&!e.applying&&!e.updating;return r`
|
|
674
661
|
<div class="config-layout">
|
|
675
662
|
<!-- Sidebar -->
|
|
676
663
|
<aside class="config-sidebar">
|
|
@@ -697,7 +684,7 @@ ${e.sidebarContent}
|
|
|
697
684
|
class="config-search__clear"
|
|
698
685
|
@click=${()=>e.onSearchChange("")}
|
|
699
686
|
>×</button>
|
|
700
|
-
`:
|
|
687
|
+
`:f}
|
|
701
688
|
</div>
|
|
702
689
|
|
|
703
690
|
<!-- Section nav -->
|
|
@@ -706,7 +693,7 @@ ${e.sidebarContent}
|
|
|
706
693
|
class="config-nav__item ${e.activeSection===null?"active":""}"
|
|
707
694
|
@click=${()=>e.onSectionChange(null)}
|
|
708
695
|
>
|
|
709
|
-
<span class="config-nav__icon">${
|
|
696
|
+
<span class="config-nav__icon">${Es.all}</span>
|
|
710
697
|
<span class="config-nav__label">All Settings</span>
|
|
711
698
|
</button>
|
|
712
699
|
${l.map(E=>r`
|
|
@@ -714,7 +701,7 @@ ${e.sidebarContent}
|
|
|
714
701
|
class="config-nav__item ${e.activeSection===E.key?"active":""}"
|
|
715
702
|
@click=${()=>e.onSectionChange(E.key)}
|
|
716
703
|
>
|
|
717
|
-
<span class="config-nav__icon">${
|
|
704
|
+
<span class="config-nav__icon">${ja(E.key)}</span>
|
|
718
705
|
<span class="config-nav__label">${E.label}</span>
|
|
719
706
|
</button>
|
|
720
707
|
`)}
|
|
@@ -757,21 +744,21 @@ ${e.sidebarContent}
|
|
|
757
744
|
</button>
|
|
758
745
|
<button
|
|
759
746
|
class="btn btn--sm primary"
|
|
760
|
-
?disabled=${!
|
|
747
|
+
?disabled=${!P}
|
|
761
748
|
@click=${e.onSave}
|
|
762
749
|
>
|
|
763
750
|
${e.saving?"Saving…":"Save"}
|
|
764
751
|
</button>
|
|
765
752
|
<button
|
|
766
753
|
class="btn btn--sm"
|
|
767
|
-
?disabled=${!
|
|
754
|
+
?disabled=${!L}
|
|
768
755
|
@click=${e.onApply}
|
|
769
756
|
>
|
|
770
757
|
${e.applying?"Applying…":"Apply"}
|
|
771
758
|
</button>
|
|
772
759
|
<button
|
|
773
760
|
class="btn btn--sm"
|
|
774
|
-
?disabled=${!
|
|
761
|
+
?disabled=${!T}
|
|
775
762
|
@click=${e.onUpdate}
|
|
776
763
|
>
|
|
777
764
|
${e.updating?"Updating…":"Update"}
|
|
@@ -793,37 +780,37 @@ ${e.sidebarContent}
|
|
|
793
780
|
<div class="config-diff__item">
|
|
794
781
|
<div class="config-diff__path">${E.path}</div>
|
|
795
782
|
<div class="config-diff__values">
|
|
796
|
-
<span class="config-diff__from">${
|
|
783
|
+
<span class="config-diff__from">${qa(E.from)}</span>
|
|
797
784
|
<span class="config-diff__arrow">→</span>
|
|
798
|
-
<span class="config-diff__to">${
|
|
785
|
+
<span class="config-diff__to">${qa(E.to)}</span>
|
|
799
786
|
</div>
|
|
800
787
|
</div>
|
|
801
788
|
`)}
|
|
802
789
|
</div>
|
|
803
790
|
</details>
|
|
804
|
-
`:
|
|
791
|
+
`:f}
|
|
805
792
|
|
|
806
793
|
${d&&e.formMode==="form"?r`
|
|
807
794
|
<div class="config-section-hero">
|
|
808
|
-
<div class="config-section-hero__icon">${
|
|
795
|
+
<div class="config-section-hero__icon">${ja(e.activeSection??"")}</div>
|
|
809
796
|
<div class="config-section-hero__text">
|
|
810
797
|
<div class="config-section-hero__title">${d.label}</div>
|
|
811
|
-
${d.description?r`<div class="config-section-hero__desc">${d.description}</div>`:
|
|
798
|
+
${d.description?r`<div class="config-section-hero__desc">${d.description}</div>`:f}
|
|
812
799
|
</div>
|
|
813
800
|
</div>
|
|
814
|
-
`:
|
|
801
|
+
`:f}
|
|
815
802
|
|
|
816
|
-
${
|
|
803
|
+
${g?r`
|
|
817
804
|
<div class="config-subnav">
|
|
818
805
|
<button
|
|
819
|
-
class="config-subnav__item ${
|
|
820
|
-
@click=${()=>e.onSubsectionChange(
|
|
806
|
+
class="config-subnav__item ${w===null?"active":""}"
|
|
807
|
+
@click=${()=>e.onSubsectionChange(za)}
|
|
821
808
|
>
|
|
822
809
|
All
|
|
823
810
|
</button>
|
|
824
|
-
${
|
|
811
|
+
${u.map(E=>r`
|
|
825
812
|
<button
|
|
826
|
-
class="config-subnav__item ${
|
|
813
|
+
class="config-subnav__item ${w===E.key?"active":""}"
|
|
827
814
|
title=${E.description||E.label}
|
|
828
815
|
@click=${()=>e.onSubsectionChange(E.key)}
|
|
829
816
|
>
|
|
@@ -831,7 +818,7 @@ ${e.sidebarContent}
|
|
|
831
818
|
</button>
|
|
832
819
|
`)}
|
|
833
820
|
</div>
|
|
834
|
-
`:
|
|
821
|
+
`:f}
|
|
835
822
|
|
|
836
823
|
<!-- Form content -->
|
|
837
824
|
<div class="config-content">
|
|
@@ -839,11 +826,11 @@ ${e.sidebarContent}
|
|
|
839
826
|
${e.schemaLoading?r`<div class="config-loading">
|
|
840
827
|
<div class="config-loading__spinner"></div>
|
|
841
828
|
<span>Loading schema…</span>
|
|
842
|
-
</div>`:
|
|
829
|
+
</div>`:eh({schema:n.schema,uiHints:e.uiHints,value:e.formValue,disabled:e.loading||!e.formValue,unsupportedPaths:n.unsupportedPaths,onPatch:e.onFormPatch,searchQuery:e.searchQuery,activeSection:e.activeSection,activeSubsection:w})}
|
|
843
830
|
${s?r`<div class="callout danger" style="margin-top: 12px;">
|
|
844
831
|
Form view can't safely edit some fields.
|
|
845
832
|
Use Raw to avoid losing config entries.
|
|
846
|
-
</div>`:
|
|
833
|
+
</div>`:f}
|
|
847
834
|
`:r`
|
|
848
835
|
<label class="field config-raw-field">
|
|
849
836
|
<span>Raw JSON5</span>
|
|
@@ -857,16 +844,16 @@ ${e.sidebarContent}
|
|
|
857
844
|
|
|
858
845
|
${e.issues.length>0?r`<div class="callout danger" style="margin-top: 12px;">
|
|
859
846
|
<pre class="code-block">${JSON.stringify(e.issues,null,2)}</pre>
|
|
860
|
-
</div>`:
|
|
847
|
+
</div>`:f}
|
|
861
848
|
</main>
|
|
862
849
|
</div>
|
|
863
|
-
`}function
|
|
850
|
+
`}function lh(e){if(!e&&e!==0)return"n/a";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function ch(e,t){const n=t.snapshot,s=n?.channels;if(!n||!s)return!1;const i=s[e],a=typeof i?.configured=="boolean"&&i.configured,o=typeof i?.running=="boolean"&&i.running,c=typeof i?.connected=="boolean"&&i.connected,p=(n.channelAccounts?.[e]??[]).some(d=>d.configured||d.running||d.connected);return a||o||c||p}function dh(e,t){return t?.[e]?.length??0}function xr(e,t){const n=dh(e,t);return n<2?f:r`<div class="account-count">Accounts (${n})</div>`}function uh(e,t){let n=e;for(const s of t){if(!n)return null;const i=ue(n);if(i==="object"){const a=n.properties??{};if(typeof s=="string"&&a[s]){n=a[s];continue}const o=n.additionalProperties;if(typeof s=="string"&&o&&typeof o=="object"){n=o;continue}return null}if(i==="array"){if(typeof s!="number")return null;n=(Array.isArray(n.items)?n.items[0]:n.items)??null;continue}return null}return n}function ph(e,t){const s=(e.channels??{})[t],i=e[t];return(s&&typeof s=="object"?s:null)??(i&&typeof i=="object"?i:null)??{}}function hh(e){const t=$r(e.schema),n=t.schema;if(!n)return r`<div class="callout danger">Schema unavailable. Use Raw.</div>`;const s=uh(n,["channels",e.channelId]);if(!s)return r`<div class="callout danger">Channel config schema unavailable.</div>`;const i=e.configValue??{},a=ph(i,e.channelId);return r`
|
|
864
851
|
<div class="config-form">
|
|
865
|
-
${
|
|
852
|
+
${be({schema:s,value:a,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
|
|
866
853
|
</div>
|
|
867
|
-
`}function
|
|
854
|
+
`}function $e(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return r`
|
|
868
855
|
<div style="margin-top: 16px;">
|
|
869
|
-
${n.configSchemaLoading?r`<div class="muted">Loading config schema…</div>`:
|
|
856
|
+
${n.configSchemaLoading?r`<div class="muted">Loading config schema…</div>`:hh({channelId:t,configValue:n.configForm,schema:n.configSchema,uiHints:n.configUiHints,disabled:s,onPatch:n.onConfigPatch})}
|
|
870
857
|
<div class="row" style="margin-top: 12px;">
|
|
871
858
|
<button
|
|
872
859
|
class="btn primary"
|
|
@@ -884,7 +871,7 @@ ${e.sidebarContent}
|
|
|
884
871
|
</button>
|
|
885
872
|
</div>
|
|
886
873
|
</div>
|
|
887
|
-
`}function
|
|
874
|
+
`}function fh(e){const{props:t,discord:n,accountCountLabel:s}=e;return r`
|
|
888
875
|
<div class="card">
|
|
889
876
|
<div class="card-title">Discord</div>
|
|
890
877
|
<div class="card-sub">Bot status and channel configuration.</div>
|
|
@@ -901,24 +888,24 @@ ${e.sidebarContent}
|
|
|
901
888
|
</div>
|
|
902
889
|
<div>
|
|
903
890
|
<span class="label">Last start</span>
|
|
904
|
-
<span>${n?.lastStartAt?
|
|
891
|
+
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
905
892
|
</div>
|
|
906
893
|
<div>
|
|
907
894
|
<span class="label">Last probe</span>
|
|
908
|
-
<span>${n?.lastProbeAt?
|
|
895
|
+
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
909
896
|
</div>
|
|
910
897
|
</div>
|
|
911
898
|
|
|
912
899
|
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
913
900
|
${n.lastError}
|
|
914
|
-
</div>`:
|
|
901
|
+
</div>`:f}
|
|
915
902
|
|
|
916
903
|
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
917
904
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
918
905
|
${n.probe.status??""} ${n.probe.error??""}
|
|
919
|
-
</div>`:
|
|
906
|
+
</div>`:f}
|
|
920
907
|
|
|
921
|
-
${
|
|
908
|
+
${$e({channelId:"discord",props:t})}
|
|
922
909
|
|
|
923
910
|
<div class="row" style="margin-top: 12px;">
|
|
924
911
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -926,7 +913,7 @@ ${e.sidebarContent}
|
|
|
926
913
|
</button>
|
|
927
914
|
</div>
|
|
928
915
|
</div>
|
|
929
|
-
`}function
|
|
916
|
+
`}function gh(e){const{props:t,googleChat:n,accountCountLabel:s}=e;return r`
|
|
930
917
|
<div class="card">
|
|
931
918
|
<div class="card-title">Google Chat</div>
|
|
932
919
|
<div class="card-sub">Chat API webhook status and channel configuration.</div>
|
|
@@ -953,24 +940,24 @@ ${e.sidebarContent}
|
|
|
953
940
|
</div>
|
|
954
941
|
<div>
|
|
955
942
|
<span class="label">Last start</span>
|
|
956
|
-
<span>${n?.lastStartAt?
|
|
943
|
+
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
957
944
|
</div>
|
|
958
945
|
<div>
|
|
959
946
|
<span class="label">Last probe</span>
|
|
960
|
-
<span>${n?.lastProbeAt?
|
|
947
|
+
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
961
948
|
</div>
|
|
962
949
|
</div>
|
|
963
950
|
|
|
964
951
|
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
965
952
|
${n.lastError}
|
|
966
|
-
</div>`:
|
|
953
|
+
</div>`:f}
|
|
967
954
|
|
|
968
955
|
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
969
956
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
970
957
|
${n.probe.status??""} ${n.probe.error??""}
|
|
971
|
-
</div>`:
|
|
958
|
+
</div>`:f}
|
|
972
959
|
|
|
973
|
-
${
|
|
960
|
+
${$e({channelId:"googlechat",props:t})}
|
|
974
961
|
|
|
975
962
|
<div class="row" style="margin-top: 12px;">
|
|
976
963
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -978,7 +965,7 @@ ${e.sidebarContent}
|
|
|
978
965
|
</button>
|
|
979
966
|
</div>
|
|
980
967
|
</div>
|
|
981
|
-
`}function
|
|
968
|
+
`}function vh(e){const{props:t,imessage:n,accountCountLabel:s}=e;return r`
|
|
982
969
|
<div class="card">
|
|
983
970
|
<div class="card-title">iMessage</div>
|
|
984
971
|
<div class="card-sub">macOS bridge status and channel configuration.</div>
|
|
@@ -995,24 +982,24 @@ ${e.sidebarContent}
|
|
|
995
982
|
</div>
|
|
996
983
|
<div>
|
|
997
984
|
<span class="label">Last start</span>
|
|
998
|
-
<span>${n?.lastStartAt?
|
|
985
|
+
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
999
986
|
</div>
|
|
1000
987
|
<div>
|
|
1001
988
|
<span class="label">Last probe</span>
|
|
1002
|
-
<span>${n?.lastProbeAt?
|
|
989
|
+
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
1003
990
|
</div>
|
|
1004
991
|
</div>
|
|
1005
992
|
|
|
1006
993
|
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1007
994
|
${n.lastError}
|
|
1008
|
-
</div>`:
|
|
995
|
+
</div>`:f}
|
|
1009
996
|
|
|
1010
997
|
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
1011
998
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
1012
999
|
${n.probe.error??""}
|
|
1013
|
-
</div>`:
|
|
1000
|
+
</div>`:f}
|
|
1014
1001
|
|
|
1015
|
-
${
|
|
1002
|
+
${$e({channelId:"imessage",props:t})}
|
|
1016
1003
|
|
|
1017
1004
|
<div class="row" style="margin-top: 12px;">
|
|
1018
1005
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -1020,23 +1007,23 @@ ${e.sidebarContent}
|
|
|
1020
1007
|
</button>
|
|
1021
1008
|
</div>
|
|
1022
1009
|
</div>
|
|
1023
|
-
`}function
|
|
1010
|
+
`}function mh(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 yh(e){const{state:t,callbacks:n,accountId:s}=e,i=mh(t),a=(c,l,p={})=>{const{type:d="text",placeholder:u,maxLength:g,help:v}=p,w=t.values[c]??"",$=t.fieldErrors[c],k=`nostr-profile-${c}`;return d==="textarea"?r`
|
|
1024
1011
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
1025
1012
|
<label for="${k}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
1026
1013
|
${l}
|
|
1027
1014
|
</label>
|
|
1028
1015
|
<textarea
|
|
1029
1016
|
id="${k}"
|
|
1030
|
-
.value=${
|
|
1031
|
-
placeholder=${
|
|
1032
|
-
maxlength=${
|
|
1017
|
+
.value=${w}
|
|
1018
|
+
placeholder=${u??""}
|
|
1019
|
+
maxlength=${g??2e3}
|
|
1033
1020
|
rows="3"
|
|
1034
1021
|
style="width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 4px; resize: vertical; font-family: inherit;"
|
|
1035
1022
|
@input=${_=>{const M=_.target;n.onFieldChange(c,M.value)}}
|
|
1036
1023
|
?disabled=${t.saving}
|
|
1037
1024
|
></textarea>
|
|
1038
|
-
${
|
|
1039
|
-
${$?r`<div style="font-size: 12px; color: var(--danger-color); margin-top: 2px;">${$}</div>`:
|
|
1025
|
+
${v?r`<div style="font-size: 12px; color: var(--text-muted); margin-top: 2px;">${v}</div>`:f}
|
|
1026
|
+
${$?r`<div style="font-size: 12px; color: var(--danger-color); margin-top: 2px;">${$}</div>`:f}
|
|
1040
1027
|
</div>
|
|
1041
1028
|
`:r`
|
|
1042
1029
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
@@ -1046,15 +1033,15 @@ ${e.sidebarContent}
|
|
|
1046
1033
|
<input
|
|
1047
1034
|
id="${k}"
|
|
1048
1035
|
type=${d}
|
|
1049
|
-
.value=${
|
|
1050
|
-
placeholder=${
|
|
1051
|
-
maxlength=${
|
|
1036
|
+
.value=${w}
|
|
1037
|
+
placeholder=${u??""}
|
|
1038
|
+
maxlength=${g??256}
|
|
1052
1039
|
style="width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 4px;"
|
|
1053
1040
|
@input=${_=>{const M=_.target;n.onFieldChange(c,M.value)}}
|
|
1054
1041
|
?disabled=${t.saving}
|
|
1055
1042
|
/>
|
|
1056
|
-
${
|
|
1057
|
-
${$?r`<div style="font-size: 12px; color: var(--danger-color); margin-top: 2px;">${$}</div>`:
|
|
1043
|
+
${v?r`<div style="font-size: 12px; color: var(--text-muted); margin-top: 2px;">${v}</div>`:f}
|
|
1044
|
+
${$?r`<div style="font-size: 12px; color: var(--danger-color); margin-top: 2px;">${$}</div>`:f}
|
|
1058
1045
|
</div>
|
|
1059
1046
|
`},o=()=>{const c=t.values.picture;return c?r`
|
|
1060
1047
|
<div style="margin-bottom: 12px;">
|
|
@@ -1062,20 +1049,20 @@ ${e.sidebarContent}
|
|
|
1062
1049
|
src=${c}
|
|
1063
1050
|
alt="Profile picture preview"
|
|
1064
1051
|
style="max-width: 80px; max-height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color);"
|
|
1065
|
-
@error=${l=>{const
|
|
1066
|
-
@load=${l=>{const
|
|
1052
|
+
@error=${l=>{const p=l.target;p.style.display="none"}}
|
|
1053
|
+
@load=${l=>{const p=l.target;p.style.display="block"}}
|
|
1067
1054
|
/>
|
|
1068
1055
|
</div>
|
|
1069
|
-
`:
|
|
1056
|
+
`:f};return r`
|
|
1070
1057
|
<div class="nostr-profile-form" style="padding: 16px; background: var(--bg-secondary); border-radius: 8px; margin-top: 12px;">
|
|
1071
1058
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;">
|
|
1072
1059
|
<div style="font-weight: 600; font-size: 16px;">Edit Profile</div>
|
|
1073
1060
|
<div style="font-size: 12px; color: var(--text-muted);">Account: ${s}</div>
|
|
1074
1061
|
</div>
|
|
1075
1062
|
|
|
1076
|
-
${t.error?r`<div class="callout danger" style="margin-bottom: 12px;">${t.error}</div>`:
|
|
1063
|
+
${t.error?r`<div class="callout danger" style="margin-bottom: 12px;">${t.error}</div>`:f}
|
|
1077
1064
|
|
|
1078
|
-
${t.success?r`<div class="callout success" style="margin-bottom: 12px;">${t.success}</div>`:
|
|
1065
|
+
${t.success?r`<div class="callout success" style="margin-bottom: 12px;">${t.success}</div>`:f}
|
|
1079
1066
|
|
|
1080
1067
|
${o()}
|
|
1081
1068
|
|
|
@@ -1099,7 +1086,7 @@ ${e.sidebarContent}
|
|
|
1099
1086
|
|
|
1100
1087
|
${a("lud16","Lightning Address",{placeholder:"you@getalby.com",help:"Lightning address for tips (LUD-16)"})}
|
|
1101
1088
|
</div>
|
|
1102
|
-
`:
|
|
1089
|
+
`:f}
|
|
1103
1090
|
|
|
1104
1091
|
<div style="display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;">
|
|
1105
1092
|
<button
|
|
@@ -1136,12 +1123,12 @@ ${e.sidebarContent}
|
|
|
1136
1123
|
|
|
1137
1124
|
${i?r`<div style="font-size: 12px; color: var(--warning-color); margin-top: 8px;">
|
|
1138
1125
|
You have unsaved changes
|
|
1139
|
-
</div>`:
|
|
1126
|
+
</div>`:f}
|
|
1140
1127
|
</div>
|
|
1141
|
-
`}function
|
|
1128
|
+
`}function bh(e){const t={name:e?.name??"",displayName:e?.displayName??"",about:e?.about??"",picture:e?.picture??"",banner:e?.banner??"",website:e?.website??"",nip05:e?.nip05??"",lud16:e?.lud16??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e?.banner||e?.website||e?.nip05||e?.lud16)}}function Va(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:"n/a"}function wh(e){const{props:t,nostr:n,nostrAccounts:s,accountCountLabel:i,profileFormState:a,profileFormCallbacks:o,onEditProfile:c}=e,l=s[0],p=n?.configured??l?.configured??!1,d=n?.running??l?.running??!1,u=n?.publicKey??l?.publicKey,g=n?.lastStartAt??l?.lastStartAt??null,v=n?.lastError??l?.lastError??null,w=s.length>1,$=a!=null,k=M=>{const P=M.publicKey,L=M.profile,T=L?.displayName??L?.name??M.name??M.accountId;return r`
|
|
1142
1129
|
<div class="account-card">
|
|
1143
1130
|
<div class="account-card-header">
|
|
1144
|
-
<div class="account-card-title">${
|
|
1131
|
+
<div class="account-card-title">${T}</div>
|
|
1145
1132
|
<div class="account-card-id">${M.accountId}</div>
|
|
1146
1133
|
</div>
|
|
1147
1134
|
<div class="status-list account-card-status">
|
|
@@ -1155,22 +1142,22 @@ ${e.sidebarContent}
|
|
|
1155
1142
|
</div>
|
|
1156
1143
|
<div>
|
|
1157
1144
|
<span class="label">Public Key</span>
|
|
1158
|
-
<span class="monospace" title="${
|
|
1145
|
+
<span class="monospace" title="${P??""}">${Va(P)}</span>
|
|
1159
1146
|
</div>
|
|
1160
1147
|
<div>
|
|
1161
1148
|
<span class="label">Last inbound</span>
|
|
1162
|
-
<span>${M.lastInboundAt?
|
|
1149
|
+
<span>${M.lastInboundAt?O(M.lastInboundAt):"n/a"}</span>
|
|
1163
1150
|
</div>
|
|
1164
1151
|
${M.lastError?r`
|
|
1165
1152
|
<div class="account-card-error">${M.lastError}</div>
|
|
1166
|
-
`:
|
|
1153
|
+
`:f}
|
|
1167
1154
|
</div>
|
|
1168
1155
|
</div>
|
|
1169
|
-
`},_=()=>{if($&&o)return
|
|
1156
|
+
`},_=()=>{if($&&o)return yh({state:a,callbacks:o,accountId:s[0]?.accountId??"default"});const M=l?.profile??n?.profile,{name:P,displayName:L,about:T,picture:E,nip05:pe}=M??{},kn=P||L||T||E||pe;return r`
|
|
1170
1157
|
<div style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
|
|
1171
1158
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
|
1172
1159
|
<div style="font-weight: 500;">Profile</div>
|
|
1173
|
-
${
|
|
1160
|
+
${p?r`
|
|
1174
1161
|
<button
|
|
1175
1162
|
class="btn btn-sm"
|
|
1176
1163
|
@click=${c}
|
|
@@ -1178,9 +1165,9 @@ ${e.sidebarContent}
|
|
|
1178
1165
|
>
|
|
1179
1166
|
Edit Profile
|
|
1180
1167
|
</button>
|
|
1181
|
-
`:
|
|
1168
|
+
`:f}
|
|
1182
1169
|
</div>
|
|
1183
|
-
${
|
|
1170
|
+
${kn?r`
|
|
1184
1171
|
<div class="status-list">
|
|
1185
1172
|
${E?r`
|
|
1186
1173
|
<div style="margin-bottom: 8px;">
|
|
@@ -1188,14 +1175,14 @@ ${e.sidebarContent}
|
|
|
1188
1175
|
src=${E}
|
|
1189
1176
|
alt="Profile picture"
|
|
1190
1177
|
style="width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color);"
|
|
1191
|
-
@error=${
|
|
1178
|
+
@error=${An=>{An.target.style.display="none"}}
|
|
1192
1179
|
/>
|
|
1193
1180
|
</div>
|
|
1194
|
-
`:
|
|
1195
|
-
${
|
|
1196
|
-
${
|
|
1197
|
-
${
|
|
1198
|
-
${
|
|
1181
|
+
`:f}
|
|
1182
|
+
${P?r`<div><span class="label">Name</span><span>${P}</span></div>`:f}
|
|
1183
|
+
${L?r`<div><span class="label">Display Name</span><span>${L}</span></div>`:f}
|
|
1184
|
+
${T?r`<div><span class="label">About</span><span style="max-width: 300px; overflow: hidden; text-overflow: ellipsis;">${T}</span></div>`:f}
|
|
1185
|
+
${pe?r`<div><span class="label">NIP-05</span><span>${pe}</span></div>`:f}
|
|
1199
1186
|
</div>
|
|
1200
1187
|
`:r`
|
|
1201
1188
|
<div style="color: var(--text-muted); font-size: 13px;">
|
|
@@ -1209,7 +1196,7 @@ ${e.sidebarContent}
|
|
|
1209
1196
|
<div class="card-sub">Decentralized DMs via Nostr relays (NIP-04).</div>
|
|
1210
1197
|
${i}
|
|
1211
1198
|
|
|
1212
|
-
${
|
|
1199
|
+
${w?r`
|
|
1213
1200
|
<div class="account-card-list">
|
|
1214
1201
|
${s.map(M=>k(M))}
|
|
1215
1202
|
</div>
|
|
@@ -1217,7 +1204,7 @@ ${e.sidebarContent}
|
|
|
1217
1204
|
<div class="status-list" style="margin-top: 16px;">
|
|
1218
1205
|
<div>
|
|
1219
1206
|
<span class="label">Configured</span>
|
|
1220
|
-
<span>${
|
|
1207
|
+
<span>${p?"Yes":"No"}</span>
|
|
1221
1208
|
</div>
|
|
1222
1209
|
<div>
|
|
1223
1210
|
<span class="label">Running</span>
|
|
@@ -1225,28 +1212,28 @@ ${e.sidebarContent}
|
|
|
1225
1212
|
</div>
|
|
1226
1213
|
<div>
|
|
1227
1214
|
<span class="label">Public Key</span>
|
|
1228
|
-
<span class="monospace" title="${
|
|
1229
|
-
>${
|
|
1215
|
+
<span class="monospace" title="${u??""}"
|
|
1216
|
+
>${Va(u)}</span
|
|
1230
1217
|
>
|
|
1231
1218
|
</div>
|
|
1232
1219
|
<div>
|
|
1233
1220
|
<span class="label">Last start</span>
|
|
1234
|
-
<span>${
|
|
1221
|
+
<span>${g?O(g):"n/a"}</span>
|
|
1235
1222
|
</div>
|
|
1236
1223
|
</div>
|
|
1237
1224
|
`}
|
|
1238
1225
|
|
|
1239
|
-
${
|
|
1226
|
+
${v?r`<div class="callout danger" style="margin-top: 12px;">${v}</div>`:f}
|
|
1240
1227
|
|
|
1241
1228
|
${_()}
|
|
1242
1229
|
|
|
1243
|
-
${
|
|
1230
|
+
${$e({channelId:"nostr",props:t})}
|
|
1244
1231
|
|
|
1245
1232
|
<div class="row" style="margin-top: 12px;">
|
|
1246
1233
|
<button class="btn" @click=${()=>t.onRefresh(!1)}>Refresh</button>
|
|
1247
1234
|
</div>
|
|
1248
1235
|
</div>
|
|
1249
|
-
`}function
|
|
1236
|
+
`}function $h(e){const{props:t,signal:n,accountCountLabel:s}=e;return r`
|
|
1250
1237
|
<div class="card">
|
|
1251
1238
|
<div class="card-title">Signal</div>
|
|
1252
1239
|
<div class="card-sub">signal-cli status and channel configuration.</div>
|
|
@@ -1267,24 +1254,24 @@ ${e.sidebarContent}
|
|
|
1267
1254
|
</div>
|
|
1268
1255
|
<div>
|
|
1269
1256
|
<span class="label">Last start</span>
|
|
1270
|
-
<span>${n?.lastStartAt?
|
|
1257
|
+
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
1271
1258
|
</div>
|
|
1272
1259
|
<div>
|
|
1273
1260
|
<span class="label">Last probe</span>
|
|
1274
|
-
<span>${n?.lastProbeAt?
|
|
1261
|
+
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
1275
1262
|
</div>
|
|
1276
1263
|
</div>
|
|
1277
1264
|
|
|
1278
1265
|
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1279
1266
|
${n.lastError}
|
|
1280
|
-
</div>`:
|
|
1267
|
+
</div>`:f}
|
|
1281
1268
|
|
|
1282
1269
|
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
1283
1270
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
1284
1271
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1285
|
-
</div>`:
|
|
1272
|
+
</div>`:f}
|
|
1286
1273
|
|
|
1287
|
-
${
|
|
1274
|
+
${$e({channelId:"signal",props:t})}
|
|
1288
1275
|
|
|
1289
1276
|
<div class="row" style="margin-top: 12px;">
|
|
1290
1277
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -1292,7 +1279,7 @@ ${e.sidebarContent}
|
|
|
1292
1279
|
</button>
|
|
1293
1280
|
</div>
|
|
1294
1281
|
</div>
|
|
1295
|
-
`}function
|
|
1282
|
+
`}function xh(e){const{props:t,slack:n,accountCountLabel:s}=e;return r`
|
|
1296
1283
|
<div class="card">
|
|
1297
1284
|
<div class="card-title">Slack</div>
|
|
1298
1285
|
<div class="card-sub">Socket mode status and channel configuration.</div>
|
|
@@ -1309,24 +1296,24 @@ ${e.sidebarContent}
|
|
|
1309
1296
|
</div>
|
|
1310
1297
|
<div>
|
|
1311
1298
|
<span class="label">Last start</span>
|
|
1312
|
-
<span>${n?.lastStartAt?
|
|
1299
|
+
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
1313
1300
|
</div>
|
|
1314
1301
|
<div>
|
|
1315
1302
|
<span class="label">Last probe</span>
|
|
1316
|
-
<span>${n?.lastProbeAt?
|
|
1303
|
+
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
1317
1304
|
</div>
|
|
1318
1305
|
</div>
|
|
1319
1306
|
|
|
1320
1307
|
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1321
1308
|
${n.lastError}
|
|
1322
|
-
</div>`:
|
|
1309
|
+
</div>`:f}
|
|
1323
1310
|
|
|
1324
1311
|
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
1325
1312
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
1326
1313
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1327
|
-
</div>`:
|
|
1314
|
+
</div>`:f}
|
|
1328
1315
|
|
|
1329
|
-
${
|
|
1316
|
+
${$e({channelId:"slack",props:t})}
|
|
1330
1317
|
|
|
1331
1318
|
<div class="row" style="margin-top: 12px;">
|
|
1332
1319
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -1334,11 +1321,11 @@ ${e.sidebarContent}
|
|
|
1334
1321
|
</button>
|
|
1335
1322
|
</div>
|
|
1336
1323
|
</div>
|
|
1337
|
-
`}function
|
|
1324
|
+
`}function kh(e){const{props:t,telegram:n,telegramAccounts:s,accountCountLabel:i}=e,a=s.length>1,o=c=>{const p=c.probe?.bot?.username,d=c.name||c.accountId;return r`
|
|
1338
1325
|
<div class="account-card">
|
|
1339
1326
|
<div class="account-card-header">
|
|
1340
1327
|
<div class="account-card-title">
|
|
1341
|
-
${
|
|
1328
|
+
${p?`@${p}`:d}
|
|
1342
1329
|
</div>
|
|
1343
1330
|
<div class="account-card-id">${c.accountId}</div>
|
|
1344
1331
|
</div>
|
|
@@ -1353,13 +1340,13 @@ ${e.sidebarContent}
|
|
|
1353
1340
|
</div>
|
|
1354
1341
|
<div>
|
|
1355
1342
|
<span class="label">Last inbound</span>
|
|
1356
|
-
<span>${c.lastInboundAt?
|
|
1343
|
+
<span>${c.lastInboundAt?O(c.lastInboundAt):"n/a"}</span>
|
|
1357
1344
|
</div>
|
|
1358
1345
|
${c.lastError?r`
|
|
1359
1346
|
<div class="account-card-error">
|
|
1360
1347
|
${c.lastError}
|
|
1361
1348
|
</div>
|
|
1362
|
-
`:
|
|
1349
|
+
`:f}
|
|
1363
1350
|
</div>
|
|
1364
1351
|
</div>
|
|
1365
1352
|
`};return r`
|
|
@@ -1388,25 +1375,25 @@ ${e.sidebarContent}
|
|
|
1388
1375
|
</div>
|
|
1389
1376
|
<div>
|
|
1390
1377
|
<span class="label">Last start</span>
|
|
1391
|
-
<span>${n?.lastStartAt?
|
|
1378
|
+
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
1392
1379
|
</div>
|
|
1393
1380
|
<div>
|
|
1394
1381
|
<span class="label">Last probe</span>
|
|
1395
|
-
<span>${n?.lastProbeAt?
|
|
1382
|
+
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
1396
1383
|
</div>
|
|
1397
1384
|
</div>
|
|
1398
1385
|
`}
|
|
1399
1386
|
|
|
1400
1387
|
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1401
1388
|
${n.lastError}
|
|
1402
|
-
</div>`:
|
|
1389
|
+
</div>`:f}
|
|
1403
1390
|
|
|
1404
1391
|
${n?.probe?r`<div class="callout" style="margin-top: 12px;">
|
|
1405
1392
|
Probe ${n.probe.ok?"ok":"failed"} ·
|
|
1406
1393
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1407
|
-
</div>`:
|
|
1394
|
+
</div>`:f}
|
|
1408
1395
|
|
|
1409
|
-
${
|
|
1396
|
+
${$e({channelId:"telegram",props:t})}
|
|
1410
1397
|
|
|
1411
1398
|
<div class="row" style="margin-top: 12px;">
|
|
1412
1399
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
@@ -1414,7 +1401,7 @@ ${e.sidebarContent}
|
|
|
1414
1401
|
</button>
|
|
1415
1402
|
</div>
|
|
1416
1403
|
</div>
|
|
1417
|
-
`}function
|
|
1404
|
+
`}function Ah(e){const{props:t,whatsapp:n,accountCountLabel:s}=e;return r`
|
|
1418
1405
|
<div class="card">
|
|
1419
1406
|
<div class="card-title">WhatsApp</div>
|
|
1420
1407
|
<div class="card-sub">Link WhatsApp Web and monitor connection health.</div>
|
|
@@ -1440,34 +1427,34 @@ ${e.sidebarContent}
|
|
|
1440
1427
|
<div>
|
|
1441
1428
|
<span class="label">Last connect</span>
|
|
1442
1429
|
<span>
|
|
1443
|
-
${n?.lastConnectedAt?
|
|
1430
|
+
${n?.lastConnectedAt?O(n.lastConnectedAt):"n/a"}
|
|
1444
1431
|
</span>
|
|
1445
1432
|
</div>
|
|
1446
1433
|
<div>
|
|
1447
1434
|
<span class="label">Last message</span>
|
|
1448
1435
|
<span>
|
|
1449
|
-
${n?.lastMessageAt?
|
|
1436
|
+
${n?.lastMessageAt?O(n.lastMessageAt):"n/a"}
|
|
1450
1437
|
</span>
|
|
1451
1438
|
</div>
|
|
1452
1439
|
<div>
|
|
1453
1440
|
<span class="label">Auth age</span>
|
|
1454
1441
|
<span>
|
|
1455
|
-
${n?.authAgeMs!=null?
|
|
1442
|
+
${n?.authAgeMs!=null?lh(n.authAgeMs):"n/a"}
|
|
1456
1443
|
</span>
|
|
1457
1444
|
</div>
|
|
1458
1445
|
</div>
|
|
1459
1446
|
|
|
1460
1447
|
${n?.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1461
1448
|
${n.lastError}
|
|
1462
|
-
</div>`:
|
|
1449
|
+
</div>`:f}
|
|
1463
1450
|
|
|
1464
1451
|
${t.whatsappMessage?r`<div class="callout" style="margin-top: 12px;">
|
|
1465
1452
|
${t.whatsappMessage}
|
|
1466
|
-
</div>`:
|
|
1453
|
+
</div>`:f}
|
|
1467
1454
|
|
|
1468
1455
|
${t.whatsappQrDataUrl?r`<div class="qr-wrap">
|
|
1469
1456
|
<img src=${t.whatsappQrDataUrl} alt="WhatsApp QR" />
|
|
1470
|
-
</div>`:
|
|
1457
|
+
</div>`:f}
|
|
1471
1458
|
|
|
1472
1459
|
<div class="row" style="margin-top: 14px; flex-wrap: wrap;">
|
|
1473
1460
|
<button
|
|
@@ -1503,11 +1490,11 @@ ${e.sidebarContent}
|
|
|
1503
1490
|
</button>
|
|
1504
1491
|
</div>
|
|
1505
1492
|
|
|
1506
|
-
${
|
|
1493
|
+
${$e({channelId:"whatsapp",props:t})}
|
|
1507
1494
|
</div>
|
|
1508
|
-
`}function
|
|
1495
|
+
`}function Sh(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null;t?.googlechat;const a=t?.slack??null,o=t?.signal??null,c=t?.imessage??null,l=t?.nostr??null,d=_h(e.snapshot).map((u,g)=>({key:u,enabled:ch(u,e),order:g})).sort((u,g)=>u.enabled!==g.enabled?u.enabled?-1:1:u.order-g.order);return r`
|
|
1509
1496
|
<section class="grid grid-cols-2">
|
|
1510
|
-
${d.map(
|
|
1497
|
+
${d.map(u=>Ch(u.key,e,{whatsapp:n,telegram:s,discord:i,slack:a,signal:o,imessage:c,nostr:l,channelAccounts:e.snapshot?.channelAccounts??null}))}
|
|
1511
1498
|
</section>
|
|
1512
1499
|
|
|
1513
1500
|
<section class="card" style="margin-top: 18px;">
|
|
@@ -1516,24 +1503,24 @@ ${e.sidebarContent}
|
|
|
1516
1503
|
<div class="card-title">Channel health</div>
|
|
1517
1504
|
<div class="card-sub">Channel status snapshots from the gateway.</div>
|
|
1518
1505
|
</div>
|
|
1519
|
-
<div class="muted">${e.lastSuccessAt?
|
|
1506
|
+
<div class="muted">${e.lastSuccessAt?O(e.lastSuccessAt):"n/a"}</div>
|
|
1520
1507
|
</div>
|
|
1521
1508
|
${e.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1522
1509
|
${e.lastError}
|
|
1523
|
-
</div>`:
|
|
1510
|
+
</div>`:f}
|
|
1524
1511
|
<pre class="code-block" style="margin-top: 12px;">
|
|
1525
1512
|
${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
1526
1513
|
</pre>
|
|
1527
1514
|
</section>
|
|
1528
|
-
`}function
|
|
1515
|
+
`}function _h(e){return e?.channelMeta?.length?e.channelMeta.map(t=>t.id):e?.channelOrder?.length?e.channelOrder:["whatsapp","telegram","discord","googlechat","slack","signal","imessage","nostr"]}function Ch(e,t,n){const s=xr(e,n.channelAccounts);switch(e){case"whatsapp":return Ah({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return kh({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return fh({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return gh({props:t,accountCountLabel:s});case"slack":return xh({props:t,slack:n.slack,accountCountLabel:s});case"signal":return $h({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return vh({props:t,imessage:n.imessage,accountCountLabel:s});case"nostr":{const i=n.channelAccounts?.nostr??[],a=i[0],o=a?.accountId??"default",c=a?.profile??null,l=t.nostrProfileAccountId===o?t.nostrProfileFormState:null,p=l?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return wh({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:l,profileFormCallbacks:p,onEditProfile:()=>t.onNostrProfileEdit(o,c)})}default:return Th(e,t,n.channelAccounts??{})}}function Th(e,t,n){const s=Lh(t.snapshot,e),i=t.snapshot?.channels?.[e],a=typeof i?.configured=="boolean"?i.configured:void 0,o=typeof i?.running=="boolean"?i.running:void 0,c=typeof i?.connected=="boolean"?i.connected:void 0,l=typeof i?.lastError=="string"?i.lastError:void 0,p=n[e]??[],d=xr(e,n);return r`
|
|
1529
1516
|
<div class="card">
|
|
1530
1517
|
<div class="card-title">${s}</div>
|
|
1531
1518
|
<div class="card-sub">Channel status and configuration.</div>
|
|
1532
1519
|
${d}
|
|
1533
1520
|
|
|
1534
|
-
${
|
|
1521
|
+
${p.length>0?r`
|
|
1535
1522
|
<div class="account-card-list">
|
|
1536
|
-
${
|
|
1523
|
+
${p.map(u=>Ph(u))}
|
|
1537
1524
|
</div>
|
|
1538
1525
|
`:r`
|
|
1539
1526
|
<div class="status-list" style="margin-top: 16px;">
|
|
@@ -1554,11 +1541,11 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1554
1541
|
|
|
1555
1542
|
${l?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1556
1543
|
${l}
|
|
1557
|
-
</div>`:
|
|
1544
|
+
</div>`:f}
|
|
1558
1545
|
|
|
1559
|
-
${
|
|
1546
|
+
${$e({channelId:e,props:t})}
|
|
1560
1547
|
</div>
|
|
1561
|
-
`}function
|
|
1548
|
+
`}function Eh(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Lh(e,t){return Eh(e)[t]?.label??e?.channelLabels?.[t]??t}const Mh=600*1e3;function kr(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<Mh:!1}function Rh(e){return e.running?"Yes":kr(e)?"Active":"No"}function Ih(e){return e.connected===!0?"Yes":e.connected===!1?"No":kr(e)?"Active":"n/a"}function Ph(e){const t=Rh(e),n=Ih(e);return r`
|
|
1562
1549
|
<div class="account-card">
|
|
1563
1550
|
<div class="account-card-header">
|
|
1564
1551
|
<div class="account-card-title">${e.name||e.accountId}</div>
|
|
@@ -1579,16 +1566,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1579
1566
|
</div>
|
|
1580
1567
|
<div>
|
|
1581
1568
|
<span class="label">Last inbound</span>
|
|
1582
|
-
<span>${e.lastInboundAt?
|
|
1569
|
+
<span>${e.lastInboundAt?O(e.lastInboundAt):"n/a"}</span>
|
|
1583
1570
|
</div>
|
|
1584
1571
|
${e.lastError?r`
|
|
1585
1572
|
<div class="account-card-error">
|
|
1586
1573
|
${e.lastError}
|
|
1587
1574
|
</div>
|
|
1588
|
-
`:
|
|
1575
|
+
`:f}
|
|
1589
1576
|
</div>
|
|
1590
1577
|
</div>
|
|
1591
|
-
`}function
|
|
1578
|
+
`}function Nh(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function Oh(e){const t=e.ts??null;return t?O(t):"n/a"}function Ar(e){return e?`${St(e)} (${O(e)})`:"n/a"}function Dh(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function Bh(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Fh(e){const t=e.schedule;return t.kind==="at"?`At ${St(t.atMs)}`:t.kind==="every"?`Every ${Rl(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function Uh(e){const t=["last",...e.channels.filter(Boolean)],n=e.form.deliveryChannel?.trim();n&&!t.includes(n)&&t.push(n);const s=new Set;return t.filter(i=>s.has(i)?!1:(s.add(i),!0))}function Kh(e,t){if(t==="last")return"last";const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function Hh(e){const t=Uh(e),s=(e.runsJobId==null?void 0:e.jobs.find(a=>a.id===e.runsJobId))?.name??e.runsJobId??"(select a job)",i=e.runs.toSorted((a,o)=>o.ts-a.ts);return r`
|
|
1592
1579
|
<section class="grid grid-cols-2">
|
|
1593
1580
|
<div class="card">
|
|
1594
1581
|
<div class="card-title">Scheduler</div>
|
|
@@ -1606,14 +1593,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1606
1593
|
</div>
|
|
1607
1594
|
<div class="stat">
|
|
1608
1595
|
<div class="stat-label">Next wake</div>
|
|
1609
|
-
<div class="stat-value">${
|
|
1596
|
+
<div class="stat-value">${Ar(e.status?.nextWakeAtMs??null)}</div>
|
|
1610
1597
|
</div>
|
|
1611
1598
|
</div>
|
|
1612
1599
|
<div class="row" style="margin-top: 12px;">
|
|
1613
1600
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
1614
1601
|
${e.loading?"Refreshing…":"Refresh"}
|
|
1615
1602
|
</button>
|
|
1616
|
-
${e.error?r`<span class="muted">${e.error}</span>`:
|
|
1603
|
+
${e.error?r`<span class="muted">${e.error}</span>`:f}
|
|
1617
1604
|
</div>
|
|
1618
1605
|
</div>
|
|
1619
1606
|
|
|
@@ -1663,7 +1650,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1663
1650
|
</select>
|
|
1664
1651
|
</label>
|
|
1665
1652
|
</div>
|
|
1666
|
-
${
|
|
1653
|
+
${zh(e)}
|
|
1667
1654
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1668
1655
|
<label class="field">
|
|
1669
1656
|
<span>Session</span>
|
|
@@ -1732,7 +1719,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1732
1719
|
@change=${a=>e.onFormChange({deliveryChannel:a.target.value})}
|
|
1733
1720
|
>
|
|
1734
1721
|
${t.map(a=>r`<option value=${a}>
|
|
1735
|
-
${
|
|
1722
|
+
${Kh(e,a)}
|
|
1736
1723
|
</option>`)}
|
|
1737
1724
|
</select>
|
|
1738
1725
|
</label>
|
|
@@ -1744,9 +1731,9 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1744
1731
|
placeholder="+1555… or chat id"
|
|
1745
1732
|
/>
|
|
1746
1733
|
</label>
|
|
1747
|
-
`:
|
|
1734
|
+
`:f}
|
|
1748
1735
|
</div>
|
|
1749
|
-
`:
|
|
1736
|
+
`:f}
|
|
1750
1737
|
<div class="row" style="margin-top: 14px;">
|
|
1751
1738
|
<button class="btn primary" ?disabled=${e.busy} @click=${e.onAdd}>
|
|
1752
1739
|
${e.busy?"Saving…":"Add job"}
|
|
@@ -1762,7 +1749,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1762
1749
|
<div class="muted" style="margin-top: 12px">No jobs yet.</div>
|
|
1763
1750
|
`:r`
|
|
1764
1751
|
<div class="list" style="margin-top: 12px;">
|
|
1765
|
-
${e.jobs.map(a=>
|
|
1752
|
+
${e.jobs.map(a=>jh(a,e))}
|
|
1766
1753
|
</div>
|
|
1767
1754
|
`}
|
|
1768
1755
|
</section>
|
|
@@ -1776,11 +1763,11 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1776
1763
|
<div class="muted" style="margin-top: 12px">No runs yet.</div>
|
|
1777
1764
|
`:r`
|
|
1778
1765
|
<div class="list" style="margin-top: 12px;">
|
|
1779
|
-
${i.map(a=>
|
|
1766
|
+
${i.map(a=>Wh(a,e.basePath))}
|
|
1780
1767
|
</div>
|
|
1781
1768
|
`}
|
|
1782
1769
|
</section>
|
|
1783
|
-
`}function
|
|
1770
|
+
`}function zh(e){const t=e.form;return t.scheduleKind==="at"?r`
|
|
1784
1771
|
<label class="field" style="margin-top: 12px;">
|
|
1785
1772
|
<span>Run at</span>
|
|
1786
1773
|
<input
|
|
@@ -1827,16 +1814,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1827
1814
|
/>
|
|
1828
1815
|
</label>
|
|
1829
1816
|
</div>
|
|
1830
|
-
`}function
|
|
1817
|
+
`}function jh(e,t){const s=`list-item list-item-clickable cron-job${t.runsJobId===e.id?" list-item-selected":""}`;return r`
|
|
1831
1818
|
<div class=${s} @click=${()=>t.onLoadRuns(e.id)}>
|
|
1832
1819
|
<div class="list-main">
|
|
1833
1820
|
<div class="list-title">${e.name}</div>
|
|
1834
|
-
<div class="list-sub">${
|
|
1835
|
-
${
|
|
1836
|
-
${e.agentId?r`<div class="muted cron-job-agent">Agent: ${e.agentId}</div>`:
|
|
1821
|
+
<div class="list-sub">${Fh(e)}</div>
|
|
1822
|
+
${qh(e)}
|
|
1823
|
+
${e.agentId?r`<div class="muted cron-job-agent">Agent: ${e.agentId}</div>`:f}
|
|
1837
1824
|
</div>
|
|
1838
1825
|
<div class="list-meta">
|
|
1839
|
-
${
|
|
1826
|
+
${Vh(e)}
|
|
1840
1827
|
</div>
|
|
1841
1828
|
<div class="cron-job-footer">
|
|
1842
1829
|
<div class="chip-row cron-job-chips">
|
|
@@ -1878,7 +1865,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1878
1865
|
</div>
|
|
1879
1866
|
</div>
|
|
1880
1867
|
</div>
|
|
1881
|
-
`}function
|
|
1868
|
+
`}function qh(e){if(e.payload.kind==="systemEvent")return r`<div class="cron-job-detail">
|
|
1882
1869
|
<span class="cron-job-detail-label">System</span>
|
|
1883
1870
|
<span class="muted cron-job-detail-value">${e.payload.text}</span>
|
|
1884
1871
|
</div>`;const t=e.delivery,n=t?.channel||t?.to?` (${t.channel??"last"}${t.to?` -> ${t.to}`:""})`:"";return r`
|
|
@@ -1889,8 +1876,8 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1889
1876
|
${t?r`<div class="cron-job-detail">
|
|
1890
1877
|
<span class="cron-job-detail-label">Delivery</span>
|
|
1891
1878
|
<span class="muted cron-job-detail-value">${t.mode}${n}</span>
|
|
1892
|
-
</div>`:
|
|
1893
|
-
`}function
|
|
1879
|
+
</div>`:f}
|
|
1880
|
+
`}function Wa(e){return typeof e!="number"||!Number.isFinite(e)?"n/a":dn(e)}function Vh(e){const t=e.state?.lastStatus??"n/a",n=t==="ok"?"cron-job-status-ok":t==="error"?"cron-job-status-error":t==="skipped"?"cron-job-status-skipped":"cron-job-status-na",s=e.state?.nextRunAtMs,i=e.state?.lastRunAtMs;return r`
|
|
1894
1881
|
<div class="cron-job-state">
|
|
1895
1882
|
<div class="cron-job-state-row">
|
|
1896
1883
|
<span class="cron-job-state-key">Status</span>
|
|
@@ -1898,31 +1885,31 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1898
1885
|
</div>
|
|
1899
1886
|
<div class="cron-job-state-row">
|
|
1900
1887
|
<span class="cron-job-state-key">Next</span>
|
|
1901
|
-
<span class="cron-job-state-value" title=${
|
|
1902
|
-
${
|
|
1888
|
+
<span class="cron-job-state-value" title=${St(s)}>
|
|
1889
|
+
${Wa(s)}
|
|
1903
1890
|
</span>
|
|
1904
1891
|
</div>
|
|
1905
1892
|
<div class="cron-job-state-row">
|
|
1906
1893
|
<span class="cron-job-state-key">Last</span>
|
|
1907
|
-
<span class="cron-job-state-value" title=${
|
|
1908
|
-
${
|
|
1894
|
+
<span class="cron-job-state-value" title=${St(i)}>
|
|
1895
|
+
${Wa(i)}
|
|
1909
1896
|
</span>
|
|
1910
1897
|
</div>
|
|
1911
1898
|
</div>
|
|
1912
|
-
`}function
|
|
1899
|
+
`}function Wh(e,t){const n=typeof e.sessionKey=="string"&&e.sessionKey.trim().length>0?`${cn("chat",t)}?session=${encodeURIComponent(e.sessionKey)}`:null;return r`
|
|
1913
1900
|
<div class="list-item">
|
|
1914
1901
|
<div class="list-main">
|
|
1915
1902
|
<div class="list-title">${e.status}</div>
|
|
1916
1903
|
<div class="list-sub">${e.summary??""}</div>
|
|
1917
1904
|
</div>
|
|
1918
1905
|
<div class="list-meta">
|
|
1919
|
-
<div>${
|
|
1906
|
+
<div>${St(e.ts)}</div>
|
|
1920
1907
|
<div class="muted">${e.durationMs??0}ms</div>
|
|
1921
|
-
${n?r`<div><a class="session-link" href=${n}>Open run chat</a></div>`:
|
|
1922
|
-
${e.error?r`<div class="muted">${e.error}</div>`:
|
|
1908
|
+
${n?r`<div><a class="session-link" href=${n}>Open run chat</a></div>`:f}
|
|
1909
|
+
${e.error?r`<div class="muted">${e.error}</div>`:f}
|
|
1923
1910
|
</div>
|
|
1924
1911
|
</div>
|
|
1925
|
-
`}function
|
|
1912
|
+
`}function Gh(e){const n=(e.status&&typeof e.status=="object"?e.status.securityAudit:null)?.summary??null,s=n?.critical??0,i=n?.warn??0,a=n?.info??0,o=s>0?"danger":i>0?"warn":"success",c=s>0?`${s} critical`:i>0?`${i} warnings`:"No critical issues";return r`
|
|
1926
1913
|
<section class="grid grid-cols-2">
|
|
1927
1914
|
<div class="card">
|
|
1928
1915
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -1940,7 +1927,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1940
1927
|
${n?r`<div class="callout ${o}" style="margin-top: 8px;">
|
|
1941
1928
|
Security audit: ${c}${a>0?` · ${a} info`:""}. Run
|
|
1942
1929
|
<span class="mono">poolbot security audit --deep</span> for details.
|
|
1943
|
-
</div>`:
|
|
1930
|
+
</div>`:f}
|
|
1944
1931
|
<pre class="code-block">${JSON.stringify(e.status??{},null,2)}</pre>
|
|
1945
1932
|
</div>
|
|
1946
1933
|
<div>
|
|
@@ -1980,8 +1967,8 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1980
1967
|
</div>
|
|
1981
1968
|
${e.callError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
1982
1969
|
${e.callError}
|
|
1983
|
-
</div>`:
|
|
1984
|
-
${e.callResult?r`<pre class="code-block" style="margin-top: 12px;">${e.callResult}</pre>`:
|
|
1970
|
+
</div>`:f}
|
|
1971
|
+
${e.callResult?r`<pre class="code-block" style="margin-top: 12px;">${e.callResult}</pre>`:f}
|
|
1985
1972
|
</div>
|
|
1986
1973
|
</section>
|
|
1987
1974
|
|
|
@@ -2003,14 +1990,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2003
1990
|
<div class="list-sub">${new Date(l.ts).toLocaleTimeString()}</div>
|
|
2004
1991
|
</div>
|
|
2005
1992
|
<div class="list-meta">
|
|
2006
|
-
<pre class="code-block">${
|
|
1993
|
+
<pre class="code-block">${Bh(l.payload)}</pre>
|
|
2007
1994
|
</div>
|
|
2008
1995
|
</div>
|
|
2009
1996
|
`)}
|
|
2010
1997
|
</div>
|
|
2011
1998
|
`}
|
|
2012
1999
|
</section>
|
|
2013
|
-
`}function
|
|
2000
|
+
`}function Yh(e){return r`
|
|
2014
2001
|
<section class="card">
|
|
2015
2002
|
<div class="row" style="justify-content: space-between;">
|
|
2016
2003
|
<div>
|
|
@@ -2023,36 +2010,36 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2023
2010
|
</div>
|
|
2024
2011
|
${e.lastError?r`<div class="callout danger" style="margin-top: 12px;">
|
|
2025
2012
|
${e.lastError}
|
|
2026
|
-
</div>`:
|
|
2013
|
+
</div>`:f}
|
|
2027
2014
|
${e.statusMessage?r`<div class="callout" style="margin-top: 12px;">
|
|
2028
2015
|
${e.statusMessage}
|
|
2029
|
-
</div>`:
|
|
2016
|
+
</div>`:f}
|
|
2030
2017
|
<div class="list" style="margin-top: 16px;">
|
|
2031
|
-
${e.entries.length===0?r`<div class="muted">No instances reported yet.</div>`:e.entries.map(t=>
|
|
2018
|
+
${e.entries.length===0?r`<div class="muted">No instances reported yet.</div>`:e.entries.map(t=>Qh(t))}
|
|
2032
2019
|
</div>
|
|
2033
2020
|
</section>
|
|
2034
|
-
`}function
|
|
2021
|
+
`}function Qh(e){const t=e.lastInputSeconds!=null?`${e.lastInputSeconds}s ago`:"n/a",n=e.mode??"unknown",s=Array.isArray(e.roles)?e.roles.filter(Boolean):[],i=Array.isArray(e.scopes)?e.scopes.filter(Boolean):[],a=i.length>0?i.length>3?`${i.length} scopes`:`scopes: ${i.join(", ")}`:null;return r`
|
|
2035
2022
|
<div class="list-item">
|
|
2036
2023
|
<div class="list-main">
|
|
2037
2024
|
<div class="list-title">${e.host??"unknown host"}</div>
|
|
2038
|
-
<div class="list-sub">${
|
|
2025
|
+
<div class="list-sub">${Nh(e)}</div>
|
|
2039
2026
|
<div class="chip-row">
|
|
2040
2027
|
<span class="chip">${n}</span>
|
|
2041
2028
|
${s.map(o=>r`<span class="chip">${o}</span>`)}
|
|
2042
|
-
${a?r`<span class="chip">${a}</span>`:
|
|
2043
|
-
${e.platform?r`<span class="chip">${e.platform}</span>`:
|
|
2044
|
-
${e.deviceFamily?r`<span class="chip">${e.deviceFamily}</span>`:
|
|
2045
|
-
${e.modelIdentifier?r`<span class="chip">${e.modelIdentifier}</span>`:
|
|
2046
|
-
${e.version?r`<span class="chip">${e.version}</span>`:
|
|
2029
|
+
${a?r`<span class="chip">${a}</span>`:f}
|
|
2030
|
+
${e.platform?r`<span class="chip">${e.platform}</span>`:f}
|
|
2031
|
+
${e.deviceFamily?r`<span class="chip">${e.deviceFamily}</span>`:f}
|
|
2032
|
+
${e.modelIdentifier?r`<span class="chip">${e.modelIdentifier}</span>`:f}
|
|
2033
|
+
${e.version?r`<span class="chip">${e.version}</span>`:f}
|
|
2047
2034
|
</div>
|
|
2048
2035
|
</div>
|
|
2049
2036
|
<div class="list-meta">
|
|
2050
|
-
<div>${
|
|
2037
|
+
<div>${Oh(e)}</div>
|
|
2051
2038
|
<div class="muted">Last input ${t}</div>
|
|
2052
2039
|
<div class="muted">Reason ${e.reason??""}</div>
|
|
2053
2040
|
</div>
|
|
2054
2041
|
</div>
|
|
2055
|
-
`}const
|
|
2042
|
+
`}const Ga=["trace","debug","info","warn","error","fatal"];function Jh(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function Zh(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function Xh(e){const t=e.filterText.trim().toLowerCase(),n=Ga.some(a=>!e.levelFilters[a]),s=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:Zh(a,t)),i=t||n?"filtered":"visible";return r`
|
|
2056
2043
|
<section class="card">
|
|
2057
2044
|
<div class="row" style="justify-content: space-between;">
|
|
2058
2045
|
<div>
|
|
@@ -2093,7 +2080,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2093
2080
|
</div>
|
|
2094
2081
|
|
|
2095
2082
|
<div class="chip-row" style="margin-top: 12px;">
|
|
2096
|
-
${
|
|
2083
|
+
${Ga.map(a=>r`
|
|
2097
2084
|
<label class="chip log-chip ${a}">
|
|
2098
2085
|
<input
|
|
2099
2086
|
type="checkbox"
|
|
@@ -2105,16 +2092,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2105
2092
|
`)}
|
|
2106
2093
|
</div>
|
|
2107
2094
|
|
|
2108
|
-
${e.file?r`<div class="muted" style="margin-top: 10px;">File: ${e.file}</div>`:
|
|
2095
|
+
${e.file?r`<div class="muted" style="margin-top: 10px;">File: ${e.file}</div>`:f}
|
|
2109
2096
|
${e.truncated?r`<div class="callout" style="margin-top: 10px;">
|
|
2110
2097
|
Log output truncated; showing latest chunk.
|
|
2111
|
-
</div>`:
|
|
2112
|
-
${e.error?r`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:
|
|
2098
|
+
</div>`:f}
|
|
2099
|
+
${e.error?r`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:f}
|
|
2113
2100
|
|
|
2114
2101
|
<div class="log-stream" style="margin-top: 12px;" @scroll=${e.onScroll}>
|
|
2115
2102
|
${s.length===0?r`<div class="muted" style="padding: 12px;">No log entries.</div>`:s.map(a=>r`
|
|
2116
2103
|
<div class="log-row">
|
|
2117
|
-
<div class="log-time mono">${
|
|
2104
|
+
<div class="log-time mono">${Jh(a.time)}</div>
|
|
2118
2105
|
<div class="log-level ${a.level??""}">${a.level??""}</div>
|
|
2119
2106
|
<div class="log-subsystem mono">${a.subsystem??""}</div>
|
|
2120
2107
|
<div class="log-message mono">${a.message??a.raw}</div>
|
|
@@ -2122,7 +2109,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2122
2109
|
`)}
|
|
2123
2110
|
</div>
|
|
2124
2111
|
</section>
|
|
2125
|
-
`}function
|
|
2112
|
+
`}function Sr(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach((i,a)=>{if(!i||typeof i!="object")return;const o=i,c=typeof o.id=="string"?o.id.trim():"";if(!c)return;const l=typeof o.name=="string"?o.name.trim():void 0,p=o.default===!0;s.push({id:c,name:l||void 0,isDefault:p,index:a,record:o})}),s}function _r(e,t){const n=new Set(t),s=[];for(const i of e){if(!(Array.isArray(i.commands)?i.commands:[]).some(p=>n.has(String(p))))continue;const c=typeof i.nodeId=="string"?i.nodeId.trim():"";if(!c)continue;const l=typeof i.displayName=="string"&&i.displayName.trim()?i.displayName.trim():c;s.push({id:c,label:l===c?c:`${l} · ${c}`})}return s.sort((i,a)=>i.label.localeCompare(a.label)),s}const Ae="__defaults__",Ya=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],ef=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Qa(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function tf(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function nf(e){const t=e?.defaults??{};return{security:Qa(t.security),ask:tf(t.ask),askFallback:Qa(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function sf(e){return Sr(e).map(t=>({id:t.id,name:t.name,isDefault:t.isDefault}))}function af(e,t){const n=sf(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(o=>i.set(o.id,o)),s.forEach(o=>{i.has(o)||i.set(o,{id:o})});const a=Array.from(i.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,c)=>{if(o.isDefault&&!c.isDefault)return-1;if(!o.isDefault&&c.isDefault)return 1;const l=o.name?.trim()?o.name:o.id,p=c.name?.trim()?c.name:c.id;return l.localeCompare(p)}),a}function of(e,t){return e===Ae?Ae:e&&t.some(n=>n.id===e)?e:Ae}function rf(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=nf(t),i=af(e.configForm,t),a=ff(e.nodes),o=e.execApprovalsTarget;let c=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&c&&!a.some(u=>u.id===c)&&(c=null);const l=of(e.execApprovalsSelectedAgent,i),p=l!==Ae?(t?.agents??{})[l]??null:null,d=Array.isArray(p?.allowlist)?p.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:l,selectedAgent:p,agents:i,allowlist:d,target:o,targetNodeId:c,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function lf(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return r`
|
|
2126
2113
|
<section class="card">
|
|
2127
2114
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
2128
2115
|
<div>
|
|
@@ -2140,12 +2127,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2140
2127
|
</button>
|
|
2141
2128
|
</div>
|
|
2142
2129
|
|
|
2143
|
-
${
|
|
2130
|
+
${cf(e)}
|
|
2144
2131
|
|
|
2145
2132
|
${t?r`
|
|
2146
|
-
${
|
|
2147
|
-
${
|
|
2148
|
-
${e.selectedScope===
|
|
2133
|
+
${df(e)}
|
|
2134
|
+
${uf(e)}
|
|
2135
|
+
${e.selectedScope===Ae?f:pf(e)}
|
|
2149
2136
|
`:r`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
2150
2137
|
<div class="muted">Load exec approvals to edit allowlists.</div>
|
|
2151
2138
|
<button class="btn" ?disabled=${e.loading||!n} @click=${e.onLoad}>
|
|
@@ -2153,7 +2140,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2153
2140
|
</button>
|
|
2154
2141
|
</div>`}
|
|
2155
2142
|
</section>
|
|
2156
|
-
`}function
|
|
2143
|
+
`}function cf(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return r`
|
|
2157
2144
|
<div class="list" style="margin-top: 12px;">
|
|
2158
2145
|
<div class="list-item">
|
|
2159
2146
|
<div class="list-main">
|
|
@@ -2189,20 +2176,20 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2189
2176
|
</option>`)}
|
|
2190
2177
|
</select>
|
|
2191
2178
|
</label>
|
|
2192
|
-
`:
|
|
2179
|
+
`:f}
|
|
2193
2180
|
</div>
|
|
2194
2181
|
</div>
|
|
2195
2182
|
${e.target==="node"&&!t?r`
|
|
2196
2183
|
<div class="muted">No nodes advertise exec approvals yet.</div>
|
|
2197
|
-
`:
|
|
2184
|
+
`:f}
|
|
2198
2185
|
</div>
|
|
2199
|
-
`}function
|
|
2186
|
+
`}function df(e){return r`
|
|
2200
2187
|
<div class="row" style="margin-top: 12px; gap: 8px; flex-wrap: wrap;">
|
|
2201
2188
|
<span class="label">Scope</span>
|
|
2202
2189
|
<div class="row" style="gap: 8px; flex-wrap: wrap;">
|
|
2203
2190
|
<button
|
|
2204
|
-
class="btn btn--sm ${e.selectedScope===
|
|
2205
|
-
@click=${()=>e.onSelectScope(
|
|
2191
|
+
class="btn btn--sm ${e.selectedScope===Ae?"active":""}"
|
|
2192
|
+
@click=${()=>e.onSelectScope(Ae)}
|
|
2206
2193
|
>
|
|
2207
2194
|
Defaults
|
|
2208
2195
|
</button>
|
|
@@ -2216,7 +2203,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2216
2203
|
`})}
|
|
2217
2204
|
</div>
|
|
2218
2205
|
</div>
|
|
2219
|
-
`}function
|
|
2206
|
+
`}function uf(e){const t=e.selectedScope===Ae,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],a=typeof s.security=="string"?s.security:void 0,o=typeof s.ask=="string"?s.ask:void 0,c=typeof s.askFallback=="string"?s.askFallback:void 0,l=t?n.security:a??"__default__",p=t?n.ask:o??"__default__",d=t?n.askFallback:c??"__default__",u=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,g=u??n.autoAllowSkills,v=u==null;return r`
|
|
2220
2207
|
<div class="list" style="margin-top: 16px;">
|
|
2221
2208
|
<div class="list-item">
|
|
2222
2209
|
<div class="list-main">
|
|
@@ -2230,16 +2217,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2230
2217
|
<span>Mode</span>
|
|
2231
2218
|
<select
|
|
2232
2219
|
?disabled=${e.disabled}
|
|
2233
|
-
@change=${
|
|
2220
|
+
@change=${w=>{const k=w.target.value;!t&&k==="__default__"?e.onRemove([...i,"security"]):e.onPatch([...i,"security"],k)}}
|
|
2234
2221
|
>
|
|
2235
|
-
${t?
|
|
2222
|
+
${t?f:r`<option value="__default__" ?selected=${l==="__default__"}>
|
|
2236
2223
|
Use default (${n.security})
|
|
2237
2224
|
</option>`}
|
|
2238
|
-
${
|
|
2239
|
-
value=${
|
|
2240
|
-
?selected=${l===
|
|
2225
|
+
${Ya.map(w=>r`<option
|
|
2226
|
+
value=${w.value}
|
|
2227
|
+
?selected=${l===w.value}
|
|
2241
2228
|
>
|
|
2242
|
-
${
|
|
2229
|
+
${w.label}
|
|
2243
2230
|
</option>`)}
|
|
2244
2231
|
</select>
|
|
2245
2232
|
</label>
|
|
@@ -2258,16 +2245,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2258
2245
|
<span>Mode</span>
|
|
2259
2246
|
<select
|
|
2260
2247
|
?disabled=${e.disabled}
|
|
2261
|
-
@change=${
|
|
2248
|
+
@change=${w=>{const k=w.target.value;!t&&k==="__default__"?e.onRemove([...i,"ask"]):e.onPatch([...i,"ask"],k)}}
|
|
2262
2249
|
>
|
|
2263
|
-
${t?
|
|
2250
|
+
${t?f:r`<option value="__default__" ?selected=${p==="__default__"}>
|
|
2264
2251
|
Use default (${n.ask})
|
|
2265
2252
|
</option>`}
|
|
2266
|
-
${
|
|
2267
|
-
value=${
|
|
2268
|
-
?selected=${
|
|
2253
|
+
${ef.map(w=>r`<option
|
|
2254
|
+
value=${w.value}
|
|
2255
|
+
?selected=${p===w.value}
|
|
2269
2256
|
>
|
|
2270
|
-
${
|
|
2257
|
+
${w.label}
|
|
2271
2258
|
</option>`)}
|
|
2272
2259
|
</select>
|
|
2273
2260
|
</label>
|
|
@@ -2286,16 +2273,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2286
2273
|
<span>Fallback</span>
|
|
2287
2274
|
<select
|
|
2288
2275
|
?disabled=${e.disabled}
|
|
2289
|
-
@change=${
|
|
2276
|
+
@change=${w=>{const k=w.target.value;!t&&k==="__default__"?e.onRemove([...i,"askFallback"]):e.onPatch([...i,"askFallback"],k)}}
|
|
2290
2277
|
>
|
|
2291
|
-
${t?
|
|
2278
|
+
${t?f:r`<option value="__default__" ?selected=${d==="__default__"}>
|
|
2292
2279
|
Use default (${n.askFallback})
|
|
2293
2280
|
</option>`}
|
|
2294
|
-
${
|
|
2295
|
-
value=${
|
|
2296
|
-
?selected=${d===
|
|
2281
|
+
${Ya.map(w=>r`<option
|
|
2282
|
+
value=${w.value}
|
|
2283
|
+
?selected=${d===w.value}
|
|
2297
2284
|
>
|
|
2298
|
-
${
|
|
2285
|
+
${w.label}
|
|
2299
2286
|
</option>`)}
|
|
2300
2287
|
</select>
|
|
2301
2288
|
</label>
|
|
@@ -2306,7 +2293,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2306
2293
|
<div class="list-main">
|
|
2307
2294
|
<div class="list-title">Auto-allow skill CLIs</div>
|
|
2308
2295
|
<div class="list-sub">
|
|
2309
|
-
${t?"Allow skill executables listed by the Gateway.":
|
|
2296
|
+
${t?"Allow skill executables listed by the Gateway.":v?`Using default (${n.autoAllowSkills?"on":"off"}).`:`Override (${g?"on":"off"}).`}
|
|
2310
2297
|
</div>
|
|
2311
2298
|
</div>
|
|
2312
2299
|
<div class="list-meta">
|
|
@@ -2315,21 +2302,21 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2315
2302
|
<input
|
|
2316
2303
|
type="checkbox"
|
|
2317
2304
|
?disabled=${e.disabled}
|
|
2318
|
-
.checked=${
|
|
2319
|
-
@change=${
|
|
2305
|
+
.checked=${g}
|
|
2306
|
+
@change=${w=>{const $=w.target;e.onPatch([...i,"autoAllowSkills"],$.checked)}}
|
|
2320
2307
|
/>
|
|
2321
2308
|
</label>
|
|
2322
|
-
${!t&&!
|
|
2309
|
+
${!t&&!v?r`<button
|
|
2323
2310
|
class="btn btn--sm"
|
|
2324
2311
|
?disabled=${e.disabled}
|
|
2325
2312
|
@click=${()=>e.onRemove([...i,"autoAllowSkills"])}
|
|
2326
2313
|
>
|
|
2327
2314
|
Use default
|
|
2328
|
-
</button>`:
|
|
2315
|
+
</button>`:f}
|
|
2329
2316
|
</div>
|
|
2330
2317
|
</div>
|
|
2331
2318
|
</div>
|
|
2332
|
-
`}function
|
|
2319
|
+
`}function pf(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return r`
|
|
2333
2320
|
<div class="row" style="margin-top: 18px; justify-content: space-between;">
|
|
2334
2321
|
<div>
|
|
2335
2322
|
<div class="card-title">Allowlist</div>
|
|
@@ -2346,15 +2333,15 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2346
2333
|
<div class="list" style="margin-top: 12px;">
|
|
2347
2334
|
${n.length===0?r`
|
|
2348
2335
|
<div class="muted">No allowlist entries yet.</div>
|
|
2349
|
-
`:n.map((s,i)=>
|
|
2336
|
+
`:n.map((s,i)=>hf(e,s,i))}
|
|
2350
2337
|
</div>
|
|
2351
|
-
`}function
|
|
2338
|
+
`}function hf(e,t,n){const s=t.lastUsedAt?dn(t.lastUsedAt):"never",i=t.lastUsedCommand?ds(t.lastUsedCommand,120):null,a=t.lastResolvedPath?ds(t.lastResolvedPath,120):null;return r`
|
|
2352
2339
|
<div class="list-item">
|
|
2353
2340
|
<div class="list-main">
|
|
2354
2341
|
<div class="list-title">${t.pattern?.trim()?t.pattern:"New pattern"}</div>
|
|
2355
2342
|
<div class="list-sub">Last used: ${s}</div>
|
|
2356
|
-
${i?r`<div class="list-sub mono">${i}</div>`:
|
|
2357
|
-
${a?r`<div class="list-sub mono">${a}</div>`:
|
|
2343
|
+
${i?r`<div class="list-sub mono">${i}</div>`:f}
|
|
2344
|
+
${a?r`<div class="list-sub mono">${a}</div>`:f}
|
|
2358
2345
|
</div>
|
|
2359
2346
|
<div class="list-meta">
|
|
2360
2347
|
<label class="field">
|
|
@@ -2375,10 +2362,10 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2375
2362
|
</button>
|
|
2376
2363
|
</div>
|
|
2377
2364
|
</div>
|
|
2378
|
-
`}function
|
|
2379
|
-
${
|
|
2380
|
-
${
|
|
2381
|
-
${
|
|
2365
|
+
`}function ff(e){return _r(e,["system.execApprovals.get","system.execApprovals.set"])}function gf(e){const t=wf(e),n=rf(e);return r`
|
|
2366
|
+
${lf(n)}
|
|
2367
|
+
${$f(t)}
|
|
2368
|
+
${vf(e)}
|
|
2382
2369
|
<section class="card">
|
|
2383
2370
|
<div class="row" style="justify-content: space-between;">
|
|
2384
2371
|
<div>
|
|
@@ -2392,10 +2379,10 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2392
2379
|
<div class="list" style="margin-top: 16px;">
|
|
2393
2380
|
${e.nodes.length===0?r`
|
|
2394
2381
|
<div class="muted">No nodes found.</div>
|
|
2395
|
-
`:e.nodes.map(s=>
|
|
2382
|
+
`:e.nodes.map(s=>Sf(s))}
|
|
2396
2383
|
</div>
|
|
2397
2384
|
</section>
|
|
2398
|
-
`}function
|
|
2385
|
+
`}function vf(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],s=Array.isArray(t.paired)?t.paired:[];return r`
|
|
2399
2386
|
<section class="card">
|
|
2400
2387
|
<div class="row" style="justify-content: space-between;">
|
|
2401
2388
|
<div>
|
|
@@ -2406,22 +2393,22 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2406
2393
|
${e.devicesLoading?"Loading…":"Refresh"}
|
|
2407
2394
|
</button>
|
|
2408
2395
|
</div>
|
|
2409
|
-
${e.devicesError?r`<div class="callout danger" style="margin-top: 12px;">${e.devicesError}</div>`:
|
|
2396
|
+
${e.devicesError?r`<div class="callout danger" style="margin-top: 12px;">${e.devicesError}</div>`:f}
|
|
2410
2397
|
<div class="list" style="margin-top: 16px;">
|
|
2411
2398
|
${n.length>0?r`
|
|
2412
2399
|
<div class="muted" style="margin-bottom: 8px;">Pending</div>
|
|
2413
|
-
${n.map(i=>
|
|
2414
|
-
`:
|
|
2400
|
+
${n.map(i=>mf(i,e))}
|
|
2401
|
+
`:f}
|
|
2415
2402
|
${s.length>0?r`
|
|
2416
2403
|
<div class="muted" style="margin-top: 12px; margin-bottom: 8px;">Paired</div>
|
|
2417
|
-
${s.map(i=>
|
|
2418
|
-
`:
|
|
2404
|
+
${s.map(i=>yf(i,e))}
|
|
2405
|
+
`:f}
|
|
2419
2406
|
${n.length===0&&s.length===0?r`
|
|
2420
2407
|
<div class="muted">No paired devices.</div>
|
|
2421
|
-
`:
|
|
2408
|
+
`:f}
|
|
2422
2409
|
</div>
|
|
2423
2410
|
</section>
|
|
2424
|
-
`}function
|
|
2411
|
+
`}function mf(e,t){const n=e.displayName?.trim()||e.deviceId,s=typeof e.ts=="number"?dn(e.ts):"n/a",i=e.role?.trim()?`role: ${e.role}`:"role: -",a=e.isRepair?" · repair":"",o=e.remoteIp?` · ${e.remoteIp}`:"";return r`
|
|
2425
2412
|
<div class="list-item">
|
|
2426
2413
|
<div class="list-main">
|
|
2427
2414
|
<div class="list-title">${n}</div>
|
|
@@ -2441,7 +2428,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2441
2428
|
</div>
|
|
2442
2429
|
</div>
|
|
2443
2430
|
</div>
|
|
2444
|
-
`}function
|
|
2431
|
+
`}function yf(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${cs(e.roles)}`,a=`scopes: ${cs(e.scopes)}`,o=Array.isArray(e.tokens)?e.tokens:[];return r`
|
|
2445
2432
|
<div class="list-item">
|
|
2446
2433
|
<div class="list-main">
|
|
2447
2434
|
<div class="list-title">${n}</div>
|
|
@@ -2452,12 +2439,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2452
2439
|
`:r`
|
|
2453
2440
|
<div class="muted" style="margin-top: 10px;">Tokens</div>
|
|
2454
2441
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 6px;">
|
|
2455
|
-
${o.map(c=>
|
|
2442
|
+
${o.map(c=>bf(e.deviceId,c,t))}
|
|
2456
2443
|
</div>
|
|
2457
2444
|
`}
|
|
2458
2445
|
</div>
|
|
2459
2446
|
</div>
|
|
2460
|
-
`}function
|
|
2447
|
+
`}function bf(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${cs(t.scopes)}`,a=dn(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return r`
|
|
2461
2448
|
<div class="row" style="justify-content: space-between; gap: 8px;">
|
|
2462
2449
|
<div class="list-sub">${t.role} · ${s} · ${i} · ${a}</div>
|
|
2463
2450
|
<div class="row" style="justify-content: flex-end; gap: 6px; flex-wrap: wrap;">
|
|
@@ -2467,7 +2454,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2467
2454
|
>
|
|
2468
2455
|
Rotate
|
|
2469
2456
|
</button>
|
|
2470
|
-
${t.revokedAtMs?
|
|
2457
|
+
${t.revokedAtMs?f:r`
|
|
2471
2458
|
<button
|
|
2472
2459
|
class="btn btn--sm danger"
|
|
2473
2460
|
@click=${()=>n.onDeviceRevoke(e,t.role)}
|
|
@@ -2477,7 +2464,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2477
2464
|
`}
|
|
2478
2465
|
</div>
|
|
2479
2466
|
</div>
|
|
2480
|
-
`}function
|
|
2467
|
+
`}function wf(e){const t=e.configForm,n=kf(e.nodes),{defaultBinding:s,agents:i}=Af(t),a=!!t,o=e.configSaving||e.configFormMode==="raw";return{ready:a,disabled:o,configDirty:e.configDirty,configLoading:e.configLoading,configSaving:e.configSaving,defaultBinding:s,agents:i,nodes:n,onBindDefault:e.onBindDefault,onBindAgent:e.onBindAgent,onSave:e.onSaveBindings,onLoadConfig:e.onLoadConfig,formMode:e.configFormMode}}function $f(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return r`
|
|
2481
2468
|
<section class="card">
|
|
2482
2469
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
2483
2470
|
<div>
|
|
@@ -2499,7 +2486,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2499
2486
|
<div class="callout warn" style="margin-top: 12px">
|
|
2500
2487
|
Switch the Config tab to <strong>Form</strong> mode to edit bindings here.
|
|
2501
2488
|
</div>
|
|
2502
|
-
`:
|
|
2489
|
+
`:f}
|
|
2503
2490
|
|
|
2504
2491
|
${e.ready?r`
|
|
2505
2492
|
<div class="list" style="margin-top: 16px;">
|
|
@@ -2524,7 +2511,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2524
2511
|
</option>`)}
|
|
2525
2512
|
</select>
|
|
2526
2513
|
</label>
|
|
2527
|
-
${t?
|
|
2514
|
+
${t?f:r`
|
|
2528
2515
|
<div class="muted">No nodes with system.run available.</div>
|
|
2529
2516
|
`}
|
|
2530
2517
|
</div>
|
|
@@ -2532,7 +2519,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2532
2519
|
|
|
2533
2520
|
${e.agents.length===0?r`
|
|
2534
2521
|
<div class="muted">No agents found.</div>
|
|
2535
|
-
`:e.agents.map(s=>
|
|
2522
|
+
`:e.agents.map(s=>xf(s,e))}
|
|
2536
2523
|
</div>
|
|
2537
2524
|
`:r`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
2538
2525
|
<div class="muted">Load config to edit bindings.</div>
|
|
@@ -2541,7 +2528,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2541
2528
|
</button>
|
|
2542
2529
|
</div>`}
|
|
2543
2530
|
</section>
|
|
2544
|
-
`}function
|
|
2531
|
+
`}function xf(e,t){const n=e.binding??"__default__",s=e.name?.trim()?`${e.name} (${e.id})`:e.id,i=t.nodes.length>0;return r`
|
|
2545
2532
|
<div class="list-item">
|
|
2546
2533
|
<div class="list-main">
|
|
2547
2534
|
<div class="list-title">${s}</div>
|
|
@@ -2570,7 +2557,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2570
2557
|
</label>
|
|
2571
2558
|
</div>
|
|
2572
2559
|
</div>
|
|
2573
|
-
`}function
|
|
2560
|
+
`}function kf(e){return _r(e,["system.run"])}function Af(e){const t={id:"main",name:void 0,index:0,isDefault:!0,binding:null};if(!e||typeof e!="object")return{defaultBinding:null,agents:[t]};const s=(e.tools??{}).exec??{},i=typeof s.node=="string"&&s.node.trim()?s.node.trim():null,a=e.agents??{};if(!Array.isArray(a.list)||a.list.length===0)return{defaultBinding:i,agents:[t]};const o=Sr(e).map(c=>{const p=(c.record.tools??{}).exec??{},d=typeof p.node=="string"&&p.node.trim()?p.node.trim():null;return{id:c.id,name:c.name,index:c.index,isDefault:c.isDefault,binding:d}});return o.length===0&&o.push(t),{defaultBinding:i,agents:o}}function Sf(e){const t=!!e.connected,n=!!e.paired,s=typeof e.displayName=="string"&&e.displayName.trim()||(typeof e.nodeId=="string"?e.nodeId:"unknown"),i=Array.isArray(e.caps)?e.caps:[],a=Array.isArray(e.commands)?e.commands:[];return r`
|
|
2574
2561
|
<div class="list-item">
|
|
2575
2562
|
<div class="list-main">
|
|
2576
2563
|
<div class="list-title">${s}</div>
|
|
@@ -2589,7 +2576,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2589
2576
|
</div>
|
|
2590
2577
|
</div>
|
|
2591
2578
|
</div>
|
|
2592
|
-
`}function
|
|
2579
|
+
`}function _f(e){const t=[];if(e.connected||t.push({severity:"error",icon:"⚠️",title:"Gateway Offline",description:"Cannot reach the gateway. Check the WebSocket URL and token."}),e.lastError){const n=e.lastError.toLowerCase();!n.includes("unauthorized")&&!n.includes("connect failed")&&t.push({severity:"error",icon:"❌",title:"Gateway Error",description:e.lastError})}return e.cronEnabled===!1&&t.push({severity:"warning",icon:"⏰",title:"Cron Disabled",description:"Scheduled agent runs are paused."}),e.lastChannelsRefresh&&Date.now()-e.lastChannelsRefresh>3e5&&t.push({severity:"warning",icon:"🔗",title:"Stale Channels",description:`Last channel refresh was ${O(e.lastChannelsRefresh)}.`}),t}function Cf(e){const t=e.severity==="error"?"alert-banner--error":e.severity==="warning"?"alert-banner--warn":"alert-banner--info";return r`
|
|
2593
2580
|
<div class="alert-banner ${t}">
|
|
2594
2581
|
<span class="alert-banner__icon">${e.icon}</span>
|
|
2595
2582
|
<div class="alert-banner__body">
|
|
@@ -2597,7 +2584,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2597
2584
|
<div class="alert-banner__desc">${e.description}</div>
|
|
2598
2585
|
</div>
|
|
2599
2586
|
</div>
|
|
2600
|
-
`}function
|
|
2587
|
+
`}function Ye(e,t,n,s="ok"){return r`
|
|
2601
2588
|
<div class="health-card">
|
|
2602
2589
|
<div class="health-card__header">
|
|
2603
2590
|
<span class="hc-dot ${s==="ok"?"hc-dot--ok":s==="warn"?"hc-dot--warn":"hc-dot--err"}"></span>
|
|
@@ -2606,7 +2593,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2606
2593
|
<div class="health-card__value">${t}</div>
|
|
2607
2594
|
<div class="health-card__hint">${n}</div>
|
|
2608
2595
|
</div>
|
|
2609
|
-
`}function
|
|
2596
|
+
`}function Tf(e){const t=e.hello?.snapshot,n=t?.uptimeMs??0,s=n?O(Date.now()-n):"n/a",i=t?.policy?.tickIntervalMs?`${(t.policy.tickIntervalMs/1e3).toFixed(t.policy.tickIntervalMs%1e3===0?0:1)}s`:"n/a",a=_f(e),o=e.connected?"ok":e.lastError?"error":"warn",c=e.cronEnabled==null?"warn":e.cronEnabled?"ok":"warn",l=e.lastChannelsRefresh==null||Date.now()-e.lastChannelsRefresh>3e5?"warn":"ok",p=(()=>{if(e.connected||!e.lastError)return null;const d=e.lastError.toLowerCase();if(!d.includes("unauthorized")&&!d.includes("connect failed"))return null;const u=!!e.settings.token.trim(),g=!!e.password.trim();return!u&&!g?r`
|
|
2610
2597
|
<div class="muted" style="margin-top: 8px;">
|
|
2611
2598
|
This gateway requires auth. Add a token or password, then click Connect.
|
|
2612
2599
|
</div>
|
|
@@ -2616,16 +2603,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2616
2603
|
</div>
|
|
2617
2604
|
`})();return r`
|
|
2618
2605
|
${a.length>0?r`<section class="alert-stack">
|
|
2619
|
-
${a.map(
|
|
2620
|
-
</section>`:
|
|
2606
|
+
${a.map(Cf)}
|
|
2607
|
+
</section>`:f}
|
|
2621
2608
|
|
|
2622
2609
|
<section class="health-grid">
|
|
2623
|
-
${
|
|
2624
|
-
${
|
|
2625
|
-
${
|
|
2626
|
-
${
|
|
2627
|
-
${
|
|
2628
|
-
${
|
|
2610
|
+
${Ye("Gateway",e.connected?"Online":"Offline",e.connected?`Uptime ${s}`:"Not connected",o)}
|
|
2611
|
+
${Ye("Instances",String(e.presenceCount),"Presence beacons active",e.presenceCount>0?"ok":"warn")}
|
|
2612
|
+
${Ye("Sessions",String(e.sessionsCount??"n/a"),"Tracked by gateway","ok")}
|
|
2613
|
+
${Ye("Cron",e.cronEnabled==null?"n/a":e.cronEnabled?`${Ar(e.cronNext)}`:"Disabled",e.cronEnabled?"Next scheduled run":"Agent scheduling paused",c)}
|
|
2614
|
+
${Ye("Channels",e.lastChannelsRefresh?O(e.lastChannelsRefresh):"n/a","Last refresh",l)}
|
|
2615
|
+
${Ye("Tick",i,"Gateway heartbeat interval","ok")}
|
|
2629
2616
|
</section>
|
|
2630
2617
|
|
|
2631
2618
|
<section class="grid grid-cols-2" style="margin-top: 18px;">
|
|
@@ -2637,7 +2624,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2637
2624
|
<span>WebSocket URL</span>
|
|
2638
2625
|
<input
|
|
2639
2626
|
.value=${e.settings.gatewayUrl}
|
|
2640
|
-
@input=${d=>{const
|
|
2627
|
+
@input=${d=>{const u=d.target.value;e.onSettingsChange({...e.settings,gatewayUrl:u})}}
|
|
2641
2628
|
placeholder="ws://100.x.y.z:18789"
|
|
2642
2629
|
/>
|
|
2643
2630
|
</label>
|
|
@@ -2645,7 +2632,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2645
2632
|
<span>Gateway Token</span>
|
|
2646
2633
|
<input
|
|
2647
2634
|
.value=${e.settings.token}
|
|
2648
|
-
@input=${d=>{const
|
|
2635
|
+
@input=${d=>{const u=d.target.value;e.onSettingsChange({...e.settings,token:u})}}
|
|
2649
2636
|
placeholder="POOLBOT_GATEWAY_TOKEN"
|
|
2650
2637
|
/>
|
|
2651
2638
|
</label>
|
|
@@ -2654,7 +2641,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2654
2641
|
<input
|
|
2655
2642
|
type="password"
|
|
2656
2643
|
.value=${e.password}
|
|
2657
|
-
@input=${d=>{const
|
|
2644
|
+
@input=${d=>{const u=d.target.value;e.onPasswordChange(u)}}
|
|
2658
2645
|
placeholder="system or shared password"
|
|
2659
2646
|
/>
|
|
2660
2647
|
</label>
|
|
@@ -2663,7 +2650,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2663
2650
|
<button class="btn" @click=${()=>e.onConnect()}>Connect</button>
|
|
2664
2651
|
<button class="btn" @click=${()=>e.onRefresh()}>Refresh</button>
|
|
2665
2652
|
</div>
|
|
2666
|
-
${e.lastError?r`<div class="callout danger" style="margin-top: 14px;">${e.lastError}${
|
|
2653
|
+
${e.lastError?r`<div class="callout danger" style="margin-top: 14px;">${e.lastError}${p??""}</div>`:f}
|
|
2667
2654
|
</div>
|
|
2668
2655
|
|
|
2669
2656
|
<div class="card glass-card">
|
|
@@ -2689,7 +2676,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2689
2676
|
</div>
|
|
2690
2677
|
</div>
|
|
2691
2678
|
</section>
|
|
2692
|
-
`}const
|
|
2679
|
+
`}const Ef=["","off","minimal","low","medium","high"],Lf=["","off","on"],Mf=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"}],Rf=["","off","on","stream"];function If(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function Cr(e){return If(e)==="zai"}function Pf(e){return Cr(e)?Lf:Ef}function Nf(e,t){return!t||!e||e==="off"?e:"on"}function Of(e,t){return e?t&&e==="on"?"low":e:null}function Df(e){const t=e.result?.sessions??[];return r`
|
|
2693
2680
|
<section class="card">
|
|
2694
2681
|
<div class="row" style="justify-content: space-between;">
|
|
2695
2682
|
<div>
|
|
@@ -2734,7 +2721,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2734
2721
|
</label>
|
|
2735
2722
|
</div>
|
|
2736
2723
|
|
|
2737
|
-
${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:
|
|
2724
|
+
${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:f}
|
|
2738
2725
|
|
|
2739
2726
|
<div class="muted" style="margin-top: 12px;">
|
|
2740
2727
|
${e.result?`Store: ${e.result.path}`:""}
|
|
@@ -2752,12 +2739,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2752
2739
|
<div>Reasoning</div>
|
|
2753
2740
|
<div>Actions</div>
|
|
2754
2741
|
</div>
|
|
2755
|
-
${t.length===0?r`<div class="muted">No sessions found.</div>`:t.map(n=>
|
|
2742
|
+
${t.length===0?r`<div class="muted">No sessions found.</div>`:t.map(n=>Bf(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
|
|
2756
2743
|
</div>
|
|
2757
2744
|
</section>
|
|
2758
|
-
`}function
|
|
2745
|
+
`}function Bf(e,t,n,s,i){const a=e.updatedAt?O(e.updatedAt):"n/a",o=e.thinkingLevel??"",c=Cr(e.modelProvider),l=Nf(o,c),p=Pf(e.modelProvider),d=e.verboseLevel??"",u=e.reasoningLevel??"",g=e.displayName??e.key,v=e.kind!=="global",w=v?`${cn("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return r`
|
|
2759
2746
|
<div class="table-row">
|
|
2760
|
-
<div class="mono">${
|
|
2747
|
+
<div class="mono">${v?r`<a href=${w} class="session-link">${g}</a>`:g}</div>
|
|
2761
2748
|
<div>
|
|
2762
2749
|
<input
|
|
2763
2750
|
.value=${e.label??""}
|
|
@@ -2768,14 +2755,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2768
2755
|
</div>
|
|
2769
2756
|
<div>${e.kind}</div>
|
|
2770
2757
|
<div>${a}</div>
|
|
2771
|
-
<div>${
|
|
2758
|
+
<div>${Dh(e)}</div>
|
|
2772
2759
|
<div>
|
|
2773
2760
|
<select
|
|
2774
2761
|
.value=${l}
|
|
2775
2762
|
?disabled=${i}
|
|
2776
|
-
@change=${$=>{const k=$.target.value;n(e.key,{thinkingLevel:
|
|
2763
|
+
@change=${$=>{const k=$.target.value;n(e.key,{thinkingLevel:Of(k,c)})}}
|
|
2777
2764
|
>
|
|
2778
|
-
${
|
|
2765
|
+
${p.map($=>r`<option value=${$}>${$||"inherit"}</option>`)}
|
|
2779
2766
|
</select>
|
|
2780
2767
|
</div>
|
|
2781
2768
|
<div>
|
|
@@ -2784,16 +2771,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2784
2771
|
?disabled=${i}
|
|
2785
2772
|
@change=${$=>{const k=$.target.value;n(e.key,{verboseLevel:k||null})}}
|
|
2786
2773
|
>
|
|
2787
|
-
${
|
|
2774
|
+
${Mf.map($=>r`<option value=${$.value}>${$.label}</option>`)}
|
|
2788
2775
|
</select>
|
|
2789
2776
|
</div>
|
|
2790
2777
|
<div>
|
|
2791
2778
|
<select
|
|
2792
|
-
.value=${
|
|
2779
|
+
.value=${u}
|
|
2793
2780
|
?disabled=${i}
|
|
2794
2781
|
@change=${$=>{const k=$.target.value;n(e.key,{reasoningLevel:k||null})}}
|
|
2795
2782
|
>
|
|
2796
|
-
${
|
|
2783
|
+
${Rf.map($=>r`<option value=${$}>${$||"inherit"}</option>`)}
|
|
2797
2784
|
</select>
|
|
2798
2785
|
</div>
|
|
2799
2786
|
<div>
|
|
@@ -2802,7 +2789,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2802
2789
|
</button>
|
|
2803
2790
|
</div>
|
|
2804
2791
|
</div>
|
|
2805
|
-
`}function
|
|
2792
|
+
`}function Ff(e){const t=Math.max(0,e),n=Math.floor(t/1e3);if(n<60)return`${n}s`;const s=Math.floor(n/60);return s<60?`${s}m`:`${Math.floor(s/60)}h`}function Re(e,t){return t?r`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:f}function Uf(e){const t=e.execApprovalQueue[0];if(!t)return f;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${Ff(s)}`:"expired",a=e.execApprovalQueue.length;return r`
|
|
2806
2793
|
<div class="exec-approval-overlay" role="dialog" aria-live="polite">
|
|
2807
2794
|
<div class="exec-approval-card">
|
|
2808
2795
|
<div class="exec-approval-header">
|
|
@@ -2810,19 +2797,19 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2810
2797
|
<div class="exec-approval-title">Exec approval needed</div>
|
|
2811
2798
|
<div class="exec-approval-sub">${i}</div>
|
|
2812
2799
|
</div>
|
|
2813
|
-
${a>1?r`<div class="exec-approval-queue">${a} pending</div>`:
|
|
2800
|
+
${a>1?r`<div class="exec-approval-queue">${a} pending</div>`:f}
|
|
2814
2801
|
</div>
|
|
2815
2802
|
<div class="exec-approval-command mono">${n.command}</div>
|
|
2816
2803
|
<div class="exec-approval-meta">
|
|
2817
|
-
${
|
|
2818
|
-
${
|
|
2819
|
-
${
|
|
2820
|
-
${
|
|
2821
|
-
${
|
|
2822
|
-
${
|
|
2823
|
-
${
|
|
2824
|
-
</div>
|
|
2825
|
-
${e.execApprovalError?r`<div class="exec-approval-error">${e.execApprovalError}</div>`:
|
|
2804
|
+
${Re("Host",n.host)}
|
|
2805
|
+
${Re("Agent",n.agentId)}
|
|
2806
|
+
${Re("Session",n.sessionKey)}
|
|
2807
|
+
${Re("CWD",n.cwd)}
|
|
2808
|
+
${Re("Resolved",n.resolvedPath)}
|
|
2809
|
+
${Re("Security",n.security)}
|
|
2810
|
+
${Re("Ask",n.ask)}
|
|
2811
|
+
</div>
|
|
2812
|
+
${e.execApprovalError?r`<div class="exec-approval-error">${e.execApprovalError}</div>`:f}
|
|
2826
2813
|
<div class="exec-approval-actions">
|
|
2827
2814
|
<button
|
|
2828
2815
|
class="btn primary"
|
|
@@ -2848,7 +2835,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2848
2835
|
</div>
|
|
2849
2836
|
</div>
|
|
2850
2837
|
</div>
|
|
2851
|
-
`}function
|
|
2838
|
+
`}function Kf(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(i=>[i.name,i.description,i.source].join(" ").toLowerCase().includes(n)):t;return r`
|
|
2852
2839
|
<section class="card">
|
|
2853
2840
|
<div class="row" style="justify-content: space-between;">
|
|
2854
2841
|
<div>
|
|
@@ -2872,38 +2859,38 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2872
2859
|
<div class="muted">${s.length} shown</div>
|
|
2873
2860
|
</div>
|
|
2874
2861
|
|
|
2875
|
-
${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:
|
|
2862
|
+
${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:f}
|
|
2876
2863
|
|
|
2877
2864
|
${s.length===0?r`<div class="muted" style="margin-top: 16px;">No skills found.</div>`:r`
|
|
2878
2865
|
<div class="list" style="margin-top: 16px;">
|
|
2879
|
-
${s.map(i=>
|
|
2866
|
+
${s.map(i=>Hf(i,e))}
|
|
2880
2867
|
</div>
|
|
2881
2868
|
`}
|
|
2882
2869
|
</section>
|
|
2883
|
-
`}function
|
|
2870
|
+
`}function Hf(e,t){const n=t.busyKey===e.skillKey,s=t.edits[e.skillKey]??"",i=t.messages[e.skillKey]??null,a=e.install.length>0&&e.missing.bins.length>0,o=[...e.missing.bins.map(l=>`bin:${l}`),...e.missing.env.map(l=>`env:${l}`),...e.missing.config.map(l=>`config:${l}`),...e.missing.os.map(l=>`os:${l}`)],c=[];return e.disabled&&c.push("disabled"),e.blockedByAllowlist&&c.push("blocked by allowlist"),r`
|
|
2884
2871
|
<div class="list-item">
|
|
2885
2872
|
<div class="list-main">
|
|
2886
2873
|
<div class="list-title">
|
|
2887
2874
|
${e.emoji?`${e.emoji} `:""}${e.name}
|
|
2888
2875
|
</div>
|
|
2889
|
-
<div class="list-sub">${
|
|
2876
|
+
<div class="list-sub">${ds(e.description,140)}</div>
|
|
2890
2877
|
<div class="chip-row" style="margin-top: 6px;">
|
|
2891
2878
|
<span class="chip">${e.source}</span>
|
|
2892
2879
|
<span class="chip ${e.eligible?"chip-ok":"chip-warn"}">
|
|
2893
2880
|
${e.eligible?"eligible":"blocked"}
|
|
2894
2881
|
</span>
|
|
2895
|
-
${e.disabled?r`<span class="chip chip-warn">disabled</span>`:
|
|
2882
|
+
${e.disabled?r`<span class="chip chip-warn">disabled</span>`:f}
|
|
2896
2883
|
</div>
|
|
2897
2884
|
${o.length>0?r`
|
|
2898
2885
|
<div class="muted" style="margin-top: 6px;">
|
|
2899
2886
|
Missing: ${o.join(", ")}
|
|
2900
2887
|
</div>
|
|
2901
|
-
`:
|
|
2888
|
+
`:f}
|
|
2902
2889
|
${c.length>0?r`
|
|
2903
2890
|
<div class="muted" style="margin-top: 6px;">
|
|
2904
2891
|
Reason: ${c.join(", ")}
|
|
2905
2892
|
</div>
|
|
2906
|
-
`:
|
|
2893
|
+
`:f}
|
|
2907
2894
|
</div>
|
|
2908
2895
|
<div class="list-meta">
|
|
2909
2896
|
<div class="row" style="justify-content: flex-end; flex-wrap: wrap;">
|
|
@@ -2920,14 +2907,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2920
2907
|
@click=${()=>t.onInstall(e.skillKey,e.name,e.install[0].id)}
|
|
2921
2908
|
>
|
|
2922
2909
|
${n?"Installing…":e.install[0].label}
|
|
2923
|
-
</button>`:
|
|
2910
|
+
</button>`:f}
|
|
2924
2911
|
</div>
|
|
2925
2912
|
${i?r`<div
|
|
2926
2913
|
class="muted"
|
|
2927
2914
|
style="margin-top: 8px; color: ${i.kind==="error"?"var(--danger-color, #d14343)":"var(--success-color, #0a7f5a)"};"
|
|
2928
2915
|
>
|
|
2929
2916
|
${i.message}
|
|
2930
|
-
</div>`:
|
|
2917
|
+
</div>`:f}
|
|
2931
2918
|
${e.primaryEnv?r`
|
|
2932
2919
|
<div class="field" style="margin-top: 10px;">
|
|
2933
2920
|
<span>API key</span>
|
|
@@ -2945,28 +2932,28 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2945
2932
|
>
|
|
2946
2933
|
Save key
|
|
2947
2934
|
</button>
|
|
2948
|
-
`:
|
|
2935
|
+
`:f}
|
|
2949
2936
|
</div>
|
|
2950
2937
|
</div>
|
|
2951
|
-
`}function
|
|
2938
|
+
`}function zf(e,t){const n=cn(t,e.basePath);return r`
|
|
2952
2939
|
<a
|
|
2953
2940
|
href=${n}
|
|
2954
2941
|
class="nav-item ${e.tab===t?"active":""}"
|
|
2955
2942
|
@click=${s=>{s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||(s.preventDefault(),e.setTab(t))}}
|
|
2956
|
-
title=${
|
|
2943
|
+
title=${ls(t)}
|
|
2957
2944
|
>
|
|
2958
|
-
<span class="nav-item__icon" aria-hidden="true">${
|
|
2959
|
-
<span class="nav-item__text">${
|
|
2945
|
+
<span class="nav-item__icon" aria-hidden="true">${W[Cl(t)]}</span>
|
|
2946
|
+
<span class="nav-item__text">${ls(t)}</span>
|
|
2960
2947
|
</a>
|
|
2961
|
-
`}function
|
|
2948
|
+
`}function jf(e){const t=qf(e.sessionKey,e.sessionsResult),n=e.onboarding,s=e.onboarding,i=e.onboarding?!1:e.settings.chatShowThinking,a=e.onboarding?!0:e.settings.chatFocusMode,o=r`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg>`,c=r`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7V4h3"></path><path d="M20 7V4h-3"></path><path d="M4 17v3h3"></path><path d="M20 17v3h-3"></path><circle cx="12" cy="12" r="3"></circle></svg>`;return r`
|
|
2962
2949
|
<div class="chat-controls">
|
|
2963
2950
|
<label class="field chat-controls__session">
|
|
2964
2951
|
<select
|
|
2965
2952
|
.value=${e.sessionKey}
|
|
2966
2953
|
?disabled=${!e.connected}
|
|
2967
|
-
@change=${l=>{const
|
|
2954
|
+
@change=${l=>{const p=l.target.value;e.sessionKey=p,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:p,lastActiveSessionKey:p}),e.loadAssistantIdentity(),Td(e,p),et(e)}}
|
|
2968
2955
|
>
|
|
2969
|
-
${
|
|
2956
|
+
${Yo(t,l=>l.key,l=>r`<option value=${l.key}>
|
|
2970
2957
|
${l.displayName??l.key}
|
|
2971
2958
|
</option>`)}
|
|
2972
2959
|
</select>
|
|
@@ -2974,7 +2961,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2974
2961
|
<button
|
|
2975
2962
|
class="btn btn--sm btn--icon"
|
|
2976
2963
|
?disabled=${e.chatLoading||!e.connected}
|
|
2977
|
-
@click=${()=>{e.resetToolStream(),
|
|
2964
|
+
@click=${()=>{e.resetToolStream(),et(e)}}
|
|
2978
2965
|
title="Refresh chat history"
|
|
2979
2966
|
>
|
|
2980
2967
|
${o}
|
|
@@ -2987,7 +2974,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2987
2974
|
aria-pressed=${i}
|
|
2988
2975
|
title=${n?"Disabled during onboarding":"Toggle assistant thinking/working output"}
|
|
2989
2976
|
>
|
|
2990
|
-
${
|
|
2977
|
+
${W.brain}
|
|
2991
2978
|
</button>
|
|
2992
2979
|
<button
|
|
2993
2980
|
class="btn btn--sm btn--icon ${a?"active":""}"
|
|
@@ -2999,7 +2986,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2999
2986
|
${c}
|
|
3000
2987
|
</button>
|
|
3001
2988
|
</div>
|
|
3002
|
-
`}function
|
|
2989
|
+
`}function qf(e,t){const n=new Set,s=[],i=t?.sessions?.find(a=>a.key===e);if(n.add(e),s.push({key:e,displayName:i?.displayName}),t?.sessions)for(const a of t.sessions)n.has(a.key)||(n.add(a.key),s.push({key:a.key,displayName:a.displayName}));return s}const Vf=["system","light","dark"];function Wf(e){const t=Math.max(0,Vf.indexOf(e.theme)),n=s=>i=>{const o={element:i.currentTarget};(i.clientX||i.clientY)&&(o.pointerClientX=i.clientX,o.pointerClientY=i.clientY),e.setTheme(s,o)};return r`
|
|
3003
2990
|
<div class="theme-toggle" style="--theme-index: ${t};">
|
|
3004
2991
|
<div class="theme-toggle__track" role="group" aria-label="Theme">
|
|
3005
2992
|
<span class="theme-toggle__indicator"></span>
|
|
@@ -3010,7 +2997,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3010
2997
|
aria-label="System theme"
|
|
3011
2998
|
title="System"
|
|
3012
2999
|
>
|
|
3013
|
-
${
|
|
3000
|
+
${Qf()}
|
|
3014
3001
|
</button>
|
|
3015
3002
|
<button
|
|
3016
3003
|
class="theme-toggle__button ${e.theme==="light"?"active":""}"
|
|
@@ -3019,7 +3006,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3019
3006
|
aria-label="Light theme"
|
|
3020
3007
|
title="Light"
|
|
3021
3008
|
>
|
|
3022
|
-
${
|
|
3009
|
+
${Gf()}
|
|
3023
3010
|
</button>
|
|
3024
3011
|
<button
|
|
3025
3012
|
class="theme-toggle__button ${e.theme==="dark"?"active":""}"
|
|
@@ -3028,11 +3015,11 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3028
3015
|
aria-label="Dark theme"
|
|
3029
3016
|
title="Dark"
|
|
3030
3017
|
>
|
|
3031
|
-
${
|
|
3018
|
+
${Yf()}
|
|
3032
3019
|
</button>
|
|
3033
3020
|
</div>
|
|
3034
3021
|
</div>
|
|
3035
|
-
`}function
|
|
3022
|
+
`}function Gf(){return r`
|
|
3036
3023
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3037
3024
|
<circle cx="12" cy="12" r="4"></circle>
|
|
3038
3025
|
<path d="M12 2v2"></path>
|
|
@@ -3044,19 +3031,19 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3044
3031
|
<path d="m6.34 17.66-1.41 1.41"></path>
|
|
3045
3032
|
<path d="m19.07 4.93-1.41 1.41"></path>
|
|
3046
3033
|
</svg>
|
|
3047
|
-
`}function
|
|
3034
|
+
`}function Yf(){return r`
|
|
3048
3035
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3049
3036
|
<path
|
|
3050
3037
|
d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"
|
|
3051
3038
|
></path>
|
|
3052
3039
|
</svg>
|
|
3053
|
-
`}function
|
|
3040
|
+
`}function Qf(){return r`
|
|
3054
3041
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3055
3042
|
<rect width="20" height="14" x="2" y="3" rx="2"></rect>
|
|
3056
3043
|
<line x1="8" x2="16" y1="21" y2="21"></line>
|
|
3057
3044
|
<line x1="12" x2="12" y1="17" y2="21"></line>
|
|
3058
3045
|
</svg>
|
|
3059
|
-
`}const
|
|
3046
|
+
`}const Jf=/^data:/i,Zf=/^https?:\/\//i;function Xf(e){const t=e.agentsList?.agents??[],s=lo(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",a=t.find(c=>c.id===s)?.identity,o=a?.avatarUrl??a?.avatar;if(o)return Jf.test(o)||Zf.test(o)?o:a?.avatarUrl}function eg(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,s=e.cronStatus?.nextWakeAtMs??null,i=e.connected?null:"Disconnected from gateway.",a=e.tab==="chat",o=a&&(e.settings.chatFocusMode||e.onboarding),c=e.onboarding?!1:e.settings.chatShowThinking,l=Xf(e),p=e.chatAvatarUrl??l??null;return r`
|
|
3060
3047
|
<div class="shell ${a?"shell--chat":""} ${o?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
|
|
3061
3048
|
<header class="topbar">
|
|
3062
3049
|
<div class="topbar-left">
|
|
@@ -3066,7 +3053,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3066
3053
|
title="${e.settings.navCollapsed?"Expand sidebar":"Collapse sidebar"}"
|
|
3067
3054
|
aria-label="${e.settings.navCollapsed?"Expand sidebar":"Collapse sidebar"}"
|
|
3068
3055
|
>
|
|
3069
|
-
<span class="nav-collapse-toggle__icon">${
|
|
3056
|
+
<span class="nav-collapse-toggle__icon">${W.menu}</span>
|
|
3070
3057
|
</button>
|
|
3071
3058
|
<div class="brand">
|
|
3072
3059
|
<div class="brand-logo">
|
|
@@ -3084,22 +3071,22 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3084
3071
|
<span>Health</span>
|
|
3085
3072
|
<span class="mono">${e.connected?"OK":"Offline"}</span>
|
|
3086
3073
|
</div>
|
|
3087
|
-
${
|
|
3074
|
+
${Wf(e)}
|
|
3088
3075
|
</div>
|
|
3089
3076
|
</header>
|
|
3090
3077
|
<aside class="nav ${e.settings.navCollapsed?"nav--collapsed":""}">
|
|
3091
|
-
${
|
|
3092
|
-
<div class="nav-group ${
|
|
3078
|
+
${Sl.map(d=>{const u=e.settings.navGroupsCollapsed[d.label]??!1,g=d.tabs.some(v=>v===e.tab);return r`
|
|
3079
|
+
<div class="nav-group ${u&&!g?"nav-group--collapsed":""}">
|
|
3093
3080
|
<button
|
|
3094
3081
|
class="nav-label"
|
|
3095
|
-
@click=${()=>{const
|
|
3096
|
-
aria-expanded=${!
|
|
3082
|
+
@click=${()=>{const v={...e.settings.navGroupsCollapsed};v[d.label]=!u,e.applySettings({...e.settings,navGroupsCollapsed:v})}}
|
|
3083
|
+
aria-expanded=${!u}
|
|
3097
3084
|
>
|
|
3098
3085
|
<span class="nav-label__text">${d.label}</span>
|
|
3099
|
-
<span class="nav-label__chevron">${
|
|
3086
|
+
<span class="nav-label__chevron">${u?"+":"−"}</span>
|
|
3100
3087
|
</button>
|
|
3101
3088
|
<div class="nav-group__items">
|
|
3102
|
-
${d.tabs.map(
|
|
3089
|
+
${d.tabs.map(v=>zf(e,v))}
|
|
3103
3090
|
</div>
|
|
3104
3091
|
</div>
|
|
3105
3092
|
`})}
|
|
@@ -3115,7 +3102,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3115
3102
|
rel="noreferrer"
|
|
3116
3103
|
title="Docs (opens in new tab)"
|
|
3117
3104
|
>
|
|
3118
|
-
<span class="nav-item__icon" aria-hidden="true">${
|
|
3105
|
+
<span class="nav-item__icon" aria-hidden="true">${W.book}</span>
|
|
3119
3106
|
<span class="nav-item__text">Docs</span>
|
|
3120
3107
|
</a>
|
|
3121
3108
|
</div>
|
|
@@ -3124,40 +3111,40 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3124
3111
|
<main class="content ${a?"content--chat":""}">
|
|
3125
3112
|
<section class="content-header">
|
|
3126
3113
|
<div>
|
|
3127
|
-
<div class="page-title">${
|
|
3128
|
-
<div class="page-sub">${
|
|
3114
|
+
<div class="page-title">${ls(e.tab)}</div>
|
|
3115
|
+
<div class="page-sub">${Tl(e.tab)}</div>
|
|
3129
3116
|
</div>
|
|
3130
3117
|
<div class="page-meta">
|
|
3131
|
-
${e.lastError?r`<div class="pill danger">${e.lastError}</div>`:
|
|
3132
|
-
${a?
|
|
3118
|
+
${e.lastError?r`<div class="pill danger">${e.lastError}</div>`:f}
|
|
3119
|
+
${a?jf(e):f}
|
|
3133
3120
|
</div>
|
|
3134
3121
|
</section>
|
|
3135
3122
|
|
|
3136
|
-
${e.tab==="overview"?
|
|
3123
|
+
${e.tab==="overview"?Tf({connected:e.connected,hello:e.hello,settings:e.settings,password:e.password,lastError:e.lastError,presenceCount:t,sessionsCount:n,cronEnabled:e.cronStatus?.enabled??null,cronNext:s,lastChannelsRefresh:e.channelsLastSuccess,onSettingsChange:d=>e.applySettings(d),onPasswordChange:d=>e.password=d,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity()},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):f}
|
|
3137
3124
|
|
|
3138
|
-
${e.tab==="channels"?
|
|
3125
|
+
${e.tab==="channels"?Sh({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,whatsappMessage:e.whatsappLoginMessage,whatsappQrDataUrl:e.whatsappLoginQrDataUrl,whatsappConnected:e.whatsappLoginConnected,whatsappBusy:e.whatsappBusy,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,nostrProfileFormState:e.nostrProfileFormState,nostrProfileAccountId:e.nostrProfileAccountId,onRefresh:d=>oe(e,d),onWhatsAppStart:d=>e.handleWhatsAppStart(d),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(d,u)=>Ft(e,d,u),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(d,u)=>e.handleNostrProfileEdit(d,u),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(d,u)=>e.handleNostrProfileFieldChange(d,u),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):f}
|
|
3139
3126
|
|
|
3140
|
-
${e.tab==="instances"?
|
|
3127
|
+
${e.tab==="instances"?Yh({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>Ws(e)}):f}
|
|
3141
3128
|
|
|
3142
|
-
${e.tab==="sessions"
|
|
3129
|
+
${e.tab==="sessions"?Df({loading:e.sessionsLoading,result:e.sessionsResult,error:e.sessionsError,activeMinutes:e.sessionsFilterActive,limit:e.sessionsFilterLimit,includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown,basePath:e.basePath,onFiltersChange:d=>{e.sessionsFilterActive=d.activeMinutes,e.sessionsFilterLimit=d.limit,e.sessionsIncludeGlobal=d.includeGlobal,e.sessionsIncludeUnknown=d.includeUnknown},onRefresh:()=>it(e),onPatch:(d,u)=>ql(e,d,u),onDelete:d=>Vl(e,d)}):f}
|
|
3143
3130
|
|
|
3144
|
-
${e.tab==="cron"?
|
|
3131
|
+
${e.tab==="cron"?Hh({loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(d=>d.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,onFormChange:d=>e.cronForm={...e.cronForm,...d},onRefresh:()=>e.loadCron(),onAdd:()=>fc(e),onToggle:(d,u)=>gc(e,d,u),onRun:d=>vc(e,d),onRemove:d=>mc(e,d),onLoadRuns:d=>bo(e,d)}):f}
|
|
3145
3132
|
|
|
3146
|
-
${e.tab==="skills"?
|
|
3133
|
+
${e.tab==="skills"?Kf({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:d=>e.skillsFilter=d,onRefresh:()=>Et(e,{clearMessages:!0}),onToggle:(d,u)=>ud(e,d,u),onEdit:(d,u)=>dd(e,d,u),onSaveKey:d=>pd(e,d),onInstall:(d,u,g)=>hd(e,d,u,g)}):f}
|
|
3147
3134
|
|
|
3148
|
-
${e.tab==="nodes"?
|
|
3135
|
+
${e.tab==="nodes"?gf({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:()=>vn(e),onDevicesRefresh:()=>Ce(e),onDeviceApprove:d=>ed(e,d),onDeviceReject:d=>td(e,d),onDeviceRotate:(d,u,g)=>nd(e,{deviceId:d,role:u,scopes:g}),onDeviceRevoke:(d,u)=>sd(e,{deviceId:d,role:u}),onLoadConfig:()=>ye(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Vs(e,d)},onBindDefault:d=>{d?Ft(e,["tools","exec","node"],d):sa(e,["tools","exec","node"])},onBindAgent:(d,u)=>{const g=["agents","list",d,"tools","exec","node"];u?Ft(e,g,u):sa(e,g)},onSaveBindings:()=>hs(e),onExecApprovalsTargetChange:(d,u)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=u,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,u)=>ld(e,d,u),onExecApprovalsRemove:d=>cd(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return rd(e,d)}}):f}
|
|
3149
3136
|
|
|
3150
|
-
${e.tab==="chat"?
|
|
3137
|
+
${e.tab==="chat"?zp({sessionKey:e.sessionKey,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity(),et(e),ys(e)},thinkingLevel:e.chatThinkingLevel,showThinking:c,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:p,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:i,error:e.lastError,sessions:e.sessionsResult,focusMode:o,onRefresh:()=>(e.resetToolStream(),Promise.all([et(e),ys(e)])),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:d=>e.handleChatScroll(d),onDraftChange:d=>e.chatMessage=d,attachments:e.chatAttachments,onAttachmentsChange:d=>e.chatAttachments=d,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:d=>e.removeQueuedMessage(d),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:d=>e.handleOpenSidebar(d),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:d=>e.handleSplitRatioChange(d),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar}):f}
|
|
3151
3138
|
|
|
3152
|
-
${e.tab==="config"?
|
|
3139
|
+
${e.tab==="config"?rh({raw:e.configRaw,originalRaw:e.configRawOriginal,valid:e.configValid,issues:e.configIssues,loading:e.configLoading,saving:e.configSaving,applying:e.configApplying,updating:e.updateRunning,connected:e.connected,schema:e.configSchema,schemaLoading:e.configSchemaLoading,uiHints:e.configUiHints,formMode:e.configFormMode,formValue:e.configForm,originalValue:e.configFormOriginal,searchQuery:e.configSearchQuery,activeSection:e.configActiveSection,activeSubsection:e.configActiveSubsection,onRawChange:d=>{e.configRaw=d},onFormModeChange:d=>e.configFormMode=d,onFormPatch:(d,u)=>Ft(e,d,u),onSearchChange:d=>e.configSearchQuery=d,onSectionChange:d=>{e.configActiveSection=d,e.configActiveSubsection=null},onSubsectionChange:d=>e.configActiveSubsection=d,onReload:()=>ye(e),onSave:()=>hs(e),onApply:()=>dc(e),onUpdate:()=>uc(e)}):f}
|
|
3153
3140
|
|
|
3154
|
-
${e.tab==="debug"?
|
|
3141
|
+
${e.tab==="debug"?Gh({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:d=>e.debugCallMethod=d,onCallParamsChange:d=>e.debugCallParams=d,onRefresh:()=>fn(e),onCall:()=>$c(e)}):f}
|
|
3155
3142
|
|
|
3156
|
-
${e.tab==="logs"?
|
|
3143
|
+
${e.tab==="logs"?Xh({loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:d=>e.logsFilterText=d,onLevelToggle:(d,u)=>{e.logsLevelFilters={...e.logsLevelFilters,[d]:u}},onToggleAutoFollow:d=>e.logsAutoFollow=d,onRefresh:()=>Fs(e,{reset:!0}),onExport:(d,u)=>e.exportLogs(d,u),onScroll:d=>e.handleLogsScroll(d)}):f}
|
|
3157
3144
|
</main>
|
|
3158
|
-
${
|
|
3145
|
+
${Uf(e)}
|
|
3159
3146
|
</div>
|
|
3160
|
-
`}const Fg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Ug={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};async function Kg(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const Gr={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"poolbot-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"poolbot-macos",IOS_APP:"poolbot-ios",ANDROID_APP:"poolbot-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"poolbot-probe"},mo=Gr,Ws={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(Gr));new Set(Object.values(Ws));function zg(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const Hg=4008;class jg{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await ai();const d=Nd({deviceId:i.deviceId,role:s})?.token;o=d??this.opts.token,a=!!(d&&this.opts.token)}const c=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let l;if(t&&i){const d=Date.now(),p=this.connectNonce??void 0,f=zg({deviceId:i.deviceId,clientId:this.opts.clientName??mo.CONTROL_UI,clientMode:this.opts.mode??Ws.WEBCHAT,role:s,scopes:n,signedAtMs:d,token:o??null,nonce:p}),m=await Ld(i.privateKey,f);l={id:i.deviceId,publicKey:i.publicKey,signature:m,signedAt:d,nonce:p}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??mo.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Ws.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:l,caps:[],auth:c,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(d=>{d?.auth?.deviceToken&&i&&nr({deviceId:i.deviceId,role:d.auth.role??s,token:d.auth.deviceToken,scopes:d.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(d)}).catch(()=>{a&&i&&sr({deviceId:i.deviceId,role:s}),this.ws?.close(Hg,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,c=o&&typeof o.nonce=="string"?o.nonce:null;c&&(this.connectNonce=c,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=ei(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,c)=>{this.pending.set(s,{resolve:l=>o(l),reject:c})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function qs(e){return typeof e=="object"&&e!==null}function Vg(e){if(!qs(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!qs(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function Wg(e){if(!qs(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 Yr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function qg(e,t){const n=Yr(e).filter(s=>s.id!==t.id);return n.push(t),n}function vo(e,t){return Yr(e).filter(n=>n.id!==t)}async function Qr(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=Ss(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function bs(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function Gg(e,t){if(!t?.mainSessionKey)return;const n=bs(e.sessionKey,t),s=bs(e.settings.sessionKey,t),i=bs(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},c=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),c&&Re(e,o)}function Jr(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new jg({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"poolbot-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,Jg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,kn(e),Qr(e),Kg(e),Cn(e,{quiet:!0}),Pe(e,{quiet:!0}),gi(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>Yg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function Yg(e,t){try{Qg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Qg(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;Bc(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&ir(e,n.sessionKey);const s=_c(e,n);(s==="final"||s==="error"||s==="aborted")&&(kn(e),vu(e)),s==="final"&<(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&mi(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Pe(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=Vg(t.payload);if(n){e.execApprovalQueue=qg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=vo(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=Wg(t.payload);n&&(e.execApprovalQueue=vo(e.execApprovalQueue,n.id))}}function Jg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&Gg(e,n.sessionDefaults)}function Zg(e){e.basePath=iu(),lu(e,!0),au(e),ou(e),window.addEventListener("popstate",e.popStateHandler),tu(e),Jr(e),Xd(e),e.tab==="logs"&&ui(e),e.tab==="debug"&&hi(e)}function Xg(e){Hc(e)}function em(e){window.removeEventListener("popstate",e.popStateHandler),eu(e),pi(e),fi(e),ru(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function tm(e,t){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;Sn(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&No(e,t.has("tab")||t.has("logsAutoFollow"))}async function nm(e,t){await ed(e,t),await ue(e,!0)}async function sm(e){await td(e),await ue(e,!0)}async function im(e){await nd(e),await ue(e,!0)}async function am(e){await Rs(e),await Ae(e),await ue(e,!0)}async function om(e){await Ae(e),await ue(e,!0)}function rm(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function Zr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function Xr(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function lm(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=sf(n??void 0)}function cm(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function dm(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function um(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function pm(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Zr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(Xr(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:rm(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 ue(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function hm(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Zr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(Xr(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const l=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,c=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:c},i.saved&&await ue(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}var fm=Object.defineProperty,gm=Object.getOwnPropertyDescriptor,b=(e,t,n,s)=>{for(var i=s>1?void 0:s?gm(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&fm(t,n,i),i};const ws=ic();function mm(){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 pt{constructor(){super(...arguments),this.settings=ac(),this.password="",this.tab="chat",this.onboarding=mm(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=ws.name,this.assistantAvatar=ws.avatar,this.assistantAgentId=ws.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.configLoading=!1,this.configRaw=`{
|
|
3147
|
+
`}const tg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},ng={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};async function sg(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const Tr={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"poolbot-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"poolbot-macos",IOS_APP:"poolbot-ios",ANDROID_APP:"poolbot-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"poolbot-probe"},Ja=Tr,Ls={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(Tr));new Set(Object.values(Ls));function ig(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const ag=4008;class og{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await zs();const d=Xc({deviceId:i.deviceId,role:s})?.token;o=d??this.opts.token,a=!!(d&&this.opts.token)}const c=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let l;if(t&&i){const d=Date.now(),u=this.connectNonce??void 0,g=ig({deviceId:i.deviceId,clientId:this.opts.clientName??Ja.CONTROL_UI,clientMode:this.opts.mode??Ls.WEBCHAT,role:s,scopes:n,signedAtMs:d,token:o??null,nonce:u}),v=await Jc(i.privateKey,g);l={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:d,nonce:u}}const p={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ja.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Ls.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:l,caps:[],auth:c,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",p).then(d=>{d?.auth?.deviceToken&&i&&Oo({deviceId:i.deviceId,role:d.auth.role??s,token:d.auth.deviceToken,scopes:d.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(d)}).catch(()=>{a&&i&&Do({deviceId:i.deviceId,role:s}),this.ws?.close(ag,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,c=o&&typeof o.nonce=="string"?o.nonce:null;c&&(this.connectNonce=c,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Bs(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,c)=>{this.pending.set(s,{resolve:l=>o(l),reject:c})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ms(e){return typeof e=="object"&&e!==null}function rg(e){if(!Ms(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Ms(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function lg(e){if(!Ms(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 Er(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function cg(e,t){const n=Er(e).filter(s=>s.id!==t.id);return n.push(t),n}function Za(e,t){return Er(e).filter(n=>n.id!==t)}async function Lr(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=rs(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function is(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function dg(e,t){if(!t?.mainSessionKey)return;const n=is(e.sessionKey,t),s=is(e.settings.sessionKey,t),i=is(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},c=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),c&&ke(e,o)}function Mr(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new og({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"poolbot-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,hg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,un(e),Lr(e),sg(e),vn(e,{quiet:!0}),Ce(e,{quiet:!0}),Xs(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>ug(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function ug(e,t){try{pg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function pg(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;nc(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Bo(e,n.sessionKey);const s=jl(e,n);(s==="final"||s==="error"||s==="aborted")&&(un(e),Nd(e)),s==="final"&&et(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&ei(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Ce(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=rg(t.payload);if(n){e.execApprovalQueue=cg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Za(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=lg(t.payload);n&&(e.execApprovalQueue=Za(e.execApprovalQueue,n.id))}}function hg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&dg(e,n.sessionDefaults)}function fg(e){e.basePath=xd(),_d(e,!0),kd(e),Ad(e),window.addEventListener("popstate",e.popStateHandler),bd(e),Mr(e),md(e),e.tab==="logs"&&Ys(e),e.tab==="debug"&&Js(e)}function gg(e){rc(e)}function vg(e){window.removeEventListener("popstate",e.popStateHandler),yd(e),Qs(e),Zs(e),Sd(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function mg(e,t){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;pn(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&go(e,t.has("tab")||t.has("logsAutoFollow"))}async function yg(e,t){await yc(e,t),await oe(e,!0)}async function bg(e){await bc(e),await oe(e,!0)}async function wg(e){await wc(e),await oe(e,!0)}async function $g(e){await hs(e),await ye(e),await oe(e,!0)}async function xg(e){await ye(e),await oe(e,!0)}function kg(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function Rr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function Ir(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Ag(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=bh(n??void 0)}function Sg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function _g(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Cg(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Tg(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Rr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(Ir(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:kg(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await oe(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Eg(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Rr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(Ir(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const l=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,c=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:c},i.saved&&await oe(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}var Lg=Object.defineProperty,Mg=Object.getOwnPropertyDescriptor,y=(e,t,n,s)=>{for(var i=s>1?void 0:s?Mg(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&Lg(t,n,i),i};const as=xl();function Rg(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let m=class extends Ze{constructor(){super(...arguments),this.settings=kl(),this.password="",this.tab="chat",this.onboarding=Rg(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=as.name,this.assistantAvatar=as.avatar,this.assistantAgentId=as.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.configLoading=!1,this.configRaw=`{
|
|
3161
3148
|
}
|
|
3162
|
-
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...
|
|
3163
|
-
//# sourceMappingURL=index-
|
|
3149
|
+
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...ng},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...tg},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>Cd(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),fg(this)}firstUpdated(){gg(this)}disconnectedCallback(){vg(this),super.disconnectedCallback()}updated(e){mg(this,e)}connect(){Mr(this)}handleChatScroll(e){sc(this,e)}handleLogsScroll(e){ic(this,e)}exportLogs(e,t){oc(e,t)}resetToolStream(){un(this)}resetChatScroll(){ac(this)}async loadAssistantIdentity(){await Lr(this)}applySettings(e){ke(this,e)}setTab(e){wd(this,e)}setTheme(e,t){$d(this,e,t)}async loadOverview(){await Ko(this)}async loadCron(){await ei(this)}async handleAbortChat(){await zo(this)}removeQueuedMessage(e){Rd(this,e)}async handleSendChat(e,t){await Id(this,e,t)}async handleWhatsAppStart(e){await yg(this,e)}async handleWhatsAppWait(){await bg(this)}async handleWhatsAppLogout(){await wg(this)}async handleChannelConfigSave(){await $g(this)}async handleChannelConfigReload(){await xg(this)}handleNostrProfileEdit(e,t){Ag(this,e,t)}handleNostrProfileCancel(){Sg(this)}handleNostrProfileFieldChange(e,t){_g(this,e,t)}async handleNostrProfileSave(){await Tg(this)}async handleNostrProfileImport(){await Eg(this)}handleNostrProfileToggleAdvanced(){Cg(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return eg(this)}};y([b()],m.prototype,"settings",2);y([b()],m.prototype,"password",2);y([b()],m.prototype,"tab",2);y([b()],m.prototype,"onboarding",2);y([b()],m.prototype,"connected",2);y([b()],m.prototype,"theme",2);y([b()],m.prototype,"themeResolved",2);y([b()],m.prototype,"hello",2);y([b()],m.prototype,"lastError",2);y([b()],m.prototype,"eventLog",2);y([b()],m.prototype,"assistantName",2);y([b()],m.prototype,"assistantAvatar",2);y([b()],m.prototype,"assistantAgentId",2);y([b()],m.prototype,"sessionKey",2);y([b()],m.prototype,"chatLoading",2);y([b()],m.prototype,"chatSending",2);y([b()],m.prototype,"chatMessage",2);y([b()],m.prototype,"chatMessages",2);y([b()],m.prototype,"chatToolMessages",2);y([b()],m.prototype,"chatStream",2);y([b()],m.prototype,"chatStreamStartedAt",2);y([b()],m.prototype,"chatRunId",2);y([b()],m.prototype,"compactionStatus",2);y([b()],m.prototype,"chatAvatarUrl",2);y([b()],m.prototype,"chatThinkingLevel",2);y([b()],m.prototype,"chatQueue",2);y([b()],m.prototype,"chatAttachments",2);y([b()],m.prototype,"sidebarOpen",2);y([b()],m.prototype,"sidebarContent",2);y([b()],m.prototype,"sidebarError",2);y([b()],m.prototype,"splitRatio",2);y([b()],m.prototype,"nodesLoading",2);y([b()],m.prototype,"nodes",2);y([b()],m.prototype,"devicesLoading",2);y([b()],m.prototype,"devicesError",2);y([b()],m.prototype,"devicesList",2);y([b()],m.prototype,"execApprovalsLoading",2);y([b()],m.prototype,"execApprovalsSaving",2);y([b()],m.prototype,"execApprovalsDirty",2);y([b()],m.prototype,"execApprovalsSnapshot",2);y([b()],m.prototype,"execApprovalsForm",2);y([b()],m.prototype,"execApprovalsSelectedAgent",2);y([b()],m.prototype,"execApprovalsTarget",2);y([b()],m.prototype,"execApprovalsTargetNodeId",2);y([b()],m.prototype,"execApprovalQueue",2);y([b()],m.prototype,"execApprovalBusy",2);y([b()],m.prototype,"execApprovalError",2);y([b()],m.prototype,"configLoading",2);y([b()],m.prototype,"configRaw",2);y([b()],m.prototype,"configRawOriginal",2);y([b()],m.prototype,"configValid",2);y([b()],m.prototype,"configIssues",2);y([b()],m.prototype,"configSaving",2);y([b()],m.prototype,"configApplying",2);y([b()],m.prototype,"updateRunning",2);y([b()],m.prototype,"applySessionKey",2);y([b()],m.prototype,"configSnapshot",2);y([b()],m.prototype,"configSchema",2);y([b()],m.prototype,"configSchemaVersion",2);y([b()],m.prototype,"configSchemaLoading",2);y([b()],m.prototype,"configUiHints",2);y([b()],m.prototype,"configForm",2);y([b()],m.prototype,"configFormOriginal",2);y([b()],m.prototype,"configFormDirty",2);y([b()],m.prototype,"configFormMode",2);y([b()],m.prototype,"configSearchQuery",2);y([b()],m.prototype,"configActiveSection",2);y([b()],m.prototype,"configActiveSubsection",2);y([b()],m.prototype,"channelsLoading",2);y([b()],m.prototype,"channelsSnapshot",2);y([b()],m.prototype,"channelsError",2);y([b()],m.prototype,"channelsLastSuccess",2);y([b()],m.prototype,"whatsappLoginMessage",2);y([b()],m.prototype,"whatsappLoginQrDataUrl",2);y([b()],m.prototype,"whatsappLoginConnected",2);y([b()],m.prototype,"whatsappBusy",2);y([b()],m.prototype,"nostrProfileFormState",2);y([b()],m.prototype,"nostrProfileAccountId",2);y([b()],m.prototype,"presenceLoading",2);y([b()],m.prototype,"presenceEntries",2);y([b()],m.prototype,"presenceError",2);y([b()],m.prototype,"presenceStatus",2);y([b()],m.prototype,"agentsLoading",2);y([b()],m.prototype,"agentsList",2);y([b()],m.prototype,"agentsError",2);y([b()],m.prototype,"sessionsLoading",2);y([b()],m.prototype,"sessionsResult",2);y([b()],m.prototype,"sessionsError",2);y([b()],m.prototype,"sessionsFilterActive",2);y([b()],m.prototype,"sessionsFilterLimit",2);y([b()],m.prototype,"sessionsIncludeGlobal",2);y([b()],m.prototype,"sessionsIncludeUnknown",2);y([b()],m.prototype,"cronLoading",2);y([b()],m.prototype,"cronJobs",2);y([b()],m.prototype,"cronStatus",2);y([b()],m.prototype,"cronError",2);y([b()],m.prototype,"cronForm",2);y([b()],m.prototype,"cronRunsJobId",2);y([b()],m.prototype,"cronRuns",2);y([b()],m.prototype,"cronBusy",2);y([b()],m.prototype,"skillsLoading",2);y([b()],m.prototype,"skillsReport",2);y([b()],m.prototype,"skillsError",2);y([b()],m.prototype,"skillsFilter",2);y([b()],m.prototype,"skillEdits",2);y([b()],m.prototype,"skillsBusyKey",2);y([b()],m.prototype,"skillMessages",2);y([b()],m.prototype,"debugLoading",2);y([b()],m.prototype,"debugStatus",2);y([b()],m.prototype,"debugHealth",2);y([b()],m.prototype,"debugModels",2);y([b()],m.prototype,"debugHeartbeat",2);y([b()],m.prototype,"debugCallMethod",2);y([b()],m.prototype,"debugCallParams",2);y([b()],m.prototype,"debugCallResult",2);y([b()],m.prototype,"debugCallError",2);y([b()],m.prototype,"logsLoading",2);y([b()],m.prototype,"logsError",2);y([b()],m.prototype,"logsFile",2);y([b()],m.prototype,"logsEntries",2);y([b()],m.prototype,"logsFilterText",2);y([b()],m.prototype,"logsLevelFilters",2);y([b()],m.prototype,"logsAutoFollow",2);y([b()],m.prototype,"logsTruncated",2);y([b()],m.prototype,"logsCursor",2);y([b()],m.prototype,"logsLastFetchAt",2);y([b()],m.prototype,"logsLimit",2);y([b()],m.prototype,"logsMaxBytes",2);y([b()],m.prototype,"logsAtBottom",2);m=y([oo("poolbot-app")],m);
|
|
3150
|
+
//# sourceMappingURL=index-CAx-3zc2.js.map
|