@rubytech/taskmaster 1.0.65 → 1.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/memory-search.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/config/schema.js +1 -1
- package/dist/config/zod-schema.agent-runtime.js +1 -1
- package/dist/control-ui/assets/{index-o5Xs9S4u.js → index-8pJBjxcK.js} +443 -397
- package/dist/control-ui/assets/index-8pJBjxcK.js.map +1 -0
- package/dist/control-ui/assets/{index-DmifehTc.css → index-Uo_tQYx1.css} +1 -1
- package/dist/control-ui/index.html +2 -2
- package/dist/gateway/control-ui.js +11 -3
- package/dist/gateway/net.js +29 -0
- package/dist/gateway/server-methods/memory.js +1 -0
- package/dist/memory/embeddings.js +140 -31
- package/dist/memory/manager.js +1 -0
- package/package.json +1 -1
- package/taskmaster-docs/USER-GUIDE.md +53 -0
- package/dist/control-ui/assets/index-o5Xs9S4u.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var _u=Object.defineProperty;var Mu=(e,t,n)=>t in e?_u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var B=(e,t,n)=>Mu(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();const Pu="modulepreload",Lu=function(e,t){return new URL(e,t).href},lo={},ne=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=c(n.map(u=>{if(u=Lu(u,i),u in lo)return;lo[u]=!0;const f=u.endsWith(".css"),d=f?'[rel="stylesheet"]':"";if(i)for(let w=o.length-1;w>=0;w--){const b=o[w];if(b.href===u&&(!f||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${d}`))return;const h=document.createElement("link");if(h.rel=f?"stylesheet":Pu,f||(h.as="script"),h.crossOrigin="",h.href=u,l&&h.setAttribute("nonce",l),document.head.appendChild(h),f)return new Promise((w,b)=>{h.addEventListener("load",w),h.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return t().catch(r)})};const qn=globalThis,Xs=qn.ShadowRoot&&(qn.ShadyCSS===void 0||qn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Zs=Symbol(),co=new WeakMap;let Ja=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==Zs)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(Xs&&t===void 0){const i=n!==void 0&&n.length===1;i&&(t=co.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&co.set(n,t))}return t}toString(){return this.cssText}};const Iu=e=>new Ja(typeof e=="string"?e:e+"",void 0,Zs),Ru=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((i,s,r)=>i+(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.")})(s)+e[r+1],e[0]);return new Ja(n,e,Zs)},Nu=(e,t)=>{if(Xs)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const i=document.createElement("style"),s=qn.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,e.appendChild(i)}},uo=Xs?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const i of t.cssRules)n+=i.cssText;return Iu(n)})(e):e;const{is:Du,defineProperty:Ou,getOwnPropertyDescriptor:Bu,getOwnPropertyNames:Fu,getOwnPropertySymbols:Uu,getPrototypeOf:Wu}=Object,Ue=globalThis,po=Ue.trustedTypes,Ku=po?po.emptyScript:"",Ki=Ue.reactiveElementPolyfillSupport,Jt=(e,t)=>e,Xn={toAttribute(e,t){switch(t){case Boolean:e=e?Ku: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}},Js=(e,t)=>!Du(e,t),ho={attribute:!0,type:String,converter:Xn,reflect:!1,useDefault:!1,hasChanged:Js};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ue.litPropertyMetadata??(Ue.litPropertyMetadata=new WeakMap);let wt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=ho){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,n);s!==void 0&&Ou(this.prototype,t,s)}}static getPropertyDescriptor(t,n,i){const{get:s,set:r}=Bu(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);r==null||r.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ho}static _$Ei(){if(this.hasOwnProperty(Jt("elementProperties")))return;const t=Wu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Jt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Jt("properties"))){const n=this.properties,i=[...Fu(n),...Uu(n)];for(const s of i)this.createProperty(s,n[s])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[i,s]of n)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[n,i]of this.elementProperties){const s=this._$Eu(n,i);s!==void 0&&this._$Eh.set(s,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)n.unshift(uo(s))}else t!==void 0&&n.push(uo(t));return n}static _$Eu(t,n){const i=n.attribute;return i===!1?void 0:typeof i=="string"?i: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(){var t;this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(n=>n(this))}addController(t){var n;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)==null||n.call(t))}removeController(t){var n;(n=this._$EO)==null||n.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const i of n.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nu(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostConnected)==null?void 0:i.call(n)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostDisconnected)==null?void 0:i.call(n)})}attributeChangedCallback(t,n,i){this._$AK(t,i)}_$ET(t,n){var r;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const o=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:Xn).toAttribute(n,i.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,n){var r,o;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=i.getPropertyOptions(s),l=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:Xn;this._$Em=s;const c=l.fromAttribute(n,a.type);this[s]=c??((o=this._$Ej)==null?void 0:o.get(s))??c,this._$Em=null}}requestUpdate(t,n,i,s=!1,r){var o;if(t!==void 0){const a=this.constructor;if(s===!1&&(r=this[t]),i??(i=a.getPropertyOptions(t)),!((i.hasChanged??Js)(r,n)||i.useDefault&&i.reflect&&r===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(a._$Eu(t,i))))return;this.C(t,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??n??this[t]),r!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(n=void 0),this._$AL.set(t,n)),s===!0&&this._$Em!==t&&(this._$Eq??(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(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,o]of s){const{wrapped:a}=o,l=this[r];a!==!0||this._$AL.has(r)||l===void 0||this.C(r,void 0,o,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(s=>{var r;return(r=s.hostUpdate)==null?void 0:r.call(s)}),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){var n;(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),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=this._$Eq.forEach(n=>this._$ET(n,this[n]))),this._$EM()}updated(t){}firstUpdated(t){}};wt.elementStyles=[],wt.shadowRootOptions={mode:"open"},wt[Jt("elementProperties")]=new Map,wt[Jt("finalized")]=new Map,Ki==null||Ki({ReactiveElement:wt}),(Ue.reactiveElementVersions??(Ue.reactiveElementVersions=[])).push("2.1.2");const en=globalThis,fo=e=>e,Zn=en.trustedTypes,go=Zn?Zn.createPolicy("lit-html",{createHTML:e=>e}):void 0,el="$lit$",Fe=`lit$${Math.random().toFixed(9).slice(2)}$`,tl="?"+Fe,zu=`<${tl}>`,tt=document,cn=()=>tt.createComment(""),un=e=>e===null||typeof e!="object"&&typeof e!="function",er=Array.isArray,ju=e=>er(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",zi=`[
|
|
1
|
+
var Mu=Object.defineProperty;var Pu=(e,t,n)=>t in e?Mu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var B=(e,t,n)=>Pu(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();const Lu="modulepreload",Iu=function(e,t){return new URL(e,t).href},lo={},ne=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=c(n.map(u=>{if(u=Iu(u,i),u in lo)return;lo[u]=!0;const f=u.endsWith(".css"),d=f?'[rel="stylesheet"]':"";if(i)for(let w=o.length-1;w>=0;w--){const b=o[w];if(b.href===u&&(!f||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${d}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":Lu,f||(p.as="script"),p.crossOrigin="",p.href=u,l&&p.setAttribute("nonce",l),document.head.appendChild(p),f)return new Promise((w,b)=>{p.addEventListener("load",w),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return t().catch(r)})};const qn=globalThis,Xs=qn.ShadowRoot&&(qn.ShadyCSS===void 0||qn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Zs=Symbol(),co=new WeakMap;let el=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==Zs)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(Xs&&t===void 0){const i=n!==void 0&&n.length===1;i&&(t=co.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&co.set(n,t))}return t}toString(){return this.cssText}};const Ru=e=>new el(typeof e=="string"?e:e+"",void 0,Zs),Nu=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((i,s,r)=>i+(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.")})(s)+e[r+1],e[0]);return new el(n,e,Zs)},Du=(e,t)=>{if(Xs)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const i=document.createElement("style"),s=qn.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,e.appendChild(i)}},uo=Xs?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const i of t.cssRules)n+=i.cssText;return Ru(n)})(e):e;const{is:Ou,defineProperty:Bu,getOwnPropertyDescriptor:Fu,getOwnPropertyNames:Uu,getOwnPropertySymbols:Wu,getPrototypeOf:Ku}=Object,Ue=globalThis,po=Ue.trustedTypes,zu=po?po.emptyScript:"",Ki=Ue.reactiveElementPolyfillSupport,Jt=(e,t)=>e,Xn={toAttribute(e,t){switch(t){case Boolean:e=e?zu: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}},Js=(e,t)=>!Ou(e,t),ho={attribute:!0,type:String,converter:Xn,reflect:!1,useDefault:!1,hasChanged:Js};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ue.litPropertyMetadata??(Ue.litPropertyMetadata=new WeakMap);let wt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=ho){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,n);s!==void 0&&Bu(this.prototype,t,s)}}static getPropertyDescriptor(t,n,i){const{get:s,set:r}=Fu(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);r==null||r.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ho}static _$Ei(){if(this.hasOwnProperty(Jt("elementProperties")))return;const t=Ku(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Jt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Jt("properties"))){const n=this.properties,i=[...Uu(n),...Wu(n)];for(const s of i)this.createProperty(s,n[s])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[i,s]of n)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[n,i]of this.elementProperties){const s=this._$Eu(n,i);s!==void 0&&this._$Eh.set(s,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)n.unshift(uo(s))}else t!==void 0&&n.push(uo(t));return n}static _$Eu(t,n){const i=n.attribute;return i===!1?void 0:typeof i=="string"?i: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(){var t;this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(n=>n(this))}addController(t){var n;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)==null||n.call(t))}removeController(t){var n;(n=this._$EO)==null||n.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const i of n.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Du(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostConnected)==null?void 0:i.call(n)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostDisconnected)==null?void 0:i.call(n)})}attributeChangedCallback(t,n,i){this._$AK(t,i)}_$ET(t,n){var r;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const o=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:Xn).toAttribute(n,i.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,n){var r,o;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=i.getPropertyOptions(s),l=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:Xn;this._$Em=s;const c=l.fromAttribute(n,a.type);this[s]=c??((o=this._$Ej)==null?void 0:o.get(s))??c,this._$Em=null}}requestUpdate(t,n,i,s=!1,r){var o;if(t!==void 0){const a=this.constructor;if(s===!1&&(r=this[t]),i??(i=a.getPropertyOptions(t)),!((i.hasChanged??Js)(r,n)||i.useDefault&&i.reflect&&r===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(a._$Eu(t,i))))return;this.C(t,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??n??this[t]),r!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(n=void 0),this._$AL.set(t,n)),s===!0&&this._$Em!==t&&(this._$Eq??(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(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,o]of s){const{wrapped:a}=o,l=this[r];a!==!0||this._$AL.has(r)||l===void 0||this.C(r,void 0,o,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(s=>{var r;return(r=s.hostUpdate)==null?void 0:r.call(s)}),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){var n;(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),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=this._$Eq.forEach(n=>this._$ET(n,this[n]))),this._$EM()}updated(t){}firstUpdated(t){}};wt.elementStyles=[],wt.shadowRootOptions={mode:"open"},wt[Jt("elementProperties")]=new Map,wt[Jt("finalized")]=new Map,Ki==null||Ki({ReactiveElement:wt}),(Ue.reactiveElementVersions??(Ue.reactiveElementVersions=[])).push("2.1.2");const en=globalThis,fo=e=>e,Zn=en.trustedTypes,go=Zn?Zn.createPolicy("lit-html",{createHTML:e=>e}):void 0,tl="$lit$",Fe=`lit$${Math.random().toFixed(9).slice(2)}$`,nl="?"+Fe,ju=`<${nl}>`,tt=document,cn=()=>tt.createComment(""),un=e=>e===null||typeof e!="object"&&typeof e!="function",er=Array.isArray,Hu=e=>er(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",zi=`[
|
|
2
2
|
\f\r]`,Ft=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mo=/-->/g,yo=/>/g,Qe=RegExp(`>|${zi}(?:([^\\s"'>=/]+)(${zi}*=${zi}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),vo=/'/g,bo=/"/g,nl=/^(?:script|style|textarea|title)$/i,Hu=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),p=Hu(1),Ke=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),wo=new WeakMap,Ze=tt.createTreeWalker(tt,129);function il(e,t){if(!er(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return go!==void 0?go.createHTML(t):t}const qu=(e,t)=>{const n=e.length-1,i=[];let s,r=t===2?"<svg>":t===3?"<math>":"",o=Ft;for(let a=0;a<n;a++){const l=e[a];let c,u,f=-1,d=0;for(;d<l.length&&(o.lastIndex=d,u=o.exec(l),u!==null);)d=o.lastIndex,o===Ft?u[1]==="!--"?o=mo:u[1]!==void 0?o=yo:u[2]!==void 0?(nl.test(u[2])&&(s=RegExp("</"+u[2],"g")),o=Qe):u[3]!==void 0&&(o=Qe):o===Qe?u[0]===">"?(o=s??Ft,f=-1):u[1]===void 0?f=-2:(f=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?Qe:u[3]==='"'?bo:vo):o===bo||o===vo?o=Qe:o===mo||o===yo?o=Ft:(o=Qe,s=void 0);const h=o===Qe&&e[a+1].startsWith("/>")?" ":"";r+=o===Ft?l+zu:f>=0?(i.push(c),l.slice(0,f)+el+l.slice(f)+Fe+h):l+Fe+(f===-2?a:h)}return[il(e,r+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let As=class sl{constructor({strings:t,_$litType$:n},i){let s;this.parts=[];let r=0,o=0;const a=t.length-1,l=this.parts,[c,u]=qu(t,n);if(this.el=sl.createElement(c,i),Ze.currentNode=this.el.content,n===2||n===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(s=Ze.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const f of s.getAttributeNames())if(f.endsWith(el)){const d=u[o++],h=s.getAttribute(f).split(Fe),w=/([.?@])?(.*)/.exec(d);l.push({type:1,index:r,name:w[2],strings:h,ctor:w[1]==="."?Vu:w[1]==="?"?Qu:w[1]==="@"?Yu:vi}),s.removeAttribute(f)}else f.startsWith(Fe)&&(l.push({type:6,index:r}),s.removeAttribute(f));if(nl.test(s.tagName)){const f=s.textContent.split(Fe),d=f.length-1;if(d>0){s.textContent=Zn?Zn.emptyScript:"";for(let h=0;h<d;h++)s.append(f[h],cn()),Ze.nextNode(),l.push({type:2,index:++r});s.append(f[d],cn())}}}else if(s.nodeType===8)if(s.data===tl)l.push({type:2,index:r});else{let f=-1;for(;(f=s.data.indexOf(Fe,f+1))!==-1;)l.push({type:7,index:r}),f+=Fe.length-1}r++}}static createElement(t,n){const i=tt.createElement("template");return i.innerHTML=t,i}};function Et(e,t,n=e,i){var o,a;if(t===Ke)return t;let s=i!==void 0?(o=n._$Co)==null?void 0:o[i]:n._$Cl;const r=un(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(e),s._$AT(e,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=s:n._$Cl=s),s!==void 0&&(t=Et(e,s._$AS(e,t.values),s,i)),t}class Gu{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:i}=this._$AD,s=((t==null?void 0:t.creationScope)??tt).importNode(n,!0);Ze.currentNode=s;let r=Ze.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new yi(r,r.nextSibling,this,t):l.type===1?c=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(c=new Xu(r,this,t)),this._$AV.push(c),l=i[++a]}o!==(l==null?void 0:l.index)&&(r=Ze.nextNode(),o++)}return Ze.currentNode=tt,s}p(t){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}let yi=class rl{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,n,i,s){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Et(this,t,n),un(t)?t===k||t==null||t===""?(this._$AH!==k&&this._$AR(),this._$AH=k):t!==this._$AH&&t!==Ke&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ju(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!==k&&un(this._$AH)?this._$AA.nextSibling.data=t:this.T(tt.createTextNode(t)),this._$AH=t}$(t){var r;const{values:n,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=As.createElement(il(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(n);else{const o=new Gu(s,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}_$AC(t){let n=wo.get(t.strings);return n===void 0&&wo.set(t.strings,n=new As(t)),n}k(t){er(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,s=0;for(const r of t)s===n.length?n.push(i=new rl(this.O(cn()),this.O(cn()),this,this.options)):i=n[s],i._$AI(r),s++;s<n.length&&(this._$AR(i&&i._$AB.nextSibling,s),n.length=s)}_$AR(t=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);t!==this._$AB;){const s=fo(t).nextSibling;fo(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}};class vi{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,s,r){this.type=1,this._$AH=k,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=k}_$AI(t,n=this,i,s){const r=this.strings;let o=!1;if(r===void 0)t=Et(this,t,n,0),o=!un(t)||t!==this._$AH&&t!==Ke,o&&(this._$AH=t);else{const a=t;let l,c;for(t=r[0],l=0;l<r.length-1;l++)c=Et(this,a[i+l],n,l),c===Ke&&(c=this._$AH[l]),o||(o=!un(c)||c!==this._$AH[l]),c===k?t=k:t!==k&&(t+=(c??"")+r[l+1]),this._$AH[l]=c}o&&!s&&this.j(t)}j(t){t===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let Vu=class extends vi{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===k?void 0:t}},Qu=class extends vi{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==k)}},Yu=class extends vi{constructor(t,n,i,s,r){super(t,n,i,s,r),this.type=5}_$AI(t,n=this){if((t=Et(this,t,n,0)??k)===Ke)return;const i=this._$AH,s=t===k&&i!==k||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==k&&(i===k||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,t):this._$AH.handleEvent(t)}},Xu=class{constructor(t,n,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}};const Zu={I:yi},ji=en.litHtmlPolyfillSupport;ji==null||ji(As,yi),(en.litHtmlVersions??(en.litHtmlVersions=[])).push("3.3.2");const Ju=(e,t,n)=>{const i=(n==null?void 0:n.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const r=(n==null?void 0:n.renderBefore)??null;i._$litPart$=s=new yi(t.insertBefore(cn(),r),r,void 0,n??{})}return s._$AI(e),s};const et=globalThis;let At=class extends wt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const t=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=t.firstChild),t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ju(n,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return Ke}};var Za;At._$litElement$=!0,At.finalized=!0,(Za=et.litElementHydrateSupport)==null||Za.call(et,{LitElement:At});const Hi=et.litElementPolyfillSupport;Hi==null||Hi({LitElement:At});(et.litElementVersions??(et.litElementVersions=[])).push("4.2.2");const ol=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const ed={attribute:!0,type:String,converter:Xn,reflect:!1,hasChanged:Js},td=(e=ed,t,n)=>{const{kind:i,metadata:s}=n;let r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),r.set(n.name,e),i==="accessor"){const{name:o}=n;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,l,e,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,e,a),a}}}if(i==="setter"){const{name:o}=n;return function(a){const l=this[o];t.call(this,a),this.requestUpdate(o,l,e,!0,a)}}throw Error("Unsupported decorator location: "+i)};function bi(e){return(t,n)=>typeof n=="object"?td(e,t,n):((i,s,r)=>{const o=s.hasOwnProperty(r);return s.constructor.createProperty(r,i),o?Object.getOwnPropertyDescriptor(s,r):void 0})(e,t,n)}function y(e){return bi({...e,state:!0,attribute:!1})}const nd=50,id=200,sd="Assistant";function ko(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function xs(e){const t=ko(e==null?void 0:e.name,nd)??sd,n=ko((e==null?void 0:e.avatar)??void 0,id)??null;return{agentId:typeof(e==null?void 0:e.agentId)=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function rd(){return xs(typeof window>"u"?{}:{name:window.__TASKMASTER_ASSISTANT_NAME__,avatar:window.__TASKMASTER_ASSISTANT_AVATAR__})}const Jn="taskmaster.control.settings.v1",al="taskmaster.account.settings.";function tn(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}`}const bt={gatewayUrl:tn(),token:"",theme:"system",navCollapsed:!1,navGroupsCollapsed:{}},Be={sessionKey:"main",lastActiveSessionKey:"main",chatFocusMode:!1,chatShowThinking:!1,splitRatio:.6};function od(){try{const e=localStorage.getItem(Jn);if(!e)return{...bt,gatewayUrl:tn()};const t=JSON.parse(e);return{gatewayUrl:typeof t.gatewayUrl=="string"&&t.gatewayUrl.trim()?t.gatewayUrl.trim():tn(),token:typeof t.token=="string"?t.token:bt.token,theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:bt.theme,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:bt.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:bt.navGroupsCollapsed}}catch{return{...bt,gatewayUrl:tn()}}}function ad(e){if(!e)return{...Be};try{const t=localStorage.getItem(al+e);if(!t)return{...Be};const n=JSON.parse(t);return{sessionKey:typeof n.sessionKey=="string"&&n.sessionKey.trim()?n.sessionKey.trim():Be.sessionKey,lastActiveSessionKey:typeof n.lastActiveSessionKey=="string"&&n.lastActiveSessionKey.trim()?n.lastActiveSessionKey.trim():typeof n.sessionKey=="string"&&n.sessionKey.trim()||Be.lastActiveSessionKey,chatFocusMode:typeof n.chatFocusMode=="boolean"?n.chatFocusMode:Be.chatFocusMode,chatShowThinking:typeof n.chatShowThinking=="boolean"?n.chatShowThinking:Be.chatShowThinking,splitRatio:typeof n.splitRatio=="number"&&n.splitRatio>=.4&&n.splitRatio<=.7?n.splitRatio:Be.splitRatio}}catch{return{...Be}}}let ei=null;function So(e){ei=e}function qi(){return{...od(),...ad(ei)}}function ld(e){const t={gatewayUrl:e.gatewayUrl,token:e.token,theme:e.theme,navCollapsed:e.navCollapsed,navGroupsCollapsed:e.navGroupsCollapsed};if(localStorage.setItem(Jn,JSON.stringify(t)),ei){const n={sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,chatFocusMode:e.chatFocusMode,chatShowThinking:e.chatShowThinking,splitRatio:e.splitRatio};localStorage.setItem(al+ei,JSON.stringify(n))}}(function(){try{const t=localStorage.getItem(Jn);if(!t)return;const n=JSON.parse(t);if(!("sessionKey"in n))return;const i={gatewayUrl:typeof n.gatewayUrl=="string"?n.gatewayUrl:tn(),token:typeof n.token=="string"?n.token:"",theme:n.theme==="light"||n.theme==="dark"||n.theme==="system"?n.theme:"system",navCollapsed:typeof n.navCollapsed=="boolean"?n.navCollapsed:!1,navGroupsCollapsed:typeof n.navGroupsCollapsed=="object"&&n.navGroupsCollapsed!==null?n.navGroupsCollapsed:{}};localStorage.setItem(Jn,JSON.stringify(i))}catch{}})();function ll(e){var r;const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const i=(r=n[1])==null?void 0:r.trim(),s=n.slice(2).join(":");return!i||!s?null:{agentId:i,rest:s}}const cd=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Pn=/<\s*\/?\s*final\b[^>]*>/gi,Ao=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function ud(e,t){return e.trimStart()}function dd(e,t){if(!e||!cd.test(e))return e;let n=e;Pn.test(n)?(Pn.lastIndex=0,n=n.replace(Pn,"")):Pn.lastIndex=0,Ao.lastIndex=0;let i="",s=0,r=!1;for(const o of n.matchAll(Ao)){const a=o.index??0,l=o[1]==="/";r?l&&(r=!1):(i+=n.slice(s,a),l||(r=!0)),s=a+o[0].length}return i+=n.slice(s),ud(i)}function cl(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function wi(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0){const o=-t,a=Math.round(o/1e3);if(a<60)return`in ${a}s`;const l=Math.round(a/60);if(l<60)return`in ${l}m`;const c=Math.round(l/60);return c<48?`in ${c}h`:`in ${Math.round(c/24)}d`}const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const i=Math.round(n/60);if(i<60)return`${i}m ago`;const s=Math.round(i/60);return s<48?`${s}h ago`:`${Math.round(s/24)}d ago`}function ul(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 i=Math.round(n/60);return i<48?`${i}h`:`${Math.round(i/24)}d`}function pd(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function dl(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 ti(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Gi(e){return dd(e)}const hd=/^\[([^\]]+)\]\s*/,fd=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Vi=new WeakMap,Qi=new WeakMap;function gd(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:fd.some(t=>e.startsWith(`${t} `))}function Yi(e){const t=e.match(hd);if(!t)return e;const n=t[1]??"";return gd(n)?e.slice(t[0].length):e}function nn(e){const t=e,n=typeof t.role=="string"?t.role:"",i=t.content;if(typeof i=="string")return n==="assistant"?Gi(i):Yi(i);if(Array.isArray(i)){const s=i.map(r=>{const o=r;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(r=>typeof r=="string");if(s.length>0){const r=s.join(`
|
|
4
|
-
`);return n==="assistant"?
|
|
5
|
-
`);const s=
|
|
6
|
-
`):null}function
|
|
7
|
-
`)}return typeof t.text=="string"?t.text:null}function
|
|
8
|
-
`):""}const
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),vo=/'/g,bo=/"/g,il=/^(?:script|style|textarea|title)$/i,qu=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),h=qu(1),Ke=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),wo=new WeakMap,Ze=tt.createTreeWalker(tt,129);function sl(e,t){if(!er(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return go!==void 0?go.createHTML(t):t}const Vu=(e,t)=>{const n=e.length-1,i=[];let s,r=t===2?"<svg>":t===3?"<math>":"",o=Ft;for(let a=0;a<n;a++){const l=e[a];let c,u,f=-1,d=0;for(;d<l.length&&(o.lastIndex=d,u=o.exec(l),u!==null);)d=o.lastIndex,o===Ft?u[1]==="!--"?o=mo:u[1]!==void 0?o=yo:u[2]!==void 0?(il.test(u[2])&&(s=RegExp("</"+u[2],"g")),o=Qe):u[3]!==void 0&&(o=Qe):o===Qe?u[0]===">"?(o=s??Ft,f=-1):u[1]===void 0?f=-2:(f=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?Qe:u[3]==='"'?bo:vo):o===bo||o===vo?o=Qe:o===mo||o===yo?o=Ft:(o=Qe,s=void 0);const p=o===Qe&&e[a+1].startsWith("/>")?" ":"";r+=o===Ft?l+ju:f>=0?(i.push(c),l.slice(0,f)+tl+l.slice(f)+Fe+p):l+Fe+(f===-2?a:p)}return[sl(e,r+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let As=class rl{constructor({strings:t,_$litType$:n},i){let s;this.parts=[];let r=0,o=0;const a=t.length-1,l=this.parts,[c,u]=Vu(t,n);if(this.el=rl.createElement(c,i),Ze.currentNode=this.el.content,n===2||n===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(s=Ze.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const f of s.getAttributeNames())if(f.endsWith(tl)){const d=u[o++],p=s.getAttribute(f).split(Fe),w=/([.?@])?(.*)/.exec(d);l.push({type:1,index:r,name:w[2],strings:p,ctor:w[1]==="."?Qu:w[1]==="?"?Yu:w[1]==="@"?Xu:vi}),s.removeAttribute(f)}else f.startsWith(Fe)&&(l.push({type:6,index:r}),s.removeAttribute(f));if(il.test(s.tagName)){const f=s.textContent.split(Fe),d=f.length-1;if(d>0){s.textContent=Zn?Zn.emptyScript:"";for(let p=0;p<d;p++)s.append(f[p],cn()),Ze.nextNode(),l.push({type:2,index:++r});s.append(f[d],cn())}}}else if(s.nodeType===8)if(s.data===nl)l.push({type:2,index:r});else{let f=-1;for(;(f=s.data.indexOf(Fe,f+1))!==-1;)l.push({type:7,index:r}),f+=Fe.length-1}r++}}static createElement(t,n){const i=tt.createElement("template");return i.innerHTML=t,i}};function Et(e,t,n=e,i){var o,a;if(t===Ke)return t;let s=i!==void 0?(o=n._$Co)==null?void 0:o[i]:n._$Cl;const r=un(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(e),s._$AT(e,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=s:n._$Cl=s),s!==void 0&&(t=Et(e,s._$AS(e,t.values),s,i)),t}class Gu{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:i}=this._$AD,s=((t==null?void 0:t.creationScope)??tt).importNode(n,!0);Ze.currentNode=s;let r=Ze.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new yi(r,r.nextSibling,this,t):l.type===1?c=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(c=new Zu(r,this,t)),this._$AV.push(c),l=i[++a]}o!==(l==null?void 0:l.index)&&(r=Ze.nextNode(),o++)}return Ze.currentNode=tt,s}p(t){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}let yi=class ol{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,n,i,s){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Et(this,t,n),un(t)?t===k||t==null||t===""?(this._$AH!==k&&this._$AR(),this._$AH=k):t!==this._$AH&&t!==Ke&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Hu(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==k&&un(this._$AH)?this._$AA.nextSibling.data=t:this.T(tt.createTextNode(t)),this._$AH=t}$(t){var r;const{values:n,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=As.createElement(sl(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(n);else{const o=new Gu(s,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}_$AC(t){let n=wo.get(t.strings);return n===void 0&&wo.set(t.strings,n=new As(t)),n}k(t){er(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,s=0;for(const r of t)s===n.length?n.push(i=new ol(this.O(cn()),this.O(cn()),this,this.options)):i=n[s],i._$AI(r),s++;s<n.length&&(this._$AR(i&&i._$AB.nextSibling,s),n.length=s)}_$AR(t=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);t!==this._$AB;){const s=fo(t).nextSibling;fo(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}};class vi{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,s,r){this.type=1,this._$AH=k,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=k}_$AI(t,n=this,i,s){const r=this.strings;let o=!1;if(r===void 0)t=Et(this,t,n,0),o=!un(t)||t!==this._$AH&&t!==Ke,o&&(this._$AH=t);else{const a=t;let l,c;for(t=r[0],l=0;l<r.length-1;l++)c=Et(this,a[i+l],n,l),c===Ke&&(c=this._$AH[l]),o||(o=!un(c)||c!==this._$AH[l]),c===k?t=k:t!==k&&(t+=(c??"")+r[l+1]),this._$AH[l]=c}o&&!s&&this.j(t)}j(t){t===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let Qu=class extends vi{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===k?void 0:t}},Yu=class extends vi{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==k)}},Xu=class extends vi{constructor(t,n,i,s,r){super(t,n,i,s,r),this.type=5}_$AI(t,n=this){if((t=Et(this,t,n,0)??k)===Ke)return;const i=this._$AH,s=t===k&&i!==k||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==k&&(i===k||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,t):this._$AH.handleEvent(t)}},Zu=class{constructor(t,n,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}};const Ju={I:yi},ji=en.litHtmlPolyfillSupport;ji==null||ji(As,yi),(en.litHtmlVersions??(en.litHtmlVersions=[])).push("3.3.2");const ed=(e,t,n)=>{const i=(n==null?void 0:n.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const r=(n==null?void 0:n.renderBefore)??null;i._$litPart$=s=new yi(t.insertBefore(cn(),r),r,void 0,n??{})}return s._$AI(e),s};const et=globalThis;let At=class extends wt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const t=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=t.firstChild),t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ed(n,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return Ke}};var Ja;At._$litElement$=!0,At.finalized=!0,(Ja=et.litElementHydrateSupport)==null||Ja.call(et,{LitElement:At});const Hi=et.litElementPolyfillSupport;Hi==null||Hi({LitElement:At});(et.litElementVersions??(et.litElementVersions=[])).push("4.2.2");const al=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const td={attribute:!0,type:String,converter:Xn,reflect:!1,hasChanged:Js},nd=(e=td,t,n)=>{const{kind:i,metadata:s}=n;let r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),r.set(n.name,e),i==="accessor"){const{name:o}=n;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,l,e,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,e,a),a}}}if(i==="setter"){const{name:o}=n;return function(a){const l=this[o];t.call(this,a),this.requestUpdate(o,l,e,!0,a)}}throw Error("Unsupported decorator location: "+i)};function bi(e){return(t,n)=>typeof n=="object"?nd(e,t,n):((i,s,r)=>{const o=s.hasOwnProperty(r);return s.constructor.createProperty(r,i),o?Object.getOwnPropertyDescriptor(s,r):void 0})(e,t,n)}function y(e){return bi({...e,state:!0,attribute:!1})}const id=50,sd=200,rd="Assistant";function ko(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function $s(e){const t=ko(e==null?void 0:e.name,id)??rd,n=ko((e==null?void 0:e.avatar)??void 0,sd)??null;return{agentId:typeof(e==null?void 0:e.agentId)=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function od(){return $s(typeof window>"u"?{}:{name:window.__TASKMASTER_ASSISTANT_NAME__,avatar:window.__TASKMASTER_ASSISTANT_AVATAR__})}const Jn="taskmaster.control.settings.v1",ll="taskmaster.account.settings.";function tn(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}`}const bt={gatewayUrl:tn(),token:"",theme:"system",navCollapsed:!1,navGroupsCollapsed:{}},Be={sessionKey:"main",lastActiveSessionKey:"main",chatFocusMode:!1,chatShowThinking:!1,splitRatio:.6};function ad(){try{const e=localStorage.getItem(Jn);if(!e)return{...bt,gatewayUrl:tn()};const t=JSON.parse(e);return{gatewayUrl:typeof t.gatewayUrl=="string"&&t.gatewayUrl.trim()?t.gatewayUrl.trim():tn(),token:typeof t.token=="string"?t.token:bt.token,theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:bt.theme,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:bt.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:bt.navGroupsCollapsed}}catch{return{...bt,gatewayUrl:tn()}}}function ld(e){if(!e)return{...Be};try{const t=localStorage.getItem(ll+e);if(!t)return{...Be};const n=JSON.parse(t);return{sessionKey:typeof n.sessionKey=="string"&&n.sessionKey.trim()?n.sessionKey.trim():Be.sessionKey,lastActiveSessionKey:typeof n.lastActiveSessionKey=="string"&&n.lastActiveSessionKey.trim()?n.lastActiveSessionKey.trim():typeof n.sessionKey=="string"&&n.sessionKey.trim()||Be.lastActiveSessionKey,chatFocusMode:typeof n.chatFocusMode=="boolean"?n.chatFocusMode:Be.chatFocusMode,chatShowThinking:typeof n.chatShowThinking=="boolean"?n.chatShowThinking:Be.chatShowThinking,splitRatio:typeof n.splitRatio=="number"&&n.splitRatio>=.4&&n.splitRatio<=.7?n.splitRatio:Be.splitRatio}}catch{return{...Be}}}let ei=null;function So(e){ei=e}function qi(){return{...ad(),...ld(ei)}}function cd(e){const t={gatewayUrl:e.gatewayUrl,token:e.token,theme:e.theme,navCollapsed:e.navCollapsed,navGroupsCollapsed:e.navGroupsCollapsed};if(localStorage.setItem(Jn,JSON.stringify(t)),ei){const n={sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,chatFocusMode:e.chatFocusMode,chatShowThinking:e.chatShowThinking,splitRatio:e.splitRatio};localStorage.setItem(ll+ei,JSON.stringify(n))}}(function(){try{const t=localStorage.getItem(Jn);if(!t)return;const n=JSON.parse(t);if(!("sessionKey"in n))return;const i={gatewayUrl:typeof n.gatewayUrl=="string"?n.gatewayUrl:tn(),token:typeof n.token=="string"?n.token:"",theme:n.theme==="light"||n.theme==="dark"||n.theme==="system"?n.theme:"system",navCollapsed:typeof n.navCollapsed=="boolean"?n.navCollapsed:!1,navGroupsCollapsed:typeof n.navGroupsCollapsed=="object"&&n.navGroupsCollapsed!==null?n.navGroupsCollapsed:{}};localStorage.setItem(Jn,JSON.stringify(i))}catch{}})();function cl(e){var r;const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const i=(r=n[1])==null?void 0:r.trim(),s=n.slice(2).join(":");return!i||!s?null:{agentId:i,rest:s}}const ud=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Pn=/<\s*\/?\s*final\b[^>]*>/gi,Ao=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function dd(e,t){return e.trimStart()}function pd(e,t){if(!e||!ud.test(e))return e;let n=e;Pn.test(n)?(Pn.lastIndex=0,n=n.replace(Pn,"")):Pn.lastIndex=0,Ao.lastIndex=0;let i="",s=0,r=!1;for(const o of n.matchAll(Ao)){const a=o.index??0,l=o[1]==="/";r?l&&(r=!1):(i+=n.slice(s,a),l||(r=!0)),s=a+o[0].length}return i+=n.slice(s),dd(i)}function ul(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function wi(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0){const o=-t,a=Math.round(o/1e3);if(a<60)return`in ${a}s`;const l=Math.round(a/60);if(l<60)return`in ${l}m`;const c=Math.round(l/60);return c<48?`in ${c}h`:`in ${Math.round(c/24)}d`}const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const i=Math.round(n/60);if(i<60)return`${i}m ago`;const s=Math.round(i/60);return s<48?`${s}h ago`:`${Math.round(s/24)}d ago`}function dl(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const i=Math.round(n/60);return i<48?`${i}h`:`${Math.round(i/24)}d`}function hd(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function pl(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 ti(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Vi(e){return pd(e)}const fd=/^\[([^\]]+)\]\s*/,gd=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Gi=new WeakMap,Qi=new WeakMap;function md(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:gd.some(t=>e.startsWith(`${t} `))}function Yi(e){const t=e.match(fd);if(!t)return e;const n=t[1]??"";return md(n)?e.slice(t[0].length):e}function nn(e){const t=e,n=typeof t.role=="string"?t.role:"",i=t.content;if(typeof i=="string")return n==="assistant"?Vi(i):Yi(i);if(Array.isArray(i)){const s=i.map(r=>{const o=r;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(r=>typeof r=="string");if(s.length>0){const r=s.join(`
|
|
4
|
+
`);return n==="assistant"?Vi(r):Yi(r)}}return typeof t.text=="string"?n==="assistant"?Vi(t.text):Yi(t.text):null}function hl(e){if(!e||typeof e!="object")return nn(e);const t=e;if(Gi.has(t))return Gi.get(t)??null;const n=nn(e);return Gi.set(t,n),n}function $o(e){const n=e.content,i=[];if(Array.isArray(n))for(const a of n){const l=a;if(l.type==="thinking"&&typeof l.thinking=="string"){const c=l.thinking.trim();c&&i.push(c)}}if(i.length>0)return i.join(`
|
|
5
|
+
`);const s=vd(e);if(!s)return null;const o=[...s.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(a=>(a[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
|
|
6
|
+
`):null}function yd(e){if(!e||typeof e!="object")return $o(e);const t=e;if(Qi.has(t))return Qi.get(t)??null;const n=$o(e);return Qi.set(t,n),n}function vd(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const i=n.map(s=>{const r=s;return r.type==="text"&&typeof r.text=="string"?r.text:null}).filter(s=>typeof s=="string");if(i.length>0)return i.join(`
|
|
7
|
+
`)}return typeof t.text=="string"?t.text:null}function bd(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(i=>i.trim()).filter(Boolean).map(i=>`_${i}_`);return n.length?["_Reasoning:_",...n].join(`
|
|
8
|
+
`):""}const wd=/Read HEARTBEAT\.md if it exists|reply HEARTBEAT_OK/i,kd=/^[\s*`_]*HEARTBEAT_OK[\s*`_]*$/i,Sd=/^[\s*`_]*NO_REPLY[\s*`_]*$/i,Ad=/^A new session was started via \/new or \/reset\./;function $d(e){const t=e,n=typeof t.role=="string"?t.role:"";let i="";typeof t.content=="string"?i=t.content:Array.isArray(t.content)?i=t.content.filter(r=>typeof r=="object"&&r!==null).map(r=>r.text??"").join(" "):typeof t.text=="string"&&(i=t.text);const s=i.trim();return s?!!(n==="user"&&wd.test(s)||n==="assistant"&&kd.test(s)||n==="user"&&Ad.test(s)||n==="assistant"&&Sd.test(s)):!1}function xd(e){return e.filter(t=>!$d(t))}function fl(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const i=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",s=t.content,r=Array.isArray(s)?s:null,o=Array.isArray(r)&&r.some(f=>{const p=String(f.type??"").toLowerCase();return p==="toolresult"||p==="tool_result"}),a=typeof t.toolName=="string"||typeof t.tool_name=="string";(i||o||a)&&(n="toolResult");let l=[];typeof t.content=="string"?l=[{type:"text",text:t.content}]:Array.isArray(t.content)?l=t.content.map(f=>({type:f.type||"text",text:f.text,name:f.name,args:f.args||f.arguments})):typeof t.text=="string"&&(l=[{type:"text",text:t.text}]);const c=typeof t.timestamp=="number"?t.timestamp:Date.now(),u=typeof t.id=="string"?t.id:void 0;return{role:n,content:l,timestamp:c,id:u}}function gl(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 ml(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}function xo(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 Ed(){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 tr(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),xo(t)}return xo(Ed())}async function Ee(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:5e3}),n=Array.isArray(t.messages)?t.messages:[];e.chatMessages=xd(n),e.chatThinkingLevel=t.thinkingLevel??null,e.chatModelProvider=typeof t.modelProvider=="string"?t.modelProvider:null,e.chatModel=typeof t.model=="string"?t.model:null,e.chatVerboseLevel=typeof t.verboseLevel=="string"?t.verboseLevel:null,e.chatFillerEnabled=typeof t.fillerEnabled=="boolean"?t.fillerEnabled:null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Td(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function yl(e,t,n){if(e.chatSuggestion=null,!e.client||!e.connected)return!1;const i=t.trim(),s=n&&n.length>0;if(!i&&!s)return!1;const r=Date.now(),o=(n??[]).filter(p=>!p.fileName),a=(n??[]).filter(p=>p.fileName),l=[],c=a.map(p=>p.fileName).filter(Boolean);if(c.length>0){const p=i?`${c.join(", ")}
|
|
9
9
|
|
|
10
|
-
${i}`:c.join(", ");l.push({type:"text",text:
|
|
10
|
+
${i}`:c.join(", ");l.push({type:"text",text:p})}else i&&l.push({type:"text",text:i});for(const p of o)l.push({type:"image",source:{type:"base64",media_type:p.mimeType,data:p.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:l,timestamp:r}],e.chatSending=!0,e.lastError=null;const u=tr();e.chatRunId=u,e.chatStream="",e.chatStreamStartedAt=r;const f=[...o,...a],d=f.length>0?f.map(p=>{if(p.textContent)return{type:"document",mimeType:p.mimeType||"text/plain",fileName:p.fileName,content:btoa(unescape(encodeURIComponent(p.textContent)))};const w=Td(p.dataUrl);return w?{type:p.fileName?"document":"image",mimeType:w.mimeType,fileName:p.fileName,content:w.content}:null}).filter(p=>p!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:i,deliver:!1,idempotencyKey:u,attachments:d}),!0}catch(p){const w=String(p);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=w,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+w}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function vl(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 bl(e,t){var n,i;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==="working"){const r=(t.message?(n=nn(t.message))==null?void 0:n.trim():void 0)||((i=e.chatStream)==null?void 0:i.trim());return r&&(e.chatInterimText=e.chatInterimText?`${e.chatInterimText}
|
|
11
11
|
|
|
12
|
-
${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.message);return typeof s=="string"&&s.trim()&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:s.trim()}],timestamp:Date.now(),filler:!0}]),"block"}else if(t.state==="delta"){e.chatSuggestion=null;const s=nn(t.message);if(typeof s=="string"){if(s.trim()==="NO_REPLY")return null;const r=e.chatStream??"";(!r||s.length>=r.length)&&(e.chatStream=s)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatInterimText=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatInterimText=null,e.lastError=t.errorMessage??"chat error");return t.state}const
|
|
13
|
-
`)}function To(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=
|
|
12
|
+
${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.message);return typeof s=="string"&&s.trim()&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:s.trim()}],timestamp:Date.now(),filler:!0}]),"block"}else if(t.state==="delta"){e.chatSuggestion=null;const s=nn(t.message);if(typeof s=="string"){if(s.trim()==="NO_REPLY")return null;const r=e.chatStream??"";(!r||s.length>=r.length)&&(e.chatStream=s)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatInterimText=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatInterimText=null,e.lastError=t.errorMessage??"chat error");return t.state}const xs=Object.freeze(Object.defineProperty({__proto__:null,abortChatRun:vl,handleChatEvent:bl,loadChatHistory:Ee,sendChatMessage:yl},Symbol.toStringTag,{value:"Module"}));async function nr(e){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const t={includeGlobal:e.sessionsIncludeGlobal??!0,includeUnknown:e.sessionsIncludeUnknown??!1},n=ti(e.sessionsFilterActive??"",0),i=ti(e.sessionsFilterLimit??"",0);n>0&&(t.activeMinutes=n),i>0&&(t.limit=i);const s=await e.client.request("sessions.list",t);s&&(e.sessionsResult=s)}catch(t){e.sessionsError=String(t)}finally{e.sessionsLoading=!1}}}async function Ln(e,t,n){if(!e.client||!e.connected)return;const i={key:t};"label"in n&&(i.label=n.label),"thinkingLevel"in n&&(i.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(i.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(i.reasoningLevel=n.reasoningLevel),"model"in n&&(i.model=n.model),"fillerEnabled"in n&&(i.fillerEnabled=n.fillerEnabled);try{await e.client.request("sessions.patch",i),await nr(e)}catch(s){e.sessionsError=String(s)}}const Eo=50,Cd=80,_d=12e4;function Md(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 i=n.map(s=>{if(!s||typeof s!="object")return null;const r=s;return r.type==="text"&&typeof r.text=="string"?r.text:null}).filter(s=>!!s);return i.length===0?null:i.join(`
|
|
13
|
+
`)}function To(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Md(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 i=pl(n,_d);return i.truncated?`${i.text}
|
|
14
14
|
|
|
15
|
-
… truncated (${i.total} chars, showing first ${i.text.length}).`:i.text}function
|
|
15
|
+
… truncated (${i.total} chars, showing first ${i.text.length}).`:i.text}function Pd(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 Ld(e){if(e.toolStreamOrder.length<=Eo)return;const t=e.toolStreamOrder.length-Eo,n=e.toolStreamOrder.splice(0,t);for(const i of n)e.toolStreamById.delete(i)}function Id(e){e.chatToolMessages=e.toolStreamOrder.map(t=>{var n;return(n=e.toolStreamById.get(t))==null?void 0:n.message}).filter(t=>!!t)}function Es(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Id(e)}function Rd(e,t=!1){if(t){Es(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>Es(e),Cd))}function ir(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],Es(e)}const Nd=5e3;function Dd(e,t){var s;const n=t.data??{},i=typeof n.phase=="string"?n.phase:"";e.compactionClearTimer!=null&&(window.clearTimeout(e.compactionClearTimer),e.compactionClearTimer=null),i==="start"?e.compactionStatus={active:!0,startedAt:Date.now(),completedAt:null}:i==="end"&&(e.compactionStatus={active:!1,startedAt:((s=e.compactionStatus)==null?void 0:s.startedAt)??null,completedAt:Date.now()},e.compactionClearTimer=window.setTimeout(()=>{e.compactionStatus=null,e.compactionClearTimer=null},Nd))}function Od(e,t){if(!t)return;if(t.stream==="compaction"){Dd(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 i=t.data??{},s=typeof i.toolCallId=="string"?i.toolCallId:"";if(!s)return;const r=typeof i.name=="string"?i.name:"tool",o=typeof i.phase=="string"?i.phase:"",a=o==="start"?i.args:void 0,l=o==="update"?To(i.partialResult):o==="result"?To(i.result):void 0,c=Date.now();let u=e.toolStreamById.get(s);u?(u.name=r,a!==void 0&&(u.args=a),l!==void 0&&(u.output=l),u.updatedAt=c):(u={toolCallId:s,runId:t.runId,sessionKey:n,name:r,args:a,output:l,startedAt:typeof t.ts=="number"?t.ts:c,updatedAt:c,message:{}},e.toolStreamById.set(s,u),e.toolStreamOrder.push(s)),u.message=Pd(u),Ld(e),Rd(e,o==="result")}function hn(e,t=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const n=()=>{const i=e.querySelector(".chat-thread");if(i){const s=getComputedStyle(i).overflowY;if(s==="auto"||s==="scroll"||i.scrollHeight-i.clientHeight>1)return i}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const i=n();if(!i)return;const s=i.scrollHeight-i.scrollTop-i.clientHeight;if(!(t||e.chatUserNearBottom||s<200))return;t&&(e.chatHasAutoScrolled=!0),i.scrollTop=i.scrollHeight,e.chatUserNearBottom=!0;const o=t?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const a=n();if(!a)return;const l=a.scrollHeight-a.scrollTop-a.clientHeight;(t||e.chatUserNearBottom||l<200)&&(a.scrollTop=a.scrollHeight,e.chatUserNearBottom=!0)},o)})})}function wl(e,t=!1){e.logsScrollFrame&&cancelAnimationFrame(e.logsScrollFrame),e.updateComplete.then(()=>{e.logsScrollFrame=requestAnimationFrame(()=>{e.logsScrollFrame=null;const n=e.querySelector(".log-stream");!n||!(t||n.scrollTop<80)||(n.scrollTop=0)})})}function Bd(e,t){const n=t.currentTarget;if(!n)return;const i=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=i<200}function Fd(e,t){const n=t.currentTarget;n&&(e.logsAtBottom=n.scrollTop<80)}function Ud(e,t){const n=t.currentTarget;n&&(e.logsAtBottom=n.scrollTop<80)}function Wd(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0}function Kd(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
16
16
|
`)}
|
|
17
|
-
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),r=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-logs-${t}-${r}.log`,s.click(),URL.revokeObjectURL(i)}function
|
|
17
|
+
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),r=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-logs-${t}-${r}.log`,s.click(),URL.revokeObjectURL(i)}function zd(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
18
18
|
`)}
|
|
19
|
-
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),r=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-session-logs-${t}-${r}.log`,s.click(),URL.revokeObjectURL(i)}function
|
|
20
|
-
`}function wl(e,t,n){if(t.length===0)return;let i=e;for(let r=0;r<t.length-1;r+=1){const o=t[r],a=t[r+1];if(typeof o=="number"){if(!Array.isArray(i))return;i[o]==null&&(i[o]=typeof a=="number"?[]:{}),i=i[o]}else{if(typeof i!="object"||i==null)return;const l=i;l[o]==null&&(l[o]=typeof a=="number"?[]:{}),i=l[o]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function Te(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Hd(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function kl(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});jd(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function jd(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Hd(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?nt(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=nt(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=ze(t.config??{}),e.configFormOriginal=ze(t.config??{}),e.configRawOriginal=n)}async function qd(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?nt(e.configForm):e.configRaw,i=(t=e.configSnapshot)==null?void 0:t.hash;if(!i){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:n,baseHash:i}),e.configFormDirty=!1,await Te(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function fn(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 ki(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t={includeDisabled:!0};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(t.agentIds=e.workspaceAgentIds);const n=await e.client.request("cron.list",t);e.cronJobs=Array.isArray(n.jobs)?n.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function Gd(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=ti(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const i=e.everyUnit;return{kind:"every",everyMs:n*(i==="minutes"?6e4:i==="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 Vd(e){if(e.payloadKind==="systemEvent"){const s=e.payloadText.trim();if(!s)throw new Error("System event text required.");return{kind:"systemEvent",text:s}}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 i=ti(e.timeoutSeconds,0);return i>0&&(n.timeoutSeconds=i),n}async function Qd(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=Gd(e.cronForm),i=Vd(e.cronForm),s=e.cronForm.agentId.trim(),r=(t=e.cronForm.accountId)==null?void 0:t.trim(),o={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:r||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!o.name)throw new Error("Name required.");await e.client.request("cron.add",o),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await ki(e),await fn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Yd(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 ki(e),await fn(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function Xd(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 Ts(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Zd(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 ki(e),await fn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ts(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 q(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 sr(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const i=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=i.message??null,e.whatsappLoginQrDataUrl=i.qrDataUrl??null,e.whatsappLoginConnected=null}catch(i){e.whatsappLoginMessage=String(i),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Sl(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.wait",{timeoutMs:12e4,accountId:t});e.whatsappLoginMessage=n.message??null,e.whatsappLoginConnected=n.connected??null,n.connected&&(e.whatsappLoginQrDataUrl=null,e.whatsappActiveQrAccountId=null,e.whatsappPairedPhone=n.selfPhone??null)}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Al(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null}catch(n){e.whatsappLoginMessage=String(n)}finally{e.whatsappBusy=!1}}}async function xl(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const i=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!i){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const r=ze(s.config??{});(!r.channels||typeof r.channels!="object")&&(r.channels={});const o=r.channels;(!o.whatsapp||typeof o.whatsapp!="object")&&(o.whatsapp={});const a=o.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const l=a.accounts;if(l[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}l[i]={name:n,provider:"baileys"};const c=s.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const u=nt(r);await e.client.request("config.set",{raw:u,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await q(e,!0),await sr(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function $l(e,t){if(!(!e.client||!e.connected)&&!e.whatsappAccountSaving){e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=ze(n.config??{}),s=i.channels,r=s==null?void 0:s.whatsapp,o=r==null?void 0:r.accounts;if(!o){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(o).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!o[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete o[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(u=>{const f=u.match;return!f||f.channel!=="whatsapp"?!0:f.accountId!==t}));const l=n.hash;if(!l){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=nt(i);await e.client.request("config.set",{raw:c,baseHash:l}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await q(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const Jd=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:xl,loadChannels:q,logoutWhatsApp:Al,removeWhatsAppAccount:$l,startWhatsAppLogin:sr,waitWhatsAppLogin:Sl},Symbol.toStringTag,{value:"Module"}));async function rr(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,i,s]=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 r=i;e.debugModels=Array.isArray(r==null?void 0:r.models)?r==null?void 0:r.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const ep=2e3,tp=new Set(["trace","debug","info","warn","error","fatal"]);function np(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 ip(e){if(typeof e!="string")return null;const t=e.toLowerCase();return tp.has(t)?t:null}function El(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,i=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,s=ip((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),r=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,o=np(r);let a=null;o&&(typeof o.subsystem=="string"?a=o.subsystem:typeof o.module=="string"&&(a=o.module)),!a&&r&&r.length<120&&(a=r);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:i,level:s,subsystem:a,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function xt(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.logsLoading=!0),e.logsError=null;try{const i=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),r=(Array.isArray(i.lines)?i.lines.filter(a=>typeof a=="string"):[]).map(El),o=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=o?r:[...e.logsEntries,...r].slice(-ep),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const sp=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:xt,parseLogLine:El},Symbol.toStringTag,{value:"Module"}));const Tl={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:se,n:Gn,Gx:Co,Gy:_o,a:Xi,d:Zi,h:rp}=Tl,it=32,or=64,op=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},Z=(e="")=>{const t=new Error(e);throw op(t,Z),t},ap=e=>typeof e=="bigint",lp=e=>typeof e=="string",cp=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",je=(e,t,n="")=>{const i=cp(e),s=e==null?void 0:e.length,r=t!==void 0;if(!i||r&&s!==t){const o=n&&`"${n}" `,a=r?` of length ${t}`:"",l=i?`length=${s}`:`type=${typeof e}`;Z(o+"expected Uint8Array"+a+", got "+l)}return e},Si=e=>new Uint8Array(e),Cl=e=>Uint8Array.from(e),_l=(e,t)=>e.toString(16).padStart(t,"0"),Ml=e=>Array.from(je(e)).map(t=>_l(t,2)).join(""),Pe={_0:48,_9:57,A:65,F:70,a:97,f:102},Mo=e=>{if(e>=Pe._0&&e<=Pe._9)return e-Pe._0;if(e>=Pe.A&&e<=Pe.F)return e-(Pe.A-10);if(e>=Pe.a&&e<=Pe.f)return e-(Pe.a-10)},Pl=e=>{const t="hex invalid";if(!lp(e))return Z(t);const n=e.length,i=n/2;if(n%2)return Z(t);const s=Si(i);for(let r=0,o=0;r<i;r++,o+=2){const a=Mo(e.charCodeAt(o)),l=Mo(e.charCodeAt(o+1));if(a===void 0||l===void 0)return Z(t);s[r]=a*16+l}return s},Ll=()=>globalThis==null?void 0:globalThis.crypto,up=()=>{var e;return((e=Ll())==null?void 0:e.subtle)??Z("crypto.subtle must be defined, consider polyfill")},dn=(...e)=>{const t=Si(e.reduce((i,s)=>i+je(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},dp=(e=it)=>Ll().getRandomValues(Si(e)),ni=BigInt,Xe=(e,t,n,i="bad number: out of range")=>ap(e)&&t<=e&&e<n?e:Z(i),M=(e,t=se)=>{const n=e%t;return n>=0n?n:t+n},Il=e=>M(e,Gn),pp=(e,t)=>{(e===0n||t<=0n)&&Z("no inverse n="+e+" mod="+t);let n=M(e,t),i=t,s=0n,r=1n;for(;n!==0n;){const o=i/n,a=i%n,l=s-r*o;i=n,n=a,s=r,r=l}return i===1n?M(s,t):Z("no inverse")},hp=e=>{const t=Ol[e];return typeof t!="function"&&Z("hashes."+e+" not set"),t},Ji=e=>e instanceof st?e:Z("Point expected"),Cs=2n**256n,$e=class $e{constructor(t,n,i,s){B(this,"X");B(this,"Y");B(this,"Z");B(this,"T");const r=Cs;this.X=Xe(t,0n,r),this.Y=Xe(n,0n,r),this.Z=Xe(i,1n,r),this.T=Xe(s,0n,r),Object.freeze(this)}static CURVE(){return Tl}static fromAffine(t){return new $e(t.x,t.y,1n,M(t.x*t.y))}static fromBytes(t,n=!1){const i=Zi,s=Cl(je(t,it)),r=t[31];s[31]=r&-129;const o=Nl(s);Xe(o,0n,n?Cs:se);const l=M(o*o),c=M(l-1n),u=M(i*l+1n);let{isValid:f,value:d}=gp(c,u);f||Z("bad point: y not sqrt");const h=(d&1n)===1n,w=(r&128)!==0;return!n&&d===0n&&w&&Z("bad point: x==0, isLastByteOdd"),w!==h&&(d=M(-d)),new $e(d,o,1n,M(d*o))}static fromHex(t,n){return $e.fromBytes(Pl(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Xi,n=Zi,i=this;if(i.is0())return Z("bad point: ZERO");const{X:s,Y:r,Z:o,T:a}=i,l=M(s*s),c=M(r*r),u=M(o*o),f=M(u*u),d=M(l*t),h=M(u*M(d+c)),w=M(f+M(n*M(l*c)));if(h!==w)return Z("bad point: equation left != right (1)");const b=M(s*r),S=M(o*a);return b!==S?Z("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:r,Y:o,Z:a}=Ji(t),l=M(n*a),c=M(r*s),u=M(i*a),f=M(o*s);return l===c&&u===f}is0(){return this.equals(St)}negate(){return new $e(M(-this.X),this.Y,this.Z,M(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=Xi,r=M(t*t),o=M(n*n),a=M(2n*M(i*i)),l=M(s*r),c=t+n,u=M(M(c*c)-r-o),f=l+o,d=f-a,h=l-o,w=M(u*d),b=M(f*h),S=M(u*h),T=M(d*f);return new $e(w,b,T,S)}add(t){const{X:n,Y:i,Z:s,T:r}=this,{X:o,Y:a,Z:l,T:c}=Ji(t),u=Xi,f=Zi,d=M(n*o),h=M(i*a),w=M(r*f*c),b=M(s*l),S=M((n+i)*(o+a)-d-h),T=M(b-w),x=M(b+w),E=M(h-u*d),C=M(S*T),I=M(x*E),U=M(S*E),Q=M(T*x);return new $e(C,I,Q,U)}subtract(t){return this.add(Ji(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return St;if(Xe(t,1n,Gn),t===1n)return this;if(this.equals(rt))return Ep(t).p;let i=St,s=rt;for(let r=this;t>0n;r=r.double(),t>>=1n)t&1n?i=i.add(r):n&&(s=s.add(r));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals(St))return{x:0n,y:1n};const s=pp(i,se);M(i*s)!==1n&&Z("invalid inverse");const r=M(t*s),o=M(n*s);return{x:r,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Rl(n);return i[31]|=t&1n?128:0,i}toHex(){return Ml(this.toBytes())}clearCofactor(){return this.multiply(ni(rp),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Gn/2n,!1).double();return Gn%2n&&(t=t.add(this)),t.is0()}};B($e,"BASE"),B($e,"ZERO");let st=$e;const rt=new st(Co,_o,1n,M(Co*_o)),St=new st(0n,1n,1n,0n);st.BASE=rt;st.ZERO=St;const Rl=e=>Pl(_l(Xe(e,0n,Cs),or)).reverse(),Nl=e=>ni("0x"+Ml(Cl(je(e)).reverse())),ke=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=se;return n},fp=e=>{const n=e*e%se*e%se,i=ke(n,2n)*n%se,s=ke(i,1n)*e%se,r=ke(s,5n)*s%se,o=ke(r,10n)*r%se,a=ke(o,20n)*o%se,l=ke(a,40n)*a%se,c=ke(l,80n)*l%se,u=ke(c,80n)*l%se,f=ke(u,10n)*r%se;return{pow_p_5_8:ke(f,2n)*e%se,b2:n}},Po=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,gp=(e,t)=>{const n=M(t*t*t),i=M(n*n*t),s=fp(e*i).pow_p_5_8;let r=M(e*n*s);const o=M(t*r*r),a=r,l=M(r*Po),c=o===e,u=o===M(-e),f=o===M(-e*Po);return c&&(r=a),(u||f)&&(r=l),(M(r)&1n)===1n&&(r=M(-r)),{isValid:c||u,value:r}},_s=e=>Il(Nl(e)),ar=(...e)=>Ol.sha512Async(dn(...e)),mp=(...e)=>hp("sha512")(dn(...e)),Dl=e=>{const t=e.slice(0,it);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(it,or),i=_s(t),s=rt.multiply(i),r=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:r}},lr=e=>ar(je(e,it)).then(Dl),yp=e=>Dl(mp(je(e,it))),vp=e=>lr(e).then(t=>t.pointBytes),bp=e=>ar(e.hashable).then(e.finish),wp=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,r=_s(t),o=rt.multiply(r).toBytes();return{hashable:dn(o,i,n),finish:c=>{const u=Il(r+_s(c)*s);return je(dn(o,Rl(u)),or)}}},kp=async(e,t)=>{const n=je(e),i=await lr(t),s=await ar(i.prefix,n);return bp(wp(i,s,n))},Ol={sha512Async:async e=>{const t=up(),n=dn(e);return Si(await t.digest("SHA-512",n.buffer))},sha512:void 0},Sp=(e=dp(it))=>e,Ap={getExtendedPublicKeyAsync:lr,getExtendedPublicKey:yp,randomSecretKey:Sp},ii=8,xp=256,Bl=Math.ceil(xp/ii)+1,Ms=2**(ii-1),$p=()=>{const e=[];let t=rt,n=t;for(let i=0;i<Bl;i++){n=t,e.push(n);for(let s=1;s<Ms;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Lo;const Io=(e,t)=>{const n=t.negate();return e?n:t},Ep=e=>{const t=Lo||(Lo=$p());let n=St,i=rt;const s=2**ii,r=s,o=ni(s-1),a=ni(ii);for(let l=0;l<Bl;l++){let c=Number(e&o);e>>=a,c>Ms&&(c-=r,e+=1n);const u=l*Ms,f=u,d=u+Math.abs(c)-1,h=l%2!==0,w=c<0;c===0?i=i.add(Io(h,t[f])):n=n.add(Io(w,t[d]))}return e!==0n&&Z("invalid wnaf"),{p:n,f:i}},es="taskmaster-device-identity-v1";function Ps(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Fl(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),i=atob(n),s=new Uint8Array(i.length);for(let r=0;r<i.length;r+=1)s[r]=i.charCodeAt(r);return s}function Tp(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Ul(e){const t=await crypto.subtle.digest("SHA-256",e);return Tp(new Uint8Array(t))}async function Cp(){const e=Ap.randomSecretKey(),t=await vp(e);return{deviceId:await Ul(t),publicKey:Ps(t),privateKey:Ps(e)}}async function _p(){try{const n=localStorage.getItem(es);if(n){const i=JSON.parse(n);if((i==null?void 0:i.version)===1&&typeof i.deviceId=="string"&&typeof i.publicKey=="string"&&typeof i.privateKey=="string"){const s=await Ul(Fl(i.publicKey));if(s!==i.deviceId){const r={...i,deviceId:s};return localStorage.setItem(es,JSON.stringify(r)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await Cp(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(es,JSON.stringify(t)),e}async function Mp(e,t){const n=Fl(e),i=new TextEncoder().encode(t),s=await kp(i,n);return Ps(s)}const Wl="taskmaster.device.auth.v1";function cr(e){return e.trim()}function Pp(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const i=n.trim();i&&t.add(i)}return[...t].sort()}function ur(){try{const e=window.localStorage.getItem(Wl);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 Kl(e){try{window.localStorage.setItem(Wl,JSON.stringify(e))}catch{}}function Lp(e){const t=ur();if(!t||t.deviceId!==e.deviceId)return null;const n=cr(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function Ip(e){const t=cr(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=ur();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:Pp(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Kl(n),s}function Rp(e){const t=ur();if(!t||t.deviceId!==e.deviceId)return;const n=cr(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Kl(i)}async function dr(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t!=null&&t.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n==null?void 0:n.pending)?n.pending:[],paired:Array.isArray(n==null?void 0:n.paired)?n.paired:[]}}catch(n){t!=null&&t.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function pr(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t!=null&&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!=null&&t.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function Np(e){return{method:"exec.approvals.get",params:{}}}async function Dp(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Np(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);Op(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Op(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=ze(t.file??{}))}async function zl(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function Tt(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Ai(e){return e instanceof Error?e.message:String(e)}async function ot(e,t){if(t!=null&&t.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=Ai(n)}finally{e.skillsLoading=!1}}}function jl(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Hl(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 ot(e),Tt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Ai(i);e.skillsError=s,Tt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function ql(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 ot(e),Tt(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Ai(n);e.skillsError=i,Tt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Gl(e,t,n,i){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const s=await e.client.request("skills.install",{name:n,installId:i,timeoutMs:12e4});await ot(e),Tt(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const r=Ai(s);e.skillsError=r,Tt(e,t,{kind:"error",message:r})}finally{e.skillsBusyKey=null}}}const Bp=Object.freeze(Object.defineProperty({__proto__:null,installSkill:Gl,loadSkills:ot,saveSkillApiKey:ql,updateSkillEdit:jl,updateSkillEnabled:Hl},Symbol.toStringTag,{value:"Module"})),Vl={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},Ql=new Map(Object.entries(Vl).map(([e,t])=>[t,e]));function xi(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function pn(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 Fp(e,t=""){const n=xi(t),i=Vl[e];return n?`${n}${i}`:i}function Yl(e,t=""){const n=xi(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=pn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":Ql.get(s)??null}function Up(e){let t=pn(e);if(t.endsWith("/index.html")&&(t=pn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let i=0;i<n.length;i++){const s=`/${n.slice(i).join("/")}`.toLowerCase();if(Ql.has(s)){const r=n.slice(0,i);return r.length?`/${r.join("/")}`:""}}return`/${n.join("/")}`}function Wp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function hr(e){return e==="system"?Wp():e}const In=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Kp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Rn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},zp=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var c;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const r=s.documentElement,o=s,a=Kp();if(!!o.startViewTransition&&!a){let u=.5,f=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")u=In(n.pointerClientX/window.innerWidth),f=In(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const d=n.element.getBoundingClientRect();d.width>0&&d.height>0&&typeof window<"u"&&(u=In((d.left+d.width/2)/window.innerWidth),f=In((d.top+d.height/2)/window.innerHeight))}r.style.setProperty("--theme-switch-x",`${u*100}%`),r.style.setProperty("--theme-switch-y",`${f*100}%`),r.classList.add("theme-transition");try{const d=(c=o.startViewTransition)==null?void 0:c.call(o,()=>{t()});d!=null&&d.finished?d.finished.finally(()=>Rn(r)):Rn(r)}catch{Rn(r),t()}return}t(),Rn(r)},jp=2e3;async function sn(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),r=Array.isArray(s.entries)?s.entries:[],o=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=o?r:[...e.sessionLogsEntries,...r].slice(-jp),s.cursors&&(e.sessionLogsCursors=s.cursors),Array.isArray(s.agents)&&(e.sessionLogsAgents=s.agents),e.sessionLogsLastFetchAt=Date.now()}catch(n){e.sessionLogsError=String(n)}finally{t!=null&&t.quiet||(e.sessionLogsLoading=!1)}}}const Xl=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:sn},Symbol.toStringTag,{value:"Module"}));async function Zl(e,t){if(!(!e.client||!e.connected))try{const n={},i=await e.client.request("memory.audit",n);i!=null&&i.ok&&(e.auditEntries=i.entries??[])}catch{}}async function Hp(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Re(e){return e instanceof Error?e.message:String(e)}let Nn=null;function gn(e,t){Nn&&clearTimeout(Nn),e.filesMessage={kind:"success",text:t},Nn=setTimeout(()=>{e.filesMessage=null,Nn=null},3e3)}async function mn(e,t){if(!(!e.client||!e.connected)){if(!t){e.filesTree=[],e.filesRoot="";return}if(!e.filesLoading){e.filesLoading=!0,e.filesError=null;try{const n={};t&&(n.agentId=t);const i=await e.client.request("files.tree",n);i!=null&&i.tree&&(e.filesTree=i.tree,e.filesRoot=i.root??"")}catch(n){e.filesError=Re(n)}finally{e.filesLoading=!1}}}}async function qp(e,t,n){e.filesSelectedPaths=new Set([t]),await Jl(e,t,n)}async function Gp(e,t,n){const i=new Set(e.filesSelectedPaths);if(i.has(t)?i.delete(t):i.add(t),e.filesSelectedPaths=i,i.size===1){const s=[...i][0];await Jl(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Vp(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const r of n)try{await ec(e,r,t),i++}catch(o){s=Re(o)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:gn(e,`${i} file${i!==1?"s":""} downloaded`)}async function Qp(e,t,n,i){const s=t.split("/").pop()??t,r=n==="."?s:`${n}/${s}`;r!==t&&await tc(e,t,r,i)}async function Jl(e,t,n){if(!(!e.client||!e.connected)){e.filesSelectedPath=t,e.filesPreviewLoading=!0,e.filesPreviewContent=null,e.filesPreviewBinary=!1,e.filesPreviewSize=null;try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.read",i);e.filesPreviewContent=(s==null?void 0:s.content)??null,e.filesPreviewBinary=(s==null?void 0:s.binary)??!1,e.filesPreviewSize=(s==null?void 0:s.size)??null}catch(i){e.filesError=Re(i)}finally{e.filesPreviewLoading=!1}}}async function ec(e,t,n){if(!(!e.client||!e.connected))try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.download",i);if(!(s!=null&&s.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const r=Uint8Array.from(atob(s.base64),c=>c.charCodeAt(0)),o=new Blob([r]),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.download=s.name??t.split("/").pop()??"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}catch(i){e.filesMessage={kind:"error",text:Re(i)}}}async function Yp(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,r="";for(const o of n)try{const a=await o.arrayBuffer(),l=btoa(new Uint8Array(a).reduce((u,f)=>u+String.fromCharCode(f),"")),c={path:t,name:o.name,data:l};i&&(c.agentId=i),await e.client.request("files.upload",c),s++}catch(a){r=Re(a)}e.filesUploadBusy=!1,r?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${r}`:r}:gn(e,`${s} file${s!==1?"s":""} uploaded`),await mn(e,i)}async function Xp(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={path:t};n&&(i.agentId=n),await e.client.request("files.delete",i),gn(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await mn(e,n)}catch(i){e.filesMessage={kind:"error",text:Re(i)}}}}async function tc(e,t,n,i){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={from:t,to:n};i&&(s.agentId=i),await e.client.request("files.move",s),gn(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await mn(e,i)}catch(s){e.filesMessage={kind:"error",text:Re(s)}}}}async function fr(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const i=await e.client.request("memory.status",n);i!=null&&i.ok&&(e.filesMemoryStatus={dirty:i.dirty??!1,files:i.files??0,chunks:i.chunks??0})}catch{}}async function Zp(e,t){if(!(!e.client||!e.connected)&&!e.filesReindexBusy){e.filesReindexBusy=!0,e.filesMessage=null;try{const n={force:!0};t&&(n.agentId=t);const i=await e.client.request("memory.reindex",n),s=(i==null?void 0:i.files)??0,r=(i==null?void 0:i.chunks)??0;gn(e,`Re-indexed: ${s} files, ${r} chunks`),await fr(e,t)}catch(n){e.filesMessage={kind:"error",text:Re(n)}}finally{e.filesReindexBusy=!1}}}function Jp(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n}async function eh(e,t,n){if(!(!e.client||!e.connected)){if(!t.trim()){e.filesSearchResults=null;return}e.filesSearchLoading=!0,e.filesSearchResults=null;try{const i={query:t.trim(),maxResults:20};n&&(i.agentId=n);const s=await e.client.request("memory.search",i);e.filesSearchResults=(s==null?void 0:s.results)??[]}catch(i){e.filesMessage={kind:"error",text:Re(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function th(e){e.filesSearchQuery="",e.filesSearchResults=null}function nh(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{pr(e,{quiet:!0})},5e3))}function ih(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function gr(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&xt(e,{quiet:!0})},2e3))}function mr(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function yr(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||sn(e,{quiet:!0})},2e3))}function vr(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function br(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&rr(e)},3e3))}function wr(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function sh(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{Zl(e)},3e4))}function rh(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function oh(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{e.tab==="files"&&fr(e)},1e4))}function ah(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function We(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,ld(n),t.theme!==e.theme&&(e.theme=t.theme,$i(e,hr(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function nc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&We(e,{...e.settings,lastActiveSessionKey:n})}function lh(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),r=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&We(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(i!=null){const l=i.trim();l&&(e.password=l),t.delete("password"),o=!0}if(s!=null){const l=s.trim();l&&(e.sessionKey=l,We(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(r!=null){const l=r.trim();l&&l!==e.settings.gatewayUrl&&We(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),o=!0}if(!o)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function ch(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?yr(e):gr(e):(mr(e),vr(e)),t==="debug"?br(e):wr(e),si(e),sc(e,t,!1)}function uh(e,t,n){zp({nextTheme:t,applyTheme:()=>{e.theme=t,We(e,{...e.settings,theme:t}),$i(e,hr(t))},context:n,currentTheme:e.theme})}async function si(e){if(e.tab==="overview"&&await rc(e),e.tab==="channels"&&await yh(e),e.tab==="instances"&&await zl(e),e.tab==="cron"&&await kr(e),e.tab==="skills"&&await ot(e),e.tab==="nodes"&&(await pr(e),await dr(e),await Te(e),await Dp(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await Sh(e),hn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await kl(e),await Te(e)),e.tab==="debug"&&(await rr(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await ne(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>Xl);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await xt(e,{reset:!0});bl(e,!0)}}function dh(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?xi(e):Up(window.location.pathname)}function ph(e){e.theme=e.settings.theme??"system",$i(e,hr(e.theme))}function $i(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function hh(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"&&$i(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function fh(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 gh(e,t){if(typeof window>"u")return;const n=Yl(window.location.pathname,e.basePath)??"chat";ic(e,n),sc(e,n,t)}function mh(e){var s;if(typeof window>"u")return;const t=Yl(window.location.pathname,e.basePath);if(!t)return;const i=(s=new URL(window.location.href).searchParams.get("session"))==null?void 0:s.trim();i&&(e.sessionKey=i,We(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),ic(e,t)}function ic(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?yr(e):gr(e):(mr(e),vr(e)),t==="debug"?br(e):wr(e),e.connected&&si(e)}function sc(e,t,n){if(typeof window>"u")return;const i=pn(Fp(t,e.basePath)),s=pn(window.location.pathname),r=new URL(window.location.href);t==="chat"&&e.sessionKey?r.searchParams.set("session",e.sessionKey):r.searchParams.delete("session"),s!==i&&(r.pathname=i),n?window.history.replaceState({},"",r.toString()):window.history.pushState({},"",r.toString())}async function rc(e){await Promise.all([q(e,!1),zl(e),nr(e),fn(e),rr(e)])}async function yh(e){await Promise.all([q(e,!0),kl(e),Te(e)])}async function kr(e){await Promise.all([q(e,!1),fn(e),ki(e)])}function oc(e){return e.chatSending||!!e.chatRunId}function vh(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 ac(e){e.connected&&(e.chatMessage="",await yl(e))}function bh(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:tr(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(r=>({...r})):void 0}],hn(e))}async function lc(e,t,n){var s,r;ir(e);const i=await ml(e,t,n==null?void 0:n.attachments);return!i&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!i&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),i&&nc(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((r=n.previousAttachments)!=null&&r.length)&&(e.chatAttachments=n.previousAttachments),hn(e),i&&!e.chatRunId&&cc(e),i}async function cc(e){if(!e.connected||oc(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await lc(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function wh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function kh(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),r=e.chatAttachments??[],o=t==null?r:[],a=o.length>0;if(!(!s&&!a)){if(vh(s)){await ac(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),oc(e)){bh(e,s,o);return}await lc(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?o:void 0,previousAttachments:t==null?r:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function Sh(e){await Promise.all([Ee(e),nr(e),Ls(e)]),hn(e,!0)}const Ah=cc;function xh(e){var s,r,o;const t=ll(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((o=(r=n==null?void 0:n.sessionDefaults)==null?void 0:r.defaultAgentId)==null?void 0:o.trim())||"main"}function $h(e,t){const n=xi(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function Ls(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=xh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=$h(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),r=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=r||null}catch{e.chatAvatarUrl=null}}const D={messageSquare:p`<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:p`<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:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:p`<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:p`<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:p`<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:p`<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:p`<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>`,users:p`<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>`,menu:p`<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:p`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:p`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:p`<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:p`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:p`<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:p`<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:p`<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>`,rotateCw:p`<svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,download:p`<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,wrench:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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>`,image:p`<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:p`<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>`,plug:p`<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:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`,puzzle:p`<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>`,info:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>`,send:p`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>`,slidersHorizontal:p`<svg viewBox="0 0 24 24"><line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/></svg>`,square:p`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:p`<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:p`<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>`,trash:p`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,chevronDown:p`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:p`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`},Eh="Taskmaster",Th="/taskmaster-icon.png",uc="#00d4ff";let Dn=null;function Ie(){return Dn||(Dn={name:window.__TASKMASTER_BRAND_NAME__||Eh,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||Th,accentColor:window.__TASKMASTER_ACCENT_COLOR__||uc},Dn)}function Ch(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);return t?`${parseInt(t[1],16)}, ${parseInt(t[2],16)}, ${parseInt(t[3],16)}`:null}function _h(e){if(e===uc)return;const t=Ch(e);if(!t)return;const n=document.documentElement;n.style.setProperty("--accent",e),n.style.setProperty("--accent-hover",e),n.style.setProperty("--accent-muted",e),n.style.setProperty("--primary",e),n.style.setProperty("--ring",e),n.style.setProperty("--accent-subtle",`rgba(${t}, 0.15)`),n.style.setProperty("--accent-glow",`rgba(${t}, 0.25)`),n.style.setProperty("--tasker-orange",e),n.style.setProperty("--tasker-orange-hover",e),n.style.setProperty("--tasker-orange-glow",`rgba(${t}, 0.25)`)}const Mh=p`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><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>`,Ph=p`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>`;let Ro=!1;function Lh(){Ro||(Ro=!0,document.addEventListener("click",e=>{const t=document.getElementById("nav-burger-toggle");if(!(t!=null&&t.checked))return;const n=t.closest(".setup-header");n!=null&&n.contains(e.target)||(t.checked=!1)}))}function ut(e,t){const n=(u,f)=>u===e?p`<span class="sp-page-nav-current">${u}</span>`:p`<a href=${f}>${u}</a>`,i=p`
|
|
19
|
+
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),r=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-session-logs-${t}-${r}.log`,s.click(),URL.revokeObjectURL(i)}function jd(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:i}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${i}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}function ze(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function nt(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
20
|
+
`}function kl(e,t,n){if(t.length===0)return;let i=e;for(let r=0;r<t.length-1;r+=1){const o=t[r],a=t[r+1];if(typeof o=="number"){if(!Array.isArray(i))return;i[o]==null&&(i[o]=typeof a=="number"?[]:{}),i=i[o]}else{if(typeof i!="object"||i==null)return;const l=i;l[o]==null&&(l[o]=typeof a=="number"?[]:{}),i=l[o]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function Te(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});qd(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function Sl(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});Hd(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function Hd(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function qd(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?nt(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=nt(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=ze(t.config??{}),e.configFormOriginal=ze(t.config??{}),e.configRawOriginal=n)}async function Vd(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?nt(e.configForm):e.configRaw,i=(t=e.configSnapshot)==null?void 0:t.hash;if(!i){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:n,baseHash:i}),e.configFormDirty=!1,await Te(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function fn(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 ki(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t={includeDisabled:!0};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(t.agentIds=e.workspaceAgentIds);const n=await e.client.request("cron.list",t);e.cronJobs=Array.isArray(n.jobs)?n.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function Gd(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=ti(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const i=e.everyUnit;return{kind:"every",everyMs:n*(i==="minutes"?6e4:i==="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 Qd(e){if(e.payloadKind==="systemEvent"){const s=e.payloadText.trim();if(!s)throw new Error("System event text required.");return{kind:"systemEvent",text:s}}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 i=ti(e.timeoutSeconds,0);return i>0&&(n.timeoutSeconds=i),n}async function Yd(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=Gd(e.cronForm),i=Qd(e.cronForm),s=e.cronForm.agentId.trim(),r=(t=e.cronForm.accountId)==null?void 0:t.trim(),o={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:r||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!o.name)throw new Error("Name required.");await e.client.request("cron.add",o),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await ki(e),await fn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Xd(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 ki(e),await fn(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function Zd(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 Ts(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Jd(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 ki(e),await fn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ts(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 q(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 sr(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const i=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=i.message??null,e.whatsappLoginQrDataUrl=i.qrDataUrl??null,e.whatsappLoginConnected=null}catch(i){e.whatsappLoginMessage=String(i),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Al(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.wait",{timeoutMs:12e4,accountId:t});e.whatsappLoginMessage=n.message??null,e.whatsappLoginConnected=n.connected??null,n.connected&&(e.whatsappLoginQrDataUrl=null,e.whatsappActiveQrAccountId=null,e.whatsappPairedPhone=n.selfPhone??null)}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function $l(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null}catch(n){e.whatsappLoginMessage=String(n)}finally{e.whatsappBusy=!1}}}async function xl(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const i=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!i){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const r=ze(s.config??{});(!r.channels||typeof r.channels!="object")&&(r.channels={});const o=r.channels;(!o.whatsapp||typeof o.whatsapp!="object")&&(o.whatsapp={});const a=o.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const l=a.accounts;if(l[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}l[i]={name:n,provider:"baileys"};const c=s.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const u=nt(r);await e.client.request("config.set",{raw:u,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await q(e,!0),await sr(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function El(e,t){if(!(!e.client||!e.connected)&&!e.whatsappAccountSaving){e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=ze(n.config??{}),s=i.channels,r=s==null?void 0:s.whatsapp,o=r==null?void 0:r.accounts;if(!o){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(o).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!o[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete o[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(u=>{const f=u.match;return!f||f.channel!=="whatsapp"?!0:f.accountId!==t}));const l=n.hash;if(!l){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=nt(i);await e.client.request("config.set",{raw:c,baseHash:l}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await q(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const ep=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:xl,loadChannels:q,logoutWhatsApp:$l,removeWhatsAppAccount:El,startWhatsAppLogin:sr,waitWhatsAppLogin:Al},Symbol.toStringTag,{value:"Module"}));async function rr(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,i,s]=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 r=i;e.debugModels=Array.isArray(r==null?void 0:r.models)?r==null?void 0:r.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const tp=2e3,np=new Set(["trace","debug","info","warn","error","fatal"]);function ip(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 sp(e){if(typeof e!="string")return null;const t=e.toLowerCase();return np.has(t)?t:null}function Tl(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,i=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,s=sp((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),r=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,o=ip(r);let a=null;o&&(typeof o.subsystem=="string"?a=o.subsystem:typeof o.module=="string"&&(a=o.module)),!a&&r&&r.length<120&&(a=r);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:i,level:s,subsystem:a,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function $t(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.logsLoading=!0),e.logsError=null;try{const i=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),r=(Array.isArray(i.lines)?i.lines.filter(a=>typeof a=="string"):[]).map(Tl),o=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=o?r:[...e.logsEntries,...r].slice(-tp),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const rp=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:$t,parseLogLine:Tl},Symbol.toStringTag,{value:"Module"}));const Cl={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:se,n:Vn,Gx:Co,Gy:_o,a:Xi,d:Zi,h:op}=Cl,it=32,or=64,ap=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},Z=(e="")=>{const t=new Error(e);throw ap(t,Z),t},lp=e=>typeof e=="bigint",cp=e=>typeof e=="string",up=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",je=(e,t,n="")=>{const i=up(e),s=e==null?void 0:e.length,r=t!==void 0;if(!i||r&&s!==t){const o=n&&`"${n}" `,a=r?` of length ${t}`:"",l=i?`length=${s}`:`type=${typeof e}`;Z(o+"expected Uint8Array"+a+", got "+l)}return e},Si=e=>new Uint8Array(e),_l=e=>Uint8Array.from(e),Ml=(e,t)=>e.toString(16).padStart(t,"0"),Pl=e=>Array.from(je(e)).map(t=>Ml(t,2)).join(""),Pe={_0:48,_9:57,A:65,F:70,a:97,f:102},Mo=e=>{if(e>=Pe._0&&e<=Pe._9)return e-Pe._0;if(e>=Pe.A&&e<=Pe.F)return e-(Pe.A-10);if(e>=Pe.a&&e<=Pe.f)return e-(Pe.a-10)},Ll=e=>{const t="hex invalid";if(!cp(e))return Z(t);const n=e.length,i=n/2;if(n%2)return Z(t);const s=Si(i);for(let r=0,o=0;r<i;r++,o+=2){const a=Mo(e.charCodeAt(o)),l=Mo(e.charCodeAt(o+1));if(a===void 0||l===void 0)return Z(t);s[r]=a*16+l}return s},Il=()=>globalThis==null?void 0:globalThis.crypto,dp=()=>{var e;return((e=Il())==null?void 0:e.subtle)??Z("crypto.subtle must be defined, consider polyfill")},dn=(...e)=>{const t=Si(e.reduce((i,s)=>i+je(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},pp=(e=it)=>Il().getRandomValues(Si(e)),ni=BigInt,Xe=(e,t,n,i="bad number: out of range")=>lp(e)&&t<=e&&e<n?e:Z(i),M=(e,t=se)=>{const n=e%t;return n>=0n?n:t+n},Rl=e=>M(e,Vn),hp=(e,t)=>{(e===0n||t<=0n)&&Z("no inverse n="+e+" mod="+t);let n=M(e,t),i=t,s=0n,r=1n;for(;n!==0n;){const o=i/n,a=i%n,l=s-r*o;i=n,n=a,s=r,r=l}return i===1n?M(s,t):Z("no inverse")},fp=e=>{const t=Bl[e];return typeof t!="function"&&Z("hashes."+e+" not set"),t},Ji=e=>e instanceof st?e:Z("Point expected"),Cs=2n**256n,xe=class xe{constructor(t,n,i,s){B(this,"X");B(this,"Y");B(this,"Z");B(this,"T");const r=Cs;this.X=Xe(t,0n,r),this.Y=Xe(n,0n,r),this.Z=Xe(i,1n,r),this.T=Xe(s,0n,r),Object.freeze(this)}static CURVE(){return Cl}static fromAffine(t){return new xe(t.x,t.y,1n,M(t.x*t.y))}static fromBytes(t,n=!1){const i=Zi,s=_l(je(t,it)),r=t[31];s[31]=r&-129;const o=Dl(s);Xe(o,0n,n?Cs:se);const l=M(o*o),c=M(l-1n),u=M(i*l+1n);let{isValid:f,value:d}=mp(c,u);f||Z("bad point: y not sqrt");const p=(d&1n)===1n,w=(r&128)!==0;return!n&&d===0n&&w&&Z("bad point: x==0, isLastByteOdd"),w!==p&&(d=M(-d)),new xe(d,o,1n,M(d*o))}static fromHex(t,n){return xe.fromBytes(Ll(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Xi,n=Zi,i=this;if(i.is0())return Z("bad point: ZERO");const{X:s,Y:r,Z:o,T:a}=i,l=M(s*s),c=M(r*r),u=M(o*o),f=M(u*u),d=M(l*t),p=M(u*M(d+c)),w=M(f+M(n*M(l*c)));if(p!==w)return Z("bad point: equation left != right (1)");const b=M(s*r),S=M(o*a);return b!==S?Z("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:r,Y:o,Z:a}=Ji(t),l=M(n*a),c=M(r*s),u=M(i*a),f=M(o*s);return l===c&&u===f}is0(){return this.equals(St)}negate(){return new xe(M(-this.X),this.Y,this.Z,M(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=Xi,r=M(t*t),o=M(n*n),a=M(2n*M(i*i)),l=M(s*r),c=t+n,u=M(M(c*c)-r-o),f=l+o,d=f-a,p=l-o,w=M(u*d),b=M(f*p),S=M(u*p),T=M(d*f);return new xe(w,b,T,S)}add(t){const{X:n,Y:i,Z:s,T:r}=this,{X:o,Y:a,Z:l,T:c}=Ji(t),u=Xi,f=Zi,d=M(n*o),p=M(i*a),w=M(r*f*c),b=M(s*l),S=M((n+i)*(o+a)-d-p),T=M(b-w),$=M(b+w),E=M(p-u*d),C=M(S*T),I=M($*E),U=M(S*E),Q=M(T*$);return new xe(C,I,Q,U)}subtract(t){return this.add(Ji(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return St;if(Xe(t,1n,Vn),t===1n)return this;if(this.equals(rt))return Tp(t).p;let i=St,s=rt;for(let r=this;t>0n;r=r.double(),t>>=1n)t&1n?i=i.add(r):n&&(s=s.add(r));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals(St))return{x:0n,y:1n};const s=hp(i,se);M(i*s)!==1n&&Z("invalid inverse");const r=M(t*s),o=M(n*s);return{x:r,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Nl(n);return i[31]|=t&1n?128:0,i}toHex(){return Pl(this.toBytes())}clearCofactor(){return this.multiply(ni(op),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Vn/2n,!1).double();return Vn%2n&&(t=t.add(this)),t.is0()}};B(xe,"BASE"),B(xe,"ZERO");let st=xe;const rt=new st(Co,_o,1n,M(Co*_o)),St=new st(0n,1n,1n,0n);st.BASE=rt;st.ZERO=St;const Nl=e=>Ll(Ml(Xe(e,0n,Cs),or)).reverse(),Dl=e=>ni("0x"+Pl(_l(je(e)).reverse())),ke=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=se;return n},gp=e=>{const n=e*e%se*e%se,i=ke(n,2n)*n%se,s=ke(i,1n)*e%se,r=ke(s,5n)*s%se,o=ke(r,10n)*r%se,a=ke(o,20n)*o%se,l=ke(a,40n)*a%se,c=ke(l,80n)*l%se,u=ke(c,80n)*l%se,f=ke(u,10n)*r%se;return{pow_p_5_8:ke(f,2n)*e%se,b2:n}},Po=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,mp=(e,t)=>{const n=M(t*t*t),i=M(n*n*t),s=gp(e*i).pow_p_5_8;let r=M(e*n*s);const o=M(t*r*r),a=r,l=M(r*Po),c=o===e,u=o===M(-e),f=o===M(-e*Po);return c&&(r=a),(u||f)&&(r=l),(M(r)&1n)===1n&&(r=M(-r)),{isValid:c||u,value:r}},_s=e=>Rl(Dl(e)),ar=(...e)=>Bl.sha512Async(dn(...e)),yp=(...e)=>fp("sha512")(dn(...e)),Ol=e=>{const t=e.slice(0,it);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(it,or),i=_s(t),s=rt.multiply(i),r=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:r}},lr=e=>ar(je(e,it)).then(Ol),vp=e=>Ol(yp(je(e,it))),bp=e=>lr(e).then(t=>t.pointBytes),wp=e=>ar(e.hashable).then(e.finish),kp=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,r=_s(t),o=rt.multiply(r).toBytes();return{hashable:dn(o,i,n),finish:c=>{const u=Rl(r+_s(c)*s);return je(dn(o,Nl(u)),or)}}},Sp=async(e,t)=>{const n=je(e),i=await lr(t),s=await ar(i.prefix,n);return wp(kp(i,s,n))},Bl={sha512Async:async e=>{const t=dp(),n=dn(e);return Si(await t.digest("SHA-512",n.buffer))},sha512:void 0},Ap=(e=pp(it))=>e,$p={getExtendedPublicKeyAsync:lr,getExtendedPublicKey:vp,randomSecretKey:Ap},ii=8,xp=256,Fl=Math.ceil(xp/ii)+1,Ms=2**(ii-1),Ep=()=>{const e=[];let t=rt,n=t;for(let i=0;i<Fl;i++){n=t,e.push(n);for(let s=1;s<Ms;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Lo;const Io=(e,t)=>{const n=t.negate();return e?n:t},Tp=e=>{const t=Lo||(Lo=Ep());let n=St,i=rt;const s=2**ii,r=s,o=ni(s-1),a=ni(ii);for(let l=0;l<Fl;l++){let c=Number(e&o);e>>=a,c>Ms&&(c-=r,e+=1n);const u=l*Ms,f=u,d=u+Math.abs(c)-1,p=l%2!==0,w=c<0;c===0?i=i.add(Io(p,t[f])):n=n.add(Io(w,t[d]))}return e!==0n&&Z("invalid wnaf"),{p:n,f:i}},es="taskmaster-device-identity-v1";function Ps(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Ul(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),i=atob(n),s=new Uint8Array(i.length);for(let r=0;r<i.length;r+=1)s[r]=i.charCodeAt(r);return s}function Cp(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Wl(e){const t=await crypto.subtle.digest("SHA-256",e);return Cp(new Uint8Array(t))}async function _p(){const e=$p.randomSecretKey(),t=await bp(e);return{deviceId:await Wl(t),publicKey:Ps(t),privateKey:Ps(e)}}async function Mp(){try{const n=localStorage.getItem(es);if(n){const i=JSON.parse(n);if((i==null?void 0:i.version)===1&&typeof i.deviceId=="string"&&typeof i.publicKey=="string"&&typeof i.privateKey=="string"){const s=await Wl(Ul(i.publicKey));if(s!==i.deviceId){const r={...i,deviceId:s};return localStorage.setItem(es,JSON.stringify(r)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await _p(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(es,JSON.stringify(t)),e}async function Pp(e,t){const n=Ul(e),i=new TextEncoder().encode(t),s=await Sp(i,n);return Ps(s)}const Kl="taskmaster.device.auth.v1";function cr(e){return e.trim()}function Lp(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const i=n.trim();i&&t.add(i)}return[...t].sort()}function ur(){try{const e=window.localStorage.getItem(Kl);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 zl(e){try{window.localStorage.setItem(Kl,JSON.stringify(e))}catch{}}function Ip(e){const t=ur();if(!t||t.deviceId!==e.deviceId)return null;const n=cr(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function Rp(e){const t=cr(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=ur();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:Lp(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,zl(n),s}function Np(e){const t=ur();if(!t||t.deviceId!==e.deviceId)return;const n=cr(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],zl(i)}async function dr(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t!=null&&t.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n==null?void 0:n.pending)?n.pending:[],paired:Array.isArray(n==null?void 0:n.paired)?n.paired:[]}}catch(n){t!=null&&t.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function pr(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t!=null&&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!=null&&t.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function Dp(e){return{method:"exec.approvals.get",params:{}}}async function Op(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Dp(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);Bp(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Bp(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=ze(t.file??{}))}async function jl(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function Tt(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Ai(e){return e instanceof Error?e.message:String(e)}async function ot(e,t){if(t!=null&&t.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=Ai(n)}finally{e.skillsLoading=!1}}}function Hl(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function ql(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 ot(e),Tt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Ai(i);e.skillsError=s,Tt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Vl(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 ot(e),Tt(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Ai(n);e.skillsError=i,Tt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Gl(e,t,n,i){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const s=await e.client.request("skills.install",{name:n,installId:i,timeoutMs:12e4});await ot(e),Tt(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const r=Ai(s);e.skillsError=r,Tt(e,t,{kind:"error",message:r})}finally{e.skillsBusyKey=null}}}const Fp=Object.freeze(Object.defineProperty({__proto__:null,installSkill:Gl,loadSkills:ot,saveSkillApiKey:Vl,updateSkillEdit:Hl,updateSkillEnabled:ql},Symbol.toStringTag,{value:"Module"})),Ql={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},Yl=new Map(Object.entries(Ql).map(([e,t])=>[t,e]));function $i(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function pn(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 Up(e,t=""){const n=$i(t),i=Ql[e];return n?`${n}${i}`:i}function Xl(e,t=""){const n=$i(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=pn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":Yl.get(s)??null}function Wp(e){let t=pn(e);if(t.endsWith("/index.html")&&(t=pn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let i=0;i<n.length;i++){const s=`/${n.slice(i).join("/")}`.toLowerCase();if(Yl.has(s)){const r=n.slice(0,i);return r.length?`/${r.join("/")}`:""}}return`/${n.join("/")}`}function Kp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function hr(e){return e==="system"?Kp():e}const In=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,zp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Rn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},jp=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var c;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const r=s.documentElement,o=s,a=zp();if(!!o.startViewTransition&&!a){let u=.5,f=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")u=In(n.pointerClientX/window.innerWidth),f=In(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const d=n.element.getBoundingClientRect();d.width>0&&d.height>0&&typeof window<"u"&&(u=In((d.left+d.width/2)/window.innerWidth),f=In((d.top+d.height/2)/window.innerHeight))}r.style.setProperty("--theme-switch-x",`${u*100}%`),r.style.setProperty("--theme-switch-y",`${f*100}%`),r.classList.add("theme-transition");try{const d=(c=o.startViewTransition)==null?void 0:c.call(o,()=>{t()});d!=null&&d.finished?d.finished.finally(()=>Rn(r)):Rn(r)}catch{Rn(r),t()}return}t(),Rn(r)},Hp=2e3;async function sn(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),r=Array.isArray(s.entries)?s.entries:[],o=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=o?r:[...e.sessionLogsEntries,...r].slice(-Hp),s.cursors&&(e.sessionLogsCursors=s.cursors),Array.isArray(s.agents)&&(e.sessionLogsAgents=s.agents),e.sessionLogsLastFetchAt=Date.now()}catch(n){e.sessionLogsError=String(n)}finally{t!=null&&t.quiet||(e.sessionLogsLoading=!1)}}}const Zl=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:sn},Symbol.toStringTag,{value:"Module"}));async function Jl(e,t){if(!(!e.client||!e.connected))try{const n={},i=await e.client.request("memory.audit",n);i!=null&&i.ok&&(e.auditEntries=i.entries??[])}catch{}}async function qp(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Re(e){return e instanceof Error?e.message:String(e)}let Nn=null;function gn(e,t){Nn&&clearTimeout(Nn),e.filesMessage={kind:"success",text:t},Nn=setTimeout(()=>{e.filesMessage=null,Nn=null},3e3)}async function mn(e,t){if(!(!e.client||!e.connected)){if(!t){e.filesTree=[],e.filesRoot="";return}if(!e.filesLoading){e.filesLoading=!0,e.filesError=null;try{const n={};t&&(n.agentId=t);const i=await e.client.request("files.tree",n);i!=null&&i.tree&&(e.filesTree=i.tree,e.filesRoot=i.root??"")}catch(n){e.filesError=Re(n)}finally{e.filesLoading=!1}}}}async function Vp(e,t,n){e.filesSelectedPaths=new Set([t]),await ec(e,t,n)}async function Gp(e,t,n){const i=new Set(e.filesSelectedPaths);if(i.has(t)?i.delete(t):i.add(t),e.filesSelectedPaths=i,i.size===1){const s=[...i][0];await ec(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Qp(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const r of n)try{await tc(e,r,t),i++}catch(o){s=Re(o)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:gn(e,`${i} file${i!==1?"s":""} downloaded`)}async function Yp(e,t,n,i){const s=t.split("/").pop()??t,r=n==="."?s:`${n}/${s}`;r!==t&&await nc(e,t,r,i)}async function ec(e,t,n){if(!(!e.client||!e.connected)){e.filesSelectedPath=t,e.filesPreviewLoading=!0,e.filesPreviewContent=null,e.filesPreviewBinary=!1,e.filesPreviewSize=null;try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.read",i);e.filesPreviewContent=(s==null?void 0:s.content)??null,e.filesPreviewBinary=(s==null?void 0:s.binary)??!1,e.filesPreviewSize=(s==null?void 0:s.size)??null}catch(i){e.filesError=Re(i)}finally{e.filesPreviewLoading=!1}}}async function tc(e,t,n){if(!(!e.client||!e.connected))try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.download",i);if(!(s!=null&&s.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const r=Uint8Array.from(atob(s.base64),c=>c.charCodeAt(0)),o=new Blob([r]),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.download=s.name??t.split("/").pop()??"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}catch(i){e.filesMessage={kind:"error",text:Re(i)}}}async function Xp(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,r="";for(const o of n)try{const a=await o.arrayBuffer(),l=btoa(new Uint8Array(a).reduce((u,f)=>u+String.fromCharCode(f),"")),c={path:t,name:o.name,data:l};i&&(c.agentId=i),await e.client.request("files.upload",c),s++}catch(a){r=Re(a)}e.filesUploadBusy=!1,r?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${r}`:r}:gn(e,`${s} file${s!==1?"s":""} uploaded`),await mn(e,i)}async function Zp(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={path:t};n&&(i.agentId=n),await e.client.request("files.delete",i),gn(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await mn(e,n)}catch(i){e.filesMessage={kind:"error",text:Re(i)}}}}async function nc(e,t,n,i){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={from:t,to:n};i&&(s.agentId=i),await e.client.request("files.move",s),gn(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await mn(e,i)}catch(s){e.filesMessage={kind:"error",text:Re(s)}}}}async function fr(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const i=await e.client.request("memory.status",n);i!=null&&i.ok&&(e.filesMemoryStatus={dirty:i.dirty??!1,files:i.files??0,chunks:i.chunks??0,model:i.model,embeddingState:i.embeddingState})}catch{}}async function Jp(e,t){if(!(!e.client||!e.connected)&&!e.filesReindexBusy){e.filesReindexBusy=!0,e.filesMessage=null;try{const n={force:!0};t&&(n.agentId=t);const i=await e.client.request("memory.reindex",n),s=(i==null?void 0:i.files)??0,r=(i==null?void 0:i.chunks)??0;gn(e,`Re-indexed: ${s} files, ${r} chunks`),await fr(e,t)}catch(n){e.filesMessage={kind:"error",text:Re(n)}}finally{e.filesReindexBusy=!1}}}function eh(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n}async function th(e,t,n){if(!(!e.client||!e.connected)){if(!t.trim()){e.filesSearchResults=null;return}e.filesSearchLoading=!0,e.filesSearchResults=null;try{const i={query:t.trim(),maxResults:20};n&&(i.agentId=n);const s=await e.client.request("memory.search",i);e.filesSearchResults=(s==null?void 0:s.results)??[]}catch(i){e.filesMessage={kind:"error",text:Re(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function nh(e){e.filesSearchQuery="",e.filesSearchResults=null}function ih(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{pr(e,{quiet:!0})},5e3))}function sh(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function gr(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&$t(e,{quiet:!0})},2e3))}function mr(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function yr(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||sn(e,{quiet:!0})},2e3))}function vr(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function br(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&rr(e)},3e3))}function wr(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function rh(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{Jl(e)},3e4))}function oh(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function ah(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{e.tab==="files"&&fr(e)},1e4))}function lh(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function We(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,cd(n),t.theme!==e.theme&&(e.theme=t.theme,xi(e,hr(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function ic(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&We(e,{...e.settings,lastActiveSessionKey:n})}function ch(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),r=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&We(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(i!=null){const l=i.trim();l&&(e.password=l),t.delete("password"),o=!0}if(s!=null){const l=s.trim();l&&(e.sessionKey=l,We(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(r!=null){const l=r.trim();l&&l!==e.settings.gatewayUrl&&We(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),o=!0}if(!o)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function uh(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?yr(e):gr(e):(mr(e),vr(e)),t==="debug"?br(e):wr(e),si(e),rc(e,t,!1)}function dh(e,t,n){jp({nextTheme:t,applyTheme:()=>{e.theme=t,We(e,{...e.settings,theme:t}),xi(e,hr(t))},context:n,currentTheme:e.theme})}async function si(e){if(e.tab==="overview"&&await oc(e),e.tab==="channels"&&await vh(e),e.tab==="instances"&&await jl(e),e.tab==="cron"&&await kr(e),e.tab==="skills"&&await ot(e),e.tab==="nodes"&&(await pr(e),await dr(e),await Te(e),await Op(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await Ah(e),hn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await Sl(e),await Te(e)),e.tab==="debug"&&(await rr(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await ne(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>Zl);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await $t(e,{reset:!0});wl(e,!0)}}function ph(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?$i(e):Wp(window.location.pathname)}function hh(e){e.theme=e.settings.theme??"system",xi(e,hr(e.theme))}function xi(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function fh(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"&&xi(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function gh(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 mh(e,t){if(typeof window>"u")return;const n=Xl(window.location.pathname,e.basePath)??"chat";sc(e,n),rc(e,n,t)}function yh(e){var s;if(typeof window>"u")return;const t=Xl(window.location.pathname,e.basePath);if(!t)return;const i=(s=new URL(window.location.href).searchParams.get("session"))==null?void 0:s.trim();i&&(e.sessionKey=i,We(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),sc(e,t)}function sc(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?yr(e):gr(e):(mr(e),vr(e)),t==="debug"?br(e):wr(e),e.connected&&si(e)}function rc(e,t,n){if(typeof window>"u")return;const i=pn(Up(t,e.basePath)),s=pn(window.location.pathname),r=new URL(window.location.href);t==="chat"&&e.sessionKey?r.searchParams.set("session",e.sessionKey):r.searchParams.delete("session"),s!==i&&(r.pathname=i),n?window.history.replaceState({},"",r.toString()):window.history.pushState({},"",r.toString())}async function oc(e){await Promise.all([q(e,!1),jl(e),nr(e),fn(e),rr(e)])}async function vh(e){await Promise.all([q(e,!0),Sl(e),Te(e)])}async function kr(e){await Promise.all([q(e,!1),fn(e),ki(e)])}function ac(e){return e.chatSending||!!e.chatRunId}function bh(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 lc(e){e.connected&&(e.chatMessage="",await vl(e))}function wh(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:tr(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(r=>({...r})):void 0}],hn(e))}async function cc(e,t,n){var s,r;ir(e);const i=await yl(e,t,n==null?void 0:n.attachments);return!i&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!i&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),i&&ic(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((r=n.previousAttachments)!=null&&r.length)&&(e.chatAttachments=n.previousAttachments),hn(e),i&&!e.chatRunId&&uc(e),i}async function uc(e){if(!e.connected||ac(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await cc(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function kh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Sh(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),r=e.chatAttachments??[],o=t==null?r:[],a=o.length>0;if(!(!s&&!a)){if(bh(s)){await lc(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),ac(e)){wh(e,s,o);return}await cc(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?o:void 0,previousAttachments:t==null?r:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function Ah(e){await Promise.all([Ee(e),nr(e),Ls(e)]),hn(e,!0)}const $h=uc;function xh(e){var s,r,o;const t=cl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((o=(r=n==null?void 0:n.sessionDefaults)==null?void 0:r.defaultAgentId)==null?void 0:o.trim())||"main"}function Eh(e,t){const n=$i(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function Ls(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=xh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Eh(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),r=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=r||null}catch{e.chatAvatarUrl=null}}const D={messageSquare:h`<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:h`<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:h`<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:h`<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:h`<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:h`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:h`<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:h`<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:h`<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:h`<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:h`<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>`,users:h`<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>`,menu:h`<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:h`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:h`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:h`<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:h`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:h`<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:h`<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:h`<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>`,rotateCw:h`<svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,download:h`<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,wrench:h`<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:h`<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:h`<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:h`<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:h`<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:h`<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>`,image:h`<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:h`<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>`,plug:h`<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:h`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:h`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:h`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`,puzzle:h`<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>`,info:h`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>`,send:h`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:h`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>`,slidersHorizontal:h`<svg viewBox="0 0 24 24"><line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/></svg>`,square:h`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:h`<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:h`<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>`,trash:h`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,chevronDown:h`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:h`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`},Th="Taskmaster",Ch="/taskmaster-icon.png",dc="#00d4ff";let Dn=null;function Ie(){return Dn||(Dn={name:window.__TASKMASTER_BRAND_NAME__||Th,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||Ch,accentColor:window.__TASKMASTER_ACCENT_COLOR__||dc},Dn)}function _h(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);return t?`${parseInt(t[1],16)}, ${parseInt(t[2],16)}, ${parseInt(t[3],16)}`:null}function Mh(e){if(e===dc)return;const t=_h(e);if(!t)return;const n=document.documentElement;n.style.setProperty("--accent",e),n.style.setProperty("--accent-hover",e),n.style.setProperty("--accent-muted",e),n.style.setProperty("--primary",e),n.style.setProperty("--ring",e),n.style.setProperty("--accent-subtle",`rgba(${t}, 0.15)`),n.style.setProperty("--accent-glow",`rgba(${t}, 0.25)`),n.style.setProperty("--tasker-orange",e),n.style.setProperty("--tasker-orange-hover",e),n.style.setProperty("--tasker-orange-glow",`rgba(${t}, 0.25)`)}const Ph=h`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><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>`,Lh=h`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>`;let Ro=!1;function Ih(){Ro||(Ro=!0,document.addEventListener("click",e=>{const t=document.getElementById("nav-burger-toggle");if(!(t!=null&&t.checked))return;const n=t.closest(".setup-header");n!=null&&n.contains(e.target)||(t.checked=!1)}))}function ut(e,t){const n=(u,f)=>u===e?h`<span class="sp-page-nav-current">${u}</span>`:h`<a href=${f}>${u}</a>`,i=h`
|
|
21
21
|
${n("Setup","/setup")}
|
|
22
22
|
${n("Chat","/chat")}
|
|
23
23
|
${n("Admins","/admins")}
|
|
@@ -25,10 +25,10 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
25
25
|
${n("Files","/files")}
|
|
26
26
|
${n("Browser","/browser")}
|
|
27
27
|
${n("Advanced","/advanced")}
|
|
28
|
-
`,r=t&&(t.isMaster!==!1||!t.hasPins)?
|
|
29
|
-
${
|
|
28
|
+
`,r=t&&(t.isMaster!==!1||!t.hasPins)?Rh(t):k,o=t!=null&&t.hasPins&&t.onLogout?h`<button class="nav-logout-btn" @click=${t.onLogout} title="Lock">${Ph}</button>`:k,a=(t==null?void 0:t.auditCount)??0,l=a>0&&(t!=null&&t.onAuditClick)?h`<button class="nav-audit-btn" @click=${t.onAuditClick} title="Memory writes to review">
|
|
29
|
+
${Lh}
|
|
30
30
|
<span class="nav-audit-badge">${a>99?"99+":a}</span>
|
|
31
|
-
</button>`:k,c=()=>{const u=document.getElementById("nav-burger-toggle");u&&(u.checked=!1)};return
|
|
31
|
+
</button>`:k,c=()=>{const u=document.getElementById("nav-burger-toggle");u&&(u.checked=!1)};return Ih(),h`
|
|
32
32
|
<div class="setup-header">
|
|
33
33
|
<input type="checkbox" id="nav-burger-toggle" class="nav-burger-checkbox" />
|
|
34
34
|
<div class="setup-header-inner">
|
|
@@ -37,7 +37,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
37
37
|
${i}
|
|
38
38
|
</nav>
|
|
39
39
|
<div class="setup-header-right">
|
|
40
|
-
${r!==k?
|
|
40
|
+
${r!==k?h`<span class="nav-selector-inline">${r}</span>`:k}
|
|
41
41
|
${l}
|
|
42
42
|
${o}
|
|
43
43
|
<label for="nav-burger-toggle" class="nav-burger-button" aria-label="Toggle menu">
|
|
@@ -46,17 +46,17 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
<nav class="setup-header-dropdown" @click=${c}>
|
|
49
|
-
${r!==k?
|
|
49
|
+
${r!==k?h`<div class="nav-selector-mobile">${r}</div>`:k}
|
|
50
50
|
${i}
|
|
51
51
|
</nav>
|
|
52
52
|
</div>
|
|
53
|
-
`}function
|
|
53
|
+
`}function Rh(e){const{workspaces:t,selectedWorkspace:n,onWorkspaceSelect:i}=e;return h`
|
|
54
54
|
<select
|
|
55
55
|
class="sp-workspace-selector"
|
|
56
56
|
.value=${n??""}
|
|
57
57
|
@change=${r=>{const o=r.target,a=o.value;if(a==="__add__"){o.value=n??"",e.onAddAccount?e.onAddAccount():window.location.href="/setup";return}i(a)}}
|
|
58
58
|
>
|
|
59
|
-
${t.map(r=>
|
|
59
|
+
${t.map(r=>h`
|
|
60
60
|
<option value=${r.name} ?selected=${r.name===n}>
|
|
61
61
|
${r.displayName??r.name}
|
|
62
62
|
</option>
|
|
@@ -64,7 +64,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
64
64
|
<option disabled>───</option>
|
|
65
65
|
<option value="__add__">+ Add Account</option>
|
|
66
66
|
</select>
|
|
67
|
-
`}function
|
|
67
|
+
`}function Nh(e){return e.connected?e.fullscreen&&e.active?h`
|
|
68
68
|
<div class="sp-fullscreen-overlay">
|
|
69
69
|
<div class="sp-fullscreen-toolbar">
|
|
70
70
|
<button
|
|
@@ -104,7 +104,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
104
104
|
></canvas>
|
|
105
105
|
</div>
|
|
106
106
|
</div>
|
|
107
|
-
`:
|
|
107
|
+
`:h`
|
|
108
108
|
<div class="setup-container">
|
|
109
109
|
${ut("Browser")}
|
|
110
110
|
<div class="setup-card sp-card-wide">
|
|
@@ -112,7 +112,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
112
112
|
<p style="margin-bottom: 16px;">Live view of the headless Chrome instance.</p>
|
|
113
113
|
|
|
114
114
|
<div class="sp-toolbar">
|
|
115
|
-
${e.active?
|
|
115
|
+
${e.active?h`
|
|
116
116
|
<button
|
|
117
117
|
class="setup-button ${e.inputMode?"primary":"secondary"}"
|
|
118
118
|
style="padding: 10px 20px; font-size: 14px;"
|
|
@@ -135,7 +135,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
135
135
|
>
|
|
136
136
|
Stop
|
|
137
137
|
</button>
|
|
138
|
-
`:
|
|
138
|
+
`:h`
|
|
139
139
|
<button
|
|
140
140
|
class="setup-button primary"
|
|
141
141
|
style="padding: 10px 20px; font-size: 14px;"
|
|
@@ -147,9 +147,9 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
147
147
|
`}
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
|
-
${e.error?
|
|
150
|
+
${e.error?h`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:k}
|
|
151
151
|
|
|
152
|
-
${e.handoffPending?
|
|
152
|
+
${e.handoffPending?h`
|
|
153
153
|
<div class="setup-warning" style="margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;">
|
|
154
154
|
<div>
|
|
155
155
|
<strong>Action required:</strong> ${e.handoffReason??"The agent needs you to complete an action in the browser."}
|
|
@@ -161,7 +161,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
161
161
|
`:k}
|
|
162
162
|
|
|
163
163
|
<div class="sp-canvas-area" style="margin-top: 16px;">
|
|
164
|
-
${e.active?
|
|
164
|
+
${e.active?h`
|
|
165
165
|
<div class="sp-canvas-wrap ${e.inputMode?"sp-input-active":""}">
|
|
166
166
|
<canvas
|
|
167
167
|
id="browser-screencast-canvas"
|
|
@@ -175,7 +175,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
175
175
|
@contextmenu=${t=>t.preventDefault()}
|
|
176
176
|
></canvas>
|
|
177
177
|
</div>
|
|
178
|
-
`:
|
|
178
|
+
`:h`
|
|
179
179
|
<div class="sp-canvas-placeholder">
|
|
180
180
|
<div class="sp-canvas-placeholder-icon">${D.globe}</div>
|
|
181
181
|
<p>Click Start to begin streaming the Chrome viewport.</p>
|
|
@@ -183,34 +183,34 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
183
183
|
`}
|
|
184
184
|
</div>
|
|
185
185
|
|
|
186
|
-
${e.active&&e.inputMode?
|
|
186
|
+
${e.active&&e.inputMode?h`<p class="setup-hint" style="margin-top: 12px;">
|
|
187
187
|
Click the canvas to focus, then interact with the browser. Mouse and keyboard input are forwarded.
|
|
188
188
|
</p>`:k}
|
|
189
189
|
|
|
190
190
|
</div>
|
|
191
191
|
</div>
|
|
192
|
-
`:
|
|
192
|
+
`:h`
|
|
193
193
|
<div class="setup-container">
|
|
194
194
|
<div class="setup-card">
|
|
195
195
|
<div class="setup-spinner"></div>
|
|
196
196
|
<p>Connecting to gateway...</p>
|
|
197
197
|
</div>
|
|
198
198
|
</div>
|
|
199
|
-
`}const ri="application/x-taskmaster-file-path";function Sr(e){return e==null?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function
|
|
199
|
+
`}const ri="application/x-taskmaster-file-path";function Sr(e){return e==null?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function pc(e){const t=e.split("/");return t.length>1?t.slice(0,-1).join("/"):"."}function Dh(e,t,n){var r,o;e.preventDefault(),e.stopPropagation(),e.currentTarget.classList.remove("sp-drop-target");const i=(r=e.dataTransfer)==null?void 0:r.getData(ri);if(i){pc(i)!==t&&n.onMoveToDir(i,t);return}const s=(o=e.dataTransfer)==null?void 0:o.files;if(s&&s.length>0){const a=Array.from(s).filter(l=>l.name.toLowerCase().endsWith(".md"));a.length>0&&n.onUpload(t,a)}}function hc(e,t,n){const i=e.type==="directory"||e.type==="symlink"&&e.children!=null,s=t.expandedDirs.has(e.path),r=t.selectedPaths.has(e.path),o=n*20+12;return i?h`
|
|
200
200
|
<div
|
|
201
201
|
class="sp-tree-item sp-tree-dir ${s?"expanded":""}"
|
|
202
202
|
style="padding-left: ${o}px;"
|
|
203
203
|
@click=${()=>t.onToggleDir(e.path)}
|
|
204
204
|
@dragover=${a=>{a.preventDefault(),a.stopPropagation(),a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.currentTarget.classList.add("sp-drop-target")}}
|
|
205
205
|
@dragleave=${a=>{a.currentTarget.classList.remove("sp-drop-target")}}
|
|
206
|
-
@drop=${a=>
|
|
206
|
+
@drop=${a=>Dh(a,e.path,t)}
|
|
207
207
|
>
|
|
208
208
|
<span class="sp-tree-chevron">${s?"−":"+"}</span>
|
|
209
209
|
<span class="sp-tree-icon">${D.folder}</span>
|
|
210
210
|
<span class="sp-tree-name">${e.name}</span>
|
|
211
211
|
</div>
|
|
212
|
-
${s&&e.children?e.children.map(a=>
|
|
213
|
-
`:
|
|
212
|
+
${s&&e.children?e.children.map(a=>hc(a,t,n+1)):k}
|
|
213
|
+
`:h`
|
|
214
214
|
<div
|
|
215
215
|
class="sp-tree-item sp-tree-file ${r?"selected":""}"
|
|
216
216
|
style="padding-left: ${o}px;"
|
|
@@ -222,7 +222,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
222
222
|
<span class="sp-tree-name">${e.name}</span>
|
|
223
223
|
<span class="sp-tree-size">${Sr(e.size)}</span>
|
|
224
224
|
</div>
|
|
225
|
-
`}function
|
|
225
|
+
`}function Oh(e){const t=e.selectedPaths.size;return t<2?k:h`
|
|
226
226
|
<div class="sp-bulk-actions">
|
|
227
227
|
<span style="color: var(--tasker-muted-grey); font-size: 13px;">${t} files selected</span>
|
|
228
228
|
<button
|
|
@@ -233,11 +233,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
233
233
|
Download ${t} files
|
|
234
234
|
</button>
|
|
235
235
|
</div>
|
|
236
|
-
`}function
|
|
236
|
+
`}function Bh(e){if(e.selectedPaths.size!==1||!e.selectedPath)return k;if(e.previewLoading)return h`
|
|
237
237
|
<div class="sp-file-preview">
|
|
238
238
|
<div class="setup-spinner" style="width: 32px; height: 32px; margin: 24px auto;"></div>
|
|
239
239
|
</div>
|
|
240
|
-
`;const t=e.selectedPath.split("/").pop()??e.selectedPath;return
|
|
240
|
+
`;const t=e.selectedPath.split("/").pop()??e.selectedPath;return h`
|
|
241
241
|
<div class="sp-file-preview">
|
|
242
242
|
<div class="sp-file-preview-header">
|
|
243
243
|
<div>
|
|
@@ -258,9 +258,9 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
258
258
|
</button>
|
|
259
259
|
</div>
|
|
260
260
|
</div>
|
|
261
|
-
${e.previewBinary?
|
|
261
|
+
${e.previewBinary?h`<div class="sp-file-preview-body"><p style="color: var(--tasker-muted-grey);">Binary file — use Download to view.</p></div>`:e.previewContent!=null?h`<div class="sp-file-preview-body"><pre class="sp-file-code">${e.previewContent}</pre></div>`:h`<div class="sp-file-preview-body"><p style="color: var(--tasker-muted-grey);">File too large for preview — use Download.</p></div>`}
|
|
262
262
|
</div>
|
|
263
|
-
`}function
|
|
263
|
+
`}function Fh(e){if(!e.selectedPath)return".";if(e.expandedDirs.has(e.selectedPath))return e.selectedPath;const t=e.selectedPath.split("/");return t.length>1?t.slice(0,-1).join("/"):"."}function fc(e){let t=0,n=0;for(const i of e)if(i.children){const s=fc(i.children);t+=s.count,n+=s.bytes}else t++,n+=i.size??0;return{count:t,bytes:n}}function Uh(e){return h`
|
|
264
264
|
<div class="sp-search-bar">
|
|
265
265
|
<input
|
|
266
266
|
type="text"
|
|
@@ -270,11 +270,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
270
270
|
@input=${t=>e.onSearchQueryChange(t.target.value)}
|
|
271
271
|
@keydown=${t=>{t.key==="Enter"&&e.onSearch(e.searchQuery)}}
|
|
272
272
|
/>
|
|
273
|
-
${e.agentIds.length>1?
|
|
273
|
+
${e.agentIds.length>1?h`<select
|
|
274
274
|
class="sp-search-agent-select"
|
|
275
275
|
@change=${t=>e.onSearchAgentChange(t.target.value)}
|
|
276
276
|
>
|
|
277
|
-
${e.agentIds.map(t=>
|
|
277
|
+
${e.agentIds.map(t=>h`<option value=${t} ?selected=${t===e.searchAgentId}>${t}</option>`)}
|
|
278
278
|
</select>`:k}
|
|
279
279
|
<button
|
|
280
280
|
class="setup-button secondary"
|
|
@@ -284,7 +284,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
284
284
|
>
|
|
285
285
|
${e.searchLoading?"Searching...":"Search"}
|
|
286
286
|
</button>
|
|
287
|
-
${e.searchResults!==null?
|
|
287
|
+
${e.searchResults!==null?h`<button
|
|
288
288
|
class="setup-button secondary"
|
|
289
289
|
style="padding: 8px 16px; font-size: 13px;"
|
|
290
290
|
@click=${e.onSearchClear}
|
|
@@ -292,11 +292,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
292
292
|
Clear
|
|
293
293
|
</button>`:k}
|
|
294
294
|
</div>
|
|
295
|
-
`}function
|
|
295
|
+
`}function Wh(e){return e.searchResults?e.searchResults.length===0?h`<div class="sp-search-results">
|
|
296
296
|
<div style="padding: 24px; color: var(--tasker-muted-grey); text-align: center;">No results found.</div>
|
|
297
|
-
</div>`:
|
|
297
|
+
</div>`:h`
|
|
298
298
|
<div class="sp-search-results">
|
|
299
|
-
${e.searchResults.map(t=>
|
|
299
|
+
${e.searchResults.map(t=>h`
|
|
300
300
|
<div
|
|
301
301
|
class="sp-search-result ${e.selectedPath===t.path?"selected":""}"
|
|
302
302
|
@click=${()=>e.onSelectFile(t.path)}
|
|
@@ -312,7 +312,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
312
312
|
</div>
|
|
313
313
|
`)}
|
|
314
314
|
</div>
|
|
315
|
-
`:k}function
|
|
315
|
+
`:k}function Kh(e){const t=Fh(e);return e.connected?h`
|
|
316
316
|
<div class="setup-container">
|
|
317
317
|
${ut("Files",e.wsProps)}
|
|
318
318
|
<div class="setup-card sp-card-wide">
|
|
@@ -346,50 +346,56 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
346
346
|
>
|
|
347
347
|
${e.reindexBusy?"Re-indexing...":"Re-index"}
|
|
348
348
|
</button>
|
|
349
|
-
${e.memoryStatus?
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
349
|
+
${e.memoryStatus?e.memoryStatus.embeddingState==="downloading"?h`<span style="display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tasker-orange, #f59e0b);">
|
|
350
|
+
<span
|
|
351
|
+
class="setup-status-light"
|
|
352
|
+
style="width: 10px; height: 10px; background: #f59e0b"
|
|
353
|
+
></span>
|
|
354
|
+
Downloading embedding model\u2026
|
|
355
|
+
</span>`:h`<span style="display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tasker-text-grey);">
|
|
356
|
+
<span
|
|
357
|
+
class="setup-status-light"
|
|
358
|
+
style="width: 10px; height: 10px; background: ${e.memoryStatus.dirty?"#ef4444":"#22c55e"}"
|
|
359
|
+
></span>
|
|
360
|
+
${(()=>{var a;const n=fc(e.tree),i=`${n.count} file${n.count!==1?"s":""}, ${Sr(n.bytes)}`,s=(a=e.memoryStatus)==null?void 0:a.model;if(!s)return i;const o=(s.includes("/")?s.split("/").pop():s).replace(/[-_]Q\d.*$/i,"").replace(/\.gguf$/i,"");return`${i} · ${o}`})()}
|
|
361
|
+
</span>`:k}
|
|
362
|
+
</div>
|
|
363
|
+
|
|
364
|
+
${e.error?h`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:k}
|
|
365
|
+
|
|
366
|
+
${e.message?h`<div class="${e.message.kind==="error"?"setup-error":"setup-success-message"}" style="margin-top: 12px;">
|
|
361
367
|
${e.message.text}
|
|
362
368
|
</div>`:k}
|
|
363
369
|
|
|
364
|
-
${e.uploadBusy?
|
|
370
|
+
${e.uploadBusy?h`<div style="margin-top: 12px; color: var(--tasker-orange); font-weight: 600; font-size: 14px;">Uploading...</div>`:k}
|
|
365
371
|
|
|
366
|
-
${
|
|
372
|
+
${Uh(e)}
|
|
367
373
|
|
|
368
|
-
${e.searchResults!==null?
|
|
374
|
+
${e.searchResults!==null?Wh(e):h`<div
|
|
369
375
|
class="sp-file-tree"
|
|
370
376
|
@dragover=${n=>{n.preventDefault(),n.dataTransfer&&(n.dataTransfer.dropEffect=n.dataTransfer.types.includes(ri)?"move":"copy")}}
|
|
371
|
-
@drop=${n=>{var r,o;n.preventDefault();const i=(r=n.dataTransfer)==null?void 0:r.getData(ri);if(i){
|
|
377
|
+
@drop=${n=>{var r,o;n.preventDefault();const i=(r=n.dataTransfer)==null?void 0:r.getData(ri);if(i){pc(i)!=="."&&e.onMoveToDir(i,".");return}const s=(o=n.dataTransfer)==null?void 0:o.files;if(s&&s.length>0){const a=Array.from(s).filter(l=>l.name.toLowerCase().endsWith(".md"));a.length>0&&e.onUpload(t,a)}}}
|
|
372
378
|
>
|
|
373
|
-
${e.tree.length===0&&!e.loading?
|
|
379
|
+
${e.tree.length===0&&!e.loading?h`<div style="padding: 24px; color: var(--tasker-muted-grey); text-align: center;">No files found. Drop .md files here to upload.</div>`:e.tree.map(n=>hc(n,e,0))}
|
|
374
380
|
</div>`}
|
|
375
381
|
|
|
376
|
-
${Dh(e)}
|
|
377
382
|
${Oh(e)}
|
|
383
|
+
${Bh(e)}
|
|
378
384
|
</div>
|
|
379
385
|
</div>
|
|
380
|
-
`:
|
|
386
|
+
`:h`
|
|
381
387
|
<div class="setup-container">
|
|
382
388
|
<div class="setup-card">
|
|
383
389
|
<div class="setup-spinner"></div>
|
|
384
390
|
<p>Connecting to gateway...</p>
|
|
385
391
|
</div>
|
|
386
392
|
</div>
|
|
387
|
-
`}const Ar="taskmaster_uninstall_done";async function
|
|
393
|
+
`}const Ar="taskmaster_uninstall_done";async function zh(e){var t,n;if(!(!e.client||!e.connected)&&!e.uninstallBusy){e.uninstallBusy=!0,e.uninstallError=null,(t=e.requestUpdate)==null||t.call(e),jh();try{await e.client.request("system.uninstall",{scopes:["service","state","workspace"],purge:!0})}catch{}e.uninstallBusy=!1,e.uninstallDone=!0,(n=e.requestUpdate)==null||n.call(e)}}function oi(){try{return localStorage.getItem(Ar)==="1"}catch{return!1}}function $r(){try{localStorage.removeItem(Ar)}catch{}}function jh(){try{localStorage.setItem(Ar,"1")}catch{}}const No=Object.freeze(Object.defineProperty({__proto__:null,checkUninstallDone:oi,clearUninstallDone:$r,runUninstall:zh},Symbol.toStringTag,{value:"Module"}));function pe(e){return h`
|
|
388
394
|
<span
|
|
389
395
|
class="setup-status-light"
|
|
390
396
|
style="background: ${{good:"#22c55e",bad:"#ef4444",partial:"#eab308",unknown:"#6b7280"}[e]}"
|
|
391
397
|
></span>
|
|
392
|
-
`}function Pt(e,t){return
|
|
398
|
+
`}function Pt(e,t){return h`
|
|
393
399
|
<button
|
|
394
400
|
class="setup-info-btn"
|
|
395
401
|
@click=${()=>t.onInfoModalOpen(e)}
|
|
@@ -397,11 +403,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
397
403
|
>
|
|
398
404
|
${D.info}
|
|
399
405
|
</button>
|
|
400
|
-
`}function
|
|
406
|
+
`}function Hh(e){var i;if(!e.infoModalOpen)return k;let t="",n=[];switch(e.infoModalOpen){case"gateway":{const s=typeof window<"u"?window.location.host:"unknown";t="Gateway",n=[{label:"Status",value:e.gatewayHealthy===!1?"Stopped":"Running"},{label:"Address",value:s},{label:"Health",value:e.gatewayHealthMessage||"OK"}];break}case"claude":{const s=e.authExpiresIn;let r="N/A";if(s!=null&&s>0)if(s>60){const o=Math.floor(s/60),a=s%60;r=a>0?`${o}h ${a}m`:`${o}h`}else r=`${s}m`;t="Claude",n=[{label:"Connected",value:e.authConnected?"Yes":"No"},{label:"Token Expiry",value:r},{label:"Renewal",value:"Automatic (tokens refresh on expiry)"},...e.authMessage?[{label:"Message",value:e.authMessage}]:[]];break}case"license":{const s=e.licenseStoredKey?`…${e.licenseStoredKey.slice(-12)}`:"N/A";t="License",n=[{label:"Status",value:e.licenseValid?"Active":"Inactive"},{label:"Key",value:s},{label:"Tier",value:e.licenseTier||"Standard"},{label:"Device ID",value:e.licenseDeviceId||"N/A"}];break}case"whatsapp":{const s=Lt(e),r=s?xr(s,e):null;t="WhatsApp",n=[{label:"Account",value:(r==null?void 0:r.name)||(r==null?void 0:r.accountId)||"Default"},{label:"Phone",value:((i=r==null?void 0:r.self)==null?void 0:i.e164)||"Not paired"},{label:"Connected",value:r!=null&&r.connected?"Yes":"No"},{label:"Linked",value:r!=null&&r.linked?"Yes":"No"},...r!=null&&r.lastError?[{label:"Last Error",value:r.lastError}]:[]];break}case"imessage":{const{thisWsOwns:s}=Er(e);t="iMessage",n=[{label:"Connected",value:s&&e.imessageConnected?"Yes":"No"},{label:"Assigned To",value:e.imessageOwnerWorkspace??"Not assigned"},{label:"Mode",value:"Self-chat only"},...e.imessageLastError?[{label:"Last Error",value:e.imessageLastError}]:[]];break}case"update":{t="Software Update",n=[{label:"Current",value:e.currentVersion?`v${e.currentVersion}`:"Unknown"},{label:"Latest",value:e.latestVersion?`v${e.latestVersion}`:"Unknown"},{label:"Status",value:e.updateAvailable===null?"Not checked":e.updateAvailable?"Update available":"Up to date"},...e.updateMessage?[{label:"Message",value:e.updateMessage}]:[]];break}default:return k}return h`
|
|
401
407
|
<div class="setup-info-overlay" @click=${s=>{s.target.classList.contains("setup-info-overlay")&&e.onInfoModalClose()}}>
|
|
402
408
|
<div class="setup-info-card">
|
|
403
409
|
<h3>${t}</h3>
|
|
404
|
-
${n.map(s=>
|
|
410
|
+
${n.map(s=>h`
|
|
405
411
|
<div class="setup-info-row">
|
|
406
412
|
<span class="setup-info-label">${s.label}</span>
|
|
407
413
|
<span class="setup-info-value">${s.value}</span>
|
|
@@ -416,9 +422,9 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
416
422
|
</button>
|
|
417
423
|
</div>
|
|
418
424
|
</div>
|
|
419
|
-
`}function ye(e){const t=[{id:"license",label:"1. Activate License"},{id:"auth",label:"2. Connect Claude"},{id:"whatsapp",label:"3. Link WhatsApp"}],n=["license","auth","whatsapp","complete"],i=n.indexOf(e);return
|
|
425
|
+
`}function ye(e){const t=[{id:"license",label:"1. Activate License"},{id:"auth",label:"2. Connect Claude"},{id:"whatsapp",label:"3. Link WhatsApp"}],n=["license","auth","whatsapp","complete"],i=n.indexOf(e);return h`
|
|
420
426
|
<div class="setup-steps">
|
|
421
|
-
${t.map(s=>{const r=n.indexOf(s.id),o=e===s.id,a=i>r;return
|
|
427
|
+
${t.map(s=>{const r=n.indexOf(s.id),o=e===s.id,a=i>r;return h`
|
|
422
428
|
<div
|
|
423
429
|
class="setup-step ${o?"active":""} ${a?"completed":""}"
|
|
424
430
|
>
|
|
@@ -427,7 +433,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
427
433
|
</div>
|
|
428
434
|
`})}
|
|
429
435
|
</div>
|
|
430
|
-
`}function Do(e){const{licenseKey:t,licenseBusy:n,licenseValid:i,licenseMessage:s,licenseDeviceId:r,onLicenseKeyChange:o,onLicenseActivate:a}=e;return i===!0?
|
|
436
|
+
`}function Do(e){const{licenseKey:t,licenseBusy:n,licenseValid:i,licenseMessage:s,licenseDeviceId:r,onLicenseKeyChange:o,onLicenseActivate:a}=e;return i===!0?h`
|
|
431
437
|
<div class="setup-container">
|
|
432
438
|
<div class="setup-card setup-success">
|
|
433
439
|
${ye("license")}
|
|
@@ -438,7 +444,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
438
444
|
<p>${s??"Your license is active."}</p>
|
|
439
445
|
</div>
|
|
440
446
|
</div>
|
|
441
|
-
`:n&&!t?
|
|
447
|
+
`:n&&!t?h`
|
|
442
448
|
<div class="setup-container">
|
|
443
449
|
<div class="setup-card">
|
|
444
450
|
${ye("license")}
|
|
@@ -446,13 +452,13 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
446
452
|
<p>Checking license...</p>
|
|
447
453
|
</div>
|
|
448
454
|
</div>
|
|
449
|
-
`:
|
|
455
|
+
`:h`
|
|
450
456
|
<div class="setup-container">
|
|
451
457
|
<div class="setup-card">
|
|
452
458
|
${ye("license")}
|
|
453
459
|
<h1>Activate License</h1>
|
|
454
460
|
<p>Enter your license key to get started.</p>
|
|
455
|
-
${r?
|
|
461
|
+
${r?h`
|
|
456
462
|
<div class="setup-device-id">
|
|
457
463
|
<span class="setup-device-id-label">Your Device ID</span>
|
|
458
464
|
<code class="setup-device-id-value">${r}</code>
|
|
@@ -482,7 +488,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
482
488
|
${n?"Activating...":"Activate"}
|
|
483
489
|
</button>
|
|
484
490
|
</div>
|
|
485
|
-
${i===!1&&s?
|
|
491
|
+
${i===!1&&s?h`
|
|
486
492
|
<div class="setup-status-row" style="margin-top: 12px;">
|
|
487
493
|
${pe("bad")}
|
|
488
494
|
<span class="setup-error">${s}</span>
|
|
@@ -496,7 +502,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
496
502
|
</p>
|
|
497
503
|
</div>
|
|
498
504
|
</div>
|
|
499
|
-
`}function
|
|
505
|
+
`}function qh(e){const{authConnected:t,authBusy:n,authMessage:i,authUrl:s,authCodeInput:r,authExpiresIn:o,onStartAuth:a,onSubmitAuthCode:l,onAuthCodeChange:c,onSkipToWhatsApp:u}=e;return t===!0?h`
|
|
500
506
|
<div class="setup-container">
|
|
501
507
|
<div class="setup-card setup-success">
|
|
502
508
|
${ye("auth")}
|
|
@@ -506,7 +512,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
506
512
|
</div>
|
|
507
513
|
<p>
|
|
508
514
|
Your Claude Pro subscription is linked.
|
|
509
|
-
${o?
|
|
515
|
+
${o?h`<br /><span class="setup-hint"
|
|
510
516
|
>Expires in ${o} minutes</span
|
|
511
517
|
>`:k}
|
|
512
518
|
</p>
|
|
@@ -518,7 +524,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
518
524
|
</a>
|
|
519
525
|
</div>
|
|
520
526
|
</div>
|
|
521
|
-
`:n&&!s?
|
|
527
|
+
`:n&&!s?h`
|
|
522
528
|
<div class="setup-container">
|
|
523
529
|
<div class="setup-card">
|
|
524
530
|
${ye("auth")}
|
|
@@ -526,7 +532,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
526
532
|
<p>Starting Claude connection...</p>
|
|
527
533
|
</div>
|
|
528
534
|
</div>
|
|
529
|
-
`:s?
|
|
535
|
+
`:s?h`
|
|
530
536
|
<div class="setup-container">
|
|
531
537
|
<div class="setup-card">
|
|
532
538
|
${ye("auth")}
|
|
@@ -559,7 +565,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
559
565
|
${n?"Verifying...":"Submit"}
|
|
560
566
|
</button>
|
|
561
567
|
</div>
|
|
562
|
-
${i?
|
|
568
|
+
${i?h`<p class="setup-hint">${i}</p>`:k}
|
|
563
569
|
<p class="setup-hint" style="margin-top: 16px;">
|
|
564
570
|
<a href="#" class="setup-link" @click=${f=>{f.preventDefault(),e.onAuthApiKeyToggle()}}>
|
|
565
571
|
Or use an API key instead
|
|
@@ -567,7 +573,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
567
573
|
</p>
|
|
568
574
|
</div>
|
|
569
575
|
</div>
|
|
570
|
-
`:e.authApiKeyMode?
|
|
576
|
+
`:e.authApiKeyMode?h`
|
|
571
577
|
<div class="setup-container">
|
|
572
578
|
<div class="setup-card">
|
|
573
579
|
${ye("auth")}
|
|
@@ -589,7 +595,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
589
595
|
@click=${()=>e.onAuthApiKeySubmit()}
|
|
590
596
|
>${e.authApiKeyBusy?"Saving...":"Save"}</button>
|
|
591
597
|
</div>
|
|
592
|
-
${e.authApiKeyError?
|
|
598
|
+
${e.authApiKeyError?h`<p class="setup-error">${e.authApiKeyError}</p>`:k}
|
|
593
599
|
<p class="setup-hint" style="margin-top: 16px;">
|
|
594
600
|
<a href="#" class="setup-link" @click=${f=>{f.preventDefault(),e.onAuthApiKeyToggle()}}>
|
|
595
601
|
Use OAuth instead
|
|
@@ -603,12 +609,12 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
603
609
|
</p>
|
|
604
610
|
</div>
|
|
605
611
|
</div>
|
|
606
|
-
`:
|
|
612
|
+
`:h`
|
|
607
613
|
<div class="setup-container">
|
|
608
614
|
<div class="setup-card">
|
|
609
615
|
${ye("auth")}
|
|
610
616
|
<h1>Connect to Claude</h1>
|
|
611
|
-
${t===!1&&i?
|
|
617
|
+
${t===!1&&i?h`<p class="setup-error">${i}</p>`:h`<p>
|
|
612
618
|
First, let's connect your Claude Pro subscription.<br />
|
|
613
619
|
This powers your AI assistant.
|
|
614
620
|
</p>`}
|
|
@@ -628,7 +634,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
628
634
|
</p>
|
|
629
635
|
</div>
|
|
630
636
|
</div>
|
|
631
|
-
`}function
|
|
637
|
+
`}function xr(e,t){const n=new Map(t.whatsappAccounts.map(i=>[i.accountId,i]));return e.whatsappAccountId?n.get(e.whatsappAccountId)??null:e.isDefault&&t.whatsappAccounts.length===1?t.whatsappAccounts[0]??null:null}function Lt(e){var n;const t=(n=e.wsProps)==null?void 0:n.selectedWorkspace;return t?e.workspaces.find(i=>i.name===t)??null:e.workspaces[0]??null}function Oo(e){const t=Lt(e),n=(t==null?void 0:t.displayName)??(t==null?void 0:t.name)??Ie().name,i=e.whatsappBusy||e.gatewayHealthLoading;if(e.renamingWorkspace&&t){const s=()=>{const r=e.renameWorkspaceName.trim();r&&e.onWorkspaceRename(t.name,r)};return h`
|
|
632
638
|
<div style="display: flex; align-items: center; gap: 6px; margin-bottom: 4px;">
|
|
633
639
|
<input
|
|
634
640
|
type="text"
|
|
@@ -650,7 +656,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
650
656
|
title="Cancel"
|
|
651
657
|
>${D.x}</button>
|
|
652
658
|
</div>
|
|
653
|
-
`}return
|
|
659
|
+
`}return h`
|
|
654
660
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;">
|
|
655
661
|
<div style="display: flex; align-items: center; gap: 6px;">
|
|
656
662
|
<h2 style="margin: 0; font-size: 20px; font-weight: 600; color: var(--tasker-white);">${n}</h2>
|
|
@@ -670,7 +676,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
670
676
|
${D.rotateCw}
|
|
671
677
|
</button>
|
|
672
678
|
</div>
|
|
673
|
-
`}function Bo(e){return
|
|
679
|
+
`}function Bo(e){return h`
|
|
674
680
|
<div class="setup-status-item">
|
|
675
681
|
${pe(e.gatewayHealthy===!1?"bad":"good")}
|
|
676
682
|
<div class="setup-status-info">
|
|
@@ -687,17 +693,17 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
687
693
|
${D.rotateCw}
|
|
688
694
|
</button>
|
|
689
695
|
</div>
|
|
690
|
-
`}function Fo(e){const t=e.authConnected===!0;return
|
|
696
|
+
`}function Fo(e){const t=e.authConnected===!0;return h`
|
|
691
697
|
<div class="setup-status-item">
|
|
692
698
|
${pe(t?"good":"bad")}
|
|
693
699
|
<div class="setup-status-info">
|
|
694
700
|
<strong>Claude</strong>
|
|
695
701
|
<span>
|
|
696
|
-
${t?"Connected":"Not connected"}${t&&e.authExpiresIn?
|
|
702
|
+
${t?"Connected":"Not connected"}${t&&e.authExpiresIn?h` <span style="color: var(--tasker-text-grey); font-size: 12px;">(${e.authExpiresIn>60?`${Math.floor(e.authExpiresIn/60)}h ${e.authExpiresIn%60}m`:`${e.authExpiresIn}m`})</span>`:k}
|
|
697
703
|
</span>
|
|
698
704
|
</div>
|
|
699
705
|
${Pt("claude",e)}
|
|
700
|
-
${t?
|
|
706
|
+
${t?h`
|
|
701
707
|
<button
|
|
702
708
|
class="setup-status-action ${e.authBusy?"spinning":""}"
|
|
703
709
|
?disabled=${e.authBusy}
|
|
@@ -706,7 +712,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
706
712
|
>
|
|
707
713
|
${D.rotateCw}
|
|
708
714
|
</button>
|
|
709
|
-
`:
|
|
715
|
+
`:h`
|
|
710
716
|
<button
|
|
711
717
|
class="setup-status-action"
|
|
712
718
|
@click=${e.onStartAuth}
|
|
@@ -716,7 +722,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
716
722
|
</button>
|
|
717
723
|
`}
|
|
718
724
|
</div>
|
|
719
|
-
`}function Uo(e){return
|
|
725
|
+
`}function Uo(e){return h`
|
|
720
726
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
721
727
|
${pe("good")}
|
|
722
728
|
<div class="setup-status-info">
|
|
@@ -731,7 +737,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
731
737
|
>
|
|
732
738
|
${D.rotateCw}
|
|
733
739
|
</button>
|
|
734
|
-
${e.licenseRemoveConfirm?
|
|
740
|
+
${e.licenseRemoveConfirm?h`
|
|
735
741
|
<div style="width: 100%; margin-top: 8px; margin-left: 30px;">
|
|
736
742
|
<p style="color: var(--tasker-text-grey); font-size: 13px; margin: 0 0 8px;">
|
|
737
743
|
Removing your license will disable ${Ie().name} until you enter a new key.
|
|
@@ -756,13 +762,13 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
756
762
|
</div>
|
|
757
763
|
`:k}
|
|
758
764
|
</div>
|
|
759
|
-
`}function Wo(e){var f;const t=Lt(e);if(!t)return k;const n
|
|
765
|
+
`}function Wo(e){var f;const t=Lt(e);if(!t)return k;const n=xr(t,e),i=(n==null?void 0:n.running)&&(n==null?void 0:n.connected),s=(n==null?void 0:n.linked)&&!i,r=!!n,o=i?"good":s?"partial":r?"bad":"unknown",a=i?"Connected":s?"Linked, not connected":r?(n==null?void 0:n.lastError)||"Not connected":"Not paired",l=!(n!=null&&n.provider)||(n==null?void 0:n.provider)==="baileys",c=t.whatsappAccountId??(t.isDefault&&e.whatsappAccounts.length===1?(f=e.whatsappAccounts[0])==null?void 0:f.accountId:void 0),u=c!=null&&e.whatsappActiveQrAccountId===c;return h`
|
|
760
766
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
761
767
|
${pe(o)}
|
|
762
768
|
<div class="setup-status-info">
|
|
763
769
|
<div style="display: flex; align-items: center; gap: 4px;">
|
|
764
770
|
<strong>WhatsApp</strong>
|
|
765
|
-
${r&&i?
|
|
771
|
+
${r&&i?h`
|
|
766
772
|
<button
|
|
767
773
|
class="setup-status-action"
|
|
768
774
|
@click=${e.onWhatsAppSettingsOpen}
|
|
@@ -776,7 +782,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
776
782
|
<span>${a}</span>
|
|
777
783
|
</div>
|
|
778
784
|
${Pt("whatsapp",e)}
|
|
779
|
-
${l&&c?
|
|
785
|
+
${l&&c?h`
|
|
780
786
|
<button
|
|
781
787
|
class="setup-status-action ${e.whatsappBusy&&u?"spinning":""}"
|
|
782
788
|
?disabled=${e.whatsappBusy}
|
|
@@ -786,7 +792,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
786
792
|
${D.rotateCw}
|
|
787
793
|
</button>
|
|
788
794
|
`:k}
|
|
789
|
-
${u&&e.whatsappLoginQrDataUrl?
|
|
795
|
+
${u&&e.whatsappLoginQrDataUrl?h`
|
|
790
796
|
<div style="width: 100%; margin-top: 8px; margin-left: 30px;">
|
|
791
797
|
<div class="setup-qr" style="display: inline-flex;">
|
|
792
798
|
<img
|
|
@@ -795,11 +801,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
795
801
|
style="width: 140px; height: 140px;"
|
|
796
802
|
/>
|
|
797
803
|
</div>
|
|
798
|
-
${e.whatsappLoginMessage?
|
|
804
|
+
${e.whatsappLoginMessage?h`<p class="setup-hint" style="margin-top: 4px;">${e.whatsappLoginMessage}</p>`:k}
|
|
799
805
|
</div>
|
|
800
806
|
`:k}
|
|
801
807
|
</div>
|
|
802
|
-
`}const
|
|
808
|
+
`}const Vh=[{id:"claude-opus-4-6",shortName:"Opus"},{id:"claude-sonnet-4-5-20250929",shortName:"Sonnet"},{id:"claude-haiku-4-5-20251001",shortName:"Haiku"}],Gh="anthropic/claude-sonnet-4-5-20250929",Qh=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Yh(e){if(!e.whatsappSettingsOpen)return k;const t=Lt(e);if(!t)return k;const n=xr(t,e),i=(n==null?void 0:n.running)&&(n==null?void 0:n.connected);if(!n||!i)return k;const s=()=>e.onWhatsAppSettingsClose(),r=e.whatsappModelCatalog??[],o=new Set(r.filter(u=>u.provider==="anthropic").map(u=>u.id)),a=Vh.filter(u=>o.has(u.id)),l=e.whatsappModel??Gh,c=e.whatsappThinkingLevel??"off";return h`
|
|
803
809
|
<div class="setup-info-overlay" @click=${u=>{u.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
804
810
|
<div class="setup-info-card" style="max-width: 360px;">
|
|
805
811
|
<h3>Public Agent Settings</h3>
|
|
@@ -829,7 +835,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
829
835
|
<div style="font-size: 12px; color: var(--tasker-text-grey); opacity: 0.7;">Agent responds in WhatsApp groups</div>
|
|
830
836
|
</div>
|
|
831
837
|
</label>
|
|
832
|
-
${e.whatsappGroupPolicy==="open"?
|
|
838
|
+
${e.whatsappGroupPolicy==="open"?h`
|
|
833
839
|
<div style="display: flex; flex-direction: column; gap: 6px; padding-left: 24px;">
|
|
834
840
|
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
|
|
835
841
|
<input
|
|
@@ -860,7 +866,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
860
866
|
</div>
|
|
861
867
|
`:k}
|
|
862
868
|
<div style="border-top: 1px solid rgba(255,255,255,0.08); margin: 4px 0;"></div>
|
|
863
|
-
${a.length>0?
|
|
869
|
+
${a.length>0?h`
|
|
864
870
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
865
871
|
<div style="font-size: 13px; color: var(--tasker-text-grey); min-width: 60px;">Model</div>
|
|
866
872
|
<select
|
|
@@ -869,7 +875,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
869
875
|
.value=${l}
|
|
870
876
|
@change=${u=>{e.onWhatsAppModelChange(u.target.value)}}
|
|
871
877
|
>
|
|
872
|
-
${a.map(u=>
|
|
878
|
+
${a.map(u=>h`
|
|
873
879
|
<option value=${"anthropic/"+u.id} ?selected=${l==="anthropic/"+u.id}>
|
|
874
880
|
${u.shortName}
|
|
875
881
|
</option>
|
|
@@ -885,7 +891,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
885
891
|
.value=${c}
|
|
886
892
|
@change=${u=>{e.onWhatsAppThinkingChange(u.target.value)}}
|
|
887
893
|
>
|
|
888
|
-
${
|
|
894
|
+
${Qh.map(u=>h`
|
|
889
895
|
<option value=${u.value} ?selected=${c===u.value}>
|
|
890
896
|
${u.label}
|
|
891
897
|
</option>
|
|
@@ -902,7 +908,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
902
908
|
</button>
|
|
903
909
|
</div>
|
|
904
910
|
</div>
|
|
905
|
-
`}function Er(e){const t=Lt(e),n=e.imessageOwnerWorkspace,i=!!(t&&n===t.name),s=!!(n&&t&&n!==t.name);return{selectedWs:t,ownerWs:n,thisWsOwns:i,anotherWsOwns:s}}function Ko(e){const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=Er(e);let s,r;return i?(s="partial",r=`Connected to ${t}`):n&&e.imessageConnected?(s="good",r="Connected"):n&&e.imessageRunning?(s="partial",r="Running, not connected"):n?(s="bad",r="Not running"):e.imessageConfigured?(s="unknown",r="Not connected"):(s="bad",r="Not configured"),
|
|
911
|
+
`}function Er(e){const t=Lt(e),n=e.imessageOwnerWorkspace,i=!!(t&&n===t.name),s=!!(n&&t&&n!==t.name);return{selectedWs:t,ownerWs:n,thisWsOwns:i,anotherWsOwns:s}}function Ko(e){const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=Er(e);let s,r;return i?(s="partial",r=`Connected to ${t}`):n&&e.imessageConnected?(s="good",r="Connected"):n&&e.imessageRunning?(s="partial",r="Running, not connected"):n?(s="bad",r="Not running"):e.imessageConfigured?(s="unknown",r="Not connected"):(s="bad",r="Not configured"),h`
|
|
906
912
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
907
913
|
${pe(s)}
|
|
908
914
|
<div class="setup-status-info">
|
|
@@ -920,7 +926,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
920
926
|
</button>
|
|
921
927
|
${k}
|
|
922
928
|
</div>
|
|
923
|
-
`}function
|
|
929
|
+
`}function Xh(e){if(!e.imessageEnableConfirm)return k;const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=Er(e),s=()=>{e.onIMessageEnableCancel()};return n?h`
|
|
924
930
|
<div class="setup-info-overlay" @click=${r=>{r.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
925
931
|
<div class="setup-info-card" style="text-align: center;">
|
|
926
932
|
<h3>iMessage</h3>
|
|
@@ -947,7 +953,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
947
953
|
</button>
|
|
948
954
|
</div>
|
|
949
955
|
</div>
|
|
950
|
-
`:i?
|
|
956
|
+
`:i?h`
|
|
951
957
|
<div class="setup-info-overlay" @click=${r=>{r.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
952
958
|
<div class="setup-info-card" style="text-align: center;">
|
|
953
959
|
<h3>Connect iMessage</h3>
|
|
@@ -972,7 +978,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
972
978
|
</button>
|
|
973
979
|
</div>
|
|
974
980
|
</div>
|
|
975
|
-
`:
|
|
981
|
+
`:h`
|
|
976
982
|
<div class="setup-info-overlay" @click=${r=>{r.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
977
983
|
<div class="setup-info-card" style="text-align: center;">
|
|
978
984
|
<h3>Enable iMessage</h3>
|
|
@@ -996,7 +1002,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
996
1002
|
</button>
|
|
997
1003
|
</div>
|
|
998
1004
|
</div>
|
|
999
|
-
`}function zo(e){if(!e.isMaster)return k;const n=e.apiKeyProviders.filter(i=>i.hasKey).length;return
|
|
1005
|
+
`}function zo(e){if(!e.isMaster)return k;const n=e.apiKeyProviders.filter(i=>i.hasKey).length;return h`
|
|
1000
1006
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1001
1007
|
<div class="setup-status-item">
|
|
1002
1008
|
${pe(n>0?"good":"bad")}
|
|
@@ -1010,14 +1016,14 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1010
1016
|
>Manage</button>
|
|
1011
1017
|
</div>
|
|
1012
1018
|
</div>
|
|
1013
|
-
${
|
|
1014
|
-
`}function
|
|
1019
|
+
${Zh(e)}
|
|
1020
|
+
`}function Zh(e){if(!e.apiKeyModalOpen)return k;const t=e.apiKeyProviders,n={};for(const c of t)c.key&&(n[c.id]=c.key);const i=(c,u)=>{const f=u==null?void 0:u.closest(".setup-apikey-input"),d=f==null?void 0:f.querySelector("input"),p=d==null?void 0:d.value.trim();!p||p===n[c]||e.onApiKeySave(c,p)},s=c=>{const u=c.currentTarget,f=u.closest(".setup-apikey-input"),d=f==null?void 0:f.querySelector("input");if(!d)return;const p=d.type==="text";d.type=p?"password":"text",u.classList.toggle("active",!p)},r=(c,u)=>{const f=u.target,d=f.closest(".setup-apikey-input"),p=f.value.trim(),w=p.length>0&&p!==n[c],b=d==null?void 0:d.querySelector(".setup-apikey-save");b&&(b.style.display=w?"":"none");const S=d==null?void 0:d.querySelector(".setup-apikey-eye");S&&(S.style.display=p.length>0?"":"none")},o=t.filter(c=>c.primary),a=t.filter(c=>!c.primary),l=c=>{const u=e.apiKeySavingProvider===c.id&&e.apiKeyBusy,f=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} key saved`,d=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} key removed`;return h`
|
|
1015
1021
|
<div class="setup-apikey-row">
|
|
1016
1022
|
<div class="setup-apikey-info">
|
|
1017
1023
|
<strong>${c.name}</strong>
|
|
1018
1024
|
<span class="setup-apikey-category">${c.category}</span>
|
|
1019
|
-
${f?
|
|
1020
|
-
${d?
|
|
1025
|
+
${f?h`<span class="setup-apikey-badge saved">Saved</span>`:k}
|
|
1026
|
+
${d?h`<span class="setup-apikey-badge removed">Removed</span>`:k}
|
|
1021
1027
|
</div>
|
|
1022
1028
|
<div class="setup-apikey-input">
|
|
1023
1029
|
<input
|
|
@@ -1025,8 +1031,8 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1025
1031
|
.value=${c.key??""}
|
|
1026
1032
|
placeholder="Enter key"
|
|
1027
1033
|
?disabled=${e.apiKeyBusy}
|
|
1028
|
-
@input=${
|
|
1029
|
-
@keydown=${
|
|
1034
|
+
@input=${p=>r(c.id,p)}
|
|
1035
|
+
@keydown=${p=>{p.key==="Enter"&&i(c.id,p.target)}}
|
|
1030
1036
|
/>
|
|
1031
1037
|
<button
|
|
1032
1038
|
class="setup-apikey-icon-btn setup-apikey-eye"
|
|
@@ -1034,13 +1040,13 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1034
1040
|
title="Toggle visibility"
|
|
1035
1041
|
@click=${s}
|
|
1036
1042
|
>${D.eye}</button>
|
|
1037
|
-
${u?
|
|
1043
|
+
${u?h`<span class="setup-apikey-badge saving">Saving\u2026</span>`:h`<button
|
|
1038
1044
|
class="setup-apikey-save setup-button"
|
|
1039
1045
|
style="display: none;"
|
|
1040
1046
|
?disabled=${e.apiKeyBusy}
|
|
1041
|
-
@click=${
|
|
1047
|
+
@click=${p=>i(c.id,p.currentTarget)}
|
|
1042
1048
|
>Save</button>`}
|
|
1043
|
-
${c.hasKey&&!u?
|
|
1049
|
+
${c.hasKey&&!u?h`
|
|
1044
1050
|
<button
|
|
1045
1051
|
class="setup-apikey-icon-btn danger"
|
|
1046
1052
|
title="Remove key"
|
|
@@ -1050,14 +1056,14 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1050
1056
|
`:k}
|
|
1051
1057
|
</div>
|
|
1052
1058
|
</div>
|
|
1053
|
-
`};return
|
|
1059
|
+
`};return h`
|
|
1054
1060
|
<div class="setup-info-overlay" style="align-items: flex-start; padding-top: 72px;" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onApiKeyModalClose()}}>
|
|
1055
1061
|
<div class="setup-info-card" style="max-width: 480px;">
|
|
1056
1062
|
<h3 style="margin: 0 0 4px; text-align: center;">API Keys</h3>
|
|
1057
1063
|
<div class="setup-apikey-list">
|
|
1058
|
-
${e.apiKeyError?
|
|
1064
|
+
${e.apiKeyError?h`<p class="setup-error" style="margin: 0;">${e.apiKeyError}</p>`:k}
|
|
1059
1065
|
${o.map(l)}
|
|
1060
|
-
${a.length>0?
|
|
1066
|
+
${a.length>0?h`
|
|
1061
1067
|
<details class="setup-apikey-advanced">
|
|
1062
1068
|
<summary>Additional keys</summary>
|
|
1063
1069
|
${a.map(l)}
|
|
@@ -1066,7 +1072,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1066
1072
|
</div>
|
|
1067
1073
|
</div>
|
|
1068
1074
|
</div>
|
|
1069
|
-
`}function jo(e){const t=e.updateAvailable===null?"unknown":e.updateAvailable?"partial":"good",n=e.updateAvailable&&e.latestVersion?`v${e.currentVersion} → v${e.latestVersion}`:e.currentVersion?`v${e.currentVersion}`:"Unknown",i=e.updateChecking||e.updateRunning;return
|
|
1075
|
+
`}function jo(e){const t=e.updateAvailable===null?"unknown":e.updateAvailable?"partial":"good",n=e.updateAvailable&&e.latestVersion?`v${e.currentVersion} → v${e.latestVersion}`:e.currentVersion?`v${e.currentVersion}`:"Unknown",i=e.updateChecking||e.updateRunning;return h`
|
|
1070
1076
|
<div class="setup-status-item">
|
|
1071
1077
|
${pe(t)}
|
|
1072
1078
|
<div class="setup-status-info">
|
|
@@ -1074,7 +1080,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1074
1080
|
<span>${n}</span>
|
|
1075
1081
|
</div>
|
|
1076
1082
|
${Pt("update",e)}
|
|
1077
|
-
${e.updateAvailable?
|
|
1083
|
+
${e.updateAvailable?h`
|
|
1078
1084
|
<button
|
|
1079
1085
|
class="setup-status-action ${i?"spinning":""}"
|
|
1080
1086
|
?disabled=${i}
|
|
@@ -1083,7 +1089,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1083
1089
|
>
|
|
1084
1090
|
${D.download}
|
|
1085
1091
|
</button>
|
|
1086
|
-
`:
|
|
1092
|
+
`:h`
|
|
1087
1093
|
<button
|
|
1088
1094
|
class="setup-status-action ${i?"spinning":""}"
|
|
1089
1095
|
?disabled=${i}
|
|
@@ -1094,27 +1100,51 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1094
1100
|
</button>
|
|
1095
1101
|
`}
|
|
1096
1102
|
</div>
|
|
1097
|
-
`}function
|
|
1103
|
+
`}const Jh={anonymous:"Open access",verified:"WhatsApp OTP",choice:"Visitor chooses"};function Ho(e){const t=e.publicChatEnabled,n=t?"good":"unknown",i=Jh[e.publicChatAuthMode]??"Open access";return h`
|
|
1104
|
+
<div class="setup-status-item">
|
|
1105
|
+
${pe(n)}
|
|
1106
|
+
<div class="setup-status-info">
|
|
1107
|
+
<strong>Public Chat</strong>
|
|
1108
|
+
<span>${t?i:"Disabled"}</span>
|
|
1109
|
+
</div>
|
|
1110
|
+
${t?h`
|
|
1111
|
+
<select
|
|
1112
|
+
class="setup-select-sm"
|
|
1113
|
+
?disabled=${e.publicChatBusy}
|
|
1114
|
+
@change=${s=>{const r=s.target.value;e.onPublicChatAuthModeChange(r)}}
|
|
1115
|
+
>
|
|
1116
|
+
<option value="anonymous" ?selected=${e.publicChatAuthMode==="anonymous"}>Open access</option>
|
|
1117
|
+
<option value="verified" ?selected=${e.publicChatAuthMode==="verified"}>WhatsApp OTP</option>
|
|
1118
|
+
<option value="choice" ?selected=${e.publicChatAuthMode==="choice"}>Visitor chooses</option>
|
|
1119
|
+
</select>
|
|
1120
|
+
`:k}
|
|
1121
|
+
<button
|
|
1122
|
+
class="setup-link-btn"
|
|
1123
|
+
?disabled=${e.publicChatBusy}
|
|
1124
|
+
@click=${e.onPublicChatToggle}
|
|
1125
|
+
>${e.publicChatBusy?"...":t?"Disable":"Enable"}</button>
|
|
1126
|
+
</div>
|
|
1127
|
+
`}function ef(e){var i,s,r;const t=e.updateRunning,n=e.updateLastResult;if(!t&&!n)return k;if(t)return h`
|
|
1098
1128
|
<div class="setup-info-overlay">
|
|
1099
1129
|
<div class="setup-info-card" style="max-width: 400px;">
|
|
1100
1130
|
<h3>Software Update</h3>
|
|
1101
|
-
${e.updateProgressSteps.length>0?
|
|
1131
|
+
${e.updateProgressSteps.length>0?h`
|
|
1102
1132
|
<div class="setup-update-progress">
|
|
1103
|
-
${e.updateProgressSteps.map(o=>
|
|
1133
|
+
${e.updateProgressSteps.map(o=>h`
|
|
1104
1134
|
<div class="setup-update-step ${o.status}">
|
|
1105
1135
|
<span class="setup-update-step-icon">
|
|
1106
|
-
${o.status==="running"?
|
|
1136
|
+
${o.status==="running"?h`<span class="setup-update-spinner"></span>`:o.status==="done"?h`<span class="setup-update-icon-ok">${D.check}</span>`:h`<span class="setup-update-icon-fail">${D.x}</span>`}
|
|
1107
1137
|
</span>
|
|
1108
1138
|
<span class="setup-update-step-name">${o.name}</span>
|
|
1109
|
-
${o.durationMs!=null?
|
|
1139
|
+
${o.durationMs!=null?h`<span class="setup-update-step-time">${qo(o.durationMs)}</span>`:k}
|
|
1110
1140
|
</div>
|
|
1111
1141
|
`)}
|
|
1112
1142
|
</div>
|
|
1113
|
-
`:
|
|
1114
|
-
${e.updateMessage?
|
|
1143
|
+
`:h`<div class="setup-spinner" style="margin: 16px auto;"></div>`}
|
|
1144
|
+
${e.updateMessage?h`<p style="text-align: center; color: var(--tasker-text-grey); font-size: 13px; margin: 12px 0 0;">${e.updateMessage}</p>`:k}
|
|
1115
1145
|
</div>
|
|
1116
1146
|
</div>
|
|
1117
|
-
`;if(n){const o=n.status==="ok";let a;if(o){const c=(i=n.before)==null?void 0:i.version,u=((s=n.after)==null?void 0:s.version)??n.currentVersion;a=c?`v${c} → v${u}`:`Updated to v${u}`}else a=n.reason??((r=n.failedStep)==null?void 0:r.name)??"unknown error";const l=n.durationMs!=null?
|
|
1147
|
+
`;if(n){const o=n.status==="ok";let a;if(o){const c=(i=n.before)==null?void 0:i.version,u=((s=n.after)==null?void 0:s.version)??n.currentVersion;a=c?`v${c} → v${u}`:`Updated to v${u}`}else a=n.reason??((r=n.failedStep)==null?void 0:r.name)??"unknown error";const l=n.durationMs!=null?qo(n.durationMs):null;return h`
|
|
1118
1148
|
<div class="setup-info-overlay" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onUpdateDismissResult()}}>
|
|
1119
1149
|
<div class="setup-info-card" style="max-width: 360px; text-align: center;">
|
|
1120
1150
|
<div class="setup-update-result-icon ${o?"ok":"fail"}">${o?D.circleCheck:D.circleX}</div>
|
|
@@ -1124,7 +1154,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1124
1154
|
<p style="color: var(--tasker-text-grey); font-size: 14px; margin: 8px 0;">
|
|
1125
1155
|
${a}
|
|
1126
1156
|
</p>
|
|
1127
|
-
${l?
|
|
1157
|
+
${l?h`<p style="color: rgba(255,255,255,0.3); font-size: 12px; margin: 4px 0 0;">${l}</p>`:k}
|
|
1128
1158
|
<button
|
|
1129
1159
|
class="setup-button secondary"
|
|
1130
1160
|
style="margin-top: 20px; width: 100%; padding: 10px;"
|
|
@@ -1134,7 +1164,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1134
1164
|
</button>
|
|
1135
1165
|
</div>
|
|
1136
1166
|
</div>
|
|
1137
|
-
`}return k}function
|
|
1167
|
+
`}return k}function qo(e){if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),i=t%60;return i>0?`${n}m ${i}s`:`${n}m`}function Vo(e){const t=e.accountHasPin;return h`
|
|
1138
1168
|
<div class="setup-status-item">
|
|
1139
1169
|
${pe(t?"good":"bad")}
|
|
1140
1170
|
<div class="setup-status-info">
|
|
@@ -1146,7 +1176,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1146
1176
|
@click=${()=>e.onAccountPinModalOpen()}
|
|
1147
1177
|
>${t?"Change":"Set PIN"}</button>
|
|
1148
1178
|
</div>
|
|
1149
|
-
`}function Go(e){if(!e.accountPinModalOpen)return k;const t=e.accountHasPin,n=e.accountPinBusy;let i="",s="",r="";const o=c=>u=>{const f=u.target;f.value=f.value.replace(/\D/g,"").slice(0,6),c(f.value)},a=(c,u)=>{var d;let f=c.querySelector(".pin-modal-validation");f||(f=document.createElement("p"),f.className="login-error pin-modal-validation",(d=c.querySelector("button[type=submit]"))==null||d.before(f)),f.textContent=u},l=c=>{c.preventDefault();const u=c.target;if(!n){if(t&&!i){a(u,"Enter your current PIN");return}if(!s){a(u,"Enter a new PIN");return}if(!r){a(u,"Confirm your new PIN");return}if(s!==r){a(u,"PINs do not match");return}if(s.length<4){a(u,"PIN must be 4–6 digits");return}e.onAccountPinSave(t?i:null,s)}};return
|
|
1179
|
+
`}function Go(e){if(!e.accountPinModalOpen)return k;const t=e.accountHasPin,n=e.accountPinBusy;let i="",s="",r="";const o=c=>u=>{const f=u.target;f.value=f.value.replace(/\D/g,"").slice(0,6),c(f.value)},a=(c,u)=>{var d;let f=c.querySelector(".pin-modal-validation");f||(f=document.createElement("p"),f.className="login-error pin-modal-validation",(d=c.querySelector("button[type=submit]"))==null||d.before(f)),f.textContent=u},l=c=>{c.preventDefault();const u=c.target;if(!n){if(t&&!i){a(u,"Enter your current PIN");return}if(!s){a(u,"Enter a new PIN");return}if(!r){a(u,"Confirm your new PIN");return}if(s!==r){a(u,"PINs do not match");return}if(s.length<4){a(u,"PIN must be 4–6 digits");return}e.onAccountPinSave(t?i:null,s)}};return h`
|
|
1150
1180
|
<div class="setup-info-overlay" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onAccountPinModalClose()}}>
|
|
1151
1181
|
<div class="setup-info-card" style="max-width: 340px;">
|
|
1152
1182
|
<div class="setup-info-header">
|
|
@@ -1156,7 +1186,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1156
1186
|
</button>
|
|
1157
1187
|
</div>
|
|
1158
1188
|
<form @submit=${l} style="display: flex; flex-direction: column; gap: 12px; padding: 16px 0 8px;">
|
|
1159
|
-
${t?
|
|
1189
|
+
${t?h`
|
|
1160
1190
|
<input
|
|
1161
1191
|
class="login-pin-input"
|
|
1162
1192
|
type="password"
|
|
@@ -1180,7 +1210,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1180
1210
|
placeholder="New PIN (4–6 digits)"
|
|
1181
1211
|
?disabled=${n}
|
|
1182
1212
|
@input=${o(c=>{s=c})}
|
|
1183
|
-
${t?k:
|
|
1213
|
+
${t?k:h`autofocus`}
|
|
1184
1214
|
/>
|
|
1185
1215
|
<input
|
|
1186
1216
|
class="login-pin-input"
|
|
@@ -1193,17 +1223,17 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1193
1223
|
?disabled=${n}
|
|
1194
1224
|
@input=${o(c=>{r=c})}
|
|
1195
1225
|
/>
|
|
1196
|
-
${e.accountPinError?
|
|
1197
|
-
${e.accountPinSuccess?
|
|
1226
|
+
${e.accountPinError?h`<p class="login-error">${e.accountPinError}</p>`:k}
|
|
1227
|
+
${e.accountPinSuccess?h`<p class="login-success">${e.accountPinSuccess}</p>`:k}
|
|
1198
1228
|
<button
|
|
1199
1229
|
class="login-submit"
|
|
1200
1230
|
type="submit"
|
|
1201
1231
|
?disabled=${n}
|
|
1202
|
-
>${n?
|
|
1232
|
+
>${n?h`<span class="login-spinner"></span>`:t?"Change PIN":"Set PIN"}</button>
|
|
1203
1233
|
</form>
|
|
1204
1234
|
</div>
|
|
1205
1235
|
</div>
|
|
1206
|
-
`}function
|
|
1236
|
+
`}function Qo(e){if(!e.addingWorkspace)return k;const{workspaceSaving:t}=e;return h`
|
|
1207
1237
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1208
1238
|
<div class="setup-add-account">
|
|
1209
1239
|
<strong>New Account</strong>
|
|
@@ -1256,7 +1286,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1256
1286
|
</div>
|
|
1257
1287
|
</div>
|
|
1258
1288
|
</div>
|
|
1259
|
-
`}function
|
|
1289
|
+
`}function Yo(e){const t=Lt(e);return!t||t.isDefault?k:e.workspaceRemoveConfirm===t.name?h`
|
|
1260
1290
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 12px;">
|
|
1261
1291
|
<div style="font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
|
1262
1292
|
<span style="color: var(--tasker-danger, #ef4444);">Remove "${t.displayName??t.name}" and its WhatsApp account?</span>
|
|
@@ -1277,7 +1307,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1277
1307
|
</button>
|
|
1278
1308
|
</div>
|
|
1279
1309
|
</div>
|
|
1280
|
-
`:
|
|
1310
|
+
`:h`
|
|
1281
1311
|
<p class="setup-hint" style="margin-top: 12px;">
|
|
1282
1312
|
<a
|
|
1283
1313
|
href="#"
|
|
@@ -1285,7 +1315,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1285
1315
|
@click=${i=>{i.preventDefault(),e.onSetWorkspaceRemoveConfirm(t.name)}}
|
|
1286
1316
|
>Remove Account</a>
|
|
1287
1317
|
</p>
|
|
1288
|
-
`}function
|
|
1318
|
+
`}function Xo(e){if(e.uninstallDone)return h`
|
|
1289
1319
|
<div style="margin-top: 24px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1290
1320
|
<p style="color: var(--tasker-danger, #ef4444); font-size: 13px; font-weight: 600; margin: 0 0 8px 0;">
|
|
1291
1321
|
Taskmaster has been uninstalled.
|
|
@@ -1295,7 +1325,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1295
1325
|
<code style="font-size: 11px; background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 3px;">sudo npm uninstall -g @rubytech/taskmaster</code>
|
|
1296
1326
|
</p>
|
|
1297
1327
|
</div>
|
|
1298
|
-
`;if(e.uninstallConfirm){const t=e.uninstallConfirmText==="UNINSTALL";return
|
|
1328
|
+
`;if(e.uninstallConfirm){const t=e.uninstallConfirmText==="UNINSTALL";return h`
|
|
1299
1329
|
<div style="margin-top: 24px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1300
1330
|
<p style="color: var(--tasker-danger, #ef4444); font-size: 13px; font-weight: 600; margin: 0 0 8px 0;">
|
|
1301
1331
|
Uninstall Taskmaster
|
|
@@ -1330,9 +1360,9 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1330
1360
|
Cancel
|
|
1331
1361
|
</button>
|
|
1332
1362
|
</div>
|
|
1333
|
-
${e.uninstallError?
|
|
1363
|
+
${e.uninstallError?h`<p class="setup-error" style="margin-top: 8px; font-size: 12px;">${e.uninstallError}</p>`:k}
|
|
1334
1364
|
</div>
|
|
1335
|
-
`}return
|
|
1365
|
+
`}return h`
|
|
1336
1366
|
<p class="setup-hint" style="margin-top: 8px;">
|
|
1337
1367
|
<a
|
|
1338
1368
|
href="#"
|
|
@@ -1340,11 +1370,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1340
1370
|
@click=${t=>{t.preventDefault(),e.onUninstallConfirm()}}
|
|
1341
1371
|
>Uninstall Taskmaster</a>
|
|
1342
1372
|
</p>
|
|
1343
|
-
`}function
|
|
1373
|
+
`}function Zo(){return h`
|
|
1344
1374
|
<p class="setup-hint" style="margin-top: 4px; font-size: 12px; opacity: 0.6;">
|
|
1345
1375
|
Need help? <a href="https://wa.me/447591215452" target="_blank" rel="noopener" style="color: var(--tasker-orange);">Message Dave on WhatsApp</a>
|
|
1346
1376
|
</p>
|
|
1347
|
-
`}function
|
|
1377
|
+
`}function tf(e){const{whatsappBusy:t,whatsappLoginMessage:n,whatsappLoginQrDataUrl:i,whatsappLoginConnected:s,whatsappChannelStatus:r}=e;if(i)return h`
|
|
1348
1378
|
<div class="setup-container">
|
|
1349
1379
|
<div class="setup-card">
|
|
1350
1380
|
<h1>Scan with WhatsApp</h1>
|
|
@@ -1354,7 +1384,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1354
1384
|
<div class="setup-qr">
|
|
1355
1385
|
<img src=${i} alt="WhatsApp QR Code" />
|
|
1356
1386
|
</div>
|
|
1357
|
-
${t?
|
|
1387
|
+
${t?h`<p class="setup-waiting">Waiting for scan...</p>`:h`<p class="setup-hint">
|
|
1358
1388
|
Scan the code above with your phone
|
|
1359
1389
|
</p>`}
|
|
1360
1390
|
<p class="setup-hint" style="margin-top: 16px;">
|
|
@@ -1371,16 +1401,16 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1371
1401
|
</div>
|
|
1372
1402
|
</div>
|
|
1373
1403
|
</div>
|
|
1374
|
-
`;if(t)return
|
|
1404
|
+
`;if(t)return h`
|
|
1375
1405
|
<div class="setup-container">
|
|
1376
1406
|
<div class="setup-card">
|
|
1377
1407
|
<div class="setup-spinner"></div>
|
|
1378
1408
|
<p>${n||"Connecting to WhatsApp..."}</p>
|
|
1379
1409
|
</div>
|
|
1380
1410
|
</div>
|
|
1381
|
-
`;const o=(r==null?void 0:r.running)&&(r==null?void 0:r.connected);return r?(e.whatsappAccounts.length>1?e.whatsappAccounts.every(u=>u.running&&u.connected):o)&&e.authConnected?
|
|
1411
|
+
`;const o=(r==null?void 0:r.running)&&(r==null?void 0:r.connected);return r?(e.whatsappAccounts.length>1?e.whatsappAccounts.every(u=>u.running&&u.connected):o)&&e.authConnected?h`
|
|
1382
1412
|
<div class="setup-container">
|
|
1383
|
-
<div class="setup-card setup-success">
|
|
1413
|
+
<div class="setup-card setup-success setup-dashboard-wide">
|
|
1384
1414
|
${Oo(e)}
|
|
1385
1415
|
<div class="setup-status-dashboard">
|
|
1386
1416
|
${Bo(e)}
|
|
@@ -1388,22 +1418,23 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1388
1418
|
${Uo(e)}
|
|
1389
1419
|
${Wo(e)}
|
|
1390
1420
|
${Ko(e)}
|
|
1391
|
-
${
|
|
1421
|
+
${Vo(e)}
|
|
1392
1422
|
${jo(e)}
|
|
1423
|
+
${Ho(e)}
|
|
1393
1424
|
</div>
|
|
1394
1425
|
|
|
1395
1426
|
${Go(e)}
|
|
1396
1427
|
${zo(e)}
|
|
1397
|
-
${Vo(e)}
|
|
1398
1428
|
${Qo(e)}
|
|
1399
1429
|
${Yo(e)}
|
|
1400
|
-
${Xo()}
|
|
1401
|
-
${
|
|
1430
|
+
${Xo(e)}
|
|
1431
|
+
${Zo()}
|
|
1432
|
+
${e.workspacesError?h`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:k}
|
|
1402
1433
|
</div>
|
|
1403
1434
|
</div>
|
|
1404
|
-
`:
|
|
1435
|
+
`:h`
|
|
1405
1436
|
<div class="setup-container">
|
|
1406
|
-
<div class="setup-card">
|
|
1437
|
+
<div class="setup-card setup-dashboard-wide">
|
|
1407
1438
|
${Oo(e)}
|
|
1408
1439
|
<div class="setup-status-dashboard">
|
|
1409
1440
|
${Bo(e)}
|
|
@@ -1411,20 +1442,21 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1411
1442
|
${Uo(e)}
|
|
1412
1443
|
${Wo(e)}
|
|
1413
1444
|
${Ko(e)}
|
|
1414
|
-
${
|
|
1445
|
+
${Vo(e)}
|
|
1415
1446
|
${jo(e)}
|
|
1447
|
+
${Ho(e)}
|
|
1416
1448
|
</div>
|
|
1417
1449
|
|
|
1418
1450
|
${Go(e)}
|
|
1419
1451
|
${zo(e)}
|
|
1420
|
-
${Vo(e)}
|
|
1421
1452
|
${Qo(e)}
|
|
1422
1453
|
${Yo(e)}
|
|
1423
|
-
${Xo()}
|
|
1424
|
-
${
|
|
1454
|
+
${Xo(e)}
|
|
1455
|
+
${Zo()}
|
|
1456
|
+
${e.workspacesError?h`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:k}
|
|
1425
1457
|
</div>
|
|
1426
1458
|
</div>
|
|
1427
|
-
`:r?s===!1&&n&&!t?
|
|
1459
|
+
`:r?s===!1&&n&&!t?h`
|
|
1428
1460
|
<div class="setup-container">
|
|
1429
1461
|
<div class="setup-card">
|
|
1430
1462
|
${ye("whatsapp")}
|
|
@@ -1442,15 +1474,15 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1442
1474
|
</button>
|
|
1443
1475
|
</div>
|
|
1444
1476
|
</div>
|
|
1445
|
-
`:
|
|
1477
|
+
`:h`
|
|
1446
1478
|
<div class="setup-container">
|
|
1447
1479
|
<div class="setup-card">
|
|
1448
1480
|
${ye("whatsapp")}
|
|
1449
|
-
${n?
|
|
1481
|
+
${n?h`<p class="setup-error">${n}</p>`:h`<div class="setup-spinner"></div>
|
|
1450
1482
|
<p>Preparing...</p>`}
|
|
1451
1483
|
</div>
|
|
1452
1484
|
</div>
|
|
1453
|
-
`:
|
|
1485
|
+
`:h`
|
|
1454
1486
|
<div class="setup-container">
|
|
1455
1487
|
<div class="setup-card">
|
|
1456
1488
|
${ye("whatsapp")}
|
|
@@ -1465,7 +1497,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1465
1497
|
</button>
|
|
1466
1498
|
</div>
|
|
1467
1499
|
</div>
|
|
1468
|
-
`}function
|
|
1500
|
+
`}function nf(e){const{connected:t,currentStep:n}=e;if(t&&oi()&&$r(),e.uninstallDone||!t&&oi())return h`
|
|
1469
1501
|
<div class="setup-container">
|
|
1470
1502
|
<div class="setup-card">
|
|
1471
1503
|
<p style="color: var(--tasker-danger, #ef4444); font-size: 16px; font-weight: 600; margin: 0 0 12px 0;">
|
|
@@ -1481,20 +1513,20 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1481
1513
|
<p style="font-size: 12px; color: var(--tasker-text-grey); margin: 0;">You can close this tab.</p>
|
|
1482
1514
|
</div>
|
|
1483
1515
|
</div>
|
|
1484
|
-
`;if(!t){const r=e.updateRunning;return
|
|
1516
|
+
`;if(!t){const r=e.updateRunning;return h`
|
|
1485
1517
|
<div class="setup-container">
|
|
1486
1518
|
<div class="setup-card">
|
|
1487
1519
|
<div class="setup-spinner"></div>
|
|
1488
1520
|
<p>${r?"Restarting gateway after update…":"Connecting to gateway..."}</p>
|
|
1489
1521
|
</div>
|
|
1490
1522
|
</div>
|
|
1491
|
-
`}let i;switch(n){case"license":i=Do(e);break;case"auth":i=
|
|
1523
|
+
`}let i;switch(n){case"license":i=Do(e);break;case"auth":i=qh(e);break;case"whatsapp":case"complete":i=tf(e);break;default:i=Do(e)}const s=ut("Setup",e.wsProps);return h`${i}${Hh(e)}${Xh(e)}${Yh(e)}${ef(e)}${s}`}function sf(e,t){const n=e.paired?"Paired phone (used to link WhatsApp)":"Admin access via WhatsApp DM";return h`
|
|
1492
1524
|
<div class="sp-list-item">
|
|
1493
1525
|
<div class="sp-list-item-main">
|
|
1494
1526
|
<div class="sp-list-item-title">${e.phone}</div>
|
|
1495
1527
|
<div class="sp-list-item-sub">${n}</div>
|
|
1496
1528
|
</div>
|
|
1497
|
-
${e.paired?
|
|
1529
|
+
${e.paired?h`<span style="color: var(--tasker-orange); font-size: 13px; padding: 8px 16px;">Primary</span>`:h`<button
|
|
1498
1530
|
class="setup-button danger"
|
|
1499
1531
|
style="padding: 8px 16px; font-size: 13px;"
|
|
1500
1532
|
?disabled=${t.saving}
|
|
@@ -1503,14 +1535,14 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1503
1535
|
Remove
|
|
1504
1536
|
</button>`}
|
|
1505
1537
|
</div>
|
|
1506
|
-
`}function
|
|
1538
|
+
`}function rf(e){if(!e.connected)return h`
|
|
1507
1539
|
<div class="setup-container">
|
|
1508
1540
|
<div class="setup-card">
|
|
1509
1541
|
<div class="setup-spinner"></div>
|
|
1510
1542
|
<p>Connecting to gateway...</p>
|
|
1511
1543
|
</div>
|
|
1512
1544
|
</div>
|
|
1513
|
-
`;const t=n=>{n.preventDefault(),e.newPhone.trim()&&e.onAdd(e.newPhone)};return
|
|
1545
|
+
`;const t=n=>{n.preventDefault(),e.newPhone.trim()&&e.onAdd(e.newPhone)};return h`
|
|
1514
1546
|
<div class="setup-container">
|
|
1515
1547
|
${ut("Admins",e.wsProps)}
|
|
1516
1548
|
<div class="setup-card" style="max-width: 520px;">
|
|
@@ -1530,7 +1562,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1530
1562
|
</button>
|
|
1531
1563
|
</div>
|
|
1532
1564
|
|
|
1533
|
-
${e.error?
|
|
1565
|
+
${e.error?h`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:k}
|
|
1534
1566
|
|
|
1535
1567
|
<form style="display: flex; flex-direction: row; gap: 12px; margin-top: 20px; align-items: stretch;" @submit=${t}>
|
|
1536
1568
|
<input
|
|
@@ -1552,7 +1584,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1552
1584
|
</form>
|
|
1553
1585
|
|
|
1554
1586
|
<div class="sp-list" style="margin-top: 20px;">
|
|
1555
|
-
${e.phones.length===0?
|
|
1587
|
+
${e.phones.length===0?h`<div class="sp-list-empty">No admin phones configured yet.</div>`:e.phones.map(n=>sf(n,e))}
|
|
1556
1588
|
</div>
|
|
1557
1589
|
|
|
1558
1590
|
<div class="setup-hint" style="margin-top: 20px; padding: 14px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; text-align: left;">
|
|
@@ -1563,9 +1595,9 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1563
1595
|
|
|
1564
1596
|
</div>
|
|
1565
1597
|
</div>
|
|
1566
|
-
`}function
|
|
1598
|
+
`}function of(e){return Object.keys(e.fields).length}function af(e,t){const n=Object.entries(e.fields);return h`
|
|
1567
1599
|
<div class="customers-record-fields">
|
|
1568
|
-
${n.length===0?
|
|
1600
|
+
${n.length===0?h`<div style="color: rgba(255,255,255,0.4); font-size: 13px; margin-top: 12px;">No fields yet. Add one below.</div>`:n.map(([i,s])=>h`
|
|
1569
1601
|
<div class="customers-field-row">
|
|
1570
1602
|
<input
|
|
1571
1603
|
class="field-key"
|
|
@@ -1610,7 +1642,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1610
1642
|
</button>
|
|
1611
1643
|
</div>
|
|
1612
1644
|
</div>
|
|
1613
|
-
`}function
|
|
1645
|
+
`}function lf(e,t){const n=t.editingId===e.id,i=of(e),s=i===0?"No fields":`${i} field${i>1?"s":""}`;return h`
|
|
1614
1646
|
<div class="customers-record">
|
|
1615
1647
|
<div
|
|
1616
1648
|
class="customers-record-header"
|
|
@@ -1622,16 +1654,16 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1622
1654
|
</div>
|
|
1623
1655
|
<span class="customers-record-meta">${s}</span>
|
|
1624
1656
|
</div>
|
|
1625
|
-
${n?
|
|
1657
|
+
${n?af(e,t):k}
|
|
1626
1658
|
</div>
|
|
1627
|
-
`}function
|
|
1659
|
+
`}function cf(e){if(!e.connected)return h`
|
|
1628
1660
|
<div class="setup-container">
|
|
1629
1661
|
<div class="setup-card">
|
|
1630
1662
|
<div class="setup-spinner"></div>
|
|
1631
1663
|
<p>Connecting to gateway...</p>
|
|
1632
1664
|
</div>
|
|
1633
1665
|
</div>
|
|
1634
|
-
`;const t=i=>{i.preventDefault(),e.onSearchSubmit()},n=i=>{i.preventDefault(),e.newRecordPhone.trim()&&e.newRecordName.trim()&&e.onAdd(e.newRecordPhone,e.newRecordName)};return
|
|
1666
|
+
`;const t=i=>{i.preventDefault(),e.onSearchSubmit()},n=i=>{i.preventDefault(),e.newRecordPhone.trim()&&e.newRecordName.trim()&&e.onAdd(e.newRecordPhone,e.newRecordName)};return h`
|
|
1635
1667
|
<div class="setup-container">
|
|
1636
1668
|
${ut("Customers",e.wsProps)}
|
|
1637
1669
|
<div class="setup-card" style="max-width: 620px;">
|
|
@@ -1658,9 +1690,9 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1658
1690
|
</button>
|
|
1659
1691
|
</div>
|
|
1660
1692
|
|
|
1661
|
-
${e.error?
|
|
1693
|
+
${e.error?h`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:k}
|
|
1662
1694
|
|
|
1663
|
-
${e.showAddForm?
|
|
1695
|
+
${e.showAddForm?h`
|
|
1664
1696
|
<form class="customers-add-form" @submit=${n}>
|
|
1665
1697
|
<input
|
|
1666
1698
|
type="tel"
|
|
@@ -1718,9 +1750,9 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1718
1750
|
</form>
|
|
1719
1751
|
|
|
1720
1752
|
<div style="margin-top: 16px;">
|
|
1721
|
-
${e.records.length===0?
|
|
1753
|
+
${e.records.length===0?h`<div class="customers-empty">
|
|
1722
1754
|
${e.searchQuery.trim()?`No records matching "${e.searchQuery}".`:"No customer records yet. Add one to get started."}
|
|
1723
|
-
</div>`:e.records.map(i=>
|
|
1755
|
+
</div>`:e.records.map(i=>lf(i,e))}
|
|
1724
1756
|
</div>
|
|
1725
1757
|
|
|
1726
1758
|
<div class="setup-hint" style="margin-top: 20px; padding: 14px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; text-align: left;">
|
|
@@ -1731,33 +1763,33 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=nn(t.messa
|
|
|
1731
1763
|
</div>
|
|
1732
1764
|
</div>
|
|
1733
1765
|
</div>
|
|
1734
|
-
`}const fc={CHILD:2},gc=e=>(...t)=>({_$litDirective$:e,values:t});let mc=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,i){this._$Ct=t,this._$AM=n,this._$Ci=i}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:lf}=Zu,Zo=e=>e,Jo=()=>document.createComment(""),Ut=(e,t,n)=>{var r;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=i.insertBefore(Jo(),s),a=i.insertBefore(Jo(),s);n=new lf(o,a,e,e.options)}else{const o=n._$AB.nextSibling,a=n._$AM,l=a!==e;if(l){let c;(r=n._$AQ)==null||r.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==a._$AU&&n._$AP(c)}if(o!==s||l){let c=n._$AA;for(;c!==o;){const u=Zo(c).nextSibling;Zo(i).insertBefore(c,s),c=u}}}return n},Ye=(e,t,n=e)=>(e._$AI(t,n),e),cf={},uf=(e,t=cf)=>e._$AH=t,df=e=>e._$AH,ts=e=>{e._$AR(),e._$AA.remove()};const ea=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},pf=gc(class extends mc{constructor(e){if(super(e),e.type!==fc.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;n===void 0?n=t:t!==void 0&&(i=t);const s=[],r=[];let o=0;for(const a of e)s[o]=i?i(a,o):o,r[o]=n(a,o),o++;return{values:r,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=df(e),{values:r,keys:o}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=o,r;const a=this.ut??(this.ut=[]),l=[];let c,u,f=0,d=s.length-1,h=0,w=r.length-1;for(;f<=d&&h<=w;)if(s[f]===null)f++;else if(s[d]===null)d--;else if(a[f]===o[h])l[h]=Ye(s[f],r[h]),f++,h++;else if(a[d]===o[w])l[w]=Ye(s[d],r[w]),d--,w--;else if(a[f]===o[w])l[w]=Ye(s[f],r[w]),Ut(e,l[w+1],s[f]),f++,w--;else if(a[d]===o[h])l[h]=Ye(s[d],r[h]),Ut(e,s[f],s[d]),d--,h++;else if(c===void 0&&(c=ea(o,h,w),u=ea(a,f,d)),c.has(a[f]))if(c.has(a[d])){const b=u.get(o[h]),S=b!==void 0?s[b]:null;if(S===null){const T=Ut(e,s[f]);Ye(T,r[h]),l[h]=T}else l[h]=Ye(S,r[h]),Ut(e,s[f],S),s[b]=null;h++}else ts(s[d]),d--;else ts(s[f]),f++;for(;h<=w;){const b=Ut(e,l[w+1]);Ye(b,r[h]),l[h++]=b}for(;f<=d;){const b=s[f++];b!==null&&ts(b)}return this.ut=o,uf(e,l),Ke}});class Is extends mc{constructor(t){if(super(t),this.it=k,t.type!==fc.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===k||t==null)return this._t=void 0,this.it=t;if(t===Ke)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:[]}}}Is.directiveName="unsafeHTML",Is.resultType=1;const ai=gc(Is);const{entries:yc,setPrototypeOf:ta,isFrozen:hf,getPrototypeOf:ff,getOwnPropertyDescriptor:gf}=Object;let{freeze:ce,seal:he,create:Rs}=Object,{apply:Ns,construct:Ds}=typeof Reflect<"u"&&Reflect;ce||(ce=function(t){return t});he||(he=function(t){return t});Ns||(Ns=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r<i;r++)s[r-2]=arguments[r];return t.apply(n,s)});Ds||(Ds=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const On=ue(Array.prototype.forEach),mf=ue(Array.prototype.lastIndexOf),na=ue(Array.prototype.pop),Wt=ue(Array.prototype.push),yf=ue(Array.prototype.splice),Vn=ue(String.prototype.toLowerCase),ns=ue(String.prototype.toString),is=ue(String.prototype.match),Kt=ue(String.prototype.replace),vf=ue(String.prototype.indexOf),bf=ue(String.prototype.trim),fe=ue(Object.prototype.hasOwnProperty),oe=ue(RegExp.prototype.test),zt=wf(TypeError);function ue(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return Ns(e,t,i)}}function wf(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Ds(e,n)}}function O(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Vn;ta&&ta(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const r=n(s);r!==s&&(hf(t)||(t[i]=r),s=r)}e[s]=!0}return e}function kf(e){for(let t=0;t<e.length;t++)fe(e,t)||(e[t]=null);return e}function Ae(e){const t=Rs(null);for(const[n,i]of yc(e))fe(e,n)&&(Array.isArray(i)?t[n]=kf(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ae(i):t[n]=i);return t}function jt(e,t){for(;e!==null;){const i=gf(e,t);if(i){if(i.get)return ue(i.get);if(typeof i.value=="function")return ue(i.value)}e=ff(e)}function n(){return null}return n}const ia=ce(["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"]),ss=ce(["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"]),rs=ce(["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"]),Sf=ce(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),os=ce(["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"]),Af=ce(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sa=ce(["#text"]),ra=ce(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),as=ce(["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=ce(["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"]),Bn=ce(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xf=he(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$f=he(/<%[\w\W]*|[\w\W]*%>/gm),Ef=he(/\$\{[\w\W]*/gm),Tf=he(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cf=he(/^aria-[\-\w]+$/),vc=he(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_f=he(/^(?:\w+script|data):/i),Mf=he(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bc=he(/^html$/i),Pf=he(/^[a-z][.\w]*(-[.\w]+)+$/i);var aa=Object.freeze({__proto__:null,ARIA_ATTR:Cf,ATTR_WHITESPACE:Mf,CUSTOM_ELEMENT:Pf,DATA_ATTR:Tf,DOCTYPE_NAME:bc,ERB_EXPR:$f,IS_ALLOWED_URI:vc,IS_SCRIPT_OR_DATA:_f,MUSTACHE_EXPR:xf,TMPLIT_EXPR:Ef});const Ht={element:1,text:3,progressingInstruction:7,comment:8,document:9},Lf=function(){return typeof window>"u"?null:window},If=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},la=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function wc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lf();const t=L=>wc(L);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ht.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:d,trustedTypes:h}=e,w=l.prototype,b=jt(w,"cloneNode"),S=jt(w,"remove"),T=jt(w,"nextSibling"),x=jt(w,"childNodes"),E=jt(w,"parentNode");if(typeof o=="function"){const L=n.createElement("template");L.content&&L.content.ownerDocument&&(n=L.content.ownerDocument)}let C,I="";const{implementation:U,createNodeIterator:Q,createDocumentFragment:He,getElementsByTagName:Rt}=n,{importNode:bn}=i;let J=la();t.isSupported=typeof yc=="function"&&typeof E=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Nt,ERB_EXPR:ht,TMPLIT_EXPR:qe,DATA_ATTR:Mi,ARIA_ATTR:Pi,IS_SCRIPT_OR_DATA:Li,ATTR_WHITESPACE:wn,CUSTOM_ELEMENT:Ii}=aa;let{IS_ALLOWED_URI:kn}=aa,G=null;const Sn=O({},[...ia,...ss,...rs,...os,...sa]);let V=null;const An=O({},[...ra,...as,...oa,...Bn]);let j=Object.seal(Rs(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}})),Ge=null,Dt=null;const De=Object.seal(Rs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let xn=!0,A=!0,_=!1,R=!0,N=!1,H=!0,K=!1,re=!1,Oe=!1,ft=!1,$n=!1,En=!1,Hr=!0,qr=!1;const ku="user-content-";let Ri=!0,Ot=!1,gt={},be=null;const Ni=O({},["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 Gr=null;const Vr=O({},["audio","video","img","source","image","track"]);let Di=null;const Qr=O({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Tn="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",Ce="http://www.w3.org/1999/xhtml";let mt=Ce,Oi=!1,Bi=null;const Su=O({},[Tn,Cn,Ce],ns);let _n=O({},["mi","mo","mn","ms","mtext"]),Mn=O({},["annotation-xml"]);const Au=O({},["title","style","font","a","script"]);let Bt=null;const xu=["application/xhtml+xml","text/html"],$u="text/html";let X=null,yt=null;const Eu=n.createElement("form"),Yr=function(v){return v instanceof RegExp||v instanceof Function},Fi=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(yt&&yt===v)){if((!v||typeof v!="object")&&(v={}),v=Ae(v),Bt=xu.indexOf(v.PARSER_MEDIA_TYPE)===-1?$u:v.PARSER_MEDIA_TYPE,X=Bt==="application/xhtml+xml"?ns:Vn,G=fe(v,"ALLOWED_TAGS")?O({},v.ALLOWED_TAGS,X):Sn,V=fe(v,"ALLOWED_ATTR")?O({},v.ALLOWED_ATTR,X):An,Bi=fe(v,"ALLOWED_NAMESPACES")?O({},v.ALLOWED_NAMESPACES,ns):Su,Di=fe(v,"ADD_URI_SAFE_ATTR")?O(Ae(Qr),v.ADD_URI_SAFE_ATTR,X):Qr,Gr=fe(v,"ADD_DATA_URI_TAGS")?O(Ae(Vr),v.ADD_DATA_URI_TAGS,X):Vr,be=fe(v,"FORBID_CONTENTS")?O({},v.FORBID_CONTENTS,X):Ni,Ge=fe(v,"FORBID_TAGS")?O({},v.FORBID_TAGS,X):Ae({}),Dt=fe(v,"FORBID_ATTR")?O({},v.FORBID_ATTR,X):Ae({}),gt=fe(v,"USE_PROFILES")?v.USE_PROFILES:!1,xn=v.ALLOW_ARIA_ATTR!==!1,A=v.ALLOW_DATA_ATTR!==!1,_=v.ALLOW_UNKNOWN_PROTOCOLS||!1,R=v.ALLOW_SELF_CLOSE_IN_ATTR!==!1,N=v.SAFE_FOR_TEMPLATES||!1,H=v.SAFE_FOR_XML!==!1,K=v.WHOLE_DOCUMENT||!1,ft=v.RETURN_DOM||!1,$n=v.RETURN_DOM_FRAGMENT||!1,En=v.RETURN_TRUSTED_TYPE||!1,Oe=v.FORCE_BODY||!1,Hr=v.SANITIZE_DOM!==!1,qr=v.SANITIZE_NAMED_PROPS||!1,Ri=v.KEEP_CONTENT!==!1,Ot=v.IN_PLACE||!1,kn=v.ALLOWED_URI_REGEXP||vc,mt=v.NAMESPACE||Ce,_n=v.MATHML_TEXT_INTEGRATION_POINTS||_n,Mn=v.HTML_INTEGRATION_POINTS||Mn,j=v.CUSTOM_ELEMENT_HANDLING||{},v.CUSTOM_ELEMENT_HANDLING&&Yr(v.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=v.CUSTOM_ELEMENT_HANDLING.tagNameCheck),v.CUSTOM_ELEMENT_HANDLING&&Yr(v.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=v.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),v.CUSTOM_ELEMENT_HANDLING&&typeof v.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(j.allowCustomizedBuiltInElements=v.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),N&&(A=!1),$n&&(ft=!0),gt&&(G=O({},sa),V=[],gt.html===!0&&(O(G,ia),O(V,ra)),gt.svg===!0&&(O(G,ss),O(V,as),O(V,Bn)),gt.svgFilters===!0&&(O(G,rs),O(V,as),O(V,Bn)),gt.mathMl===!0&&(O(G,os),O(V,oa),O(V,Bn))),v.ADD_TAGS&&(typeof v.ADD_TAGS=="function"?De.tagCheck=v.ADD_TAGS:(G===Sn&&(G=Ae(G)),O(G,v.ADD_TAGS,X))),v.ADD_ATTR&&(typeof v.ADD_ATTR=="function"?De.attributeCheck=v.ADD_ATTR:(V===An&&(V=Ae(V)),O(V,v.ADD_ATTR,X))),v.ADD_URI_SAFE_ATTR&&O(Di,v.ADD_URI_SAFE_ATTR,X),v.FORBID_CONTENTS&&(be===Ni&&(be=Ae(be)),O(be,v.FORBID_CONTENTS,X)),v.ADD_FORBID_CONTENTS&&(be===Ni&&(be=Ae(be)),O(be,v.ADD_FORBID_CONTENTS,X)),Ri&&(G["#text"]=!0),K&&O(G,["html","head","body"]),G.table&&(O(G,["tbody"]),delete Ge.tbody),v.TRUSTED_TYPES_POLICY){if(typeof v.TRUSTED_TYPES_POLICY.createHTML!="function")throw zt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof v.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=v.TRUSTED_TYPES_POLICY,I=C.createHTML("")}else C===void 0&&(C=If(h,s)),C!==null&&typeof I=="string"&&(I=C.createHTML(""));ce&&ce(v),yt=v}},Xr=O({},[...ss,...rs,...Sf]),Zr=O({},[...os,...Af]),Tu=function(v){let $=E(v);(!$||!$.tagName)&&($={namespaceURI:mt,tagName:"template"});const P=Vn(v.tagName),z=Vn($.tagName);return Bi[v.namespaceURI]?v.namespaceURI===Cn?$.namespaceURI===Ce?P==="svg":$.namespaceURI===Tn?P==="svg"&&(z==="annotation-xml"||_n[z]):!!Xr[P]:v.namespaceURI===Tn?$.namespaceURI===Ce?P==="math":$.namespaceURI===Cn?P==="math"&&Mn[z]:!!Zr[P]:v.namespaceURI===Ce?$.namespaceURI===Cn&&!Mn[z]||$.namespaceURI===Tn&&!_n[z]?!1:!Zr[P]&&(Au[P]||!Xr[P]):!!(Bt==="application/xhtml+xml"&&Bi[v.namespaceURI]):!1},we=function(v){Wt(t.removed,{element:v});try{E(v).removeChild(v)}catch{S(v)}},Ve=function(v,$){try{Wt(t.removed,{attribute:$.getAttributeNode(v),from:$})}catch{Wt(t.removed,{attribute:null,from:$})}if($.removeAttribute(v),v==="is")if(ft||$n)try{we($)}catch{}else try{$.setAttribute(v,"")}catch{}},Jr=function(v){let $=null,P=null;if(Oe)v="<remove></remove>"+v;else{const Y=is(v,/^[\r\n\t ]+/);P=Y&&Y[0]}Bt==="application/xhtml+xml"&&mt===Ce&&(v='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+v+"</body></html>");const z=C?C.createHTML(v):v;if(mt===Ce)try{$=new d().parseFromString(z,Bt)}catch{}if(!$||!$.documentElement){$=U.createDocument(mt,"template",null);try{$.documentElement.innerHTML=Oi?I:z}catch{}}const te=$.body||$.documentElement;return v&&P&&te.insertBefore(n.createTextNode(P),te.childNodes[0]||null),mt===Ce?Rt.call($,K?"html":"body")[0]:K?$.documentElement:te},eo=function(v){return Q.call(v.ownerDocument||v,v,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ui=function(v){return v instanceof f&&(typeof v.nodeName!="string"||typeof v.textContent!="string"||typeof v.removeChild!="function"||!(v.attributes instanceof u)||typeof v.removeAttribute!="function"||typeof v.setAttribute!="function"||typeof v.namespaceURI!="string"||typeof v.insertBefore!="function"||typeof v.hasChildNodes!="function")},to=function(v){return typeof a=="function"&&v instanceof a};function _e(L,v,$){On(L,P=>{P.call(t,v,$,yt)})}const no=function(v){let $=null;if(_e(J.beforeSanitizeElements,v,null),Ui(v))return we(v),!0;const P=X(v.nodeName);if(_e(J.uponSanitizeElement,v,{tagName:P,allowedTags:G}),H&&v.hasChildNodes()&&!to(v.firstElementChild)&&oe(/<[/\w!]/g,v.innerHTML)&&oe(/<[/\w!]/g,v.textContent)||v.nodeType===Ht.progressingInstruction||H&&v.nodeType===Ht.comment&&oe(/<[/\w]/g,v.data))return we(v),!0;if(!(De.tagCheck instanceof Function&&De.tagCheck(P))&&(!G[P]||Ge[P])){if(!Ge[P]&&so(P)&&(j.tagNameCheck instanceof RegExp&&oe(j.tagNameCheck,P)||j.tagNameCheck instanceof Function&&j.tagNameCheck(P)))return!1;if(Ri&&!be[P]){const z=E(v)||v.parentNode,te=x(v)||v.childNodes;if(te&&z){const Y=te.length;for(let de=Y-1;de>=0;--de){const Me=b(te[de],!0);Me.__removalCount=(v.__removalCount||0)+1,z.insertBefore(Me,T(v))}}}return we(v),!0}return v instanceof l&&!Tu(v)||(P==="noscript"||P==="noembed"||P==="noframes")&&oe(/<\/no(script|embed|frames)/i,v.innerHTML)?(we(v),!0):(N&&v.nodeType===Ht.text&&($=v.textContent,On([Nt,ht,qe],z=>{$=Kt($,z," ")}),v.textContent!==$&&(Wt(t.removed,{element:v.cloneNode()}),v.textContent=$)),_e(J.afterSanitizeElements,v,null),!1)},io=function(v,$,P){if(Hr&&($==="id"||$==="name")&&(P in n||P in Eu))return!1;if(!(A&&!Dt[$]&&oe(Mi,$))){if(!(xn&&oe(Pi,$))){if(!(De.attributeCheck instanceof Function&&De.attributeCheck($,v))){if(!V[$]||Dt[$]){if(!(so(v)&&(j.tagNameCheck instanceof RegExp&&oe(j.tagNameCheck,v)||j.tagNameCheck instanceof Function&&j.tagNameCheck(v))&&(j.attributeNameCheck instanceof RegExp&&oe(j.attributeNameCheck,$)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck($,v))||$==="is"&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&oe(j.tagNameCheck,P)||j.tagNameCheck instanceof Function&&j.tagNameCheck(P))))return!1}else if(!Di[$]){if(!oe(kn,Kt(P,wn,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&v!=="script"&&vf(P,"data:")===0&&Gr[v])){if(!(_&&!oe(Li,Kt(P,wn,"")))){if(P)return!1}}}}}}}return!0},so=function(v){return v!=="annotation-xml"&&is(v,Ii)},ro=function(v){_e(J.beforeSanitizeAttributes,v,null);const{attributes:$}=v;if(!$||Ui(v))return;const P={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0};let z=$.length;for(;z--;){const te=$[z],{name:Y,namespaceURI:de,value:Me}=te,vt=X(Y),Wi=Me;let ee=Y==="value"?Wi:bf(Wi);if(P.attrName=vt,P.attrValue=ee,P.keepAttr=!0,P.forceKeepAttr=void 0,_e(J.uponSanitizeAttribute,v,P),ee=P.attrValue,qr&&(vt==="id"||vt==="name")&&(Ve(Y,v),ee=ku+ee),H&&oe(/((--!?|])>)|<\/(style|title|textarea)/i,ee)){Ve(Y,v);continue}if(vt==="attributename"&&is(ee,"href")){Ve(Y,v);continue}if(P.forceKeepAttr)continue;if(!P.keepAttr){Ve(Y,v);continue}if(!R&&oe(/\/>/i,ee)){Ve(Y,v);continue}N&&On([Nt,ht,qe],ao=>{ee=Kt(ee,ao," ")});const oo=X(v.nodeName);if(!io(oo,vt,ee)){Ve(Y,v);continue}if(C&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!de)switch(h.getAttributeType(oo,vt)){case"TrustedHTML":{ee=C.createHTML(ee);break}case"TrustedScriptURL":{ee=C.createScriptURL(ee);break}}if(ee!==Wi)try{de?v.setAttributeNS(de,Y,ee):v.setAttribute(Y,ee),Ui(v)?we(v):na(t.removed)}catch{Ve(Y,v)}}_e(J.afterSanitizeAttributes,v,null)},Cu=function L(v){let $=null;const P=eo(v);for(_e(J.beforeSanitizeShadowDOM,v,null);$=P.nextNode();)_e(J.uponSanitizeShadowNode,$,null),no($),ro($),$.content instanceof r&&L($.content);_e(J.afterSanitizeShadowDOM,v,null)};return t.sanitize=function(L){let v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,P=null,z=null,te=null;if(Oi=!L,Oi&&(L="<!-->"),typeof L!="string"&&!to(L))if(typeof L.toString=="function"){if(L=L.toString(),typeof L!="string")throw zt("dirty is not a string, aborting")}else throw zt("toString is not a function");if(!t.isSupported)return L;if(re||Fi(v),t.removed=[],typeof L=="string"&&(Ot=!1),Ot){if(L.nodeName){const Me=X(L.nodeName);if(!G[Me]||Ge[Me])throw zt("root node is forbidden and cannot be sanitized in-place")}}else if(L instanceof a)$=Jr("<!---->"),P=$.ownerDocument.importNode(L,!0),P.nodeType===Ht.element&&P.nodeName==="BODY"||P.nodeName==="HTML"?$=P:$.appendChild(P);else{if(!ft&&!N&&!K&&L.indexOf("<")===-1)return C&&En?C.createHTML(L):L;if($=Jr(L),!$)return ft?null:En?I:""}$&&Oe&&we($.firstChild);const Y=eo(Ot?L:$);for(;z=Y.nextNode();)no(z),ro(z),z.content instanceof r&&Cu(z.content);if(Ot)return L;if(ft){if($n)for(te=He.call($.ownerDocument);$.firstChild;)te.appendChild($.firstChild);else te=$;return(V.shadowroot||V.shadowrootmode)&&(te=bn.call(i,te,!0)),te}let de=K?$.outerHTML:$.innerHTML;return K&&G["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&oe(bc,$.ownerDocument.doctype.name)&&(de="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
|
|
1735
|
-
`+de),N&&On([Nt,ht,qe],Me=>{de=Kt(de,Me," ")}),C&&En?C.createHTML(de):de},t.setConfig=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fi(L),re=!0},t.clearConfig=function(){yt=null,re=!1},t.isValidAttribute=function(L,v
|
|
1736
|
-
]`).replace("lheading"
|
|
1766
|
+
`}const gc={CHILD:2},mc=e=>(...t)=>({_$litDirective$:e,values:t});let yc=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,i){this._$Ct=t,this._$AM=n,this._$Ci=i}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:uf}=Ju,Jo=e=>e,ea=()=>document.createComment(""),Ut=(e,t,n)=>{var r;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=i.insertBefore(ea(),s),a=i.insertBefore(ea(),s);n=new uf(o,a,e,e.options)}else{const o=n._$AB.nextSibling,a=n._$AM,l=a!==e;if(l){let c;(r=n._$AQ)==null||r.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==a._$AU&&n._$AP(c)}if(o!==s||l){let c=n._$AA;for(;c!==o;){const u=Jo(c).nextSibling;Jo(i).insertBefore(c,s),c=u}}}return n},Ye=(e,t,n=e)=>(e._$AI(t,n),e),df={},pf=(e,t=df)=>e._$AH=t,hf=e=>e._$AH,ts=e=>{e._$AR(),e._$AA.remove()};const ta=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},ff=mc(class extends yc{constructor(e){if(super(e),e.type!==gc.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;n===void 0?n=t:t!==void 0&&(i=t);const s=[],r=[];let o=0;for(const a of e)s[o]=i?i(a,o):o,r[o]=n(a,o),o++;return{values:r,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=hf(e),{values:r,keys:o}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=o,r;const a=this.ut??(this.ut=[]),l=[];let c,u,f=0,d=s.length-1,p=0,w=r.length-1;for(;f<=d&&p<=w;)if(s[f]===null)f++;else if(s[d]===null)d--;else if(a[f]===o[p])l[p]=Ye(s[f],r[p]),f++,p++;else if(a[d]===o[w])l[w]=Ye(s[d],r[w]),d--,w--;else if(a[f]===o[w])l[w]=Ye(s[f],r[w]),Ut(e,l[w+1],s[f]),f++,w--;else if(a[d]===o[p])l[p]=Ye(s[d],r[p]),Ut(e,s[f],s[d]),d--,p++;else if(c===void 0&&(c=ta(o,p,w),u=ta(a,f,d)),c.has(a[f]))if(c.has(a[d])){const b=u.get(o[p]),S=b!==void 0?s[b]:null;if(S===null){const T=Ut(e,s[f]);Ye(T,r[p]),l[p]=T}else l[p]=Ye(S,r[p]),Ut(e,s[f],S),s[b]=null;p++}else ts(s[d]),d--;else ts(s[f]),f++;for(;p<=w;){const b=Ut(e,l[w+1]);Ye(b,r[p]),l[p++]=b}for(;f<=d;){const b=s[f++];b!==null&&ts(b)}return this.ut=o,pf(e,l),Ke}});class Is extends yc{constructor(t){if(super(t),this.it=k,t.type!==gc.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===k||t==null)return this._t=void 0,this.it=t;if(t===Ke)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:[]}}}Is.directiveName="unsafeHTML",Is.resultType=1;const ai=mc(Is);const{entries:vc,setPrototypeOf:na,isFrozen:gf,getPrototypeOf:mf,getOwnPropertyDescriptor:yf}=Object;let{freeze:ce,seal:he,create:Rs}=Object,{apply:Ns,construct:Ds}=typeof Reflect<"u"&&Reflect;ce||(ce=function(t){return t});he||(he=function(t){return t});Ns||(Ns=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r<i;r++)s[r-2]=arguments[r];return t.apply(n,s)});Ds||(Ds=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const On=ue(Array.prototype.forEach),vf=ue(Array.prototype.lastIndexOf),ia=ue(Array.prototype.pop),Wt=ue(Array.prototype.push),bf=ue(Array.prototype.splice),Gn=ue(String.prototype.toLowerCase),ns=ue(String.prototype.toString),is=ue(String.prototype.match),Kt=ue(String.prototype.replace),wf=ue(String.prototype.indexOf),kf=ue(String.prototype.trim),fe=ue(Object.prototype.hasOwnProperty),oe=ue(RegExp.prototype.test),zt=Sf(TypeError);function ue(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return Ns(e,t,i)}}function Sf(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Ds(e,n)}}function O(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Gn;na&&na(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const r=n(s);r!==s&&(gf(t)||(t[i]=r),s=r)}e[s]=!0}return e}function Af(e){for(let t=0;t<e.length;t++)fe(e,t)||(e[t]=null);return e}function Ae(e){const t=Rs(null);for(const[n,i]of vc(e))fe(e,n)&&(Array.isArray(i)?t[n]=Af(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ae(i):t[n]=i);return t}function jt(e,t){for(;e!==null;){const i=yf(e,t);if(i){if(i.get)return ue(i.get);if(typeof i.value=="function")return ue(i.value)}e=mf(e)}function n(){return null}return n}const sa=ce(["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"]),ss=ce(["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"]),rs=ce(["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"]),$f=ce(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),os=ce(["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"]),xf=ce(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ra=ce(["#text"]),oa=ce(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),as=ce(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),aa=ce(["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"]),Bn=ce(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ef=he(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Tf=he(/<%[\w\W]*|[\w\W]*%>/gm),Cf=he(/\$\{[\w\W]*/gm),_f=he(/^data-[\-\w.\u00B7-\uFFFF]+$/),Mf=he(/^aria-[\-\w]+$/),bc=he(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pf=he(/^(?:\w+script|data):/i),Lf=he(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wc=he(/^html$/i),If=he(/^[a-z][.\w]*(-[.\w]+)+$/i);var la=Object.freeze({__proto__:null,ARIA_ATTR:Mf,ATTR_WHITESPACE:Lf,CUSTOM_ELEMENT:If,DATA_ATTR:_f,DOCTYPE_NAME:wc,ERB_EXPR:Tf,IS_ALLOWED_URI:bc,IS_SCRIPT_OR_DATA:Pf,MUSTACHE_EXPR:Ef,TMPLIT_EXPR:Cf});const Ht={element:1,text:3,progressingInstruction:7,comment:8,document:9},Rf=function(){return typeof window>"u"?null:window},Nf=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},ca=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function kc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Rf();const t=L=>kc(L);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ht.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:d,trustedTypes:p}=e,w=l.prototype,b=jt(w,"cloneNode"),S=jt(w,"remove"),T=jt(w,"nextSibling"),$=jt(w,"childNodes"),E=jt(w,"parentNode");if(typeof o=="function"){const L=n.createElement("template");L.content&&L.content.ownerDocument&&(n=L.content.ownerDocument)}let C,I="";const{implementation:U,createNodeIterator:Q,createDocumentFragment:He,getElementsByTagName:Rt}=n,{importNode:bn}=i;let J=ca();t.isSupported=typeof vc=="function"&&typeof E=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Nt,ERB_EXPR:ht,TMPLIT_EXPR:qe,DATA_ATTR:Mi,ARIA_ATTR:Pi,IS_SCRIPT_OR_DATA:Li,ATTR_WHITESPACE:wn,CUSTOM_ELEMENT:Ii}=la;let{IS_ALLOWED_URI:kn}=la,V=null;const Sn=O({},[...sa,...ss,...rs,...os,...ra]);let G=null;const An=O({},[...oa,...as,...aa,...Bn]);let j=Object.seal(Rs(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}})),Ve=null,Dt=null;const De=Object.seal(Rs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $n=!0,A=!0,_=!1,R=!0,N=!1,H=!0,K=!1,re=!1,Oe=!1,ft=!1,xn=!1,En=!1,Hr=!0,qr=!1;const Su="user-content-";let Ri=!0,Ot=!1,gt={},be=null;const Ni=O({},["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 Vr=null;const Gr=O({},["audio","video","img","source","image","track"]);let Di=null;const Qr=O({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Tn="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",Ce="http://www.w3.org/1999/xhtml";let mt=Ce,Oi=!1,Bi=null;const Au=O({},[Tn,Cn,Ce],ns);let _n=O({},["mi","mo","mn","ms","mtext"]),Mn=O({},["annotation-xml"]);const $u=O({},["title","style","font","a","script"]);let Bt=null;const xu=["application/xhtml+xml","text/html"],Eu="text/html";let X=null,yt=null;const Tu=n.createElement("form"),Yr=function(v){return v instanceof RegExp||v instanceof Function},Fi=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(yt&&yt===v)){if((!v||typeof v!="object")&&(v={}),v=Ae(v),Bt=xu.indexOf(v.PARSER_MEDIA_TYPE)===-1?Eu:v.PARSER_MEDIA_TYPE,X=Bt==="application/xhtml+xml"?ns:Gn,V=fe(v,"ALLOWED_TAGS")?O({},v.ALLOWED_TAGS,X):Sn,G=fe(v,"ALLOWED_ATTR")?O({},v.ALLOWED_ATTR,X):An,Bi=fe(v,"ALLOWED_NAMESPACES")?O({},v.ALLOWED_NAMESPACES,ns):Au,Di=fe(v,"ADD_URI_SAFE_ATTR")?O(Ae(Qr),v.ADD_URI_SAFE_ATTR,X):Qr,Vr=fe(v,"ADD_DATA_URI_TAGS")?O(Ae(Gr),v.ADD_DATA_URI_TAGS,X):Gr,be=fe(v,"FORBID_CONTENTS")?O({},v.FORBID_CONTENTS,X):Ni,Ve=fe(v,"FORBID_TAGS")?O({},v.FORBID_TAGS,X):Ae({}),Dt=fe(v,"FORBID_ATTR")?O({},v.FORBID_ATTR,X):Ae({}),gt=fe(v,"USE_PROFILES")?v.USE_PROFILES:!1,$n=v.ALLOW_ARIA_ATTR!==!1,A=v.ALLOW_DATA_ATTR!==!1,_=v.ALLOW_UNKNOWN_PROTOCOLS||!1,R=v.ALLOW_SELF_CLOSE_IN_ATTR!==!1,N=v.SAFE_FOR_TEMPLATES||!1,H=v.SAFE_FOR_XML!==!1,K=v.WHOLE_DOCUMENT||!1,ft=v.RETURN_DOM||!1,xn=v.RETURN_DOM_FRAGMENT||!1,En=v.RETURN_TRUSTED_TYPE||!1,Oe=v.FORCE_BODY||!1,Hr=v.SANITIZE_DOM!==!1,qr=v.SANITIZE_NAMED_PROPS||!1,Ri=v.KEEP_CONTENT!==!1,Ot=v.IN_PLACE||!1,kn=v.ALLOWED_URI_REGEXP||bc,mt=v.NAMESPACE||Ce,_n=v.MATHML_TEXT_INTEGRATION_POINTS||_n,Mn=v.HTML_INTEGRATION_POINTS||Mn,j=v.CUSTOM_ELEMENT_HANDLING||{},v.CUSTOM_ELEMENT_HANDLING&&Yr(v.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=v.CUSTOM_ELEMENT_HANDLING.tagNameCheck),v.CUSTOM_ELEMENT_HANDLING&&Yr(v.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=v.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),v.CUSTOM_ELEMENT_HANDLING&&typeof v.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(j.allowCustomizedBuiltInElements=v.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),N&&(A=!1),xn&&(ft=!0),gt&&(V=O({},ra),G=[],gt.html===!0&&(O(V,sa),O(G,oa)),gt.svg===!0&&(O(V,ss),O(G,as),O(G,Bn)),gt.svgFilters===!0&&(O(V,rs),O(G,as),O(G,Bn)),gt.mathMl===!0&&(O(V,os),O(G,aa),O(G,Bn))),v.ADD_TAGS&&(typeof v.ADD_TAGS=="function"?De.tagCheck=v.ADD_TAGS:(V===Sn&&(V=Ae(V)),O(V,v.ADD_TAGS,X))),v.ADD_ATTR&&(typeof v.ADD_ATTR=="function"?De.attributeCheck=v.ADD_ATTR:(G===An&&(G=Ae(G)),O(G,v.ADD_ATTR,X))),v.ADD_URI_SAFE_ATTR&&O(Di,v.ADD_URI_SAFE_ATTR,X),v.FORBID_CONTENTS&&(be===Ni&&(be=Ae(be)),O(be,v.FORBID_CONTENTS,X)),v.ADD_FORBID_CONTENTS&&(be===Ni&&(be=Ae(be)),O(be,v.ADD_FORBID_CONTENTS,X)),Ri&&(V["#text"]=!0),K&&O(V,["html","head","body"]),V.table&&(O(V,["tbody"]),delete Ve.tbody),v.TRUSTED_TYPES_POLICY){if(typeof v.TRUSTED_TYPES_POLICY.createHTML!="function")throw zt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof v.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=v.TRUSTED_TYPES_POLICY,I=C.createHTML("")}else C===void 0&&(C=Nf(p,s)),C!==null&&typeof I=="string"&&(I=C.createHTML(""));ce&&ce(v),yt=v}},Xr=O({},[...ss,...rs,...$f]),Zr=O({},[...os,...xf]),Cu=function(v){let x=E(v);(!x||!x.tagName)&&(x={namespaceURI:mt,tagName:"template"});const P=Gn(v.tagName),z=Gn(x.tagName);return Bi[v.namespaceURI]?v.namespaceURI===Cn?x.namespaceURI===Ce?P==="svg":x.namespaceURI===Tn?P==="svg"&&(z==="annotation-xml"||_n[z]):!!Xr[P]:v.namespaceURI===Tn?x.namespaceURI===Ce?P==="math":x.namespaceURI===Cn?P==="math"&&Mn[z]:!!Zr[P]:v.namespaceURI===Ce?x.namespaceURI===Cn&&!Mn[z]||x.namespaceURI===Tn&&!_n[z]?!1:!Zr[P]&&($u[P]||!Xr[P]):!!(Bt==="application/xhtml+xml"&&Bi[v.namespaceURI]):!1},we=function(v){Wt(t.removed,{element:v});try{E(v).removeChild(v)}catch{S(v)}},Ge=function(v,x){try{Wt(t.removed,{attribute:x.getAttributeNode(v),from:x})}catch{Wt(t.removed,{attribute:null,from:x})}if(x.removeAttribute(v),v==="is")if(ft||xn)try{we(x)}catch{}else try{x.setAttribute(v,"")}catch{}},Jr=function(v){let x=null,P=null;if(Oe)v="<remove></remove>"+v;else{const Y=is(v,/^[\r\n\t ]+/);P=Y&&Y[0]}Bt==="application/xhtml+xml"&&mt===Ce&&(v='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+v+"</body></html>");const z=C?C.createHTML(v):v;if(mt===Ce)try{x=new d().parseFromString(z,Bt)}catch{}if(!x||!x.documentElement){x=U.createDocument(mt,"template",null);try{x.documentElement.innerHTML=Oi?I:z}catch{}}const te=x.body||x.documentElement;return v&&P&&te.insertBefore(n.createTextNode(P),te.childNodes[0]||null),mt===Ce?Rt.call(x,K?"html":"body")[0]:K?x.documentElement:te},eo=function(v){return Q.call(v.ownerDocument||v,v,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ui=function(v){return v instanceof f&&(typeof v.nodeName!="string"||typeof v.textContent!="string"||typeof v.removeChild!="function"||!(v.attributes instanceof u)||typeof v.removeAttribute!="function"||typeof v.setAttribute!="function"||typeof v.namespaceURI!="string"||typeof v.insertBefore!="function"||typeof v.hasChildNodes!="function")},to=function(v){return typeof a=="function"&&v instanceof a};function _e(L,v,x){On(L,P=>{P.call(t,v,x,yt)})}const no=function(v){let x=null;if(_e(J.beforeSanitizeElements,v,null),Ui(v))return we(v),!0;const P=X(v.nodeName);if(_e(J.uponSanitizeElement,v,{tagName:P,allowedTags:V}),H&&v.hasChildNodes()&&!to(v.firstElementChild)&&oe(/<[/\w!]/g,v.innerHTML)&&oe(/<[/\w!]/g,v.textContent)||v.nodeType===Ht.progressingInstruction||H&&v.nodeType===Ht.comment&&oe(/<[/\w]/g,v.data))return we(v),!0;if(!(De.tagCheck instanceof Function&&De.tagCheck(P))&&(!V[P]||Ve[P])){if(!Ve[P]&&so(P)&&(j.tagNameCheck instanceof RegExp&&oe(j.tagNameCheck,P)||j.tagNameCheck instanceof Function&&j.tagNameCheck(P)))return!1;if(Ri&&!be[P]){const z=E(v)||v.parentNode,te=$(v)||v.childNodes;if(te&&z){const Y=te.length;for(let de=Y-1;de>=0;--de){const Me=b(te[de],!0);Me.__removalCount=(v.__removalCount||0)+1,z.insertBefore(Me,T(v))}}}return we(v),!0}return v instanceof l&&!Cu(v)||(P==="noscript"||P==="noembed"||P==="noframes")&&oe(/<\/no(script|embed|frames)/i,v.innerHTML)?(we(v),!0):(N&&v.nodeType===Ht.text&&(x=v.textContent,On([Nt,ht,qe],z=>{x=Kt(x,z," ")}),v.textContent!==x&&(Wt(t.removed,{element:v.cloneNode()}),v.textContent=x)),_e(J.afterSanitizeElements,v,null),!1)},io=function(v,x,P){if(Hr&&(x==="id"||x==="name")&&(P in n||P in Tu))return!1;if(!(A&&!Dt[x]&&oe(Mi,x))){if(!($n&&oe(Pi,x))){if(!(De.attributeCheck instanceof Function&&De.attributeCheck(x,v))){if(!G[x]||Dt[x]){if(!(so(v)&&(j.tagNameCheck instanceof RegExp&&oe(j.tagNameCheck,v)||j.tagNameCheck instanceof Function&&j.tagNameCheck(v))&&(j.attributeNameCheck instanceof RegExp&&oe(j.attributeNameCheck,x)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(x,v))||x==="is"&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&oe(j.tagNameCheck,P)||j.tagNameCheck instanceof Function&&j.tagNameCheck(P))))return!1}else if(!Di[x]){if(!oe(kn,Kt(P,wn,""))){if(!((x==="src"||x==="xlink:href"||x==="href")&&v!=="script"&&wf(P,"data:")===0&&Vr[v])){if(!(_&&!oe(Li,Kt(P,wn,"")))){if(P)return!1}}}}}}}return!0},so=function(v){return v!=="annotation-xml"&&is(v,Ii)},ro=function(v){_e(J.beforeSanitizeAttributes,v,null);const{attributes:x}=v;if(!x||Ui(v))return;const P={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let z=x.length;for(;z--;){const te=x[z],{name:Y,namespaceURI:de,value:Me}=te,vt=X(Y),Wi=Me;let ee=Y==="value"?Wi:kf(Wi);if(P.attrName=vt,P.attrValue=ee,P.keepAttr=!0,P.forceKeepAttr=void 0,_e(J.uponSanitizeAttribute,v,P),ee=P.attrValue,qr&&(vt==="id"||vt==="name")&&(Ge(Y,v),ee=Su+ee),H&&oe(/((--!?|])>)|<\/(style|title|textarea)/i,ee)){Ge(Y,v);continue}if(vt==="attributename"&&is(ee,"href")){Ge(Y,v);continue}if(P.forceKeepAttr)continue;if(!P.keepAttr){Ge(Y,v);continue}if(!R&&oe(/\/>/i,ee)){Ge(Y,v);continue}N&&On([Nt,ht,qe],ao=>{ee=Kt(ee,ao," ")});const oo=X(v.nodeName);if(!io(oo,vt,ee)){Ge(Y,v);continue}if(C&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!de)switch(p.getAttributeType(oo,vt)){case"TrustedHTML":{ee=C.createHTML(ee);break}case"TrustedScriptURL":{ee=C.createScriptURL(ee);break}}if(ee!==Wi)try{de?v.setAttributeNS(de,Y,ee):v.setAttribute(Y,ee),Ui(v)?we(v):ia(t.removed)}catch{Ge(Y,v)}}_e(J.afterSanitizeAttributes,v,null)},_u=function L(v){let x=null;const P=eo(v);for(_e(J.beforeSanitizeShadowDOM,v,null);x=P.nextNode();)_e(J.uponSanitizeShadowNode,x,null),no(x),ro(x),x.content instanceof r&&L(x.content);_e(J.afterSanitizeShadowDOM,v,null)};return t.sanitize=function(L){let v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,P=null,z=null,te=null;if(Oi=!L,Oi&&(L="<!-->"),typeof L!="string"&&!to(L))if(typeof L.toString=="function"){if(L=L.toString(),typeof L!="string")throw zt("dirty is not a string, aborting")}else throw zt("toString is not a function");if(!t.isSupported)return L;if(re||Fi(v),t.removed=[],typeof L=="string"&&(Ot=!1),Ot){if(L.nodeName){const Me=X(L.nodeName);if(!V[Me]||Ve[Me])throw zt("root node is forbidden and cannot be sanitized in-place")}}else if(L instanceof a)x=Jr("<!---->"),P=x.ownerDocument.importNode(L,!0),P.nodeType===Ht.element&&P.nodeName==="BODY"||P.nodeName==="HTML"?x=P:x.appendChild(P);else{if(!ft&&!N&&!K&&L.indexOf("<")===-1)return C&&En?C.createHTML(L):L;if(x=Jr(L),!x)return ft?null:En?I:""}x&&Oe&&we(x.firstChild);const Y=eo(Ot?L:x);for(;z=Y.nextNode();)no(z),ro(z),z.content instanceof r&&_u(z.content);if(Ot)return L;if(ft){if(xn)for(te=He.call(x.ownerDocument);x.firstChild;)te.appendChild(x.firstChild);else te=x;return(G.shadowroot||G.shadowrootmode)&&(te=bn.call(i,te,!0)),te}let de=K?x.outerHTML:x.innerHTML;return K&&V["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&oe(wc,x.ownerDocument.doctype.name)&&(de="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
1767
|
+
`+de),N&&On([Nt,ht,qe],Me=>{de=Kt(de,Me," ")}),C&&En?C.createHTML(de):de},t.setConfig=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fi(L),re=!0},t.clearConfig=function(){yt=null,re=!1},t.isValidAttribute=function(L,v,x){yt||Fi({});const P=X(L),z=X(v);return io(P,z,x)},t.addHook=function(L,v){typeof v=="function"&&Wt(J[L],v)},t.removeHook=function(L,v){if(v!==void 0){const x=vf(J[L],v);return x===-1?void 0:bf(J[L],x,1)[0]}return ia(J[L])},t.removeHooks=function(L){J[L]=[]},t.removeAllHooks=function(){J=ca()},t}var Os=kc();function Tr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var dt=Tr();function Sc(e){dt=e}var rn={exec:()=>null};function F(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(s,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(ae.caret,"$1"),n=n.replace(s,o),i},getRegex:()=>new RegExp(n,t)};return i}var Df=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ae={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")},Of=/^(?:[ \t]*(?:\n|$))+/,Bf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ff=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,yn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Uf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Cr=/(?:[*+-]|\d{1,9}[.)])/,Ac=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$c=F(Ac).replace(/bull/g,Cr).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(),Wf=F(Ac).replace(/bull/g,Cr).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(),_r=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Kf=/^[^\n]+/,Mr=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,zf=F(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Mr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),jf=F(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Cr).getRegex(),Ei="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",Pr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Hf=F("^ {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",Pr).replace("tag",Ei).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xc=F(_r).replace("hr",yn).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",Ei).getRegex(),qf=F(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xc).getRegex(),Lr={blockquote:qf,code:Bf,def:zf,fences:Ff,heading:Uf,hr:yn,html:Hf,lheading:$c,list:jf,newline:Of,paragraph:xc,table:rn,text:Kf},ua=F("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",yn).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",Ei).getRegex(),Vf={...Lr,lheading:Wf,table:ua,paragraph:F(_r).replace("hr",yn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ua).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",Ei).getRegex()},Gf={...Lr,html:F(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Pr).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:rn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:F(_r).replace("hr",yn).replace("heading",` *#{1,6} *[^
|
|
1768
|
+
]`).replace("lheading",$c).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Qf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Yf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ec=/^( {2,}|\\)\n(?!\s*$)/,Xf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ti=/[\p{P}\p{S}]/u,Ir=/[\s\p{P}\p{S}]/u,Tc=/[^\s\p{P}\p{S}]/u,Zf=F(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ir).getRegex(),Cc=/(?!~)[\p{P}\p{S}]/u,Jf=/(?!~)[\s\p{P}\p{S}]/u,eg=/(?:[^\s\p{P}\p{S}]|~)/u,tg=F(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Df?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),_c=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ng=F(_c,"u").replace(/punct/g,Ti).getRegex(),ig=F(_c,"u").replace(/punct/g,Cc).getRegex(),Mc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",sg=F(Mc,"gu").replace(/notPunctSpace/g,Tc).replace(/punctSpace/g,Ir).replace(/punct/g,Ti).getRegex(),rg=F(Mc,"gu").replace(/notPunctSpace/g,eg).replace(/punctSpace/g,Jf).replace(/punct/g,Cc).getRegex(),og=F("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Tc).replace(/punctSpace/g,Ir).replace(/punct/g,Ti).getRegex(),ag=F(/\\(punct)/,"gu").replace(/punct/g,Ti).getRegex(),lg=F(/^<(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(),cg=F(Pr).replace("(?:-->|$)","-->").getRegex(),ug=F("^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",cg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),li=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,dg=F(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",li).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pc=F(/^!?\[(label)\]\[(ref)\]/).replace("label",li).replace("ref",Mr).getRegex(),Lc=F(/^!?\[(ref)\](?:\[\])?/).replace("ref",Mr).getRegex(),pg=F("reflink|nolink(?!\\()","g").replace("reflink",Pc).replace("nolink",Lc).getRegex(),da=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Rr={_backpedal:rn,anyPunctuation:ag,autolink:lg,blockSkip:tg,br:Ec,code:Yf,del:rn,emStrongLDelim:ng,emStrongRDelimAst:sg,emStrongRDelimUnd:og,escape:Qf,link:dg,nolink:Lc,punctuation:Zf,reflink:Pc,reflinkSearch:pg,tag:ug,text:Xf,url:rn},hg={...Rr,link:F(/^!?\[(label)\]\((.*?)\)/).replace("label",li).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",li).getRegex()},Bs={...Rr,emStrongRDelimAst:rg,emStrongLDelim:ig,url:F(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",da).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:F(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",da).getRegex()},fg={...Bs,br:F(Ec).replace("{2,}","*").getRegex(),text:F(Bs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fn={normal:Lr,gfm:Vf,pedantic:Gf},qt={normal:Rr,gfm:Bs,breaks:fg,pedantic:hg},gg={"&":"&","<":"<",">":">",'"':""","'":"'"},pa=e=>gg[e];function Le(e,t){if(t){if(ae.escapeTest.test(e))return e.replace(ae.escapeReplace,pa)}else if(ae.escapeTestNoEncode.test(e))return e.replace(ae.escapeReplaceNoEncode,pa);return e}function ha(e){try{e=encodeURI(e).replace(ae.percentDecode,"%")}catch{return null}return e}function fa(e,t){var r;let n=e.replace(ae.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),i=n.split(ae.splitPipe),s=0;if(i[0].trim()||i.shift(),i.length>0&&!((r=i.at(-1))!=null&&r.trim())&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(ae.slashPipe,"|");return i}function Vt(e,t,n){let i=e.length;if(i===0)return"";let s=0;for(;s<i&&e.charAt(i-s-1)===t;)s++;return e.slice(0,i-s)}function mg(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}function ga(e,t,n,i,s){let r=t.href,o=t.title||null,a=e[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:r,title:o,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,l}function yg(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let s=i[1];return t.split(`
|
|
1737
1769
|
`).map(r=>{let o=r.match(n.other.beginningSpace);if(o===null)return r;let[a]=o;return a.length>=s.length?r.slice(s.length):r}).join(`
|
|
1738
|
-
`)}var ci=class{constructor(e){B(this,"options");B(this,"rules");B(this,"lexer");this.options=e||dt}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:
|
|
1739
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=
|
|
1740
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=
|
|
1770
|
+
`)}var ci=class{constructor(e){B(this,"options");B(this,"rules");B(this,"lexer");this.options=e||dt}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,`
|
|
1771
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=yg(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:i}}}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 i=Vt(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.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],`
|
|
1772
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Vt(t[0],`
|
|
1741
1773
|
`).split(`
|
|
1742
1774
|
`),i="",s="",r=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),o=!0;else if(!o)a.push(n[l]);else break;n=n.slice(l);let c=a.join(`
|
|
1743
1775
|
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
1744
1776
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
1745
1777
|
${c}`:c,s=s?`${s}
|
|
1746
|
-
${u}`:u;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,r,!0),this.lexer.state.top=f,n.length===0)break;let d=r.at(-1);if((d==null?void 0:d.type)==="code")break;if((d==null?void 0:d.type)==="blockquote"){let
|
|
1778
|
+
${u}`:u;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,r,!0),this.lexer.state.top=f,n.length===0)break;let d=r.at(-1);if((d==null?void 0:d.type)==="code")break;if((d==null?void 0:d.type)==="blockquote"){let p=d,w=p.raw+`
|
|
1747
1779
|
`+n.join(`
|
|
1748
|
-
`),b=this.blockquote(w);r[r.length-1]=b,i=i.substring(0,i.length-
|
|
1780
|
+
`),b=this.blockquote(w);r[r.length-1]=b,i=i.substring(0,i.length-p.raw.length)+b.raw,s=s.substring(0,s.length-p.text.length)+b.text;break}else if((d==null?void 0:d.type)==="list"){let p=d,w=p.raw+`
|
|
1749
1781
|
`+n.join(`
|
|
1750
|
-
`),b=this.list(w);r[r.length-1]=b,i=i.substring(0,i.length-d.raw.length)+b.raw,s=s.substring(0,s.length-
|
|
1751
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:r,text:s}}}list(e){var n,i;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),r=s.length>1,o={type:"list",raw:"",ordered:r,start:r?+s.slice(0,-1):"",loose:!1,items:[]};s=r?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=r?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;e;){let u=!1,f="",d="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let
|
|
1782
|
+
`),b=this.list(w);r[r.length-1]=b,i=i.substring(0,i.length-d.raw.length)+b.raw,s=s.substring(0,s.length-p.raw.length)+b.raw,n=w.substring(r.at(-1).raw.length).split(`
|
|
1783
|
+
`);continue}}return{type:"blockquote",raw:i,tokens:r,text:s}}}list(e){var n,i;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),r=s.length>1,o={type:"list",raw:"",ordered:r,start:r?+s.slice(0,-1):"",loose:!1,items:[]};s=r?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=r?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;e;){let u=!1,f="",d="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let p=t[2].split(`
|
|
1752
1784
|
`,1)[0].replace(this.rules.other.listReplaceTabs,T=>" ".repeat(3*T.length)),w=e.split(`
|
|
1753
|
-
`,1)[0],b=!
|
|
1754
|
-
`,e=e.substring(w.length+1),u=!0),!u){let T=this.rules.other.nextBulletRegex(S)
|
|
1755
|
-
`,1)[0],Q;if(w=U,this.options.pedantic?(w=w.replace(this.rules.other.listReplaceNesting," "),Q=w):Q=w.replace(this.rules.other.tabCharGlobal," "),E.test(w)||C.test(w)||I.test(w)||T.test(w)
|
|
1756
|
-
`+Q.slice(S);else{if(b||
|
|
1785
|
+
`,1)[0],b=!p.trim(),S=0;if(this.options.pedantic?(S=2,d=p.trimStart()):b?S=t[1].length+1:(S=t[2].search(this.rules.other.nonSpaceChar),S=S>4?1:S,d=p.slice(S),S+=t[1].length),b&&this.rules.other.blankLine.test(w)&&(f+=w+`
|
|
1786
|
+
`,e=e.substring(w.length+1),u=!0),!u){let T=this.rules.other.nextBulletRegex(S),$=this.rules.other.hrRegex(S),E=this.rules.other.fencesBeginRegex(S),C=this.rules.other.headingBeginRegex(S),I=this.rules.other.htmlBeginRegex(S);for(;e;){let U=e.split(`
|
|
1787
|
+
`,1)[0],Q;if(w=U,this.options.pedantic?(w=w.replace(this.rules.other.listReplaceNesting," "),Q=w):Q=w.replace(this.rules.other.tabCharGlobal," "),E.test(w)||C.test(w)||I.test(w)||T.test(w)||$.test(w))break;if(Q.search(this.rules.other.nonSpaceChar)>=S||!w.trim())d+=`
|
|
1788
|
+
`+Q.slice(S);else{if(b||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(p)||C.test(p)||$.test(p))break;d+=`
|
|
1757
1789
|
`+w}!b&&!w.trim()&&(b=!0),f+=U+`
|
|
1758
|
-
`,e=e.substring(U.length+1),
|
|
1759
|
-
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?r.align.push("right"):this.rules.other.tableAlignCenter.test(a)?r.align.push("center"):this.rules.other.tableAlignLeft.test(a)?r.align.push("left"):r.align.push(null);for(let a=0;a<n.length;a++)r.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:r.align[a]});for(let a of s)r.rows.push(
|
|
1760
|
-
`?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 r=
|
|
1790
|
+
`,e=e.substring(U.length+1),p=Q.slice(S)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(l=!0)),o.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),o.raw+=f}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((n=u.tokens[0])==null?void 0:n.type)==="text"||((i=u.tokens[0])==null?void 0:i.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.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 f=this.rules.other.listTaskCheckbox.exec(u.raw);if(f){let d={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};u.checked=d.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=d.raw+u.tokens[0].raw,u.tokens[0].text=d.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(d)):u.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):u.tokens.unshift(d)}}if(!o.loose){let f=u.tokens.filter(p=>p.type==="space"),d=f.length>0&&f.some(p=>this.rules.other.anyLine.test(p.raw));o.loose=d}}if(o.loose)for(let u of o.items){u.loose=!0;for(let f of u.tokens)f.type==="text"&&(f.type="paragraph")}return o}}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," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=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:i,title:s}}}table(e){var o;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=fa(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
1791
|
+
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?r.align.push("right"):this.rules.other.tableAlignCenter.test(a)?r.align.push("center"):this.rules.other.tableAlignLeft.test(a)?r.align.push("left"):r.align.push(null);for(let a=0;a<n.length;a++)r.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:r.align[a]});for(let a of s)r.rows.push(fa(a,r.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[c]})));return r}}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)===`
|
|
1792
|
+
`?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 r=Vt(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{let r=mg(t[2],"()");if(r===-2)return;if(r>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(i);r&&(i=r[1],s=r[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),ga(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.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 i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[i.toLowerCase()];if(!s){let r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return ga(n,s,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...i[0]].length-1,r,o,a=s,l=0,c=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);(i=c.exec(t))!=null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(o=[...r].length,i[3]||i[4]){a+=o;continue}else if((i[5]||i[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...i[0]][0].length,f=e.slice(0,s+i.index+u+o);if(Math.min(s,o)%2){let p=f.slice(1,-1);return{type:"em",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}let d=f.slice(2,-2);return{type:"strong",raw:f,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&s&&(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,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let i,s;if(t[2]==="@")i=t[0],s="mailto:"+i;else{let r;do r=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(r!==t[0]);i=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}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}}}},ge=class Fs{constructor(t){B(this,"tokens");B(this,"options");B(this,"state");B(this,"inlineQueue");B(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||dt,this.options.tokenizer=this.options.tokenizer||new ci,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:ae,block:Fn.normal,inline:qt.normal};this.options.pedantic?(n.block=Fn.pedantic,n.inline=qt.pedantic):this.options.gfm&&(n.block=Fn.gfm,this.options.breaks?n.inline=qt.breaks:n.inline=qt.gfm),this.tokenizer.rules=n}static get rules(){return{block:Fn,inline:qt}}static lex(t,n){return new Fs(n).lex(t)}static lexInline(t,n){return new Fs(n).inlineTokens(t)}lex(t){t=t.replace(ae.carriageReturn,`
|
|
1761
1793
|
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){var s,r,o;for(this.options.pedantic&&(t=t.replace(ae.tabCharGlobal," ").replace(ae.spaceLine,""));t;){let a;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(c=>(a=c.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let c=n.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
|
1762
1794
|
`:n.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
1763
1795
|
`)?"":`
|
|
@@ -1771,7 +1803,7 @@ ${u}`:u;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
1771
1803
|
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a),i=l.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
1772
1804
|
`)?"":`
|
|
1773
1805
|
`)+a.raw,c.text+=`
|
|
1774
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var l,c,u,f,d;let i=t,s=null;if(this.tokens.links){let
|
|
1806
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var l,c,u,f,d;let i=t,s=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)p.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,s.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let r;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)r=s[2]?s[2].length:0,i=i.slice(0,s.index+r)+"["+"a".repeat(s[0].length-r-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},i))??i;let o=!1,a="";for(;t;){o||(a=""),o=!1;let p;if((f=(u=this.options.extensions)==null?void 0:u.inline)!=null&&f.some(b=>(p=b.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let b=n.at(-1);p.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=p.raw,b.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,i,a)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let w=t;if((d=this.options.extensions)!=null&&d.startInline){let b=1/0,S=t.slice(1),T;this.options.extensions.startInline.forEach($=>{T=$.call({lexer:this},S),typeof T=="number"&&T>=0&&(b=Math.min(b,T))}),b<1/0&&b>=0&&(w=t.substring(0,b+1))}if(p=this.tokenizer.inlineText(w)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(a=p.raw.slice(-1)),o=!0;let b=n.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=p.raw,b.text+=p.text):n.push(p);continue}if(t){let b="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(b);break}else throw new Error(b)}}return n}},ui=class{constructor(e){B(this,"options");B(this,"parser");this.options=e||dt}space(e){return""}code({text:e,lang:t,escaped:n}){var r;let i=(r=(t||"").match(ae.notSpaceStart))==null?void 0:r[0],s=e.replace(ae.endingNewline,"")+`
|
|
1775
1807
|
`;return i?'<pre><code class="language-'+Le(i)+'">'+(n?s:Le(s,!0))+`</code></pre>
|
|
1776
1808
|
`:"<pre><code>"+(n?s:Le(s,!0))+`</code></pre>
|
|
1777
1809
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
@@ -1789,23 +1821,23 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1789
1821
|
`}tablerow({text:e}){return`<tr>
|
|
1790
1822
|
${e}</tr>
|
|
1791
1823
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
1792
|
-
`}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>${Le(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 i=this.parser.parseInline(n),s=
|
|
1793
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Le(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},at=new
|
|
1824
|
+
`}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>${Le(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 i=this.parser.parseInline(n),s=ha(e);if(s===null)return i;e=s;let r='<a href="'+e+'"';return t&&(r+=' title="'+Le(t)+'"'),r+=">"+i+"</a>",r}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let s=ha(e);if(s===null)return Le(n);e=s;let r=`<img src="${e}" alt="${n}"`;return t&&(r+=` title="${Le(t)}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Le(e.text)}},Nr=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}},me=class Us{constructor(t){B(this,"options");B(this,"renderer");B(this,"textRenderer");this.options=t||dt,this.options.renderer=this.options.renderer||new ui,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Nr}static parse(t,n){return new Us(n).parse(t)}static parseInline(t,n){return new Us(n).parseInline(t)}parse(t){var i,s;let n="";for(let r=0;r<t.length;r++){let o=t[r];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=c||"";continue}}let a=o;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 l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(t,n=this.renderer){var s,r;let i="";for(let o=0;o<t.length;o++){let a=t[o];if((r=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&r[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)){i+=c||"";continue}}let l=a;switch(l.type){case"escape":{i+=n.text(l);break}case"html":{i+=n.html(l);break}case"link":{i+=n.link(l);break}case"image":{i+=n.image(l);break}case"checkbox":{i+=n.checkbox(l);break}case"strong":{i+=n.strong(l);break}case"em":{i+=n.em(l);break}case"codespan":{i+=n.codespan(l);break}case"br":{i+=n.br(l);break}case"del":{i+=n.del(l);break}case"text":{i+=n.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return i}},Hn,Yt=(Hn=class{constructor(e){B(this,"options");B(this,"block");this.options=e||dt}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?ge.lex:ge.lexInline}provideParser(){return this.block?me.parse:me.parseInline}},B(Hn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),B(Hn,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Hn),vg=class{constructor(...e){B(this,"defaults",Tr());B(this,"options",this.setOptions);B(this,"parse",this.parseMarkdown(!0));B(this,"parseInline",this.parseMarkdown(!1));B(this,"Parser",me);B(this,"Renderer",ui);B(this,"TextRenderer",Nr);B(this,"Lexer",ge);B(this,"Tokenizer",ci);B(this,"Hooks",Yt);this.use(...e)}walkTokens(e,t){var i,s;let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let o=r;for(let a of o.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of o.rows)for(let l of a)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{let o=r;n=n.concat(this.walkTokens(o.items,t));break}default:{let o=r;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);n=n.concat(this.walkTokens(l,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let r=t.renderers[s.name];r?t.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=t[s.level];r?r.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),i.extensions=t),n.renderer){let s=this.defaults.renderer||new ui(this.defaults);for(let r in n.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=n.renderer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new ci(this.defaults);for(let r in n.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=n.tokenizer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Yt;for(let r in n.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=n.hooks[o],l=s[o];Yt.passThroughHooks.has(r)?s[o]=c=>{if(this.defaults.async&&Yt.passThroughHooksRespectAsync.has(r))return(async()=>{let f=await a.call(s,c);return l.call(s,f)})();let u=a.call(s,c);return l.call(s,u)}:s[o]=(...c)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(s,c);return f===!1&&(f=await l.apply(s,c)),f})();let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}i.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,r=n.walkTokens;i.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ge.lex(e,t??this.defaults)}parser(e,t){return me.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},s={...this.defaults,...i},r=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return r(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 r(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(t):t,a=await(s.hooks?await s.hooks.provideLexer():e?ge.lex:ge.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():e?me.parse:me.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(r);try{s.hooks&&(t=s.hooks.preprocess(t));let o=(s.hooks?s.hooks.provideLexer():e?ge.lex:ge.lexInline)(t,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser():e?me.parse:me.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
1825
|
+
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Le(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},at=new vg;function W(e,t){return at.parse(e,t)}W.options=W.setOptions=function(e){return at.setOptions(e),W.defaults=at.defaults,Sc(W.defaults),W};W.getDefaults=Tr;W.defaults=dt;W.use=function(...e){return at.use(...e),W.defaults=at.defaults,Sc(W.defaults),W};W.walkTokens=function(e,t){return at.walkTokens(e,t)};W.parseInline=at.parseInline;W.Parser=me;W.parser=me.parse;W.Renderer=ui;W.TextRenderer=Nr;W.Lexer=ge;W.lexer=ge.lex;W.Tokenizer=ci;W.Hooks=Yt;W.parse=W;W.options;W.setOptions;W.use;W.walkTokens;W.parseInline;me.parse;ge.lex;W.setOptions({gfm:!0,breaks:!0,mangle:!1});const ma=["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"],ya=["class","href","rel","target","title","start"];let va=!1;const bg=14e4,wg=4e4,kg=200,ls=5e4,Je=new Map;function Sg(e){const t=Je.get(e);return t===void 0?null:(Je.delete(e),Je.set(e,t),t)}function ba(e,t){if(Je.set(e,t),Je.size<=kg)return;const n=Je.keys().next().value;n&&Je.delete(n)}function Ag(){va||(va=!0,Os.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function di(e){const t=e.trim();if(!t)return"";if(Ag(),t.length<=ls){const o=Sg(t);if(o!==null)return o}const n=pl(t,bg),i=n.truncated?`
|
|
1794
1826
|
|
|
1795
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>
|
|
1827
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>wg){const a=`<pre class="code-block">${$g(`${n.text}${i}`)}</pre>`,l=Os.sanitize(a,{ALLOWED_TAGS:ma,ALLOWED_ATTR:ya});return t.length<=ls&&ba(t,l),l}const s=W.parse(`${n.text}${i}`),r=Os.sanitize(s,{ALLOWED_TAGS:ma,ALLOWED_ATTR:ya});return t.length<=ls&&ba(t,r),r}function $g(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const xg=1500,Eg=2e3,Ic="Copy as markdown",Tg="Copied",Cg="Copy failed";async function _g(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}}function Un(e,t){e.title=t,e.setAttribute("aria-label",t)}function Mg(e){const t=e.label??Ic;return h`
|
|
1796
1828
|
<button
|
|
1797
1829
|
class="chat-copy-btn"
|
|
1798
1830
|
type="button"
|
|
1799
1831
|
title=${t}
|
|
1800
1832
|
aria-label=${t}
|
|
1801
|
-
@click=${async n=>{const i=n.currentTarget;if(i==null||i.querySelector(".chat-copy-btn__icon"),!i||i.dataset.copying==="1")return;i.dataset.copying="1",i.setAttribute("aria-busy","true"),i.disabled=!0;const s=await
|
|
1833
|
+
@click=${async n=>{const i=n.currentTarget;if(i==null||i.querySelector(".chat-copy-btn__icon"),!i||i.dataset.copying==="1")return;i.dataset.copying="1",i.setAttribute("aria-busy","true"),i.disabled=!0;const s=await _g(e.text());if(i.isConnected){if(delete i.dataset.copying,i.removeAttribute("aria-busy"),i.disabled=!1,!s){i.dataset.error="1",Un(i,Cg),window.setTimeout(()=>{i.isConnected&&(delete i.dataset.error,Un(i,t))},Eg);return}i.dataset.copied="1",Un(i,Tg),window.setTimeout(()=>{i.isConnected&&(delete i.dataset.copied,Un(i,t))},xg)}}}
|
|
1802
1834
|
>
|
|
1803
1835
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
1804
1836
|
<span class="chat-copy-btn__icon-copy">${D.copy}</span>
|
|
1805
1837
|
<span class="chat-copy-btn__icon-check">${D.check}</span>
|
|
1806
1838
|
</span>
|
|
1807
1839
|
</button>
|
|
1808
|
-
`}function
|
|
1840
|
+
`}function Pg(e){return Mg({text:()=>e,label:Ic})}function Lg(e){const t=e,n=Ig(t.content),i=[];for(const s of n){const r=String(s.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(r)||typeof s.name=="string"&&s.arguments!=null)&&i.push({kind:"call",name:s.name??"tool",args:Rg(s.arguments??s.args)})}for(const s of n){const r=String(s.type??"").toLowerCase();if(r!=="toolresult"&&r!=="tool_result")continue;const o=Ng(s),a=typeof s.name=="string"?s.name:"tool";i.push({kind:"result",name:a,text:o})}if(ml(e)&&!i.some(s=>s.kind==="result")){const s=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",r=hl(e)??void 0;i.push({kind:"result",name:s,text:r})}return i}function Ig(e){return Array.isArray(e)?e.filter(Boolean):[]}function Rg(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 Ng(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function Dg(e){var s;const n=e.content,i=[];if(Array.isArray(n))for(const r of n){if(typeof r!="object"||r===null)continue;const o=r;if(o.type==="image")if(((s=o.source)==null?void 0:s.type)==="base64"){const a=o.source,l=a.data,c=a.media_type||"image/png",u=l.startsWith("data:")?l:`data:${c};base64,${l}`;i.push({url:u})}else if(typeof o.data=="string"&&o.data){const a=o.data,l=o.mimeType||o.media_type||"image/png",c=a.startsWith("data:")?a:`data:${l};base64,${a}`;i.push({url:c})}else typeof o.url=="string"&&i.push({url:o.url});else if(o.type==="image_url"){const a=o.image_url;typeof(a==null?void 0:a.url)=="string"&&i.push({url:a.url})}}return i}function Og(e){return h`
|
|
1809
1841
|
<div class="chat-group assistant">
|
|
1810
1842
|
<div class="chat-group-messages">
|
|
1811
1843
|
<div class="chat-bubble chat-reading-indicator" aria-hidden="true">
|
|
@@ -1815,7 +1847,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
1815
1847
|
</div>
|
|
1816
1848
|
</div>
|
|
1817
1849
|
</div>
|
|
1818
|
-
`}function
|
|
1850
|
+
`}function Bg(e){return h`
|
|
1819
1851
|
<div class="chat-group assistant">
|
|
1820
1852
|
<div class="chat-group-messages">
|
|
1821
1853
|
<div class="chat-interim fade-in">
|
|
@@ -1823,24 +1855,24 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
1823
1855
|
</div>
|
|
1824
1856
|
</div>
|
|
1825
1857
|
</div>
|
|
1826
|
-
`}function
|
|
1858
|
+
`}function Fg(e,t,n,i){return h`
|
|
1827
1859
|
<div class="chat-group assistant">
|
|
1828
1860
|
<div class="chat-group-messages">
|
|
1829
|
-
${
|
|
1861
|
+
${Rc({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!1,showReasoning:!1})}
|
|
1830
1862
|
</div>
|
|
1831
1863
|
</div>
|
|
1832
|
-
`}function
|
|
1864
|
+
`}function Ug(e,t){const n=gl(e.role),i=n==="user"?"user":n==="assistant"?"assistant":"other",s=new Date(e.timestamp).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"});return h`
|
|
1833
1865
|
<div class="chat-group ${i}">
|
|
1834
1866
|
<div class="chat-group-messages">
|
|
1835
|
-
${e.messages.map((r,o)=>
|
|
1867
|
+
${e.messages.map((r,o)=>Rc(r.message,{isStreaming:e.isStreaming&&o===e.messages.length-1,showReasoning:t.showReasoning}))}
|
|
1836
1868
|
<div class="chat-group-footer">
|
|
1837
1869
|
<span class="chat-group-timestamp">${s}</span>
|
|
1838
1870
|
</div>
|
|
1839
1871
|
</div>
|
|
1840
1872
|
</div>
|
|
1841
|
-
`}function
|
|
1873
|
+
`}function Wg(e){return e.length===0?k:h`
|
|
1842
1874
|
<div class="chat-message-images">
|
|
1843
|
-
${e.map(t=>
|
|
1875
|
+
${e.map(t=>h`
|
|
1844
1876
|
<img
|
|
1845
1877
|
src=${t.url}
|
|
1846
1878
|
alt=${t.alt??"Attached image"}
|
|
@@ -1849,14 +1881,14 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
1849
1881
|
/>
|
|
1850
1882
|
`)}
|
|
1851
1883
|
</div>
|
|
1852
|
-
`}function
|
|
1884
|
+
`}function Rc(e,t,n){const i=e,s=typeof i.role=="string"?i.role:"unknown",r=ml(e)||s.toLowerCase()==="toolresult"||s.toLowerCase()==="tool_result"||typeof i.toolCallId=="string"||typeof i.tool_call_id=="string",a=Lg(e).length>0,l=Dg(e),c=l.length>0,u=hl(e),f=t.showReasoning&&s==="assistant"?yd(e):null,d=u!=null&&u.trim()?u:null,p=f?bd(f):null,w=d,b=(s==="assistant"||s==="user")&&!!(w!=null&&w.trim()),S=["chat-bubble",b?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!w&&(a||r)||!w&&!c?k:h`
|
|
1853
1885
|
<div class="${S}">
|
|
1854
|
-
${b?
|
|
1855
|
-
${
|
|
1856
|
-
${h
|
|
1857
|
-
${w?
|
|
1886
|
+
${b?Pg(w):k}
|
|
1887
|
+
${Wg(l)}
|
|
1888
|
+
${p?h`<div class="chat-thinking">${ai(di(p))}</div>`:k}
|
|
1889
|
+
${w?h`<div class="chat-text">${ai(di(w))}</div>`:k}
|
|
1858
1890
|
</div>
|
|
1859
|
-
`}function
|
|
1891
|
+
`}function Kg(e){return h`
|
|
1860
1892
|
<div class="sidebar-panel">
|
|
1861
1893
|
<div class="sidebar-header">
|
|
1862
1894
|
<div class="sidebar-title">Tool Output</div>
|
|
@@ -1865,15 +1897,15 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
1865
1897
|
</button>
|
|
1866
1898
|
</div>
|
|
1867
1899
|
<div class="sidebar-content">
|
|
1868
|
-
${e.error?
|
|
1900
|
+
${e.error?h`
|
|
1869
1901
|
<div class="callout danger">${e.error}</div>
|
|
1870
1902
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
1871
1903
|
View Raw Text
|
|
1872
1904
|
</button>
|
|
1873
|
-
`:e.content?
|
|
1905
|
+
`:e.content?h`<div class="sidebar-markdown">${ai(di(e.content))}</div>`:h`<div class="muted">No content available</div>`}
|
|
1874
1906
|
</div>
|
|
1875
1907
|
</div>
|
|
1876
|
-
`}var
|
|
1908
|
+
`}var zg=Object.defineProperty,jg=Object.getOwnPropertyDescriptor,Ci=(e,t,n,i)=>{for(var s=i>1?void 0:i?jg(t,n):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(s=(i?o(t,n,s):o(s))||s);return i&&s&&zg(t,n,s),s};let Ct=class extends At{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,s=(e.clientX-this.startX)/n;let r=this.startRatio+s;r=Math.max(this.minRatio,Math.min(this.maxRatio,r)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:r},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return h``}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this.handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};Ct.styles=Nu`
|
|
1877
1909
|
:host {
|
|
1878
1910
|
width: 4px;
|
|
1879
1911
|
cursor: col-resize;
|
|
@@ -1899,23 +1931,23 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
1899
1931
|
:host(.dragging) {
|
|
1900
1932
|
background: var(--accent, #007bff);
|
|
1901
1933
|
}
|
|
1902
|
-
`;Ci([bi({type:Number})],Ct.prototype,"splitRatio",2);Ci([bi({type:Number})],Ct.prototype,"minRatio",2);Ci([bi({type:Number})],Ct.prototype,"maxRatio",2);Ct=Ci([ol("resizable-divider")],Ct);function Wn(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function cs(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const zg=1,jg=1,pt="emoji",_t="keyvalue",Dr="favorites",Hg="tokens",Rc="tokens",qg="unicode",Nc="count",Gg="group",Vg="order",Dc="group-order",Ws="eTag",pi="url",ba="skinTone",It="readonly",Or="readwrite",Oc="skinUnicodes",Qg="skinUnicodes",Yg="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Xg="en";function Zg(e,t){const n=new Set,i=[];for(const s of e){const r=t(s);n.has(r)||(n.add(r),i.push(s))}return i}function wa(e){return Zg(e,t=>t.unicode)}function Jg(e){function t(n,i,s){const r=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[o,[a,l]]of Object.entries(s))r.createIndex(o,a,{multiEntry:l});return r}t(_t),t(pt,qg,{[Rc]:[Hg,!0],[Dc]:[[Gg,Vg]],[Oc]:[Qg,!0]}),t(Dr,void 0,{[Nc]:[""]})}const Ks={},Qn={},hi={};function Bc(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function em(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,zg);Ks[e]=s,s.onupgradeneeded=r=>{r.oldVersion<jg&&Jg(s.result)},Bc(n,i,s)});return t.onclose=()=>Br(e),t}function tm(e){return Qn[e]||(Qn[e]=em(e)),Qn[e]}function Ne(e,t,n,i){return new Promise((s,r)=>{const o=e.transaction(t,n,{durability:"relaxed"}),a=typeof t=="string"?o.objectStore(t):t.map(c=>o.objectStore(c));let l;i(a,o,c=>{l=c}),o.oncomplete=()=>s(l),o.onerror=()=>r(o.error)})}function Br(e){const t=Ks[e],n=t&&t.result;if(n){n.close();const i=hi[e];if(i)for(const s of i)s()}delete Ks[e],delete Qn[e],delete hi[e]}function nm(e){return new Promise((t,n)=>{Br(e);const i=indexedDB.deleteDatabase(e);Bc(t,n,i)})}function im(e,t){let n=hi[e];n||(n=hi[e]=[]),n.push(t)}const sm=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function $t(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||sm.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const rm=2;function Fc(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=rm)}function om(e){return e.map(({annotation:n,emoticon:i,group:s,order:r,shortcodes:o,skins:a,tags:l,emoji:c,version:u})=>{const f=[...new Set(Fc([...(o||[]).map($t).flat(),...(l||[]).map($t).flat(),...$t(n),i]))].sort(),d={annotation:n,group:s,order:r,tags:l,tokens:f,unicode:c,version:u};if(i&&(d.emoticon=i),o&&(d.shortcodes=o),a){d.skinTones=[],d.skinUnicodes=[],d.skinVersions=[];for(const{tone:h,emoji:w,version:b}of a)d.skinTones.push(h),d.skinUnicodes.push(w),d.skinVersions.push(b)}return d})}function Uc(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function lt(e,t,n){Uc(e,"get",t,n)}function Wc(e,t,n){Uc(e,"getAll",t,n)}function Fr(e){e.commit&&e.commit()}function am(e,t){let n=e[0];for(let i=1;i<e.length;i++){const s=e[i];t(n)>t(s)&&(n=s)}return n}function Kc(e,t){const n=am(e,s=>s.length),i=[];for(const s of n)e.some(r=>r.findIndex(o=>t(o)===t(s))===-1)||i.push(s);return i}async function lm(e){return!await Ur(e,_t,pi)}async function cm(e,t,n){const[i,s]=await Promise.all([Ws,pi].map(r=>Ur(e,_t,r)));return i===n&&s===t}async function um(e,t){return Ne(e,pt,It,(i,s,r)=>{let o;const a=()=>{i.getAll(o&&IDBKeyRange.lowerBound(o,!0),50).onsuccess=l=>{const c=l.target.result;for(const u of c)if(o=u.unicode,t(u))return r(u);if(c.length<50)return r();a()}};a()})}async function zc(e,t,n,i){{const s=om(t);await Ne(e,[pt,_t],Or,([r,o],a)=>{let l,c,u=0;function f(){++u===2&&d()}function d(){if(!(l===i&&c===n)){r.clear();for(const h of s)r.put(h);o.put(i,Ws),o.put(n,pi),Fr(a)}}lt(o,Ws,h=>{l=h,f()}),lt(o,pi,h=>{c=h,f()})})}}async function dm(e,t){return Ne(e,pt,It,(n,i,s)=>{const r=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Wc(n.index(Dc),r,s)})}async function jc(e,t){const n=Fc($t(t));return n.length?Ne(e,pt,It,(i,s,r)=>{const o=[],a=()=>{o.length===n.length&&l()},l=()=>{const c=Kc(o,u=>u.unicode);r(c.sort((u,f)=>u.order<f.order?-1:1))};for(let c=0;c<n.length;c++){const u=n[c],f=c===n.length-1?IDBKeyRange.bound(u,u+"",!1,!0):IDBKeyRange.only(u);Wc(i.index(Rc),f,d=>{o.push(d),a()})}}):[]}async function pm(e,t){const n=await jc(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(r=>r.toLowerCase()).includes(t.toLowerCase()))[0]||null:await um(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function hm(e,t){return Ne(e,pt,It,(n,i,s)=>lt(n,t,r=>{if(r)return s(r);lt(n.index(Oc),t,o=>s(o||null))}))}function Ur(e,t,n){return Ne(e,t,It,(i,s,r)=>lt(i,n,r))}function fm(e,t,n,i){return Ne(e,t,Or,(s,r)=>{s.put(i,n),Fr(r)})}function gm(e,t){return Ne(e,Dr,Or,(n,i)=>lt(n,t,s=>{n.put((s||0)+1,t),Fr(i)}))}function mm(e,t,n){return n===0?[]:Ne(e,[Dr,pt],It,([i,s],r,o)=>{const a=[];i.index(Nc).openCursor(void 0,"prev").onsuccess=l=>{const c=l.target.result;if(!c)return o(a);function u(h){if(a.push(h),a.length===n)return o(a);c.continue()}const f=c.primaryKey,d=t.byName(f);if(d)return u(d);lt(s,f,h=>{if(h)return u(h);c.continue()})}})}const Kn="";function ym(e,t){const n=new Map;for(const s of e){const r=t(s);for(const o of r){let a=n;for(let c=0;c<o.length;c++){const u=o.charAt(c);let f=a.get(u);f||(f=new Map,a.set(u,f)),a=f}let l=a.get(Kn);l||(l=[],a.set(Kn,l)),l.push(s)}}return(s,r)=>{let o=n;for(let c=0;c<s.length;c++){const u=s.charAt(c),f=o.get(u);if(f)o=f;else return[]}if(r)return o.get(Kn)||[];const a=[],l=[o];for(;l.length;){const u=[...l.shift().entries()].sort((f,d)=>f[0]<d[0]?-1:1);for(const[f,d]of u)f===Kn?a.push(...d):l.push(d)}return a}}const vm=["name","url"];function bm(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||vm.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function ka(e){bm(e);const t=(d,h)=>d.name.toLowerCase()<h.name.toLowerCase()?-1:1,n=e.sort(t),s=ym(e,d=>{const h=new Set;if(d.shortcodes)for(const w of d.shortcodes)for(const b of $t(w))h.add(b);return h}),r=d=>s(d,!0),o=d=>s(d,!1),a=d=>{const h=$t(d),w=h.map((b,S)=>(S<h.length-1?r:o)(b));return Kc(w,b=>b.name).sort(t)},l=new Map,c=new Map;for(const d of e){c.set(d.name.toLowerCase(),d);for(const h of d.shortcodes||[])l.set(h.toLowerCase(),d)}return{all:n,search:a,byShortcode:d=>l.get(d.toLowerCase()),byName:d=>c.get(d.toLowerCase())}}const wm=typeof wrappedJSObject<"u";function Vt(e){if(!e)return e;if(wm&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function Hc(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const km=["annotation","emoji","group","order","version"];function Sm(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||km.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function qc(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function Am(e){const t=await fetch(e,{method:"HEAD"});qc(t,e);const n=t.headers.get("etag");return Hc(n),n}async function zs(e){const t=await fetch(e);qc(t,e);const n=t.headers.get("etag");Hc(n);const i=await t.json();return Sm(i),[n,i]}function xm(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function $m(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=-1;++s<t;)i[s]=e.charCodeAt(s);return n}async function Gc(e){const t=JSON.stringify(e);let n=$m(t);const i=await crypto.subtle.digest("SHA-1",n),s=xm(i);return btoa(s)}async function Em(e,t){let n,i=await Am(t);if(!i){const s=await zs(t);i=s[0],n=s[1],i||(i=await Gc(n))}await cm(e,t,i)||(n||(n=(await zs(t))[1]),await zc(e,n,t,i))}async function Tm(e,t){let[n,i]=await zs(t);n||(n=await Gc(i)),await zc(e,i,t,n)}async function Cm(e,t){try{await Em(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class _m{constructor({dataSource:t=Yg,locale:n=Xg,customEmoji:i=[]}={}){this.dataSource=t,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=ka(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await tm(this._dbName);im(this._dbName,this._clear);const n=this.dataSource;await lm(t)?await Tm(t,n):this._lazyUpdate=Cm(t,n)}async ready(){const t=async()=>(this._ready||(this._ready=this._init()),this._ready);await t(),this._db||await t()}async getEmojiByGroup(t){return cs(t),await this.ready(),wa(await dm(this._db,t)).map(Vt)}async getEmojiBySearchQuery(t){Wn(t),await this.ready();const n=this._custom.search(t),i=wa(await jc(this._db,t)).map(Vt);return[...n,...i]}async getEmojiByShortcode(t){Wn(t),await this.ready();const n=this._custom.byShortcode(t);return n||Vt(await pm(this._db,t))}async getEmojiByUnicodeOrName(t){Wn(t),await this.ready();const n=this._custom.byName(t);return n||Vt(await hm(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await Ur(this._db,_t,ba)||0}async setPreferredSkinTone(t){return cs(t),await this.ready(),fm(this._db,_t,ba,t)}async incrementFavoriteEmojiCount(t){return Wn(t),await this.ready(),gm(this._db,t)}async getTopFavoriteEmoji(t){return cs(t),await this.ready(),(await mm(this._db,this._custom,t)).map(Vt)}set customEmoji(t){this._custom=ka(t)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await Br(this._dbName)}async delete(){await this._shutdown(),await nm(this._dbName)}}const js=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([e,t,n])=>({id:e,emoji:t,name:n})),us=js.slice(1),Mm=2,Sa=6,Vc=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function Aa(e){return e.unicode.includes("")}const Pm={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},Lm=1e3,Im="🖐️",Rm=8,Nm=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],Qc='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Dm=(e,t)=>e<t?-1:e>t?1:0,xa=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const i=n.getContext("2d",{willReadFrequently:!0});return i.textBaseline="top",i.font=`100px ${Qc}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Om=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Bm(e){const t=xa(e,"#000"),n=xa(e,"#fff");return t&&n&&Om(t,n)}function Fm(){const e=Object.entries(Pm);try{for(const[t,n]of e)if(Bm(t))return n}catch{}return e[0][1]}let ds;const ps=()=>(ds||(ds=new Promise(e=>Vc(()=>e(Fm())))),ds),Hs=new Map,Um="️",Wm="\uD83C",Km="",zm=127995,jm=57339;function Hm(e,t){if(t===0)return e;const n=e.indexOf(Km);return n!==-1?e.substring(0,n)+String.fromCodePoint(zm+t-1)+e.substring(n):(e.endsWith(Um)&&(e=e.substring(0,e.length-1)),e+Wm+String.fromCodePoint(jm+t-1))}function Se(e){e.preventDefault(),e.stopPropagation()}function hs(e,t,n){return t+=e?-1:1,t<0?t=n.length-1:t>=n.length&&(t=0),t}function Yc(e,t){const n=new Set,i=[];for(const s of e){const r=t(s);n.has(r)||(n.add(r),i.push(s))}return i}function qm(e,t){const n=i=>{const s={};for(const r of i)typeof r.tone=="number"&&r.version<=t&&(s[r.tone]=r.unicode);return s};return e.map(({unicode:i,skins:s,shortcodes:r,url:o,name:a,category:l,annotation:c})=>({unicode:i,name:a,shortcodes:r,url:o,category:l,annotation:c,id:i||a,skins:s&&n(s)}))}const Yn=requestAnimationFrame;let Gm=typeof ResizeObserver=="function";function Vm(e,t,n){let i;Gm?(i=new ResizeObserver(n),i.observe(e)):Yn(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function $a(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let fs;function Qm(e,t,n){let i=!0,s=!1;for(const r of e){const o=n(r);if(!o)continue;const a=$a(o);a===0&&(s=!0),typeof fs>"u"&&(fs=$a(t));const l=a/1.8<fs;Hs.set(r.unicode,l),l||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
1934
|
+
`;Ci([bi({type:Number})],Ct.prototype,"splitRatio",2);Ci([bi({type:Number})],Ct.prototype,"minRatio",2);Ci([bi({type:Number})],Ct.prototype,"maxRatio",2);Ct=Ci([al("resizable-divider")],Ct);function Wn(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function cs(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const Hg=1,qg=1,pt="emoji",_t="keyvalue",Dr="favorites",Vg="tokens",Nc="tokens",Gg="unicode",Dc="count",Qg="group",Yg="order",Oc="group-order",Ws="eTag",pi="url",wa="skinTone",It="readonly",Or="readwrite",Bc="skinUnicodes",Xg="skinUnicodes",Zg="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Jg="en";function em(e,t){const n=new Set,i=[];for(const s of e){const r=t(s);n.has(r)||(n.add(r),i.push(s))}return i}function ka(e){return em(e,t=>t.unicode)}function tm(e){function t(n,i,s){const r=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[o,[a,l]]of Object.entries(s))r.createIndex(o,a,{multiEntry:l});return r}t(_t),t(pt,Gg,{[Nc]:[Vg,!0],[Oc]:[[Qg,Yg]],[Bc]:[Xg,!0]}),t(Dr,void 0,{[Dc]:[""]})}const Ks={},Qn={},hi={};function Fc(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function nm(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,Hg);Ks[e]=s,s.onupgradeneeded=r=>{r.oldVersion<qg&&tm(s.result)},Fc(n,i,s)});return t.onclose=()=>Br(e),t}function im(e){return Qn[e]||(Qn[e]=nm(e)),Qn[e]}function Ne(e,t,n,i){return new Promise((s,r)=>{const o=e.transaction(t,n,{durability:"relaxed"}),a=typeof t=="string"?o.objectStore(t):t.map(c=>o.objectStore(c));let l;i(a,o,c=>{l=c}),o.oncomplete=()=>s(l),o.onerror=()=>r(o.error)})}function Br(e){const t=Ks[e],n=t&&t.result;if(n){n.close();const i=hi[e];if(i)for(const s of i)s()}delete Ks[e],delete Qn[e],delete hi[e]}function sm(e){return new Promise((t,n)=>{Br(e);const i=indexedDB.deleteDatabase(e);Fc(t,n,i)})}function rm(e,t){let n=hi[e];n||(n=hi[e]=[]),n.push(t)}const om=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function xt(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||om.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const am=2;function Uc(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=am)}function lm(e){return e.map(({annotation:n,emoticon:i,group:s,order:r,shortcodes:o,skins:a,tags:l,emoji:c,version:u})=>{const f=[...new Set(Uc([...(o||[]).map(xt).flat(),...(l||[]).map(xt).flat(),...xt(n),i]))].sort(),d={annotation:n,group:s,order:r,tags:l,tokens:f,unicode:c,version:u};if(i&&(d.emoticon=i),o&&(d.shortcodes=o),a){d.skinTones=[],d.skinUnicodes=[],d.skinVersions=[];for(const{tone:p,emoji:w,version:b}of a)d.skinTones.push(p),d.skinUnicodes.push(w),d.skinVersions.push(b)}return d})}function Wc(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function lt(e,t,n){Wc(e,"get",t,n)}function Kc(e,t,n){Wc(e,"getAll",t,n)}function Fr(e){e.commit&&e.commit()}function cm(e,t){let n=e[0];for(let i=1;i<e.length;i++){const s=e[i];t(n)>t(s)&&(n=s)}return n}function zc(e,t){const n=cm(e,s=>s.length),i=[];for(const s of n)e.some(r=>r.findIndex(o=>t(o)===t(s))===-1)||i.push(s);return i}async function um(e){return!await Ur(e,_t,pi)}async function dm(e,t,n){const[i,s]=await Promise.all([Ws,pi].map(r=>Ur(e,_t,r)));return i===n&&s===t}async function pm(e,t){return Ne(e,pt,It,(i,s,r)=>{let o;const a=()=>{i.getAll(o&&IDBKeyRange.lowerBound(o,!0),50).onsuccess=l=>{const c=l.target.result;for(const u of c)if(o=u.unicode,t(u))return r(u);if(c.length<50)return r();a()}};a()})}async function jc(e,t,n,i){{const s=lm(t);await Ne(e,[pt,_t],Or,([r,o],a)=>{let l,c,u=0;function f(){++u===2&&d()}function d(){if(!(l===i&&c===n)){r.clear();for(const p of s)r.put(p);o.put(i,Ws),o.put(n,pi),Fr(a)}}lt(o,Ws,p=>{l=p,f()}),lt(o,pi,p=>{c=p,f()})})}}async function hm(e,t){return Ne(e,pt,It,(n,i,s)=>{const r=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Kc(n.index(Oc),r,s)})}async function Hc(e,t){const n=Uc(xt(t));return n.length?Ne(e,pt,It,(i,s,r)=>{const o=[],a=()=>{o.length===n.length&&l()},l=()=>{const c=zc(o,u=>u.unicode);r(c.sort((u,f)=>u.order<f.order?-1:1))};for(let c=0;c<n.length;c++){const u=n[c],f=c===n.length-1?IDBKeyRange.bound(u,u+"",!1,!0):IDBKeyRange.only(u);Kc(i.index(Nc),f,d=>{o.push(d),a()})}}):[]}async function fm(e,t){const n=await Hc(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(r=>r.toLowerCase()).includes(t.toLowerCase()))[0]||null:await pm(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function gm(e,t){return Ne(e,pt,It,(n,i,s)=>lt(n,t,r=>{if(r)return s(r);lt(n.index(Bc),t,o=>s(o||null))}))}function Ur(e,t,n){return Ne(e,t,It,(i,s,r)=>lt(i,n,r))}function mm(e,t,n,i){return Ne(e,t,Or,(s,r)=>{s.put(i,n),Fr(r)})}function ym(e,t){return Ne(e,Dr,Or,(n,i)=>lt(n,t,s=>{n.put((s||0)+1,t),Fr(i)}))}function vm(e,t,n){return n===0?[]:Ne(e,[Dr,pt],It,([i,s],r,o)=>{const a=[];i.index(Dc).openCursor(void 0,"prev").onsuccess=l=>{const c=l.target.result;if(!c)return o(a);function u(p){if(a.push(p),a.length===n)return o(a);c.continue()}const f=c.primaryKey,d=t.byName(f);if(d)return u(d);lt(s,f,p=>{if(p)return u(p);c.continue()})}})}const Kn="";function bm(e,t){const n=new Map;for(const s of e){const r=t(s);for(const o of r){let a=n;for(let c=0;c<o.length;c++){const u=o.charAt(c);let f=a.get(u);f||(f=new Map,a.set(u,f)),a=f}let l=a.get(Kn);l||(l=[],a.set(Kn,l)),l.push(s)}}return(s,r)=>{let o=n;for(let c=0;c<s.length;c++){const u=s.charAt(c),f=o.get(u);if(f)o=f;else return[]}if(r)return o.get(Kn)||[];const a=[],l=[o];for(;l.length;){const u=[...l.shift().entries()].sort((f,d)=>f[0]<d[0]?-1:1);for(const[f,d]of u)f===Kn?a.push(...d):l.push(d)}return a}}const wm=["name","url"];function km(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||wm.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function Sa(e){km(e);const t=(d,p)=>d.name.toLowerCase()<p.name.toLowerCase()?-1:1,n=e.sort(t),s=bm(e,d=>{const p=new Set;if(d.shortcodes)for(const w of d.shortcodes)for(const b of xt(w))p.add(b);return p}),r=d=>s(d,!0),o=d=>s(d,!1),a=d=>{const p=xt(d),w=p.map((b,S)=>(S<p.length-1?r:o)(b));return zc(w,b=>b.name).sort(t)},l=new Map,c=new Map;for(const d of e){c.set(d.name.toLowerCase(),d);for(const p of d.shortcodes||[])l.set(p.toLowerCase(),d)}return{all:n,search:a,byShortcode:d=>l.get(d.toLowerCase()),byName:d=>c.get(d.toLowerCase())}}const Sm=typeof wrappedJSObject<"u";function Gt(e){if(!e)return e;if(Sm&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function qc(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const Am=["annotation","emoji","group","order","version"];function $m(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||Am.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function Vc(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function xm(e){const t=await fetch(e,{method:"HEAD"});Vc(t,e);const n=t.headers.get("etag");return qc(n),n}async function zs(e){const t=await fetch(e);Vc(t,e);const n=t.headers.get("etag");qc(n);const i=await t.json();return $m(i),[n,i]}function Em(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function Tm(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=-1;++s<t;)i[s]=e.charCodeAt(s);return n}async function Gc(e){const t=JSON.stringify(e);let n=Tm(t);const i=await crypto.subtle.digest("SHA-1",n),s=Em(i);return btoa(s)}async function Cm(e,t){let n,i=await xm(t);if(!i){const s=await zs(t);i=s[0],n=s[1],i||(i=await Gc(n))}await dm(e,t,i)||(n||(n=(await zs(t))[1]),await jc(e,n,t,i))}async function _m(e,t){let[n,i]=await zs(t);n||(n=await Gc(i)),await jc(e,i,t,n)}async function Mm(e,t){try{await Cm(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class Pm{constructor({dataSource:t=Zg,locale:n=Jg,customEmoji:i=[]}={}){this.dataSource=t,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=Sa(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await im(this._dbName);rm(this._dbName,this._clear);const n=this.dataSource;await um(t)?await _m(t,n):this._lazyUpdate=Mm(t,n)}async ready(){const t=async()=>(this._ready||(this._ready=this._init()),this._ready);await t(),this._db||await t()}async getEmojiByGroup(t){return cs(t),await this.ready(),ka(await hm(this._db,t)).map(Gt)}async getEmojiBySearchQuery(t){Wn(t),await this.ready();const n=this._custom.search(t),i=ka(await Hc(this._db,t)).map(Gt);return[...n,...i]}async getEmojiByShortcode(t){Wn(t),await this.ready();const n=this._custom.byShortcode(t);return n||Gt(await fm(this._db,t))}async getEmojiByUnicodeOrName(t){Wn(t),await this.ready();const n=this._custom.byName(t);return n||Gt(await gm(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await Ur(this._db,_t,wa)||0}async setPreferredSkinTone(t){return cs(t),await this.ready(),mm(this._db,_t,wa,t)}async incrementFavoriteEmojiCount(t){return Wn(t),await this.ready(),ym(this._db,t)}async getTopFavoriteEmoji(t){return cs(t),await this.ready(),(await vm(this._db,this._custom,t)).map(Gt)}set customEmoji(t){this._custom=Sa(t)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await Br(this._dbName)}async delete(){await this._shutdown(),await sm(this._dbName)}}const js=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([e,t,n])=>({id:e,emoji:t,name:n})),us=js.slice(1),Lm=2,Aa=6,Qc=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function $a(e){return e.unicode.includes("")}const Im={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},Rm=1e3,Nm="🖐️",Dm=8,Om=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],Yc='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Bm=(e,t)=>e<t?-1:e>t?1:0,xa=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const i=n.getContext("2d",{willReadFrequently:!0});return i.textBaseline="top",i.font=`100px ${Yc}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Fm=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Um(e){const t=xa(e,"#000"),n=xa(e,"#fff");return t&&n&&Fm(t,n)}function Wm(){const e=Object.entries(Im);try{for(const[t,n]of e)if(Um(t))return n}catch{}return e[0][1]}let ds;const ps=()=>(ds||(ds=new Promise(e=>Qc(()=>e(Wm())))),ds),Hs=new Map,Km="️",zm="\uD83C",jm="",Hm=127995,qm=57339;function Vm(e,t){if(t===0)return e;const n=e.indexOf(jm);return n!==-1?e.substring(0,n)+String.fromCodePoint(Hm+t-1)+e.substring(n):(e.endsWith(Km)&&(e=e.substring(0,e.length-1)),e+zm+String.fromCodePoint(qm+t-1))}function Se(e){e.preventDefault(),e.stopPropagation()}function hs(e,t,n){return t+=e?-1:1,t<0?t=n.length-1:t>=n.length&&(t=0),t}function Xc(e,t){const n=new Set,i=[];for(const s of e){const r=t(s);n.has(r)||(n.add(r),i.push(s))}return i}function Gm(e,t){const n=i=>{const s={};for(const r of i)typeof r.tone=="number"&&r.version<=t&&(s[r.tone]=r.unicode);return s};return e.map(({unicode:i,skins:s,shortcodes:r,url:o,name:a,category:l,annotation:c})=>({unicode:i,name:a,shortcodes:r,url:o,category:l,annotation:c,id:i||a,skins:s&&n(s)}))}const Yn=requestAnimationFrame;let Qm=typeof ResizeObserver=="function";function Ym(e,t,n){let i;Qm?(i=new ResizeObserver(n),i.observe(e)):Yn(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function Ea(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let fs;function Xm(e,t,n){let i=!0,s=!1;for(const r of e){const o=n(r);if(!o)continue;const a=Ea(o);a===0&&(s=!0),typeof fs>"u"&&(fs=Ea(t));const l=a/1.8<fs;Hs.set(r.unicode,l),l||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
1903
1935
|
This is likely due to using \`display:none\` which is unsupported.
|
|
1904
1936
|
If this is a Jest/Vitest environment, you can ignore this warning.
|
|
1905
|
-
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function Ym(e){return Yc(e,t=>t)}function Xm(e){e&&(e.scrollTop=0)}function on(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function Ea(e){return""+e}function Zm(e){const t=document.createElement("template");return t.innerHTML=e,t}const Jm=new WeakMap,ey=new WeakMap,ty=Symbol("un-keyed"),ny="replaceChildren"in Element.prototype;function iy(e,t){ny?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function sy(e,t){let n=e.firstChild,i=0;for(;n;){if(t[i]!==n)return!0;n=n.nextSibling,i++}return i!==t.length}function ry(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=sy(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&iy(i,e)}function oy(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:r,attributeName:o,attributeValuePre:a,attributeValuePost:l}}=n,c=e[r];if(s!==c)if(n.currentExpression=c,o)if(c===null)i.removeAttribute(o);else{const u=a+Ea(c)+l;i.setAttribute(o,u)}else{let u;Array.isArray(c)?ry(c,n):c instanceof Element?(u=c,i.replaceWith(u)):i.nodeValue=Ea(c),u&&(n.targetNode=u)}}}function ay(e){let t="",n=!1,i=!1,s=-1;const r=new Map,o=[];let a=0;for(let c=0,u=e.length;c<u;c++){const f=e[c];if(t+=f.slice(a),c===u-1)break;for(let x=0;x<f.length;x++)switch(f.charAt(x)){case"<":{f.charAt(x+1)==="/"?o.pop():(n=!0,o.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const d=o[o.length-1],h=on(r,d,()=>[]);let w,b,S;if(i){const x=/(\S+)="?([^"=]*)$/.exec(f);w=x[1],b=x[2];const E=/^([^">]*)("?)/.exec(e[c+1]);S=E[1],t=t.slice(0,-1*x[0].length),a=E[0].length}else a=0;const T={attributeName:w,attributeValuePre:b,attributeValuePost:S,expressionIndex:c};h.push(T),!n&&!i&&(t+=" ")}return{template:Zm(t),elementsToBindings:r}}function Ta(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],r=s.attributeName?t:t.firstChild,o={binding:s,targetNode:r,targetParentNode:void 0,currentExpression:void 0};n.push(o)}}function ly(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))Ta(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let r=e,o=-1;do{const a=t.get(++o);a&&Ta(a,r,n)}while(r=s.nextNode())}return n}function cy(e){const{template:t,elementsToBindings:n}=on(Jm,e,()=>ay(e)),i=t.cloneNode(!0).content.firstElementChild,s=ly(i,n);return function(o){return oy(o,s),i}}function uy(e){const t=on(ey,e,()=>new Map);let n=ty;function i(r,...o){const a=on(t,r,()=>new Map);return on(a,n,()=>cy(r))(o)}function s(r,o,a){return r.map((l,c)=>{const u=n;n=a(l);try{return o(l,c)}finally{n=u}})}return{map:s,html:i}}function dy(e,t,n,i,s,r,o,a,l){const{labelWithSkin:c,titleForEmoji:u,unicodeWithSkin:f}=n,{html:d,map:h}=uy(t);function w(x,E,C){return h(x,(I,U)=>d`<button role="${E?"option":"menuitem"}" aria-selected="${E?U===t.activeSearchItem:null}" aria-label="${c(I,t.currentSkinTone)}" title="${u(I)}" class="${"emoji"+(E&&U===t.activeSearchItem?" active":"")+(I.unicode?"":" custom-emoji")}" id="${`${C}-${I.id}`}" style="${I.unicode?null:`--custom-emoji-background: url(${JSON.stringify(I.url)})`}">${I.unicode?f(I,t.currentSkinTone):""}</button>`,I=>`${C}-${I.id}`)}const S=d`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(t.searchMode&&t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?`emo-${t.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${h(t.skinTones,(x,E)=>d`<div id="skintone-${E}" class="emoji ${E===t.activeSkinTone?"active":""}" aria-selected="${E===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[E]}" aria-label="${t.i18n.skinTones[E]}">${x}</div>`,x=>x)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${h(t.groups,x=>d`<button role="tab" class="nav-button" aria-controls="tab-${x.id}" aria-label="${t.i18n.categories[x.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===x.id}" title="${t.i18n.categories[x.name]}" data-group-id="${x.id}"><div class="nav-emoji emoji">${x.emoji}</div></button>`,x=>x.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${h(t.currentEmojisWithCategories,(x,E)=>d`<div><div id="menu-label-${E}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:x.category?x.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${E!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(x.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${E}" id="${t.searchMode?"search-results":null}">${w(x.emojis,t.searchMode,"emo")}</div></div>`,x=>x.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${w(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,T=(x,E)=>{for(const C of e.querySelectorAll(`[${x}]`))E(C,C.getAttribute(x))};if(l){e.appendChild(S);for(const x of["click","focusout","input","keydown","keyup"])T(`data-on-${x}`,(E,C)=>{E.addEventListener(x,i[C])});T("data-ref",(x,E)=>{r[E]=x}),o.addEventListener("abort",()=>{e.removeChild(S)})}T("data-action",(x,E)=>{let C=a.get(E);C||a.set(E,C=new WeakSet),C.has(x)||(C.add(x),s[E](x))})}const fi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function py(e){let t=!1,n;const i=new Map,s=new Set;let r;const o=()=>{if(t)return;const c=[...s];s.clear();try{for(const u of c)u()}finally{r=!1,s.size&&(r=!0,fi(o))}},a=new Proxy({},{get(c,u){if(n){let f=i.get(u);f||(f=new Set,i.set(u,f)),f.add(n)}return c[u]},set(c,u,f){if(c[u]!==f){c[u]=f;const d=i.get(u);if(d){for(const h of d)s.add(h);r||(r=!0,fi(o))}}return!0}}),l=c=>{const u=()=>{const f=n;n=u;try{return c()}finally{n=f}};return u()};return e.addEventListener("abort",()=>{t=!0}),{state:a,createEffect:l}}function gs(e,t,n){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}const Ca=new WeakMap;function hy(e,t,n){{const i=e.closest(".tabpanel");let s=Ca.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),Ca.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const ms=[],{assign:zn}=Object;function fy(e,t){const n={},i=new AbortController,s=i.signal,{state:r,createEffect:o}=py(s),a=new Map;zn(r,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),zn(r,t),zn(r,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Rm,isRtl:!1,currentGroupIndex:0,groups:us,databaseLoaded:!1,activeSearchItemId:void 0}),o(()=>{r.currentGroup!==r.groups[r.currentGroupIndex]&&(r.currentGroup=r.groups[r.currentGroupIndex])});const l=A=>{e.getElementById(A).focus()},c=A=>e.getElementById(`emo-${A.id}`),u=(A,_)=>{n.rootElement.dispatchEvent(new CustomEvent(A,{detail:_,bubbles:!0,composed:!0}))},f=(A,_)=>A.id===_.id,d=(A,_)=>{const{category:R,emojis:N}=A,{category:H,emojis:K}=_;return R!==H?!1:gs(N,K,f)},h=A=>{gs(r.currentEmojis,A,f)||(r.currentEmojis=A)},w=A=>{r.searchMode!==A&&(r.searchMode=A)},b=A=>{gs(r.currentEmojisWithCategories,A,d)||(r.currentEmojisWithCategories=A)},S=(A,_)=>_&&A.skins&&A.skins[_]||A.unicode,E={labelWithSkin:(A,_)=>Ym([A.name||S(A,_),A.annotation,...A.shortcodes||ms].filter(Boolean)).join(", "),titleForEmoji:A=>A.annotation||(A.shortcodes||ms).join(", "),unicodeWithSkin:S},C={onClickSkinToneButton:j,onEmojiClick:Sn,onNavClick:wn,onNavKeydown:Ii,onSearchKeydown:Li,onSkinToneOptionsClick:An,onSkinToneOptionsFocusOut:De,onSkinToneOptionsKeydown:Ge,onSkinToneOptionsKeyup:Dt,onSearchInput:xn},I={calculateEmojiGridStyle:He,updateOnIntersection:Rt};let U=!0;o(()=>{dy(e,r,E,C,I,n,s,a,U),U=!1}),r.emojiVersion||ps().then(A=>{A||(r.message=r.i18n.emojiUnsupportedMessage)}),o(()=>{async function A(){let _=!1;const R=setTimeout(()=>{_=!0,r.message=r.i18n.loadingMessage},Lm);try{await r.database.ready(),r.databaseLoaded=!0}catch(N){console.error(N),r.message=r.i18n.networkErrorMessage}finally{clearTimeout(R),_&&(_=!1,r.message="")}}r.database&&A()}),o(()=>{r.pickerStyle=`
|
|
1937
|
+
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function Zm(e){return Xc(e,t=>t)}function Jm(e){e&&(e.scrollTop=0)}function on(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function Ta(e){return""+e}function ey(e){const t=document.createElement("template");return t.innerHTML=e,t}const ty=new WeakMap,ny=new WeakMap,iy=Symbol("un-keyed"),sy="replaceChildren"in Element.prototype;function ry(e,t){sy?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function oy(e,t){let n=e.firstChild,i=0;for(;n;){if(t[i]!==n)return!0;n=n.nextSibling,i++}return i!==t.length}function ay(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=oy(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&ry(i,e)}function ly(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:r,attributeName:o,attributeValuePre:a,attributeValuePost:l}}=n,c=e[r];if(s!==c)if(n.currentExpression=c,o)if(c===null)i.removeAttribute(o);else{const u=a+Ta(c)+l;i.setAttribute(o,u)}else{let u;Array.isArray(c)?ay(c,n):c instanceof Element?(u=c,i.replaceWith(u)):i.nodeValue=Ta(c),u&&(n.targetNode=u)}}}function cy(e){let t="",n=!1,i=!1,s=-1;const r=new Map,o=[];let a=0;for(let c=0,u=e.length;c<u;c++){const f=e[c];if(t+=f.slice(a),c===u-1)break;for(let $=0;$<f.length;$++)switch(f.charAt($)){case"<":{f.charAt($+1)==="/"?o.pop():(n=!0,o.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const d=o[o.length-1],p=on(r,d,()=>[]);let w,b,S;if(i){const $=/(\S+)="?([^"=]*)$/.exec(f);w=$[1],b=$[2];const E=/^([^">]*)("?)/.exec(e[c+1]);S=E[1],t=t.slice(0,-1*$[0].length),a=E[0].length}else a=0;const T={attributeName:w,attributeValuePre:b,attributeValuePost:S,expressionIndex:c};p.push(T),!n&&!i&&(t+=" ")}return{template:ey(t),elementsToBindings:r}}function Ca(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],r=s.attributeName?t:t.firstChild,o={binding:s,targetNode:r,targetParentNode:void 0,currentExpression:void 0};n.push(o)}}function uy(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))Ca(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let r=e,o=-1;do{const a=t.get(++o);a&&Ca(a,r,n)}while(r=s.nextNode())}return n}function dy(e){const{template:t,elementsToBindings:n}=on(ty,e,()=>cy(e)),i=t.cloneNode(!0).content.firstElementChild,s=uy(i,n);return function(o){return ly(o,s),i}}function py(e){const t=on(ny,e,()=>new Map);let n=iy;function i(r,...o){const a=on(t,r,()=>new Map);return on(a,n,()=>dy(r))(o)}function s(r,o,a){return r.map((l,c)=>{const u=n;n=a(l);try{return o(l,c)}finally{n=u}})}return{map:s,html:i}}function hy(e,t,n,i,s,r,o,a,l){const{labelWithSkin:c,titleForEmoji:u,unicodeWithSkin:f}=n,{html:d,map:p}=py(t);function w($,E,C){return p($,(I,U)=>d`<button role="${E?"option":"menuitem"}" aria-selected="${E?U===t.activeSearchItem:null}" aria-label="${c(I,t.currentSkinTone)}" title="${u(I)}" class="${"emoji"+(E&&U===t.activeSearchItem?" active":"")+(I.unicode?"":" custom-emoji")}" id="${`${C}-${I.id}`}" style="${I.unicode?null:`--custom-emoji-background: url(${JSON.stringify(I.url)})`}">${I.unicode?f(I,t.currentSkinTone):""}</button>`,I=>`${C}-${I.id}`)}const S=d`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(t.searchMode&&t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?`emo-${t.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${p(t.skinTones,($,E)=>d`<div id="skintone-${E}" class="emoji ${E===t.activeSkinTone?"active":""}" aria-selected="${E===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[E]}" aria-label="${t.i18n.skinTones[E]}">${$}</div>`,$=>$)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${p(t.groups,$=>d`<button role="tab" class="nav-button" aria-controls="tab-${$.id}" aria-label="${t.i18n.categories[$.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===$.id}" title="${t.i18n.categories[$.name]}" data-group-id="${$.id}"><div class="nav-emoji emoji">${$.emoji}</div></button>`,$=>$.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${p(t.currentEmojisWithCategories,($,E)=>d`<div><div id="menu-label-${E}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:$.category?$.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${E!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil($.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${E}" id="${t.searchMode?"search-results":null}">${w($.emojis,t.searchMode,"emo")}</div></div>`,$=>$.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${w(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,T=($,E)=>{for(const C of e.querySelectorAll(`[${$}]`))E(C,C.getAttribute($))};if(l){e.appendChild(S);for(const $ of["click","focusout","input","keydown","keyup"])T(`data-on-${$}`,(E,C)=>{E.addEventListener($,i[C])});T("data-ref",($,E)=>{r[E]=$}),o.addEventListener("abort",()=>{e.removeChild(S)})}T("data-action",($,E)=>{let C=a.get(E);C||a.set(E,C=new WeakSet),C.has($)||(C.add($),s[E]($))})}const fi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function fy(e){let t=!1,n;const i=new Map,s=new Set;let r;const o=()=>{if(t)return;const c=[...s];s.clear();try{for(const u of c)u()}finally{r=!1,s.size&&(r=!0,fi(o))}},a=new Proxy({},{get(c,u){if(n){let f=i.get(u);f||(f=new Set,i.set(u,f)),f.add(n)}return c[u]},set(c,u,f){if(c[u]!==f){c[u]=f;const d=i.get(u);if(d){for(const p of d)s.add(p);r||(r=!0,fi(o))}}return!0}}),l=c=>{const u=()=>{const f=n;n=u;try{return c()}finally{n=f}};return u()};return e.addEventListener("abort",()=>{t=!0}),{state:a,createEffect:l}}function gs(e,t,n){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}const _a=new WeakMap;function gy(e,t,n){{const i=e.closest(".tabpanel");let s=_a.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),_a.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const ms=[],{assign:zn}=Object;function my(e,t){const n={},i=new AbortController,s=i.signal,{state:r,createEffect:o}=fy(s),a=new Map;zn(r,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),zn(r,t),zn(r,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Dm,isRtl:!1,currentGroupIndex:0,groups:us,databaseLoaded:!1,activeSearchItemId:void 0}),o(()=>{r.currentGroup!==r.groups[r.currentGroupIndex]&&(r.currentGroup=r.groups[r.currentGroupIndex])});const l=A=>{e.getElementById(A).focus()},c=A=>e.getElementById(`emo-${A.id}`),u=(A,_)=>{n.rootElement.dispatchEvent(new CustomEvent(A,{detail:_,bubbles:!0,composed:!0}))},f=(A,_)=>A.id===_.id,d=(A,_)=>{const{category:R,emojis:N}=A,{category:H,emojis:K}=_;return R!==H?!1:gs(N,K,f)},p=A=>{gs(r.currentEmojis,A,f)||(r.currentEmojis=A)},w=A=>{r.searchMode!==A&&(r.searchMode=A)},b=A=>{gs(r.currentEmojisWithCategories,A,d)||(r.currentEmojisWithCategories=A)},S=(A,_)=>_&&A.skins&&A.skins[_]||A.unicode,E={labelWithSkin:(A,_)=>Zm([A.name||S(A,_),A.annotation,...A.shortcodes||ms].filter(Boolean)).join(", "),titleForEmoji:A=>A.annotation||(A.shortcodes||ms).join(", "),unicodeWithSkin:S},C={onClickSkinToneButton:j,onEmojiClick:Sn,onNavClick:wn,onNavKeydown:Ii,onSearchKeydown:Li,onSkinToneOptionsClick:An,onSkinToneOptionsFocusOut:De,onSkinToneOptionsKeydown:Ve,onSkinToneOptionsKeyup:Dt,onSearchInput:$n},I={calculateEmojiGridStyle:He,updateOnIntersection:Rt};let U=!0;o(()=>{hy(e,r,E,C,I,n,s,a,U),U=!1}),r.emojiVersion||ps().then(A=>{A||(r.message=r.i18n.emojiUnsupportedMessage)}),o(()=>{async function A(){let _=!1;const R=setTimeout(()=>{_=!0,r.message=r.i18n.loadingMessage},Rm);try{await r.database.ready(),r.databaseLoaded=!0}catch(N){console.error(N),r.message=r.i18n.networkErrorMessage}finally{clearTimeout(R),_&&(_=!1,r.message="")}}r.database&&A()}),o(()=>{r.pickerStyle=`
|
|
1906
1938
|
--num-groups: ${r.groups.length};
|
|
1907
1939
|
--indicator-opacity: ${r.searchMode?0:1};
|
|
1908
|
-
--num-skintones: ${Sa};`}),o(()=>{r.customEmoji&&r.database&&Q()}),o(()=>{r.customEmoji&&r.customEmoji.length?r.groups!==js&&(r.groups=js):r.groups!==us&&(r.currentGroupIndex&&r.currentGroupIndex--,r.groups=us)}),o(()=>{async function A(){r.databaseLoaded&&(r.currentSkinTone=await r.database.getPreferredSkinTone())}A()}),o(()=>{r.skinTones=Array(Sa).fill().map((A,_)=>Hm(r.skinToneEmoji,_))}),o(()=>{r.skinToneButtonText=r.skinTones[r.currentSkinTone]}),o(()=>{r.skinToneButtonLabel=r.i18n.skinToneLabel.replace("{skinTone}",r.i18n.skinTones[r.currentSkinTone])}),o(()=>{async function A(){const{database:_}=r,R=(await Promise.all(Nm.map(N=>_.getEmojiByUnicodeOrName(N)))).filter(Boolean);r.defaultFavoriteEmojis=R}r.databaseLoaded&&A()});function Q(){const{customEmoji:A,database:_}=r,R=A||ms;_.customEmoji!==R&&(_.customEmoji=R)}o(()=>{async function A(){Q();const{database:_,defaultFavoriteEmojis:R,numColumns:N}=r,H=await _.getTopFavoriteEmoji(N),K=await qe(Yc([...H,...R],re=>re.unicode||re.name).slice(0,N));r.currentFavorites=K}r.databaseLoaded&&r.defaultFavoriteEmojis&&A()});function He(A){Vm(A,s,()=>{{const _=getComputedStyle(n.rootElement),R=parseInt(_.getPropertyValue("--num-columns"),10),N=_.getPropertyValue("direction")==="rtl";r.numColumns=R,r.isRtl=N}})}function Rt(A){hy(A,s,_=>{for(const{target:R,isIntersecting:N}of _)R.classList.toggle("onscreen",N)})}o(()=>{async function A(){const{searchText:_,currentGroup:R,databaseLoaded:N,customEmoji:H}=r;if(!N)r.currentEmojis=[],r.searchMode=!1;else if(_.length>=Mm){const K=await Pi(_);r.searchText===_&&(h(K),w(!0))}else{const{id:K}=R;if(K!==-1||H&&H.length){const re=await Mi(K);r.currentGroup.id===K&&(h(re),w(!1))}}}A()});const bn=()=>{Yn(()=>Xm(n.tabpanelElement))};o(()=>{const{currentEmojis:A,emojiVersion:_}=r,R=A.filter(N=>N.unicode).filter(N=>Aa(N)&&!Hs.has(N.unicode));if(!_&&R.length)h(A),Yn(()=>J(R));else{const N=_?A:A.filter(Nt);h(N),bn()}});function J(A){Qm(A,n.baselineEmoji,c)?bn():r.currentEmojis=[...r.currentEmojis]}function Nt(A){return!A.unicode||!Aa(A)||Hs.get(A.unicode)}async function ht(A){const _=r.emojiVersion||await ps();return A.filter(({version:R})=>!R||R<=_)}async function qe(A){return qm(A,r.emojiVersion||await ps())}async function Mi(A){const _=A===-1?r.customEmoji:await r.database.getEmojiByGroup(A);return qe(await ht(_))}async function Pi(A){return qe(await ht(await r.database.getEmojiBySearchQuery(A)))}o(()=>{}),o(()=>{function A(){const{searchMode:R,currentEmojis:N}=r;if(R)return[{category:"",emojis:N}];const H=new Map;for(const K of N){const re=K.category||"";let Oe=H.get(re);Oe||(Oe=[],H.set(re,Oe)),Oe.push(K)}return[...H.entries()].map(([K,re])=>({category:K,emojis:re})).sort((K,re)=>r.customCategorySorting(K.category,re.category))}const _=A();b(_)}),o(()=>{r.activeSearchItemId=r.activeSearchItem!==-1&&r.currentEmojis[r.activeSearchItem].id}),o(()=>{const{rawSearchText:A}=r;Vc(()=>{r.searchText=(A||"").trim(),r.activeSearchItem=-1})});function Li(A){if(!r.searchMode||!r.currentEmojis.length)return;const _=R=>{Se(A),r.activeSearchItem=hs(R,r.activeSearchItem,r.currentEmojis)};switch(A.key){case"ArrowDown":return _(!1);case"ArrowUp":return _(!0);case"Enter":if(r.activeSearchItem===-1)r.activeSearchItem=0;else return Se(A),G(r.currentEmojis[r.activeSearchItem].id)}}function wn(A){const{target:_}=A,R=_.closest(".nav-button");if(!R)return;const N=parseInt(R.dataset.groupId,10);n.searchElement.value="",r.rawSearchText="",r.searchText="",r.activeSearchItem=-1,r.currentGroupIndex=r.groups.findIndex(H=>H.id===N)}function Ii(A){const{target:_,key:R}=A,N=H=>{H&&(Se(A),H.focus())};switch(R){case"ArrowLeft":return N(_.previousElementSibling);case"ArrowRight":return N(_.nextElementSibling);case"Home":return N(_.parentElement.firstElementChild);case"End":return N(_.parentElement.lastElementChild)}}async function kn(A){const _=await r.database.getEmojiByUnicodeOrName(A),R=[...r.currentEmojis,...r.currentFavorites].find(H=>H.id===A),N=R.unicode&&S(R,r.currentSkinTone);return await r.database.incrementFavoriteEmojiCount(A),{emoji:_,skinTone:r.currentSkinTone,...N&&{unicode:N},...R.name&&{name:R.name}}}async function G(A){const _=kn(A);u("emoji-click-sync",_),u("emoji-click",await _)}function Sn(A){const{target:_}=A;if(!_.classList.contains("emoji"))return;Se(A);const R=_.id.substring(4);G(R)}function V(A){r.currentSkinTone=A,r.skinTonePickerExpanded=!1,l("skintone-button"),u("skin-tone-change",{skinTone:A}),r.database.setPreferredSkinTone(A)}function An(A){const{target:{id:_}}=A,R=_&&_.match(/^skintone-(\d)/);if(!R)return;Se(A);const N=parseInt(R[1],10);V(N)}function j(A){r.skinTonePickerExpanded=!r.skinTonePickerExpanded,r.activeSkinTone=r.currentSkinTone,r.skinTonePickerExpanded&&(Se(A),Yn(()=>l("skintone-list")))}o(()=>{r.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{r.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):r.skinTonePickerExpandedAfterAnimation=!1});function Ge(A){if(!r.skinTonePickerExpanded)return;const _=async R=>{Se(A),r.activeSkinTone=R};switch(A.key){case"ArrowUp":return _(hs(!0,r.activeSkinTone,r.skinTones));case"ArrowDown":return _(hs(!1,r.activeSkinTone,r.skinTones));case"Home":return _(0);case"End":return _(r.skinTones.length-1);case"Enter":return Se(A),V(r.activeSkinTone);case"Escape":return Se(A),r.skinTonePickerExpanded=!1,l("skintone-button")}}function Dt(A){if(r.skinTonePickerExpanded&&A.key===" ")return Se(A),V(r.activeSkinTone)}async function De(A){const{relatedTarget:_}=A;(!_||_.id!=="skintone-list")&&(r.skinTonePickerExpanded=!1)}function xn(A){r.rawSearchText=A.target.value}return{$set(A){zn(r,A)},$destroy(){i.abort()}}}const gy="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",my="en";var yy={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading…",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}},vy=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const Xc=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],by=`:host{--emoji-font-family:${Qc}}`;class Wr extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=vy+by,this.shadowRoot.appendChild(n),this._ctx={locale:my,dataSource:gy,skinToneEmoji:Im,customCategorySorting:Dm,customEmoji:null,i18n:yy,emojiVersion:null,...t};for(const i of Xc)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){_a(this),this._cmp||(this._cmp=fy(this.shadowRoot,this._ctx))}disconnectedCallback(){_a(this),fi(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,i){this._set(t.replace(/-([a-z])/g,(s,r)=>r.toUpperCase()),t==="emoji-version"?parseFloat(i):i)}_set(t,n){this._ctx[t]=n,this._cmp&&this._cmp.$set({[t]:n}),["locale","dataSource"].includes(t)&&this._dbFlush()}_dbCreate(){const{locale:t,dataSource:n,database:i}=this._ctx;(!i||i.locale!==t||i.dataSource!==n)&&this._set("database",new _m({locale:t,dataSource:n}))}_dbFlush(){fi(()=>this._dbCreate())}}const Zc={};for(const e of Xc)Zc[e]={get(){return e==="database"&&this._dbCreate(),this._ctx[e]},set(t){if(e==="database")throw new Error("database is read-only");this._set(e,t)}};Object.defineProperties(Wr.prototype,Zc);function _a(e){e instanceof Wr||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Wr);function wy(e){e.style.height="0";const t=Math.max(e.scrollHeight,44);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>e.offsetHeight?"auto":"hidden"}function Ma(e){e.style.height="44px",e.style.overflowY="hidden"}const ky=5e3;function Sy(e){return e?e.active?p`
|
|
1940
|
+
--num-skintones: ${Aa};`}),o(()=>{r.customEmoji&&r.database&&Q()}),o(()=>{r.customEmoji&&r.customEmoji.length?r.groups!==js&&(r.groups=js):r.groups!==us&&(r.currentGroupIndex&&r.currentGroupIndex--,r.groups=us)}),o(()=>{async function A(){r.databaseLoaded&&(r.currentSkinTone=await r.database.getPreferredSkinTone())}A()}),o(()=>{r.skinTones=Array(Aa).fill().map((A,_)=>Vm(r.skinToneEmoji,_))}),o(()=>{r.skinToneButtonText=r.skinTones[r.currentSkinTone]}),o(()=>{r.skinToneButtonLabel=r.i18n.skinToneLabel.replace("{skinTone}",r.i18n.skinTones[r.currentSkinTone])}),o(()=>{async function A(){const{database:_}=r,R=(await Promise.all(Om.map(N=>_.getEmojiByUnicodeOrName(N)))).filter(Boolean);r.defaultFavoriteEmojis=R}r.databaseLoaded&&A()});function Q(){const{customEmoji:A,database:_}=r,R=A||ms;_.customEmoji!==R&&(_.customEmoji=R)}o(()=>{async function A(){Q();const{database:_,defaultFavoriteEmojis:R,numColumns:N}=r,H=await _.getTopFavoriteEmoji(N),K=await qe(Xc([...H,...R],re=>re.unicode||re.name).slice(0,N));r.currentFavorites=K}r.databaseLoaded&&r.defaultFavoriteEmojis&&A()});function He(A){Ym(A,s,()=>{{const _=getComputedStyle(n.rootElement),R=parseInt(_.getPropertyValue("--num-columns"),10),N=_.getPropertyValue("direction")==="rtl";r.numColumns=R,r.isRtl=N}})}function Rt(A){gy(A,s,_=>{for(const{target:R,isIntersecting:N}of _)R.classList.toggle("onscreen",N)})}o(()=>{async function A(){const{searchText:_,currentGroup:R,databaseLoaded:N,customEmoji:H}=r;if(!N)r.currentEmojis=[],r.searchMode=!1;else if(_.length>=Lm){const K=await Pi(_);r.searchText===_&&(p(K),w(!0))}else{const{id:K}=R;if(K!==-1||H&&H.length){const re=await Mi(K);r.currentGroup.id===K&&(p(re),w(!1))}}}A()});const bn=()=>{Yn(()=>Jm(n.tabpanelElement))};o(()=>{const{currentEmojis:A,emojiVersion:_}=r,R=A.filter(N=>N.unicode).filter(N=>$a(N)&&!Hs.has(N.unicode));if(!_&&R.length)p(A),Yn(()=>J(R));else{const N=_?A:A.filter(Nt);p(N),bn()}});function J(A){Xm(A,n.baselineEmoji,c)?bn():r.currentEmojis=[...r.currentEmojis]}function Nt(A){return!A.unicode||!$a(A)||Hs.get(A.unicode)}async function ht(A){const _=r.emojiVersion||await ps();return A.filter(({version:R})=>!R||R<=_)}async function qe(A){return Gm(A,r.emojiVersion||await ps())}async function Mi(A){const _=A===-1?r.customEmoji:await r.database.getEmojiByGroup(A);return qe(await ht(_))}async function Pi(A){return qe(await ht(await r.database.getEmojiBySearchQuery(A)))}o(()=>{}),o(()=>{function A(){const{searchMode:R,currentEmojis:N}=r;if(R)return[{category:"",emojis:N}];const H=new Map;for(const K of N){const re=K.category||"";let Oe=H.get(re);Oe||(Oe=[],H.set(re,Oe)),Oe.push(K)}return[...H.entries()].map(([K,re])=>({category:K,emojis:re})).sort((K,re)=>r.customCategorySorting(K.category,re.category))}const _=A();b(_)}),o(()=>{r.activeSearchItemId=r.activeSearchItem!==-1&&r.currentEmojis[r.activeSearchItem].id}),o(()=>{const{rawSearchText:A}=r;Qc(()=>{r.searchText=(A||"").trim(),r.activeSearchItem=-1})});function Li(A){if(!r.searchMode||!r.currentEmojis.length)return;const _=R=>{Se(A),r.activeSearchItem=hs(R,r.activeSearchItem,r.currentEmojis)};switch(A.key){case"ArrowDown":return _(!1);case"ArrowUp":return _(!0);case"Enter":if(r.activeSearchItem===-1)r.activeSearchItem=0;else return Se(A),V(r.currentEmojis[r.activeSearchItem].id)}}function wn(A){const{target:_}=A,R=_.closest(".nav-button");if(!R)return;const N=parseInt(R.dataset.groupId,10);n.searchElement.value="",r.rawSearchText="",r.searchText="",r.activeSearchItem=-1,r.currentGroupIndex=r.groups.findIndex(H=>H.id===N)}function Ii(A){const{target:_,key:R}=A,N=H=>{H&&(Se(A),H.focus())};switch(R){case"ArrowLeft":return N(_.previousElementSibling);case"ArrowRight":return N(_.nextElementSibling);case"Home":return N(_.parentElement.firstElementChild);case"End":return N(_.parentElement.lastElementChild)}}async function kn(A){const _=await r.database.getEmojiByUnicodeOrName(A),R=[...r.currentEmojis,...r.currentFavorites].find(H=>H.id===A),N=R.unicode&&S(R,r.currentSkinTone);return await r.database.incrementFavoriteEmojiCount(A),{emoji:_,skinTone:r.currentSkinTone,...N&&{unicode:N},...R.name&&{name:R.name}}}async function V(A){const _=kn(A);u("emoji-click-sync",_),u("emoji-click",await _)}function Sn(A){const{target:_}=A;if(!_.classList.contains("emoji"))return;Se(A);const R=_.id.substring(4);V(R)}function G(A){r.currentSkinTone=A,r.skinTonePickerExpanded=!1,l("skintone-button"),u("skin-tone-change",{skinTone:A}),r.database.setPreferredSkinTone(A)}function An(A){const{target:{id:_}}=A,R=_&&_.match(/^skintone-(\d)/);if(!R)return;Se(A);const N=parseInt(R[1],10);G(N)}function j(A){r.skinTonePickerExpanded=!r.skinTonePickerExpanded,r.activeSkinTone=r.currentSkinTone,r.skinTonePickerExpanded&&(Se(A),Yn(()=>l("skintone-list")))}o(()=>{r.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{r.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):r.skinTonePickerExpandedAfterAnimation=!1});function Ve(A){if(!r.skinTonePickerExpanded)return;const _=async R=>{Se(A),r.activeSkinTone=R};switch(A.key){case"ArrowUp":return _(hs(!0,r.activeSkinTone,r.skinTones));case"ArrowDown":return _(hs(!1,r.activeSkinTone,r.skinTones));case"Home":return _(0);case"End":return _(r.skinTones.length-1);case"Enter":return Se(A),G(r.activeSkinTone);case"Escape":return Se(A),r.skinTonePickerExpanded=!1,l("skintone-button")}}function Dt(A){if(r.skinTonePickerExpanded&&A.key===" ")return Se(A),G(r.activeSkinTone)}async function De(A){const{relatedTarget:_}=A;(!_||_.id!=="skintone-list")&&(r.skinTonePickerExpanded=!1)}function $n(A){r.rawSearchText=A.target.value}return{$set(A){zn(r,A)},$destroy(){i.abort()}}}const yy="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",vy="en";var by={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading…",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}},wy=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const Zc=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],ky=`:host{--emoji-font-family:${Yc}}`;class Wr extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=wy+ky,this.shadowRoot.appendChild(n),this._ctx={locale:vy,dataSource:yy,skinToneEmoji:Nm,customCategorySorting:Bm,customEmoji:null,i18n:by,emojiVersion:null,...t};for(const i of Zc)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){Ma(this),this._cmp||(this._cmp=my(this.shadowRoot,this._ctx))}disconnectedCallback(){Ma(this),fi(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,i){this._set(t.replace(/-([a-z])/g,(s,r)=>r.toUpperCase()),t==="emoji-version"?parseFloat(i):i)}_set(t,n){this._ctx[t]=n,this._cmp&&this._cmp.$set({[t]:n}),["locale","dataSource"].includes(t)&&this._dbFlush()}_dbCreate(){const{locale:t,dataSource:n,database:i}=this._ctx;(!i||i.locale!==t||i.dataSource!==n)&&this._set("database",new Pm({locale:t,dataSource:n}))}_dbFlush(){fi(()=>this._dbCreate())}}const Jc={};for(const e of Zc)Jc[e]={get(){return e==="database"&&this._dbCreate(),this._ctx[e]},set(t){if(e==="database")throw new Error("database is read-only");this._set(e,t)}};Object.defineProperties(Wr.prototype,Jc);function Ma(e){e instanceof Wr||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Wr);function Sy(e){e.style.height="0";const t=Math.max(e.scrollHeight,44);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>e.offsetHeight?"auto":"hidden"}function Pa(e){e.style.height="44px",e.style.overflowY="hidden"}const Ay=5e3;function $y(e){return e?e.active?h`
|
|
1909
1941
|
<div class="callout info compaction-indicator compaction-indicator--active">
|
|
1910
1942
|
${D.loader} Compacting context...
|
|
1911
1943
|
</div>
|
|
1912
|
-
`:e.completedAt&&Date.now()-e.completedAt<
|
|
1944
|
+
`:e.completedAt&&Date.now()-e.completedAt<Ay?h`
|
|
1913
1945
|
<div class="callout success compaction-indicator compaction-indicator--complete">
|
|
1914
1946
|
${D.check} Context compacted
|
|
1915
1947
|
</div>
|
|
1916
|
-
`:k:k}const Xt=5*1024*1024;function Zt(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function kt(e,t){var i,s,r;let n=(i=e.closest(".chat"))==null?void 0:i.querySelector(".chat-attachment-error");if(!n){n=document.createElement("div"),n.className="callout danger chat-attachment-error",n.style.cssText="margin: 8px 4px; animation: fade-in 200ms ease-out;";const o=(s=e.closest(".chat"))==null?void 0:s.querySelector(".chat-compose");(r=o==null?void 0:o.parentElement)==null||r.insertBefore(n,o)}n.textContent=t,setTimeout(()=>n==null?void 0:n.remove(),4e3)}const
|
|
1948
|
+
`:k:k}const Xt=5*1024*1024;function Zt(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function kt(e,t){var i,s,r;let n=(i=e.closest(".chat"))==null?void 0:i.querySelector(".chat-attachment-error");if(!n){n=document.createElement("div"),n.className="callout danger chat-attachment-error",n.style.cssText="margin: 8px 4px; animation: fade-in 200ms ease-out;";const o=(s=e.closest(".chat"))==null?void 0:s.querySelector(".chat-compose");(r=o==null?void 0:o.parentElement)==null||r.insertBefore(n,o)}n.textContent=t,setTimeout(()=>n==null?void 0:n.remove(),4e3)}const xy=/\.(md|txt|csv|json|xml|html|css|js|ts|py|sh|yaml|yml|toml|ini|cfg|log|sql)$/i;function Ey(e){return e.type.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name)}function Ty(e){return e.type.startsWith("text/")||e.type==="application/json"||e.type==="application/xml"||xy.test(e.name)}function Cy(e){return e.type==="application/pdf"||/\.pdf$/i.test(e.name)}function _y(e){return e.type.startsWith("video/")||/\.(mp4|webm|mov|avi|mkv|m4v)$/i.test(e.name)}function My(e,t){var s;e.preventDefault(),e.stopPropagation();const n=e.currentTarget;n.classList.remove("chat--dragover");const i=(s=e.dataTransfer)==null?void 0:s.files;if(!(!i||i.length===0))for(let r=0;r<i.length;r++){const o=i[r];if(Ey(o)){if(!t.onAttachmentsChange)continue;if(o.size>Xt){kt(n,`Image too large (${(o.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var f;const l=a.result,c={id:Zt(),dataUrl:l,mimeType:o.type},u=t.attachments??[];(f=t.onAttachmentsChange)==null||f.call(t,[...u,c])},a.readAsDataURL(o)}else if(Ty(o)){if(!t.onAttachmentsChange)continue;if(o.size>Xt){kt(n,`File too large (${(o.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var f;const l=a.result,c={id:Zt(),dataUrl:"",mimeType:o.type||"text/plain",fileName:o.name,textContent:l},u=t.attachments??[];(f=t.onAttachmentsChange)==null||f.call(t,[...u,c])},a.readAsText(o)}else if(Cy(o)){if(!t.onAttachmentsChange)continue;if(o.size>Xt){kt(n,`PDF too large (${(o.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var f;const l=a.result,c={id:Zt(),dataUrl:l,mimeType:"application/pdf",fileName:o.name},u=t.attachments??[];(f=t.onAttachmentsChange)==null||f.call(t,[...u,c])},a.readAsDataURL(o)}else if(_y(o)){if(!t.onAttachmentsChange)continue;if(o.size>Xt){kt(n,`Video too large (${(o.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var f;const l=a.result,c={id:Zt(),dataUrl:l,mimeType:o.type||"video/mp4",fileName:o.name},u=t.attachments??[];(f=t.onAttachmentsChange)==null||f.call(t,[...u,c])},a.readAsDataURL(o)}else kt(n,`Unsupported file type: ${o.name}. Use the Files page to upload to workspace.`)}}function Py(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),e.currentTarget.classList.add("chat--dragover")}function Ly(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&t.classList.remove("chat--dragover")}function Iy(e,t){var s,r,o;const n=(s=e.clipboardData)==null?void 0:s.items;if(!n||!t.onAttachmentsChange)return;const i=[];for(let a=0;a<n.length;a++){const l=n[a];(l.type.startsWith("image/")||l.type.startsWith("video/"))&&i.push(l)}if(i.length!==0){e.preventDefault();for(const a of i){const l=a.getAsFile();if(!l)continue;const c=l.type.startsWith("video/")?"Video":"Image";if(l.size>Xt){const f=((o=(r=e.target)==null?void 0:r.closest)==null?void 0:o.call(r,".chat"))??document.querySelector(".chat");f&&kt(f,`${c} too large (${(l.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const u=new FileReader;u.onload=()=>{var b;const f=u.result,d=l.type.startsWith("video/"),p={id:Zt(),dataUrl:f,mimeType:l.type,fileName:d?l.name||"video.mp4":void 0},w=t.attachments??[];(b=t.onAttachmentsChange)==null||b.call(t,[...w,p])},u.readAsDataURL(l)}}}function Ry(e){const t=e.currentTarget,n=t.closest(".chat-compose"),i=n==null?void 0:n.querySelector(".emoji-picker-popup");if(!i)return;const s=i.classList.toggle("active");if(t.classList.toggle("active",s),s){const r=o=>{i.contains(o.target)||t.contains(o.target)||(i.classList.remove("active"),t.classList.remove("active"),document.removeEventListener("click",r,!0))};requestAnimationFrame(()=>document.addEventListener("click",r,!0))}}function Ny(e,t){const n=e.detail,i=n==null?void 0:n.unicode;if(!i)return;const s=e.currentTarget.closest(".chat-compose"),r=s==null?void 0:s.querySelector("textarea");if(!r)return;const o=r.selectionStart??t.draft.length,a=r.selectionEnd??o,l=t.draft.slice(0,o),c=t.draft.slice(a);t.onDraftChange(l+i+c);const u=s==null?void 0:s.querySelector(".emoji-picker-popup"),f=s==null?void 0:s.querySelector(".chat-compose__emoji");u==null||u.classList.remove("active"),f==null||f.classList.remove("active"),requestAnimationFrame(()=>{r.focus();const d=o+i.length;r.setSelectionRange(d,d)})}function Dy(e){const t=e.attachments??[];return t.length===0?k:h`
|
|
1917
1949
|
<div class="chat-attachments">
|
|
1918
|
-
${t.map(n=>{var i;return n.fileName?
|
|
1950
|
+
${t.map(n=>{var i;return n.fileName?h`
|
|
1919
1951
|
<div class="chat-attachment chat-attachment--file">
|
|
1920
1952
|
<span class="chat-attachment__icon">${(i=n.mimeType)!=null&&i.startsWith("video/")?D.film:D.fileText}</span>
|
|
1921
1953
|
<span class="chat-attachment__name" title=${n.fileName}>${n.fileName}</span>
|
|
@@ -1928,7 +1960,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
1928
1960
|
${D.x}
|
|
1929
1961
|
</button>
|
|
1930
1962
|
</div>
|
|
1931
|
-
`:
|
|
1963
|
+
`:h`
|
|
1932
1964
|
<div class="chat-attachment">
|
|
1933
1965
|
<img
|
|
1934
1966
|
src=${n.dataUrl}
|
|
@@ -1946,30 +1978,30 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
1946
1978
|
</div>
|
|
1947
1979
|
`})}
|
|
1948
1980
|
</div>
|
|
1949
|
-
`}function
|
|
1981
|
+
`}function eu(e){var d,p,w;const t=e.connected,n=e.sending||e.stream!==null,i=!!(e.canAbort&&e.onAbort),s=(p=(d=e.sessions)==null?void 0:d.sessions)==null?void 0:p.find(b=>b.key===e.sessionKey),r=(s==null?void 0:s.reasoningLevel)??"off",o=e.showThinking&&r!=="off";e.assistantName,e.assistantAvatar??e.assistantAvatarUrl;const a=(((w=e.attachments)==null?void 0:w.length)??0)>0,l=e.connected?a?"Add a message...":"Message...":"Connecting…",c=e.splitRatio??.6,u=!!(e.sidebarOpen&&e.onCloseSidebar),f=h`
|
|
1950
1982
|
<div
|
|
1951
1983
|
class="chat-thread"
|
|
1952
1984
|
role="log"
|
|
1953
1985
|
aria-live="polite"
|
|
1954
1986
|
@scroll=${e.onChatScroll}
|
|
1955
1987
|
>
|
|
1956
|
-
${e.loading?
|
|
1957
|
-
${
|
|
1988
|
+
${e.loading?h`<div class="muted">Loading chat…</div>`:k}
|
|
1989
|
+
${ff(zy(e),b=>b.key,b=>b.kind==="interim"?Bg(b.text):b.kind==="reading-indicator"?Og():b.kind==="stream"?Fg(b.text,b.startedAt,e.onOpenSidebar):b.kind==="group"?Ug(b,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName}):k)}
|
|
1958
1990
|
</div>
|
|
1959
|
-
`;return
|
|
1991
|
+
`;return h`
|
|
1960
1992
|
<section
|
|
1961
1993
|
class="card chat"
|
|
1962
|
-
@drop=${b=>
|
|
1963
|
-
@dragover=${
|
|
1964
|
-
@dragleave=${
|
|
1994
|
+
@drop=${b=>My(b,e)}
|
|
1995
|
+
@dragover=${Py}
|
|
1996
|
+
@dragleave=${Ly}
|
|
1965
1997
|
>
|
|
1966
|
-
${e.disabledReason?
|
|
1998
|
+
${e.disabledReason?h`<div class="callout">${e.disabledReason}</div>`:k}
|
|
1967
1999
|
|
|
1968
|
-
${e.error?
|
|
2000
|
+
${e.error?h`<div class="callout danger">${e.error}</div>`:k}
|
|
1969
2001
|
|
|
1970
|
-
${
|
|
2002
|
+
${$y(e.compactionStatus)}
|
|
1971
2003
|
|
|
1972
|
-
${e.focusMode?
|
|
2004
|
+
${e.focusMode?h`
|
|
1973
2005
|
<button
|
|
1974
2006
|
class="chat-focus-exit"
|
|
1975
2007
|
type="button"
|
|
@@ -1989,7 +2021,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
1989
2021
|
style="flex: ${u?`0 0 ${c*100}%`:"1 1 100%"}"
|
|
1990
2022
|
>
|
|
1991
2023
|
${f}
|
|
1992
|
-
${e.nearBottom===!1?
|
|
2024
|
+
${e.nearBottom===!1?h`
|
|
1993
2025
|
<button
|
|
1994
2026
|
class="chat-scroll-bottom"
|
|
1995
2027
|
type="button"
|
|
@@ -2002,20 +2034,20 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2002
2034
|
`:k}
|
|
2003
2035
|
</div>
|
|
2004
2036
|
|
|
2005
|
-
${u?
|
|
2037
|
+
${u?h`
|
|
2006
2038
|
<resizable-divider
|
|
2007
2039
|
.splitRatio=${c}
|
|
2008
2040
|
@resize=${b=>{var S;return(S=e.onSplitRatioChange)==null?void 0:S.call(e,b.detail.splitRatio)}}
|
|
2009
2041
|
></resizable-divider>
|
|
2010
2042
|
<div class="chat-sidebar">
|
|
2011
|
-
${
|
|
2043
|
+
${Kg({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
|
|
2012
2044
|
${e.sidebarContent}
|
|
2013
2045
|
\`\`\``)}})}
|
|
2014
2046
|
</div>
|
|
2015
2047
|
`:k}
|
|
2016
2048
|
</div>
|
|
2017
2049
|
|
|
2018
|
-
${e.suggestion?
|
|
2050
|
+
${e.suggestion?h`
|
|
2019
2051
|
<div class="chat-suggestions">
|
|
2020
2052
|
<button
|
|
2021
2053
|
class="chat-suggestion-chip"
|
|
@@ -2028,12 +2060,12 @@ ${e.sidebarContent}
|
|
|
2028
2060
|
`:k}
|
|
2029
2061
|
|
|
2030
2062
|
<div class="chat-compose">
|
|
2031
|
-
${
|
|
2063
|
+
${Dy(e)}
|
|
2032
2064
|
<div class="chat-compose__row">
|
|
2033
2065
|
<button
|
|
2034
2066
|
class="chat-compose__emoji"
|
|
2035
2067
|
type="button"
|
|
2036
|
-
@click=${
|
|
2068
|
+
@click=${Ry}
|
|
2037
2069
|
aria-label="Emoji"
|
|
2038
2070
|
title="Emoji"
|
|
2039
2071
|
>
|
|
@@ -2044,13 +2076,13 @@ ${e.sidebarContent}
|
|
|
2044
2076
|
<textarea
|
|
2045
2077
|
.value=${e.draft}
|
|
2046
2078
|
?disabled=${!e.connected}
|
|
2047
|
-
@keydown=${b=>{b.key==="Enter"&&(b.isComposing||b.keyCode===229||b.shiftKey||e.connected&&(b.preventDefault(),t&&(e.onSend(),
|
|
2048
|
-
@input=${b=>{const S=b.target;e.onDraftChange(S.value),
|
|
2049
|
-
@paste=${b=>
|
|
2079
|
+
@keydown=${b=>{b.key==="Enter"&&(b.isComposing||b.keyCode===229||b.shiftKey||e.connected&&(b.preventDefault(),t&&(e.onSend(),Pa(b.target))))}}
|
|
2080
|
+
@input=${b=>{const S=b.target;e.onDraftChange(S.value),Sy(S)}}
|
|
2081
|
+
@paste=${b=>Iy(b,e)}
|
|
2050
2082
|
placeholder=${l}
|
|
2051
2083
|
></textarea>
|
|
2052
2084
|
</label>
|
|
2053
|
-
${i?
|
|
2085
|
+
${i?h`
|
|
2054
2086
|
<button
|
|
2055
2087
|
class="btn btn--icon chat-compose__send"
|
|
2056
2088
|
@click=${e.onAbort}
|
|
@@ -2063,7 +2095,7 @@ ${e.sidebarContent}
|
|
|
2063
2095
|
<button
|
|
2064
2096
|
class="btn btn--icon chat-compose__send primary"
|
|
2065
2097
|
?disabled=${!e.connected}
|
|
2066
|
-
@click=${b=>{var T;e.onSend();const S=(T=b.target.closest(".chat-compose"))==null?void 0:T.querySelector("textarea");S&&
|
|
2098
|
+
@click=${b=>{var T;e.onSend();const S=(T=b.target.closest(".chat-compose"))==null?void 0:T.querySelector("textarea");S&&Pa(S)}}
|
|
2067
2099
|
aria-label="${n?"Queue":"Send"}"
|
|
2068
2100
|
title="${n?"Queue message":"Send (Enter)"}"
|
|
2069
2101
|
>
|
|
@@ -2072,13 +2104,13 @@ ${e.sidebarContent}
|
|
|
2072
2104
|
</div>
|
|
2073
2105
|
<div class="emoji-picker-popup">
|
|
2074
2106
|
<emoji-picker
|
|
2075
|
-
@emoji-click=${b=>
|
|
2107
|
+
@emoji-click=${b=>Ny(b,e)}
|
|
2076
2108
|
></emoji-picker>
|
|
2077
2109
|
</div>
|
|
2078
|
-
${e.publicMode?k:
|
|
2110
|
+
${e.publicMode?k:Wy(e)}
|
|
2079
2111
|
</div>
|
|
2080
2112
|
</section>
|
|
2081
|
-
`}const
|
|
2113
|
+
`}const Oy=[{id:"claude-opus-4-6",shortName:"Opus",description:"Most capable"},{id:"claude-sonnet-4-5-20250929",shortName:"Sonnet",description:"Fast & capable"},{id:"claude-haiku-4-5-20251001",shortName:"Haiku",description:"Fastest"}];function By(e){const t=new Set(e.filter(n=>n.provider==="anthropic").map(n=>n.id));return Oy.filter(n=>t.has(n.id)).map(n=>({key:`anthropic/${n.id}`,...n}))}const Fy=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Uy(e){var s;const t=e.currentTarget,n=(s=t.closest(".chat-model-bar"))==null?void 0:s.querySelector(".chat-settings-menu");if(!n)return;const i=n.classList.contains("active");if(document.querySelectorAll(".chat-settings-menu.active").forEach(r=>r.classList.remove("active")),!i){n.classList.add("active");const r=o=>{!n.contains(o.target)&&o.target!==t&&!t.contains(o.target)&&(n.classList.remove("active"),document.removeEventListener("click",r))};requestAnimationFrame(()=>document.addEventListener("click",r))}}function Wy(e){if(!e.connected)return k;const t=e.modelCatalog??[],n=By(t);if(n.length===0)return k;const i=e.modelProvider&&e.model?`${e.modelProvider}/${e.model}`:null,s=e.thinkingLevel??"off",r=e.verboseLevel==="on"||e.verboseLevel==="full",o=e.fillerEnabled===!0;return h`
|
|
2082
2114
|
<div class="chat-model-bar">
|
|
2083
2115
|
<div class="chat-model-bar__select">
|
|
2084
2116
|
<select
|
|
@@ -2086,7 +2118,7 @@ ${e.sidebarContent}
|
|
|
2086
2118
|
.value=${i??""}
|
|
2087
2119
|
@change=${a=>{const l=a.target.value;l&&e.onModelChange&&e.onModelChange(l)}}
|
|
2088
2120
|
>
|
|
2089
|
-
${n.map(a=>
|
|
2121
|
+
${n.map(a=>h`
|
|
2090
2122
|
<option value=${a.key} ?selected=${a.key===i}>
|
|
2091
2123
|
${a.shortName} — ${a.description}
|
|
2092
2124
|
</option>
|
|
@@ -2099,7 +2131,7 @@ ${e.sidebarContent}
|
|
|
2099
2131
|
.value=${s}
|
|
2100
2132
|
@change=${a=>{const l=a.target.value;e.onThinkingLevelChange&&e.onThinkingLevelChange(l)}}
|
|
2101
2133
|
>
|
|
2102
|
-
${
|
|
2134
|
+
${Fy.map(a=>h`
|
|
2103
2135
|
<option value=${a.value} ?selected=${a.value===s}>
|
|
2104
2136
|
Thinking: ${a.label}
|
|
2105
2137
|
</option>
|
|
@@ -2109,7 +2141,7 @@ ${e.sidebarContent}
|
|
|
2109
2141
|
<button
|
|
2110
2142
|
class="chat-model-bar__settings-btn"
|
|
2111
2143
|
type="button"
|
|
2112
|
-
@click=${
|
|
2144
|
+
@click=${Uy}
|
|
2113
2145
|
aria-label="Message settings"
|
|
2114
2146
|
title="Message settings"
|
|
2115
2147
|
>
|
|
@@ -2136,35 +2168,35 @@ ${e.sidebarContent}
|
|
|
2136
2168
|
</label>
|
|
2137
2169
|
</div>
|
|
2138
2170
|
</div>
|
|
2139
|
-
`}const
|
|
2171
|
+
`}const La=200;function Ky(e){const t=[];let n=null;for(const i of e){if(i.kind!=="message"){n&&(t.push(n),n=null),t.push(i);continue}const s=fl(i.message),r=gl(s.role),o=s.timestamp||Date.now();!n||n.role!==r?(n&&t.push(n),n={kind:"group",key:`group:${r}:${i.key}`,role:r,messages:[{message:i.message,key:i.key}],timestamp:o,isStreaming:!1}):n.messages.push({message:i.message,key:i.key})}return n&&t.push(n),t}function zy(e){var o;const t=[],n=Array.isArray(e.messages)?e.messages:[],i=Array.isArray(e.toolMessages)?e.toolMessages:[],s=e.showThinking||e.verboseLevel==="on"||e.verboseLevel==="full",r=Math.max(0,n.length-La);r>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${La} messages (${r} hidden).`,timestamp:Date.now()}});for(let a=r;a<n.length;a++){const l=n[a],c=fl(l);!s&&c.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:Ia(l,a),message:l})}if(s)for(let a=0;a<i.length;a++)t.push({kind:"message",key:Ia(i[a],a+n.length),message:i[a]});if(e.interimText&&t.push({kind:"interim",key:"interim:thinking",text:e.interimText}),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})}for(const a of e.queue){const l=((o=a.attachments)==null?void 0:o.filter(u=>u.fileName).map(u=>u.fileName))??[],c=l.length>0?a.text?`${l.join(", ")}
|
|
2140
2172
|
|
|
2141
|
-
${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,message:{role:"user",content:[{type:"text",text:c}],timestamp:a.createdAt}})}return
|
|
2173
|
+
${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,message:{role:"user",content:[{type:"text",text:c}],timestamp:a.createdAt}})}return Ky(t)}function Ia(e,t){const n=e,i=typeof n.toolCallId=="string"?n.toolCallId:"";if(i)return`tool:${i}`;const s=typeof n.id=="string"?n.id:"";if(s)return`msg:${s}`;const r=typeof n.messageId=="string"?n.messageId:"";if(r)return`msg:${r}`;const o=typeof n.timestamp=="number"?n.timestamp:null,a=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${a}:${o}:${t}`:`msg:${a}:${t}`}function jy(e){return e.connected?h`
|
|
2142
2174
|
<div class="setup-container setup-container--full chat-page">
|
|
2143
2175
|
${ut("Chat",e.wsProps)}
|
|
2144
2176
|
<div class="chat-viewport">
|
|
2145
|
-
${
|
|
2177
|
+
${eu(e)}
|
|
2146
2178
|
</div>
|
|
2147
2179
|
</div>
|
|
2148
|
-
`:
|
|
2180
|
+
`:h`
|
|
2149
2181
|
<div class="setup-container">
|
|
2150
2182
|
<div class="setup-card">
|
|
2151
2183
|
<div class="setup-spinner"></div>
|
|
2152
2184
|
<p>Connecting to gateway...</p>
|
|
2153
2185
|
</div>
|
|
2154
2186
|
</div>
|
|
2155
|
-
`}function
|
|
2156
|
-
${
|
|
2157
|
-
${
|
|
2158
|
-
${e.newEventModalOpen?
|
|
2159
|
-
${t?
|
|
2160
|
-
`}function
|
|
2187
|
+
`}function Hy(e){return e?`${ul(e)} (${wi(e)})`:"n/a"}function tu(e){const t=e.state??{},n=t.lastStatus??"n/a",i=t.lastRunAtMs?wi(t.lastRunAtMs):"never";return`${n} · last ${i}`}function nu(e){const t=e.schedule;return t.kind==="at"?`One-time: ${ul(t.atMs)}`:t.kind==="every"?`Every ${dl(t.everyMs)}`:qy(t.expr,t.tz)}function qy(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[i,s,r,o,a]=n,l=t?` (${t.replace(/^.*\//,"").replace(/_/g," ")})`:"",c=(b,S)=>new Date(2e3,0,1,b,S).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),u=/^\d{1,2}$/.test(i)?parseInt(i,10):null,f=Ra(s);if(u===null||!f)return`${e}${t?` (${t})`:""}`;const d=f.map(b=>c(b,u)),p=d.length<=3?d.join(" & "):`${d.slice(0,-1).join(", ")} & ${d[d.length-1]}`,w=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(r==="*"&&o==="*"){if(a==="*")return`Daily at ${p}${l}`;if(a==="1-5")return`Weekdays at ${p}${l}`;if(a==="0,6"||a==="6,0")return`Weekends at ${p}${l}`;const b=Ra(a);if(b)return`${b.map(T=>w[T%7]??String(T)).join(", ")} at ${p}${l}`}return`${e}${t?` (${t})`:""}`}function Ra(e){if(e==="*")return null;if(/^\d+(,\d+)*$/.test(e))return e.split(",").map(Number);if(/^\d+-\d+$/.test(e)){const[t,n]=e.split("-").map(Number);if(t>n)return null;const i=[];for(let s=t;s<=n;s++)i.push(s);return i}return null}function Vy(e,t=!0){const n=e.payload;return n.kind==="systemEvent"?`Task: ${t&&n.text.length>60?`${n.text.slice(0,57)}…`:n.text}`:`Message: ${t&&n.message.length>60?`${n.message.slice(0,57)}…`:n.message}`}function Na(e){const t=e.payload;if(t.kind!=="agentTurn")return null;const n=t.channel??t.provider,i=t.to;if(!i&&!n)return null;const s=[];return i&&s.push(i),n&&n!=="last"&&s.push(`via ${n}`),s.join(" ")||null}function Gy(e){var s;const t=["last",...e.channels.filter(Boolean)],n=(s=e.form.channel)==null?void 0:s.trim();n&&!t.includes(n)&&t.push(n);const i=new Set;return t.filter(r=>i.has(r)?!1:(i.add(r),!0))}function Qy(e,t){var i,s;if(t==="last")return"last";const n=(i=e.channelMeta)==null?void 0:i.find(r=>r.id===t);return n!=null&&n.label?n.label:((s=e.channelLabels)==null?void 0:s[t])??t}function Yy(e){return e||"Default"}const Da=h`<svg viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg>`,Xy=h`<svg viewBox="0 0 24 24"><rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/></svg>`,Zy=h`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,iu=h`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,Jy=h`<svg viewBox="0 0 24 24"><path d="M12 5v14"/><path d="M5 12h14"/></svg>`;function Oa(e){const t=e.detailJobId?e.jobs.find(n=>n.id===e.detailJobId)??null:null;return h`
|
|
2188
|
+
${ev(e)}
|
|
2189
|
+
${tv(e)}
|
|
2190
|
+
${e.newEventModalOpen?iv(e):k}
|
|
2191
|
+
${t?rv(t,e):k}
|
|
2192
|
+
`}function ev(e){const t=e.status,n=(t==null?void 0:t.enabled)??!1,i=(t==null?void 0:t.jobs)??0,s=t==null?void 0:t.nextWakeAtMs;return h`
|
|
2161
2193
|
<div class="event-status-bar">
|
|
2162
2194
|
<div class="event-status-bar__info">
|
|
2163
2195
|
<span class="statusDot ${n?"ok":""}"></span>
|
|
2164
2196
|
<span>${n?"Active":"Inactive"}</span>
|
|
2165
2197
|
<span class="event-status-bar__sep">\u00b7</span>
|
|
2166
2198
|
<span>${i} event${i!==1?"s":""}</span>
|
|
2167
|
-
${s?
|
|
2199
|
+
${s?h`
|
|
2168
2200
|
<span class="event-status-bar__sep">\u00b7</span>
|
|
2169
2201
|
<span>Next: ${wi(s)}</span>
|
|
2170
2202
|
`:k}
|
|
@@ -2176,17 +2208,17 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2176
2208
|
>
|
|
2177
2209
|
${e.loading?"Refreshing…":"Refresh"}
|
|
2178
2210
|
</button>
|
|
2179
|
-
${e.error?
|
|
2211
|
+
${e.error?h`<span class="muted">${e.error}</span>`:k}
|
|
2180
2212
|
</div>
|
|
2181
2213
|
<button class="btn primary btn--sm" @click=${e.onNewEventModalOpen}>
|
|
2182
|
-
${
|
|
2214
|
+
${Jy} New Event
|
|
2183
2215
|
</button>
|
|
2184
2216
|
</div>
|
|
2185
|
-
`}function
|
|
2217
|
+
`}function tv(e){return e.jobs.length===0?h`<div class="muted" style="padding: 20px 0;">No events yet. Create one to get started.</div>`:h`
|
|
2186
2218
|
<div class="event-grid">
|
|
2187
|
-
${e.jobs.map(t=>
|
|
2219
|
+
${e.jobs.map(t=>nv(t,e))}
|
|
2188
2220
|
</div>
|
|
2189
|
-
`}function
|
|
2221
|
+
`}function nv(e,t){return h`
|
|
2190
2222
|
<div
|
|
2191
2223
|
class="event-card ${e.enabled?"":"disabled"}"
|
|
2192
2224
|
@click=${()=>t.onDetailOpen(e)}
|
|
@@ -2197,12 +2229,12 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2197
2229
|
${e.enabled?"On":"Off"}
|
|
2198
2230
|
</span>
|
|
2199
2231
|
</div>
|
|
2200
|
-
<div class="event-card__schedule">${
|
|
2201
|
-
${e.agentId?
|
|
2202
|
-
${
|
|
2232
|
+
<div class="event-card__schedule">${nu(e)}</div>
|
|
2233
|
+
${e.agentId?h`<div class="event-card__agent">${Yy(e.agentId)}</div>`:k}
|
|
2234
|
+
${Na(e)?h`<div class="event-card__agent muted" style="font-size: 11px;">\u2192 ${Na(e)}</div>`:k}
|
|
2203
2235
|
<div class="event-card__footer">
|
|
2204
2236
|
<div class="event-card__status">
|
|
2205
|
-
<span class="muted" style="font-size: 11px;">${
|
|
2237
|
+
<span class="muted" style="font-size: 11px;">${tu(e)}</span>
|
|
2206
2238
|
</div>
|
|
2207
2239
|
<div class="event-card__actions" @click=${n=>n.stopPropagation()}>
|
|
2208
2240
|
<button
|
|
@@ -2211,7 +2243,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2211
2243
|
?disabled=${t.busy}
|
|
2212
2244
|
@click=${()=>t.onToggle(e,!e.enabled)}
|
|
2213
2245
|
>
|
|
2214
|
-
${e.enabled?
|
|
2246
|
+
${e.enabled?Xy:Da}
|
|
2215
2247
|
</button>
|
|
2216
2248
|
<button
|
|
2217
2249
|
class="btn-icon"
|
|
@@ -2219,7 +2251,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2219
2251
|
?disabled=${t.busy}
|
|
2220
2252
|
@click=${()=>t.onRun(e)}
|
|
2221
2253
|
>
|
|
2222
|
-
${
|
|
2254
|
+
${Da}
|
|
2223
2255
|
</button>
|
|
2224
2256
|
<button
|
|
2225
2257
|
class="btn-icon danger"
|
|
@@ -2227,18 +2259,18 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2227
2259
|
?disabled=${t.busy}
|
|
2228
2260
|
@click=${()=>t.onRemove(e)}
|
|
2229
2261
|
>
|
|
2230
|
-
${
|
|
2262
|
+
${Zy}
|
|
2231
2263
|
</button>
|
|
2232
2264
|
</div>
|
|
2233
2265
|
</div>
|
|
2234
2266
|
</div>
|
|
2235
|
-
`}function
|
|
2267
|
+
`}function iv(e){const t=Gy(e);return h`
|
|
2236
2268
|
<div class="event-modal-overlay" @click=${e.onNewEventModalClose}>
|
|
2237
2269
|
<div class="event-modal" @click=${n=>n.stopPropagation()}>
|
|
2238
2270
|
<div class="event-modal__header">
|
|
2239
2271
|
<div class="event-modal__title">New Event</div>
|
|
2240
2272
|
<button class="event-modal__close" @click=${e.onNewEventModalClose}>
|
|
2241
|
-
${
|
|
2273
|
+
${iu}
|
|
2242
2274
|
</button>
|
|
2243
2275
|
</div>
|
|
2244
2276
|
|
|
@@ -2266,7 +2298,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2266
2298
|
@change=${n=>e.onFormChange({agentId:n.target.value})}
|
|
2267
2299
|
>
|
|
2268
2300
|
<option value="">Default</option>
|
|
2269
|
-
${e.agentIds.map(n=>
|
|
2301
|
+
${e.agentIds.map(n=>h`<option value=${n}>${n}</option>`)}
|
|
2270
2302
|
</select>
|
|
2271
2303
|
</label>
|
|
2272
2304
|
<label class="field checkbox">
|
|
@@ -2290,7 +2322,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2290
2322
|
</label>
|
|
2291
2323
|
</div>
|
|
2292
2324
|
|
|
2293
|
-
${
|
|
2325
|
+
${sv(e)}
|
|
2294
2326
|
|
|
2295
2327
|
<div class="form-grid" style="margin-top: 12px;">
|
|
2296
2328
|
<label class="field">
|
|
@@ -2335,7 +2367,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2335
2367
|
></textarea>
|
|
2336
2368
|
</label>
|
|
2337
2369
|
|
|
2338
|
-
${e.form.payloadKind==="agentTurn"?
|
|
2370
|
+
${e.form.payloadKind==="agentTurn"?h`
|
|
2339
2371
|
<div class="form-grid" style="margin-top: 12px;">
|
|
2340
2372
|
<label class="field checkbox">
|
|
2341
2373
|
<span>Deliver response</span>
|
|
@@ -2351,8 +2383,8 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2351
2383
|
.value=${e.form.channel||"last"}
|
|
2352
2384
|
@change=${n=>e.onFormChange({channel:n.target.value})}
|
|
2353
2385
|
>
|
|
2354
|
-
${t.map(n=>
|
|
2355
|
-
${
|
|
2386
|
+
${t.map(n=>h`<option value=${n}>
|
|
2387
|
+
${Qy(e,n)}
|
|
2356
2388
|
</option>`)}
|
|
2357
2389
|
</select>
|
|
2358
2390
|
</label>
|
|
@@ -2371,7 +2403,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2371
2403
|
@input=${n=>e.onFormChange({timeoutSeconds:n.target.value})}
|
|
2372
2404
|
/>
|
|
2373
2405
|
</label>
|
|
2374
|
-
${e.form.sessionTarget==="isolated"?
|
|
2406
|
+
${e.form.sessionTarget==="isolated"?h`
|
|
2375
2407
|
<label class="field">
|
|
2376
2408
|
<span>Summary prefix</span>
|
|
2377
2409
|
<input
|
|
@@ -2391,7 +2423,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2391
2423
|
</div>
|
|
2392
2424
|
</div>
|
|
2393
2425
|
</div>
|
|
2394
|
-
`}function
|
|
2426
|
+
`}function sv(e){const t=e.form;return t.scheduleKind==="at"?h`
|
|
2395
2427
|
<label class="field" style="margin-top: 12px;">
|
|
2396
2428
|
<span>Run at</span>
|
|
2397
2429
|
<input
|
|
@@ -2400,7 +2432,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2400
2432
|
@input=${n=>e.onFormChange({scheduleAt:n.target.value})}
|
|
2401
2433
|
/>
|
|
2402
2434
|
</label>
|
|
2403
|
-
`:t.scheduleKind==="every"?
|
|
2435
|
+
`:t.scheduleKind==="every"?h`
|
|
2404
2436
|
<div class="form-grid" style="margin-top: 12px;">
|
|
2405
2437
|
<label class="field">
|
|
2406
2438
|
<span>Repeat every</span>
|
|
@@ -2421,7 +2453,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2421
2453
|
</select>
|
|
2422
2454
|
</label>
|
|
2423
2455
|
</div>
|
|
2424
|
-
`:
|
|
2456
|
+
`:h`
|
|
2425
2457
|
<div class="form-grid" style="margin-top: 12px;">
|
|
2426
2458
|
<label class="field">
|
|
2427
2459
|
<span>Cron expression</span>
|
|
@@ -2440,17 +2472,17 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2440
2472
|
/>
|
|
2441
2473
|
</label>
|
|
2442
2474
|
</div>
|
|
2443
|
-
`}function
|
|
2475
|
+
`}function rv(e,t){var n;return h`
|
|
2444
2476
|
<div class="event-modal-overlay" @click=${t.onDetailClose}>
|
|
2445
2477
|
<div class="event-modal" @click=${i=>i.stopPropagation()}>
|
|
2446
2478
|
<div class="event-modal__header">
|
|
2447
2479
|
<div class="event-modal__title">${e.name||"Untitled Event"}</div>
|
|
2448
2480
|
<button class="event-modal__close" @click=${t.onDetailClose}>
|
|
2449
|
-
${
|
|
2481
|
+
${iu}
|
|
2450
2482
|
</button>
|
|
2451
2483
|
</div>
|
|
2452
2484
|
|
|
2453
|
-
${e.description?
|
|
2485
|
+
${e.description?h`<div style="color: var(--muted); font-size: 13px; margin-bottom: 16px;">${e.description}</div>`:k}
|
|
2454
2486
|
|
|
2455
2487
|
<div class="event-detail-section">
|
|
2456
2488
|
<div class="event-detail-row">
|
|
@@ -2463,9 +2495,9 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2463
2495
|
</div>
|
|
2464
2496
|
<div class="event-detail-row">
|
|
2465
2497
|
<span class="event-detail-label">Schedule</span>
|
|
2466
|
-
<span class="event-detail-value">${
|
|
2498
|
+
<span class="event-detail-value">${nu(e)}</span>
|
|
2467
2499
|
</div>
|
|
2468
|
-
${e.agentId?
|
|
2500
|
+
${e.agentId?h`
|
|
2469
2501
|
<div class="event-detail-row">
|
|
2470
2502
|
<span class="event-detail-label">Agent</span>
|
|
2471
2503
|
<span class="event-detail-value mono">${e.agentId}</span>
|
|
@@ -2485,21 +2517,21 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2485
2517
|
</div>
|
|
2486
2518
|
<div class="event-detail-row" style="flex-direction: column; align-items: stretch; gap: 4px;">
|
|
2487
2519
|
<span class="event-detail-label">Action</span>
|
|
2488
|
-
<span class="event-detail-value" style="text-align: left; white-space: pre-wrap; font-size: 12px; color: var(--muted); line-height: 1.5;">${
|
|
2520
|
+
<span class="event-detail-value" style="text-align: left; white-space: pre-wrap; font-size: 12px; color: var(--muted); line-height: 1.5;">${Vy(e,!1)}</span>
|
|
2489
2521
|
</div>
|
|
2490
|
-
${e.payload.kind==="agentTurn"&&e.payload.to?
|
|
2522
|
+
${e.payload.kind==="agentTurn"&&e.payload.to?h`
|
|
2491
2523
|
<div class="event-detail-row">
|
|
2492
2524
|
<span class="event-detail-label">Send to</span>
|
|
2493
2525
|
<span class="event-detail-value mono">${e.payload.to}</span>
|
|
2494
2526
|
</div>
|
|
2495
2527
|
`:k}
|
|
2496
|
-
${e.payload.kind==="agentTurn"&&(e.payload.channel??e.payload.provider)?
|
|
2528
|
+
${e.payload.kind==="agentTurn"&&(e.payload.channel??e.payload.provider)?h`
|
|
2497
2529
|
<div class="event-detail-row">
|
|
2498
2530
|
<span class="event-detail-label">Channel</span>
|
|
2499
2531
|
<span class="event-detail-value">${e.payload.channel??e.payload.provider}</span>
|
|
2500
2532
|
</div>
|
|
2501
2533
|
`:k}
|
|
2502
|
-
${e.payload.kind==="agentTurn"?
|
|
2534
|
+
${e.payload.kind==="agentTurn"?h`
|
|
2503
2535
|
<div class="event-detail-row">
|
|
2504
2536
|
<span class="event-detail-label">Auto-deliver</span>
|
|
2505
2537
|
<span class="event-detail-value">${e.payload.deliver?"Yes":"No"}</span>
|
|
@@ -2510,12 +2542,12 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2510
2542
|
<div class="event-detail-section">
|
|
2511
2543
|
<div class="event-detail-row">
|
|
2512
2544
|
<span class="event-detail-label">Last run</span>
|
|
2513
|
-
<span class="event-detail-value">${
|
|
2545
|
+
<span class="event-detail-value">${tu(e)}</span>
|
|
2514
2546
|
</div>
|
|
2515
|
-
${(n=e.state)!=null&&n.nextRunAtMs?
|
|
2547
|
+
${(n=e.state)!=null&&n.nextRunAtMs?h`
|
|
2516
2548
|
<div class="event-detail-row">
|
|
2517
2549
|
<span class="event-detail-label">Next run</span>
|
|
2518
|
-
<span class="event-detail-value">${
|
|
2550
|
+
<span class="event-detail-value">${Hy(e.state.nextRunAtMs)}</span>
|
|
2519
2551
|
</div>
|
|
2520
2552
|
`:k}
|
|
2521
2553
|
</div>
|
|
@@ -2524,9 +2556,9 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2524
2556
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;">
|
|
2525
2557
|
<span class="event-detail-label" style="font-size: 14px;">Recent Activity</span>
|
|
2526
2558
|
</div>
|
|
2527
|
-
${t.runs.length===0?
|
|
2559
|
+
${t.runs.length===0?h`<div class="muted" style="font-size: 13px;">No runs recorded yet.</div>`:h`
|
|
2528
2560
|
<div class="list">
|
|
2529
|
-
${[...t.runs].sort((i,s)=>s.ts-i.ts).map(i=>
|
|
2561
|
+
${[...t.runs].sort((i,s)=>s.ts-i.ts).map(i=>av(i))}
|
|
2530
2562
|
</div>
|
|
2531
2563
|
`}
|
|
2532
2564
|
</div>
|
|
@@ -2556,24 +2588,24 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2556
2588
|
</div>
|
|
2557
2589
|
</div>
|
|
2558
2590
|
</div>
|
|
2559
|
-
`}function
|
|
2591
|
+
`}function ov(e){const t=e.toLowerCase();return t==="ok"||t==="success"?"chip chip-ok":t==="error"||t==="fail"||t==="failed"?"chip chip-warn":"chip"}function av(e){return h`
|
|
2560
2592
|
<div class="list-item" style="grid-template-columns: 1fr; gap: 6px;">
|
|
2561
2593
|
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
|
2562
|
-
<span class=${
|
|
2594
|
+
<span class=${ov(e.status)} style="font-size: 11px; padding: 2px 8px;">
|
|
2563
2595
|
${e.status}
|
|
2564
2596
|
</span>
|
|
2565
2597
|
<span class="muted" style="font-size: 12px;">${wi(e.ts)}</span>
|
|
2566
|
-
<span class="muted" style="font-size: 12px;">${
|
|
2598
|
+
<span class="muted" style="font-size: 12px;">${dl(e.durationMs)}</span>
|
|
2567
2599
|
</div>
|
|
2568
|
-
${e.summary?
|
|
2569
|
-
${e.error?
|
|
2600
|
+
${e.summary?h`<div class="muted" style="font-size: 12px;">${e.summary}</div>`:k}
|
|
2601
|
+
${e.error?h`
|
|
2570
2602
|
<details style="margin-top: 2px;">
|
|
2571
2603
|
<summary class="muted" style="cursor: pointer; font-size: 12px;">Error details</summary>
|
|
2572
2604
|
<div class="muted" style="margin-top: 4px; white-space: pre-wrap; font-size: 12px;">${e.error}</div>
|
|
2573
2605
|
</details>
|
|
2574
2606
|
`:k}
|
|
2575
2607
|
</div>
|
|
2576
|
-
`}function
|
|
2608
|
+
`}function lv(e){var s;const t=((s=e.report)==null?void 0:s.skills)??[],n=e.filter.trim().toLowerCase(),i=n?t.filter(r=>[r.name,r.description,r.source].join(" ").toLowerCase().includes(n)):t;return h`
|
|
2577
2609
|
<section class="card">
|
|
2578
2610
|
<div class="row" style="justify-content: space-between;">
|
|
2579
2611
|
<div>
|
|
@@ -2597,34 +2629,34 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2597
2629
|
<div class="muted">${i.length} shown</div>
|
|
2598
2630
|
</div>
|
|
2599
2631
|
|
|
2600
|
-
${e.error?
|
|
2632
|
+
${e.error?h`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:k}
|
|
2601
2633
|
|
|
2602
|
-
${i.length===0?
|
|
2634
|
+
${i.length===0?h`<div class="muted" style="margin-top: 16px;">No skills found.</div>`:h`
|
|
2603
2635
|
<div class="list" style="margin-top: 16px;">
|
|
2604
|
-
${i.map(r=>
|
|
2636
|
+
${i.map(r=>cv(r,e))}
|
|
2605
2637
|
</div>
|
|
2606
2638
|
`}
|
|
2607
2639
|
</section>
|
|
2608
|
-
`}function
|
|
2640
|
+
`}function cv(e,t){const n=t.busyKey===e.skillKey,i=t.edits[e.skillKey]??"",s=t.messages[e.skillKey]??null,r=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}`)],a=[];return e.disabled&&a.push("disabled"),e.blockedByAllowlist&&a.push("blocked by allowlist"),h`
|
|
2609
2641
|
<div class="list-item">
|
|
2610
2642
|
<div class="list-main">
|
|
2611
2643
|
<div class="list-title">
|
|
2612
2644
|
${e.emoji?`${e.emoji} `:""}${e.name}
|
|
2613
2645
|
</div>
|
|
2614
|
-
<div class="list-sub">${
|
|
2646
|
+
<div class="list-sub">${hd(e.description,140)}</div>
|
|
2615
2647
|
<div class="chip-row" style="margin-top: 6px;">
|
|
2616
2648
|
<span class="chip">${e.source}</span>
|
|
2617
2649
|
<span class="chip ${e.eligible?"chip-ok":"chip-warn"}">
|
|
2618
2650
|
${e.eligible?"eligible":"blocked"}
|
|
2619
2651
|
</span>
|
|
2620
|
-
${e.disabled?
|
|
2652
|
+
${e.disabled?h`<span class="chip chip-warn">disabled</span>`:k}
|
|
2621
2653
|
</div>
|
|
2622
|
-
${o.length>0?
|
|
2654
|
+
${o.length>0?h`
|
|
2623
2655
|
<div class="muted" style="margin-top: 6px;">
|
|
2624
2656
|
Missing: ${o.join(", ")}
|
|
2625
2657
|
</div>
|
|
2626
2658
|
`:k}
|
|
2627
|
-
${a.length>0?
|
|
2659
|
+
${a.length>0?h`
|
|
2628
2660
|
<div class="muted" style="margin-top: 6px;">
|
|
2629
2661
|
Reason: ${a.join(", ")}
|
|
2630
2662
|
</div>
|
|
@@ -2639,7 +2671,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2639
2671
|
>
|
|
2640
2672
|
${e.disabled?"Enable":"Disable"}
|
|
2641
2673
|
</button>
|
|
2642
|
-
${r?
|
|
2674
|
+
${r?h`<button
|
|
2643
2675
|
class="btn"
|
|
2644
2676
|
?disabled=${n}
|
|
2645
2677
|
@click=${()=>t.onInstall(e.skillKey,e.name,e.install[0].id)}
|
|
@@ -2647,13 +2679,13 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2647
2679
|
${n?"Installing…":e.install[0].label}
|
|
2648
2680
|
</button>`:k}
|
|
2649
2681
|
</div>
|
|
2650
|
-
${s?
|
|
2682
|
+
${s?h`<div
|
|
2651
2683
|
class="muted"
|
|
2652
2684
|
style="margin-top: 8px; color: ${s.kind==="error"?"var(--danger-color, #d14343)":"var(--success-color, #0a7f5a)"};"
|
|
2653
2685
|
>
|
|
2654
2686
|
${s.message}
|
|
2655
2687
|
</div>`:k}
|
|
2656
|
-
${e.primaryEnv?
|
|
2688
|
+
${e.primaryEnv?h`
|
|
2657
2689
|
<div class="field" style="margin-top: 10px;">
|
|
2658
2690
|
<span>API key</span>
|
|
2659
2691
|
<input
|
|
@@ -2673,7 +2705,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2673
2705
|
`:k}
|
|
2674
2706
|
</div>
|
|
2675
2707
|
</div>
|
|
2676
|
-
`}const
|
|
2708
|
+
`}const Ba=["user","assistant","tool","thinking","error"],Fa={user:"User",assistant:"Assistant",tool:"Tool",thinking:"Thinking",error:"Error",system:"System"};function uv(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function dv(e){return e.split(":").slice(2).join(":")||e}function pv(e,t){return t?[e.content,e.agentId,e.sessionKey,e.sessionId,e.toolName].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function hv(e,t=500){return e.length<=t?e:e.slice(0,t)+"..."}function fv(e){const t=e.filterText.trim().toLowerCase();Ba.some(i=>!e.typeFilters[i]),e.agents.some(i=>!e.agentFilters[i]);const n=e.entries.filter(i=>!e.typeFilters[i.type]||e.agents.length>0&&!(e.agentFilters[i.agentId]??!0)?!1:pv(i,t));return h`
|
|
2677
2709
|
<div>
|
|
2678
2710
|
<div class="filters" style="margin-top: 14px;">
|
|
2679
2711
|
<label class="field" style="min-width: 220px;">
|
|
@@ -2687,20 +2719,20 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2687
2719
|
</div>
|
|
2688
2720
|
|
|
2689
2721
|
<div class="chip-row" style="margin-top: 12px;">
|
|
2690
|
-
${
|
|
2722
|
+
${Ba.map(i=>h`
|
|
2691
2723
|
<label class="chip session-log-chip ${i}">
|
|
2692
2724
|
<input
|
|
2693
2725
|
type="checkbox"
|
|
2694
2726
|
.checked=${e.typeFilters[i]}
|
|
2695
2727
|
@change=${s=>e.onTypeToggle(i,s.target.checked)}
|
|
2696
2728
|
/>
|
|
2697
|
-
<span>${
|
|
2729
|
+
<span>${Fa[i]}</span>
|
|
2698
2730
|
</label>
|
|
2699
2731
|
`)}
|
|
2700
2732
|
</div>
|
|
2701
2733
|
|
|
2702
2734
|
<div class="chip-row" style="margin-top: 8px; align-items: center;">
|
|
2703
|
-
${e.agents.map(i=>
|
|
2735
|
+
${e.agents.map(i=>h`
|
|
2704
2736
|
<label class="chip agent-chip">
|
|
2705
2737
|
<input
|
|
2706
2738
|
type="checkbox"
|
|
@@ -2720,25 +2752,25 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2720
2752
|
</label>
|
|
2721
2753
|
</div>
|
|
2722
2754
|
|
|
2723
|
-
${e.error?
|
|
2755
|
+
${e.error?h`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:k}
|
|
2724
2756
|
|
|
2725
2757
|
<div class="log-stream" style="margin-top: 12px;" @scroll=${e.onScroll}>
|
|
2726
|
-
${n.length===0?
|
|
2758
|
+
${n.length===0?h`<div class="muted" style="padding: 12px;">No session log entries.</div>`:n.map(i=>h`
|
|
2727
2759
|
<div class="log-row session-entry ${i.type}">
|
|
2728
2760
|
<div class="log-row-header">
|
|
2729
|
-
<span class="log-time mono">${
|
|
2730
|
-
<span class="session-log-type ${i.type}">${
|
|
2761
|
+
<span class="log-time mono">${uv(i.timestamp)}</span>
|
|
2762
|
+
<span class="session-log-type ${i.type}">${Fa[i.type]}</span>
|
|
2731
2763
|
<span class="log-subsystem mono">${i.agentId}</span>
|
|
2732
|
-
<span class="session-label mono">${
|
|
2733
|
-
${i.toolName?
|
|
2734
|
-
${i.model?
|
|
2764
|
+
<span class="session-label mono">${dv(i.sessionKey)}</span>
|
|
2765
|
+
${i.toolName?h`<span class="session-tool mono">${i.toolName}</span>`:k}
|
|
2766
|
+
${i.model?h`<span class="session-model mono">${i.model}</span>`:k}
|
|
2735
2767
|
</div>
|
|
2736
|
-
<div class="log-message mono">${
|
|
2768
|
+
<div class="log-message mono">${hv(i.content)}</div>
|
|
2737
2769
|
</div>
|
|
2738
2770
|
`)}
|
|
2739
2771
|
</div>
|
|
2740
2772
|
</div>
|
|
2741
|
-
`}const qs=["trace","debug","info","warn","error","fatal"];function
|
|
2773
|
+
`}const qs=["trace","debug","info","warn","error","fatal"];function gv(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function su(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function mv(e){return h`
|
|
2742
2774
|
<section class="card">
|
|
2743
2775
|
<div class="row" style="justify-content: space-between;">
|
|
2744
2776
|
<div>
|
|
@@ -2746,18 +2778,18 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2746
2778
|
<div class="card-sub">Session transcripts and system logs.</div>
|
|
2747
2779
|
</div>
|
|
2748
2780
|
<div class="row" style="gap: 8px;">
|
|
2749
|
-
${e.logsSubTab==="system"?
|
|
2781
|
+
${e.logsSubTab==="system"?h`
|
|
2750
2782
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
2751
2783
|
${e.loading?"Loading…":"Refresh"}
|
|
2752
2784
|
</button>
|
|
2753
2785
|
<button
|
|
2754
2786
|
class="btn"
|
|
2755
2787
|
?disabled=${e.entries.length===0}
|
|
2756
|
-
@click=${()=>{const t=e.filterText.trim().toLowerCase(),n=qs.some(r=>!e.levelFilters[r]),i=e.entries.filter(r=>r.level&&!e.levelFilters[r.level]?!1:
|
|
2788
|
+
@click=${()=>{const t=e.filterText.trim().toLowerCase(),n=qs.some(r=>!e.levelFilters[r]),i=e.entries.filter(r=>r.level&&!e.levelFilters[r.level]?!1:su(r,t)),s=t||n?"filtered":"visible";e.onExport(i.map(r=>r.raw),s)}}
|
|
2757
2789
|
>
|
|
2758
2790
|
Export
|
|
2759
2791
|
</button>
|
|
2760
|
-
`:
|
|
2792
|
+
`:h`
|
|
2761
2793
|
<button class="btn" ?disabled=${e.sessionLogsProps.loading} @click=${e.sessionLogsProps.onRefresh}>
|
|
2762
2794
|
${e.sessionLogsProps.loading?"Loading…":"Refresh"}
|
|
2763
2795
|
</button>
|
|
@@ -2783,9 +2815,9 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2783
2815
|
</button>
|
|
2784
2816
|
</div>
|
|
2785
2817
|
|
|
2786
|
-
${e.logsSubTab==="session"?
|
|
2818
|
+
${e.logsSubTab==="session"?fv(e.sessionLogsProps):yv(e)}
|
|
2787
2819
|
</section>
|
|
2788
|
-
`}function
|
|
2820
|
+
`}function yv(e){const t=e.filterText.trim().toLowerCase();qs.some(i=>!e.levelFilters[i]);const n=e.entries.filter(i=>i.level&&!e.levelFilters[i.level]?!1:su(i,t));return h`
|
|
2789
2821
|
<div class="filters" style="margin-top: 14px;">
|
|
2790
2822
|
<label class="field" style="min-width: 220px;">
|
|
2791
2823
|
<span>Filter</span>
|
|
@@ -2806,7 +2838,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2806
2838
|
</div>
|
|
2807
2839
|
|
|
2808
2840
|
<div class="chip-row" style="margin-top: 12px;">
|
|
2809
|
-
${qs.map(i=>
|
|
2841
|
+
${qs.map(i=>h`
|
|
2810
2842
|
<label class="chip log-chip ${i}">
|
|
2811
2843
|
<input
|
|
2812
2844
|
type="checkbox"
|
|
@@ -2818,17 +2850,17 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2818
2850
|
`)}
|
|
2819
2851
|
</div>
|
|
2820
2852
|
|
|
2821
|
-
${e.file?
|
|
2822
|
-
${e.truncated?
|
|
2853
|
+
${e.file?h`<div class="muted" style="margin-top: 10px;">File: ${e.file}</div>`:k}
|
|
2854
|
+
${e.truncated?h`<div class="callout" style="margin-top: 10px;">
|
|
2823
2855
|
Log output truncated; showing latest chunk.
|
|
2824
2856
|
</div>`:k}
|
|
2825
|
-
${e.error?
|
|
2857
|
+
${e.error?h`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:k}
|
|
2826
2858
|
|
|
2827
2859
|
<div class="log-stream" style="margin-top: 12px;" @scroll=${e.onScroll}>
|
|
2828
|
-
${n.length===0?
|
|
2860
|
+
${n.length===0?h`<div class="muted" style="padding: 12px;">No log entries.</div>`:[...n].reverse().map(i=>h`
|
|
2829
2861
|
<div class="log-row">
|
|
2830
2862
|
<div class="log-row-header">
|
|
2831
|
-
<span class="log-time mono">${
|
|
2863
|
+
<span class="log-time mono">${gv(i.time)}</span>
|
|
2832
2864
|
<span class="log-level ${i.level??""}">${i.level??""}</span>
|
|
2833
2865
|
<span class="log-subsystem mono">${i.subsystem??""}</span>
|
|
2834
2866
|
</div>
|
|
@@ -2836,13 +2868,13 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2836
2868
|
</div>
|
|
2837
2869
|
`)}
|
|
2838
2870
|
</div>
|
|
2839
|
-
`}const
|
|
2871
|
+
`}const vv=[{id:"cron",label:"Events"},{id:"skills",label:"Skills"},{id:"logs",label:"Logs"}];function bv(e){switch(e.activeTab){case"cron":return Oa(e.cronProps);case"skills":return lv(e.skillsProps);case"logs":return mv(e.logsProps);default:return Oa(e.cronProps)}}function wv(e){return e.connected?h`
|
|
2840
2872
|
<div class="setup-container">
|
|
2841
2873
|
${ut("Advanced",e.wsProps)}
|
|
2842
2874
|
<div class="setup-card sp-card-advanced" style="text-align: left;">
|
|
2843
2875
|
<h1>Advanced</h1>
|
|
2844
2876
|
<div class="sp-tabs">
|
|
2845
|
-
${
|
|
2877
|
+
${vv.map(t=>h`
|
|
2846
2878
|
<button
|
|
2847
2879
|
class="sp-tab ${e.activeTab===t.id?"active":""}"
|
|
2848
2880
|
@click=${()=>e.onTabChange(t.id)}
|
|
@@ -2851,29 +2883,29 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2851
2883
|
</button>
|
|
2852
2884
|
`)}
|
|
2853
2885
|
</div>
|
|
2854
|
-
${
|
|
2886
|
+
${bv(e)}
|
|
2855
2887
|
</div>
|
|
2856
2888
|
</div>
|
|
2857
|
-
`:
|
|
2889
|
+
`:h`
|
|
2858
2890
|
<div class="setup-container">
|
|
2859
2891
|
<div class="setup-card">
|
|
2860
2892
|
<div class="setup-spinner"></div>
|
|
2861
2893
|
<p>Connecting to gateway...</p>
|
|
2862
2894
|
</div>
|
|
2863
2895
|
</div>
|
|
2864
|
-
`}function
|
|
2896
|
+
`}function Ua(e){if(!e.show)return k;const t=Ie(),n=e.isFirstTime,i=e.changePinMode===!0&&!n,s=e.changePinBusy===!0;let r=e.accounts.length>0?e.accounts[0].id:"";const o=d=>{var w;r=d.target.value;const p=(w=d.target.closest(".login-card"))==null?void 0:w.querySelector(".login-change-pin");p&&(p.style.display=r==="__master__"?"":"none")},a=d=>p=>{const w=p.target;w.value=w.value.replace(/\D/g,"").slice(0,6),d(w.value)},l=!n&&e.accounts.length>1?h`
|
|
2865
2897
|
<select
|
|
2866
2898
|
class="login-account-select"
|
|
2867
2899
|
@change=${o}
|
|
2868
2900
|
?disabled=${e.busy||s}
|
|
2869
2901
|
>
|
|
2870
|
-
${e.accounts.map((d,
|
|
2871
|
-
<option value=${d.id} ?selected=${
|
|
2902
|
+
${e.accounts.map((d,p)=>h`
|
|
2903
|
+
<option value=${d.id} ?selected=${p===0}>
|
|
2872
2904
|
${d.displayName}
|
|
2873
2905
|
</option>
|
|
2874
2906
|
`)}
|
|
2875
2907
|
</select>
|
|
2876
|
-
`:k;if(i){let d="",
|
|
2908
|
+
`:k;if(i){let d="",p="",w="";const b=S=>{var T;S.preventDefault(),!s&&(!d||!p||!w||p===w&&r&&((T=e.onChangePin)==null||T.call(e,r,d,p)))};return h`
|
|
2877
2909
|
<div class="login-overlay">
|
|
2878
2910
|
<div class="login-card">
|
|
2879
2911
|
<img class="login-logo" src="${t.iconUrl}" alt="${t.name}" />
|
|
@@ -2902,7 +2934,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2902
2934
|
maxlength="6"
|
|
2903
2935
|
placeholder="New PIN (4-6 digits)"
|
|
2904
2936
|
?disabled=${s}
|
|
2905
|
-
@input=${a(S=>{
|
|
2937
|
+
@input=${a(S=>{p=S})}
|
|
2906
2938
|
/>
|
|
2907
2939
|
<input
|
|
2908
2940
|
class="login-pin-input"
|
|
@@ -2915,13 +2947,13 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2915
2947
|
?disabled=${s}
|
|
2916
2948
|
@input=${a(S=>{w=S})}
|
|
2917
2949
|
/>
|
|
2918
|
-
${e.changePinError?
|
|
2919
|
-
${e.changePinSuccess?
|
|
2950
|
+
${e.changePinError?h`<p class="login-error">${e.changePinError}</p>`:k}
|
|
2951
|
+
${e.changePinSuccess?h`<p class="login-success">${e.changePinSuccess}</p>`:k}
|
|
2920
2952
|
<button
|
|
2921
2953
|
class="login-submit"
|
|
2922
2954
|
type="submit"
|
|
2923
2955
|
?disabled=${s}
|
|
2924
|
-
>${s?
|
|
2956
|
+
>${s?h`<span class="login-spinner"></span>`:"Change PIN"}</button>
|
|
2925
2957
|
</form>
|
|
2926
2958
|
<p class="login-hint" style="margin-top: 16px;">
|
|
2927
2959
|
<a
|
|
@@ -2932,7 +2964,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2932
2964
|
</p>
|
|
2933
2965
|
</div>
|
|
2934
2966
|
</div>
|
|
2935
|
-
`}let c="",u="";const f=d=>{if(d.preventDefault(),!e.busy)if(n){if(!c||!u||c!==u)return;e.onSubmit(c)}else{if(!c||!r)return;e.onSubmit(r,c)}};return
|
|
2967
|
+
`}let c="",u="";const f=d=>{if(d.preventDefault(),!e.busy)if(n){if(!c||!u||c!==u)return;e.onSubmit(c)}else{if(!c||!r)return;e.onSubmit(r,c)}};return h`
|
|
2936
2968
|
<div class="login-overlay">
|
|
2937
2969
|
<div class="login-card">
|
|
2938
2970
|
<img class="login-logo" src="${t.iconUrl}" alt="${t.name}" />
|
|
@@ -2954,7 +2986,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2954
2986
|
@input=${a(d=>{c=d})}
|
|
2955
2987
|
autofocus
|
|
2956
2988
|
/>
|
|
2957
|
-
${n?
|
|
2989
|
+
${n?h`
|
|
2958
2990
|
<input
|
|
2959
2991
|
class="login-pin-input"
|
|
2960
2992
|
type="password"
|
|
@@ -2967,48 +2999,48 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2967
2999
|
@input=${a(d=>{u=d})}
|
|
2968
3000
|
/>
|
|
2969
3001
|
`:k}
|
|
2970
|
-
${e.error?
|
|
3002
|
+
${e.error?h`<p class="login-error">${e.error}</p>`:k}
|
|
2971
3003
|
<button
|
|
2972
3004
|
class="login-submit"
|
|
2973
3005
|
type="submit"
|
|
2974
3006
|
?disabled=${e.busy}
|
|
2975
3007
|
>
|
|
2976
|
-
${e.busy?
|
|
3008
|
+
${e.busy?h`<span class="login-spinner"></span>`:n?"Set PIN":"Unlock"}
|
|
2977
3009
|
</button>
|
|
2978
3010
|
</form>
|
|
2979
|
-
${n?
|
|
3011
|
+
${n?h`<p class="login-hint">This PIN protects all accounts on this device. You'll need it every time you open the dashboard.</p>`:e.accounts.some(d=>d.id==="__master__")?h`<p class="login-hint login-change-pin" style="margin-top: 16px;${r!=="__master__"?" display: none;":""}">
|
|
2980
3012
|
<a
|
|
2981
3013
|
class="login-link"
|
|
2982
3014
|
href="#"
|
|
2983
|
-
@click=${d=>{var
|
|
3015
|
+
@click=${d=>{var p;d.preventDefault(),(p=e.onToggleChangePinMode)==null||p.call(e)}}
|
|
2984
3016
|
>Change PIN</a>
|
|
2985
3017
|
</p>`:k}
|
|
2986
3018
|
</div>
|
|
2987
3019
|
</div>
|
|
2988
|
-
`}function
|
|
3020
|
+
`}function kv(e){if(!e.connected)return h`
|
|
2989
3021
|
<div class="setup-container">
|
|
2990
3022
|
<div class="setup-card">
|
|
2991
3023
|
<div class="setup-spinner"></div>
|
|
2992
3024
|
<p>Connecting...</p>
|
|
2993
3025
|
</div>
|
|
2994
3026
|
</div>
|
|
2995
|
-
`;const t={...e,sessions:null,focusMode:!1,showThinking:!1,thinkingLevel:null,publicMode:!0,onToggleFocusMode:()=>{},onSessionKeyChange:()=>{},onNewSession:()=>{}},n=e.assistantName||"Assistant",i=e.assistantAvatar??e.assistantAvatarUrl??null;return
|
|
3027
|
+
`;const t={...e,sessions:null,focusMode:!1,showThinking:!1,thinkingLevel:null,publicMode:!0,onToggleFocusMode:()=>{},onSessionKeyChange:()=>{},onNewSession:()=>{}},n=e.assistantName||"Assistant",i=e.assistantAvatar??e.assistantAvatarUrl??null,s=i&&/^(https?:\/\/|data:image\/|\/)/i.test(i)?i:null;return h`
|
|
2996
3028
|
<div class="setup-container setup-container--full public-chat-page">
|
|
2997
3029
|
<div class="public-chat-header">
|
|
2998
|
-
${
|
|
3030
|
+
${s?h`<img class="public-chat-header__avatar" src=${s} alt=${n} />`:k}
|
|
2999
3031
|
<span class="public-chat-header__name">${n}</span>
|
|
3000
3032
|
</div>
|
|
3001
3033
|
<div class="chat-viewport">
|
|
3002
|
-
${
|
|
3034
|
+
${eu(t)}
|
|
3003
3035
|
</div>
|
|
3004
3036
|
</div>
|
|
3005
|
-
`}async function wv(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}}}async function vn(e){if(!(!e.client||!e.connected)&&!e.workspacesLoading){e.workspacesLoading=!0,e.workspacesError=null;try{const t=await e.client.request("workspaces.list",{});e.workspaces=t.workspaces}catch(t){e.workspacesError=String(t)}finally{e.workspacesLoading=!1}}}async function kv(e,t){var i,s;if(!e.client||!e.connected||e.workspaceSaving)return;const n=t.name.trim();if(!n){e.workspacesError="Account name is required.";return}e.workspaceSaving=!0,e.workspacesError=null;try{const r=await e.client.request("config.get",{});e.configSnapshot=r;const o=r.hash;if(!o){e.workspacesError="Config hash missing; reload and retry.";return}const a={name:n,baseHash:o,whatsappAccountName:n};(i=t.workspacePath)!=null&&i.trim()&&(a.workspaceDir=t.workspacePath.trim());const l=await e.client.request("workspaces.create",a);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await vn(e),(s=t.onCreated)==null||s.call(t,l)}catch(r){e.workspacesError=String(r)}finally{e.workspaceSaving=!1}}async function Sv(e,t){if(!(!e.client||!e.connected)&&!e.workspaceSaving){e.workspaceSaving=!0,e.workspacesError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=n.hash;if(!i){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.remove",{name:t,baseHash:i}),e.workspaceRemoveConfirm=null,await vn(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function Av(e,t,n){if(!(!e.client||!e.connected)){e.workspacesError=null;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.hash;if(!s){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.rename",{name:t,displayName:n,baseHash:s}),await vn(e)}catch(i){e.workspacesError=String(i)}}}const jn=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:kv,loadWorkspaces:vn,removeWorkspace:Sv,renameWorkspace:Av},Symbol.toStringTag,{value:"Module"})),su={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"taskmaster-control-ui",SETUP_UI:"setup-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"taskmaster-macos",IOS_APP:"taskmaster-ios",ANDROID_APP:"taskmaster-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"taskmaster-probe",PUBLIC_CHAT:"public-chat"},Ua=su,Gs={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(su));new Set(Object.values(Gs));function xv(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),i=e.token??"",s=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),i];return t==="v2"&&s.push(e.nonce??""),s.join("|")}const $v=4008;class Ev{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(){var t;this.closed=!0,(t=this.ws)==null||t.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){var t;return((t=this.ws)==null?void 0:t.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=>{var i,s;const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),(s=(i=this.opts).onClose)==null||s.call(i,{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(){var f;if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=this.opts.role??"operator",n=this.opts.scopes??["operator.admin","operator.approvals","operator.pairing"],s=!(t!=="operator")&&typeof crypto<"u"&&!!crypto.subtle;let r=null,o=!1,a=this.opts.token;if(s){r=await _p();const d=(f=Lp({deviceId:r.deviceId,role:t}))==null?void 0:f.token;a=d??this.opts.token,o=!!(d&&this.opts.token)}const l=a||this.opts.password?{token:a,password:this.opts.password}:void 0;let c;if(s&&r){const d=Date.now(),h=this.connectNonce??void 0,w=xv({deviceId:r.deviceId,clientId:this.opts.clientName??Ua.CONTROL_UI,clientMode:this.opts.mode??Gs.WEBCHAT,role:t,scopes:n,signedAtMs:d,token:a??null,nonce:h}),b=await Mp(r.privateKey,w);c={id:r.deviceId,publicKey:r.publicKey,signature:b,signedAt:d,nonce:h}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ua.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Gs.WEBCHAT,instanceId:this.opts.instanceId},role:t,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(d=>{var h,w,b;(h=d==null?void 0:d.auth)!=null&&h.deviceToken&&r&&Ip({deviceId:r.deviceId,role:d.auth.role??t,token:d.auth.deviceToken,scopes:d.auth.scopes??[]}),this.backoffMs=800,(b=(w=this.opts).onHello)==null||b.call(w,d)}).catch(()=>{var d;o&&r&&Rp({deviceId:r.deviceId,role:t}),(d=this.ws)==null||d.close($v,"connect failed")})}handleMessage(t){var s,r,o,a,l;let n;try{n=JSON.parse(t)}catch{return}const i=n;if(i.type==="event"){const c=n;if(c.event==="connect.challenge"){const f=c.payload,d=f&&typeof f.nonce=="string"?f.nonce:null;d&&(this.connectNonce=d,this.sendConnect());return}const u=typeof c.seq=="number"?c.seq:null;u!==null&&(this.lastSeq!==null&&u>this.lastSeq+1&&((r=(s=this.opts).onGap)==null||r.call(s,{expected:this.lastSeq+1,received:u})),this.lastSeq=u);try{(a=(o=this.opts).onEvent)==null||a.call(o,c)}catch(f){console.error("[gateway] event handler error:",f)}return}if(i.type==="res"){const c=n,u=this.pending.get(c.id);if(!u)return;this.pending.delete(c.id),c.ok?u.resolve(c.payload):u.reject(new Error(((l=c.error)==null?void 0:l.message)??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const i=tr(),s={type:"req",id:i,method:t,params:n},r=new Promise((o,a)=>{this.pending.set(i,{resolve:l=>o(l),reject:a})});return this.ws.send(JSON.stringify(s)),r}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Vs(e){return typeof e=="object"&&e!==null}function Tv(e){if(!Vs(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Vs(n))return null;const i=typeof n.command=="string"?n.command.trim():"";if(!i)return null;const s=typeof e.createdAtMs=="number"?e.createdAtMs:0,r=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!s||!r?null:{id:t,request:{command:i,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:s,expiresAtMs:r}}function Cv(e){if(!Vs(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 ru(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function _v(e,t){const n=ru(e).filter(i=>i.id!==t.id);return n.push(t),n}function Wa(e,t){return ru(e).filter(n=>n.id!==t)}class Mv{constructor(){this.canvas=null,this.ctx=null,this.img=new Image,this.pendingFrame=null,this.rafId=null,this.deviceWidth=1280,this.deviceHeight=720,this.lastMouseMoveAt=0,this.MOUSE_THROTTLE_MS=30}attach(t){this.canvas=t,this.ctx=t.getContext("2d")}detach(){this.rafId!=null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas=null,this.ctx=null,this.pendingFrame=null}updateFrame(t,n){if(n!=null&&n.deviceWidth&&(this.deviceWidth=n.deviceWidth),n!=null&&n.deviceHeight&&(this.deviceHeight=n.deviceHeight),this.pendingFrame=t,!this.canvas){const i=document.getElementById("browser-screencast-canvas");i&&this.attach(i)}this.rafId==null&&(this.rafId=requestAnimationFrame(()=>this.renderFrame()))}renderFrame(){this.rafId=null;const t=this.pendingFrame;!t||!this.canvas||!this.ctx||(this.pendingFrame=null,this.img.onload=()=>{!this.canvas||!this.ctx||((this.canvas.width!==this.img.width||this.canvas.height!==this.img.height)&&(this.canvas.width=this.img.width,this.canvas.height=this.img.height),this.ctx.drawImage(this.img,0,0))},this.img.src=`data:image/jpeg;base64,${t}`)}translateCoordinates(t,n){if(!this.canvas)return{x:t,y:n};const i=this.canvas.getBoundingClientRect(),s=this.canvas.width/i.width,r=this.canvas.height/i.height,o=this.deviceWidth/this.canvas.width,a=this.deviceHeight/this.canvas.height;return{x:Math.round(t*s*o),y:Math.round(n*r*a)}}shouldThrottleMouseMove(){const t=performance.now();return t-this.lastMouseMoveAt<this.MOUSE_THROTTLE_MS?!0:(this.lastMouseMoveAt=t,!1)}getDeviceDimensions(){return{width:this.deviceWidth,height:this.deviceHeight}}}let ys=null;function an(){return ys||(ys=new Mv),ys}function Kr(e){return e instanceof Error?e.message:String(e)}async function Pv(e){if(!e.client){console.error("[browser] startScreencast: no client"),e.browserError="Not connected to gateway";return}if(!e.connected){console.error("[browser] startScreencast: client exists but not connected"),e.browserError="Not connected to gateway";return}console.log("[browser] startScreencast: sending request"),e.browserLoading=!0,e.browserError=null;try{const t=await e.client.request("browser.screencast.start",{quality:60,maxWidth:1280,maxHeight:720});console.log("[browser] startScreencast response:",t),t!=null&&t.ok?e.browserScreencastActive=!0:(console.warn("[browser] startScreencast: response did not have ok=true",t),e.browserError="Screencast start failed (no ok in response)")}catch(t){console.error("[browser] startScreencast error:",t),e.browserError=Kr(t)}finally{e.browserLoading=!1}}async function Lv(e){if(!(!e.client||!e.connected)){e.browserLoading=!0,e.browserFullscreen=!1;try{await e.client.request("browser.screencast.stop",{}),e.browserScreencastActive=!1,e.browserScreencastFrame=null,e.browserScreencastMetadata=null}catch(t){e.browserError=Kr(t)}finally{e.browserLoading=!1}}}async function vs(e,t,n,i,s){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"mouse",action:t,x:n,y:i,button:s??"left",clickCount:t==="mousePressed"?1:0})}catch{}}async function bs(e,t,n,i){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"key",action:t,key:n,...i!=null&&i.text?{text:i.text}:{},...i!=null&&i.code?{code:i.code}:{},...i!=null&&i.modifiers?{modifiers:i.modifiers}:{}})}catch{}}async function Iv(e){if(!(!e.client||!e.connected))try{await e.client.request("browser.handoff.complete",{}),e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}catch(t){e.browserError=Kr(t)}}function Rv(e){e.browserInputMode=!e.browserInputMode}function Nv(e){e.browserFullscreen=!e.browserFullscreen,an().detach()}function Dv(e,t){if(!(t!=null&&t.data))return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,an().updateFrame(t.data,t.metadata)}function Ov(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function Bv(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}async function Qs(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),i=n?{sessionKey:n}:{};try{const s=await e.client.request("agent.identity.get",i);if(!s)return;const r=xs(s);e.assistantName=r.name,e.assistantAvatar=r.avatar,e.assistantAgentId=r.agentId??null}catch{}}async function Ys(e){return(await e.request("apikeys.list")).providers??[]}async function Ka(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function Fv(e,t){await e.request("apikeys.remove",{provider:t})}const gi="taskmaster_update_pending";async function ou(e){var t,n;if(!(!e.client||!e.connected)&&!e.updateChecking){e.updateChecking=!0,e.updateMessage=null,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("update.status",{});e.currentVersion=i.current,e.latestVersion=i.latest,e.updateAvailable=i.updateAvailable,e.updateMessage=i.updateAvailable?`v${i.latest} available`:"Up to date"}catch(i){e.updateMessage=`Check failed: ${String(i)}`,e.updateAvailable=null}finally{e.updateChecking=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function Uv(e){var t,n,i,s;if(!(!e.client||e.updateRunning)){e.updateRunning=!0,e.updateMessage="Starting update...",e.updateProgressSteps=[],e.updateLastResult=null,(t=e.requestUpdate)==null||t.call(e);try{localStorage.setItem(gi,String(Date.now())),localStorage.removeItem(zr)}catch{}try{const r=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(r.ok&&r.result.status==="ok")e.updateMessage="Updated — restarting gateway...",(n=e.requestUpdate)==null||n.call(e);else if(r.ok&&r.result.status==="skipped")ln(),e.updateMessage=r.result.reason||"Update skipped",e.updateRunning=!1,(i=e.requestUpdate)==null||i.call(e);else throw ln(),new Error(r.result.reason||"Update failed")}catch(r){ln(),e.updateMessage=`Update failed: ${String(r)}`,e.updateRunning=!1,e.updateProgressSteps=[],(s=e.requestUpdate)==null||s.call(e)}}}function Wv(e,t){var i,s,r;const n=t.phase;if(n==="step-start"){const o=t.name,a=t.index,l=t.total;e.updateMessage=`Updating: ${o} (${a+1}/${l})`;const c=e.updateProgressSteps.find(u=>u.index===a);c?(c.status="running",c.name=o):e.updateProgressSteps=[...e.updateProgressSteps,{name:o,index:a,total:l,status:"running"}],(i=e.requestUpdate)==null||i.call(e)}else if(n==="step-done"){const o=t.name,a=t.index,l=t.total,c=t.ok,u=t.durationMs,f=e.updateProgressSteps.find(h=>h.index===a);f?(f.status=c?"done":"failed",f.durationMs=u):e.updateProgressSteps=[...e.updateProgressSteps,{name:o,index:a,total:l,status:c?"done":"failed",durationMs:u}];const d=!c&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=c?`Updating: ${o} done (${a+1}/${l})`:`Update step failed: ${o}${d}`,(s=e.requestUpdate)==null||s.call(e)}else if(n==="complete"){if(t.status==="ok")e.updateMessage="Update complete — restarting gateway...";else{const a=t.reason;e.updateMessage=a?`Update failed: ${a}`:"Update failed",e.updateRunning=!1,ln()}(r=e.requestUpdate)==null||r.call(e)}}async function Kv(e){var n,i,s,r;if(!e.client||!e.connected)return;const t=jv();ln();try{const o=await e.client.request("update.lastResult",{});if(!o.ok||!o.result)return;const a=5*6e4,l=Date.now()-o.result.ts<a;if(!t&&!l||Hv(o.result.ts))return;e.updateLastResult=o.result;const c=(n=o.result.after)==null?void 0:n.version;if(o.result.status==="ok"&&c&&(e.currentVersion=c),e.updateAvailable=!1,o.result.status==="ok"){const u=(i=o.result.before)==null?void 0:i.version,f=c??o.result.currentVersion;e.updateMessage=u?`Updated: v${u} → v${f}`:`Updated to v${f}`}else{const u=o.result.reason??((s=o.result.failedStep)==null?void 0:s.name)??"unknown error";e.updateMessage=`Update failed: ${u}`}}catch{}finally{e.updateRunning=!1,e.updateProgressSteps=[],(r=e.requestUpdate)==null||r.call(e)}}const zr="taskmaster_update_dismissed";function zv(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(zr,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function jv(){try{const e=localStorage.getItem(gi);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(gi),!1):!0:!1}catch{return!1}}function ln(){try{localStorage.removeItem(gi)}catch{}}function Hv(e){try{const t=localStorage.getItem(zr);return t?Number(t)>=e:!1}catch{return!1}}function ws(e,t){var a,l,c;const n=(e??"").trim(),i=(a=t.mainSessionKey)==null?void 0:a.trim();if(!i)return n;if(!n)return i;const s=((l=t.mainKey)==null?void 0:l.trim())||"main",r=(c=t.defaultAgentId)==null?void 0:c.trim();return n==="main"||n===s||r&&(n===`agent:${r}:main`||n===`agent:${r}:${s}`)?i:n}function qv(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=ws(e.sessionKey,t),i=ws(e.settings.sessionKey,t),s=ws(e.settings.lastActiveSessionKey,t),r=n||i||e.sessionKey,o={...e.settings,sessionKey:i||r,lastActiveSessionKey:s||r},a=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;r!==e.sessionKey&&(e.sessionKey=r),a&&We(e,o)}function xe(e){var s;e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=!!e.publicChat,n=e.setup||e.filesPage||e.browserPage||e.chatPage||e.adminsPage||e.customersPage||e.advancedPage,i=t?"public-chat":n?"setup-ui":"taskmaster-control-ui";(s=e.client)==null||s.stop(),e.client=new Ev({url:e.settings.gatewayUrl,token:t?void 0:e.settings.token.trim()?e.settings.token:void 0,password:t?void 0:e.password.trim()?e.password:void 0,clientName:i,mode:"webchat",role:t?"public":void 0,scopes:t?[]:void 0,onHello:r=>{var o;if(e.connected=!0,e.lastError=null,e.hello=r,t){za(e,r),Qs(e),(((o=e.publicChatConfig)==null?void 0:o.auth)??"anonymous")==="anonymous"&&Xv(e);return}oi()&&(xr(),e.uninstallDone=!1),za(e,r),e.handleAccessCheck(),Kv(e).then(()=>{ou(e)}),Qs(e),wv(e),(e.chatPage||e.setup)&&Qv(e),pr(e,{quiet:!0}),dr(e,{quiet:!0}),vn(e).then(()=>{e.initWorkspaceSelection()}),e.setup&&(Te(e),Yv(e)),si(e)},onClose:({code:r,reason:o})=>{e.connected=!1,r!==1012&&(e.lastError=`disconnected (${r}): ${o||"no reason"}`)},onEvent:r=>Gv(e,r),onGap:({expected:r,received:o})=>{console.warn(`[gateway] event gap: expected seq ${r}, got ${o}`),si(e)}}),e.client.start()}function Gv(e,t){try{Vv(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Vv(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;Dd(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n!=null&&n.sessionKey&&nc(e,n.sessionKey);const i=vl(e,n);(i==="final"||i==="error"||i==="aborted")&&(ir(e),Ah(e)),i==="final"&&Ee(e);return}if(t.event==="suggestions"){const n=t.payload;(n==null?void 0:n.sessionKey)===e.sessionKey&&Array.isArray(n.suggestions)&&n.suggestions.length>0&&(e.chatSuggestion=n.suggestions[0]);return}if(t.event==="presence"){const n=t.payload;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&kr(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&dr(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=Tv(t.payload);if(n){e.execApprovalQueue=_v(e.execApprovalQueue,n),e.execApprovalError=null;const i=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Wa(e.execApprovalQueue,n.id)},i)}return}if(t.event==="browser.screencast.frame"){Dv(e,t.payload);return}if(t.event==="browser.handoff"){Ov(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){Bv(e);return}if(t.event==="exec.approval.resolved"){const n=Cv(t.payload);n&&(e.execApprovalQueue=Wa(e.execApprovalQueue,n.id));return}if(t.event==="update.progress"){Wv(e,t.payload);return}}function za(e,t){const n=t.snapshot;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n!=null&&n.health&&(e.debugHealth=n.health),n!=null&&n.sessionDefaults&&qv(e,n.sessionDefaults)}async function Qv(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("models.list",{});Array.isArray(t==null?void 0:t.models)&&(e.chatModelCatalog=t.models)}catch{}}async function Yv(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await Ys(e.client)}catch{}}const ja="taskmaster_public_id";function au(e=30){var s;const t=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(`${ja}=`));if(t)return t.split("=")[1];const n=`anon-${((s=crypto.randomUUID)==null?void 0:s.call(crypto))??Math.random().toString(36).slice(2)}`,i=new Date(Date.now()+e*864e5).toUTCString();return document.cookie=`${ja}=${n}; path=/; expires=${i}; SameSite=Lax`,n}async function Xv(e){var n;if(!e.client||!e.connected)return;const t=au((n=e.publicChatConfig)==null?void 0:n.cookieTtlDays);try{const i=await e.client.request("public.session",{cookieId:t});i!=null&&i.sessionKey&&(e.publicChatSessionKey=i.sessionKey,e.sessionKey=i.sessionKey,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready",Ee(e))}catch(i){console.error("[public-chat] failed to resolve anonymous session:",i),e.lastError="Failed to start chat session"}}let ve=!1,le=null,Mt="",mi="";function lu(){ve=!1,le=null,Mt="",mi=""}async function Zv(e){if(!e.client||!e.connected)return;const t=au(e.cookieTtlDays);try{const n=await e.client.request("public.session",{cookieId:t});n!=null&&n.sessionKey&&e.onAuthenticated(n.sessionKey)}catch(n){le=n instanceof Error?n.message:"Failed to start session"}}async function Ha(e){if(!e.client||ve)return;const t=Mt.trim();if(!t){le="Please enter your phone number";return}ve=!0,le=null;try{const n=await e.client.request("public.otp.request",{phone:t,name:mi.trim()||void 0});n!=null&&n.ok?e.onAuthStepChange("otp"):le=(n==null?void 0:n.error)??"Failed to send verification code"}catch(n){le=n instanceof Error?n.message:"Failed to send verification code"}finally{ve=!1}}async function qa(e,t){if(!(!e.client||ve)){if(!t.trim()){le="Please enter the verification code";return}ve=!0,le=null;try{const n=await e.client.request("public.otp.verify",{phone:Mt.trim(),code:t.trim()});n!=null&&n.ok&&n.sessionKey?(lu(),e.onAuthenticated(n.sessionKey)):le=(n==null?void 0:n.error)??"Invalid verification code"}catch(n){le=n instanceof Error?n.message:"Verification failed"}finally{ve=!1}}}function ks(e){return e.assistantAvatar?p`
|
|
3037
|
+
`}async function Sv(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}}}async function vn(e){if(!(!e.client||!e.connected)&&!e.workspacesLoading){e.workspacesLoading=!0,e.workspacesError=null;try{const t=await e.client.request("workspaces.list",{});e.workspaces=t.workspaces}catch(t){e.workspacesError=String(t)}finally{e.workspacesLoading=!1}}}async function Av(e,t){var i,s;if(!e.client||!e.connected||e.workspaceSaving)return;const n=t.name.trim();if(!n){e.workspacesError="Account name is required.";return}e.workspaceSaving=!0,e.workspacesError=null;try{const r=await e.client.request("config.get",{});e.configSnapshot=r;const o=r.hash;if(!o){e.workspacesError="Config hash missing; reload and retry.";return}const a={name:n,baseHash:o,whatsappAccountName:n};(i=t.workspacePath)!=null&&i.trim()&&(a.workspaceDir=t.workspacePath.trim());const l=await e.client.request("workspaces.create",a);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await vn(e),(s=t.onCreated)==null||s.call(t,l)}catch(r){e.workspacesError=String(r)}finally{e.workspaceSaving=!1}}async function $v(e,t){if(!(!e.client||!e.connected)&&!e.workspaceSaving){e.workspaceSaving=!0,e.workspacesError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=n.hash;if(!i){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.remove",{name:t,baseHash:i}),e.workspaceRemoveConfirm=null,await vn(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function xv(e,t,n){if(!(!e.client||!e.connected)){e.workspacesError=null;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.hash;if(!s){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.rename",{name:t,displayName:n,baseHash:s}),await vn(e)}catch(i){e.workspacesError=String(i)}}}const jn=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:Av,loadWorkspaces:vn,removeWorkspace:$v,renameWorkspace:xv},Symbol.toStringTag,{value:"Module"})),ru={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"taskmaster-control-ui",SETUP_UI:"setup-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"taskmaster-macos",IOS_APP:"taskmaster-ios",ANDROID_APP:"taskmaster-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"taskmaster-probe",PUBLIC_CHAT:"public-chat"},Wa=ru,Vs={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(ru));new Set(Object.values(Vs));function Ev(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),i=e.token??"",s=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),i];return t==="v2"&&s.push(e.nonce??""),s.join("|")}const Tv=4008;class Cv{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(){var t;this.closed=!0,(t=this.ws)==null||t.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){var t;return((t=this.ws)==null?void 0:t.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=>{var i,s;const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),(s=(i=this.opts).onClose)==null||s.call(i,{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(){var f;if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=this.opts.role??"operator",n=this.opts.scopes??["operator.admin","operator.approvals","operator.pairing"],s=!(t!=="operator")&&typeof crypto<"u"&&!!crypto.subtle;let r=null,o=!1,a=this.opts.token;if(s){r=await Mp();const d=(f=Ip({deviceId:r.deviceId,role:t}))==null?void 0:f.token;a=d??this.opts.token,o=!!(d&&this.opts.token)}const l=a||this.opts.password?{token:a,password:this.opts.password}:void 0;let c;if(s&&r){const d=Date.now(),p=this.connectNonce??void 0,w=Ev({deviceId:r.deviceId,clientId:this.opts.clientName??Wa.CONTROL_UI,clientMode:this.opts.mode??Vs.WEBCHAT,role:t,scopes:n,signedAtMs:d,token:a??null,nonce:p}),b=await Pp(r.privateKey,w);c={id:r.deviceId,publicKey:r.publicKey,signature:b,signedAt:d,nonce:p}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Wa.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Vs.WEBCHAT,instanceId:this.opts.instanceId},role:t,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(d=>{var p,w,b;(p=d==null?void 0:d.auth)!=null&&p.deviceToken&&r&&Rp({deviceId:r.deviceId,role:d.auth.role??t,token:d.auth.deviceToken,scopes:d.auth.scopes??[]}),this.backoffMs=800,(b=(w=this.opts).onHello)==null||b.call(w,d)}).catch(()=>{var d;o&&r&&Np({deviceId:r.deviceId,role:t}),(d=this.ws)==null||d.close(Tv,"connect failed")})}handleMessage(t){var s,r,o,a,l;let n;try{n=JSON.parse(t)}catch{return}const i=n;if(i.type==="event"){const c=n;if(c.event==="connect.challenge"){const f=c.payload,d=f&&typeof f.nonce=="string"?f.nonce:null;d&&(this.connectNonce=d,this.sendConnect());return}const u=typeof c.seq=="number"?c.seq:null;u!==null&&(this.lastSeq!==null&&u>this.lastSeq+1&&((r=(s=this.opts).onGap)==null||r.call(s,{expected:this.lastSeq+1,received:u})),this.lastSeq=u);try{(a=(o=this.opts).onEvent)==null||a.call(o,c)}catch(f){console.error("[gateway] event handler error:",f)}return}if(i.type==="res"){const c=n,u=this.pending.get(c.id);if(!u)return;this.pending.delete(c.id),c.ok?u.resolve(c.payload):u.reject(new Error(((l=c.error)==null?void 0:l.message)??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const i=tr(),s={type:"req",id:i,method:t,params:n},r=new Promise((o,a)=>{this.pending.set(i,{resolve:l=>o(l),reject:a})});return this.ws.send(JSON.stringify(s)),r}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Gs(e){return typeof e=="object"&&e!==null}function _v(e){if(!Gs(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Gs(n))return null;const i=typeof n.command=="string"?n.command.trim():"";if(!i)return null;const s=typeof e.createdAtMs=="number"?e.createdAtMs:0,r=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!s||!r?null:{id:t,request:{command:i,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:s,expiresAtMs:r}}function Mv(e){if(!Gs(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 ou(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Pv(e,t){const n=ou(e).filter(i=>i.id!==t.id);return n.push(t),n}function Ka(e,t){return ou(e).filter(n=>n.id!==t)}class Lv{constructor(){this.canvas=null,this.ctx=null,this.img=new Image,this.pendingFrame=null,this.rafId=null,this.deviceWidth=1280,this.deviceHeight=720,this.lastMouseMoveAt=0,this.MOUSE_THROTTLE_MS=30}attach(t){this.canvas=t,this.ctx=t.getContext("2d")}detach(){this.rafId!=null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas=null,this.ctx=null,this.pendingFrame=null}updateFrame(t,n){if(n!=null&&n.deviceWidth&&(this.deviceWidth=n.deviceWidth),n!=null&&n.deviceHeight&&(this.deviceHeight=n.deviceHeight),this.pendingFrame=t,!this.canvas){const i=document.getElementById("browser-screencast-canvas");i&&this.attach(i)}this.rafId==null&&(this.rafId=requestAnimationFrame(()=>this.renderFrame()))}renderFrame(){this.rafId=null;const t=this.pendingFrame;!t||!this.canvas||!this.ctx||(this.pendingFrame=null,this.img.onload=()=>{!this.canvas||!this.ctx||((this.canvas.width!==this.img.width||this.canvas.height!==this.img.height)&&(this.canvas.width=this.img.width,this.canvas.height=this.img.height),this.ctx.drawImage(this.img,0,0))},this.img.src=`data:image/jpeg;base64,${t}`)}translateCoordinates(t,n){if(!this.canvas)return{x:t,y:n};const i=this.canvas.getBoundingClientRect(),s=this.canvas.width/i.width,r=this.canvas.height/i.height,o=this.deviceWidth/this.canvas.width,a=this.deviceHeight/this.canvas.height;return{x:Math.round(t*s*o),y:Math.round(n*r*a)}}shouldThrottleMouseMove(){const t=performance.now();return t-this.lastMouseMoveAt<this.MOUSE_THROTTLE_MS?!0:(this.lastMouseMoveAt=t,!1)}getDeviceDimensions(){return{width:this.deviceWidth,height:this.deviceHeight}}}let ys=null;function an(){return ys||(ys=new Lv),ys}function Kr(e){return e instanceof Error?e.message:String(e)}async function Iv(e){if(!e.client){console.error("[browser] startScreencast: no client"),e.browserError="Not connected to gateway";return}if(!e.connected){console.error("[browser] startScreencast: client exists but not connected"),e.browserError="Not connected to gateway";return}console.log("[browser] startScreencast: sending request"),e.browserLoading=!0,e.browserError=null;try{const t=await e.client.request("browser.screencast.start",{quality:60,maxWidth:1280,maxHeight:720});console.log("[browser] startScreencast response:",t),t!=null&&t.ok?e.browserScreencastActive=!0:(console.warn("[browser] startScreencast: response did not have ok=true",t),e.browserError="Screencast start failed (no ok in response)")}catch(t){console.error("[browser] startScreencast error:",t),e.browserError=Kr(t)}finally{e.browserLoading=!1}}async function Rv(e){if(!(!e.client||!e.connected)){e.browserLoading=!0,e.browserFullscreen=!1;try{await e.client.request("browser.screencast.stop",{}),e.browserScreencastActive=!1,e.browserScreencastFrame=null,e.browserScreencastMetadata=null}catch(t){e.browserError=Kr(t)}finally{e.browserLoading=!1}}}async function vs(e,t,n,i,s){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"mouse",action:t,x:n,y:i,button:s??"left",clickCount:t==="mousePressed"?1:0})}catch{}}async function bs(e,t,n,i){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"key",action:t,key:n,...i!=null&&i.text?{text:i.text}:{},...i!=null&&i.code?{code:i.code}:{},...i!=null&&i.modifiers?{modifiers:i.modifiers}:{}})}catch{}}async function Nv(e){if(!(!e.client||!e.connected))try{await e.client.request("browser.handoff.complete",{}),e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}catch(t){e.browserError=Kr(t)}}function Dv(e){e.browserInputMode=!e.browserInputMode}function Ov(e){e.browserFullscreen=!e.browserFullscreen,an().detach()}function Bv(e,t){if(!(t!=null&&t.data))return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,an().updateFrame(t.data,t.metadata)}function Fv(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function Uv(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}async function Qs(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),i=n?{sessionKey:n}:{};try{const s=await e.client.request("agent.identity.get",i);if(!s)return;const r=$s(s);e.assistantName=r.name,e.assistantAvatar=r.avatar,e.assistantAgentId=r.agentId??null}catch{}}async function Ys(e){return(await e.request("apikeys.list")).providers??[]}async function za(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function Wv(e,t){await e.request("apikeys.remove",{provider:t})}const gi="taskmaster_update_pending";async function au(e){var t,n;if(!(!e.client||!e.connected)&&!e.updateChecking){e.updateChecking=!0,e.updateMessage=null,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("update.status",{});e.currentVersion=i.current,e.latestVersion=i.latest,e.updateAvailable=i.updateAvailable,e.updateMessage=i.updateAvailable?`v${i.latest} available`:"Up to date"}catch(i){e.updateMessage=`Check failed: ${String(i)}`,e.updateAvailable=null}finally{e.updateChecking=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function Kv(e){var t,n,i,s;if(!(!e.client||e.updateRunning)){e.updateRunning=!0,e.updateMessage="Starting update...",e.updateProgressSteps=[],e.updateLastResult=null,(t=e.requestUpdate)==null||t.call(e);try{localStorage.setItem(gi,String(Date.now())),localStorage.removeItem(zr)}catch{}try{const r=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(r.ok&&r.result.status==="ok")e.updateMessage="Updated — restarting gateway...",(n=e.requestUpdate)==null||n.call(e);else if(r.ok&&r.result.status==="skipped")ln(),e.updateMessage=r.result.reason||"Update skipped",e.updateRunning=!1,(i=e.requestUpdate)==null||i.call(e);else throw ln(),new Error(r.result.reason||"Update failed")}catch(r){ln(),e.updateMessage=`Update failed: ${String(r)}`,e.updateRunning=!1,e.updateProgressSteps=[],(s=e.requestUpdate)==null||s.call(e)}}}function zv(e,t){var i,s,r;const n=t.phase;if(n==="step-start"){const o=t.name,a=t.index,l=t.total;e.updateMessage=`Updating: ${o} (${a+1}/${l})`;const c=e.updateProgressSteps.find(u=>u.index===a);c?(c.status="running",c.name=o):e.updateProgressSteps=[...e.updateProgressSteps,{name:o,index:a,total:l,status:"running"}],(i=e.requestUpdate)==null||i.call(e)}else if(n==="step-done"){const o=t.name,a=t.index,l=t.total,c=t.ok,u=t.durationMs,f=e.updateProgressSteps.find(p=>p.index===a);f?(f.status=c?"done":"failed",f.durationMs=u):e.updateProgressSteps=[...e.updateProgressSteps,{name:o,index:a,total:l,status:c?"done":"failed",durationMs:u}];const d=!c&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=c?`Updating: ${o} done (${a+1}/${l})`:`Update step failed: ${o}${d}`,(s=e.requestUpdate)==null||s.call(e)}else if(n==="complete"){if(t.status==="ok")e.updateMessage="Update complete — restarting gateway...";else{const a=t.reason;e.updateMessage=a?`Update failed: ${a}`:"Update failed",e.updateRunning=!1,ln()}(r=e.requestUpdate)==null||r.call(e)}}async function jv(e){var n,i,s,r;if(!e.client||!e.connected)return;const t=qv();ln();try{const o=await e.client.request("update.lastResult",{});if(!o.ok||!o.result)return;const a=5*6e4,l=Date.now()-o.result.ts<a;if(!t&&!l||Vv(o.result.ts))return;e.updateLastResult=o.result;const c=(n=o.result.after)==null?void 0:n.version;if(o.result.status==="ok"&&c&&(e.currentVersion=c),e.updateAvailable=!1,o.result.status==="ok"){const u=(i=o.result.before)==null?void 0:i.version,f=c??o.result.currentVersion;e.updateMessage=u?`Updated: v${u} → v${f}`:`Updated to v${f}`}else{const u=o.result.reason??((s=o.result.failedStep)==null?void 0:s.name)??"unknown error";e.updateMessage=`Update failed: ${u}`}}catch{}finally{e.updateRunning=!1,e.updateProgressSteps=[],(r=e.requestUpdate)==null||r.call(e)}}const zr="taskmaster_update_dismissed";function Hv(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(zr,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function qv(){try{const e=localStorage.getItem(gi);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(gi),!1):!0:!1}catch{return!1}}function ln(){try{localStorage.removeItem(gi)}catch{}}function Vv(e){try{const t=localStorage.getItem(zr);return t?Number(t)>=e:!1}catch{return!1}}function ws(e,t){var a,l,c;const n=(e??"").trim(),i=(a=t.mainSessionKey)==null?void 0:a.trim();if(!i)return n;if(!n)return i;const s=((l=t.mainKey)==null?void 0:l.trim())||"main",r=(c=t.defaultAgentId)==null?void 0:c.trim();return n==="main"||n===s||r&&(n===`agent:${r}:main`||n===`agent:${r}:${s}`)?i:n}function Gv(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=ws(e.sessionKey,t),i=ws(e.settings.sessionKey,t),s=ws(e.settings.lastActiveSessionKey,t),r=n||i||e.sessionKey,o={...e.settings,sessionKey:i||r,lastActiveSessionKey:s||r},a=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;r!==e.sessionKey&&(e.sessionKey=r),a&&We(e,o)}function $e(e){var s;e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=!!e.publicChat,n=e.setup||e.filesPage||e.browserPage||e.chatPage||e.adminsPage||e.customersPage||e.advancedPage,i=t?"public-chat":n?"setup-ui":"taskmaster-control-ui";(s=e.client)==null||s.stop(),e.client=new Cv({url:e.settings.gatewayUrl,token:t?void 0:e.settings.token.trim()?e.settings.token:void 0,password:t?void 0:e.password.trim()?e.password:void 0,clientName:i,mode:"webchat",role:t?"public":void 0,scopes:t?[]:void 0,onHello:r=>{var o;if(e.connected=!0,e.lastError=null,e.hello=r,t){ja(e,r),Qs(e),(((o=e.publicChatConfig)==null?void 0:o.auth)??"anonymous")==="anonymous"&&Jv(e);return}oi()&&($r(),e.uninstallDone=!1),ja(e,r),e.handleAccessCheck(),jv(e).then(()=>{au(e)}),Qs(e),Sv(e),(e.chatPage||e.setup)&&Xv(e),pr(e,{quiet:!0}),dr(e,{quiet:!0}),vn(e).then(()=>{e.initWorkspaceSelection()}),e.startEmbeddingPoll(),e.setup&&(Te(e),Zv(e)),si(e)},onClose:({code:r,reason:o})=>{e.connected=!1,r!==1012&&(e.lastError=`disconnected (${r}): ${o||"no reason"}`)},onEvent:r=>Qv(e,r),onGap:({expected:r,received:o})=>{console.warn(`[gateway] event gap: expected seq ${r}, got ${o}`),si(e)}}),e.client.start()}function Qv(e,t){try{Yv(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Yv(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;Od(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n!=null&&n.sessionKey&&ic(e,n.sessionKey);const i=bl(e,n);(i==="final"||i==="error"||i==="aborted")&&(ir(e),$h(e)),i==="final"&&Ee(e);return}if(t.event==="suggestions"){const n=t.payload;(n==null?void 0:n.sessionKey)===e.sessionKey&&Array.isArray(n.suggestions)&&n.suggestions.length>0&&(e.chatSuggestion=n.suggestions[0]);return}if(t.event==="presence"){const n=t.payload;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&kr(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&dr(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=_v(t.payload);if(n){e.execApprovalQueue=Pv(e.execApprovalQueue,n),e.execApprovalError=null;const i=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Ka(e.execApprovalQueue,n.id)},i)}return}if(t.event==="browser.screencast.frame"){Bv(e,t.payload);return}if(t.event==="browser.handoff"){Fv(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){Uv(e);return}if(t.event==="exec.approval.resolved"){const n=Mv(t.payload);n&&(e.execApprovalQueue=Ka(e.execApprovalQueue,n.id));return}if(t.event==="update.progress"){zv(e,t.payload);return}}function ja(e,t){const n=t.snapshot;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n!=null&&n.health&&(e.debugHealth=n.health),n!=null&&n.sessionDefaults&&Gv(e,n.sessionDefaults)}async function Xv(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("models.list",{});Array.isArray(t==null?void 0:t.models)&&(e.chatModelCatalog=t.models)}catch{}}async function Zv(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await Ys(e.client)}catch{}}const Ha="taskmaster_public_id";function lu(e=30){var s;const t=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(`${Ha}=`));if(t)return t.split("=")[1];const n=`anon-${((s=crypto.randomUUID)==null?void 0:s.call(crypto))??Math.random().toString(36).slice(2)}`,i=new Date(Date.now()+e*864e5).toUTCString();return document.cookie=`${Ha}=${n}; path=/; expires=${i}; SameSite=Lax`,n}async function Jv(e){var n;if(!e.client||!e.connected)return;const t=lu((n=e.publicChatConfig)==null?void 0:n.cookieTtlDays);try{const i=await e.client.request("public.session",{cookieId:t});i!=null&&i.sessionKey&&(e.publicChatSessionKey=i.sessionKey,e.sessionKey=i.sessionKey,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready",Ee(e))}catch(i){console.error("[public-chat] failed to resolve anonymous session:",i),e.lastError="Failed to start chat session"}}let ve=!1,le=null,Mt="",mi="";function cu(){ve=!1,le=null,Mt="",mi=""}async function eb(e){if(!e.client||!e.connected)return;const t=lu(e.cookieTtlDays);try{const n=await e.client.request("public.session",{cookieId:t});n!=null&&n.sessionKey&&e.onAuthenticated(n.sessionKey)}catch(n){le=n instanceof Error?n.message:"Failed to start session"}}async function qa(e){if(!e.client||ve)return;const t=Mt.trim();if(!t){le="Please enter your phone number";return}ve=!0,le=null;try{const n=await e.client.request("public.otp.request",{phone:t,name:mi.trim()||void 0});n!=null&&n.ok?e.onAuthStepChange("otp"):le=(n==null?void 0:n.error)??"Failed to send verification code"}catch(n){le=n instanceof Error?n.message:"Failed to send verification code"}finally{ve=!1}}async function Va(e,t){if(!(!e.client||ve)){if(!t.trim()){le="Please enter the verification code";return}ve=!0,le=null;try{const n=await e.client.request("public.otp.verify",{phone:Mt.trim(),code:t.trim()});n!=null&&n.ok&&n.sessionKey?(cu(),e.onAuthenticated(n.sessionKey)):le=(n==null?void 0:n.error)??"Invalid verification code"}catch(n){le=n instanceof Error?n.message:"Verification failed"}finally{ve=!1}}}function ks(e){return e.assistantAvatar?h`
|
|
3006
3038
|
<img
|
|
3007
3039
|
class="public-auth__avatar"
|
|
3008
3040
|
src=${e.assistantAvatar}
|
|
3009
3041
|
alt=${e.assistantName}
|
|
3010
3042
|
/>
|
|
3011
|
-
`:k}function Ga(e){return
|
|
3043
|
+
`:k}function Ga(e){return h`
|
|
3012
3044
|
<div class="public-auth__form">
|
|
3013
3045
|
<label class="field public-auth__field">
|
|
3014
3046
|
<span>Your name (optional)</span>
|
|
@@ -3025,21 +3057,21 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3025
3057
|
type="tel"
|
|
3026
3058
|
.value=${Mt}
|
|
3027
3059
|
@input=${t=>{Mt=t.target.value}}
|
|
3028
|
-
@keydown=${t=>{t.key==="Enter"&&(t.preventDefault(),
|
|
3060
|
+
@keydown=${t=>{t.key==="Enter"&&(t.preventDefault(),qa(e))}}
|
|
3029
3061
|
placeholder="+1234567890"
|
|
3030
3062
|
required
|
|
3031
3063
|
/>
|
|
3032
3064
|
</label>
|
|
3033
|
-
${le?
|
|
3065
|
+
${le?h`<div class="public-auth__error">${le}</div>`:k}
|
|
3034
3066
|
<button
|
|
3035
3067
|
class="btn primary public-auth__btn"
|
|
3036
3068
|
?disabled=${ve}
|
|
3037
|
-
@click=${()=>{
|
|
3069
|
+
@click=${()=>{qa(e)}}
|
|
3038
3070
|
>
|
|
3039
3071
|
${ve?"Sending...":"Send verification code"}
|
|
3040
3072
|
</button>
|
|
3041
3073
|
</div>
|
|
3042
|
-
`}function
|
|
3074
|
+
`}function Qa(e){let t="";return h`
|
|
3043
3075
|
<div class="public-auth__form">
|
|
3044
3076
|
<p class="public-auth__hint">
|
|
3045
3077
|
We sent a verification code to <strong>${Mt}</strong> via WhatsApp.
|
|
@@ -3051,16 +3083,16 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3051
3083
|
inputmode="numeric"
|
|
3052
3084
|
maxlength="6"
|
|
3053
3085
|
@input=${n=>{t=n.target.value}}
|
|
3054
|
-
@keydown=${n=>{n.key==="Enter"&&(n.preventDefault(),
|
|
3086
|
+
@keydown=${n=>{n.key==="Enter"&&(n.preventDefault(),Va(e,t))}}
|
|
3055
3087
|
placeholder="123456"
|
|
3056
3088
|
required
|
|
3057
3089
|
/>
|
|
3058
3090
|
</label>
|
|
3059
|
-
${le?
|
|
3091
|
+
${le?h`<div class="public-auth__error">${le}</div>`:k}
|
|
3060
3092
|
<button
|
|
3061
3093
|
class="btn primary public-auth__btn"
|
|
3062
3094
|
?disabled=${ve}
|
|
3063
|
-
@click=${()=>{
|
|
3095
|
+
@click=${()=>{Va(e,t)}}
|
|
3064
3096
|
>
|
|
3065
3097
|
${ve?"Verifying...":"Verify"}
|
|
3066
3098
|
</button>
|
|
@@ -3071,32 +3103,32 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3071
3103
|
Use a different number
|
|
3072
3104
|
</button>
|
|
3073
3105
|
</div>
|
|
3074
|
-
`}function
|
|
3106
|
+
`}function tb(e){const{authMode:t,authStep:n}=e;return t==="anonymous"?h`
|
|
3075
3107
|
<div class="setup-container">
|
|
3076
3108
|
<div class="setup-card">
|
|
3077
3109
|
<div class="setup-spinner"></div>
|
|
3078
3110
|
<p>Starting chat...</p>
|
|
3079
3111
|
</div>
|
|
3080
3112
|
</div>
|
|
3081
|
-
`:t==="verified"?
|
|
3113
|
+
`:t==="verified"?h`
|
|
3082
3114
|
<div class="setup-container">
|
|
3083
3115
|
<div class="public-auth">
|
|
3084
3116
|
${ks(e)}
|
|
3085
3117
|
<h2 class="public-auth__title">Chat with ${e.assistantName}</h2>
|
|
3086
3118
|
<p class="public-auth__subtitle">Verify your WhatsApp number to get started.</p>
|
|
3087
|
-
${n==="otp"?
|
|
3119
|
+
${n==="otp"?Qa(e):Ga(e)}
|
|
3088
3120
|
</div>
|
|
3089
3121
|
</div>
|
|
3090
|
-
`:n==="phone"||n==="otp"?
|
|
3122
|
+
`:n==="phone"||n==="otp"?h`
|
|
3091
3123
|
<div class="setup-container">
|
|
3092
3124
|
<div class="public-auth">
|
|
3093
3125
|
${ks(e)}
|
|
3094
3126
|
<h2 class="public-auth__title">Chat with ${e.assistantName}</h2>
|
|
3095
3127
|
<p class="public-auth__subtitle">Verify your WhatsApp number to continue your conversation across devices.</p>
|
|
3096
|
-
${n==="otp"?
|
|
3128
|
+
${n==="otp"?Qa(e):Ga(e)}
|
|
3097
3129
|
</div>
|
|
3098
3130
|
</div>
|
|
3099
|
-
`:
|
|
3131
|
+
`:h`
|
|
3100
3132
|
<div class="setup-container">
|
|
3101
3133
|
<div class="public-auth">
|
|
3102
3134
|
${ks(e)}
|
|
@@ -3105,13 +3137,13 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3105
3137
|
<div class="public-auth__choices">
|
|
3106
3138
|
<button
|
|
3107
3139
|
class="btn primary public-auth__btn"
|
|
3108
|
-
@click=${()=>{
|
|
3140
|
+
@click=${()=>{eb(e)}}
|
|
3109
3141
|
>
|
|
3110
3142
|
Chat now
|
|
3111
3143
|
</button>
|
|
3112
3144
|
<button
|
|
3113
3145
|
class="btn public-auth__btn"
|
|
3114
|
-
@click=${()=>{
|
|
3146
|
+
@click=${()=>{cu(),e.onAuthStepChange("phone")}}
|
|
3115
3147
|
>
|
|
3116
3148
|
Verify with WhatsApp
|
|
3117
3149
|
</button>
|
|
@@ -3121,14 +3153,28 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3121
3153
|
</p>
|
|
3122
3154
|
</div>
|
|
3123
3155
|
</div>
|
|
3124
|
-
`}const jr="taskmaster-access-session",cu={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function uu(){try{return localStorage.getItem(jr)}catch{return null}}function du(e){try{localStorage.setItem(jr,e)}catch{}}function eb(){try{localStorage.removeItem(jr)}catch{}}async function Qa(e){if(e.client)try{const t=uu(),n=await e.client.request("access.status",{token:t});e.accessState={...e.accessState,checked:!0,hasPins:n.hasPins,hasMasterPin:n.hasMasterPin,accounts:n.accounts??[],authenticated:n.authenticated,workspace:n.workspace,master:n.master,error:null}}catch{e.accessState={...e.accessState,checked:!0,hasPins:!1,hasMasterPin:!1,accounts:[],authenticated:!0,error:null}}}async function tb(e,t,n){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const i=await e.client.request("access.verify",{account:t,pin:n});i.ok&&i.token?(du(i.token),e.accessState={...e.accessState,authenticated:!0,workspace:i.workspace??null,master:i.master??!1,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:i.message??"Incorrect PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to verify PIN"}}}}async function nb(e,t){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const n=await e.client.request("access.setMasterPin",{pin:t});n.ok&&n.token?(du(n.token),e.accessState={...e.accessState,checked:!0,hasPins:!0,hasMasterPin:!0,authenticated:!0,workspace:null,master:!0,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:"Failed to set PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to set PIN"}}}}async function ib(e,t,n){if(!e.client)return!1;try{return(await e.client.request("access.setAccountPin",{workspace:t,pin:n})).ok}catch{return!1}}async function sb(e){const t=uu();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}eb(),e.accessState={...cu,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}function rb(e,t="admin"){var s;if(!e)return[];const n=e.bindings;if(!Array.isArray(n))return[];const i=[];for(const r of n){if(!r||typeof r!="object"||r.agentId!==t&&r.agentId!=="management")continue;const o=r.match;if(!o||typeof o!="object"||(o.channel??"").toLowerCase()!=="whatsapp")continue;const l=o.peer;if(!l||typeof l!="object"||l.kind!=="dm")continue;const c=l.id??"";c&&i.push({phone:c,paired:((s=r.meta)==null?void 0:s.paired)===!0})}return i.sort((r,o)=>r.paired&&!o.paired?-1:!r.paired&&o.paired?1:0),i}function pu(e,t,n="admin",i){const s=c=>c===n||c==="management",r=new Map,o=new Map;for(const c of e){if(!c||typeof c!="object"||!s(c.agentId))continue;const u=c.match;if(!u||typeof u!="object"||(u.channel??"").toLowerCase()!=="whatsapp")continue;const d=u.peer;if(!d||typeof d!="object"||d.kind!=="dm")continue;const h=d.id??"";h&&(c.meta&&r.set(h,c.meta),u.accountId&&o.set(h,u.accountId))}const a=e.filter(c=>{if(!c||typeof c!="object"||!s(c.agentId))return!0;const u=c.match;if(!u||typeof u!="object"||(u.channel??"").toLowerCase()!=="whatsapp")return!0;const d=u.peer;return!d||typeof d!="object"?!0:d.kind!=="dm"}),l=t.map(c=>{const u=i??o.get(c.phone),f={channel:"whatsapp",peer:{kind:"dm",id:c.phone}};u&&(f.accountId=u);const d={agentId:n,match:f},h=r.get(c.phone);return h?d.meta=h:c.paired&&(d.meta={paired:!0}),d});return[...a,...l]}async function _i(e,t){if(!e.client||!e.connected)return;if(!t){e.adminPhones=[];return}if(e.adminsLoading)return;e.adminsLoading=!0,e.adminsError=null;const n=t;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.config;e.configForm=ze(s??{}),e.adminPhones=rb(s,n),e.configFormDirty=!1}catch(i){e.adminsError=String(i)}finally{e.adminsLoading=!1}}async function hu(e,t,n,i){var o,a;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n;let r=t.replace(/[\s\-\(\)]/g,"");if(!r){e.adminsError="Phone number is required";return}if(r.startsWith("+")||(r="+"+r),!/^\+[1-9]\d{6,14}$/.test(r)){e.adminsError="Invalid phone number. Use international format (e.g., +44 7504 472444)";return}if(e.adminPhones.some(l=>l.phone===r)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const l=ze(e.configForm??((o=e.configSnapshot)==null?void 0:o.config)??{}),c=l.bindings??[],u=[...e.adminPhones,{phone:r}],f=pu(c,u,s,i);wl(l,["bindings"],f);const d=(a=e.configSnapshot)==null?void 0:a.hash;if(!d){e.adminsError="Config hash missing; reload and retry.";return}const h=nt(l);await e.client.request("config.set",{raw:h,baseHash:d}),await _i(e,n)}catch(l){e.adminsError=String(l)}finally{e.adminsSaving=!1}}async function fu(e,t,n,i){var o,a;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n,r=e.adminPhones.find(l=>l.phone===t);if(r!=null&&r.paired){e.adminsError="Cannot remove the paired phone. Unlink WhatsApp first.";return}e.adminsSaving=!0,e.adminsError=null;try{const l=ze(e.configForm??((o=e.configSnapshot)==null?void 0:o.config)??{}),c=l.bindings??[],u=e.adminPhones.filter(w=>w.phone!==t),f=pu(c,u,s,i);wl(l,["bindings"],f);const d=(a=e.configSnapshot)==null?void 0:a.hash;if(!d){e.adminsError="Config hash missing; reload and retry.";return}const h=nt(l);await e.client.request("config.set",{raw:h,baseHash:d}),await _i(e,n)}catch(l){e.adminsError=String(l)}finally{e.adminsSaving=!1}}const ob=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:hu,loadAdmins:_i,removeAdmin:fu},Symbol.toStringTag,{value:"Module"}));async function ct(e,t){if(!(!e.client||!e.connected)){if(!t){e.customersRecords=[];return}if(!e.customersLoading){e.customersLoading=!0,e.customersError=null;try{const n=e.customersSearchQuery.trim(),i=n?await e.client.request("records.search",{query:n,workspace:t}):await e.client.request("records.list",{workspace:t});e.customersRecords=i.records??[]}catch(n){e.customersError=String(n)}finally{e.customersLoading=!1}}}}async function gu(e,t,n,i){if(!e.client||!e.connected||e.customersSaving)return;let s=t.replace(/[\s\-\(\)]/g,"");const r=n.trim();if(!s){e.customersError="Phone number is required";return}if(!r){e.customersError="Name is required";return}if(s.startsWith("+")||(s="+"+s),!/^\+[1-9]\d{6,14}$/.test(s)){e.customersError="Invalid phone number. Use international format (e.g., +44 7490 553305)";return}e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.set",{id:s,name:r,fields:{},workspace:i}),e.customersShowAddForm=!1,e.customersNewPhone="",e.customersNewName="",await ct(e,i)}catch(o){e.customersError=String(o)}finally{e.customersSaving=!1}}async function mu(e,t,n){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.delete",{id:t}),e.customersEditingId===t&&(e.customersEditingId=null),await ct(e,n)}catch(i){e.customersError=String(i)}finally{e.customersSaving=!1}}}async function yu(e,t,n,i,s){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.setField",{id:t,key:n,value:i}),await ct(e,s)}catch(r){e.customersError=String(r)}finally{e.customersSaving=!1}}}async function vu(e,t,n,i){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.deleteField",{id:t,key:n}),await ct(e,i)}catch(s){e.customersError=String(s)}finally{e.customersSaving=!1}}}const ab=Object.freeze(Object.defineProperty({__proto__:null,addCustomer:gu,deleteCustomer:mu,deleteCustomerField:vu,loadCustomers:ct,setCustomerField:yu},Symbol.toStringTag,{value:"Module"}));function Qt(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout(),auditCount:e.auditEntries.length,onAuditClick:()=>{e.auditModalOpen=!0}}}function lb(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),onAddAccount:()=>{e.addingWorkspace=!0},hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout(),auditCount:e.auditEntries.length,onAuditClick:()=>{e.auditModalOpen=!0}}}function cb(e){const t=ie(e);if(!t)return;const n=t.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return n==null?void 0:n.id}function ub(e){const t=ie(e);return(t==null?void 0:t.whatsappAccountId)??void 0}function db(e){var n;const t=ie(e);if(t)return(n=t.agents[0])==null?void 0:n.id}function pb(e){return e.selectedWorkspace??void 0}function ie(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const hb=/^data:/i,fb=/^https?:\/\//i;function Ya(e){var a,l;const t=((a=e.agentsList)==null?void 0:a.agents)??[],n=ll(e.sessionKey),i=(n==null?void 0:n.agentId)??((l=e.agentsList)==null?void 0:l.defaultId)??"main",s=t.find(c=>c.id===i),r=s==null?void 0:s.identity,o=(r==null?void 0:r.avatarUrl)??(r==null?void 0:r.avatar);if(o)return hb.test(o)||fb.test(o)?o:r==null?void 0:r.avatarUrl}function gb(e){var i;if(!e)return null;const t=(i=e.channelAccounts)==null?void 0:i.whatsapp;if(!t||t.length===0)return null;const n=t[0];return{running:n.running??!1,connected:n.connected??!1,linked:n.linked??!1,lastError:n.lastError}}function mb(e){var o;if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=(o=e.channelAccounts)==null?void 0:o.imessage;if(!t||t.length===0)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const n=t[0],i=n.running??!1,s=n.probe,r=s!=null?s.ok===!0:i;return{configured:n.configured??!1,running:i,connected:r,lastError:n.lastError??null,selfChatMode:n.mode==="self-chat"||!!n.selfChatMode,dmPolicy:n.dmPolicy??null,cliPath:n.cliPath??null}}function yb(e){var o;const t=(o=e.configSnapshot)==null?void 0:o.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const i=n.find(a=>{var l,c;return((l=a.match)==null?void 0:l.channel)==="imessage"&&((c=a.meta)==null?void 0:c.imessageOwner)});if(!i)return null;const s=i.agentId;for(const a of e.workspaces)if(a.agents.some(l=>l.id===s))return a.name;if(s==="admin"||s==="public"){const a=e.workspaces.find(l=>l.isDefault);return(a==null?void 0:a.name)??null}const r=s.replace(/-(admin|public)$/,"");if(r!==s){const a=e.workspaces.find(l=>l.name===r);return(a==null?void 0:a.name)??null}return null}function vb(e){var t,n,i,s,r,o,a;if(e.publicChat)return e.connected?e.publicChatAuthenticated?bv({connected:e.connected,sessionKey:e.sessionKey,loading:e.chatLoading,sending:e.chatSending,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,assistantAvatarUrl:e.chatAvatarUrl??Ya(e)??null,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,canAbort:!!e.chatRunId,disabledReason:e.connected?null:"Disconnected.",error:e.lastError,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,suggestion:e.chatSuggestion,onSuggestionClick:l=>{e.chatMessage=l,e.chatSuggestion=null,e.handleSendChat()},onRefresh:()=>(e.resetToolStream(),ne(async()=>{const{loadChatHistory:l}=await Promise.resolve().then(()=>$s);return{loadChatHistory:l}},void 0,import.meta.url).then(({loadChatHistory:l})=>{l(e)})),onDraftChange:l=>e.chatMessage=l,attachments:e.chatAttachments,onAttachmentsChange:l=>e.chatAttachments=l,onSend:()=>e.handleSendChat(),onAbort:()=>{e.handleAbortChat()},onQueueRemove:l=>e.removeQueuedMessage(l),onChatScroll:l=>e.handleChatScroll(l),nearBottom:e.chatUserNearBottom}):Jv({authMode:e.publicChatConfig.auth??"anonymous",authStep:e.publicChatAuthStep,connected:e.connected,client:e.client,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,cookieTtlDays:e.publicChatConfig.cookieTtlDays,onAuthenticated:l=>{e.publicChatSessionKey=l,e.sessionKey=l,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready",ne(async()=>{const{loadChatHistory:c}=await Promise.resolve().then(()=>$s);return{loadChatHistory:c}},void 0,import.meta.url).then(({loadChatHistory:c})=>{c(e)})},onAuthStepChange:l=>{e.publicChatAuthStep=l}}):p`
|
|
3156
|
+
`}const jr="taskmaster-access-session",uu={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function du(){try{return localStorage.getItem(jr)}catch{return null}}function pu(e){try{localStorage.setItem(jr,e)}catch{}}function nb(){try{localStorage.removeItem(jr)}catch{}}async function Ya(e){if(e.client)try{const t=du(),n=await e.client.request("access.status",{token:t});e.accessState={...e.accessState,checked:!0,hasPins:n.hasPins,hasMasterPin:n.hasMasterPin,accounts:n.accounts??[],authenticated:n.authenticated,workspace:n.workspace,master:n.master,error:null}}catch{e.accessState={...e.accessState,checked:!0,hasPins:!1,hasMasterPin:!1,accounts:[],authenticated:!0,error:null}}}async function ib(e,t,n){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const i=await e.client.request("access.verify",{account:t,pin:n});i.ok&&i.token?(pu(i.token),e.accessState={...e.accessState,authenticated:!0,workspace:i.workspace??null,master:i.master??!1,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:i.message??"Incorrect PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to verify PIN"}}}}async function sb(e,t){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const n=await e.client.request("access.setMasterPin",{pin:t});n.ok&&n.token?(pu(n.token),e.accessState={...e.accessState,checked:!0,hasPins:!0,hasMasterPin:!0,authenticated:!0,workspace:null,master:!0,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:"Failed to set PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to set PIN"}}}}async function rb(e,t,n){if(!e.client)return!1;try{return(await e.client.request("access.setAccountPin",{workspace:t,pin:n})).ok}catch{return!1}}async function ob(e){const t=du();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}nb(),e.accessState={...uu,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}function ab(e,t="admin"){var s;if(!e)return[];const n=e.bindings;if(!Array.isArray(n))return[];const i=[];for(const r of n){if(!r||typeof r!="object"||r.agentId!==t&&r.agentId!=="management")continue;const o=r.match;if(!o||typeof o!="object"||(o.channel??"").toLowerCase()!=="whatsapp")continue;const l=o.peer;if(!l||typeof l!="object"||l.kind!=="dm")continue;const c=l.id??"";c&&i.push({phone:c,paired:((s=r.meta)==null?void 0:s.paired)===!0})}return i.sort((r,o)=>r.paired&&!o.paired?-1:!r.paired&&o.paired?1:0),i}function hu(e,t,n="admin",i){const s=c=>c===n||c==="management",r=new Map,o=new Map;for(const c of e){if(!c||typeof c!="object"||!s(c.agentId))continue;const u=c.match;if(!u||typeof u!="object"||(u.channel??"").toLowerCase()!=="whatsapp")continue;const d=u.peer;if(!d||typeof d!="object"||d.kind!=="dm")continue;const p=d.id??"";p&&(c.meta&&r.set(p,c.meta),u.accountId&&o.set(p,u.accountId))}const a=e.filter(c=>{if(!c||typeof c!="object"||!s(c.agentId))return!0;const u=c.match;if(!u||typeof u!="object"||(u.channel??"").toLowerCase()!=="whatsapp")return!0;const d=u.peer;return!d||typeof d!="object"?!0:d.kind!=="dm"}),l=t.map(c=>{const u=i??o.get(c.phone),f={channel:"whatsapp",peer:{kind:"dm",id:c.phone}};u&&(f.accountId=u);const d={agentId:n,match:f},p=r.get(c.phone);return p?d.meta=p:c.paired&&(d.meta={paired:!0}),d});return[...a,...l]}async function _i(e,t){if(!e.client||!e.connected)return;if(!t){e.adminPhones=[];return}if(e.adminsLoading)return;e.adminsLoading=!0,e.adminsError=null;const n=t;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.config;e.configForm=ze(s??{}),e.adminPhones=ab(s,n),e.configFormDirty=!1}catch(i){e.adminsError=String(i)}finally{e.adminsLoading=!1}}async function fu(e,t,n,i){var o,a;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n;let r=t.replace(/[\s\-\(\)]/g,"");if(!r){e.adminsError="Phone number is required";return}if(r.startsWith("+")||(r="+"+r),!/^\+[1-9]\d{6,14}$/.test(r)){e.adminsError="Invalid phone number. Use international format (e.g., +44 7504 472444)";return}if(e.adminPhones.some(l=>l.phone===r)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const l=ze(e.configForm??((o=e.configSnapshot)==null?void 0:o.config)??{}),c=l.bindings??[],u=[...e.adminPhones,{phone:r}],f=hu(c,u,s,i);kl(l,["bindings"],f);const d=(a=e.configSnapshot)==null?void 0:a.hash;if(!d){e.adminsError="Config hash missing; reload and retry.";return}const p=nt(l);await e.client.request("config.set",{raw:p,baseHash:d}),await _i(e,n)}catch(l){e.adminsError=String(l)}finally{e.adminsSaving=!1}}async function gu(e,t,n,i){var o,a;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n,r=e.adminPhones.find(l=>l.phone===t);if(r!=null&&r.paired){e.adminsError="Cannot remove the paired phone. Unlink WhatsApp first.";return}e.adminsSaving=!0,e.adminsError=null;try{const l=ze(e.configForm??((o=e.configSnapshot)==null?void 0:o.config)??{}),c=l.bindings??[],u=e.adminPhones.filter(w=>w.phone!==t),f=hu(c,u,s,i);kl(l,["bindings"],f);const d=(a=e.configSnapshot)==null?void 0:a.hash;if(!d){e.adminsError="Config hash missing; reload and retry.";return}const p=nt(l);await e.client.request("config.set",{raw:p,baseHash:d}),await _i(e,n)}catch(l){e.adminsError=String(l)}finally{e.adminsSaving=!1}}const lb=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:fu,loadAdmins:_i,removeAdmin:gu},Symbol.toStringTag,{value:"Module"}));async function ct(e,t){if(!(!e.client||!e.connected)){if(!t){e.customersRecords=[];return}if(!e.customersLoading){e.customersLoading=!0,e.customersError=null;try{const n=e.customersSearchQuery.trim(),i=n?await e.client.request("records.search",{query:n,workspace:t}):await e.client.request("records.list",{workspace:t});e.customersRecords=i.records??[]}catch(n){e.customersError=String(n)}finally{e.customersLoading=!1}}}}async function mu(e,t,n,i){if(!e.client||!e.connected||e.customersSaving)return;let s=t.replace(/[\s\-\(\)]/g,"");const r=n.trim();if(!s){e.customersError="Phone number is required";return}if(!r){e.customersError="Name is required";return}if(s.startsWith("+")||(s="+"+s),!/^\+[1-9]\d{6,14}$/.test(s)){e.customersError="Invalid phone number. Use international format (e.g., +44 7490 553305)";return}e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.set",{id:s,name:r,fields:{},workspace:i}),e.customersShowAddForm=!1,e.customersNewPhone="",e.customersNewName="",await ct(e,i)}catch(o){e.customersError=String(o)}finally{e.customersSaving=!1}}async function yu(e,t,n){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.delete",{id:t}),e.customersEditingId===t&&(e.customersEditingId=null),await ct(e,n)}catch(i){e.customersError=String(i)}finally{e.customersSaving=!1}}}async function vu(e,t,n,i,s){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.setField",{id:t,key:n,value:i}),await ct(e,s)}catch(r){e.customersError=String(r)}finally{e.customersSaving=!1}}}async function bu(e,t,n,i){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.deleteField",{id:t,key:n}),await ct(e,i)}catch(s){e.customersError=String(s)}finally{e.customersSaving=!1}}}const cb=Object.freeze(Object.defineProperty({__proto__:null,addCustomer:mu,deleteCustomer:yu,deleteCustomerField:bu,loadCustomers:ct,setCustomerField:vu},Symbol.toStringTag,{value:"Module"}));function Qt(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout(),auditCount:e.auditEntries.length,onAuditClick:()=>{e.auditModalOpen=!0}}}function ub(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),onAddAccount:()=>{e.addingWorkspace=!0},hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout(),auditCount:e.auditEntries.length,onAuditClick:()=>{e.auditModalOpen=!0}}}function db(e){const t=ie(e);if(!t)return;const n=t.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return n==null?void 0:n.id}function pb(e){const t=ie(e);return(t==null?void 0:t.whatsappAccountId)??void 0}function hb(e){var n;const t=ie(e);if(t)return(n=t.agents[0])==null?void 0:n.id}function fb(e){return e.selectedWorkspace??void 0}function ie(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const gb=/^data:/i,mb=/^https?:\/\//i;function Xa(e){var a,l;const t=((a=e.agentsList)==null?void 0:a.agents)??[],n=cl(e.sessionKey),i=(n==null?void 0:n.agentId)??((l=e.agentsList)==null?void 0:l.defaultId)??"main",s=t.find(c=>c.id===i),r=s==null?void 0:s.identity,o=(r==null?void 0:r.avatarUrl)??(r==null?void 0:r.avatar);if(o)return gb.test(o)||mb.test(o)?o:r==null?void 0:r.avatarUrl}function yb(e){var i;if(!e)return null;const t=(i=e.channelAccounts)==null?void 0:i.whatsapp;if(!t||t.length===0)return null;const n=t[0];return{running:n.running??!1,connected:n.connected??!1,linked:n.linked??!1,lastError:n.lastError}}function vb(e){var o;if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=(o=e.channelAccounts)==null?void 0:o.imessage;if(!t||t.length===0)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const n=t[0],i=n.running??!1,s=n.probe,r=s!=null?s.ok===!0:i;return{configured:n.configured??!1,running:i,connected:r,lastError:n.lastError??null,selfChatMode:n.mode==="self-chat"||!!n.selfChatMode,dmPolicy:n.dmPolicy??null,cliPath:n.cliPath??null}}function bb(e){var o;const t=(o=e.configSnapshot)==null?void 0:o.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const i=n.find(a=>{var l,c;return((l=a.match)==null?void 0:l.channel)==="imessage"&&((c=a.meta)==null?void 0:c.imessageOwner)});if(!i)return null;const s=i.agentId;for(const a of e.workspaces)if(a.agents.some(l=>l.id===s))return a.name;if(s==="admin"||s==="public"){const a=e.workspaces.find(l=>l.isDefault);return(a==null?void 0:a.name)??null}const r=s.replace(/-(admin|public)$/,"");if(r!==s){const a=e.workspaces.find(l=>l.name===r);return(a==null?void 0:a.name)??null}return null}function wb(e){var t,n,i,s,r,o,a;if(e.embeddingDownloading&&!e.publicChat)return h`
|
|
3157
|
+
<div class="setup-container">
|
|
3158
|
+
<div class="setup-card" style="text-align:center; max-width:420px;">
|
|
3159
|
+
<div class="setup-spinner"></div>
|
|
3160
|
+
<h2 style="margin:16px 0 8px; font-size:1.1rem; font-weight:600; color:#fff;">Downloading embedding model</h2>
|
|
3161
|
+
<p style="margin:0; color:rgba(255,255,255,0.6); font-size:0.85rem; line-height:1.4;">
|
|
3162
|
+
This is a one-time download after install or upgrade.
|
|
3163
|
+
It may take a few minutes depending on your connection.
|
|
3164
|
+
</p>
|
|
3165
|
+
<p style="margin:12px 0 0; color:rgba(255,255,255,0.4); font-size:0.75rem;">
|
|
3166
|
+
Memory search will be available when the download completes.
|
|
3167
|
+
</p>
|
|
3168
|
+
</div>
|
|
3169
|
+
</div>
|
|
3170
|
+
`;if(e.publicChat)return e.connected?e.publicChatAuthenticated?kv({connected:e.connected,sessionKey:e.sessionKey,loading:e.chatLoading,sending:e.chatSending,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,assistantAvatarUrl:e.chatAvatarUrl??Xa(e)??null,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,canAbort:!!e.chatRunId,disabledReason:e.connected?null:"Disconnected.",error:e.lastError,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,suggestion:e.chatSuggestion,onSuggestionClick:l=>{e.chatMessage=l,e.chatSuggestion=null,e.handleSendChat()},onRefresh:()=>(e.resetToolStream(),ne(async()=>{const{loadChatHistory:l}=await Promise.resolve().then(()=>xs);return{loadChatHistory:l}},void 0,import.meta.url).then(({loadChatHistory:l})=>{l(e)})),onDraftChange:l=>e.chatMessage=l,attachments:e.chatAttachments,onAttachmentsChange:l=>e.chatAttachments=l,onSend:()=>e.handleSendChat(),onAbort:()=>{e.handleAbortChat()},onQueueRemove:l=>e.removeQueuedMessage(l),onChatScroll:l=>e.handleChatScroll(l),nearBottom:e.chatUserNearBottom}):tb({authMode:e.publicChatConfig.auth??"anonymous",authStep:e.publicChatAuthStep,connected:e.connected,client:e.client,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,cookieTtlDays:e.publicChatConfig.cookieTtlDays,onAuthenticated:l=>{e.publicChatSessionKey=l,e.sessionKey=l,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready",ne(async()=>{const{loadChatHistory:c}=await Promise.resolve().then(()=>xs);return{loadChatHistory:c}},void 0,import.meta.url).then(({loadChatHistory:c})=>{c(e)})},onAuthStepChange:l=>{e.publicChatAuthStep=l}}):h`
|
|
3125
3171
|
<div class="setup-container">
|
|
3126
3172
|
<div class="setup-card">
|
|
3127
3173
|
<div class="setup-spinner"></div>
|
|
3128
3174
|
<p>Connecting...</p>
|
|
3129
3175
|
</div>
|
|
3130
3176
|
</div>
|
|
3131
|
-
`;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return Fa({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(c,u)=>{u!=null&&e.handlePinSubmit(c,u)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(c,u,f)=>e.handleChangePin(c,u,f)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return Fa({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:c=>e.handleSetMasterPin(c)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",k}if(e.setup){const l=gb(e.channelsSnapshot),c=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],u=mb(e.channelsSnapshot),f=yb(e);return ef({connected:e.connected,assistantName:e.assistantName,currentStep:e.setupStep,licenseKey:e.licenseKey,licenseBusy:e.licenseBusy,licenseValid:e.licenseValid,licenseMessage:e.licenseMessage,licenseTier:e.licenseTier,licenseDeviceId:e.licenseDeviceId,licenseStoredKey:e.licenseStoredKey,onLicenseKeyChange:d=>e.handleLicenseKeyChange(d),onLicenseActivate:()=>e.handleLicenseActivate(),onLicenseRemove:async()=>{await e.handleLicenseRemove(),e.licenseRemoveConfirm=!1},licenseRemoveConfirm:e.licenseRemoveConfirm,onLicenseRemoveConfirm:()=>{e.licenseRemoveConfirm=!0},onLicenseRemoveCancel:()=>{e.licenseRemoveConfirm=!1},authConnected:e.authConnected,authBusy:e.authBusy,authMessage:e.authMessage,authUrl:e.authUrl,authCodeInput:e.authCodeInput,authExpiresIn:e.authExpiresIn,whatsappBusy:e.whatsappBusy,whatsappLoginMessage:e.whatsappLoginMessage,whatsappLoginQrDataUrl:e.whatsappLoginQrDataUrl,whatsappLoginConnected:e.whatsappLoginConnected,whatsappChannelStatus:l,whatsappAccounts:c,whatsappActiveQrAccountId:e.whatsappActiveQrAccountId,whatsappAccountSaving:e.whatsappAccountSaving,gatewayHealthy:e.gatewayHealthy,gatewayHealthLoading:e.gatewayHealthLoading,gatewayHealthMessage:e.gatewayHealthMessage,gatewayRestartBusy:e.gatewayRestartBusy,updateAvailable:e.updateAvailable,currentVersion:e.currentVersion,latestVersion:e.latestVersion,updateChecking:e.updateChecking,updateRunning:e.updateRunning,updateMessage:e.updateMessage,updateProgressSteps:e.updateProgressSteps,updateLastResult:e.updateLastResult,onUpdateCheck:()=>e.handleUpdateCheck(),onUpdateRun:()=>e.handleUpdateRun(),onUpdateDismissResult:()=>e.handleUpdateDismissResult(),uninstallConfirm:e.uninstallConfirm,uninstallBusy:e.uninstallBusy,uninstallDone:e.uninstallDone,uninstallError:e.uninstallError,uninstallConfirmText:e.uninstallConfirmText,onUninstallConfirm:()=>e.handleUninstallConfirm(),onUninstallCancel:()=>e.handleUninstallCancel(),onUninstallConfirmTextChange:d=>e.handleUninstallConfirmTextChange(d),onUninstallRun:()=>e.handleUninstallRun(),onUninstallDismiss:()=>e.handleUninstallDismiss(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:d=>e.handleAuthSubmitCode(d),onAuthCodeChange:d=>e.handleAuthCodeChange(d),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async d=>{await e.handleWhatsAppStart(!0,d),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(d),await q(e,!0),e.requestUpdate())},onWhatsAppReset:async d=>{await e.handleWhatsAppLogout(d),await e.handleWhatsAppStart(!0,d),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(d),await q(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await q(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),q(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:d=>e.handleRemoveWhatsAppAccount(d),workspaces:e.workspaces,workspacesLoading:e.workspacesLoading,workspacesError:e.workspacesError,addingWorkspace:e.addingWorkspace,newWorkspaceName:e.newWorkspaceName,newWorkspacePath:e.newWorkspacePath,workspaceSaving:e.workspaceSaving,workspaceRemoveConfirm:e.workspaceRemoveConfirm,newWorkspacePin:e.newWorkspacePin,onSetNewWorkspacePin:d=>{e.newWorkspacePin=d},onWorkspaceCreate:async(d,h)=>{const w=e.newWorkspacePin;await e.handleWorkspaceCreate(d,h),w.match(/^\d{4,6}$/)&&(await ib(e,d,w),e.newWorkspacePin="")},onWorkspaceRemove:d=>e.handleWorkspaceRemove(d),onSetAddingWorkspace:d=>{e.addingWorkspace=d},onSetNewWorkspaceName:d=>{e.newWorkspaceName=d},onSetNewWorkspacePath:d=>{e.newWorkspacePath=d},onSetWorkspaceRemoveConfirm:d=>{e.workspaceRemoveConfirm=d},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(d,h)=>e.handleWorkspaceRename(d,h),whatsappDmPolicy:(()=>{const d=ie(e),h=d==null?void 0:d.whatsappAccountId,w=h?c.find(b=>b.accountId===h):c[0];return(w==null?void 0:w.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var x;const d=ie(e),h=d==null?void 0:d.whatsappAccountId,w=h?c.find(E=>E.accountId===h):c[0];if(!w)return;const S=w.dmPolicy!=null&&w.dmPolicy!=="disabled"?"disabled":"open",T=S==="open"?{dmPolicy:S,allowFrom:["*"]}:{dmPolicy:S};try{const E=await e.client.request("config.get"),C=E.config,I=(x=C==null?void 0:C.channels)==null?void 0:x.whatsapp,Q=((I==null?void 0:I.accounts)??{})[w.accountId]?{channels:{whatsapp:{accounts:{[w.accountId]:T}}}}:{channels:{whatsapp:T}};await e.client.request("config.patch",{raw:JSON.stringify(Q),baseHash:E.hash,note:`WhatsApp DM policy → ${S}`,skipRestart:!0}),await q(e,!1)}catch(E){console.error("DM toggle failed:",E)}},whatsappModel:(()=>{var x,E;const d=ie(e);if(!d)return null;const h=d.agents.find(C=>C.id.endsWith("-public")||C.id==="public");if(!h)return null;const w=(x=e.configSnapshot)==null?void 0:x.config,b=(E=w==null?void 0:w.agents)==null?void 0:E.list;if(!Array.isArray(b))return null;const S=b.find(C=>C.id===h.id);if(!(S!=null&&S.model))return null;const T=typeof S.model=="string"?S.model:S.model.primary;return(T==null?void 0:T.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async d=>{const h=ie(e);if(!h)return;const w=h.agents.find(b=>b.id.endsWith("-public")||b.id==="public");if(w)try{const b=await e.client.request("config.get"),S=b.config,T=(S==null?void 0:S.agents)??{},x=Array.isArray(T.list)?[...T.list]:[],E=x.findIndex(I=>I.id===w.id);if(d)E>=0?x[E]={...x[E],model:d}:x.push({id:w.id,model:d});else if(E>=0){const{model:I,...U}=x[E];Object.keys(U).length<=1?x.splice(E,1):x[E]=U}const C=x.length>0?{agents:{list:x}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(C),baseHash:b.hash,note:`Public agent model → ${d||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Model change failed:",b)}},whatsappThinkingLevel:(()=>{var T,x,E;const d=ie(e);if(!d)return null;const h=d.agents.find(C=>C.id.endsWith("-public")||C.id==="public");if(!h)return null;const w=(T=e.configSnapshot)==null?void 0:T.config,b=(x=w==null?void 0:w.agents)==null?void 0:x.list;if(!Array.isArray(b))return null;const S=b.find(C=>C.id===h.id);return((E=S==null?void 0:S.thinkingLevel)==null?void 0:E.trim())||null})(),onWhatsAppThinkingChange:async d=>{const h=ie(e);if(!h)return;const w=h.agents.find(b=>b.id.endsWith("-public")||b.id==="public");if(w)try{const b=await e.client.request("config.get"),S=b.config,T=(S==null?void 0:S.agents)??{},x=Array.isArray(T.list)?[...T.list]:[],E=x.findIndex(U=>U.id===w.id),C=d==="off"?void 0:d;if(C)E>=0?x[E]={...x[E],thinkingLevel:C}:x.push({id:w.id,thinkingLevel:C});else if(E>=0){const{thinkingLevel:U,...Q}=x[E];Object.keys(Q).length<=1?x.splice(E,1):x[E]=Q}const I=x.length>0?{agents:{list:x}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(I),baseHash:b.hash,note:`Public agent thinking → ${C||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Thinking change failed:",b)}},whatsappGroupPolicy:(()=>{var E,C;const d=(E=e.configSnapshot)==null?void 0:E.config,h=(C=d==null?void 0:d.channels)==null?void 0:C.whatsapp,w=ie(e),b=w==null?void 0:w.whatsappAccountId,S=(h==null?void 0:h.accounts)??{},T=b?S[b]:void 0;return(T==null?void 0:T.groupPolicy)??(h==null?void 0:h.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var C,I;const d=(C=e.configSnapshot)==null?void 0:C.config,h=(I=d==null?void 0:d.channels)==null?void 0:I.whatsapp,w=ie(e),b=w==null?void 0:w.whatsappAccountId,S=(h==null?void 0:h.accounts)??{},T=b?S[b]:void 0,E=((T==null?void 0:T.groups)??(h==null?void 0:h.groups)??{})["*"];return(E==null?void 0:E.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var w;const d=ie(e),h=d==null?void 0:d.whatsappAccountId;try{const b=await e.client.request("config.get"),S=b.config,T=((w=S==null?void 0:S.channels)==null?void 0:w.whatsapp)??{},x=T.accounts??{},E=h?x[h]:void 0,C=(E==null?void 0:E.groupPolicy)??T.groupPolicy??"allowlist",I=C==="disabled"||C==="allowlist",U=I?"open":"disabled",Q=I?{"*":{}}:void 0,He={groupPolicy:U};Q&&(He.groups=Q);const Rt=E?{channels:{whatsapp:{accounts:{[h]:He}}}}:{channels:{whatsapp:He}};await e.client.request("config.patch",{raw:JSON.stringify(Rt),baseHash:b.hash,note:`WhatsApp groups → ${U}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Group toggle failed:",b)}},onWhatsAppGroupMentionChange:async d=>{var b;const h=ie(e),w=h==null?void 0:h.whatsappAccountId;try{const S=await e.client.request("config.get"),T=S.config,E=(((b=T==null?void 0:T.channels)==null?void 0:b.whatsapp)??{}).accounts??{},C=w?E[w]:void 0,I={"*":{requireMention:d}},U=C?{channels:{whatsapp:{accounts:{[w]:{groups:I}}}}}:{channels:{whatsapp:{groups:I}}};await e.client.request("config.patch",{raw:JSON.stringify(U),baseHash:S.hash,note:`WhatsApp group mention → ${d?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(S){console.error("Group mention change failed:",S)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:u.configured,imessageRunning:u.running,imessageConnected:u.connected,imessageLastError:u.lastError,imessageSelfChatMode:u.selfChatMode,imessageCliPath:u.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:f,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const d=await e.client.request("config.get"),h=d.config,w=(h==null?void 0:h.bindings)??[],b=ie(e),S=b==null?void 0:b.agents.find(I=>I.id.endsWith("-admin")||I.id==="admin"),T=(S==null?void 0:S.id)??"admin",x=w.filter(I=>{var U;return((U=I.match)==null?void 0:U.channel)!=="imessage"}),E=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],C=[...x,...E];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:C}),baseHash:d.hash,note:"Enable iMessage (self-chat) for "+((b==null?void 0:b.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([q(e,!0),Te(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await q(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const d=await e.client.request("config.get"),h=d.config,b=((h==null?void 0:h.bindings)??[]).filter(S=>{var T;return((T=S.match)==null?void 0:T.channel)!=="imessage"});await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:b}),baseHash:d.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([q(e,!0),Te(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const d=await e.client.request("config.get"),h=d.config,w=(h==null?void 0:h.bindings)??[],b=ie(e),S=b==null?void 0:b.agents.find(C=>C.id.endsWith("-admin")||C.id==="admin"),T=(S==null?void 0:S.id)??"admin",x=w.filter(C=>{var I;return((I=C.match)==null?void 0:I.channel)!=="imessage"}),E=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:[...x,...E]}),baseHash:d.hash,note:"Reassign iMessage to "+((b==null?void 0:b.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([q(e,!0),Te(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:d=>{e.infoModalOpen=d},onInfoModalClose:()=>{e.infoModalOpen=null},isMaster:e.accessState.master,apiKeyProviders:e.apiKeyProviders,apiKeyModalOpen:e.apiKeyModalOpen,apiKeyBusy:e.apiKeyBusy,apiKeyError:e.apiKeyError,apiKeySuccess:e.apiKeySuccess,apiKeySavingProvider:e.apiKeySavingProvider,onApiKeyModalOpen:()=>{e.apiKeyModalOpen=!0,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeyModalClose:()=>{e.apiKeyModalOpen=!1,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeySave:async(d,h)=>{e.apiKeySavingProvider=d,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Ka(e.client,d,h);const w=`${d} key saved`;e.apiKeySuccess=w,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await Ys(e.client)}catch{}d==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===w&&(e.apiKeySuccess=null)},2500)}catch(w){e.apiKeyError=w instanceof Error?w.message:"Failed to save key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async d=>{e.apiKeySavingProvider=d,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Fv(e.client,d);const h=`${d} key removed`;e.apiKeySuccess=h,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await Ys(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===h&&(e.apiKeySuccess=null)},2500)}catch(h){e.apiKeyError=h instanceof Error?h.message:"Failed to remove key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},authApiKeyMode:e.authApiKeyMode,authApiKeyInput:e.authApiKeyInput,authApiKeyBusy:e.authApiKeyBusy,authApiKeyError:e.authApiKeyError,onAuthApiKeyToggle:()=>{e.authApiKeyMode=!e.authApiKeyMode,e.authApiKeyError=null},onAuthApiKeyChange:d=>{e.authApiKeyInput=d},onAuthApiKeySubmit:async()=>{const d=e.authApiKeyInput.trim();if(d){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await Ka(e.client,"anthropic",d),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(h){e.authApiKeyError=h instanceof Error?h.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{var h;const d=e.selectedWorkspace??((h=e.workspaces[0])==null?void 0:h.name);return d?e.accessState.accounts.some(w=>w.id===d):!1})(),accountPinModalOpen:e.accountPinModalOpen,accountPinBusy:e.accountPinBusy,accountPinError:e.accountPinError,accountPinSuccess:e.accountPinSuccess,onAccountPinModalOpen:()=>{e.accountPinModalOpen=!0,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinModalClose:()=>{e.accountPinModalOpen=!1,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinSave:(d,h)=>{var b;const w=e.selectedWorkspace??((b=e.workspaces[0])==null?void 0:b.name);w&&e.handleAccountPinSave(w,d,h)},wsProps:lb(e)})}if(e.filesPage){const l=db(e);return Wh({connected:e.connected,wsProps:Qt(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>mn(e,l),onReindex:()=>Zp(e,l),onSelectFile:c=>qp(e,c,l),onToggleSelectFile:c=>Gp(e,c,l),onToggleDir:c=>Jp(e,c),onUpload:(c,u)=>Yp(e,c,u,l),onDownload:c=>ec(e,c,l),onBulkDownload:()=>Vp(e,l),onDelete:c=>Xp(e,c,l),onMove:(c,u)=>tc(e,c,u,l),onMoveToDir:(c,u)=>Qp(e,c,u,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:c=>{const u=e.filesSearchAgentId??l;eh(e,c,u)},onSearchAgentChange:c=>{e.filesSearchAgentId=c},onSearchClear:()=>{th(e)},onSearchQueryChange:c=>{e.filesSearchQuery=c}})}if(e.browserPage)return Rh({connected:e.connected,active:e.browserScreencastActive,loading:e.browserLoading,error:e.browserError,inputMode:e.browserInputMode,fullscreen:e.browserFullscreen,handoffPending:e.browserHandoffPending,handoffReason:e.browserHandoffReason,onStart:()=>Pv(e),onStop:()=>Lv(e),onToggleInput:()=>Rv(e),onToggleFullscreen:()=>Nv(e),onCompleteHandoff:()=>Iv(e),onCanvasMouseDown:l=>{const u=l.target.getBoundingClientRect(),d=an().translateCoordinates(l.clientX-u.left,l.clientY-u.top);vs(e,"mousePressed",d.x,d.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const u=l.target.getBoundingClientRect(),d=an().translateCoordinates(l.clientX-u.left,l.clientY-u.top);vs(e,"mouseReleased",d.x,d.y)},onCanvasMouseMove:l=>{const c=an();if(c.shouldThrottleMouseMove())return;const f=l.target.getBoundingClientRect(),d=c.translateCoordinates(l.clientX-f.left,l.clientY-f.top);vs(e,"mouseMoved",d.x,d.y)},onCanvasKeyDown:l=>{let c=0;l.altKey&&(c|=1),l.ctrlKey&&(c|=2),l.metaKey&&(c|=4),l.shiftKey&&(c|=8),bs(e,"keyDown",l.key,{code:l.code,modifiers:c||void 0}),l.key.length===1&&bs(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{bs(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=cb(e),c=ub(e);return nf({connected:e.connected,wsProps:Qt(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>_i(e,l),onAdd:u=>{hu(e,u,l,c).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:u=>fu(e,u,l,c),onNewPhoneChange:u=>e.handleAdminsNewPhoneChange(u)})}if(e.customersPage){const l=pb(e);return af({connected:e.connected,wsProps:Qt(e),loading:e.customersLoading,saving:e.customersSaving,records:e.customersRecords,error:e.customersError,searchQuery:e.customersSearchQuery,editingId:e.customersEditingId,showAddForm:e.customersShowAddForm,newRecordPhone:e.customersNewPhone,newRecordName:e.customersNewName,onSearch:c=>e.customersSearchQuery=c,onSearchSubmit:()=>ct(e,l),onAdd:(c,u)=>gu(e,c,u,l),onDelete:c=>mu(e,c,l),onSetField:(c,u,f)=>yu(e,c,u,f,l),onDeleteField:(c,u)=>vu(e,c,u,l),onToggleExpand:c=>{e.customersEditingId=e.customersEditingId===c?null:c},onShowAddForm:()=>e.customersShowAddForm=!0,onCancelAddForm:()=>{e.customersShowAddForm=!1,e.customersNewPhone="",e.customersNewName=""},onNewRecordPhoneChange:c=>e.handleCustomersNewPhoneChange(c),onNewRecordNameChange:c=>e.handleCustomersNewNameChange(c),onRefresh:()=>ct(e,l)})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",c=Ya(e),u=e.chatAvatarUrl??c??null;return Ky({connected:e.connected,wsProps:Qt(e),sessionKey:e.sessionKey,onSessionKeyChange:f=>{e.sessionKey=f,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatInterimText=null,e.chatSuggestion=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:f,lastActiveSessionKey:f}),e.loadAssistantIdentity(),Ee(e),Ls(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:f=>{Ln(e,e.sessionKey,{model:f}).then(()=>{Ee(e)})},onThinkingLevelChange:f=>{Ln(e,e.sessionKey,{thinkingLevel:f==="off"?null:f}).then(()=>{Ee(e)})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:f=>{e.chatMessage=f,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:f=>{Ln(e,e.sessionKey,{verboseLevel:f==="off"?null:f}).then(()=>{Ee(e)})},onFillerChange:f=>{Ln(e,e.sessionKey,{fillerEnabled:f}).then(()=>{Ee(e)})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:u,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:!1,onRefresh:()=>(e.resetToolStream(),Promise.all([Ee(e),Ls(e)])),onToggleFocusMode:()=>{},onChatScroll:f=>e.handleChatScroll(f),nearBottom:e.chatUserNearBottom,onDraftChange:f=>e.chatMessage=f,attachments:e.chatAttachments,onAttachmentsChange:f=>e.chatAttachments=f,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:f=>e.removeQueuedMessage(f),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:f=>e.handleOpenSidebar(f),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:f=>e.handleSplitRatioChange(f),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?vv({connected:e.connected,wsProps:Qt(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&ot(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?sn(e,{reset:!0}):xt(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(s=(i=e.channelsSnapshot)==null?void 0:i.channelMeta)!=null&&s.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((r=e.channelsSnapshot)==null?void 0:r.channelOrder)??[],channelLabels:((o=e.channelsSnapshot)==null?void 0:o.channelLabels)??{},channelMeta:((a=e.channelsSnapshot)==null?void 0:a.channelMeta)??[],agentIds:(()=>{var c;const l=ie(e);return((c=l==null?void 0:l.agents)==null?void 0:c.map(u=>u.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1},detailJobId:e.cronDetailJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,Ts(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{Qd(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,c)=>Yd(e,l,c),onRun:l=>Xd(e,l),onRemove:l=>Zd(e,l),onLoadRuns:l=>Ts(e,l)},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:l=>e.skillsFilter=l,onRefresh:()=>ot(e,{clearMessages:!0}),onToggle:(l,c)=>Hl(e,l,c),onEdit:(l,c)=>jl(e,l,c),onSaveKey:l=>ql(e,l),onInstall:(l,c,u)=>Gl(e,l,c,u)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?sn(e,{reset:!0}):xt(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,c)=>{const u=e;u.sessionLogsTypeFilters={...u.sessionLogsTypeFilters,[l]:c}},onAgentToggle:(l,c)=>{const u=e;u.sessionLogsAgentFilters={...u.sessionLogsAgentFilters,[l]:c}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onRefresh:()=>{sn(e,{reset:!0})},onExport:(l,c)=>e.exportSessionLogs(l,c),onScroll:l=>e.handleSessionLogsScroll(l)},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:l=>e.logsFilterText=l,onLevelToggle:(l,c)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:c}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onRefresh:()=>xt(e,{reset:!0}),onExport:(l,c)=>e.exportSessionLogs(l,c),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),p``)}function bb(e){const t=new Date(e),n=t.toLocaleDateString("en-GB",{day:"2-digit",month:"short"}),i=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return`${n} ${i}`}function Xa(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function wb(e,t,n){return p`
|
|
3177
|
+
`;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return Ua({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(c,u)=>{u!=null&&e.handlePinSubmit(c,u)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(c,u,f)=>e.handleChangePin(c,u,f)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return Ua({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:c=>e.handleSetMasterPin(c)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",k}if(e.setup){const l=yb(e.channelsSnapshot),c=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],u=vb(e.channelsSnapshot),f=bb(e);return nf({connected:e.connected,assistantName:e.assistantName,currentStep:e.setupStep,licenseKey:e.licenseKey,licenseBusy:e.licenseBusy,licenseValid:e.licenseValid,licenseMessage:e.licenseMessage,licenseTier:e.licenseTier,licenseDeviceId:e.licenseDeviceId,licenseStoredKey:e.licenseStoredKey,onLicenseKeyChange:d=>e.handleLicenseKeyChange(d),onLicenseActivate:()=>e.handleLicenseActivate(),onLicenseRemove:async()=>{await e.handleLicenseRemove(),e.licenseRemoveConfirm=!1},licenseRemoveConfirm:e.licenseRemoveConfirm,onLicenseRemoveConfirm:()=>{e.licenseRemoveConfirm=!0},onLicenseRemoveCancel:()=>{e.licenseRemoveConfirm=!1},authConnected:e.authConnected,authBusy:e.authBusy,authMessage:e.authMessage,authUrl:e.authUrl,authCodeInput:e.authCodeInput,authExpiresIn:e.authExpiresIn,whatsappBusy:e.whatsappBusy,whatsappLoginMessage:e.whatsappLoginMessage,whatsappLoginQrDataUrl:e.whatsappLoginQrDataUrl,whatsappLoginConnected:e.whatsappLoginConnected,whatsappChannelStatus:l,whatsappAccounts:c,whatsappActiveQrAccountId:e.whatsappActiveQrAccountId,whatsappAccountSaving:e.whatsappAccountSaving,gatewayHealthy:e.gatewayHealthy,gatewayHealthLoading:e.gatewayHealthLoading,gatewayHealthMessage:e.gatewayHealthMessage,gatewayRestartBusy:e.gatewayRestartBusy,updateAvailable:e.updateAvailable,currentVersion:e.currentVersion,latestVersion:e.latestVersion,updateChecking:e.updateChecking,updateRunning:e.updateRunning,updateMessage:e.updateMessage,updateProgressSteps:e.updateProgressSteps,updateLastResult:e.updateLastResult,onUpdateCheck:()=>e.handleUpdateCheck(),onUpdateRun:()=>e.handleUpdateRun(),onUpdateDismissResult:()=>e.handleUpdateDismissResult(),uninstallConfirm:e.uninstallConfirm,uninstallBusy:e.uninstallBusy,uninstallDone:e.uninstallDone,uninstallError:e.uninstallError,uninstallConfirmText:e.uninstallConfirmText,onUninstallConfirm:()=>e.handleUninstallConfirm(),onUninstallCancel:()=>e.handleUninstallCancel(),onUninstallConfirmTextChange:d=>e.handleUninstallConfirmTextChange(d),onUninstallRun:()=>e.handleUninstallRun(),onUninstallDismiss:()=>e.handleUninstallDismiss(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:d=>e.handleAuthSubmitCode(d),onAuthCodeChange:d=>e.handleAuthCodeChange(d),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async d=>{await e.handleWhatsAppStart(!0,d),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(d),await q(e,!0),e.requestUpdate())},onWhatsAppReset:async d=>{await e.handleWhatsAppLogout(d),await e.handleWhatsAppStart(!0,d),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(d),await q(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await q(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),q(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:d=>e.handleRemoveWhatsAppAccount(d),workspaces:e.workspaces,workspacesLoading:e.workspacesLoading,workspacesError:e.workspacesError,addingWorkspace:e.addingWorkspace,newWorkspaceName:e.newWorkspaceName,newWorkspacePath:e.newWorkspacePath,workspaceSaving:e.workspaceSaving,workspaceRemoveConfirm:e.workspaceRemoveConfirm,newWorkspacePin:e.newWorkspacePin,onSetNewWorkspacePin:d=>{e.newWorkspacePin=d},onWorkspaceCreate:async(d,p)=>{const w=e.newWorkspacePin;await e.handleWorkspaceCreate(d,p),w.match(/^\d{4,6}$/)&&(await rb(e,d,w),e.newWorkspacePin="")},onWorkspaceRemove:d=>e.handleWorkspaceRemove(d),onSetAddingWorkspace:d=>{e.addingWorkspace=d},onSetNewWorkspaceName:d=>{e.newWorkspaceName=d},onSetNewWorkspacePath:d=>{e.newWorkspacePath=d},onSetWorkspaceRemoveConfirm:d=>{e.workspaceRemoveConfirm=d},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(d,p)=>e.handleWorkspaceRename(d,p),whatsappDmPolicy:(()=>{const d=ie(e),p=d==null?void 0:d.whatsappAccountId,w=p?c.find(b=>b.accountId===p):c[0];return(w==null?void 0:w.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var $;const d=ie(e),p=d==null?void 0:d.whatsappAccountId,w=p?c.find(E=>E.accountId===p):c[0];if(!w)return;const S=w.dmPolicy!=null&&w.dmPolicy!=="disabled"?"disabled":"open",T=S==="open"?{dmPolicy:S,allowFrom:["*"]}:{dmPolicy:S};try{const E=await e.client.request("config.get"),C=E.config,I=($=C==null?void 0:C.channels)==null?void 0:$.whatsapp,Q=((I==null?void 0:I.accounts)??{})[w.accountId]?{channels:{whatsapp:{accounts:{[w.accountId]:T}}}}:{channels:{whatsapp:T}};await e.client.request("config.patch",{raw:JSON.stringify(Q),baseHash:E.hash,note:`WhatsApp DM policy → ${S}`,skipRestart:!0}),await q(e,!1)}catch(E){console.error("DM toggle failed:",E)}},whatsappModel:(()=>{var $,E;const d=ie(e);if(!d)return null;const p=d.agents.find(C=>C.id.endsWith("-public")||C.id==="public");if(!p)return null;const w=($=e.configSnapshot)==null?void 0:$.config,b=(E=w==null?void 0:w.agents)==null?void 0:E.list;if(!Array.isArray(b))return null;const S=b.find(C=>C.id===p.id);if(!(S!=null&&S.model))return null;const T=typeof S.model=="string"?S.model:S.model.primary;return(T==null?void 0:T.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async d=>{const p=ie(e);if(!p)return;const w=p.agents.find(b=>b.id.endsWith("-public")||b.id==="public");if(w)try{const b=await e.client.request("config.get"),S=b.config,T=(S==null?void 0:S.agents)??{},$=Array.isArray(T.list)?[...T.list]:[],E=$.findIndex(I=>I.id===w.id);if(d)E>=0?$[E]={...$[E],model:d}:$.push({id:w.id,model:d});else if(E>=0){const{model:I,...U}=$[E];Object.keys(U).length<=1?$.splice(E,1):$[E]=U}const C=$.length>0?{agents:{list:$}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(C),baseHash:b.hash,note:`Public agent model → ${d||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Model change failed:",b)}},whatsappThinkingLevel:(()=>{var T,$,E;const d=ie(e);if(!d)return null;const p=d.agents.find(C=>C.id.endsWith("-public")||C.id==="public");if(!p)return null;const w=(T=e.configSnapshot)==null?void 0:T.config,b=($=w==null?void 0:w.agents)==null?void 0:$.list;if(!Array.isArray(b))return null;const S=b.find(C=>C.id===p.id);return((E=S==null?void 0:S.thinkingLevel)==null?void 0:E.trim())||null})(),onWhatsAppThinkingChange:async d=>{const p=ie(e);if(!p)return;const w=p.agents.find(b=>b.id.endsWith("-public")||b.id==="public");if(w)try{const b=await e.client.request("config.get"),S=b.config,T=(S==null?void 0:S.agents)??{},$=Array.isArray(T.list)?[...T.list]:[],E=$.findIndex(U=>U.id===w.id),C=d==="off"?void 0:d;if(C)E>=0?$[E]={...$[E],thinkingLevel:C}:$.push({id:w.id,thinkingLevel:C});else if(E>=0){const{thinkingLevel:U,...Q}=$[E];Object.keys(Q).length<=1?$.splice(E,1):$[E]=Q}const I=$.length>0?{agents:{list:$}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(I),baseHash:b.hash,note:`Public agent thinking → ${C||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Thinking change failed:",b)}},whatsappGroupPolicy:(()=>{var E,C;const d=(E=e.configSnapshot)==null?void 0:E.config,p=(C=d==null?void 0:d.channels)==null?void 0:C.whatsapp,w=ie(e),b=w==null?void 0:w.whatsappAccountId,S=(p==null?void 0:p.accounts)??{},T=b?S[b]:void 0;return(T==null?void 0:T.groupPolicy)??(p==null?void 0:p.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var C,I;const d=(C=e.configSnapshot)==null?void 0:C.config,p=(I=d==null?void 0:d.channels)==null?void 0:I.whatsapp,w=ie(e),b=w==null?void 0:w.whatsappAccountId,S=(p==null?void 0:p.accounts)??{},T=b?S[b]:void 0,E=((T==null?void 0:T.groups)??(p==null?void 0:p.groups)??{})["*"];return(E==null?void 0:E.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var w;const d=ie(e),p=d==null?void 0:d.whatsappAccountId;try{const b=await e.client.request("config.get"),S=b.config,T=((w=S==null?void 0:S.channels)==null?void 0:w.whatsapp)??{},$=T.accounts??{},E=p?$[p]:void 0,C=(E==null?void 0:E.groupPolicy)??T.groupPolicy??"allowlist",I=C==="disabled"||C==="allowlist",U=I?"open":"disabled",Q=I?{"*":{}}:void 0,He={groupPolicy:U};Q&&(He.groups=Q);const Rt=E?{channels:{whatsapp:{accounts:{[p]:He}}}}:{channels:{whatsapp:He}};await e.client.request("config.patch",{raw:JSON.stringify(Rt),baseHash:b.hash,note:`WhatsApp groups → ${U}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Group toggle failed:",b)}},onWhatsAppGroupMentionChange:async d=>{var b;const p=ie(e),w=p==null?void 0:p.whatsappAccountId;try{const S=await e.client.request("config.get"),T=S.config,E=(((b=T==null?void 0:T.channels)==null?void 0:b.whatsapp)??{}).accounts??{},C=w?E[w]:void 0,I={"*":{requireMention:d}},U=C?{channels:{whatsapp:{accounts:{[w]:{groups:I}}}}}:{channels:{whatsapp:{groups:I}}};await e.client.request("config.patch",{raw:JSON.stringify(U),baseHash:S.hash,note:`WhatsApp group mention → ${d?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(S){console.error("Group mention change failed:",S)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:u.configured,imessageRunning:u.running,imessageConnected:u.connected,imessageLastError:u.lastError,imessageSelfChatMode:u.selfChatMode,imessageCliPath:u.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:f,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const d=await e.client.request("config.get"),p=d.config,w=(p==null?void 0:p.bindings)??[],b=ie(e),S=b==null?void 0:b.agents.find(I=>I.id.endsWith("-admin")||I.id==="admin"),T=(S==null?void 0:S.id)??"admin",$=w.filter(I=>{var U;return((U=I.match)==null?void 0:U.channel)!=="imessage"}),E=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],C=[...$,...E];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:C}),baseHash:d.hash,note:"Enable iMessage (self-chat) for "+((b==null?void 0:b.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([q(e,!0),Te(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await q(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const d=await e.client.request("config.get"),p=d.config,b=((p==null?void 0:p.bindings)??[]).filter(S=>{var T;return((T=S.match)==null?void 0:T.channel)!=="imessage"});await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:b}),baseHash:d.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([q(e,!0),Te(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const d=await e.client.request("config.get"),p=d.config,w=(p==null?void 0:p.bindings)??[],b=ie(e),S=b==null?void 0:b.agents.find(C=>C.id.endsWith("-admin")||C.id==="admin"),T=(S==null?void 0:S.id)??"admin",$=w.filter(C=>{var I;return((I=C.match)==null?void 0:I.channel)!=="imessage"}),E=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:[...$,...E]}),baseHash:d.hash,note:"Reassign iMessage to "+((b==null?void 0:b.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([q(e,!0),Te(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:d=>{e.infoModalOpen=d},onInfoModalClose:()=>{e.infoModalOpen=null},isMaster:e.accessState.master,apiKeyProviders:e.apiKeyProviders,apiKeyModalOpen:e.apiKeyModalOpen,apiKeyBusy:e.apiKeyBusy,apiKeyError:e.apiKeyError,apiKeySuccess:e.apiKeySuccess,apiKeySavingProvider:e.apiKeySavingProvider,onApiKeyModalOpen:()=>{e.apiKeyModalOpen=!0,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeyModalClose:()=>{e.apiKeyModalOpen=!1,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeySave:async(d,p)=>{e.apiKeySavingProvider=d,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await za(e.client,d,p);const w=`${d} key saved`;e.apiKeySuccess=w,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await Ys(e.client)}catch{}d==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===w&&(e.apiKeySuccess=null)},2500)}catch(w){e.apiKeyError=w instanceof Error?w.message:"Failed to save key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async d=>{e.apiKeySavingProvider=d,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Wv(e.client,d);const p=`${d} key removed`;e.apiKeySuccess=p,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await Ys(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===p&&(e.apiKeySuccess=null)},2500)}catch(p){e.apiKeyError=p instanceof Error?p.message:"Failed to remove key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},authApiKeyMode:e.authApiKeyMode,authApiKeyInput:e.authApiKeyInput,authApiKeyBusy:e.authApiKeyBusy,authApiKeyError:e.authApiKeyError,onAuthApiKeyToggle:()=>{e.authApiKeyMode=!e.authApiKeyMode,e.authApiKeyError=null},onAuthApiKeyChange:d=>{e.authApiKeyInput=d},onAuthApiKeySubmit:async()=>{const d=e.authApiKeyInput.trim();if(d){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await za(e.client,"anthropic",d),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(p){e.authApiKeyError=p instanceof Error?p.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{var p;const d=e.selectedWorkspace??((p=e.workspaces[0])==null?void 0:p.name);return d?e.accessState.accounts.some(w=>w.id===d):!1})(),accountPinModalOpen:e.accountPinModalOpen,accountPinBusy:e.accountPinBusy,accountPinError:e.accountPinError,accountPinSuccess:e.accountPinSuccess,onAccountPinModalOpen:()=>{e.accountPinModalOpen=!0,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinModalClose:()=>{e.accountPinModalOpen=!1,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinSave:(d,p)=>{var b;const w=e.selectedWorkspace??((b=e.workspaces[0])==null?void 0:b.name);w&&e.handleAccountPinSave(w,d,p)},publicChatEnabled:(()=>{var w;const d=(w=e.configSnapshot)==null?void 0:w.config,p=d==null?void 0:d.publicChat;return(p==null?void 0:p.enabled)===!0})(),publicChatAuthMode:(()=>{var b;const d=(b=e.configSnapshot)==null?void 0:b.config,p=d==null?void 0:d.publicChat,w=p==null?void 0:p.auth;return w==="verified"||w==="choice"?w:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var d;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const p=await e.client.request("config.get"),w=p.config,b=((d=w==null?void 0:w.publicChat)==null?void 0:d.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!b}}),baseHash:p.hash,note:`Public chat → ${b?"disabled":"enabled"}`}),e.configSnapshot=await e.client.request("config.get")}catch(p){console.error("Public chat toggle failed:",p)}finally{e.publicChatToggleBusy=!1}}},onPublicChatAuthModeChange:async d=>{if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const p=await e.client.request("config.get");await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{auth:d}}),baseHash:p.hash,note:`Public chat auth → ${d}`}),e.configSnapshot=await e.client.request("config.get")}catch(p){console.error("Public chat auth mode change failed:",p)}finally{e.publicChatToggleBusy=!1}}},wsProps:ub(e)})}if(e.filesPage){const l=hb(e);return Kh({connected:e.connected,wsProps:Qt(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>mn(e,l),onReindex:()=>Jp(e,l),onSelectFile:c=>Vp(e,c,l),onToggleSelectFile:c=>Gp(e,c,l),onToggleDir:c=>eh(e,c),onUpload:(c,u)=>Xp(e,c,u,l),onDownload:c=>tc(e,c,l),onBulkDownload:()=>Qp(e,l),onDelete:c=>Zp(e,c,l),onMove:(c,u)=>nc(e,c,u,l),onMoveToDir:(c,u)=>Yp(e,c,u,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:c=>{const u=e.filesSearchAgentId??l;th(e,c,u)},onSearchAgentChange:c=>{e.filesSearchAgentId=c},onSearchClear:()=>{nh(e)},onSearchQueryChange:c=>{e.filesSearchQuery=c}})}if(e.browserPage)return Nh({connected:e.connected,active:e.browserScreencastActive,loading:e.browserLoading,error:e.browserError,inputMode:e.browserInputMode,fullscreen:e.browserFullscreen,handoffPending:e.browserHandoffPending,handoffReason:e.browserHandoffReason,onStart:()=>Iv(e),onStop:()=>Rv(e),onToggleInput:()=>Dv(e),onToggleFullscreen:()=>Ov(e),onCompleteHandoff:()=>Nv(e),onCanvasMouseDown:l=>{const u=l.target.getBoundingClientRect(),d=an().translateCoordinates(l.clientX-u.left,l.clientY-u.top);vs(e,"mousePressed",d.x,d.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const u=l.target.getBoundingClientRect(),d=an().translateCoordinates(l.clientX-u.left,l.clientY-u.top);vs(e,"mouseReleased",d.x,d.y)},onCanvasMouseMove:l=>{const c=an();if(c.shouldThrottleMouseMove())return;const f=l.target.getBoundingClientRect(),d=c.translateCoordinates(l.clientX-f.left,l.clientY-f.top);vs(e,"mouseMoved",d.x,d.y)},onCanvasKeyDown:l=>{let c=0;l.altKey&&(c|=1),l.ctrlKey&&(c|=2),l.metaKey&&(c|=4),l.shiftKey&&(c|=8),bs(e,"keyDown",l.key,{code:l.code,modifiers:c||void 0}),l.key.length===1&&bs(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{bs(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=db(e),c=pb(e);return rf({connected:e.connected,wsProps:Qt(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>_i(e,l),onAdd:u=>{fu(e,u,l,c).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:u=>gu(e,u,l,c),onNewPhoneChange:u=>e.handleAdminsNewPhoneChange(u)})}if(e.customersPage){const l=fb(e);return cf({connected:e.connected,wsProps:Qt(e),loading:e.customersLoading,saving:e.customersSaving,records:e.customersRecords,error:e.customersError,searchQuery:e.customersSearchQuery,editingId:e.customersEditingId,showAddForm:e.customersShowAddForm,newRecordPhone:e.customersNewPhone,newRecordName:e.customersNewName,onSearch:c=>e.customersSearchQuery=c,onSearchSubmit:()=>ct(e,l),onAdd:(c,u)=>mu(e,c,u,l),onDelete:c=>yu(e,c,l),onSetField:(c,u,f)=>vu(e,c,u,f,l),onDeleteField:(c,u)=>bu(e,c,u,l),onToggleExpand:c=>{e.customersEditingId=e.customersEditingId===c?null:c},onShowAddForm:()=>e.customersShowAddForm=!0,onCancelAddForm:()=>{e.customersShowAddForm=!1,e.customersNewPhone="",e.customersNewName=""},onNewRecordPhoneChange:c=>e.handleCustomersNewPhoneChange(c),onNewRecordNameChange:c=>e.handleCustomersNewNameChange(c),onRefresh:()=>ct(e,l)})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",c=Xa(e),u=e.chatAvatarUrl??c??null;return jy({connected:e.connected,wsProps:Qt(e),sessionKey:e.sessionKey,onSessionKeyChange:f=>{e.sessionKey=f,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatInterimText=null,e.chatSuggestion=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:f,lastActiveSessionKey:f}),e.loadAssistantIdentity(),Ee(e),Ls(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:f=>{Ln(e,e.sessionKey,{model:f}).then(()=>{Ee(e)})},onThinkingLevelChange:f=>{Ln(e,e.sessionKey,{thinkingLevel:f==="off"?null:f}).then(()=>{Ee(e)})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:f=>{e.chatMessage=f,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:f=>{Ln(e,e.sessionKey,{verboseLevel:f==="off"?null:f}).then(()=>{Ee(e)})},onFillerChange:f=>{Ln(e,e.sessionKey,{fillerEnabled:f}).then(()=>{Ee(e)})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:u,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:!1,onRefresh:()=>(e.resetToolStream(),Promise.all([Ee(e),Ls(e)])),onToggleFocusMode:()=>{},onChatScroll:f=>e.handleChatScroll(f),nearBottom:e.chatUserNearBottom,onDraftChange:f=>e.chatMessage=f,attachments:e.chatAttachments,onAttachmentsChange:f=>e.chatAttachments=f,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:f=>e.removeQueuedMessage(f),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:f=>e.handleOpenSidebar(f),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:f=>e.handleSplitRatioChange(f),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?wv({connected:e.connected,wsProps:Qt(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&ot(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?sn(e,{reset:!0}):$t(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(s=(i=e.channelsSnapshot)==null?void 0:i.channelMeta)!=null&&s.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((r=e.channelsSnapshot)==null?void 0:r.channelOrder)??[],channelLabels:((o=e.channelsSnapshot)==null?void 0:o.channelLabels)??{},channelMeta:((a=e.channelsSnapshot)==null?void 0:a.channelMeta)??[],agentIds:(()=>{var c;const l=ie(e);return((c=l==null?void 0:l.agents)==null?void 0:c.map(u=>u.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1},detailJobId:e.cronDetailJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,Ts(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{Yd(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,c)=>Xd(e,l,c),onRun:l=>Zd(e,l),onRemove:l=>Jd(e,l),onLoadRuns:l=>Ts(e,l)},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:l=>e.skillsFilter=l,onRefresh:()=>ot(e,{clearMessages:!0}),onToggle:(l,c)=>ql(e,l,c),onEdit:(l,c)=>Hl(e,l,c),onSaveKey:l=>Vl(e,l),onInstall:(l,c,u)=>Gl(e,l,c,u)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?sn(e,{reset:!0}):$t(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,c)=>{const u=e;u.sessionLogsTypeFilters={...u.sessionLogsTypeFilters,[l]:c}},onAgentToggle:(l,c)=>{const u=e;u.sessionLogsAgentFilters={...u.sessionLogsAgentFilters,[l]:c}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onRefresh:()=>{sn(e,{reset:!0})},onExport:(l,c)=>e.exportSessionLogs(l,c),onScroll:l=>e.handleSessionLogsScroll(l)},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:l=>e.logsFilterText=l,onLevelToggle:(l,c)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:c}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onRefresh:()=>$t(e,{reset:!0}),onExport:(l,c)=>e.exportSessionLogs(l,c),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),h``)}function kb(e){const t=new Date(e),n=t.toLocaleDateString("en-GB",{day:"2-digit",month:"short"}),i=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return`${n} ${i}`}function Za(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function Sb(e,t,n){return h`
|
|
3132
3178
|
<div class="audit-modal-overlay" @click=${s=>{s.target.classList.contains("audit-modal-overlay")&&n()}}>
|
|
3133
3179
|
<div class="audit-modal-card">
|
|
3134
3180
|
<div class="audit-modal-header">
|
|
@@ -3139,16 +3185,16 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3139
3185
|
These files were written to shared or public folders by the agent.
|
|
3140
3186
|
Review to ensure no sensitive data was misplaced.
|
|
3141
3187
|
</p>
|
|
3142
|
-
${e.length===0?
|
|
3188
|
+
${e.length===0?h`<p class="audit-modal-empty">No unreviewed writes.</p>`:h`
|
|
3143
3189
|
<div class="audit-modal-list">
|
|
3144
|
-
${e.map(s=>
|
|
3190
|
+
${e.map(s=>h`
|
|
3145
3191
|
<div class="audit-modal-entry">
|
|
3146
3192
|
<div class="audit-modal-entry-path">
|
|
3147
|
-
<span class="audit-modal-folder audit-modal-folder--${
|
|
3193
|
+
<span class="audit-modal-folder audit-modal-folder--${Za(s.path)}">${Za(s.path)}</span>
|
|
3148
3194
|
<a href="/files" class="audit-modal-path-link">${s.path}</a>
|
|
3149
3195
|
</div>
|
|
3150
3196
|
<div class="audit-modal-entry-meta">
|
|
3151
|
-
${
|
|
3197
|
+
${kb(s.timestamp)}
|
|
3152
3198
|
<span class="audit-modal-agent">${s.agentId}</span>
|
|
3153
3199
|
</div>
|
|
3154
3200
|
</div>
|
|
@@ -3160,7 +3206,7 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3160
3206
|
`}
|
|
3161
3207
|
</div>
|
|
3162
3208
|
</div>
|
|
3163
|
-
`}const kb={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Sb={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:""};function Ab(e){e.basePath=dh();const t=Ie();if(_h(t.accentColor),window.scrollTo(0,0),sh(e),e.publicChat){const n=Ie();document.title=`Chat with ${n.name}`,xe(e);return}if(e.setup){document.title=`${t.name} Setup`,xe(e);return}if(e.filesPage){document.title=`${t.name} Files`,oh(e),xe(e);return}if(e.browserPage){document.title=`${t.name} Browser`,xe(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,xe(e);return}if(e.customersPage){document.title=`${t.name} Customers`,xe(e);return}if(e.chatPage){document.title=`${t.name} Chat`,xe(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,xe(e);return}gh(e,!0),ph(e),hh(e),window.addEventListener("popstate",e.popStateHandler),lh(e),xe(e),nh(e),e.tab==="logs"&&(e.logsSubTab==="session"?yr(e):gr(e)),e.tab==="debug"&&br(e)}function xb(e){zd(e)}function $b(e){var t;window.removeEventListener("popstate",e.popStateHandler),ih(e),mr(e),vr(e),wr(e),rh(e),ah(e),fh(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Eb(e,t){if(!e.publicChat){if(e.filesPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleFilesLoad&&e.handleFilesLoad(),e.adminsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdminsLoad&&e.handleAdminsLoad(),e.customersPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleCustomersLoad&&e.handleCustomersLoad(),e.chatPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleChatLoad&&e.handleChatLoad(),e.advancedPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdvancedLoad&&e.handleAdvancedLoad(),e.setup&&e.connected){const n=t.has("connected")&&t.get("connected")===!1;n&&e.handleLicenseStatusCheck&&e.licenseValid===null&&!e.licenseBusy&&e.handleLicenseStatusCheck(),n&&e.handleUpdateCheck&&e.handleUpdateCheck();const i=t.has("setupStep")&&e.setupStep==="auth";(n||i)&&e.setupStep==="auth"&&e.handleAuthStatusCheck&&e.authConnected===null&&!e.authBusy&&e.handleAuthStatusCheck(),e.setupStep==="whatsapp"&&t.has("setupStep")&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(r=>{e.channelsSnapshot=r,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1})),t.has("whatsappLoginConnected")&&e.whatsappLoginConnected===!0&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(s=>{e.channelsSnapshot=s,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1}))}if(e.tab==="chat"&&!e.advancedPage&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),i=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;hn(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&bl(e,t.has("tab")||t.has("logsAutoFollow"))}}function Tb(e){const t={name:(e==null?void 0:e.name)??"",displayName:(e==null?void 0:e.displayName)??"",about:(e==null?void 0:e.about)??"",picture:(e==null?void 0:e.picture)??"",banner:(e==null?void 0:e.banner)??"",website:(e==null?void 0:e.website)??"",nip05:(e==null?void 0:e.nip05)??"",lud16:(e==null?void 0:e.lud16)??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e!=null&&e.banner||e!=null&&e.website||e!=null&&e.nip05||e!=null&&e.lud16)}}async function Cb(e,t,n){await sr(e,t,n),await q(e,!0)}async function _b(e,t){await Sl(e,t),await q(e,!0)}async function Mb(e,t){await Al(e,t),await q(e,!0)}async function Pb(e,t){await xl(e,t)}async function Lb(e,t){await $l(e,t)}async function Ib(e){await qd(e),await Te(e),await q(e,!0)}async function Rb(e){await Te(e),await q(e,!0)}function Nb(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[i,...s]=n.split(":");if(!i||s.length===0)continue;const r=i.trim(),o=s.join(":").trim();r&&o&&(t[r]=o)}return t}function bu(e){var n,i,s;return((s=(((i=(n=e.channelsSnapshot)==null?void 0:n.channelAccounts)==null?void 0:i.nostr)??[])[0])==null?void 0:s.accountId)??e.nostrProfileAccountId??"default"}function wu(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Db(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Tb(n??void 0)}function Ob(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Bb(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function Fb(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Ub(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=bu(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(wu(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const r=(s==null?void 0:s.error)??`Profile update failed (${i.status})`;e.nostrProfileFormState={...t,saving:!1,error:r,success:null,fieldErrors:Nb(s==null?void 0:s.details)};return}if(!s.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 q(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function Wb(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=bu(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(wu(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const l=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const r=s.merged??s.imported??null,o=r?{...t.values,...r}:t.values,a=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:a},s.saved&&await q(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function Kb(e){if(e.client){e.authBusy=!0,e.authMessage=null;try{const t=await e.client.request("auth.status",{});e.authConnected=t.connected,e.authExpiresIn=t.expiresIn??null,e.authMessage=t.message??null,t.connected&&(e.setupStep="whatsapp")}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to check auth status"}finally{e.authBusy=!1}}}async function zb(e){if(e.client){e.authBusy=!0,e.authMessage=null,e.authUrl=null,e.authConnected=null;try{const t=await e.client.request("auth.oauth.start",{provider:"anthropic"});e.authUrl=t.authUrl,e.authMessage=t.message??"Sign in with your Claude Pro account"}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to start auth flow"}finally{e.authBusy=!1}}}async function jb(e,t){if(e.client){e.authBusy=!0,e.authMessage="Verifying code...";try{await e.client.request("auth.oauth.code",{code:t});const n=await e.client.request("auth.oauth.wait",{timeoutMs:3e4});n.connected?(e.authConnected=!0,e.authMessage=n.message??"Connected to Claude!",e.authUrl=null,e.authCodeInput=""):e.authMessage=n.message??"Still waiting for authorization..."}catch(n){e.authConnected=!1,e.authMessage=n instanceof Error?n.message:"Verification failed"}finally{e.authBusy=!1}}}function Hb(e,t){e.authCodeInput=t}function qb(e){e.setupStep="whatsapp"}async function Gb(e){if(e.client){e.licenseBusy=!0,e.licenseMessage=null;try{const t=await e.client.request("license.status",{});e.licenseDeviceId=t.deviceId??null,e.licenseStoredKey=t.key??null,t.licensed?(e.licenseValid=!0,e.licenseTier=t.tier??null,e.setupStep="auth"):(e.licenseValid=null,e.setupStep="license")}catch(t){const n=t instanceof Error?t.message:String(t);n.includes("unknown method")?(e.licenseValid=!0,e.setupStep="auth"):(e.licenseValid=null,e.licenseMessage=n,e.setupStep="license")}finally{e.licenseBusy=!1}}}async function Vb(e){if(e.client&&e.licenseKey.trim()){e.licenseBusy=!0,e.licenseMessage=null,e.licenseValid=null;try{const t=await e.client.request("license.activate",{key:e.licenseKey.trim()});t.valid?(e.licenseValid=!0,e.licenseMessage=t.message??"License activated",e.licenseTier=t.tier??null,setTimeout(()=>{e.setupStep="auth"},1500)):(e.licenseValid=!1,e.licenseMessage=t.message??"Invalid license key")}catch(t){e.licenseValid=!1,e.licenseMessage=t instanceof Error?t.message:"Activation failed"}finally{e.licenseBusy=!1}}}async function Qb(e){if(e.client){e.licenseBusy=!0;try{await e.client.request("license.remove",{}),e.licenseValid=null,e.licenseKey="",e.licenseTier=null,e.licenseMessage=null,e.setupStep="license"}catch(t){e.licenseMessage=t instanceof Error?t.message:"Failed to remove license"}finally{e.licenseBusy=!1}}}function Yb(e,t){e.licenseKey=t}async function Xb(e){var t,n;if(!(!e.client||!e.connected)&&!e.gatewayHealthLoading){e.gatewayHealthLoading=!0,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("health",{probe:!0});e.gatewayHealthy=i.ok===!0,e.gatewayHealthMessage=i.ok?`Healthy${i.durationMs?` (${i.durationMs}ms)`:""}`:"Unhealthy"}catch(i){e.gatewayHealthy=!1,e.gatewayHealthMessage=`Error: ${String(i)}`}finally{e.gatewayHealthLoading=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function Zb(e){var t,n,i;if(!(!e.client||e.gatewayRestartBusy)){e.gatewayRestartBusy=!0,e.gatewayHealthMessage="Restarting...",(t=e.requestUpdate)==null||t.call(e);try{const s=await e.client.request("gateway.restart",{reason:"Manual restart from setup page",delayMs:1e3});if(s.ok&&((n=s.restart)!=null&&n.ok))e.gatewayHealthMessage="Restarting...",setTimeout(()=>{window.location.reload()},3e3);else throw new Error("Restart not scheduled")}catch(s){e.gatewayHealthMessage=`Restart failed: ${String(s)}`,e.gatewayRestartBusy=!1,(i=e.requestUpdate)==null||i.call(e)}}}var Jb=Object.defineProperty,ew=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?ew(t,n):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(s=(i?o(t,n,s):o(s))||s);return i&&s&&Jb(t,n,s),s};const Ss=rd();function tw(){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"}function nw(){const e=window.location.pathname;if(e==="/setup"||e.endsWith("/setup"))return!0;if(!window.location.search)return!1;const n=new URLSearchParams(window.location.search).get("setup");if(!n)return!1;const i=n.trim().toLowerCase();return i==="1"||i==="true"||i==="yes"||i==="on"}function iw(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function sw(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function rw(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function ow(){const e=window.location.pathname;return e==="/customers"||e.endsWith("/customers")}function aw(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function lw(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends At{constructor(){super(...arguments),this.settings=qi(),this.password="",this.tab="chat",this.onboarding=tw(),this.setup=nw(),this.filesPage=iw(),this.browserPage=sw(),this.adminsPage=rw(),this.customersPage=ow(),this.chatPage=aw(),this.advancedPage=lw(),this.advancedTab="cron",this.publicChat=!!window.__TASKMASTER_PUBLIC_CHAT__,this.publicChatConfig=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__??{},this.publicChatSessionKey=null,this.publicChatAuthenticated=!1,this.publicChatAuthStep="idle",this.connected=!1,this.accessState=cu,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=Ss.name,this.assistantAvatar=Ss.avatar,this.assistantAgentId=Ss.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatModelProvider=null,this.chatModel=null,this.chatModelCatalog=[],this.chatVerboseLevel=null,this.chatFillerEnabled=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.configLoading=!1,this.configRaw=`{
|
|
3209
|
+
`}const Ab={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},$b={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:""};function xb(e){e.basePath=ph();const t=Ie();if(Mh(t.accentColor),window.scrollTo(0,0),rh(e),e.publicChat){const n=Ie();document.title=`Chat with ${n.name}`,$e(e);return}if(e.setup){document.title=`${t.name} Setup`,$e(e);return}if(e.filesPage){document.title=`${t.name} Files`,ah(e),$e(e);return}if(e.browserPage){document.title=`${t.name} Browser`,$e(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,$e(e);return}if(e.customersPage){document.title=`${t.name} Customers`,$e(e);return}if(e.chatPage){document.title=`${t.name} Chat`,$e(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,$e(e);return}mh(e,!0),hh(e),fh(e),window.addEventListener("popstate",e.popStateHandler),ch(e),$e(e),ih(e),e.tab==="logs"&&(e.logsSubTab==="session"?yr(e):gr(e)),e.tab==="debug"&&br(e)}function Eb(e){jd(e)}function Tb(e){var t;window.removeEventListener("popstate",e.popStateHandler),sh(e),mr(e),vr(e),wr(e),oh(e),lh(e),gh(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Cb(e,t){if(!e.publicChat){if(e.filesPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleFilesLoad&&e.handleFilesLoad(),e.adminsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdminsLoad&&e.handleAdminsLoad(),e.customersPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleCustomersLoad&&e.handleCustomersLoad(),e.chatPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleChatLoad&&e.handleChatLoad(),e.advancedPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdvancedLoad&&e.handleAdvancedLoad(),e.setup&&e.connected){const n=t.has("connected")&&t.get("connected")===!1;n&&e.handleLicenseStatusCheck&&e.licenseValid===null&&!e.licenseBusy&&e.handleLicenseStatusCheck(),n&&e.handleUpdateCheck&&e.handleUpdateCheck();const i=t.has("setupStep")&&e.setupStep==="auth";(n||i)&&e.setupStep==="auth"&&e.handleAuthStatusCheck&&e.authConnected===null&&!e.authBusy&&e.handleAuthStatusCheck(),e.setupStep==="whatsapp"&&t.has("setupStep")&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(r=>{e.channelsSnapshot=r,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1})),t.has("whatsappLoginConnected")&&e.whatsappLoginConnected===!0&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(s=>{e.channelsSnapshot=s,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1}))}if(e.tab==="chat"&&!e.advancedPage&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),i=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;hn(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&wl(e,t.has("tab")||t.has("logsAutoFollow"))}}function _b(e){const t={name:(e==null?void 0:e.name)??"",displayName:(e==null?void 0:e.displayName)??"",about:(e==null?void 0:e.about)??"",picture:(e==null?void 0:e.picture)??"",banner:(e==null?void 0:e.banner)??"",website:(e==null?void 0:e.website)??"",nip05:(e==null?void 0:e.nip05)??"",lud16:(e==null?void 0:e.lud16)??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e!=null&&e.banner||e!=null&&e.website||e!=null&&e.nip05||e!=null&&e.lud16)}}async function Mb(e,t,n){await sr(e,t,n),await q(e,!0)}async function Pb(e,t){await Al(e,t),await q(e,!0)}async function Lb(e,t){await $l(e,t),await q(e,!0)}async function Ib(e,t){await xl(e,t)}async function Rb(e,t){await El(e,t)}async function Nb(e){await Vd(e),await Te(e),await q(e,!0)}async function Db(e){await Te(e),await q(e,!0)}function Ob(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[i,...s]=n.split(":");if(!i||s.length===0)continue;const r=i.trim(),o=s.join(":").trim();r&&o&&(t[r]=o)}return t}function wu(e){var n,i,s;return((s=(((i=(n=e.channelsSnapshot)==null?void 0:n.channelAccounts)==null?void 0:i.nostr)??[])[0])==null?void 0:s.accountId)??e.nostrProfileAccountId??"default"}function ku(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Bb(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=_b(n??void 0)}function Fb(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Ub(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function Wb(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Kb(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=wu(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(ku(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const r=(s==null?void 0:s.error)??`Profile update failed (${i.status})`;e.nostrProfileFormState={...t,saving:!1,error:r,success:null,fieldErrors:Ob(s==null?void 0:s.details)};return}if(!s.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 q(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function zb(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=wu(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(ku(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const l=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const r=s.merged??s.imported??null,o=r?{...t.values,...r}:t.values,a=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:a},s.saved&&await q(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function jb(e){if(e.client){e.authBusy=!0,e.authMessage=null;try{const t=await e.client.request("auth.status",{});e.authConnected=t.connected,e.authExpiresIn=t.expiresIn??null,e.authMessage=t.message??null,t.connected&&(e.setupStep="whatsapp")}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to check auth status"}finally{e.authBusy=!1}}}async function Hb(e){if(e.client){e.authBusy=!0,e.authMessage=null,e.authUrl=null,e.authConnected=null;try{const t=await e.client.request("auth.oauth.start",{provider:"anthropic"});e.authUrl=t.authUrl,e.authMessage=t.message??"Sign in with your Claude Pro account"}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to start auth flow"}finally{e.authBusy=!1}}}async function qb(e,t){if(e.client){e.authBusy=!0,e.authMessage="Verifying code...";try{await e.client.request("auth.oauth.code",{code:t});const n=await e.client.request("auth.oauth.wait",{timeoutMs:3e4});n.connected?(e.authConnected=!0,e.authMessage=n.message??"Connected to Claude!",e.authUrl=null,e.authCodeInput=""):e.authMessage=n.message??"Still waiting for authorization..."}catch(n){e.authConnected=!1,e.authMessage=n instanceof Error?n.message:"Verification failed"}finally{e.authBusy=!1}}}function Vb(e,t){e.authCodeInput=t}function Gb(e){e.setupStep="whatsapp"}async function Qb(e){if(e.client){e.licenseBusy=!0,e.licenseMessage=null;try{const t=await e.client.request("license.status",{});e.licenseDeviceId=t.deviceId??null,e.licenseStoredKey=t.key??null,t.licensed?(e.licenseValid=!0,e.licenseTier=t.tier??null,e.setupStep="auth"):(e.licenseValid=null,e.setupStep="license")}catch(t){const n=t instanceof Error?t.message:String(t);n.includes("unknown method")?(e.licenseValid=!0,e.setupStep="auth"):(e.licenseValid=null,e.licenseMessage=n,e.setupStep="license")}finally{e.licenseBusy=!1}}}async function Yb(e){if(e.client&&e.licenseKey.trim()){e.licenseBusy=!0,e.licenseMessage=null,e.licenseValid=null;try{const t=await e.client.request("license.activate",{key:e.licenseKey.trim()});t.valid?(e.licenseValid=!0,e.licenseMessage=t.message??"License activated",e.licenseTier=t.tier??null,setTimeout(()=>{e.setupStep="auth"},1500)):(e.licenseValid=!1,e.licenseMessage=t.message??"Invalid license key")}catch(t){e.licenseValid=!1,e.licenseMessage=t instanceof Error?t.message:"Activation failed"}finally{e.licenseBusy=!1}}}async function Xb(e){if(e.client){e.licenseBusy=!0;try{await e.client.request("license.remove",{}),e.licenseValid=null,e.licenseKey="",e.licenseTier=null,e.licenseMessage=null,e.setupStep="license"}catch(t){e.licenseMessage=t instanceof Error?t.message:"Failed to remove license"}finally{e.licenseBusy=!1}}}function Zb(e,t){e.licenseKey=t}async function Jb(e){var t,n;if(!(!e.client||!e.connected)&&!e.gatewayHealthLoading){e.gatewayHealthLoading=!0,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("health",{probe:!0});e.gatewayHealthy=i.ok===!0,e.gatewayHealthMessage=i.ok?`Healthy${i.durationMs?` (${i.durationMs}ms)`:""}`:"Unhealthy"}catch(i){e.gatewayHealthy=!1,e.gatewayHealthMessage=`Error: ${String(i)}`}finally{e.gatewayHealthLoading=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function ew(e){var t,n,i;if(!(!e.client||e.gatewayRestartBusy)){e.gatewayRestartBusy=!0,e.gatewayHealthMessage="Restarting...",(t=e.requestUpdate)==null||t.call(e);try{const s=await e.client.request("gateway.restart",{reason:"Manual restart from setup page",delayMs:1e3});if(s.ok&&((n=s.restart)!=null&&n.ok))e.gatewayHealthMessage="Restarting...",setTimeout(()=>{window.location.reload()},3e3);else throw new Error("Restart not scheduled")}catch(s){e.gatewayHealthMessage=`Restart failed: ${String(s)}`,e.gatewayRestartBusy=!1,(i=e.requestUpdate)==null||i.call(e)}}}var tw=Object.defineProperty,nw=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?nw(t,n):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(s=(i?o(t,n,s):o(s))||s);return i&&s&&tw(t,n,s),s};const Ss=od();function iw(){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"}function sw(){const e=window.location.pathname;if(e==="/setup"||e.endsWith("/setup"))return!0;if(!window.location.search)return!1;const n=new URLSearchParams(window.location.search).get("setup");if(!n)return!1;const i=n.trim().toLowerCase();return i==="1"||i==="true"||i==="yes"||i==="on"}function rw(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function ow(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function aw(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function lw(){const e=window.location.pathname;return e==="/customers"||e.endsWith("/customers")}function cw(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function uw(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends At{constructor(){super(...arguments),this.settings=qi(),this.password="",this.tab="chat",this.onboarding=iw(),this.setup=sw(),this.filesPage=rw(),this.browserPage=ow(),this.adminsPage=aw(),this.customersPage=lw(),this.chatPage=cw(),this.advancedPage=uw(),this.advancedTab="cron",this.publicChat=!!window.__TASKMASTER_PUBLIC_CHAT__,this.publicChatConfig=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__??{},this.publicChatSessionKey=null,this.publicChatAuthenticated=!1,this.publicChatAuthStep="idle",this.connected=!1,this.accessState=uu,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=Ss.name,this.assistantAvatar=Ss.avatar,this.assistantAgentId=Ss.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatModelProvider=null,this.chatModel=null,this.chatModelCatalog=[],this.chatVerboseLevel=null,this.chatFillerEnabled=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=`{
|
|
3164
3210
|
}
|
|
3165
|
-
`,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.whatsappActiveQrAccountId=null,this.whatsappPairedPhone=null,this.addingWhatsAppAccount=!1,this.newWhatsAppAccountName="",this.whatsappAccountError=null,this.whatsappAccountSaving=!1,this.whatsappSettingsOpen=!1,this.licenseKey="",this.licenseBusy=!1,this.licenseValid=null,this.licenseMessage=null,this.licenseTier=null,this.licenseDeviceId=null,this.licenseStoredKey=null,this.licenseRemoveConfirm=!1,this.authConnected=null,this.authBusy=!1,this.authMessage=null,this.authUrl=null,this.authCodeInput="",this.authExpiresIn=null,this.setupStep="license",this.gatewayHealthy=null,this.gatewayHealthLoading=!1,this.gatewayHealthMessage=null,this.gatewayRestartBusy=!1,this.updateAvailable=null,this.currentVersion=null,this.latestVersion=null,this.updateChecking=!1,this.updateMessage=null,this.updateProgressSteps=[],this.updateLastResult=null,this.uninstallConfirm=!1,this.uninstallBusy=!1,this.uninstallDone=!1,this.uninstallError=null,this.uninstallConfirmText="",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.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Sb},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserFullscreen=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.customersLoading=!1,this.customersSaving=!1,this.customersRecords=[],this.customersError=null,this.customersSearchQuery="",this.customersEditingId=null,this.customersShowAddForm=!1,this.customersNewPhone="",this.customersNewName="",this.imessageEnableConfirm=!1,this.imessageEnabling=!1,this.infoModalOpen=null,this.workspaces=[],this.workspacesLoading=!1,this.workspacesError=null,this.selectedWorkspace=null,this.addingWorkspace=!1,this.newWorkspaceName="",this.newWorkspacePath="",this.newWorkspacePin="",this.accountPinModalOpen=!1,this.accountPinBusy=!1,this.accountPinError=null,this.accountPinSuccess=null,this.apiKeyProviders=[],this.apiKeyModalOpen=!1,this.apiKeyBusy=!1,this.apiKeyError=null,this.apiKeySuccess=null,this.apiKeySavingProvider=null,this.authApiKeyMode=!1,this.authApiKeyInput="",this.authApiKeyBusy=!1,this.authApiKeyError=null,this.pinChanging=null,this.pinChangeBusy=!1,this.pinChangeError=null,this.loginChangePinMode=!1,this.changePinBusy=!1,this.changePinError=null,this.changePinSuccess=null,this.workspaceSaving=!1,this.workspaceRemoveConfirm=null,this.renamingWorkspace=!1,this.renameWorkspaceName="",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={...kb},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.logsSubTab="session",this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>mh(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ab(this)}firstUpdated(){xb(this)}disconnectedCallback(){$b(this),super.disconnectedCallback()}updated(e){Eb(this,e)}connect(){xe(this)}handleChatScroll(e){Od(this,e)}handleLogsScroll(e){Bd(this,e)}handleSessionLogsScroll(e){Fd(this,e)}exportLogs(e,t){Wd(e,t)}exportSessionLogs(e,t){Kd(e,t)}resetToolStream(){ir(this)}resetChatScroll(){Ud(this)}async loadAssistantIdentity(){await Qs(this)}applySettings(e){We(this,e)}setTab(e){ch(this,e)}setTheme(e,t){uh(this,e,t)}async loadOverview(){await rc(this)}async loadCron(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.cronForm={...this.cronForm,accountId:(e==null?void 0:e.whatsappAccountId)??void 0},await kr(this)}async handleAbortChat(){await ac(this)}removeQueuedMessage(e){wh(this,e)}async handleSendChat(e,t){await kh(this,e,t)}async handleWhatsAppStart(e,t){await Cb(this,e,t)}async handleWhatsAppWait(e){await _b(this,e)}async handleWhatsAppLogout(e){await Mb(this,e)}async handleAddWhatsAppAccount(e){await Pb(this,e)}async handleRemoveWhatsAppAccount(e){await Lb(this,e)}async handleAccessCheck(){await Qa(this)}async handlePinSubmit(e,t){await tb(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await nb(this,e)}async handleLogout(){await sb(this)}toggleChangePinMode(){this.loginChangePinMode=!this.loginChangePinMode,this.changePinError=null,this.changePinSuccess=null}async handleChangePin(e,t,n){if(this.client){this.changePinBusy=!0,this.changePinError=null,this.changePinSuccess=null;try{const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.changePinError=i.message??"Incorrect current PIN",this.changePinBusy=!1;return}e==="__master__"?await this.client.request("access.setMasterPin",{pin:n}):await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.changePinSuccess="PIN changed successfully",this.changePinBusy=!1,setTimeout(()=>{this.loginChangePinMode=!1,this.changePinSuccess=null},2e3)}catch{this.changePinError="Failed to change PIN",this.changePinBusy=!1}}}async handleAccountPinSave(e,t,n){if(this.client){this.accountPinBusy=!0,this.accountPinError=null,this.accountPinSuccess=null;try{if(t!==null){const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.accountPinError=i.message??"Incorrect current PIN",this.accountPinBusy=!1;return}}await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.accountPinSuccess="PIN saved",this.accountPinBusy=!1,await Qa(this),setTimeout(()=>{this.accountPinModalOpen=!1,this.accountPinSuccess=null,this.accountPinError=null},1500)}catch{this.accountPinError="Failed to save PIN",this.accountPinBusy=!1}}}async handleLicenseStatusCheck(){await Gb(this)}async handleLicenseActivate(){await Vb(this)}async handleLicenseRemove(){await Qb(this)}handleLicenseKeyChange(e){Yb(this,e)}async handleAuthStatusCheck(){await Kb(this)}async handleAuthStart(){await zb(this)}async handleAuthSubmitCode(e){await jb(this,e)}handleAuthCodeChange(e){Hb(this,e)}handleSkipToWhatsApp(){qb(this)}async handleGatewayHealthCheck(){await Xb(this)}async handleGatewayRestart(){await Zb(this)}async handleUpdateCheck(){await ou(this)}async handleUpdateRun(){await Uv(this)}handleUpdateDismissResult(){zv(this)}handleUninstallConfirm(){this.uninstallConfirm=!0,this.uninstallConfirmText=""}handleUninstallCancel(){this.uninstallConfirm=!1,this.uninstallConfirmText="",this.uninstallError=null}handleUninstallConfirmTextChange(e){this.uninstallConfirmText=e}async handleUninstallRun(){const{runUninstall:e}=await ne(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>No);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){ne(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>No);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await Zl(this)}async clearAudit(){await Hp(this),this.auditModalOpen=!1}handleFilesLoad(){var n;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((n=e==null?void 0:e.agents)==null?void 0:n.map(i=>i.id))??void 0;const t=this.resolveFilesAgentId();mn(this,t),fr(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();ne(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>ob);return{loadAdmins:t}},void 0,import.meta.url).then(({loadAdmins:t})=>{t(this,e)})}resolveAdminAgentId(){const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(n=>n.id.endsWith("-admin")||n.id==="admin");return t==null?void 0:t.id}resolveFilesAgentId(){var t;const e=this.getSelectedWorkspaceInfo();if(e)return(t=e.agents[0])==null?void 0:t.id}handleChatLoad(){const e=this.resolveAdminAgentId();if(e){const t=`agent:${e}:main`;t!==this.sessionKey&&(this.sessionKey=t,this.chatMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatRunId=null,this.chatSuggestion=null,this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}ne(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>$s);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this)})}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.loadCron(),this.advancedTab==="logs"&&(this.logsSubTab==="session"?ne(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>Xl);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):ne(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>sp);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&ne(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>Bp);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Ib(this)}async handleChannelConfigReload(){await Rb(this)}handleNostrProfileEdit(e,t){Db(this,e,t)}handleNostrProfileCancel(){Ob(this)}handleNostrProfileFieldChange(e,t){Bb(this,e,t)}async handleNostrProfileSave(){await Ub(this)}async handleNostrProfileImport(){await Wb(this)}handleNostrProfileToggleAdvanced(){Fb(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})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleCustomersLoad(){const e=this.selectedWorkspace??void 0;ne(async()=>{const{loadCustomers:t}=await Promise.resolve().then(()=>ab);return{loadCustomers:t}},void 0,import.meta.url).then(({loadCustomers:t})=>{t(this,e)})}handleCustomersNewPhoneChange(e){this.customersNewPhone=e,this.customersError&&(this.customersError=null)}handleCustomersNewNameChange(e){this.customersNewName=e,this.customersError&&(this.customersError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await ne(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>jn);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await ne(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>jn);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await ne(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>Jd);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const r=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,r),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(r),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await ne(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>jn);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=(e==null?void 0:e.displayName)??(e==null?void 0:e.name)??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await ne(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>jn);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),So(e),this.settings=qi(),this.chatMessage="",this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.reloadCurrentPageData()}getSelectedWorkspaceInfo(){return this.selectedWorkspace?this.workspaces.find(e=>e.name===this.selectedWorkspace)??null:null}reloadCurrentPageData(){this.loadAuditEntries(),this.adminsPage?this.handleAdminsLoad():this.customersPage?this.handleCustomersLoad():this.filesPage?this.handleFilesLoad():this.chatPage?this.handleChatLoad():this.advancedPage&&this.handleAdvancedLoad()}initWorkspaceSelection(){if(this.workspaces.length===0){this.reloadCurrentPageData();return}const e=localStorage.getItem("taskmaster-selected-workspace"),t=e?this.workspaces.find(n=>n.name===e):null;if(t)this.selectedWorkspace=t.name;else{const n=this.workspaces.find(i=>i.isDefault)??this.workspaces[0];this.selectedWorkspace=n.name,localStorage.setItem("taskmaster-selected-workspace",n.name)}So(this.selectedWorkspace),this.settings=qi(),this.reloadCurrentPageData()}render(){return p`${vb(this)}${this.auditModalOpen?wb(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):k}`}};m([y()],g.prototype,"settings",2);m([y()],g.prototype,"password",2);m([y()],g.prototype,"tab",2);m([y()],g.prototype,"onboarding",2);m([y()],g.prototype,"setup",2);m([y()],g.prototype,"filesPage",2);m([y()],g.prototype,"browserPage",2);m([y()],g.prototype,"adminsPage",2);m([y()],g.prototype,"customersPage",2);m([y()],g.prototype,"chatPage",2);m([y()],g.prototype,"advancedPage",2);m([y()],g.prototype,"advancedTab",2);m([y()],g.prototype,"publicChat",2);m([y()],g.prototype,"publicChatConfig",2);m([y()],g.prototype,"publicChatSessionKey",2);m([y()],g.prototype,"publicChatAuthenticated",2);m([y()],g.prototype,"publicChatAuthStep",2);m([y()],g.prototype,"connected",2);m([y()],g.prototype,"accessState",2);m([y()],g.prototype,"theme",2);m([y()],g.prototype,"themeResolved",2);m([y()],g.prototype,"hello",2);m([y()],g.prototype,"lastError",2);m([y()],g.prototype,"eventLog",2);m([y()],g.prototype,"assistantName",2);m([y()],g.prototype,"assistantAvatar",2);m([y()],g.prototype,"assistantAgentId",2);m([y()],g.prototype,"sessionKey",2);m([y()],g.prototype,"chatLoading",2);m([y()],g.prototype,"chatSending",2);m([y()],g.prototype,"chatMessage",2);m([y()],g.prototype,"chatMessages",2);m([y()],g.prototype,"chatToolMessages",2);m([y()],g.prototype,"chatStream",2);m([y()],g.prototype,"chatInterimText",2);m([y()],g.prototype,"chatSuggestion",2);m([y()],g.prototype,"chatStreamStartedAt",2);m([y()],g.prototype,"chatRunId",2);m([y()],g.prototype,"compactionStatus",2);m([y()],g.prototype,"chatAvatarUrl",2);m([y()],g.prototype,"chatThinkingLevel",2);m([y()],g.prototype,"chatModelProvider",2);m([y()],g.prototype,"chatModel",2);m([y()],g.prototype,"chatModelCatalog",2);m([y()],g.prototype,"chatVerboseLevel",2);m([y()],g.prototype,"chatFillerEnabled",2);m([y()],g.prototype,"chatQueue",2);m([y()],g.prototype,"chatAttachments",2);m([y()],g.prototype,"sidebarOpen",2);m([y()],g.prototype,"sidebarContent",2);m([y()],g.prototype,"sidebarError",2);m([y()],g.prototype,"splitRatio",2);m([y()],g.prototype,"nodesLoading",2);m([y()],g.prototype,"nodes",2);m([y()],g.prototype,"devicesLoading",2);m([y()],g.prototype,"devicesError",2);m([y()],g.prototype,"devicesList",2);m([y()],g.prototype,"execApprovalsLoading",2);m([y()],g.prototype,"execApprovalsSaving",2);m([y()],g.prototype,"execApprovalsDirty",2);m([y()],g.prototype,"execApprovalsSnapshot",2);m([y()],g.prototype,"execApprovalsForm",2);m([y()],g.prototype,"execApprovalsSelectedAgent",2);m([y()],g.prototype,"execApprovalsTarget",2);m([y()],g.prototype,"execApprovalsTargetNodeId",2);m([y()],g.prototype,"execApprovalQueue",2);m([y()],g.prototype,"execApprovalBusy",2);m([y()],g.prototype,"execApprovalError",2);m([y()],g.prototype,"configLoading",2);m([y()],g.prototype,"configRaw",2);m([y()],g.prototype,"configRawOriginal",2);m([y()],g.prototype,"configValid",2);m([y()],g.prototype,"configIssues",2);m([y()],g.prototype,"configSaving",2);m([y()],g.prototype,"configApplying",2);m([y()],g.prototype,"updateRunning",2);m([y()],g.prototype,"applySessionKey",2);m([y()],g.prototype,"configSnapshot",2);m([y()],g.prototype,"configSchema",2);m([y()],g.prototype,"configSchemaVersion",2);m([y()],g.prototype,"configSchemaLoading",2);m([y()],g.prototype,"configUiHints",2);m([y()],g.prototype,"configForm",2);m([y()],g.prototype,"configFormOriginal",2);m([y()],g.prototype,"configFormDirty",2);m([y()],g.prototype,"configFormMode",2);m([y()],g.prototype,"configSearchQuery",2);m([y()],g.prototype,"configActiveSection",2);m([y()],g.prototype,"configActiveSubsection",2);m([y()],g.prototype,"channelsLoading",2);m([y()],g.prototype,"channelsSnapshot",2);m([y()],g.prototype,"channelsError",2);m([y()],g.prototype,"channelsLastSuccess",2);m([y()],g.prototype,"whatsappLoginMessage",2);m([y()],g.prototype,"whatsappLoginQrDataUrl",2);m([y()],g.prototype,"whatsappLoginConnected",2);m([y()],g.prototype,"whatsappBusy",2);m([y()],g.prototype,"whatsappActiveQrAccountId",2);m([y()],g.prototype,"whatsappPairedPhone",2);m([y()],g.prototype,"addingWhatsAppAccount",2);m([y()],g.prototype,"newWhatsAppAccountName",2);m([y()],g.prototype,"whatsappAccountError",2);m([y()],g.prototype,"whatsappAccountSaving",2);m([y()],g.prototype,"whatsappSettingsOpen",2);m([y()],g.prototype,"licenseKey",2);m([y()],g.prototype,"licenseBusy",2);m([y()],g.prototype,"licenseValid",2);m([y()],g.prototype,"licenseMessage",2);m([y()],g.prototype,"licenseTier",2);m([y()],g.prototype,"licenseDeviceId",2);m([y()],g.prototype,"licenseStoredKey",2);m([y()],g.prototype,"licenseRemoveConfirm",2);m([y()],g.prototype,"authConnected",2);m([y()],g.prototype,"authBusy",2);m([y()],g.prototype,"authMessage",2);m([y()],g.prototype,"authUrl",2);m([y()],g.prototype,"authCodeInput",2);m([y()],g.prototype,"authExpiresIn",2);m([y()],g.prototype,"setupStep",2);m([y()],g.prototype,"gatewayHealthy",2);m([y()],g.prototype,"gatewayHealthLoading",2);m([y()],g.prototype,"gatewayHealthMessage",2);m([y()],g.prototype,"gatewayRestartBusy",2);m([y()],g.prototype,"updateAvailable",2);m([y()],g.prototype,"currentVersion",2);m([y()],g.prototype,"latestVersion",2);m([y()],g.prototype,"updateChecking",2);m([y()],g.prototype,"updateMessage",2);m([y()],g.prototype,"updateProgressSteps",2);m([y()],g.prototype,"updateLastResult",2);m([y()],g.prototype,"uninstallConfirm",2);m([y()],g.prototype,"uninstallBusy",2);m([y()],g.prototype,"uninstallDone",2);m([y()],g.prototype,"uninstallError",2);m([y()],g.prototype,"uninstallConfirmText",2);m([y()],g.prototype,"nostrProfileFormState",2);m([y()],g.prototype,"nostrProfileAccountId",2);m([y()],g.prototype,"presenceLoading",2);m([y()],g.prototype,"presenceEntries",2);m([y()],g.prototype,"presenceError",2);m([y()],g.prototype,"presenceStatus",2);m([y()],g.prototype,"agentsLoading",2);m([y()],g.prototype,"agentsList",2);m([y()],g.prototype,"agentsError",2);m([y()],g.prototype,"sessionsLoading",2);m([y()],g.prototype,"sessionsResult",2);m([y()],g.prototype,"sessionsError",2);m([y()],g.prototype,"cronLoading",2);m([y()],g.prototype,"cronJobs",2);m([y()],g.prototype,"cronStatus",2);m([y()],g.prototype,"cronError",2);m([y()],g.prototype,"cronForm",2);m([y()],g.prototype,"cronRunsJobId",2);m([y()],g.prototype,"cronRuns",2);m([y()],g.prototype,"cronBusy",2);m([y()],g.prototype,"cronNewEventModal",2);m([y()],g.prototype,"cronDetailJobId",2);m([y()],g.prototype,"browserScreencastActive",2);m([y()],g.prototype,"browserScreencastFrame",2);m([y()],g.prototype,"browserScreencastMetadata",2);m([y()],g.prototype,"browserHandoffPending",2);m([y()],g.prototype,"browserHandoffReason",2);m([y()],g.prototype,"browserHandoffId",2);m([y()],g.prototype,"browserInputMode",2);m([y()],g.prototype,"browserFullscreen",2);m([y()],g.prototype,"browserLoading",2);m([y()],g.prototype,"browserError",2);m([y()],g.prototype,"filesLoading",2);m([y()],g.prototype,"filesTree",2);m([y()],g.prototype,"filesRoot",2);m([y()],g.prototype,"filesError",2);m([y()],g.prototype,"filesSelectedPath",2);m([y()],g.prototype,"filesSelectedPaths",2);m([y()],g.prototype,"filesPreviewContent",2);m([y()],g.prototype,"filesPreviewLoading",2);m([y()],g.prototype,"filesPreviewBinary",2);m([y()],g.prototype,"filesPreviewSize",2);m([y()],g.prototype,"filesExpandedDirs",2);m([y()],g.prototype,"filesMessage",2);m([y()],g.prototype,"filesUploadBusy",2);m([y()],g.prototype,"filesReindexBusy",2);m([y()],g.prototype,"filesMemoryStatus",2);m([y()],g.prototype,"filesSearchQuery",2);m([y()],g.prototype,"filesSearchResults",2);m([y()],g.prototype,"filesSearchLoading",2);m([y()],g.prototype,"filesSearchAgentId",2);m([y()],g.prototype,"auditEntries",2);m([y()],g.prototype,"auditLoading",2);m([y()],g.prototype,"auditModalOpen",2);m([y()],g.prototype,"skillsLoading",2);m([y()],g.prototype,"skillsReport",2);m([y()],g.prototype,"skillsError",2);m([y()],g.prototype,"skillsFilter",2);m([y()],g.prototype,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",2);m([y()],g.prototype,"adminsLoading",2);m([y()],g.prototype,"adminPhones",2);m([y()],g.prototype,"adminsError",2);m([y()],g.prototype,"adminsSaving",2);m([y()],g.prototype,"adminsNewPhone",2);m([y()],g.prototype,"customersLoading",2);m([y()],g.prototype,"customersSaving",2);m([y()],g.prototype,"customersRecords",2);m([y()],g.prototype,"customersError",2);m([y()],g.prototype,"customersSearchQuery",2);m([y()],g.prototype,"customersEditingId",2);m([y()],g.prototype,"customersShowAddForm",2);m([y()],g.prototype,"customersNewPhone",2);m([y()],g.prototype,"customersNewName",2);m([y()],g.prototype,"imessageEnableConfirm",2);m([y()],g.prototype,"imessageEnabling",2);m([y()],g.prototype,"infoModalOpen",2);m([y()],g.prototype,"workspaces",2);m([y()],g.prototype,"workspacesLoading",2);m([y()],g.prototype,"workspacesError",2);m([y()],g.prototype,"selectedWorkspace",2);m([y()],g.prototype,"addingWorkspace",2);m([y()],g.prototype,"newWorkspaceName",2);m([y()],g.prototype,"newWorkspacePath",2);m([y()],g.prototype,"newWorkspacePin",2);m([y()],g.prototype,"accountPinModalOpen",2);m([y()],g.prototype,"accountPinBusy",2);m([y()],g.prototype,"accountPinError",2);m([y()],g.prototype,"accountPinSuccess",2);m([y()],g.prototype,"apiKeyProviders",2);m([y()],g.prototype,"apiKeyModalOpen",2);m([y()],g.prototype,"apiKeyBusy",2);m([y()],g.prototype,"apiKeyError",2);m([y()],g.prototype,"apiKeySuccess",2);m([y()],g.prototype,"apiKeySavingProvider",2);m([y()],g.prototype,"authApiKeyMode",2);m([y()],g.prototype,"authApiKeyInput",2);m([y()],g.prototype,"authApiKeyBusy",2);m([y()],g.prototype,"authApiKeyError",2);m([y()],g.prototype,"pinChanging",2);m([y()],g.prototype,"pinChangeBusy",2);m([y()],g.prototype,"pinChangeError",2);m([y()],g.prototype,"loginChangePinMode",2);m([y()],g.prototype,"changePinBusy",2);m([y()],g.prototype,"changePinError",2);m([y()],g.prototype,"changePinSuccess",2);m([y()],g.prototype,"workspaceSaving",2);m([y()],g.prototype,"workspaceRemoveConfirm",2);m([y()],g.prototype,"renamingWorkspace",2);m([y()],g.prototype,"renameWorkspaceName",2);m([y()],g.prototype,"debugLoading",2);m([y()],g.prototype,"debugStatus",2);m([y()],g.prototype,"debugHealth",2);m([y()],g.prototype,"debugModels",2);m([y()],g.prototype,"debugHeartbeat",2);m([y()],g.prototype,"debugCallMethod",2);m([y()],g.prototype,"debugCallParams",2);m([y()],g.prototype,"debugCallResult",2);m([y()],g.prototype,"debugCallError",2);m([y()],g.prototype,"logsLoading",2);m([y()],g.prototype,"logsError",2);m([y()],g.prototype,"logsFile",2);m([y()],g.prototype,"logsEntries",2);m([y()],g.prototype,"logsFilterText",2);m([y()],g.prototype,"logsLevelFilters",2);m([y()],g.prototype,"logsAutoFollow",2);m([y()],g.prototype,"logsTruncated",2);m([y()],g.prototype,"logsCursor",2);m([y()],g.prototype,"logsLastFetchAt",2);m([y()],g.prototype,"logsLimit",2);m([y()],g.prototype,"logsMaxBytes",2);m([y()],g.prototype,"logsAtBottom",2);m([y()],g.prototype,"logsSubTab",2);m([y()],g.prototype,"sessionLogsLoading",2);m([y()],g.prototype,"sessionLogsError",2);m([y()],g.prototype,"sessionLogsEntries",2);m([y()],g.prototype,"sessionLogsFilterText",2);m([y()],g.prototype,"sessionLogsTypeFilters",2);m([y()],g.prototype,"sessionLogsAgentFilters",2);m([y()],g.prototype,"sessionLogsAgents",2);m([y()],g.prototype,"sessionLogsAutoFollow",2);m([y()],g.prototype,"sessionLogsCursors",2);m([y()],g.prototype,"sessionLogsLastFetchAt",2);m([y()],g.prototype,"sessionLogsAtBottom",2);m([y()],g.prototype,"chatUserNearBottom",2);g=m([ol("taskmaster-app")],g);
|
|
3166
|
-
//# sourceMappingURL=index-
|
|
3211
|
+
`,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.whatsappActiveQrAccountId=null,this.whatsappPairedPhone=null,this.addingWhatsAppAccount=!1,this.newWhatsAppAccountName="",this.whatsappAccountError=null,this.whatsappAccountSaving=!1,this.whatsappSettingsOpen=!1,this.publicChatToggleBusy=!1,this.licenseKey="",this.licenseBusy=!1,this.licenseValid=null,this.licenseMessage=null,this.licenseTier=null,this.licenseDeviceId=null,this.licenseStoredKey=null,this.licenseRemoveConfirm=!1,this.authConnected=null,this.authBusy=!1,this.authMessage=null,this.authUrl=null,this.authCodeInput="",this.authExpiresIn=null,this.setupStep="license",this.gatewayHealthy=null,this.gatewayHealthLoading=!1,this.gatewayHealthMessage=null,this.gatewayRestartBusy=!1,this.updateAvailable=null,this.currentVersion=null,this.latestVersion=null,this.updateChecking=!1,this.updateMessage=null,this.updateProgressSteps=[],this.updateLastResult=null,this.uninstallConfirm=!1,this.uninstallBusy=!1,this.uninstallDone=!1,this.uninstallError=null,this.uninstallConfirmText="",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.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...$b},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserFullscreen=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.embeddingDownloading=!1,this.embeddingPollTimer=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.customersLoading=!1,this.customersSaving=!1,this.customersRecords=[],this.customersError=null,this.customersSearchQuery="",this.customersEditingId=null,this.customersShowAddForm=!1,this.customersNewPhone="",this.customersNewName="",this.imessageEnableConfirm=!1,this.imessageEnabling=!1,this.infoModalOpen=null,this.workspaces=[],this.workspacesLoading=!1,this.workspacesError=null,this.selectedWorkspace=null,this.addingWorkspace=!1,this.newWorkspaceName="",this.newWorkspacePath="",this.newWorkspacePin="",this.accountPinModalOpen=!1,this.accountPinBusy=!1,this.accountPinError=null,this.accountPinSuccess=null,this.apiKeyProviders=[],this.apiKeyModalOpen=!1,this.apiKeyBusy=!1,this.apiKeyError=null,this.apiKeySuccess=null,this.apiKeySavingProvider=null,this.authApiKeyMode=!1,this.authApiKeyInput="",this.authApiKeyBusy=!1,this.authApiKeyError=null,this.pinChanging=null,this.pinChangeBusy=!1,this.pinChangeError=null,this.loginChangePinMode=!1,this.changePinBusy=!1,this.changePinError=null,this.changePinSuccess=null,this.workspaceSaving=!1,this.workspaceRemoveConfirm=null,this.renamingWorkspace=!1,this.renameWorkspaceName="",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={...Ab},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.logsSubTab="session",this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>yh(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),xb(this)}firstUpdated(){Eb(this)}disconnectedCallback(){this.stopEmbeddingPoll(),Tb(this),super.disconnectedCallback()}startEmbeddingPoll(){if(this.embeddingPollTimer!=null)return;const e=async()=>{if(!(!this.client||!this.connected)){try{const t=await this.client.request("memory.status",{});if((t==null?void 0:t.embeddingState)==="downloading")this.embeddingDownloading=!0;else{this.embeddingDownloading&&(this.embeddingDownloading=!1),this.stopEmbeddingPoll();return}}catch{this.embeddingDownloading=!1,this.stopEmbeddingPoll();return}this.embeddingPollTimer=window.setTimeout(e,3e3)}};e()}stopEmbeddingPoll(){this.embeddingPollTimer!=null&&(window.clearTimeout(this.embeddingPollTimer),this.embeddingPollTimer=null)}updated(e){Cb(this,e)}connect(){$e(this)}handleChatScroll(e){Bd(this,e)}handleLogsScroll(e){Fd(this,e)}handleSessionLogsScroll(e){Ud(this,e)}exportLogs(e,t){Kd(e,t)}exportSessionLogs(e,t){zd(e,t)}resetToolStream(){ir(this)}resetChatScroll(){Wd(this)}async loadAssistantIdentity(){await Qs(this)}applySettings(e){We(this,e)}setTab(e){uh(this,e)}setTheme(e,t){dh(this,e,t)}async loadOverview(){await oc(this)}async loadCron(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.cronForm={...this.cronForm,accountId:(e==null?void 0:e.whatsappAccountId)??void 0},await kr(this)}async handleAbortChat(){await lc(this)}removeQueuedMessage(e){kh(this,e)}async handleSendChat(e,t){await Sh(this,e,t)}async handleWhatsAppStart(e,t){await Mb(this,e,t)}async handleWhatsAppWait(e){await Pb(this,e)}async handleWhatsAppLogout(e){await Lb(this,e)}async handleAddWhatsAppAccount(e){await Ib(this,e)}async handleRemoveWhatsAppAccount(e){await Rb(this,e)}async handleAccessCheck(){await Ya(this)}async handlePinSubmit(e,t){await ib(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await sb(this,e)}async handleLogout(){await ob(this)}toggleChangePinMode(){this.loginChangePinMode=!this.loginChangePinMode,this.changePinError=null,this.changePinSuccess=null}async handleChangePin(e,t,n){if(this.client){this.changePinBusy=!0,this.changePinError=null,this.changePinSuccess=null;try{const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.changePinError=i.message??"Incorrect current PIN",this.changePinBusy=!1;return}e==="__master__"?await this.client.request("access.setMasterPin",{pin:n}):await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.changePinSuccess="PIN changed successfully",this.changePinBusy=!1,setTimeout(()=>{this.loginChangePinMode=!1,this.changePinSuccess=null},2e3)}catch{this.changePinError="Failed to change PIN",this.changePinBusy=!1}}}async handleAccountPinSave(e,t,n){if(this.client){this.accountPinBusy=!0,this.accountPinError=null,this.accountPinSuccess=null;try{if(t!==null){const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.accountPinError=i.message??"Incorrect current PIN",this.accountPinBusy=!1;return}}await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.accountPinSuccess="PIN saved",this.accountPinBusy=!1,await Ya(this),setTimeout(()=>{this.accountPinModalOpen=!1,this.accountPinSuccess=null,this.accountPinError=null},1500)}catch{this.accountPinError="Failed to save PIN",this.accountPinBusy=!1}}}async handleLicenseStatusCheck(){await Qb(this)}async handleLicenseActivate(){await Yb(this)}async handleLicenseRemove(){await Xb(this)}handleLicenseKeyChange(e){Zb(this,e)}async handleAuthStatusCheck(){await jb(this)}async handleAuthStart(){await Hb(this)}async handleAuthSubmitCode(e){await qb(this,e)}handleAuthCodeChange(e){Vb(this,e)}handleSkipToWhatsApp(){Gb(this)}async handleGatewayHealthCheck(){await Jb(this)}async handleGatewayRestart(){await ew(this)}async handleUpdateCheck(){await au(this)}async handleUpdateRun(){await Kv(this)}handleUpdateDismissResult(){Hv(this)}handleUninstallConfirm(){this.uninstallConfirm=!0,this.uninstallConfirmText=""}handleUninstallCancel(){this.uninstallConfirm=!1,this.uninstallConfirmText="",this.uninstallError=null}handleUninstallConfirmTextChange(e){this.uninstallConfirmText=e}async handleUninstallRun(){const{runUninstall:e}=await ne(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>No);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){ne(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>No);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await Jl(this)}async clearAudit(){await qp(this),this.auditModalOpen=!1}handleFilesLoad(){var n;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((n=e==null?void 0:e.agents)==null?void 0:n.map(i=>i.id))??void 0;const t=this.resolveFilesAgentId();mn(this,t),fr(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();ne(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>lb);return{loadAdmins:t}},void 0,import.meta.url).then(({loadAdmins:t})=>{t(this,e)})}resolveAdminAgentId(){const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(n=>n.id.endsWith("-admin")||n.id==="admin");return t==null?void 0:t.id}resolveFilesAgentId(){var t;const e=this.getSelectedWorkspaceInfo();if(e)return(t=e.agents[0])==null?void 0:t.id}handleChatLoad(){const e=this.resolveAdminAgentId();if(e){const t=`agent:${e}:main`;t!==this.sessionKey&&(this.sessionKey=t,this.chatMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatRunId=null,this.chatSuggestion=null,this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}ne(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>xs);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this)})}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.loadCron(),this.advancedTab==="logs"&&(this.logsSubTab==="session"?ne(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>Zl);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):ne(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>rp);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&ne(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>Fp);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Nb(this)}async handleChannelConfigReload(){await Db(this)}handleNostrProfileEdit(e,t){Bb(this,e,t)}handleNostrProfileCancel(){Fb(this)}handleNostrProfileFieldChange(e,t){Ub(this,e,t)}async handleNostrProfileSave(){await Kb(this)}async handleNostrProfileImport(){await zb(this)}handleNostrProfileToggleAdvanced(){Wb(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})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleCustomersLoad(){const e=this.selectedWorkspace??void 0;ne(async()=>{const{loadCustomers:t}=await Promise.resolve().then(()=>cb);return{loadCustomers:t}},void 0,import.meta.url).then(({loadCustomers:t})=>{t(this,e)})}handleCustomersNewPhoneChange(e){this.customersNewPhone=e,this.customersError&&(this.customersError=null)}handleCustomersNewNameChange(e){this.customersNewName=e,this.customersError&&(this.customersError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await ne(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>jn);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await ne(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>jn);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await ne(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>ep);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const r=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,r),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(r),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await ne(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>jn);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=(e==null?void 0:e.displayName)??(e==null?void 0:e.name)??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await ne(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>jn);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),So(e),this.settings=qi(),this.chatMessage="",this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.reloadCurrentPageData()}getSelectedWorkspaceInfo(){return this.selectedWorkspace?this.workspaces.find(e=>e.name===this.selectedWorkspace)??null:null}reloadCurrentPageData(){this.loadAuditEntries(),this.adminsPage?this.handleAdminsLoad():this.customersPage?this.handleCustomersLoad():this.filesPage?this.handleFilesLoad():this.chatPage?this.handleChatLoad():this.advancedPage&&this.handleAdvancedLoad()}initWorkspaceSelection(){if(this.workspaces.length===0){this.reloadCurrentPageData();return}const e=localStorage.getItem("taskmaster-selected-workspace"),t=e?this.workspaces.find(n=>n.name===e):null;if(t)this.selectedWorkspace=t.name;else{const n=this.workspaces.find(i=>i.isDefault)??this.workspaces[0];this.selectedWorkspace=n.name,localStorage.setItem("taskmaster-selected-workspace",n.name)}So(this.selectedWorkspace),this.settings=qi(),this.reloadCurrentPageData()}render(){return h`${wb(this)}${this.auditModalOpen?Sb(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):k}`}};m([y()],g.prototype,"settings",2);m([y()],g.prototype,"password",2);m([y()],g.prototype,"tab",2);m([y()],g.prototype,"onboarding",2);m([y()],g.prototype,"setup",2);m([y()],g.prototype,"filesPage",2);m([y()],g.prototype,"browserPage",2);m([y()],g.prototype,"adminsPage",2);m([y()],g.prototype,"customersPage",2);m([y()],g.prototype,"chatPage",2);m([y()],g.prototype,"advancedPage",2);m([y()],g.prototype,"advancedTab",2);m([y()],g.prototype,"publicChat",2);m([y()],g.prototype,"publicChatConfig",2);m([y()],g.prototype,"publicChatSessionKey",2);m([y()],g.prototype,"publicChatAuthenticated",2);m([y()],g.prototype,"publicChatAuthStep",2);m([y()],g.prototype,"connected",2);m([y()],g.prototype,"accessState",2);m([y()],g.prototype,"theme",2);m([y()],g.prototype,"themeResolved",2);m([y()],g.prototype,"hello",2);m([y()],g.prototype,"lastError",2);m([y()],g.prototype,"eventLog",2);m([y()],g.prototype,"assistantName",2);m([y()],g.prototype,"assistantAvatar",2);m([y()],g.prototype,"assistantAgentId",2);m([y()],g.prototype,"sessionKey",2);m([y()],g.prototype,"chatLoading",2);m([y()],g.prototype,"chatSending",2);m([y()],g.prototype,"chatMessage",2);m([y()],g.prototype,"chatMessages",2);m([y()],g.prototype,"chatToolMessages",2);m([y()],g.prototype,"chatStream",2);m([y()],g.prototype,"chatInterimText",2);m([y()],g.prototype,"chatSuggestion",2);m([y()],g.prototype,"chatStreamStartedAt",2);m([y()],g.prototype,"chatRunId",2);m([y()],g.prototype,"compactionStatus",2);m([y()],g.prototype,"chatAvatarUrl",2);m([y()],g.prototype,"chatThinkingLevel",2);m([y()],g.prototype,"chatModelProvider",2);m([y()],g.prototype,"chatModel",2);m([y()],g.prototype,"chatModelCatalog",2);m([y()],g.prototype,"chatVerboseLevel",2);m([y()],g.prototype,"chatFillerEnabled",2);m([y()],g.prototype,"chatQueue",2);m([y()],g.prototype,"chatAttachments",2);m([y()],g.prototype,"sidebarOpen",2);m([y()],g.prototype,"sidebarContent",2);m([y()],g.prototype,"sidebarError",2);m([y()],g.prototype,"splitRatio",2);m([y()],g.prototype,"nodesLoading",2);m([y()],g.prototype,"nodes",2);m([y()],g.prototype,"devicesLoading",2);m([y()],g.prototype,"devicesError",2);m([y()],g.prototype,"devicesList",2);m([y()],g.prototype,"execApprovalsLoading",2);m([y()],g.prototype,"execApprovalsSaving",2);m([y()],g.prototype,"execApprovalsDirty",2);m([y()],g.prototype,"execApprovalsSnapshot",2);m([y()],g.prototype,"execApprovalsForm",2);m([y()],g.prototype,"execApprovalsSelectedAgent",2);m([y()],g.prototype,"execApprovalsTarget",2);m([y()],g.prototype,"execApprovalsTargetNodeId",2);m([y()],g.prototype,"execApprovalQueue",2);m([y()],g.prototype,"execApprovalBusy",2);m([y()],g.prototype,"execApprovalError",2);m([y()],g.prototype,"configLoading",2);m([y()],g.prototype,"configRaw",2);m([y()],g.prototype,"configRawOriginal",2);m([y()],g.prototype,"configValid",2);m([y()],g.prototype,"configIssues",2);m([y()],g.prototype,"configSaving",2);m([y()],g.prototype,"configApplying",2);m([y()],g.prototype,"updateRunning",2);m([y()],g.prototype,"applySessionKey",2);m([y()],g.prototype,"configSnapshot",2);m([y()],g.prototype,"configSchema",2);m([y()],g.prototype,"configSchemaVersion",2);m([y()],g.prototype,"configSchemaLoading",2);m([y()],g.prototype,"configUiHints",2);m([y()],g.prototype,"configForm",2);m([y()],g.prototype,"configFormOriginal",2);m([y()],g.prototype,"configFormDirty",2);m([y()],g.prototype,"configFormMode",2);m([y()],g.prototype,"configSearchQuery",2);m([y()],g.prototype,"configActiveSection",2);m([y()],g.prototype,"configActiveSubsection",2);m([y()],g.prototype,"channelsLoading",2);m([y()],g.prototype,"channelsSnapshot",2);m([y()],g.prototype,"channelsError",2);m([y()],g.prototype,"channelsLastSuccess",2);m([y()],g.prototype,"whatsappLoginMessage",2);m([y()],g.prototype,"whatsappLoginQrDataUrl",2);m([y()],g.prototype,"whatsappLoginConnected",2);m([y()],g.prototype,"whatsappBusy",2);m([y()],g.prototype,"whatsappActiveQrAccountId",2);m([y()],g.prototype,"whatsappPairedPhone",2);m([y()],g.prototype,"addingWhatsAppAccount",2);m([y()],g.prototype,"newWhatsAppAccountName",2);m([y()],g.prototype,"whatsappAccountError",2);m([y()],g.prototype,"whatsappAccountSaving",2);m([y()],g.prototype,"whatsappSettingsOpen",2);m([y()],g.prototype,"publicChatToggleBusy",2);m([y()],g.prototype,"licenseKey",2);m([y()],g.prototype,"licenseBusy",2);m([y()],g.prototype,"licenseValid",2);m([y()],g.prototype,"licenseMessage",2);m([y()],g.prototype,"licenseTier",2);m([y()],g.prototype,"licenseDeviceId",2);m([y()],g.prototype,"licenseStoredKey",2);m([y()],g.prototype,"licenseRemoveConfirm",2);m([y()],g.prototype,"authConnected",2);m([y()],g.prototype,"authBusy",2);m([y()],g.prototype,"authMessage",2);m([y()],g.prototype,"authUrl",2);m([y()],g.prototype,"authCodeInput",2);m([y()],g.prototype,"authExpiresIn",2);m([y()],g.prototype,"setupStep",2);m([y()],g.prototype,"gatewayHealthy",2);m([y()],g.prototype,"gatewayHealthLoading",2);m([y()],g.prototype,"gatewayHealthMessage",2);m([y()],g.prototype,"gatewayRestartBusy",2);m([y()],g.prototype,"updateAvailable",2);m([y()],g.prototype,"currentVersion",2);m([y()],g.prototype,"latestVersion",2);m([y()],g.prototype,"updateChecking",2);m([y()],g.prototype,"updateMessage",2);m([y()],g.prototype,"updateProgressSteps",2);m([y()],g.prototype,"updateLastResult",2);m([y()],g.prototype,"uninstallConfirm",2);m([y()],g.prototype,"uninstallBusy",2);m([y()],g.prototype,"uninstallDone",2);m([y()],g.prototype,"uninstallError",2);m([y()],g.prototype,"uninstallConfirmText",2);m([y()],g.prototype,"nostrProfileFormState",2);m([y()],g.prototype,"nostrProfileAccountId",2);m([y()],g.prototype,"presenceLoading",2);m([y()],g.prototype,"presenceEntries",2);m([y()],g.prototype,"presenceError",2);m([y()],g.prototype,"presenceStatus",2);m([y()],g.prototype,"agentsLoading",2);m([y()],g.prototype,"agentsList",2);m([y()],g.prototype,"agentsError",2);m([y()],g.prototype,"sessionsLoading",2);m([y()],g.prototype,"sessionsResult",2);m([y()],g.prototype,"sessionsError",2);m([y()],g.prototype,"cronLoading",2);m([y()],g.prototype,"cronJobs",2);m([y()],g.prototype,"cronStatus",2);m([y()],g.prototype,"cronError",2);m([y()],g.prototype,"cronForm",2);m([y()],g.prototype,"cronRunsJobId",2);m([y()],g.prototype,"cronRuns",2);m([y()],g.prototype,"cronBusy",2);m([y()],g.prototype,"cronNewEventModal",2);m([y()],g.prototype,"cronDetailJobId",2);m([y()],g.prototype,"browserScreencastActive",2);m([y()],g.prototype,"browserScreencastFrame",2);m([y()],g.prototype,"browserScreencastMetadata",2);m([y()],g.prototype,"browserHandoffPending",2);m([y()],g.prototype,"browserHandoffReason",2);m([y()],g.prototype,"browserHandoffId",2);m([y()],g.prototype,"browserInputMode",2);m([y()],g.prototype,"browserFullscreen",2);m([y()],g.prototype,"browserLoading",2);m([y()],g.prototype,"browserError",2);m([y()],g.prototype,"filesLoading",2);m([y()],g.prototype,"filesTree",2);m([y()],g.prototype,"filesRoot",2);m([y()],g.prototype,"filesError",2);m([y()],g.prototype,"filesSelectedPath",2);m([y()],g.prototype,"filesSelectedPaths",2);m([y()],g.prototype,"filesPreviewContent",2);m([y()],g.prototype,"filesPreviewLoading",2);m([y()],g.prototype,"filesPreviewBinary",2);m([y()],g.prototype,"filesPreviewSize",2);m([y()],g.prototype,"filesExpandedDirs",2);m([y()],g.prototype,"filesMessage",2);m([y()],g.prototype,"filesUploadBusy",2);m([y()],g.prototype,"filesReindexBusy",2);m([y()],g.prototype,"filesMemoryStatus",2);m([y()],g.prototype,"embeddingDownloading",2);m([y()],g.prototype,"filesSearchQuery",2);m([y()],g.prototype,"filesSearchResults",2);m([y()],g.prototype,"filesSearchLoading",2);m([y()],g.prototype,"filesSearchAgentId",2);m([y()],g.prototype,"auditEntries",2);m([y()],g.prototype,"auditLoading",2);m([y()],g.prototype,"auditModalOpen",2);m([y()],g.prototype,"skillsLoading",2);m([y()],g.prototype,"skillsReport",2);m([y()],g.prototype,"skillsError",2);m([y()],g.prototype,"skillsFilter",2);m([y()],g.prototype,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",2);m([y()],g.prototype,"adminsLoading",2);m([y()],g.prototype,"adminPhones",2);m([y()],g.prototype,"adminsError",2);m([y()],g.prototype,"adminsSaving",2);m([y()],g.prototype,"adminsNewPhone",2);m([y()],g.prototype,"customersLoading",2);m([y()],g.prototype,"customersSaving",2);m([y()],g.prototype,"customersRecords",2);m([y()],g.prototype,"customersError",2);m([y()],g.prototype,"customersSearchQuery",2);m([y()],g.prototype,"customersEditingId",2);m([y()],g.prototype,"customersShowAddForm",2);m([y()],g.prototype,"customersNewPhone",2);m([y()],g.prototype,"customersNewName",2);m([y()],g.prototype,"imessageEnableConfirm",2);m([y()],g.prototype,"imessageEnabling",2);m([y()],g.prototype,"infoModalOpen",2);m([y()],g.prototype,"workspaces",2);m([y()],g.prototype,"workspacesLoading",2);m([y()],g.prototype,"workspacesError",2);m([y()],g.prototype,"selectedWorkspace",2);m([y()],g.prototype,"addingWorkspace",2);m([y()],g.prototype,"newWorkspaceName",2);m([y()],g.prototype,"newWorkspacePath",2);m([y()],g.prototype,"newWorkspacePin",2);m([y()],g.prototype,"accountPinModalOpen",2);m([y()],g.prototype,"accountPinBusy",2);m([y()],g.prototype,"accountPinError",2);m([y()],g.prototype,"accountPinSuccess",2);m([y()],g.prototype,"apiKeyProviders",2);m([y()],g.prototype,"apiKeyModalOpen",2);m([y()],g.prototype,"apiKeyBusy",2);m([y()],g.prototype,"apiKeyError",2);m([y()],g.prototype,"apiKeySuccess",2);m([y()],g.prototype,"apiKeySavingProvider",2);m([y()],g.prototype,"authApiKeyMode",2);m([y()],g.prototype,"authApiKeyInput",2);m([y()],g.prototype,"authApiKeyBusy",2);m([y()],g.prototype,"authApiKeyError",2);m([y()],g.prototype,"pinChanging",2);m([y()],g.prototype,"pinChangeBusy",2);m([y()],g.prototype,"pinChangeError",2);m([y()],g.prototype,"loginChangePinMode",2);m([y()],g.prototype,"changePinBusy",2);m([y()],g.prototype,"changePinError",2);m([y()],g.prototype,"changePinSuccess",2);m([y()],g.prototype,"workspaceSaving",2);m([y()],g.prototype,"workspaceRemoveConfirm",2);m([y()],g.prototype,"renamingWorkspace",2);m([y()],g.prototype,"renameWorkspaceName",2);m([y()],g.prototype,"debugLoading",2);m([y()],g.prototype,"debugStatus",2);m([y()],g.prototype,"debugHealth",2);m([y()],g.prototype,"debugModels",2);m([y()],g.prototype,"debugHeartbeat",2);m([y()],g.prototype,"debugCallMethod",2);m([y()],g.prototype,"debugCallParams",2);m([y()],g.prototype,"debugCallResult",2);m([y()],g.prototype,"debugCallError",2);m([y()],g.prototype,"logsLoading",2);m([y()],g.prototype,"logsError",2);m([y()],g.prototype,"logsFile",2);m([y()],g.prototype,"logsEntries",2);m([y()],g.prototype,"logsFilterText",2);m([y()],g.prototype,"logsLevelFilters",2);m([y()],g.prototype,"logsAutoFollow",2);m([y()],g.prototype,"logsTruncated",2);m([y()],g.prototype,"logsCursor",2);m([y()],g.prototype,"logsLastFetchAt",2);m([y()],g.prototype,"logsLimit",2);m([y()],g.prototype,"logsMaxBytes",2);m([y()],g.prototype,"logsAtBottom",2);m([y()],g.prototype,"logsSubTab",2);m([y()],g.prototype,"sessionLogsLoading",2);m([y()],g.prototype,"sessionLogsError",2);m([y()],g.prototype,"sessionLogsEntries",2);m([y()],g.prototype,"sessionLogsFilterText",2);m([y()],g.prototype,"sessionLogsTypeFilters",2);m([y()],g.prototype,"sessionLogsAgentFilters",2);m([y()],g.prototype,"sessionLogsAgents",2);m([y()],g.prototype,"sessionLogsAutoFollow",2);m([y()],g.prototype,"sessionLogsCursors",2);m([y()],g.prototype,"sessionLogsLastFetchAt",2);m([y()],g.prototype,"sessionLogsAtBottom",2);m([y()],g.prototype,"chatUserNearBottom",2);g=m([al("taskmaster-app")],g);
|
|
3212
|
+
//# sourceMappingURL=index-8pJBjxcK.js.map
|