@rubytech/taskmaster 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-info.json +3 -3
- package/dist/control-ui/assets/{index-F91adp4g.js → index-BFPQ4MXV.js} +399 -399
- package/dist/control-ui/assets/index-BFPQ4MXV.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/gateway/config-reload.js +1 -0
- package/package.json +1 -1
- package/dist/control-ui/assets/index-F91adp4g.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var zu=Object.defineProperty;var qu=(e,t,n)=>t in e?zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>qu(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 o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Hu="modulepreload",ju=function(e,t){return new URL(e,t).href},qa={},oe=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let c=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const a=document.getElementsByTagName("link"),r=document.querySelector("meta[property=csp-nonce]"),d=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));s=c(n.map(l=>{if(l=ju(l,i),l in qa)return;qa[l]=!0;const p=l.endsWith(".css"),f=p?'[rel="stylesheet"]':"";if(i)for(let h=a.length-1;h>=0;h--){const b=a[h];if(b.href===l&&(!p||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${f}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":Hu,p||(v.as="script"),v.crossOrigin="",v.href=l,d&&v.setAttribute("nonce",d),document.head.appendChild(v),p)return new Promise((h,b)=>{v.addEventListener("load",h),v.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(a){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=a,window.dispatchEvent(r),!r.defaultPrevented)throw a}return s.then(a=>{for(const r of a||[])r.status==="rejected"&&o(r.reason);return t().catch(o)})};const gi=globalThis,Po=gi.ShadowRoot&&(gi.ShadyCSS===void 0||gi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lo=Symbol(),Ha=new WeakMap;let Ul=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==Lo)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(Po&&t===void 0){const i=n!==void 0&&n.length===1;i&&(t=Ha.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ha.set(n,t))}return t}toString(){return this.cssText}};const Vu=e=>new Ul(typeof e=="string"?e:e+"",void 0,Lo),Gu=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((i,s,o)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[o+1],e[0]);return new Ul(n,e,Lo)},Qu=(e,t)=>{if(Po)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const i=document.createElement("style"),s=gi.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,e.appendChild(i)}},ja=Po?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const i of t.cssRules)n+=i.cssText;return Vu(n)})(e):e;const{is:Yu,defineProperty:Ju,getOwnPropertyDescriptor:Xu,getOwnPropertyNames:Zu,getOwnPropertySymbols:ep,getPrototypeOf:tp}=Object,tt=globalThis,Va=tt.trustedTypes,np=Va?Va.emptyScript:"",ms=tt.reactiveElementPolyfillSupport,bn=(e,t)=>e,ki={toAttribute(e,t){switch(t){case Boolean:e=e?np: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}},Io=(e,t)=>!Yu(e,t),Ga={attribute:!0,type:String,converter:ki,reflect:!1,useDefault:!1,hasChanged:Io};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),tt.litPropertyMetadata??(tt.litPropertyMetadata=new WeakMap);let Ot=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=Ga){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&&Ju(this.prototype,t,s)}}static getPropertyDescriptor(t,n,i){const{get:s,set:o}=Xu(this.prototype,t)??{get(){return this[n]},set(a){this[n]=a}};return{get:s,set(a){const r=s==null?void 0:s.call(this);o==null||o.call(this,a),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ga}static _$Ei(){if(this.hasOwnProperty(bn("elementProperties")))return;const t=tp(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(bn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(bn("properties"))){const n=this.properties,i=[...Zu(n),...ep(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(ja(s))}else t!==void 0&&n.push(ja(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 Qu(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 o;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const a=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:ki).toAttribute(n,i.type);this._$Em=t,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(t,n){var o,a;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const r=i.getPropertyOptions(s),d=typeof r.converter=="function"?{fromAttribute:r.converter}:((o=r.converter)==null?void 0:o.fromAttribute)!==void 0?r.converter:ki;this._$Em=s;const c=d.fromAttribute(n,r.type);this[s]=c??((a=this._$Ej)==null?void 0:a.get(s))??c,this._$Em=null}}requestUpdate(t,n,i,s=!1,o){var a;if(t!==void 0){const r=this.constructor;if(s===!1&&(o=this[t]),i??(i=r.getPropertyOptions(t)),!((i.hasChanged??Io)(o,n)||i.useDefault&&i.reflect&&o===((a=this._$Ej)==null?void 0:a.get(t))&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:i,reflect:s,wrapped:o},a){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,a??n??this[t]),o!==!0||a!==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[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,a]of s){const{wrapped:r}=a,d=this[o];r!==!0||this._$AL.has(o)||d===void 0||this.C(o,void 0,a,d)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(s=>{var o;return(o=s.hostUpdate)==null?void 0:o.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){}};Ot.elementStyles=[],Ot.shadowRootOptions={mode:"open"},Ot[bn("elementProperties")]=new Map,Ot[bn("finalized")]=new Map,ms==null||ms({ReactiveElement:Ot}),(tt.reactiveElementVersions??(tt.reactiveElementVersions=[])).push("2.1.2");const wn=globalThis,Qa=e=>e,$i=wn.trustedTypes,Ya=$i?$i.createPolicy("lit-html",{createHTML:e=>e}):void 0,Kl="$lit$",et=`lit$${Math.random().toFixed(9).slice(2)}$`,Wl="?"+et,ip=`<${Wl}>`,kt=document,Pn=()=>kt.createComment(""),Ln=e=>e===null||typeof e!="object"&&typeof e!="function",Ro=Array.isArray,sp=e=>Ro(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",ys=`[
|
|
2
|
-
\f\r]`,an=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ja=/-->/g,Xa=/>/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Za=/'/g,er=/"/g,zl=/^(?:script|style|textarea|title)$/i,op=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),u=op(1),it=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),tr=new WeakMap,gt=kt.createTreeWalker(kt,129);function ql(e,t){if(!Ro(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ya!==void 0?Ya.createHTML(t):t}const ap=(e,t)=>{const n=e.length-1,i=[];let s,o=t===2?"<svg>":t===3?"<math>":"",a=an;for(let r=0;r<n;r++){const d=e[r];let c,l,p=-1,f=0;for(;f<d.length&&(a.lastIndex=f,l=a.exec(d),l!==null);)f=a.lastIndex,a===an?l[1]==="!--"?a=Ja:l[1]!==void 0?a=Xa:l[2]!==void 0?(zl.test(l[2])&&(s=RegExp("</"+l[2],"g")),a=dt):l[3]!==void 0&&(a=dt):a===dt?l[0]===">"?(a=s??an,p=-1):l[1]===void 0?p=-2:(p=a.lastIndex-l[2].length,c=l[1],a=l[3]===void 0?dt:l[3]==='"'?er:Za):a===er||a===Za?a=dt:a===Ja||a===Xa?a=an:(a=dt,s=void 0);const v=a===dt&&e[r+1].startsWith("/>")?" ":"";o+=a===an?d+ip:p>=0?(i.push(c),d.slice(0,p)+Kl+d.slice(p)+et+v):d+et+(p===-2?r:v)}return[ql(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let no=class Hl{constructor({strings:t,_$litType$:n},i){let s;this.parts=[];let o=0,a=0;const r=t.length-1,d=this.parts,[c,l]=ap(t,n);if(this.el=Hl.createElement(c,i),gt.currentNode=this.el.content,n===2||n===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=gt.nextNode())!==null&&d.length<r;){if(s.nodeType===1){if(s.hasAttributes())for(const p of s.getAttributeNames())if(p.endsWith(Kl)){const f=l[a++],v=s.getAttribute(p).split(et),h=/([.?@])?(.*)/.exec(f);d.push({type:1,index:o,name:h[2],strings:v,ctor:h[1]==="."?lp:h[1]==="?"?cp:h[1]==="@"?dp:ji}),s.removeAttribute(p)}else p.startsWith(et)&&(d.push({type:6,index:o}),s.removeAttribute(p));if(zl.test(s.tagName)){const p=s.textContent.split(et),f=p.length-1;if(f>0){s.textContent=$i?$i.emptyScript:"";for(let v=0;v<f;v++)s.append(p[v],Pn()),gt.nextNode(),d.push({type:2,index:++o});s.append(p[f],Pn())}}}else if(s.nodeType===8)if(s.data===Wl)d.push({type:2,index:o});else{let p=-1;for(;(p=s.data.indexOf(et,p+1))!==-1;)d.push({type:7,index:o}),p+=et.length-1}o++}}static createElement(t,n){const i=kt.createElement("template");return i.innerHTML=t,i}};function Ht(e,t,n=e,i){var a,r;if(t===it)return t;let s=i!==void 0?(a=n._$Co)==null?void 0:a[i]:n._$Cl;const o=Ln(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==o&&((r=s==null?void 0:s._$AO)==null||r.call(s,!1),o===void 0?s=void 0:(s=new o(e),s._$AT(e,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=s:n._$Cl=s),s!==void 0&&(t=Ht(e,s._$AS(e,t.values),s,i)),t}class rp{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)??kt).importNode(n,!0);gt.currentNode=s;let o=gt.nextNode(),a=0,r=0,d=i[0];for(;d!==void 0;){if(a===d.index){let c;d.type===2?c=new Hi(o,o.nextSibling,this,t):d.type===1?c=new d.ctor(o,d.name,d.strings,this,t):d.type===6&&(c=new up(o,this,t)),this._$AV.push(c),d=i[++r]}a!==(d==null?void 0:d.index)&&(o=gt.nextNode(),a++)}return gt.currentNode=kt,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 Hi=class jl{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=w,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=Ht(this,t,n),Ln(t)?t===w||t==null||t===""?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):sp(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!==w&&Ln(this._$AH)?this._$AA.nextSibling.data=t:this.T(kt.createTextNode(t)),this._$AH=t}$(t){var o;const{values:n,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=no.createElement(ql(i.h,i.h[0]),this.options)),i);if(((o=this._$AH)==null?void 0:o._$AD)===s)this._$AH.p(n);else{const a=new rp(s,this),r=a.u(this.options);a.p(n),this.T(r),this._$AH=a}}_$AC(t){let n=tr.get(t.strings);return n===void 0&&tr.set(t.strings,n=new no(t)),n}k(t){Ro(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,s=0;for(const o of t)s===n.length?n.push(i=new jl(this.O(Pn()),this.O(Pn()),this,this.options)):i=n[s],i._$AI(o),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=Qa(t).nextSibling;Qa(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}};class ji{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,s,o){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=w}_$AI(t,n=this,i,s){const o=this.strings;let a=!1;if(o===void 0)t=Ht(this,t,n,0),a=!Ln(t)||t!==this._$AH&&t!==it,a&&(this._$AH=t);else{const r=t;let d,c;for(t=o[0],d=0;d<o.length-1;d++)c=Ht(this,r[i+d],n,d),c===it&&(c=this._$AH[d]),a||(a=!Ln(c)||c!==this._$AH[d]),c===w?t=w:t!==w&&(t+=(c??"")+o[d+1]),this._$AH[d]=c}a&&!s&&this.j(t)}j(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let lp=class extends ji{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===w?void 0:t}},cp=class extends ji{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==w)}},dp=class extends ji{constructor(t,n,i,s,o){super(t,n,i,s,o),this.type=5}_$AI(t,n=this){if((t=Ht(this,t,n,0)??w)===it)return;const i=this._$AH,s=t===w&&i!==w||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==w&&(i===w||s);s&&this.element.removeEventListener(this.name,this,i),o&&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)}},up=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){Ht(this,t)}};const pp={I:Hi},vs=wn.litHtmlPolyfillSupport;vs==null||vs(no,Hi),(wn.litHtmlVersions??(wn.litHtmlVersions=[])).push("3.3.2");const hp=(e,t,n)=>{const i=(n==null?void 0:n.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const o=(n==null?void 0:n.renderBefore)??null;i._$litPart$=s=new Hi(t.insertBefore(Pn(),o),o,void 0,n??{})}return s._$AI(e),s};const vt=globalThis;let Wt=class extends Ot{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=hp(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 it}};var Ol;Wt._$litElement$=!0,Wt.finalized=!0,(Ol=vt.litElementHydrateSupport)==null||Ol.call(vt,{LitElement:Wt});const bs=vt.litElementPolyfillSupport;bs==null||bs({LitElement:Wt});(vt.litElementVersions??(vt.litElementVersions=[])).push("4.2.2");const Vl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const fp={attribute:!0,type:String,converter:ki,reflect:!1,hasChanged:Io},gp=(e=fp,t,n)=>{const{kind:i,metadata:s}=n;let o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(n.name,e),i==="accessor"){const{name:a}=n;return{set(r){const d=t.get.call(this);t.set.call(this,r),this.requestUpdate(a,d,e,!0,r)},init(r){return r!==void 0&&this.C(a,void 0,e,r),r}}}if(i==="setter"){const{name:a}=n;return function(r){const d=this[a];t.call(this,r),this.requestUpdate(a,d,e,!0,r)}}throw Error("Unsupported decorator location: "+i)};function Vi(e){return(t,n)=>typeof n=="object"?gp(e,t,n):((i,s,o)=>{const a=s.hasOwnProperty(o);return s.constructor.createProperty(o,i),a?Object.getOwnPropertyDescriptor(s,o):void 0})(e,t,n)}function y(e){return Vi({...e,state:!0,attribute:!1})}const mp=50,yp=200,vp="Assistant";function nr(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function io(e){const t=nr(e==null?void 0:e.name,mp)??vp,n=nr((e==null?void 0:e.avatar)??void 0,yp)??null;return{agentId:typeof(e==null?void 0:e.agentId)=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function bp(){return io(typeof window>"u"?{}:{name:window.__TASKMASTER_ASSISTANT_NAME__,avatar:window.__TASKMASTER_ASSISTANT_AVATAR__})}const wp="Taskmaster",kp="/taskmaster-icon.png",$p="#00d4ff",Sp="";let Xn=null;function je(){return Xn||(Xn={name:window.__TASKMASTER_BRAND_NAME__||wp,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||kp,accentColor:window.__TASKMASTER_ACCENT_COLOR__||$p,backgroundColor:window.__TASKMASTER_BACKGROUND_COLOR__||Sp},Xn)}function Ie(){return window.__TASKMASTER_WORKSPACE_BRANDS__??{}}function Gl(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 xp(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!t)return 0;const[n,i,s]=[t[1],t[2],t[3]].map(o=>{const a=parseInt(o,16)/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*n+.7152*i+.0722*s}function Ql(e){const t=Gl(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 i=xp(e)>.4?"#111111":"#ffffff";n.style.setProperty("--accent-foreground",i),n.style.setProperty("--primary-foreground",i)}function Zn(e,t,n){const i=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e),s=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!i||!s)return e;const o=(c,l)=>Math.round(parseInt(i[c],16)*(1-n)+parseInt(s[l],16)*n),a=o(1,1),r=o(2,2),d=o(3,3);return`#${a.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${d.toString(16).padStart(2,"0")}`}const rn={"--bg":"#12141a","--bg-muted":"#262a35","--card":"#181b22","--secondary":"#1e2028"};function Yl(e){const t=document.documentElement;if(!e){for(const[i,s]of Object.entries(rn))t.style.setProperty(i,s);t.style.removeProperty("--brand-bg"),t.style.removeProperty("--brand-bg-subtle"),t.style.removeProperty("--brand-bg-card");return}const n=Gl(e);n&&(t.style.setProperty("--bg",Zn(rn["--bg"],e,.08)),t.style.setProperty("--bg-muted",Zn(rn["--bg-muted"],e,.1)),t.style.setProperty("--card",Zn(rn["--card"],e,.12)),t.style.setProperty("--secondary",Zn(rn["--secondary"],e,.1)),t.style.setProperty("--brand-bg",e),t.style.setProperty("--brand-bg-subtle",`rgba(${n}, 0.08)`),t.style.setProperty("--brand-bg-card",`rgba(${n}, 0.12)`))}function kn(e){const t=je(),n=Ie(),i=e?n[e]:void 0,s=(i==null?void 0:i.accentColor)??t.accentColor;Ql(s);const o=(i==null?void 0:i.backgroundColor)??t.backgroundColor;Yl(o)}const Si="taskmaster.control.settings.v1",Jl="taskmaster.account.settings.";function $n(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}`}const Ft={gatewayUrl:$n(),token:"",theme:"system",navCollapsed:!1,navGroupsCollapsed:{}},Ze={sessionKey:"main",lastActiveSessionKey:"main",chatFocusMode:!1,chatShowThinking:!1,splitRatio:.6};function Ap(){try{const e=localStorage.getItem(Si);if(!e)return{...Ft,gatewayUrl:$n()};const t=JSON.parse(e);return{gatewayUrl:typeof t.gatewayUrl=="string"&&t.gatewayUrl.trim()?t.gatewayUrl.trim():$n(),token:typeof t.token=="string"?t.token:Ft.token,theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:Ft.theme,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:Ft.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:Ft.navGroupsCollapsed}}catch{return{...Ft,gatewayUrl:$n()}}}function Cp(e){if(!e)return{...Ze};try{const t=localStorage.getItem(Jl+e);if(!t)return{...Ze};const n=JSON.parse(t);return{sessionKey:typeof n.sessionKey=="string"&&n.sessionKey.trim()?n.sessionKey.trim():Ze.sessionKey,lastActiveSessionKey:typeof n.lastActiveSessionKey=="string"&&n.lastActiveSessionKey.trim()?n.lastActiveSessionKey.trim():typeof n.sessionKey=="string"&&n.sessionKey.trim()||Ze.lastActiveSessionKey,chatFocusMode:typeof n.chatFocusMode=="boolean"?n.chatFocusMode:Ze.chatFocusMode,chatShowThinking:typeof n.chatShowThinking=="boolean"?n.chatShowThinking:Ze.chatShowThinking,splitRatio:typeof n.splitRatio=="number"&&n.splitRatio>=.4&&n.splitRatio<=.7?n.splitRatio:Ze.splitRatio}}catch{return{...Ze}}}let xi=null;function ir(e){xi=e}function ws(){return{...Ap(),...Cp(xi)}}function Ep(e){const t={gatewayUrl:e.gatewayUrl,token:e.token,theme:e.theme,navCollapsed:e.navCollapsed,navGroupsCollapsed:e.navGroupsCollapsed};if(localStorage.setItem(Si,JSON.stringify(t)),xi){const n={sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,chatFocusMode:e.chatFocusMode,chatShowThinking:e.chatShowThinking,splitRatio:e.splitRatio};localStorage.setItem(Jl+xi,JSON.stringify(n))}}const Tp="taskmaster.draft.";function Do(e,t){return Tp+e+"."+t}function In(e,t,n){try{const i=Do(e,t);n?localStorage.setItem(i,n):localStorage.removeItem(i)}catch{}}function Rn(e,t){try{return localStorage.getItem(Do(e,t))??""}catch{return""}}function _p(e,t){try{localStorage.removeItem(Do(e,t))}catch{}}let mt=null,ke=null;function sr(e,t,n){ke={workspace:e,sessionKey:t,text:n},mt!=null&&clearTimeout(mt),mt=setTimeout(()=>{ke&&In(ke.workspace,ke.sessionKey,ke.text),ke=null,mt=null},300)}function so(){mt!=null&&clearTimeout(mt),mt=null,ke&&(In(ke.workspace,ke.sessionKey,ke.text),ke=null)}(function(){try{const t=localStorage.getItem(Si);if(!t)return;const n=JSON.parse(t);if(!("sessionKey"in n))return;const i={gatewayUrl:typeof n.gatewayUrl=="string"?n.gatewayUrl:$n(),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(Si,JSON.stringify(i))}catch{}})();function Xl(e){var o;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=(o=n[1])==null?void 0:o.trim(),s=n.slice(2).join(":");return!i||!s?null:{agentId:i,rest:s}}const Mp=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,ei=/<\s*\/?\s*final\b[^>]*>/gi,or=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function Pp(e,t){return e.trimStart()}function Lp(e,t){if(!e||!Mp.test(e))return e;let n=e;ei.test(n)?(ei.lastIndex=0,n=n.replace(ei,"")):ei.lastIndex=0,or.lastIndex=0;let i="",s=0,o=!1;for(const a of n.matchAll(or)){const r=a.index??0,d=a[1]==="/";o?d&&(o=!1):(i+=n.slice(s,r),d||(o=!0)),s=r+a[0].length}return i+=n.slice(s),Pp(i)}function Zl(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function Gi(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0){const a=-t,r=Math.round(a/1e3);if(r<60)return`in ${r}s`;const d=Math.round(r/60);if(d<60)return`in ${d}m`;const c=Math.round(d/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 Bo(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 Ip(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function ec(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 Ai(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ks(e){return Lp(e)}const Rp=/^\[([^\]]+)\]\s*/,Dp=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],$s=new WeakMap,Ss=new WeakMap;function Bp(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:Dp.some(t=>e.startsWith(`${t} `))}function xs(e){const t=e.match(Rp);if(!t)return e;const n=t[1]??"";return Bp(n)?e.slice(t[0].length):e}function Sn(e){const t=e,n=typeof t.role=="string"?t.role:"",i=t.content;if(typeof i=="string")return n==="assistant"?ks(i):xs(i);if(Array.isArray(i)){const s=i.map(o=>{const a=o;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(o=>typeof o=="string");if(s.length>0){const o=s.join(`
|
|
1
|
+
var zu=Object.defineProperty;var qu=(e,t,n)=>t in e?zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>qu(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 o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Hu="modulepreload",ju=function(e,t){return new URL(e,t).href},qa={},ae=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let c=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const a=document.getElementsByTagName("link"),r=document.querySelector("meta[property=csp-nonce]"),d=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));s=c(n.map(l=>{if(l=ju(l,i),l in qa)return;qa[l]=!0;const p=l.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(i)for(let S=a.length-1;S>=0;S--){const f=a[S];if(f.href===l&&(!p||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${h}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":Hu,p||(v.as="script"),v.crossOrigin="",v.href=l,d&&v.setAttribute("nonce",d),document.head.appendChild(v),p)return new Promise((S,f)=>{v.addEventListener("load",S),v.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(a){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=a,window.dispatchEvent(r),!r.defaultPrevented)throw a}return s.then(a=>{for(const r of a||[])r.status==="rejected"&&o(r.reason);return t().catch(o)})};const gi=globalThis,Po=gi.ShadowRoot&&(gi.ShadyCSS===void 0||gi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lo=Symbol(),Ha=new WeakMap;let Ul=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==Lo)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(Po&&t===void 0){const i=n!==void 0&&n.length===1;i&&(t=Ha.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ha.set(n,t))}return t}toString(){return this.cssText}};const Vu=e=>new Ul(typeof e=="string"?e:e+"",void 0,Lo),Gu=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((i,s,o)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[o+1],e[0]);return new Ul(n,e,Lo)},Qu=(e,t)=>{if(Po)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const i=document.createElement("style"),s=gi.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,e.appendChild(i)}},ja=Po?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const i of t.cssRules)n+=i.cssText;return Vu(n)})(e):e;const{is:Yu,defineProperty:Ju,getOwnPropertyDescriptor:Xu,getOwnPropertyNames:Zu,getOwnPropertySymbols:ep,getPrototypeOf:tp}=Object,tt=globalThis,Va=tt.trustedTypes,np=Va?Va.emptyScript:"",ms=tt.reactiveElementPolyfillSupport,bn=(e,t)=>e,ki={toAttribute(e,t){switch(t){case Boolean:e=e?np: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}},Io=(e,t)=>!Yu(e,t),Ga={attribute:!0,type:String,converter:ki,reflect:!1,useDefault:!1,hasChanged:Io};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),tt.litPropertyMetadata??(tt.litPropertyMetadata=new WeakMap);let Ut=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=Ga){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&&Ju(this.prototype,t,s)}}static getPropertyDescriptor(t,n,i){const{get:s,set:o}=Xu(this.prototype,t)??{get(){return this[n]},set(a){this[n]=a}};return{get:s,set(a){const r=s==null?void 0:s.call(this);o==null||o.call(this,a),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ga}static _$Ei(){if(this.hasOwnProperty(bn("elementProperties")))return;const t=tp(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(bn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(bn("properties"))){const n=this.properties,i=[...Zu(n),...ep(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(ja(s))}else t!==void 0&&n.push(ja(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 Qu(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 o;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const a=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:ki).toAttribute(n,i.type);this._$Em=t,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(t,n){var o,a;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const r=i.getPropertyOptions(s),d=typeof r.converter=="function"?{fromAttribute:r.converter}:((o=r.converter)==null?void 0:o.fromAttribute)!==void 0?r.converter:ki;this._$Em=s;const c=d.fromAttribute(n,r.type);this[s]=c??((a=this._$Ej)==null?void 0:a.get(s))??c,this._$Em=null}}requestUpdate(t,n,i,s=!1,o){var a;if(t!==void 0){const r=this.constructor;if(s===!1&&(o=this[t]),i??(i=r.getPropertyOptions(t)),!((i.hasChanged??Io)(o,n)||i.useDefault&&i.reflect&&o===((a=this._$Ej)==null?void 0:a.get(t))&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:i,reflect:s,wrapped:o},a){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,a??n??this[t]),o!==!0||a!==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[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,a]of s){const{wrapped:r}=a,d=this[o];r!==!0||this._$AL.has(o)||d===void 0||this.C(o,void 0,a,d)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(s=>{var o;return(o=s.hostUpdate)==null?void 0:o.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){}};Ut.elementStyles=[],Ut.shadowRootOptions={mode:"open"},Ut[bn("elementProperties")]=new Map,Ut[bn("finalized")]=new Map,ms==null||ms({ReactiveElement:Ut}),(tt.reactiveElementVersions??(tt.reactiveElementVersions=[])).push("2.1.2");const wn=globalThis,Qa=e=>e,$i=wn.trustedTypes,Ya=$i?$i.createPolicy("lit-html",{createHTML:e=>e}):void 0,Kl="$lit$",et=`lit$${Math.random().toFixed(9).slice(2)}$`,Wl="?"+et,ip=`<${Wl}>`,$t=document,Pn=()=>$t.createComment(""),Ln=e=>e===null||typeof e!="object"&&typeof e!="function",Ro=Array.isArray,sp=e=>Ro(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",ys=`[
|
|
2
|
+
\f\r]`,an=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ja=/-->/g,Xa=/>/g,ut=RegExp(`>|${ys}(?:([^\\s"'>=/]+)(${ys}*=${ys}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Za=/'/g,er=/"/g,zl=/^(?:script|style|textarea|title)$/i,op=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),u=op(1),it=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),tr=new WeakMap,mt=$t.createTreeWalker($t,129);function ql(e,t){if(!Ro(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ya!==void 0?Ya.createHTML(t):t}const ap=(e,t)=>{const n=e.length-1,i=[];let s,o=t===2?"<svg>":t===3?"<math>":"",a=an;for(let r=0;r<n;r++){const d=e[r];let c,l,p=-1,h=0;for(;h<d.length&&(a.lastIndex=h,l=a.exec(d),l!==null);)h=a.lastIndex,a===an?l[1]==="!--"?a=Ja:l[1]!==void 0?a=Xa:l[2]!==void 0?(zl.test(l[2])&&(s=RegExp("</"+l[2],"g")),a=ut):l[3]!==void 0&&(a=ut):a===ut?l[0]===">"?(a=s??an,p=-1):l[1]===void 0?p=-2:(p=a.lastIndex-l[2].length,c=l[1],a=l[3]===void 0?ut:l[3]==='"'?er:Za):a===er||a===Za?a=ut:a===Ja||a===Xa?a=an:(a=ut,s=void 0);const v=a===ut&&e[r+1].startsWith("/>")?" ":"";o+=a===an?d+ip:p>=0?(i.push(c),d.slice(0,p)+Kl+d.slice(p)+et+v):d+et+(p===-2?r:v)}return[ql(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let no=class Hl{constructor({strings:t,_$litType$:n},i){let s;this.parts=[];let o=0,a=0;const r=t.length-1,d=this.parts,[c,l]=ap(t,n);if(this.el=Hl.createElement(c,i),mt.currentNode=this.el.content,n===2||n===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=mt.nextNode())!==null&&d.length<r;){if(s.nodeType===1){if(s.hasAttributes())for(const p of s.getAttributeNames())if(p.endsWith(Kl)){const h=l[a++],v=s.getAttribute(p).split(et),S=/([.?@])?(.*)/.exec(h);d.push({type:1,index:o,name:S[2],strings:v,ctor:S[1]==="."?lp:S[1]==="?"?cp:S[1]==="@"?dp:ji}),s.removeAttribute(p)}else p.startsWith(et)&&(d.push({type:6,index:o}),s.removeAttribute(p));if(zl.test(s.tagName)){const p=s.textContent.split(et),h=p.length-1;if(h>0){s.textContent=$i?$i.emptyScript:"";for(let v=0;v<h;v++)s.append(p[v],Pn()),mt.nextNode(),d.push({type:2,index:++o});s.append(p[h],Pn())}}}else if(s.nodeType===8)if(s.data===Wl)d.push({type:2,index:o});else{let p=-1;for(;(p=s.data.indexOf(et,p+1))!==-1;)d.push({type:7,index:o}),p+=et.length-1}o++}}static createElement(t,n){const i=$t.createElement("template");return i.innerHTML=t,i}};function jt(e,t,n=e,i){var a,r;if(t===it)return t;let s=i!==void 0?(a=n._$Co)==null?void 0:a[i]:n._$Cl;const o=Ln(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==o&&((r=s==null?void 0:s._$AO)==null||r.call(s,!1),o===void 0?s=void 0:(s=new o(e),s._$AT(e,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=s:n._$Cl=s),s!==void 0&&(t=jt(e,s._$AS(e,t.values),s,i)),t}class rp{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)??$t).importNode(n,!0);mt.currentNode=s;let o=mt.nextNode(),a=0,r=0,d=i[0];for(;d!==void 0;){if(a===d.index){let c;d.type===2?c=new Hi(o,o.nextSibling,this,t):d.type===1?c=new d.ctor(o,d.name,d.strings,this,t):d.type===6&&(c=new up(o,this,t)),this._$AV.push(c),d=i[++r]}a!==(d==null?void 0:d.index)&&(o=mt.nextNode(),a++)}return mt.currentNode=$t,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 Hi=class jl{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=jt(this,t,n),Ln(t)?t===k||t==null||t===""?(this._$AH!==k&&this._$AR(),this._$AH=k):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):sp(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&&Ln(this._$AH)?this._$AA.nextSibling.data=t:this.T($t.createTextNode(t)),this._$AH=t}$(t){var o;const{values:n,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=no.createElement(ql(i.h,i.h[0]),this.options)),i);if(((o=this._$AH)==null?void 0:o._$AD)===s)this._$AH.p(n);else{const a=new rp(s,this),r=a.u(this.options);a.p(n),this.T(r),this._$AH=a}}_$AC(t){let n=tr.get(t.strings);return n===void 0&&tr.set(t.strings,n=new no(t)),n}k(t){Ro(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,s=0;for(const o of t)s===n.length?n.push(i=new jl(this.O(Pn()),this.O(Pn()),this,this.options)):i=n[s],i._$AI(o),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=Qa(t).nextSibling;Qa(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}};class ji{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,s,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=o,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 o=this.strings;let a=!1;if(o===void 0)t=jt(this,t,n,0),a=!Ln(t)||t!==this._$AH&&t!==it,a&&(this._$AH=t);else{const r=t;let d,c;for(t=o[0],d=0;d<o.length-1;d++)c=jt(this,r[i+d],n,d),c===it&&(c=this._$AH[d]),a||(a=!Ln(c)||c!==this._$AH[d]),c===k?t=k:t!==k&&(t+=(c??"")+o[d+1]),this._$AH[d]=c}a&&!s&&this.j(t)}j(t){t===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let lp=class extends ji{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===k?void 0:t}},cp=class extends ji{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==k)}},dp=class extends ji{constructor(t,n,i,s,o){super(t,n,i,s,o),this.type=5}_$AI(t,n=this){if((t=jt(this,t,n,0)??k)===it)return;const i=this._$AH,s=t===k&&i!==k||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==k&&(i===k||s);s&&this.element.removeEventListener(this.name,this,i),o&&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)}},up=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){jt(this,t)}};const pp={I:Hi},vs=wn.litHtmlPolyfillSupport;vs==null||vs(no,Hi),(wn.litHtmlVersions??(wn.litHtmlVersions=[])).push("3.3.2");const hp=(e,t,n)=>{const i=(n==null?void 0:n.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const o=(n==null?void 0:n.renderBefore)??null;i._$litPart$=s=new Hi(t.insertBefore(Pn(),o),o,void 0,n??{})}return s._$AI(e),s};const bt=globalThis;let zt=class extends Ut{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=hp(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 it}};var Ol;zt._$litElement$=!0,zt.finalized=!0,(Ol=bt.litElementHydrateSupport)==null||Ol.call(bt,{LitElement:zt});const bs=bt.litElementPolyfillSupport;bs==null||bs({LitElement:zt});(bt.litElementVersions??(bt.litElementVersions=[])).push("4.2.2");const Vl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const fp={attribute:!0,type:String,converter:ki,reflect:!1,hasChanged:Io},gp=(e=fp,t,n)=>{const{kind:i,metadata:s}=n;let o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(n.name,e),i==="accessor"){const{name:a}=n;return{set(r){const d=t.get.call(this);t.set.call(this,r),this.requestUpdate(a,d,e,!0,r)},init(r){return r!==void 0&&this.C(a,void 0,e,r),r}}}if(i==="setter"){const{name:a}=n;return function(r){const d=this[a];t.call(this,r),this.requestUpdate(a,d,e,!0,r)}}throw Error("Unsupported decorator location: "+i)};function Vi(e){return(t,n)=>typeof n=="object"?gp(e,t,n):((i,s,o)=>{const a=s.hasOwnProperty(o);return s.constructor.createProperty(o,i),a?Object.getOwnPropertyDescriptor(s,o):void 0})(e,t,n)}function y(e){return Vi({...e,state:!0,attribute:!1})}const mp=50,yp=200,vp="Assistant";function nr(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function io(e){const t=nr(e==null?void 0:e.name,mp)??vp,n=nr((e==null?void 0:e.avatar)??void 0,yp)??null;return{agentId:typeof(e==null?void 0:e.agentId)=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function bp(){return io(typeof window>"u"?{}:{name:window.__TASKMASTER_ASSISTANT_NAME__,avatar:window.__TASKMASTER_ASSISTANT_AVATAR__})}const wp="Taskmaster",kp="/taskmaster-icon.png",$p="#00d4ff",Sp="";let Xn=null;function Ve(){return Xn||(Xn={name:window.__TASKMASTER_BRAND_NAME__||wp,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||kp,accentColor:window.__TASKMASTER_ACCENT_COLOR__||$p,backgroundColor:window.__TASKMASTER_BACKGROUND_COLOR__||Sp},Xn)}function Re(){return window.__TASKMASTER_WORKSPACE_BRANDS__??{}}function Gl(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 xp(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!t)return 0;const[n,i,s]=[t[1],t[2],t[3]].map(o=>{const a=parseInt(o,16)/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*n+.7152*i+.0722*s}function Ql(e){const t=Gl(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 i=xp(e)>.4?"#111111":"#ffffff";n.style.setProperty("--accent-foreground",i),n.style.setProperty("--primary-foreground",i)}function Zn(e,t,n){const i=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e),s=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!i||!s)return e;const o=(c,l)=>Math.round(parseInt(i[c],16)*(1-n)+parseInt(s[l],16)*n),a=o(1,1),r=o(2,2),d=o(3,3);return`#${a.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${d.toString(16).padStart(2,"0")}`}const rn={"--bg":"#12141a","--bg-muted":"#262a35","--card":"#181b22","--secondary":"#1e2028"};function Yl(e){const t=document.documentElement;if(!e){for(const[i,s]of Object.entries(rn))t.style.setProperty(i,s);t.style.removeProperty("--brand-bg"),t.style.removeProperty("--brand-bg-subtle"),t.style.removeProperty("--brand-bg-card");return}const n=Gl(e);n&&(t.style.setProperty("--bg",Zn(rn["--bg"],e,.08)),t.style.setProperty("--bg-muted",Zn(rn["--bg-muted"],e,.1)),t.style.setProperty("--card",Zn(rn["--card"],e,.12)),t.style.setProperty("--secondary",Zn(rn["--secondary"],e,.1)),t.style.setProperty("--brand-bg",e),t.style.setProperty("--brand-bg-subtle",`rgba(${n}, 0.08)`),t.style.setProperty("--brand-bg-card",`rgba(${n}, 0.12)`))}function kn(e){const t=Ve(),n=Re(),i=e?n[e]:void 0,s=(i==null?void 0:i.accentColor)??t.accentColor;Ql(s);const o=(i==null?void 0:i.backgroundColor)??t.backgroundColor;Yl(o)}const Si="taskmaster.control.settings.v1",Jl="taskmaster.account.settings.";function $n(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}`}const Ot={gatewayUrl:$n(),token:"",theme:"system",navCollapsed:!1,navGroupsCollapsed:{}},Ze={sessionKey:"main",lastActiveSessionKey:"main",chatFocusMode:!1,chatShowThinking:!1,splitRatio:.6};function Ap(){try{const e=localStorage.getItem(Si);if(!e)return{...Ot,gatewayUrl:$n()};const t=JSON.parse(e);return{gatewayUrl:typeof t.gatewayUrl=="string"&&t.gatewayUrl.trim()?t.gatewayUrl.trim():$n(),token:typeof t.token=="string"?t.token:Ot.token,theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:Ot.theme,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:Ot.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:Ot.navGroupsCollapsed}}catch{return{...Ot,gatewayUrl:$n()}}}function Cp(e){if(!e)return{...Ze};try{const t=localStorage.getItem(Jl+e);if(!t)return{...Ze};const n=JSON.parse(t);return{sessionKey:typeof n.sessionKey=="string"&&n.sessionKey.trim()?n.sessionKey.trim():Ze.sessionKey,lastActiveSessionKey:typeof n.lastActiveSessionKey=="string"&&n.lastActiveSessionKey.trim()?n.lastActiveSessionKey.trim():typeof n.sessionKey=="string"&&n.sessionKey.trim()||Ze.lastActiveSessionKey,chatFocusMode:typeof n.chatFocusMode=="boolean"?n.chatFocusMode:Ze.chatFocusMode,chatShowThinking:typeof n.chatShowThinking=="boolean"?n.chatShowThinking:Ze.chatShowThinking,splitRatio:typeof n.splitRatio=="number"&&n.splitRatio>=.4&&n.splitRatio<=.7?n.splitRatio:Ze.splitRatio}}catch{return{...Ze}}}let xi=null;function ir(e){xi=e}function ws(){return{...Ap(),...Cp(xi)}}function Ep(e){const t={gatewayUrl:e.gatewayUrl,token:e.token,theme:e.theme,navCollapsed:e.navCollapsed,navGroupsCollapsed:e.navGroupsCollapsed};if(localStorage.setItem(Si,JSON.stringify(t)),xi){const n={sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,chatFocusMode:e.chatFocusMode,chatShowThinking:e.chatShowThinking,splitRatio:e.splitRatio};localStorage.setItem(Jl+xi,JSON.stringify(n))}}const Tp="taskmaster.draft.";function Do(e,t){return Tp+e+"."+t}function In(e,t,n){try{const i=Do(e,t);n?localStorage.setItem(i,n):localStorage.removeItem(i)}catch{}}function Rn(e,t){try{return localStorage.getItem(Do(e,t))??""}catch{return""}}function _p(e,t){try{localStorage.removeItem(Do(e,t))}catch{}}let yt=null,$e=null;function sr(e,t,n){$e={workspace:e,sessionKey:t,text:n},yt!=null&&clearTimeout(yt),yt=setTimeout(()=>{$e&&In($e.workspace,$e.sessionKey,$e.text),$e=null,yt=null},300)}function so(){yt!=null&&clearTimeout(yt),yt=null,$e&&(In($e.workspace,$e.sessionKey,$e.text),$e=null)}(function(){try{const t=localStorage.getItem(Si);if(!t)return;const n=JSON.parse(t);if(!("sessionKey"in n))return;const i={gatewayUrl:typeof n.gatewayUrl=="string"?n.gatewayUrl:$n(),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(Si,JSON.stringify(i))}catch{}})();function Xl(e){var o;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=(o=n[1])==null?void 0:o.trim(),s=n.slice(2).join(":");return!i||!s?null:{agentId:i,rest:s}}const Mp=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,ei=/<\s*\/?\s*final\b[^>]*>/gi,or=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function Pp(e,t){return e.trimStart()}function Lp(e,t){if(!e||!Mp.test(e))return e;let n=e;ei.test(n)?(ei.lastIndex=0,n=n.replace(ei,"")):ei.lastIndex=0,or.lastIndex=0;let i="",s=0,o=!1;for(const a of n.matchAll(or)){const r=a.index??0,d=a[1]==="/";o?d&&(o=!1):(i+=n.slice(s,r),d||(o=!0)),s=r+a[0].length}return i+=n.slice(s),Pp(i)}function Zl(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function Gi(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0){const a=-t,r=Math.round(a/1e3);if(r<60)return`in ${r}s`;const d=Math.round(r/60);if(d<60)return`in ${d}m`;const c=Math.round(d/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 Bo(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 Ip(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function ec(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 Ai(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ks(e){return Lp(e)}const Rp=/^\[([^\]]+)\]\s*/,Dp=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],$s=new WeakMap,Ss=new WeakMap;function Bp(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:Dp.some(t=>e.startsWith(`${t} `))}function xs(e){const t=e.match(Rp);if(!t)return e;const n=t[1]??"";return Bp(n)?e.slice(t[0].length):e}function Sn(e){const t=e,n=typeof t.role=="string"?t.role:"",i=t.content;if(typeof i=="string")return n==="assistant"?ks(i):xs(i);if(Array.isArray(i)){const s=i.map(o=>{const a=o;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(o=>typeof o=="string");if(s.length>0){const o=s.join(`
|
|
4
4
|
`);return n==="assistant"?ks(o):xs(o)}}return typeof t.text=="string"?n==="assistant"?ks(t.text):xs(t.text):null}function tc(e){if(!e||typeof e!="object")return Sn(e);const t=e;if($s.has(t))return $s.get(t)??null;const n=Sn(e);return $s.set(t,n),n}function ar(e){const n=e.content,i=[];if(Array.isArray(n))for(const r of n){const d=r;if(d.type==="thinking"&&typeof d.thinking=="string"){const c=d.thinking.trim();c&&i.push(c)}}if(i.length>0)return i.join(`
|
|
5
5
|
`);const s=Fp(e);if(!s)return null;const a=[...s.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(r=>(r[1]??"").trim()).filter(Boolean);return a.length>0?a.join(`
|
|
6
6
|
`):null}function Np(e){if(!e||typeof e!="object")return ar(e);const t=e;if(Ss.has(t))return Ss.get(t)??null;const n=ar(e);return Ss.set(t,n),n}function Fp(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const i=n.map(s=>{const o=s;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(s=>typeof s=="string");if(i.length>0)return i.join(`
|
|
7
7
|
`)}return typeof t.text=="string"?t.text:null}function Op(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 Up=/Read HEARTBEAT\.md if it exists|reply HEARTBEAT_OK/i,Kp=/^[\s*`_]*HEARTBEAT_OK[\s*`_]*$/i,Wp=/^[\s*`_]*NO_REPLY[\s*`_]*$/i,zp=/^A new session was started via \/new or \/reset\./;function qp(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(o=>typeof o=="object"&&o!==null).map(o=>o.text??"").join(" "):typeof t.text=="string"&&(i=t.text);const s=i.trim();return s?!!(n==="user"&&Up.test(s)||n==="assistant"&&Kp.test(s)||n==="user"&&zp.test(s)||n==="assistant"&&Wp.test(s)):!1}function nc(e){return e.filter(t=>!qp(t))}function ic(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,o=Array.isArray(s)?s:null,a=Array.isArray(o)&&o.some(p=>{const v=String(p.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),r=typeof t.toolName=="string"||typeof t.tool_name=="string";(i||a||r)&&(n="toolResult");let d=[];typeof t.content=="string"?d=[{type:"text",text:t.content}]:Array.isArray(t.content)?d=t.content.map(p=>({type:p.type||"text",text:p.text,name:p.name,args:p.args||p.arguments})):typeof t.text=="string"&&(d=[{type:"text",text:t.text}]);const c=typeof t.timestamp=="number"?t.timestamp:Date.now(),l=typeof t.id=="string"?t.id:void 0;return{role:n,content:d,timestamp:c,id:l}}function sc(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 oc(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}function rr(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 Hp(){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 Qi(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),rr(t)}return rr(Hp())}const
|
|
8
|
+
`):""}const Up=/Read HEARTBEAT\.md if it exists|reply HEARTBEAT_OK/i,Kp=/^[\s*`_]*HEARTBEAT_OK[\s*`_]*$/i,Wp=/^[\s*`_]*NO_REPLY[\s*`_]*$/i,zp=/^A new session was started via \/new or \/reset\./;function qp(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(o=>typeof o=="object"&&o!==null).map(o=>o.text??"").join(" "):typeof t.text=="string"&&(i=t.text);const s=i.trim();return s?!!(n==="user"&&Up.test(s)||n==="assistant"&&Kp.test(s)||n==="user"&&zp.test(s)||n==="assistant"&&Wp.test(s)):!1}function nc(e){return e.filter(t=>!qp(t))}function ic(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,o=Array.isArray(s)?s:null,a=Array.isArray(o)&&o.some(p=>{const v=String(p.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),r=typeof t.toolName=="string"||typeof t.tool_name=="string";(i||a||r)&&(n="toolResult");let d=[];typeof t.content=="string"?d=[{type:"text",text:t.content}]:Array.isArray(t.content)?d=t.content.map(p=>({type:p.type||"text",text:p.text,name:p.name,args:p.args||p.arguments})):typeof t.text=="string"&&(d=[{type:"text",text:t.text}]);const c=typeof t.timestamp=="number"?t.timestamp:Date.now(),l=typeof t.id=="string"?t.id:void 0;return{role:n,content:d,timestamp:c,id:l}}function sc(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 oc(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}function rr(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 Hp(){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 Qi(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),rr(t)}return rr(Hp())}const Ne=50;async function Be(e,t){if(!e.client||!e.connected)return;e.chatLoading=!0,e.lastError=null;const n=(t==null?void 0:t.limit)??Ne;try{const i=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:n}),s=Array.isArray(i.messages)?i.messages:[],o=typeof i.totalMessages=="number"?i.totalMessages:s.length,a=nc(s);e.chatMessages=a,e.chatHistoryTotal=o,e.chatHistoryHasMore=o>s.length,e.chatThinkingLevel=i.thinkingLevel??null,e.chatModelProvider=typeof i.modelProvider=="string"?i.modelProvider:null,e.chatModel=typeof i.model=="string"?i.model:null,e.chatVerboseLevel=typeof i.verboseLevel=="string"?i.verboseLevel:null,e.chatFillerEnabled=typeof i.fillerEnabled=="boolean"?i.fillerEnabled:null}catch(i){e.lastError=String(i)}finally{e.chatLoading=!1}}async function jp(e){if(!e.client||!e.connected||e.chatLoadingOlder||!e.chatHistoryHasMore)return!1;e.chatLoadingOlder=!0;try{const t=e.chatMessages.length,n=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:Ne,offset:t}),i=Array.isArray(n.messages)?n.messages:[],s=typeof n.totalMessages=="number"?n.totalMessages:0;if(i.length===0)return e.chatHistoryHasMore=!1,!1;const o=nc(i);return e.chatMessages=[...o,...e.chatMessages],e.chatHistoryTotal=s,e.chatHistoryHasMore=s>t+i.length,!0}catch(t){return e.lastError=String(t),!1}finally{e.chatLoadingOlder=!1}}function Vp(e){const t=/^data:(.+?);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function ac(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 o=Date.now(),a=(n??[]).filter(v=>!v.fileName),r=(n??[]).filter(v=>v.fileName),d=[],c=r.map(v=>v.fileName).filter(Boolean);if(c.length>0){const v=i?`${c.join(", ")}
|
|
9
9
|
|
|
10
|
-
${i}`:c.join(", ");d.push({type:"text",text:v})}else i&&d.push({type:"text",text:i});for(const v of a)d.push({type:"image",source:{type:"base64",media_type:v.mimeType,data:v.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:d,timestamp:o}],e.chatSending=!0,e.lastError=null;const l=Qi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=o;const p=[...a,...r],
|
|
10
|
+
${i}`:c.join(", ");d.push({type:"text",text:v})}else i&&d.push({type:"text",text:i});for(const v of a)d.push({type:"image",source:{type:"base64",media_type:v.mimeType,data:v.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:d,timestamp:o}],e.chatSending=!0,e.lastError=null;const l=Qi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=o;const p=[...a,...r],h=p.length>0?p.map(v=>{if(v.textContent)return{type:"document",mimeType:v.mimeType||"text/plain",fileName:v.fileName,content:btoa(unescape(encodeURIComponent(v.textContent)))};const S=Vp(v.dataUrl);return S?{type:v.fileName?"document":"image",mimeType:S.mimeType,fileName:v.fileName,content:S.content}:null}).filter(v=>v!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:i,deliver:!1,idempotencyKey:l,attachments:h}),!0}catch(v){const S=String(v);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=S,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+S}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function rc(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 lc(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 o=(t.message?(n=Sn(t.message))==null?void 0:n.trim():void 0)||((i=e.chatStream)==null?void 0:i.trim());if(o)if(!e.chatInterimText)e.chatInterimText=o;else{const a=o.trim(),r=e.chatInterimText.trim();a===r||r.endsWith(a)||(a.startsWith(r)?e.chatInterimText=o:e.chatInterimText=`${e.chatInterimText}
|
|
11
11
|
|
|
12
|
-
${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(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=Sn(t.message);if(typeof s=="string"){if(s.trim()==="NO_REPLY")return null;const o=e.chatStream??"";(!o||s.length>=o.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 Ci=Object.freeze(Object.defineProperty({__proto__:null,CHAT_PAGE_SIZE:
|
|
12
|
+
${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(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=Sn(t.message);if(typeof s=="string"){if(s.trim()==="NO_REPLY")return null;const o=e.chatStream??"";(!o||s.length>=o.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 Ci=Object.freeze(Object.defineProperty({__proto__:null,CHAT_PAGE_SIZE:Ne,abortChatRun:rc,handleChatEvent:lc,loadChatHistory:Be,loadOlderChatHistory:jp,sendChatMessage:ac},Symbol.toStringTag,{value:"Module"}));async function No(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=Ai(e.sessionsFilterActive??"",0),i=Ai(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 ti(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 No(e)}catch(s){e.sessionsError=String(s)}}const lr=50,Gp=80,Qp=12e4;function Yp(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 o=s;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(s=>!!s);return i.length===0?null:i.join(`
|
|
13
13
|
`)}function cr(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Yp(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=ec(n,Qp);return i.truncated?`${i.text}
|
|
14
14
|
|
|
15
|
-
… truncated (${i.total} chars, showing first ${i.text.length}).`:i.text}function Jp(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 Xp(e){if(e.toolStreamOrder.length<=lr)return;const t=e.toolStreamOrder.length-lr,n=e.toolStreamOrder.splice(0,t);for(const i of n)e.toolStreamById.delete(i)}function Zp(e){e.chatToolMessages=e.toolStreamOrder.map(t=>{var n;return(n=e.toolStreamById.get(t))==null?void 0:n.message}).filter(t=>!!t)}function oo(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Zp(e)}function eh(e,t=!1){if(t){oo(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>oo(e),Gp))}function Fo(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],oo(e)}const th=5e3;function nh(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},th))}function ih(e,t){if(!t)return;if(t.stream==="compaction"){nh(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 o=typeof i.name=="string"?i.name:"tool",a=typeof i.phase=="string"?i.phase:"",r=a==="start"?i.args:void 0,d=a==="update"?cr(i.partialResult):a==="result"?cr(i.result):void 0,c=Date.now();let l=e.toolStreamById.get(s);l?(l.name=o,r!==void 0&&(l.args=r),d!==void 0&&(l.output=d),l.updatedAt=c):(l={toolCallId:s,runId:t.runId,sessionKey:n,name:o,args:r,output:d,startedAt:typeof t.ts=="number"?t.ts:c,updatedAt:c,message:{}},e.toolStreamById.set(s,l),e.toolStreamOrder.push(s)),l.message=Jp(l),Xp(e),eh(e,a==="result")}let ni=0;function
|
|
15
|
+
… truncated (${i.total} chars, showing first ${i.text.length}).`:i.text}function Jp(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 Xp(e){if(e.toolStreamOrder.length<=lr)return;const t=e.toolStreamOrder.length-lr,n=e.toolStreamOrder.splice(0,t);for(const i of n)e.toolStreamById.delete(i)}function Zp(e){e.chatToolMessages=e.toolStreamOrder.map(t=>{var n;return(n=e.toolStreamById.get(t))==null?void 0:n.message}).filter(t=>!!t)}function oo(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Zp(e)}function eh(e,t=!1){if(t){oo(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>oo(e),Gp))}function Fo(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],oo(e)}const th=5e3;function nh(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},th))}function ih(e,t){if(!t)return;if(t.stream==="compaction"){nh(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 o=typeof i.name=="string"?i.name:"tool",a=typeof i.phase=="string"?i.phase:"",r=a==="start"?i.args:void 0,d=a==="update"?cr(i.partialResult):a==="result"?cr(i.result):void 0,c=Date.now();let l=e.toolStreamById.get(s);l?(l.name=o,r!==void 0&&(l.args=r),d!==void 0&&(l.output=d),l.updatedAt=c):(l={toolCallId:s,runId:t.runId,sessionKey:n,name:o,args:r,output:d,startedAt:typeof t.ts=="number"?t.ts:c,updatedAt:c,message:{}},e.toolStreamById.set(s,l),e.toolStreamOrder.push(s)),l.message=Jp(l),Xp(e),eh(e,a==="result")}let ni=0;function Yt(e,t=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const n=++ni,i=()=>{const s=e.querySelector(".chat-thread");if(s){const o=getComputedStyle(s).overflowY;if(o==="auto"||o==="scroll"||s.scrollHeight-s.clientHeight>1)return s}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{n===ni&&(e.chatScrollFrame=requestAnimationFrame(()=>{if(e.chatScrollFrame=null,n!==ni)return;const s=i();if(!s)return;const o=s.scrollHeight-s.scrollTop-s.clientHeight;if(!(t||e.chatUserNearBottom||o<200))return;t&&(e.chatHasAutoScrolled=!0),s.scrollTop=s.scrollHeight,e.chatUserNearBottom=!0;const r=t?150:120;e.chatScrollTimeout=window.setTimeout(()=>{if(e.chatScrollTimeout=null,n!==ni)return;const d=i();if(!d)return;const c=d.scrollHeight-d.scrollTop-d.clientHeight;(t||e.chatUserNearBottom||c<200)&&(d.scrollTop=d.scrollHeight,e.chatUserNearBottom=!0)},r)}))})}function cc(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 sh(e,t){const n=t.currentTarget;if(!n)return;const i=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=i<200,n.scrollTop<100&&e.onLoadOlder&&e.onLoadOlder()}function oh(e){const t=e.querySelector(".chat-thread");if(!t)return null;const n=t.scrollHeight,i=t.scrollTop;return()=>{const s=t.scrollHeight-n;t.scrollTop=i+s}}function ah(e,t){const n=t.currentTarget;n&&(e.logsAtBottom=n.scrollTop<80)}function rh(e,t){const n=t.currentTarget;n&&(e.logsAtBottom=n.scrollTop<80)}function lh(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0}function ch(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
16
16
|
`)}
|
|
17
17
|
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function dh(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"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-session-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function uh(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 st(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function
|
|
20
|
-
`}function dc(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const a=t[o],r=t[o+1];if(typeof a=="number"){if(!Array.isArray(i))return;i[a]==null&&(i[a]=typeof r=="number"?[]:{}),i=i[a]}else{if(typeof i!="object"||i==null)return;const d=i;d[a]==null&&(d[a]=typeof r=="number"?[]:{}),i=d[a]}}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 Ne(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});hh(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function uc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});ph(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function ph(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function hh(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?$t(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=$t(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=st(t.config??{}),e.configFormOriginal=st(t.config??{}),e.configRawOriginal=n)}async function fh(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?$t(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 Ne(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function Yt(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 Fn(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 pc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=Ai(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 hc(e){if(e.payloadKind==="systemEvent"){const o=e.payloadText.trim();if(!o)throw new Error("System event text required.");return{kind:"systemEvent",text:o}}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);const i=[];e.toAdmins&&i.push("admins");for(const o of e.recipients){const a=o.trim();a&&i.push(a)}i.length>0&&(n.to=i.join(","));const s=Ai(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function gh(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=pc(e.cronForm),i=hc(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:o||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(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Fn(e),await Yt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function mh(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 Fn(e),await Yt(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function yh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null,e.cronRunModalJobId=t.id,e.cronRunModalJobName=t.name||"Untitled",e.cronRunResult=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await ao(e,t.id)}catch(n){e.cronError=String(n),e.cronRunResult={status:"error",error:String(n)}}finally{e.cronBusy=!1}}}function vh(e,t){e.cronRunModalJobId&&t.jobId===e.cronRunModalJobId&&t.action==="finished"&&(e.cronRunResult={status:t.status??"unknown",durationMs:t.durationMs,summary:t.summary,error:t.error})}async function bh(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 Fn(e),await Yt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}function wh(e){var n;const t={name:e.name||"",description:e.description||"",agentId:e.agentId||"",enabled:e.enabled,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"",cronTz:"",sessionTarget:e.sessionTarget||"main",wakeMode:e.wakeMode||"next-heartbeat",payloadKind:e.payload.kind,payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};if(e.schedule.kind==="at"){const i=new Date(e.schedule.atMs),s=o=>String(o).padStart(2,"0");t.scheduleAt=`${i.getFullYear()}-${s(i.getMonth()+1)}-${s(i.getDate())}T${s(i.getHours())}:${s(i.getMinutes())}`}else if(e.schedule.kind==="every"){const i=e.schedule.everyMs;i%864e5===0?(t.everyAmount=String(i/864e5),t.everyUnit="days"):i%36e5===0?(t.everyAmount=String(i/36e5),t.everyUnit="hours"):(t.everyAmount=String(i/6e4),t.everyUnit="minutes")}else e.schedule.kind==="cron"&&(t.cronExpr=e.schedule.expr,t.cronTz=e.schedule.tz||"");if(e.payload.kind==="systemEvent")t.payloadText=e.payload.text;else if(e.payload.kind==="agentTurn"){t.payloadText=e.payload.message,t.deliver=e.payload.deliver??!1,t.timeoutSeconds=e.payload.timeoutSeconds?String(e.payload.timeoutSeconds):"";const i=e.payload.channel??e.payload.provider;t.channel=i||"last";const s=e.payload.to||"";if(s){const o=s.split(",").map(a=>a.trim()).filter(Boolean);t.toAdmins=o.some(a=>a.toLowerCase()==="admins"),t.recipients=o.filter(a=>a.toLowerCase()!=="admins")}}return(n=e.isolation)!=null&&n.postToMainPrefix&&(t.postToMainPrefix=e.isolation.postToMainPrefix),t}async function kh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=pc(e.cronForm),i=hc(e.cronForm),s={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:e.cronForm.agentId.trim()||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i};if(e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?s.isolation={postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:s.isolation=void 0,!s.name)throw new Error("Name required.");await e.client.request("cron.update",{id:t,patch:s}),await Fn(e),await Yt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ao(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 Y(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 Oo(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 fc(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 gc(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 mc(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 o=st(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const a=o.channels;(!a.whatsapp||typeof a.whatsapp!="object")&&(a.whatsapp={});const r=a.whatsapp;(!r.accounts||typeof r.accounts!="object")&&(r.accounts={});const d=r.accounts;if(d[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}d[i]={name:n,provider:"baileys"};const c=s.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const l=$t(o);await e.client.request("config.set",{raw:l,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await Y(e,!0),await Oo(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function yc(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=st(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,a=o==null?void 0:o.accounts;if(!a){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(a).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!a[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete a[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(l=>{const p=l.match;return!p||p.channel!=="whatsapp"?!0:p.accountId!==t}));const d=n.hash;if(!d){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=$t(i);await e.client.request("config.set",{raw:c,baseHash:d}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await Y(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const $h=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:mc,loadChannels:Y,logoutWhatsApp:gc,removeWhatsAppAccount:yc,startWhatsAppLogin:Oo,waitWhatsAppLogin:fc},Symbol.toStringTag,{value:"Module"}));async function Uo(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 o=i;e.debugModels=Array.isArray(o==null?void 0:o.models)?o==null?void 0:o.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const Sh=2e3,xh=new Set(["trace","debug","info","warn","error","fatal"]);function Ah(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 Ch(e){if(typeof e!="string")return null;const t=e.toLowerCase();return xh.has(t)?t:null}function vc(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=Ch((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),o=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,a=Ah(o);let r=null;a&&(typeof a.subsystem=="string"?r=a.subsystem:typeof a.module=="string"&&(r=a.module)),!r&&o&&o.length<120&&(r=o);let d=null;return typeof t[1]=="string"?d=t[1]:!a&&typeof t[0]=="string"?d=t[0]:typeof t.message=="string"&&(d=t.message),{raw:e,time:i,level:s,subsystem:r,message:d??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function zt(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}),o=(Array.isArray(i.lines)?i.lines.filter(r=>typeof r=="string"):[]).map(vc),a=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=a?o:[...e.logsEntries,...o].slice(-Sh),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 Eh=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:zt,parseLogLine:vc},Symbol.toStringTag,{value:"Module"}));const bc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:le,n:mi,Gx:dr,Gy:ur,a:As,d:Cs,h:Th}=bc,St=32,Ko=64,_h=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},ie=(e="")=>{const t=new Error(e);throw _h(t,ie),t},Mh=e=>typeof e=="bigint",Ph=e=>typeof e=="string",Lh=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",at=(e,t,n="")=>{const i=Lh(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const a=n&&`"${n}" `,r=o?` of length ${t}`:"",d=i?`length=${s}`:`type=${typeof e}`;ie(a+"expected Uint8Array"+r+", got "+d)}return e},Yi=e=>new Uint8Array(e),wc=e=>Uint8Array.from(e),kc=(e,t)=>e.toString(16).padStart(t,"0"),$c=e=>Array.from(at(e)).map(t=>kc(t,2)).join(""),We={_0:48,_9:57,A:65,F:70,a:97,f:102},pr=e=>{if(e>=We._0&&e<=We._9)return e-We._0;if(e>=We.A&&e<=We.F)return e-(We.A-10);if(e>=We.a&&e<=We.f)return e-(We.a-10)},Sc=e=>{const t="hex invalid";if(!Ph(e))return ie(t);const n=e.length,i=n/2;if(n%2)return ie(t);const s=Yi(i);for(let o=0,a=0;o<i;o++,a+=2){const r=pr(e.charCodeAt(a)),d=pr(e.charCodeAt(a+1));if(r===void 0||d===void 0)return ie(t);s[o]=r*16+d}return s},xc=()=>globalThis==null?void 0:globalThis.crypto,Ih=()=>{var e;return((e=xc())==null?void 0:e.subtle)??ie("crypto.subtle must be defined, consider polyfill")},Dn=(...e)=>{const t=Yi(e.reduce((i,s)=>i+at(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},Rh=(e=St)=>xc().getRandomValues(Yi(e)),Ei=BigInt,ht=(e,t,n,i="bad number: out of range")=>Mh(e)&&t<=e&&e<n?e:ie(i),L=(e,t=le)=>{const n=e%t;return n>=0n?n:t+n},Ac=e=>L(e,mi),Dh=(e,t)=>{(e===0n||t<=0n)&&ie("no inverse n="+e+" mod="+t);let n=L(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const a=i/n,r=i%n,d=s-o*a;i=n,n=r,s=o,o=d}return i===1n?L(s,t):ie("no inverse")},Bh=e=>{const t=_c[e];return typeof t!="function"&&ie("hashes."+e+" not set"),t},Es=e=>e instanceof xt?e:ie("Point expected"),ro=2n**256n,Re=class Re{constructor(t,n,i,s){K(this,"X");K(this,"Y");K(this,"Z");K(this,"T");const o=ro;this.X=ht(t,0n,o),this.Y=ht(n,0n,o),this.Z=ht(i,1n,o),this.T=ht(s,0n,o),Object.freeze(this)}static CURVE(){return bc}static fromAffine(t){return new Re(t.x,t.y,1n,L(t.x*t.y))}static fromBytes(t,n=!1){const i=Cs,s=wc(at(t,St)),o=t[31];s[31]=o&-129;const a=Ec(s);ht(a,0n,n?ro:le);const d=L(a*a),c=L(d-1n),l=L(i*d+1n);let{isValid:p,value:f}=Fh(c,l);p||ie("bad point: y not sqrt");const v=(f&1n)===1n,h=(o&128)!==0;return!n&&f===0n&&h&&ie("bad point: x==0, isLastByteOdd"),h!==v&&(f=L(-f)),new Re(f,a,1n,L(f*a))}static fromHex(t,n){return Re.fromBytes(Sc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=As,n=Cs,i=this;if(i.is0())return ie("bad point: ZERO");const{X:s,Y:o,Z:a,T:r}=i,d=L(s*s),c=L(o*o),l=L(a*a),p=L(l*l),f=L(d*t),v=L(l*L(f+c)),h=L(p+L(n*L(d*c)));if(v!==h)return ie("bad point: equation left != right (1)");const b=L(s*o),S=L(a*r);return b!==S?ie("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:a,Z:r}=Es(t),d=L(n*r),c=L(o*s),l=L(i*r),p=L(a*s);return d===c&&l===p}is0(){return this.equals(Kt)}negate(){return new Re(L(-this.X),this.Y,this.Z,L(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=As,o=L(t*t),a=L(n*n),r=L(2n*L(i*i)),d=L(s*o),c=t+n,l=L(L(c*c)-o-a),p=d+a,f=p-r,v=d-a,h=L(l*f),b=L(p*v),S=L(l*v),$=L(f*p);return new Re(h,b,$,S)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:r,Z:d,T:c}=Es(t),l=As,p=Cs,f=L(n*a),v=L(i*r),h=L(o*p*c),b=L(s*d),S=L((n+i)*(a+r)-f-v),$=L(b-h),x=L(b+h),C=L(v-l*f),T=L(S*$),_=L(x*C),D=L(S*C),O=L($*x);return new Re(T,_,O,D)}subtract(t){return this.add(Es(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Kt;if(ht(t,1n,mi),t===1n)return this;if(this.equals(At))return Qh(t).p;let i=Kt,s=At;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?i=i.add(o):n&&(s=s.add(o));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals(Kt))return{x:0n,y:1n};const s=Dh(i,le);L(i*s)!==1n&&ie("invalid inverse");const o=L(t*s),a=L(n*s);return{x:o,y:a}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Cc(n);return i[31]|=t&1n?128:0,i}toHex(){return $c(this.toBytes())}clearCofactor(){return this.multiply(Ei(Th),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(mi/2n,!1).double();return mi%2n&&(t=t.add(this)),t.is0()}};K(Re,"BASE"),K(Re,"ZERO");let xt=Re;const At=new xt(dr,ur,1n,L(dr*ur)),Kt=new xt(0n,1n,1n,0n);xt.BASE=At;xt.ZERO=Kt;const Cc=e=>Sc(kc(ht(e,0n,ro),Ko)).reverse(),Ec=e=>Ei("0x"+$c(wc(at(e)).reverse())),_e=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=le;return n},Nh=e=>{const n=e*e%le*e%le,i=_e(n,2n)*n%le,s=_e(i,1n)*e%le,o=_e(s,5n)*s%le,a=_e(o,10n)*o%le,r=_e(a,20n)*a%le,d=_e(r,40n)*r%le,c=_e(d,80n)*d%le,l=_e(c,80n)*d%le,p=_e(l,10n)*o%le;return{pow_p_5_8:_e(p,2n)*e%le,b2:n}},hr=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Fh=(e,t)=>{const n=L(t*t*t),i=L(n*n*t),s=Nh(e*i).pow_p_5_8;let o=L(e*n*s);const a=L(t*o*o),r=o,d=L(o*hr),c=a===e,l=a===L(-e),p=a===L(-e*hr);return c&&(o=r),(l||p)&&(o=d),(L(o)&1n)===1n&&(o=L(-o)),{isValid:c||l,value:o}},lo=e=>Ac(Ec(e)),Wo=(...e)=>_c.sha512Async(Dn(...e)),Oh=(...e)=>Bh("sha512")(Dn(...e)),Tc=e=>{const t=e.slice(0,St);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(St,Ko),i=lo(t),s=At.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},zo=e=>Wo(at(e,St)).then(Tc),Uh=e=>Tc(Oh(at(e,St))),Kh=e=>zo(e).then(t=>t.pointBytes),Wh=e=>Wo(e.hashable).then(e.finish),zh=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=lo(t),a=At.multiply(o).toBytes();return{hashable:Dn(a,i,n),finish:c=>{const l=Ac(o+lo(c)*s);return at(Dn(a,Cc(l)),Ko)}}},qh=async(e,t)=>{const n=at(e),i=await zo(t),s=await Wo(i.prefix,n);return Wh(zh(i,s,n))},_c={sha512Async:async e=>{const t=Ih(),n=Dn(e);return Yi(await t.digest("SHA-512",n.buffer))},sha512:void 0},Hh=(e=Rh(St))=>e,jh={getExtendedPublicKeyAsync:zo,getExtendedPublicKey:Uh,randomSecretKey:Hh},Ti=8,Vh=256,Mc=Math.ceil(Vh/Ti)+1,co=2**(Ti-1),Gh=()=>{const e=[];let t=At,n=t;for(let i=0;i<Mc;i++){n=t,e.push(n);for(let s=1;s<co;s++)n=n.add(t),e.push(n);t=n.double()}return e};let fr;const gr=(e,t)=>{const n=t.negate();return e?n:t},Qh=e=>{const t=fr||(fr=Gh());let n=Kt,i=At;const s=2**Ti,o=s,a=Ei(s-1),r=Ei(Ti);for(let d=0;d<Mc;d++){let c=Number(e&a);e>>=r,c>co&&(c-=o,e+=1n);const l=d*co,p=l,f=l+Math.abs(c)-1,v=d%2!==0,h=c<0;c===0?i=i.add(gr(v,t[p])):n=n.add(gr(h,t[f]))}return e!==0n&&ie("invalid wnaf"),{p:n,f:i}},Ts="taskmaster-device-identity-v1";function uo(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Pc(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 o=0;o<i.length;o+=1)s[o]=i.charCodeAt(o);return s}function Yh(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Lc(e){const t=await crypto.subtle.digest("SHA-256",e);return Yh(new Uint8Array(t))}async function Jh(){const e=jh.randomSecretKey(),t=await Kh(e);return{deviceId:await Lc(t),publicKey:uo(t),privateKey:uo(e)}}async function Xh(){try{const n=localStorage.getItem(Ts);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 Lc(Pc(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(Ts,JSON.stringify(o)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await Jh(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Ts,JSON.stringify(t)),e}async function Zh(e,t){const n=Pc(e),i=new TextEncoder().encode(t),s=await qh(i,n);return uo(s)}const Ic="taskmaster.device.auth.v1";function qo(e){return e.trim()}function ef(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 Ho(){try{const e=window.localStorage.getItem(Ic);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 Rc(e){try{window.localStorage.setItem(Ic,JSON.stringify(e))}catch{}}function tf(e){const t=Ho();if(!t||t.deviceId!==e.deviceId)return null;const n=qo(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function nf(e){const t=qo(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=Ho();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:ef(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Rc(n),s}function sf(e){const t=Ho();if(!t||t.deviceId!==e.deviceId)return;const n=qo(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Rc(i)}async function jo(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 Vo(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 of(e){return{method:"exec.approvals.get",params:{}}}async function af(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=of(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);rf(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function rf(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=st(t.file??{}))}async function Dc(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 ot(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Ge(e){return e instanceof Error?e.message:String(e)}function Bn(){return{name:"",skillContent:"",references:[]}}async function Ve(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=Ge(n)}finally{e.skillsLoading=!1}}}function Bc(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Nc(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 Ve(e),ot(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Ge(i);e.skillsError=s,ot(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Fc(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 Ve(e),ot(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Ge(n);e.skillsError=i,ot(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Oc(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 Ve(e),ot(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=Ge(s);e.skillsError=o,ot(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}async function Uc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});n&&(e.skillDetail=n,e.skillDetailTab="SKILL.md")}catch(n){e.skillsError=Ge(n)}}function Kc(e){e.skillDetail=null,e.skillDetailTab=""}function Wc(e,t){e.skillDetailTab=t}async function zc(e){if(e.skillAddModal=!0,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[],!(!e.client||!e.connected))try{const t=await e.client.request("skills.drafts",{});t&&(e.skillDrafts=t.drafts)}catch{}}function qc(e){e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[]}function Hc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n}))},e.skillAddFormSource="draft"}async function jc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n}))},e.skillAddFormSource="installed",await Go(e)}async function Go(e){if(!e.client||!e.connected)return;const t=e.skillAddForm;if(!(!t.name.trim()||!t.skillContent.trim())){e.skillsBusyKey="__add__",e.skillsError=null;try{const n=t.references.filter(s=>s.name.trim()&&s.content.trim()).map(s=>({name:s.name.trim(),content:s.content})),i=t.name.trim();e.skillAddFormSource==="installed"?(await e.client.request("skills.create",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillDrafts=[],await Ve(e),ot(e,i,{kind:"success",message:"Skill saved — active on next message"})):(await e.client.request("skills.saveDraft",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillDrafts=[],ot(e,i,{kind:"success",message:"Draft saved"}))}catch(n){e.skillsError=Ge(n)}finally{e.skillsBusyKey=null}}}async function Vc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("skills.deleteDraft",{name:t}),e.skillDrafts=e.skillDrafts.filter(n=>n.name!==t)}catch(n){e.skillsError=Ge(n)}}async function Gc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});if(!n)return;e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i}))},e.skillAddFormSource="installed",e.skillAddModal=!0,e.skillDrafts=[]}catch(n){e.skillsError=Ge(n)}}function Qc(e,t){const n=e.skillDetail;n&&(e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i}))},e.skillAddFormSource="installed",e.skillEditTab=t&&t!=="SKILL.md"?t:"SKILL.md",e.skillDetail=null,e.skillDetailTab="",e.skillAddModal=!0,e.skillDrafts=[])}function Yc(e,t,n){e.skillAddForm={...e.skillAddForm,references:e.skillAddForm.references.map(i=>i.name===t?{...i,content:n}:i)}}function Jc(e,t){e.skillEditTab=t}async function Xc(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.delete",{name:t}),await Ve(e)}catch(n){e.skillsError=Ge(n)}finally{e.skillsBusyKey=null}}}const lf=Object.freeze(Object.defineProperty({__proto__:null,closeAddSkillModal:qc,closeSkillDetail:Kc,deleteDraft:Vc,deleteSkill:Xc,editDetailSkill:Qc,editSkill:Gc,emptyAddForm:Bn,importDraft:Hc,installDraft:jc,installSkill:Oc,loadSkills:Ve,openAddSkillModal:zc,saveNewSkill:Go,saveSkillApiKey:Fc,setEditTab:Jc,setSkillDetailTab:Wc,updateFormReference:Yc,updateSkillEdit:Bc,updateSkillEnabled:Nc,viewSkillDetail:Uc},Symbol.toStringTag,{value:"Module"})),Zc={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},ed=new Map(Object.entries(Zc).map(([e,t])=>[t,e]));function Ji(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Nn(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 cf(e,t=""){const n=Ji(t),i=Zc[e];return n?`${n}${i}`:i}function td(e,t=""){const n=Ji(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=Nn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":ed.get(s)??null}function df(e){let t=Nn(e);if(t.endsWith("/index.html")&&(t=Nn(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(ed.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function uf(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Qo(e){return e==="system"?uf():e}const ii=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,pf=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,si=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},hf=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var c;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,a=s,r=pf();if(!!a.startViewTransition&&!r){let l=.5,p=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")l=ii(n.pointerClientX/window.innerWidth),p=ii(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const f=n.element.getBoundingClientRect();f.width>0&&f.height>0&&typeof window<"u"&&(l=ii((f.left+f.width/2)/window.innerWidth),p=ii((f.top+f.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${l*100}%`),o.style.setProperty("--theme-switch-y",`${p*100}%`),o.classList.add("theme-transition");try{const f=(c=a.startViewTransition)==null?void 0:c.call(a,()=>{t()});f!=null&&f.finished?f.finished.finally(()=>si(o)):si(o)}catch{si(o),t()}return}t(),si(o)},ff=2e3;async function xn(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),o=Array.isArray(s.entries)?s.entries:[],a=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=a?o:[...e.sessionLogsEntries,...o].slice(-ff),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 nd=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:xn},Symbol.toStringTag,{value:"Module"}));async function id(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 gf(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Fe(e){return e instanceof Error?e.message:String(e)}let oi=null;function Jt(e,t){oi&&clearTimeout(oi),e.filesMessage={kind:"success",text:t},oi=setTimeout(()=>{e.filesMessage=null,oi=null},3e3)}async function Xt(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=Fe(n)}finally{e.filesLoading=!1}}}}async function mf(e,t,n){e.filesSelectedPaths=new Set([t]),await sd(e,t,n)}async function yf(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 sd(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function vf(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const o of n)try{await od(e,o,t),i++}catch(a){s=Fe(a)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:Jt(e,`${i} file${i!==1?"s":""} downloaded`)}async function bf(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await Sf(e,t,o,i)}async function sd(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=Fe(i)}finally{e.filesPreviewLoading=!1}}}async function od(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 o=Uint8Array.from(atob(s.base64),c=>c.charCodeAt(0)),a=new Blob([o]),r=URL.createObjectURL(a),d=document.createElement("a");d.href=r,d.download=s.name??t.split("/").pop()??"download",document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(r)}catch(i){e.filesMessage={kind:"error",text:Fe(i)}}}async function wf(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const a of n)try{const r=await a.arrayBuffer(),d=btoa(new Uint8Array(r).reduce((l,p)=>l+String.fromCharCode(p),"")),c={path:t,name:a.name,data:d};i&&(c.agentId=i),await e.client.request("files.upload",c),s++}catch(r){o=Fe(r)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:Jt(e,`${s} file${s!==1?"s":""} uploaded`),await Xt(e,i)}async function kf(e,t,n,i){if(!e.client||!e.connected)return;e.filesMessage=null;const s=t==="."?n:`${t}/${n}`;try{const o={path:s};i&&(o.agentId=i),await e.client.request("files.mkdir",o),Jt(e,`Created ${s}`),await Xt(e,i),e.filesExpandedDirs=new Set([...e.filesExpandedDirs,s]),e.filesCurrentDir=s}catch(o){e.filesMessage={kind:"error",text:Fe(o)}}}async function $f(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),Jt(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await Xt(e,n)}catch(i){e.filesMessage={kind:"error",text:Fe(i)}}}}async function Sf(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),Jt(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await Xt(e,i)}catch(s){e.filesMessage={kind:"error",text:Fe(s)}}}}async function Yo(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,syncing:i.syncing,syncProgress:i.syncProgress,files:i.files??0,chunks:i.chunks??0,model:i.model,embeddingState:i.embeddingState})}catch{}}async function xf(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,o=(i==null?void 0:i.chunks)??0;Jt(e,`Re-indexed: ${s} files, ${o} chunks`),await Yo(e,t)}catch(n){e.filesMessage={kind:"error",text:Fe(n)}}finally{e.filesReindexBusy=!1}}}function Af(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n,e.filesCurrentDir=t}async function Cf(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:Fe(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function Ef(e){e.filesSearchQuery="",e.filesSearchResults=null}function Tf(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Vo(e,{quiet:!0})},5e3))}function _f(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Jo(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&zt(e,{quiet:!0})},2e3))}function Xo(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Zo(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||xn(e,{quiet:!0})},2e3))}function ea(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function ta(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Uo(e)},3e3))}function na(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Mf(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{id(e)},3e4))}function Pf(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function Lf(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{if(e.tab!=="files")return;const t=e;Yo(t,t.filesResolvedAgentId)},3e3))}function If(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function nt(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,Ep(n),t.theme!==e.theme&&(e.theme=t.theme,Xi(e,Qo(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function ad(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&nt(e,{...e.settings,lastActiveSessionKey:n})}function Rf(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"),o=t.get("gatewayUrl");let a=!1;if(n!=null){const d=n.trim();d&&d!==e.settings.token&&nt(e,{...e.settings,token:d}),t.delete("token"),a=!0}if(i!=null){const d=i.trim();d&&(e.password=d),t.delete("password"),a=!0}if(s!=null){const d=s.trim();d&&(e.sessionKey=d,nt(e,{...e.settings,sessionKey:d,lastActiveSessionKey:d}))}if(o!=null){const d=o.trim();d&&d!==e.settings.gatewayUrl&&nt(e,{...e.settings,gatewayUrl:d}),t.delete("gatewayUrl"),a=!0}if(!a)return;const r=new URL(window.location.href);r.search=t.toString(),window.history.replaceState({},"",r.toString())}function Df(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Zo(e):Jo(e):(Xo(e),ea(e)),t==="debug"?ta(e):na(e),_i(e),ld(e,t,!1)}function Bf(e,t,n){hf({nextTheme:t,applyTheme:()=>{e.theme=t,nt(e,{...e.settings,theme:t}),Xi(e,Qo(t))},context:n,currentTheme:e.theme})}async function _i(e){if(e.tab==="overview"&&await cd(e),e.tab==="channels"&&await zf(e),e.tab==="instances"&&await Dc(e),e.tab==="cron"&&await ia(e),e.tab==="skills"&&await Ve(e),e.tab==="nodes"&&(await Vo(e),await jo(e),await Ne(e),await af(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await Gf(e),Qt(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await uc(e),await Ne(e)),e.tab==="debug"&&(await Uo(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await oe(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>nd);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await zt(e,{reset:!0});cc(e,!0)}}function Nf(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Ji(e):df(window.location.pathname)}function Ff(e){e.theme=e.settings.theme??"system",Xi(e,Qo(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 Of(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 Uf(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 Kf(e,t){if(typeof window>"u")return;const n=td(window.location.pathname,e.basePath)??"chat";rd(e,n),ld(e,n,t)}function Wf(e){var s;if(typeof window>"u")return;const t=td(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,nt(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),rd(e,t)}function rd(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Zo(e):Jo(e):(Xo(e),ea(e)),t==="debug"?ta(e):na(e),e.connected&&_i(e)}function ld(e,t,n){if(typeof window>"u")return;const i=Nn(cf(t,e.basePath)),s=Nn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),s!==i&&(o.pathname=i),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}async function cd(e){await Promise.all([Y(e,!1),Dc(e),No(e),Yt(e),Uo(e)])}async function zf(e){await Promise.all([Y(e,!0),uc(e),Ne(e)])}async function ia(e){await Promise.all([Y(e,!1),Yt(e),Fn(e)])}function dd(e){return e.chatSending||!!e.chatRunId}function qf(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 ud(e){e.connected&&(e.chatMessage="",await rc(e))}function Hf(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:Qi(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],Qt(e))}async function pd(e,t,n){var s,o;Fo(e);const i=await ac(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&&ad(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((o=n.previousAttachments)!=null&&o.length)&&(e.chatAttachments=n.previousAttachments),Qt(e),i&&!e.chatRunId&&hd(e),i}async function hd(e){if(!e.connected||dd(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await pd(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function jf(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Vf(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],a=t==null?o:[],r=a.length>0;if(!(!s&&!r)){if(qf(s)){await ud(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[],_p(e.selectedWorkspace??"",e.sessionKey)),dd(e)){Hf(e,s,a);return}await pd(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:r?a:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function Gf(e){var i;const t=e,n=Math.max((((i=t.chatMessages)==null?void 0:i.length)??0)+10,Be);await Promise.all([De(t,{limit:n}),No(t),po(e)]),Qt(e,!0)}const Qf=hd;function Yf(e){var s,o,a;const t=Xl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((a=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:a.trim())||"main"}function Jf(e,t){const n=Ji(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function po(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Yf(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Jf(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),o=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const P={messageSquare:u`<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:u`<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:u`<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>`,unlink:u`<svg viewBox="0 0 24 24"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"/><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"/><line x1="8" x2="8" y1="2" y2="5"/><line x1="2" x2="5" y1="8" y2="8"/><line x1="16" x2="16" y1="19" y2="22"/><line x1="19" x2="22" y1="16" y2="16"/></svg>`,radio:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:u`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:u`<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:u`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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>`,globeOff:u`<svg viewBox="0 0 24 24"><path d="M21.54 15H17"/><path d="M7 3.34V5a3 3 0 0 0 3 3 2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:u`<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:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:u`<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:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:u`<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:u`<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:u`<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>`,mic:u`<svg viewBox="0 0 24 24"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,chevronDown:u`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:u`<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>`,wifi:u`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.859a10 10 0 0 1 14 0"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/></svg>`,wifiOff:u`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/><path d="M5 12.859a10 10 0 0 1 5.17-2.69"/><path d="M13.41 10.28a10 10 0 0 1 5.59 2.58"/><path d="M2 8.82a15 15 0 0 1 4.17-2.65"/><path d="M10.66 5c4.01-.36 8.14.9 11.34 3.76"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,power:u`<svg viewBox="0 0 24 24"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"/><line x1="12" x2="12" y1="2" y2="12"/></svg>`,powerOff:u`<svg viewBox="0 0 24 24"><path d="M18.36 6.64A9 9 0 0 1 20.77 15"/><path d="M6.16 6.16a9 9 0 1 0 12.68 12.68"/><path d="M12 2v4"/><path d="m2 2 20 20"/></svg>`},Xf=u`<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>`,Zf=u`<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 mr=!1;function eg(){mr||(mr=!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 _t(e,t){var l;const n=(p,f)=>p===e?u`<span class="sp-page-nav-current">${p}</span>`:u`<a href=${f}>${p}</a>`,i=u`
|
|
19
|
+
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-session-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function uh(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 st(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function St(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
20
|
+
`}function dc(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const a=t[o],r=t[o+1];if(typeof a=="number"){if(!Array.isArray(i))return;i[a]==null&&(i[a]=typeof r=="number"?[]:{}),i=i[a]}else{if(typeof i!="object"||i==null)return;const d=i;d[a]==null&&(d[a]=typeof r=="number"?[]:{}),i=d[a]}}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 Fe(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});hh(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function uc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});ph(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function ph(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function hh(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?St(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=St(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=st(t.config??{}),e.configFormOriginal=st(t.config??{}),e.configRawOriginal=n)}async function fh(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?St(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 Fe(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function Jt(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 Fn(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 pc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=Ai(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 hc(e){if(e.payloadKind==="systemEvent"){const o=e.payloadText.trim();if(!o)throw new Error("System event text required.");return{kind:"systemEvent",text:o}}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);const i=[];e.toAdmins&&i.push("admins");for(const o of e.recipients){const a=o.trim();a&&i.push(a)}i.length>0&&(n.to=i.join(","));const s=Ai(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function gh(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=pc(e.cronForm),i=hc(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:o||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(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Fn(e),await Jt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function mh(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 Fn(e),await Jt(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function yh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null,e.cronRunModalJobId=t.id,e.cronRunModalJobName=t.name||"Untitled",e.cronRunResult=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await ao(e,t.id)}catch(n){e.cronError=String(n),e.cronRunResult={status:"error",error:String(n)}}finally{e.cronBusy=!1}}}function vh(e,t){e.cronRunModalJobId&&t.jobId===e.cronRunModalJobId&&t.action==="finished"&&(e.cronRunResult={status:t.status??"unknown",durationMs:t.durationMs,summary:t.summary,error:t.error})}async function bh(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 Fn(e),await Jt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}function wh(e){var n;const t={name:e.name||"",description:e.description||"",agentId:e.agentId||"",enabled:e.enabled,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"",cronTz:"",sessionTarget:e.sessionTarget||"main",wakeMode:e.wakeMode||"next-heartbeat",payloadKind:e.payload.kind,payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};if(e.schedule.kind==="at"){const i=new Date(e.schedule.atMs),s=o=>String(o).padStart(2,"0");t.scheduleAt=`${i.getFullYear()}-${s(i.getMonth()+1)}-${s(i.getDate())}T${s(i.getHours())}:${s(i.getMinutes())}`}else if(e.schedule.kind==="every"){const i=e.schedule.everyMs;i%864e5===0?(t.everyAmount=String(i/864e5),t.everyUnit="days"):i%36e5===0?(t.everyAmount=String(i/36e5),t.everyUnit="hours"):(t.everyAmount=String(i/6e4),t.everyUnit="minutes")}else e.schedule.kind==="cron"&&(t.cronExpr=e.schedule.expr,t.cronTz=e.schedule.tz||"");if(e.payload.kind==="systemEvent")t.payloadText=e.payload.text;else if(e.payload.kind==="agentTurn"){t.payloadText=e.payload.message,t.deliver=e.payload.deliver??!1,t.timeoutSeconds=e.payload.timeoutSeconds?String(e.payload.timeoutSeconds):"";const i=e.payload.channel??e.payload.provider;t.channel=i||"last";const s=e.payload.to||"";if(s){const o=s.split(",").map(a=>a.trim()).filter(Boolean);t.toAdmins=o.some(a=>a.toLowerCase()==="admins"),t.recipients=o.filter(a=>a.toLowerCase()!=="admins")}}return(n=e.isolation)!=null&&n.postToMainPrefix&&(t.postToMainPrefix=e.isolation.postToMainPrefix),t}async function kh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=pc(e.cronForm),i=hc(e.cronForm),s={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:e.cronForm.agentId.trim()||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i};if(e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?s.isolation={postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:s.isolation=void 0,!s.name)throw new Error("Name required.");await e.client.request("cron.update",{id:t,patch:s}),await Fn(e),await Jt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ao(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 J(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 Oo(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 fc(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 gc(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 mc(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 o=st(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const a=o.channels;(!a.whatsapp||typeof a.whatsapp!="object")&&(a.whatsapp={});const r=a.whatsapp;(!r.accounts||typeof r.accounts!="object")&&(r.accounts={});const d=r.accounts;if(d[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}d[i]={name:n,provider:"baileys"};const c=s.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const l=St(o);await e.client.request("config.set",{raw:l,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await J(e,!0),await Oo(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function yc(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=st(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,a=o==null?void 0:o.accounts;if(!a){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(a).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!a[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete a[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(l=>{const p=l.match;return!p||p.channel!=="whatsapp"?!0:p.accountId!==t}));const d=n.hash;if(!d){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=St(i);await e.client.request("config.set",{raw:c,baseHash:d}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await J(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const $h=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:mc,loadChannels:J,logoutWhatsApp:gc,removeWhatsAppAccount:yc,startWhatsAppLogin:Oo,waitWhatsAppLogin:fc},Symbol.toStringTag,{value:"Module"}));async function Uo(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 o=i;e.debugModels=Array.isArray(o==null?void 0:o.models)?o==null?void 0:o.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const Sh=2e3,xh=new Set(["trace","debug","info","warn","error","fatal"]);function Ah(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 Ch(e){if(typeof e!="string")return null;const t=e.toLowerCase();return xh.has(t)?t:null}function vc(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=Ch((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),o=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,a=Ah(o);let r=null;a&&(typeof a.subsystem=="string"?r=a.subsystem:typeof a.module=="string"&&(r=a.module)),!r&&o&&o.length<120&&(r=o);let d=null;return typeof t[1]=="string"?d=t[1]:!a&&typeof t[0]=="string"?d=t[0]:typeof t.message=="string"&&(d=t.message),{raw:e,time:i,level:s,subsystem:r,message:d??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function qt(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}),o=(Array.isArray(i.lines)?i.lines.filter(r=>typeof r=="string"):[]).map(vc),a=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=a?o:[...e.logsEntries,...o].slice(-Sh),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 Eh=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:qt,parseLogLine:vc},Symbol.toStringTag,{value:"Module"}));const bc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ce,n:mi,Gx:dr,Gy:ur,a:As,d:Cs,h:Th}=bc,xt=32,Ko=64,_h=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},se=(e="")=>{const t=new Error(e);throw _h(t,se),t},Mh=e=>typeof e=="bigint",Ph=e=>typeof e=="string",Lh=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",at=(e,t,n="")=>{const i=Lh(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const a=n&&`"${n}" `,r=o?` of length ${t}`:"",d=i?`length=${s}`:`type=${typeof e}`;se(a+"expected Uint8Array"+r+", got "+d)}return e},Yi=e=>new Uint8Array(e),wc=e=>Uint8Array.from(e),kc=(e,t)=>e.toString(16).padStart(t,"0"),$c=e=>Array.from(at(e)).map(t=>kc(t,2)).join(""),ze={_0:48,_9:57,A:65,F:70,a:97,f:102},pr=e=>{if(e>=ze._0&&e<=ze._9)return e-ze._0;if(e>=ze.A&&e<=ze.F)return e-(ze.A-10);if(e>=ze.a&&e<=ze.f)return e-(ze.a-10)},Sc=e=>{const t="hex invalid";if(!Ph(e))return se(t);const n=e.length,i=n/2;if(n%2)return se(t);const s=Yi(i);for(let o=0,a=0;o<i;o++,a+=2){const r=pr(e.charCodeAt(a)),d=pr(e.charCodeAt(a+1));if(r===void 0||d===void 0)return se(t);s[o]=r*16+d}return s},xc=()=>globalThis==null?void 0:globalThis.crypto,Ih=()=>{var e;return((e=xc())==null?void 0:e.subtle)??se("crypto.subtle must be defined, consider polyfill")},Dn=(...e)=>{const t=Yi(e.reduce((i,s)=>i+at(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},Rh=(e=xt)=>xc().getRandomValues(Yi(e)),Ei=BigInt,ft=(e,t,n,i="bad number: out of range")=>Mh(e)&&t<=e&&e<n?e:se(i),I=(e,t=ce)=>{const n=e%t;return n>=0n?n:t+n},Ac=e=>I(e,mi),Dh=(e,t)=>{(e===0n||t<=0n)&&se("no inverse n="+e+" mod="+t);let n=I(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const a=i/n,r=i%n,d=s-o*a;i=n,n=r,s=o,o=d}return i===1n?I(s,t):se("no inverse")},Bh=e=>{const t=_c[e];return typeof t!="function"&&se("hashes."+e+" not set"),t},Es=e=>e instanceof At?e:se("Point expected"),ro=2n**256n,De=class De{constructor(t,n,i,s){K(this,"X");K(this,"Y");K(this,"Z");K(this,"T");const o=ro;this.X=ft(t,0n,o),this.Y=ft(n,0n,o),this.Z=ft(i,1n,o),this.T=ft(s,0n,o),Object.freeze(this)}static CURVE(){return bc}static fromAffine(t){return new De(t.x,t.y,1n,I(t.x*t.y))}static fromBytes(t,n=!1){const i=Cs,s=wc(at(t,xt)),o=t[31];s[31]=o&-129;const a=Ec(s);ft(a,0n,n?ro:ce);const d=I(a*a),c=I(d-1n),l=I(i*d+1n);let{isValid:p,value:h}=Fh(c,l);p||se("bad point: y not sqrt");const v=(h&1n)===1n,S=(o&128)!==0;return!n&&h===0n&&S&&se("bad point: x==0, isLastByteOdd"),S!==v&&(h=I(-h)),new De(h,a,1n,I(h*a))}static fromHex(t,n){return De.fromBytes(Sc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=As,n=Cs,i=this;if(i.is0())return se("bad point: ZERO");const{X:s,Y:o,Z:a,T:r}=i,d=I(s*s),c=I(o*o),l=I(a*a),p=I(l*l),h=I(d*t),v=I(l*I(h+c)),S=I(p+I(n*I(d*c)));if(v!==S)return se("bad point: equation left != right (1)");const f=I(s*o),w=I(a*r);return f!==w?se("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:a,Z:r}=Es(t),d=I(n*r),c=I(o*s),l=I(i*r),p=I(a*s);return d===c&&l===p}is0(){return this.equals(Wt)}negate(){return new De(I(-this.X),this.Y,this.Z,I(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=As,o=I(t*t),a=I(n*n),r=I(2n*I(i*i)),d=I(s*o),c=t+n,l=I(I(c*c)-o-a),p=d+a,h=p-r,v=d-a,S=I(l*h),f=I(p*v),w=I(l*v),b=I(h*p);return new De(S,f,b,w)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:r,Z:d,T:c}=Es(t),l=As,p=Cs,h=I(n*a),v=I(i*r),S=I(o*p*c),f=I(s*d),w=I((n+i)*(a+r)-h-v),b=I(f-S),x=I(f+S),C=I(v-l*h),T=I(w*b),P=I(x*C),_=I(w*C),N=I(b*x);return new De(T,P,N,_)}subtract(t){return this.add(Es(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Wt;if(ft(t,1n,mi),t===1n)return this;if(this.equals(Ct))return Qh(t).p;let i=Wt,s=Ct;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?i=i.add(o):n&&(s=s.add(o));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals(Wt))return{x:0n,y:1n};const s=Dh(i,ce);I(i*s)!==1n&&se("invalid inverse");const o=I(t*s),a=I(n*s);return{x:o,y:a}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Cc(n);return i[31]|=t&1n?128:0,i}toHex(){return $c(this.toBytes())}clearCofactor(){return this.multiply(Ei(Th),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(mi/2n,!1).double();return mi%2n&&(t=t.add(this)),t.is0()}};K(De,"BASE"),K(De,"ZERO");let At=De;const Ct=new At(dr,ur,1n,I(dr*ur)),Wt=new At(0n,1n,1n,0n);At.BASE=Ct;At.ZERO=Wt;const Cc=e=>Sc(kc(ft(e,0n,ro),Ko)).reverse(),Ec=e=>Ei("0x"+$c(wc(at(e)).reverse())),Me=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ce;return n},Nh=e=>{const n=e*e%ce*e%ce,i=Me(n,2n)*n%ce,s=Me(i,1n)*e%ce,o=Me(s,5n)*s%ce,a=Me(o,10n)*o%ce,r=Me(a,20n)*a%ce,d=Me(r,40n)*r%ce,c=Me(d,80n)*d%ce,l=Me(c,80n)*d%ce,p=Me(l,10n)*o%ce;return{pow_p_5_8:Me(p,2n)*e%ce,b2:n}},hr=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Fh=(e,t)=>{const n=I(t*t*t),i=I(n*n*t),s=Nh(e*i).pow_p_5_8;let o=I(e*n*s);const a=I(t*o*o),r=o,d=I(o*hr),c=a===e,l=a===I(-e),p=a===I(-e*hr);return c&&(o=r),(l||p)&&(o=d),(I(o)&1n)===1n&&(o=I(-o)),{isValid:c||l,value:o}},lo=e=>Ac(Ec(e)),Wo=(...e)=>_c.sha512Async(Dn(...e)),Oh=(...e)=>Bh("sha512")(Dn(...e)),Tc=e=>{const t=e.slice(0,xt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(xt,Ko),i=lo(t),s=Ct.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},zo=e=>Wo(at(e,xt)).then(Tc),Uh=e=>Tc(Oh(at(e,xt))),Kh=e=>zo(e).then(t=>t.pointBytes),Wh=e=>Wo(e.hashable).then(e.finish),zh=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=lo(t),a=Ct.multiply(o).toBytes();return{hashable:Dn(a,i,n),finish:c=>{const l=Ac(o+lo(c)*s);return at(Dn(a,Cc(l)),Ko)}}},qh=async(e,t)=>{const n=at(e),i=await zo(t),s=await Wo(i.prefix,n);return Wh(zh(i,s,n))},_c={sha512Async:async e=>{const t=Ih(),n=Dn(e);return Yi(await t.digest("SHA-512",n.buffer))},sha512:void 0},Hh=(e=Rh(xt))=>e,jh={getExtendedPublicKeyAsync:zo,getExtendedPublicKey:Uh,randomSecretKey:Hh},Ti=8,Vh=256,Mc=Math.ceil(Vh/Ti)+1,co=2**(Ti-1),Gh=()=>{const e=[];let t=Ct,n=t;for(let i=0;i<Mc;i++){n=t,e.push(n);for(let s=1;s<co;s++)n=n.add(t),e.push(n);t=n.double()}return e};let fr;const gr=(e,t)=>{const n=t.negate();return e?n:t},Qh=e=>{const t=fr||(fr=Gh());let n=Wt,i=Ct;const s=2**Ti,o=s,a=Ei(s-1),r=Ei(Ti);for(let d=0;d<Mc;d++){let c=Number(e&a);e>>=r,c>co&&(c-=o,e+=1n);const l=d*co,p=l,h=l+Math.abs(c)-1,v=d%2!==0,S=c<0;c===0?i=i.add(gr(v,t[p])):n=n.add(gr(S,t[h]))}return e!==0n&&se("invalid wnaf"),{p:n,f:i}},Ts="taskmaster-device-identity-v1";function uo(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Pc(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 o=0;o<i.length;o+=1)s[o]=i.charCodeAt(o);return s}function Yh(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Lc(e){const t=await crypto.subtle.digest("SHA-256",e);return Yh(new Uint8Array(t))}async function Jh(){const e=jh.randomSecretKey(),t=await Kh(e);return{deviceId:await Lc(t),publicKey:uo(t),privateKey:uo(e)}}async function Xh(){try{const n=localStorage.getItem(Ts);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 Lc(Pc(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(Ts,JSON.stringify(o)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await Jh(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Ts,JSON.stringify(t)),e}async function Zh(e,t){const n=Pc(e),i=new TextEncoder().encode(t),s=await qh(i,n);return uo(s)}const Ic="taskmaster.device.auth.v1";function qo(e){return e.trim()}function ef(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 Ho(){try{const e=window.localStorage.getItem(Ic);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 Rc(e){try{window.localStorage.setItem(Ic,JSON.stringify(e))}catch{}}function tf(e){const t=Ho();if(!t||t.deviceId!==e.deviceId)return null;const n=qo(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function nf(e){const t=qo(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=Ho();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:ef(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Rc(n),s}function sf(e){const t=Ho();if(!t||t.deviceId!==e.deviceId)return;const n=qo(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Rc(i)}async function jo(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 Vo(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 of(e){return{method:"exec.approvals.get",params:{}}}async function af(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=of(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);rf(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function rf(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=st(t.file??{}))}async function Dc(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 ot(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Qe(e){return e instanceof Error?e.message:String(e)}function Bn(){return{name:"",skillContent:"",references:[]}}async function Ge(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=Qe(n)}finally{e.skillsLoading=!1}}}function Bc(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Nc(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 Ge(e),ot(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Qe(i);e.skillsError=s,ot(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Fc(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 Ge(e),ot(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Qe(n);e.skillsError=i,ot(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Oc(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 Ge(e),ot(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=Qe(s);e.skillsError=o,ot(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}async function Uc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});n&&(e.skillDetail=n,e.skillDetailTab="SKILL.md")}catch(n){e.skillsError=Qe(n)}}function Kc(e){e.skillDetail=null,e.skillDetailTab=""}function Wc(e,t){e.skillDetailTab=t}async function zc(e){if(e.skillAddModal=!0,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[],!(!e.client||!e.connected))try{const t=await e.client.request("skills.drafts",{});t&&(e.skillDrafts=t.drafts)}catch{}}function qc(e){e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[]}function Hc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n}))},e.skillAddFormSource="draft"}async function jc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n}))},e.skillAddFormSource="installed",await Go(e)}async function Go(e){if(!e.client||!e.connected)return;const t=e.skillAddForm;if(!(!t.name.trim()||!t.skillContent.trim())){e.skillsBusyKey="__add__",e.skillsError=null;try{const n=t.references.filter(s=>s.name.trim()&&s.content.trim()).map(s=>({name:s.name.trim(),content:s.content})),i=t.name.trim();e.skillAddFormSource==="installed"?(await e.client.request("skills.create",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillDrafts=[],await Ge(e),ot(e,i,{kind:"success",message:"Skill saved — active on next message"})):(await e.client.request("skills.saveDraft",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillDrafts=[],ot(e,i,{kind:"success",message:"Draft saved"}))}catch(n){e.skillsError=Qe(n)}finally{e.skillsBusyKey=null}}}async function Vc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("skills.deleteDraft",{name:t}),e.skillDrafts=e.skillDrafts.filter(n=>n.name!==t)}catch(n){e.skillsError=Qe(n)}}async function Gc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});if(!n)return;e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i}))},e.skillAddFormSource="installed",e.skillAddModal=!0,e.skillDrafts=[]}catch(n){e.skillsError=Qe(n)}}function Qc(e,t){const n=e.skillDetail;n&&(e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i}))},e.skillAddFormSource="installed",e.skillEditTab=t&&t!=="SKILL.md"?t:"SKILL.md",e.skillDetail=null,e.skillDetailTab="",e.skillAddModal=!0,e.skillDrafts=[])}function Yc(e,t,n){e.skillAddForm={...e.skillAddForm,references:e.skillAddForm.references.map(i=>i.name===t?{...i,content:n}:i)}}function Jc(e,t){e.skillEditTab=t}async function Xc(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.delete",{name:t}),await Ge(e)}catch(n){e.skillsError=Qe(n)}finally{e.skillsBusyKey=null}}}const lf=Object.freeze(Object.defineProperty({__proto__:null,closeAddSkillModal:qc,closeSkillDetail:Kc,deleteDraft:Vc,deleteSkill:Xc,editDetailSkill:Qc,editSkill:Gc,emptyAddForm:Bn,importDraft:Hc,installDraft:jc,installSkill:Oc,loadSkills:Ge,openAddSkillModal:zc,saveNewSkill:Go,saveSkillApiKey:Fc,setEditTab:Jc,setSkillDetailTab:Wc,updateFormReference:Yc,updateSkillEdit:Bc,updateSkillEnabled:Nc,viewSkillDetail:Uc},Symbol.toStringTag,{value:"Module"})),Zc={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},ed=new Map(Object.entries(Zc).map(([e,t])=>[t,e]));function Ji(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Nn(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 cf(e,t=""){const n=Ji(t),i=Zc[e];return n?`${n}${i}`:i}function td(e,t=""){const n=Ji(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=Nn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":ed.get(s)??null}function df(e){let t=Nn(e);if(t.endsWith("/index.html")&&(t=Nn(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(ed.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function uf(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Qo(e){return e==="system"?uf():e}const ii=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,pf=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,si=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},hf=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var c;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,a=s,r=pf();if(!!a.startViewTransition&&!r){let l=.5,p=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")l=ii(n.pointerClientX/window.innerWidth),p=ii(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const h=n.element.getBoundingClientRect();h.width>0&&h.height>0&&typeof window<"u"&&(l=ii((h.left+h.width/2)/window.innerWidth),p=ii((h.top+h.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${l*100}%`),o.style.setProperty("--theme-switch-y",`${p*100}%`),o.classList.add("theme-transition");try{const h=(c=a.startViewTransition)==null?void 0:c.call(a,()=>{t()});h!=null&&h.finished?h.finished.finally(()=>si(o)):si(o)}catch{si(o),t()}return}t(),si(o)},ff=2e3;async function xn(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),o=Array.isArray(s.entries)?s.entries:[],a=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=a?o:[...e.sessionLogsEntries,...o].slice(-ff),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 nd=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:xn},Symbol.toStringTag,{value:"Module"}));async function id(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 gf(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Oe(e){return e instanceof Error?e.message:String(e)}let oi=null;function Xt(e,t){oi&&clearTimeout(oi),e.filesMessage={kind:"success",text:t},oi=setTimeout(()=>{e.filesMessage=null,oi=null},3e3)}async function Zt(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=Oe(n)}finally{e.filesLoading=!1}}}}async function mf(e,t,n){e.filesSelectedPaths=new Set([t]),await sd(e,t,n)}async function yf(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 sd(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function vf(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const o of n)try{await od(e,o,t),i++}catch(a){s=Oe(a)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:Xt(e,`${i} file${i!==1?"s":""} downloaded`)}async function bf(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await Sf(e,t,o,i)}async function sd(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=Oe(i)}finally{e.filesPreviewLoading=!1}}}async function od(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 o=Uint8Array.from(atob(s.base64),c=>c.charCodeAt(0)),a=new Blob([o]),r=URL.createObjectURL(a),d=document.createElement("a");d.href=r,d.download=s.name??t.split("/").pop()??"download",document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(r)}catch(i){e.filesMessage={kind:"error",text:Oe(i)}}}async function wf(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const a of n)try{const r=await a.arrayBuffer(),d=btoa(new Uint8Array(r).reduce((l,p)=>l+String.fromCharCode(p),"")),c={path:t,name:a.name,data:d};i&&(c.agentId=i),await e.client.request("files.upload",c),s++}catch(r){o=Oe(r)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:Xt(e,`${s} file${s!==1?"s":""} uploaded`),await Zt(e,i)}async function kf(e,t,n,i){if(!e.client||!e.connected)return;e.filesMessage=null;const s=t==="."?n:`${t}/${n}`;try{const o={path:s};i&&(o.agentId=i),await e.client.request("files.mkdir",o),Xt(e,`Created ${s}`),await Zt(e,i),e.filesExpandedDirs=new Set([...e.filesExpandedDirs,s]),e.filesCurrentDir=s}catch(o){e.filesMessage={kind:"error",text:Oe(o)}}}async function $f(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),Xt(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await Zt(e,n)}catch(i){e.filesMessage={kind:"error",text:Oe(i)}}}}async function Sf(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),Xt(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await Zt(e,i)}catch(s){e.filesMessage={kind:"error",text:Oe(s)}}}}async function Yo(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,syncing:i.syncing,syncProgress:i.syncProgress,files:i.files??0,chunks:i.chunks??0,model:i.model,embeddingState:i.embeddingState})}catch{}}async function xf(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,o=(i==null?void 0:i.chunks)??0;Xt(e,`Re-indexed: ${s} files, ${o} chunks`),await Yo(e,t)}catch(n){e.filesMessage={kind:"error",text:Oe(n)}}finally{e.filesReindexBusy=!1}}}function Af(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n,e.filesCurrentDir=t}async function Cf(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:Oe(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function Ef(e){e.filesSearchQuery="",e.filesSearchResults=null}function Tf(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Vo(e,{quiet:!0})},5e3))}function _f(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Jo(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&qt(e,{quiet:!0})},2e3))}function Xo(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Zo(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||xn(e,{quiet:!0})},2e3))}function ea(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function ta(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Uo(e)},3e3))}function na(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Mf(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{id(e)},3e4))}function Pf(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function Lf(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{if(e.tab!=="files")return;const t=e;Yo(t,t.filesResolvedAgentId)},3e3))}function If(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function nt(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,Ep(n),t.theme!==e.theme&&(e.theme=t.theme,Xi(e,Qo(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function ad(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&nt(e,{...e.settings,lastActiveSessionKey:n})}function Rf(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"),o=t.get("gatewayUrl");let a=!1;if(n!=null){const d=n.trim();d&&d!==e.settings.token&&nt(e,{...e.settings,token:d}),t.delete("token"),a=!0}if(i!=null){const d=i.trim();d&&(e.password=d),t.delete("password"),a=!0}if(s!=null){const d=s.trim();d&&(e.sessionKey=d,nt(e,{...e.settings,sessionKey:d,lastActiveSessionKey:d}))}if(o!=null){const d=o.trim();d&&d!==e.settings.gatewayUrl&&nt(e,{...e.settings,gatewayUrl:d}),t.delete("gatewayUrl"),a=!0}if(!a)return;const r=new URL(window.location.href);r.search=t.toString(),window.history.replaceState({},"",r.toString())}function Df(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Zo(e):Jo(e):(Xo(e),ea(e)),t==="debug"?ta(e):na(e),_i(e),ld(e,t,!1)}function Bf(e,t,n){hf({nextTheme:t,applyTheme:()=>{e.theme=t,nt(e,{...e.settings,theme:t}),Xi(e,Qo(t))},context:n,currentTheme:e.theme})}async function _i(e){if(e.tab==="overview"&&await cd(e),e.tab==="channels"&&await zf(e),e.tab==="instances"&&await Dc(e),e.tab==="cron"&&await ia(e),e.tab==="skills"&&await Ge(e),e.tab==="nodes"&&(await Vo(e),await jo(e),await Fe(e),await af(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await Gf(e),Yt(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await uc(e),await Fe(e)),e.tab==="debug"&&(await Uo(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await ae(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>nd);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await qt(e,{reset:!0});cc(e,!0)}}function Nf(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Ji(e):df(window.location.pathname)}function Ff(e){e.theme=e.settings.theme??"system",Xi(e,Qo(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 Of(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 Uf(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 Kf(e,t){if(typeof window>"u")return;const n=td(window.location.pathname,e.basePath)??"chat";rd(e,n),ld(e,n,t)}function Wf(e){var s;if(typeof window>"u")return;const t=td(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,nt(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),rd(e,t)}function rd(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Zo(e):Jo(e):(Xo(e),ea(e)),t==="debug"?ta(e):na(e),e.connected&&_i(e)}function ld(e,t,n){if(typeof window>"u")return;const i=Nn(cf(t,e.basePath)),s=Nn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),s!==i&&(o.pathname=i),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}async function cd(e){await Promise.all([J(e,!1),Dc(e),No(e),Jt(e),Uo(e)])}async function zf(e){await Promise.all([J(e,!0),uc(e),Fe(e)])}async function ia(e){await Promise.all([J(e,!1),Jt(e),Fn(e)])}function dd(e){return e.chatSending||!!e.chatRunId}function qf(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 ud(e){e.connected&&(e.chatMessage="",await rc(e))}function Hf(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:Qi(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],Yt(e))}async function pd(e,t,n){var s,o;Fo(e);const i=await ac(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&&ad(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((o=n.previousAttachments)!=null&&o.length)&&(e.chatAttachments=n.previousAttachments),Yt(e),i&&!e.chatRunId&&hd(e),i}async function hd(e){if(!e.connected||dd(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await pd(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function jf(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Vf(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],a=t==null?o:[],r=a.length>0;if(!(!s&&!r)){if(qf(s)){await ud(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[],_p(e.selectedWorkspace??"",e.sessionKey)),dd(e)){Hf(e,s,a);return}await pd(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:r?a:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function Gf(e){var i;const t=e,n=Math.max((((i=t.chatMessages)==null?void 0:i.length)??0)+10,Ne);await Promise.all([Be(t,{limit:n}),No(t),po(e)]),Yt(e,!0)}const Qf=hd;function Yf(e){var s,o,a;const t=Xl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((a=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:a.trim())||"main"}function Jf(e,t){const n=Ji(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function po(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Yf(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Jf(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),o=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const L={messageSquare:u`<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:u`<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:u`<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>`,unlink:u`<svg viewBox="0 0 24 24"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"/><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"/><line x1="8" x2="8" y1="2" y2="5"/><line x1="2" x2="5" y1="8" y2="8"/><line x1="16" x2="16" y1="19" y2="22"/><line x1="19" x2="22" y1="16" y2="16"/></svg>`,radio:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:u`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:u`<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:u`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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:u`<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>`,globeOff:u`<svg viewBox="0 0 24 24"><path d="M21.54 15H17"/><path d="M7 3.34V5a3 3 0 0 0 3 3 2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:u`<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:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:u`<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:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:u`<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:u`<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:u`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:u`<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:u`<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:u`<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>`,mic:u`<svg viewBox="0 0 24 24"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,chevronDown:u`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:u`<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>`,wifi:u`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.859a10 10 0 0 1 14 0"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/></svg>`,wifiOff:u`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/><path d="M5 12.859a10 10 0 0 1 5.17-2.69"/><path d="M13.41 10.28a10 10 0 0 1 5.59 2.58"/><path d="M2 8.82a15 15 0 0 1 4.17-2.65"/><path d="M10.66 5c4.01-.36 8.14.9 11.34 3.76"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,power:u`<svg viewBox="0 0 24 24"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"/><line x1="12" x2="12" y1="2" y2="12"/></svg>`,powerOff:u`<svg viewBox="0 0 24 24"><path d="M18.36 6.64A9 9 0 0 1 20.77 15"/><path d="M6.16 6.16a9 9 0 1 0 12.68 12.68"/><path d="M12 2v4"/><path d="m2 2 20 20"/></svg>`},Xf=u`<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>`,Zf=u`<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 mr=!1;function eg(){mr||(mr=!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 Mt(e,t){var l;const n=(p,h)=>p===e?u`<span class="sp-page-nav-current">${p}</span>`:u`<a href=${h}>${p}</a>`,i=u`
|
|
21
21
|
${n("Setup","/setup")}
|
|
22
22
|
${n("Chat","/chat")}
|
|
23
23
|
${n("Admins","/admins")}
|
|
@@ -25,19 +25,19 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
25
25
|
${n("Files","/files")}
|
|
26
26
|
${n("Browser","/browser")}
|
|
27
27
|
${n("Advanced","/advanced")}
|
|
28
|
-
`,o=t&&(t.isMaster!==!1||!t.hasPins)?tg(t):
|
|
28
|
+
`,o=t&&(t.isMaster!==!1||!t.hasPins)?tg(t):k,a=t!=null&&t.hasPins&&t.onLogout?u`<button class="nav-logout-btn" @click=${t.onLogout} title="Lock">${Xf}</button>`:k,r=(t==null?void 0:t.auditCount)??0,d=r>0&&(t!=null&&t.onAuditClick)?u`<button class="nav-audit-btn" @click=${t.onAuditClick} title="Memory writes to review">
|
|
29
29
|
${Zf}
|
|
30
30
|
<span class="nav-audit-badge">${r>99?"99+":r}</span>
|
|
31
|
-
</button>`:
|
|
31
|
+
</button>`:k,c=()=>{const p=document.getElementById("nav-burger-toggle");p&&(p.checked=!1)};return eg(),u`
|
|
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">
|
|
35
|
-
<img class="setup-header-logo" src="${(t==null?void 0:t.selectedWorkspace)&&((l=
|
|
35
|
+
<img class="setup-header-logo" src="${(t==null?void 0:t.selectedWorkspace)&&((l=Re()[t.selectedWorkspace])==null?void 0:l.logoUrl)||Ve().iconUrl}" alt="${Ve().name}" />
|
|
36
36
|
<nav class="setup-header-nav">
|
|
37
37
|
${i}
|
|
38
38
|
</nav>
|
|
39
39
|
<div class="setup-header-right">
|
|
40
|
-
${o!==
|
|
40
|
+
${o!==k?u`<span class="nav-selector-inline">${o}</span>`:k}
|
|
41
41
|
${d}
|
|
42
42
|
${a}
|
|
43
43
|
<label for="nav-burger-toggle" class="nav-burger-button" aria-label="Toggle menu">
|
|
@@ -46,7 +46,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
<nav class="setup-header-dropdown" @click=${c}>
|
|
49
|
-
${o!==
|
|
49
|
+
${o!==k?u`<div class="nav-selector-mobile">${o}</div>`:k}
|
|
50
50
|
${i}
|
|
51
51
|
</nav>
|
|
52
52
|
</div>
|
|
@@ -106,7 +106,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
106
106
|
</div>
|
|
107
107
|
`:u`
|
|
108
108
|
<div class="setup-container">
|
|
109
|
-
${
|
|
109
|
+
${Mt("Browser")}
|
|
110
110
|
<div class="setup-card sp-card-wide">
|
|
111
111
|
<h1>Remote Browser</h1>
|
|
112
112
|
<p style="margin-bottom: 16px;">Live view of the headless Chrome instance.</p>
|
|
@@ -147,7 +147,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
147
147
|
`}
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
|
-
${e.error?u`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:
|
|
150
|
+
${e.error?u`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:k}
|
|
151
151
|
|
|
152
152
|
${e.handoffPending?u`
|
|
153
153
|
<div class="setup-warning" style="margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;">
|
|
@@ -158,7 +158,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
158
158
|
Done
|
|
159
159
|
</button>
|
|
160
160
|
</div>
|
|
161
|
-
`:
|
|
161
|
+
`:k}
|
|
162
162
|
|
|
163
163
|
<div class="sp-canvas-area" style="margin-top: 16px;">
|
|
164
164
|
${e.active?u`
|
|
@@ -177,7 +177,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
177
177
|
</div>
|
|
178
178
|
`:u`
|
|
179
179
|
<div class="sp-canvas-placeholder">
|
|
180
|
-
<div class="sp-canvas-placeholder-icon">${
|
|
180
|
+
<div class="sp-canvas-placeholder-icon">${L.globe}</div>
|
|
181
181
|
<p>Click Start to begin streaming the Chrome viewport.</p>
|
|
182
182
|
</div>
|
|
183
183
|
`}
|
|
@@ -185,7 +185,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
185
185
|
|
|
186
186
|
${e.active&&e.inputMode?u`<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
|
-
</p>`:
|
|
188
|
+
</p>`:k}
|
|
189
189
|
|
|
190
190
|
</div>
|
|
191
191
|
</div>
|
|
@@ -196,7 +196,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
196
196
|
<p>Connecting to gateway...</p>
|
|
197
197
|
</div>
|
|
198
198
|
</div>
|
|
199
|
-
`}const Mi="application/x-taskmaster-file-path";let
|
|
199
|
+
`}const Mi="application/x-taskmaster-file-path";let pt=null;function fd(e){return e==null?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function gd(e){const t=e.split("/");return t.length>1?t.slice(0,-1).join("/"):"."}function ig(e,t,n){var o,a;e.preventDefault(),e.stopPropagation(),e.currentTarget.classList.remove("sp-drop-target");const i=(o=e.dataTransfer)==null?void 0:o.getData(Mi);if(i){gd(i)!==t&&n.onMoveToDir(i,t);return}const s=(a=e.dataTransfer)==null?void 0:a.files;if(s&&s.length>0){const r=Array.from(s).filter(d=>d.name.toLowerCase().endsWith(".md"));r.length>0&&n.onUpload(t,r)}}function md(e,t,n){var d;const i=e.type==="directory"||e.type==="symlink"&&e.children!=null,s=t.expandedDirs.has(e.path),o=t.selectedPaths.has(e.path),a=t.currentDir===e.path,r=n*20+12;return i?u`
|
|
200
200
|
<div
|
|
201
201
|
class="sp-tree-item sp-tree-dir ${s?"expanded":""} ${a?"current":""}"
|
|
202
202
|
style="padding-left: ${r}px;"
|
|
@@ -206,15 +206,15 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
206
206
|
@drop=${c=>ig(c,e.path,t)}
|
|
207
207
|
>
|
|
208
208
|
<span class="sp-tree-chevron">${s?"−":"+"}</span>
|
|
209
|
-
<span class="sp-tree-icon">${
|
|
209
|
+
<span class="sp-tree-icon">${L.folder}</span>
|
|
210
210
|
<span class="sp-tree-name">${e.name}</span>
|
|
211
211
|
${s&&((d=e.children)==null?void 0:d.length)===0?u`<span
|
|
212
212
|
class="sp-tree-dir-delete"
|
|
213
213
|
title="Delete empty folder"
|
|
214
214
|
@click=${c=>{c.stopPropagation(),t.onDelete(e.path)}}
|
|
215
|
-
>×</span>`:
|
|
215
|
+
>×</span>`:k}
|
|
216
216
|
</div>
|
|
217
|
-
${s&&e.children?e.children.map(c=>md(c,t,n+1)):
|
|
217
|
+
${s&&e.children?e.children.map(c=>md(c,t,n+1)):k}
|
|
218
218
|
`:u`
|
|
219
219
|
<div
|
|
220
220
|
class="sp-tree-item sp-tree-file ${o?"selected":""}"
|
|
@@ -223,11 +223,11 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
223
223
|
@click=${c=>{c.metaKey||c.ctrlKey?t.onToggleSelectFile(e.path):t.onSelectFile(e.path)}}
|
|
224
224
|
@dragstart=${c=>{c.dataTransfer&&(c.dataTransfer.effectAllowed="move",c.dataTransfer.setData(Mi,e.path),c.dataTransfer.setData("text/plain",e.name))}}
|
|
225
225
|
>
|
|
226
|
-
<span class="sp-tree-icon">${
|
|
226
|
+
<span class="sp-tree-icon">${L.fileText}</span>
|
|
227
227
|
<span class="sp-tree-name">${e.name}</span>
|
|
228
228
|
<span class="sp-tree-size">${fd(e.size)}</span>
|
|
229
229
|
</div>
|
|
230
|
-
`}function sg(e){const t=e.selectedPaths.size;return t<2?
|
|
230
|
+
`}function sg(e){const t=e.selectedPaths.size;return t<2?k:u`
|
|
231
231
|
<div class="sp-bulk-actions">
|
|
232
232
|
<span style="color: var(--tasker-muted-grey); font-size: 13px;">${t} files selected</span>
|
|
233
233
|
<button
|
|
@@ -238,7 +238,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
238
238
|
Download ${t} files
|
|
239
239
|
</button>
|
|
240
240
|
</div>
|
|
241
|
-
`}function og(e){if(e.selectedPaths.size!==1||!e.selectedPath)return
|
|
241
|
+
`}function og(e){if(e.selectedPaths.size!==1||!e.selectedPath)return k;if(e.previewLoading)return u`
|
|
242
242
|
<div class="sp-file-preview">
|
|
243
243
|
<div class="setup-spinner" style="width: 32px; height: 32px; margin: 24px auto;"></div>
|
|
244
244
|
</div>
|
|
@@ -255,7 +255,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
255
255
|
<button class="setup-button secondary" style="padding: 8px 16px; font-size: 13px;" @click=${()=>e.onDownload(e.selectedPath)}>
|
|
256
256
|
Download
|
|
257
257
|
</button>
|
|
258
|
-
<button class="setup-button danger" style="padding: 8px 16px; font-size: 13px;" @click=${()=>{e.pendingDeletePath===e.selectedPath?(
|
|
258
|
+
<button class="setup-button danger" style="padding: 8px 16px; font-size: 13px;" @click=${()=>{e.pendingDeletePath===e.selectedPath?(pt&&clearTimeout(pt),pt=null,e.onDelete(e.selectedPath)):(e.onArmDelete(e.selectedPath),pt&&clearTimeout(pt),pt=setTimeout(()=>{e.onArmDelete(""),pt=null},3e3))}}>
|
|
259
259
|
${e.pendingDeletePath===e.selectedPath?"Confirm delete?":"Delete"}
|
|
260
260
|
</button>
|
|
261
261
|
</div>
|
|
@@ -277,7 +277,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
277
277
|
@change=${t=>e.onSearchAgentChange(t.target.value)}
|
|
278
278
|
>
|
|
279
279
|
${e.agentIds.map(t=>u`<option value=${t} ?selected=${t===e.searchAgentId}>${t}</option>`)}
|
|
280
|
-
</select>`:
|
|
280
|
+
</select>`:k}
|
|
281
281
|
<button
|
|
282
282
|
class="setup-button secondary"
|
|
283
283
|
style="padding: 8px 16px; font-size: 13px;"
|
|
@@ -292,7 +292,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
292
292
|
@click=${e.onSearchClear}
|
|
293
293
|
>
|
|
294
294
|
Clear
|
|
295
|
-
</button>`:
|
|
295
|
+
</button>`:k}
|
|
296
296
|
</div>
|
|
297
297
|
`}function rg(e){return e.searchResults?e.searchResults.length===0?u`<div class="sp-search-results">
|
|
298
298
|
<div style="padding: 24px; color: var(--tasker-muted-grey); text-align: center;">No results found.</div>
|
|
@@ -314,16 +314,16 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
314
314
|
</div>
|
|
315
315
|
`)}
|
|
316
316
|
</div>
|
|
317
|
-
`:
|
|
317
|
+
`:k}function lg(e){const t=e.currentDir;return e.connected?u`
|
|
318
318
|
<div class="setup-container">
|
|
319
|
-
${
|
|
319
|
+
${Mt("Files",e.wsProps)}
|
|
320
320
|
<div class="setup-card sp-card-wide">
|
|
321
321
|
<h1>Workspace Files</h1>
|
|
322
322
|
<p style="margin-bottom: 16px;">Browse, upload, and manage files in your workspace. Drag files between folders to move them.</p>
|
|
323
323
|
|
|
324
324
|
<div class="sp-toolbar">
|
|
325
325
|
<label class="setup-button secondary" style="padding: 10px 20px; font-size: 14px; cursor: pointer;">
|
|
326
|
-
Upload${t!=="."?u` to <em>${t}</em>`:
|
|
326
|
+
Upload${t!=="."?u` to <em>${t}</em>`:k}
|
|
327
327
|
<input
|
|
328
328
|
type="file"
|
|
329
329
|
multiple
|
|
@@ -337,7 +337,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
337
337
|
style="padding: 10px 20px; font-size: 14px;"
|
|
338
338
|
@click=${()=>{const n=prompt("Folder name:");n!=null&&n.trim()&&e.onNewFolder(t,n.trim())}}
|
|
339
339
|
>
|
|
340
|
-
New Folder${t!=="."?u` in <em>${t}</em>`:
|
|
340
|
+
New Folder${t!=="."?u` in <em>${t}</em>`:k}
|
|
341
341
|
</button>
|
|
342
342
|
<button
|
|
343
343
|
class="setup-button secondary"
|
|
@@ -367,16 +367,16 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
367
367
|
style="width: 10px; height: 10px; background: ${e.memoryStatus.syncing?"#f59e0b":e.memoryStatus.dirty?"#ef4444":"#22c55e"}"
|
|
368
368
|
></span>
|
|
369
369
|
${(()=>{var d;if(e.memoryStatus.syncing&&e.memoryStatus.syncProgress){const{completed:c,total:l,label:p}=e.memoryStatus.syncProgress;return p||(l>0?`Indexing ${c}/${l} files…`:"Indexing…")}const n=e.memoryStatus.files,i=e.memoryStatus.chunks,s=`${n} file${n!==1?"s":""}, ${i} chunks`,o=(d=e.memoryStatus)==null?void 0:d.model;if(!o)return s;const r=(o.includes("/")?o.split("/").pop():o).replace(/[-_]Q\d.*$/i,"").replace(/\.gguf$/i,"");return`${s} · ${r}`})()}
|
|
370
|
-
</span>`:
|
|
370
|
+
</span>`:k}
|
|
371
371
|
</div>
|
|
372
372
|
|
|
373
|
-
${e.error?u`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:
|
|
373
|
+
${e.error?u`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:k}
|
|
374
374
|
|
|
375
375
|
${e.message?u`<div class="${e.message.kind==="error"?"setup-error":"setup-success-message"}" style="margin-top: 12px;">
|
|
376
376
|
${e.message.text}
|
|
377
|
-
</div>`:
|
|
377
|
+
</div>`:k}
|
|
378
378
|
|
|
379
|
-
${e.uploadBusy?u`<div style="margin-top: 12px; color: var(--tasker-orange); font-weight: 600; font-size: 14px;">Uploading...</div>`:
|
|
379
|
+
${e.uploadBusy?u`<div style="margin-top: 12px; color: var(--tasker-orange); font-weight: 600; font-size: 14px;">Uploading...</div>`:k}
|
|
380
380
|
|
|
381
381
|
${ag(e)}
|
|
382
382
|
|
|
@@ -399,20 +399,20 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
399
399
|
<p>Connecting to gateway...</p>
|
|
400
400
|
</div>
|
|
401
401
|
</div>
|
|
402
|
-
`}const sa="taskmaster_uninstall_done";async function cg(e){var t,n;if(!(!e.client||!e.connected)&&!e.uninstallBusy){e.uninstallBusy=!0,e.uninstallError=null,(t=e.requestUpdate)==null||t.call(e),dg();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 Pi(){try{return localStorage.getItem(sa)==="1"}catch{return!1}}function oa(){try{localStorage.removeItem(sa)}catch{}}function dg(){try{localStorage.setItem(sa,"1")}catch{}}const yr=Object.freeze(Object.defineProperty({__proto__:null,checkUninstallDone:Pi,clearUninstallDone:oa,runUninstall:cg},Symbol.toStringTag,{value:"Module"}));function
|
|
402
|
+
`}const sa="taskmaster_uninstall_done";async function cg(e){var t,n;if(!(!e.client||!e.connected)&&!e.uninstallBusy){e.uninstallBusy=!0,e.uninstallError=null,(t=e.requestUpdate)==null||t.call(e),dg();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 Pi(){try{return localStorage.getItem(sa)==="1"}catch{return!1}}function oa(){try{localStorage.removeItem(sa)}catch{}}function dg(){try{localStorage.setItem(sa,"1")}catch{}}const yr=Object.freeze(Object.defineProperty({__proto__:null,checkUninstallDone:Pi,clearUninstallDone:oa,runUninstall:cg},Symbol.toStringTag,{value:"Module"}));function G(e){return u`
|
|
403
403
|
<span
|
|
404
404
|
class="setup-status-light"
|
|
405
405
|
style="background: ${{good:"#22c55e",bad:"#ef4444",partial:"#eab308",unknown:"#6b7280"}[e]}"
|
|
406
406
|
></span>
|
|
407
|
-
`}function
|
|
407
|
+
`}function pe(e,t){return u`
|
|
408
408
|
<button
|
|
409
409
|
class="setup-info-btn"
|
|
410
410
|
@click=${()=>t.onInfoModalOpen(e)}
|
|
411
411
|
title="Details"
|
|
412
412
|
>
|
|
413
|
-
${
|
|
413
|
+
${L.info}
|
|
414
414
|
</button>
|
|
415
|
-
`}function ug(e){var i;if(!e.infoModalOpen)return
|
|
415
|
+
`}function ug(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 o="N/A";if(s!=null&&s>0)if(s>60){const a=Math.floor(s/60),r=s%60;o=r>0?`${a}h ${r}m`:`${a}h`}else o=`${s}m`;t="Claude",n=[{label:"Connected",value:e.authConnected?"Yes":"No"},{label:"Token Expiry",value:o},{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=en(e),o=s?aa(s,e):null;t="WhatsApp",n=[{label:"Account",value:(o==null?void 0:o.name)||(o==null?void 0:o.accountId)||"Default"},{label:"Phone",value:((i=o==null?void 0:o.self)==null?void 0:i.e164)||"Not paired"},{label:"Connected",value:o!=null&&o.connected?"Yes":"No"},{label:"Linked",value:o!=null&&o.linked?"Yes":"No"},...o!=null&&o.lastError?[{label:"Last Error",value:ra(o.lastError)}]:[]];break}case"imessage":{const{thisWsOwns:s}=la(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}case"remote-access":{const s=e.tailscaleStatus,o=s?s.installed?s.loggedIn?s.serveEnabled&&s.serveActive?"Active":s.serveEnabled&&!s.serveActive?"Enabled but not active":"Off":"Not connected":"Not installed":"Checking...";t="Remote Access",n=[{label:"Status",value:o},{label:"What",value:"Access this control panel from anywhere — your phone, another computer, or while away from home"},{label:"How",value:"Uses Tailscale to create a private, encrypted connection with a trusted HTTPS certificate (no browser warnings)"},{label:"Requires",value:"Tailscale installed on this device and on any device you want to access the control panel from, all logged into the same Tailscale account"},{label:"Internet Access",value:"Enable internet access (globe icon) to make Public Chat reachable from the web"},{label:"Cost",value:"Tailscale is free for personal use (up to 100 devices)"},...s!=null&&s.tailnetUrl?[{label:"URL",value:`${s.tailnetUrl} — bookmark this on your other devices`}]:[]];break}case"public-chat":{t="Public Chat",n=[{label:"Status",value:e.publicChatEnabled?"Enabled":"Disabled"},{label:"What",value:"A chat widget anyone can use to message your business from a web browser"},{label:"Requires",value:"Remote Access with internet access enabled — this gives your device a public URL that visitors can reach"},{label:"Access mode",value:bg[e.publicChatAuthMode]??"Open access"},{label:"Open access",value:"Anyone can chat without identifying themselves"},{label:"WhatsApp OTP",value:"Visitors verify their phone number before chatting"},{label:"Visitor chooses",value:"Visitors can chat anonymously or verify via WhatsApp"}];break}case"account-pin":{t="Account PIN",n=[{label:"Status",value:e.accountHasPin?"Set":"Not set"},{label:"What",value:"A numeric PIN that protects this account on the control panel"},{label:"When needed",value:"Required when switching to this account or after the session expires"},{label:"Format",value:"4 to 6 digits"}];break}case"branding":{const s=!!(e.brandAccentColor||e.brandBackgroundColor||e.brandHasLogo);t="Branding",n=[{label:"Status",value:s?"Customised":"Default"},{label:"What",value:"Your business logo and colour scheme, displayed on the control panel and public chat pages"},{label:"Logo",value:"Shown on public chat pages alongside your business name"},{label:"Accent colour",value:"Used for buttons, links, and interactive elements"},{label:"Background tint",value:"A subtle colour wash applied to page and card backgrounds"},{label:"Scope",value:"Each account has its own branding — switch accounts to customise each one separately"}];break}default:return k}return u`
|
|
416
416
|
<div class="setup-info-overlay" @click=${s=>{s.target.classList.contains("setup-info-overlay")&&e.onInfoModalClose()}}>
|
|
417
417
|
<div class="setup-info-card">
|
|
418
418
|
<h3>${t}</h3>
|
|
@@ -431,7 +431,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
431
431
|
</button>
|
|
432
432
|
</div>
|
|
433
433
|
</div>
|
|
434
|
-
`}function
|
|
434
|
+
`}function Ae(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 u`
|
|
435
435
|
<div class="setup-steps">
|
|
436
436
|
${t.map(s=>{const o=n.indexOf(s.id),a=e===s.id,r=i>o;return u`
|
|
437
437
|
<div
|
|
@@ -445,9 +445,9 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
445
445
|
`}function vr(e){const{licenseKey:t,licenseBusy:n,licenseValid:i,licenseMessage:s,licenseDeviceId:o,onLicenseKeyChange:a,onLicenseActivate:r}=e;return i===!0?u`
|
|
446
446
|
<div class="setup-container">
|
|
447
447
|
<div class="setup-card setup-success">
|
|
448
|
-
${
|
|
448
|
+
${Ae("license")}
|
|
449
449
|
<div class="setup-status-row">
|
|
450
|
-
${
|
|
450
|
+
${G("good")}
|
|
451
451
|
<span>License Activated</span>
|
|
452
452
|
</div>
|
|
453
453
|
<p>${s??"Your license is active."}</p>
|
|
@@ -456,7 +456,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
456
456
|
`:n&&!t?u`
|
|
457
457
|
<div class="setup-container">
|
|
458
458
|
<div class="setup-card">
|
|
459
|
-
${
|
|
459
|
+
${Ae("license")}
|
|
460
460
|
<div class="setup-spinner"></div>
|
|
461
461
|
<p>Checking license...</p>
|
|
462
462
|
</div>
|
|
@@ -464,7 +464,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
464
464
|
`:u`
|
|
465
465
|
<div class="setup-container">
|
|
466
466
|
<div class="setup-card">
|
|
467
|
-
${
|
|
467
|
+
${Ae("license")}
|
|
468
468
|
<h1>Activate License</h1>
|
|
469
469
|
<p>Enter your license key to get started.</p>
|
|
470
470
|
${o?u`
|
|
@@ -480,7 +480,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
480
480
|
@click=${async d=>{const c=d.currentTarget;try{await navigator.clipboard.writeText(o),c.textContent="Copied!",setTimeout(()=>{c.textContent="Copy"},1500)}catch{const l=document.createElement("textarea");l.value=o,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.select(),document.execCommand("copy"),document.body.removeChild(l),c.textContent="Copied!",setTimeout(()=>{c.textContent="Copy"},1500)}}}
|
|
481
481
|
>Copy</button>
|
|
482
482
|
</div>
|
|
483
|
-
`:
|
|
483
|
+
`:k}
|
|
484
484
|
<div class="setup-code-input">
|
|
485
485
|
<input
|
|
486
486
|
type="text"
|
|
@@ -499,10 +499,10 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
499
499
|
</div>
|
|
500
500
|
${i===!1&&s?u`
|
|
501
501
|
<div class="setup-status-row" style="margin-top: 12px;">
|
|
502
|
-
${
|
|
502
|
+
${G("bad")}
|
|
503
503
|
<span class="setup-error">${s}</span>
|
|
504
504
|
</div>
|
|
505
|
-
`:
|
|
505
|
+
`:k}
|
|
506
506
|
<p class="setup-hint">
|
|
507
507
|
Need a license?
|
|
508
508
|
<a href="https://taskmaster.bot" target="_blank" rel="noopener">
|
|
@@ -514,16 +514,16 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
514
514
|
`}function pg(e){const{authConnected:t,authBusy:n,authMessage:i,authUrl:s,authCodeInput:o,authExpiresIn:a,onStartAuth:r,onSubmitAuthCode:d,onAuthCodeChange:c,onSkipToWhatsApp:l}=e;return t===!0?u`
|
|
515
515
|
<div class="setup-container">
|
|
516
516
|
<div class="setup-card setup-success">
|
|
517
|
-
${
|
|
517
|
+
${Ae("auth")}
|
|
518
518
|
<div class="setup-status-row">
|
|
519
|
-
${
|
|
519
|
+
${G("good")}
|
|
520
520
|
<span>Claude Connected</span>
|
|
521
521
|
</div>
|
|
522
522
|
<p>
|
|
523
523
|
Your Claude Pro subscription is linked.
|
|
524
524
|
${a?u`<br /><span class="setup-hint"
|
|
525
525
|
>Expires in ${a} minutes</span
|
|
526
|
-
>`:
|
|
526
|
+
>`:k}
|
|
527
527
|
</p>
|
|
528
528
|
<p style="color: var(--tasker-text-grey); font-size: 14px;">
|
|
529
529
|
Head to Chat to introduce yourself and finish setting up your assistant.
|
|
@@ -536,7 +536,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
536
536
|
`:n&&!s?u`
|
|
537
537
|
<div class="setup-container">
|
|
538
538
|
<div class="setup-card">
|
|
539
|
-
${
|
|
539
|
+
${Ae("auth")}
|
|
540
540
|
<div class="setup-spinner"></div>
|
|
541
541
|
<p>Starting Claude connection...</p>
|
|
542
542
|
</div>
|
|
@@ -544,7 +544,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
544
544
|
`:s?u`
|
|
545
545
|
<div class="setup-container">
|
|
546
546
|
<div class="setup-card">
|
|
547
|
-
${
|
|
547
|
+
${Ae("auth")}
|
|
548
548
|
<h1>Connect to Claude</h1>
|
|
549
549
|
<p>Click the button below to sign in with your Claude Pro account.</p>
|
|
550
550
|
<a
|
|
@@ -574,7 +574,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
574
574
|
${n?"Verifying...":"Submit"}
|
|
575
575
|
</button>
|
|
576
576
|
</div>
|
|
577
|
-
${i?u`<p class="setup-hint">${i}</p>`:
|
|
577
|
+
${i?u`<p class="setup-hint">${i}</p>`:k}
|
|
578
578
|
<p class="setup-hint" style="margin-top: 16px;">
|
|
579
579
|
<a href="#" class="setup-link" @click=${p=>{p.preventDefault(),e.onAuthApiKeyToggle()}}>
|
|
580
580
|
Or use an API key instead
|
|
@@ -585,7 +585,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
585
585
|
`:e.authApiKeyMode?u`
|
|
586
586
|
<div class="setup-container">
|
|
587
587
|
<div class="setup-card">
|
|
588
|
-
${
|
|
588
|
+
${Ae("auth")}
|
|
589
589
|
<h1>Enter API Key</h1>
|
|
590
590
|
<p>Paste your Anthropic API key below.</p>
|
|
591
591
|
<div class="setup-code-input">
|
|
@@ -604,7 +604,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
604
604
|
@click=${()=>e.onAuthApiKeySubmit()}
|
|
605
605
|
>${e.authApiKeyBusy?"Saving...":"Save"}</button>
|
|
606
606
|
</div>
|
|
607
|
-
${e.authApiKeyError?u`<p class="setup-error">${e.authApiKeyError}</p>`:
|
|
607
|
+
${e.authApiKeyError?u`<p class="setup-error">${e.authApiKeyError}</p>`:k}
|
|
608
608
|
<p class="setup-hint" style="margin-top: 16px;">
|
|
609
609
|
<a href="#" class="setup-link" @click=${p=>{p.preventDefault(),e.onAuthApiKeyToggle()}}>
|
|
610
610
|
Use OAuth instead
|
|
@@ -621,7 +621,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
621
621
|
`:u`
|
|
622
622
|
<div class="setup-container">
|
|
623
623
|
<div class="setup-card">
|
|
624
|
-
${
|
|
624
|
+
${Ae("auth")}
|
|
625
625
|
<h1>Connect to Claude</h1>
|
|
626
626
|
${t===!1&&i?u`<p class="setup-error">${i}</p>`:u`<p>
|
|
627
627
|
First, let's connect your Claude Pro subscription.<br />
|
|
@@ -643,7 +643,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
643
643
|
</p>
|
|
644
644
|
</div>
|
|
645
645
|
</div>
|
|
646
|
-
`}function aa(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
|
|
646
|
+
`}function aa(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 en(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 br(e){const t=en(e),n=(t==null?void 0:t.displayName)??(t==null?void 0:t.name)??Ve().name,i=e.whatsappBusy||e.gatewayHealthLoading;if(e.renamingWorkspace&&t){const s=()=>{const o=e.renameWorkspaceName.trim();o&&e.onWorkspaceRename(t.name,o)};return u`
|
|
647
647
|
<div style="display: flex; align-items: center; gap: 6px; margin-bottom: 4px;">
|
|
648
648
|
<input
|
|
649
649
|
type="text"
|
|
@@ -658,12 +658,12 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
658
658
|
@click=${s}
|
|
659
659
|
title="Save"
|
|
660
660
|
style="color: #22c55e;"
|
|
661
|
-
>${
|
|
661
|
+
>${L.check}</button>
|
|
662
662
|
<button
|
|
663
663
|
class="setup-status-action"
|
|
664
664
|
@click=${e.onWorkspaceRenameCancel}
|
|
665
665
|
title="Cancel"
|
|
666
|
-
>${
|
|
666
|
+
>${L.x}</button>
|
|
667
667
|
</div>
|
|
668
668
|
`}return u`
|
|
669
669
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;">
|
|
@@ -674,7 +674,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
674
674
|
@click=${e.onWorkspaceRenameStart}
|
|
675
675
|
title="Rename"
|
|
676
676
|
style="opacity: 0.5; transform: scale(0.8);"
|
|
677
|
-
>${
|
|
677
|
+
>${L.edit}</button>
|
|
678
678
|
</div>
|
|
679
679
|
<button
|
|
680
680
|
class="setup-status-action ${i?"spinning":""}"
|
|
@@ -682,36 +682,36 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
682
682
|
@click=${e.onRefreshStatus}
|
|
683
683
|
title="Refresh Status"
|
|
684
684
|
>
|
|
685
|
-
${
|
|
685
|
+
${L.rotateCw}
|
|
686
686
|
</button>
|
|
687
687
|
</div>
|
|
688
688
|
`}function wr(e){return u`
|
|
689
689
|
<div class="setup-status-item">
|
|
690
|
-
${
|
|
690
|
+
${G(e.gatewayHealthy===!1?"bad":"good")}
|
|
691
691
|
<div class="setup-status-info">
|
|
692
692
|
<strong>Gateway</strong>
|
|
693
693
|
<span>${e.gatewayHealthMessage||"Running"}</span>
|
|
694
694
|
</div>
|
|
695
|
-
${
|
|
695
|
+
${pe("gateway",e)}
|
|
696
696
|
<button
|
|
697
697
|
class="setup-status-action ${e.gatewayRestartBusy?"spinning":""}"
|
|
698
698
|
?disabled=${e.gatewayRestartBusy}
|
|
699
699
|
@click=${e.onRestartGateway}
|
|
700
700
|
title="Restart Gateway"
|
|
701
701
|
>
|
|
702
|
-
${
|
|
702
|
+
${L.rotateCw}
|
|
703
703
|
</button>
|
|
704
704
|
</div>
|
|
705
705
|
`}function kr(e){const t=e.authConnected===!0;return u`
|
|
706
706
|
<div class="setup-status-item">
|
|
707
|
-
${
|
|
707
|
+
${G(t?"good":"bad")}
|
|
708
708
|
<div class="setup-status-info">
|
|
709
709
|
<strong>Claude</strong>
|
|
710
710
|
<span>
|
|
711
|
-
${t?"Connected":"Not connected"}${t&&e.authExpiresIn?u` <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>`:
|
|
711
|
+
${t?"Connected":"Not connected"}${t&&e.authExpiresIn?u` <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}
|
|
712
712
|
</span>
|
|
713
713
|
</div>
|
|
714
|
-
${
|
|
714
|
+
${pe("claude",e)}
|
|
715
715
|
${t?u`
|
|
716
716
|
<button
|
|
717
717
|
class="setup-status-action ${e.authBusy?"spinning":""}"
|
|
@@ -719,7 +719,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
719
719
|
@click=${e.onStartAuth}
|
|
720
720
|
title="Refresh Token"
|
|
721
721
|
>
|
|
722
|
-
${
|
|
722
|
+
${L.rotateCw}
|
|
723
723
|
</button>
|
|
724
724
|
`:u`
|
|
725
725
|
<button
|
|
@@ -727,29 +727,29 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
727
727
|
@click=${e.onStartAuth}
|
|
728
728
|
title="Connect Claude"
|
|
729
729
|
>
|
|
730
|
-
${
|
|
730
|
+
${L.rotateCw}
|
|
731
731
|
</button>
|
|
732
732
|
`}
|
|
733
733
|
</div>
|
|
734
734
|
`}function $r(e){return u`
|
|
735
735
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
736
|
-
${
|
|
736
|
+
${G("good")}
|
|
737
737
|
<div class="setup-status-info">
|
|
738
738
|
<strong>License</strong>
|
|
739
739
|
<span>Active</span>
|
|
740
740
|
</div>
|
|
741
|
-
${
|
|
741
|
+
${pe("license",e)}
|
|
742
742
|
<button
|
|
743
743
|
class="setup-status-action"
|
|
744
744
|
@click=${()=>{e.licenseRemoveConfirm?e.onLicenseRemoveCancel():e.onLicenseRemoveConfirm()}}
|
|
745
745
|
title="Manage License"
|
|
746
746
|
>
|
|
747
|
-
${
|
|
747
|
+
${L.rotateCw}
|
|
748
748
|
</button>
|
|
749
749
|
${e.licenseRemoveConfirm?u`
|
|
750
750
|
<div style="width: 100%; margin-top: 8px; margin-left: 30px;">
|
|
751
751
|
<p style="color: var(--tasker-text-grey); font-size: 13px; margin: 0 0 8px;">
|
|
752
|
-
Removing your license will disable ${
|
|
752
|
+
Removing your license will disable ${Ve().name} until you enter a new key.
|
|
753
753
|
</p>
|
|
754
754
|
<div style="display: flex; gap: 8px;">
|
|
755
755
|
<button
|
|
@@ -769,11 +769,11 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
769
769
|
</button>
|
|
770
770
|
</div>
|
|
771
771
|
</div>
|
|
772
|
-
`:
|
|
772
|
+
`:k}
|
|
773
773
|
</div>
|
|
774
|
-
`}function ra(e){var t,n;try{const i=JSON.parse(e),s=(i==null?void 0:i.error)??i,o=((n=(t=s==null?void 0:s.output)==null?void 0:t.payload)==null?void 0:n.message)??(s==null?void 0:s.message)??(i==null?void 0:i.message);if(o&&typeof o=="string")return o}catch{}return e.length>80?e.slice(0,77)+"…":e}function Sr(e){var p;const t=
|
|
774
|
+
`}function ra(e){var t,n;try{const i=JSON.parse(e),s=(i==null?void 0:i.error)??i,o=((n=(t=s==null?void 0:s.output)==null?void 0:t.payload)==null?void 0:n.message)??(s==null?void 0:s.message)??(i==null?void 0:i.message);if(o&&typeof o=="string")return o}catch{}return e.length>80?e.slice(0,77)+"…":e}function Sr(e){var p;const t=en(e);if(!t)return k;const n=aa(t,e),i=(n==null?void 0:n.running)&&(n==null?void 0:n.connected),s=(n==null?void 0:n.linked)&&!i,o=!!n,a=i?"good":s?"partial":o?"bad":"unknown",r=i?"Connected":s?"Linked, not connected":o?n!=null&&n.lastError?ra(n.lastError):"Not connected":"Not paired",d=!(n!=null&&n.provider)||(n==null?void 0:n.provider)==="baileys",c=t.whatsappAccountId??(t.isDefault&&e.whatsappAccounts.length===1?(p=e.whatsappAccounts[0])==null?void 0:p.accountId:void 0),l=c!=null&&e.whatsappActiveQrAccountId===c;return u`
|
|
775
775
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
776
|
-
${
|
|
776
|
+
${G(a)}
|
|
777
777
|
<div class="setup-status-info">
|
|
778
778
|
<strong>WhatsApp</strong>
|
|
779
779
|
<span>${r}</span>
|
|
@@ -782,12 +782,12 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
782
782
|
class="setup-info-btn"
|
|
783
783
|
@click=${e.onWhatsAppSettingsOpen}
|
|
784
784
|
title="WhatsApp settings"
|
|
785
|
-
>${
|
|
785
|
+
>${L.settings}</button>`:k}
|
|
786
786
|
${d&&c?u`<button
|
|
787
787
|
class="setup-status-action"
|
|
788
788
|
@click=${e.onRefreshStatus}
|
|
789
789
|
title="Refresh status"
|
|
790
|
-
>${
|
|
790
|
+
>${L.rotateCw}</button>`:k}
|
|
791
791
|
${l&&e.whatsappLoginQrDataUrl?u`
|
|
792
792
|
<div style="width: 100%; margin-top: 8px; margin-left: 30px;">
|
|
793
793
|
<div class="setup-qr" style="display: inline-flex;">
|
|
@@ -797,20 +797,20 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
797
797
|
style="width: 140px; height: 140px;"
|
|
798
798
|
/>
|
|
799
799
|
</div>
|
|
800
|
-
${e.whatsappLoginMessage?u`<p class="setup-hint" style="margin-top: 4px;">${e.whatsappLoginMessage}</p>`:
|
|
800
|
+
${e.whatsappLoginMessage?u`<p class="setup-hint" style="margin-top: 4px;">${e.whatsappLoginMessage}</p>`:k}
|
|
801
801
|
</div>
|
|
802
|
-
`:
|
|
802
|
+
`:k}
|
|
803
803
|
</div>
|
|
804
|
-
`}const hg=[{id:"claude-opus-4-6",shortName:"Opus"},{id:"claude-sonnet-4-5-20250929",shortName:"Sonnet"},{id:"claude-haiku-4-5-20251001",shortName:"Haiku"}],fg="anthropic/claude-sonnet-4-5-20250929",gg=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function mg(e){var
|
|
805
|
-
<div class="setup-info-overlay" @click=${
|
|
804
|
+
`}const hg=[{id:"claude-opus-4-6",shortName:"Opus"},{id:"claude-sonnet-4-5-20250929",shortName:"Sonnet"},{id:"claude-haiku-4-5-20251001",shortName:"Haiku"}],fg="anthropic/claude-sonnet-4-5-20250929",gg=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function mg(e){var f,w;if(!e.whatsappSettingsOpen)return k;const t=en(e);if(!t)return k;const n=aa(t,e);if(!n)return k;const i=n.running&&n.connected,s=!n.provider||n.provider==="baileys",o=t.whatsappAccountId??(t.isDefault&&e.whatsappAccounts.length===1?(f=e.whatsappAccounts[0])==null?void 0:f.accountId:void 0),a=()=>e.onWhatsAppSettingsClose(),r=e.whatsappModelCatalog??[],d=new Set(r.filter(b=>b.provider==="anthropic").map(b=>b.id)),c=hg.filter(b=>d.has(b.id)),l=e.whatsappModel??fg,p=e.whatsappThinkingLevel??"off",h="display: flex; justify-content: space-between; font-size: 13px;",v="color: var(--tasker-text-grey);",S="color: var(--tasker-white); text-align: right;";return u`
|
|
805
|
+
<div class="setup-info-overlay" @click=${b=>{b.target.classList.contains("setup-info-overlay")&&a()}}>
|
|
806
806
|
<div class="setup-info-card" style="max-width: 360px;">
|
|
807
807
|
<h3>WhatsApp</h3>
|
|
808
808
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 12px;">
|
|
809
|
-
<div style="${
|
|
810
|
-
<div style="${
|
|
811
|
-
<div style="${
|
|
812
|
-
<div style="${
|
|
813
|
-
${n.lastError?u`<div style="${
|
|
809
|
+
<div style="${h}"><span style="${v}">Account</span><span style="${S}">${n.name||n.accountId||"Default"}</span></div>
|
|
810
|
+
<div style="${h}"><span style="${v}">Phone</span><span style="${S}">${((w=n.self)==null?void 0:w.e164)||"Not paired"}</span></div>
|
|
811
|
+
<div style="${h}"><span style="${v}">Connected</span><span style="${S}">${i?"Yes":"No"}</span></div>
|
|
812
|
+
<div style="${h}"><span style="${v}">Linked</span><span style="${S}">${n.linked?"Yes":"No"}</span></div>
|
|
813
|
+
${n.lastError?u`<div style="${h}"><span style="${v}">Error</span><span style="${S}; color: #ef4444;">${ra(n.lastError)}</span></div>`:k}
|
|
814
814
|
</div>
|
|
815
815
|
${s&&o?u`
|
|
816
816
|
<div style="border-top: 1px solid rgba(255,255,255,0.08); margin: 16px 0 12px;"></div>
|
|
@@ -825,7 +825,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
825
825
|
?disabled=${e.whatsappBusy}
|
|
826
826
|
@click=${()=>{e.onWhatsAppRelink(o),a()}}
|
|
827
827
|
>Link WhatsApp</button>`}
|
|
828
|
-
`:
|
|
828
|
+
`:k}
|
|
829
829
|
${i?u`
|
|
830
830
|
<div style="border-top: 1px solid rgba(255,255,255,0.08); margin: 16px 0 12px;"></div>
|
|
831
831
|
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
@@ -883,7 +883,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
883
883
|
</div>
|
|
884
884
|
</label>
|
|
885
885
|
</div>
|
|
886
|
-
`:
|
|
886
|
+
`:k}
|
|
887
887
|
<div style="border-top: 1px solid rgba(255,255,255,0.08); margin: 4px 0;"></div>
|
|
888
888
|
${c.length>0?u`
|
|
889
889
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
@@ -892,33 +892,33 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
892
892
|
class="setup-model-select"
|
|
893
893
|
style="flex: 1;"
|
|
894
894
|
.value=${l}
|
|
895
|
-
@change=${
|
|
895
|
+
@change=${b=>{e.onWhatsAppModelChange(b.target.value)}}
|
|
896
896
|
>
|
|
897
|
-
${c.map(
|
|
898
|
-
<option value=${"anthropic/"
|
|
899
|
-
${
|
|
897
|
+
${c.map(b=>u`
|
|
898
|
+
<option value=${"anthropic/"+b.id} ?selected=${l==="anthropic/"+b.id}>
|
|
899
|
+
${b.shortName}
|
|
900
900
|
</option>
|
|
901
901
|
`)}
|
|
902
902
|
</select>
|
|
903
903
|
</div>
|
|
904
|
-
`:
|
|
904
|
+
`:k}
|
|
905
905
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
906
906
|
<div style="font-size: 13px; color: var(--tasker-text-grey); min-width: 60px;">Thinking</div>
|
|
907
907
|
<select
|
|
908
908
|
class="setup-model-select"
|
|
909
909
|
style="flex: 1;"
|
|
910
910
|
.value=${p}
|
|
911
|
-
@change=${
|
|
911
|
+
@change=${b=>{e.onWhatsAppThinkingChange(b.target.value)}}
|
|
912
912
|
>
|
|
913
|
-
${gg.map(
|
|
914
|
-
<option value=${
|
|
915
|
-
${
|
|
913
|
+
${gg.map(b=>u`
|
|
914
|
+
<option value=${b.value} ?selected=${p===b.value}>
|
|
915
|
+
${b.label}
|
|
916
916
|
</option>
|
|
917
917
|
`)}
|
|
918
918
|
</select>
|
|
919
919
|
</div>
|
|
920
920
|
</div>
|
|
921
|
-
`:
|
|
921
|
+
`:k}
|
|
922
922
|
<button
|
|
923
923
|
class="setup-button secondary"
|
|
924
924
|
style="margin-top: 20px; width: 100%; padding: 10px;"
|
|
@@ -928,25 +928,25 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
928
928
|
</button>
|
|
929
929
|
</div>
|
|
930
930
|
</div>
|
|
931
|
-
`}function la(e){const t=
|
|
931
|
+
`}function la(e){const t=en(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 xr(e){const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=la(e);let s,o;return i?(s="partial",o=`Connected to ${t}`):n&&e.imessageConnected?(s="good",o="Connected"):n&&e.imessageRunning?(s="partial",o="Running, not connected"):n?(s="bad",o="Not running"):e.imessageConfigured?(s="unknown",o="Not connected"):(s="bad",o="Not configured"),u`
|
|
932
932
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
933
|
-
${
|
|
933
|
+
${G(s)}
|
|
934
934
|
<div class="setup-status-info">
|
|
935
935
|
<strong>iMessage</strong>
|
|
936
936
|
<span>${o}</span>
|
|
937
937
|
</div>
|
|
938
|
-
${
|
|
938
|
+
${pe("imessage",e)}
|
|
939
939
|
<button
|
|
940
940
|
class="setup-status-action ${e.imessageEnabling?"spinning":""}"
|
|
941
941
|
?disabled=${e.imessageEnabling}
|
|
942
942
|
@click=${e.onIMessageEnable}
|
|
943
943
|
title="${n?"Manage iMessage":"Connect iMessage"}"
|
|
944
944
|
>
|
|
945
|
-
${
|
|
945
|
+
${L.rotateCw}
|
|
946
946
|
</button>
|
|
947
|
-
${
|
|
947
|
+
${k}
|
|
948
948
|
</div>
|
|
949
|
-
`}function yg(e){if(!e.imessageEnableConfirm)return
|
|
949
|
+
`}function yg(e){if(!e.imessageEnableConfirm)return k;const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=la(e),s=()=>{e.onIMessageEnableCancel()};return n?u`
|
|
950
950
|
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
951
951
|
<div class="setup-info-card" style="text-align: center;">
|
|
952
952
|
<h3>iMessage</h3>
|
|
@@ -1003,7 +1003,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1003
1003
|
<div class="setup-info-card" style="text-align: center;">
|
|
1004
1004
|
<h3>Enable iMessage</h3>
|
|
1005
1005
|
<p style="color: var(--tasker-text-grey); font-size: 13px; margin: 8px 0 16px;">
|
|
1006
|
-
${
|
|
1006
|
+
${Ve().name} will respond to messages in Messages.app for this business.
|
|
1007
1007
|
</p>
|
|
1008
1008
|
<button
|
|
1009
1009
|
class="setup-button primary"
|
|
@@ -1022,10 +1022,10 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1022
1022
|
</button>
|
|
1023
1023
|
</div>
|
|
1024
1024
|
</div>
|
|
1025
|
-
`}function Ar(e){if(!e.isMaster)return
|
|
1025
|
+
`}function Ar(e){if(!e.isMaster)return k;const n=e.apiKeyProviders.filter(i=>i.hasKey).length;return u`
|
|
1026
1026
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1027
1027
|
<div class="setup-status-item">
|
|
1028
|
-
${
|
|
1028
|
+
${G(n>0?"good":"bad")}
|
|
1029
1029
|
<div class="setup-status-info">
|
|
1030
1030
|
<strong>API Keys</strong>
|
|
1031
1031
|
<span>${n} configured</span>
|
|
@@ -1037,16 +1037,16 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1037
1037
|
</div>
|
|
1038
1038
|
</div>
|
|
1039
1039
|
${vg(e)}
|
|
1040
|
-
`}function vg(e){if(!e.apiKeyModalOpen)return
|
|
1040
|
+
`}function vg(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,l)=>{const p=l==null?void 0:l.closest(".setup-apikey-input"),h=p==null?void 0:p.querySelector("input"),v=h==null?void 0:h.value.trim();!v||v===n[c]||e.onApiKeySave(c,v)},s=c=>{const l=c.currentTarget,p=l.closest(".setup-apikey-input"),h=p==null?void 0:p.querySelector("input");if(!h)return;const v=h.type==="text";h.type=v?"password":"text",l.classList.toggle("active",!v)},o=(c,l)=>{const p=l.target,h=p.closest(".setup-apikey-input"),v=p.value.trim(),S=v.length>0&&v!==n[c],f=h==null?void 0:h.querySelector(".setup-apikey-save");f&&(f.style.display=S?"":"none");const w=h==null?void 0:h.querySelector(".setup-apikey-eye");w&&(w.style.display=v.length>0?"":"none")},a=t.filter(c=>c.primary),r=t.filter(c=>!c.primary),d=c=>{const l=e.apiKeySavingProvider===c.id&&e.apiKeyBusy,p=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} key saved`,h=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} key removed`,v=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} disabled`,S=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} enabled`;return u`
|
|
1041
1041
|
<div class="setup-apikey-row ${c.disabled?"disabled":""}">
|
|
1042
1042
|
<div class="setup-apikey-info">
|
|
1043
1043
|
<strong>${c.name}</strong>
|
|
1044
1044
|
<span class="setup-apikey-category">${c.category}</span>
|
|
1045
|
-
${p?u`<span class="setup-apikey-badge saved">Saved</span>`:
|
|
1046
|
-
${
|
|
1047
|
-
${v?u`<span class="setup-apikey-badge removed">Disabled</span>`:
|
|
1048
|
-
${
|
|
1049
|
-
${c.disabled&&!
|
|
1045
|
+
${p?u`<span class="setup-apikey-badge saved">Saved</span>`:k}
|
|
1046
|
+
${h?u`<span class="setup-apikey-badge removed">Removed</span>`:k}
|
|
1047
|
+
${v?u`<span class="setup-apikey-badge removed">Disabled</span>`:k}
|
|
1048
|
+
${S?u`<span class="setup-apikey-badge saved">Enabled</span>`:k}
|
|
1049
|
+
${c.disabled&&!S?u`<span class="setup-apikey-badge apikey-disabled">Off</span>`:k}
|
|
1050
1050
|
</div>
|
|
1051
1051
|
<div class="setup-apikey-input">
|
|
1052
1052
|
<input
|
|
@@ -1054,20 +1054,20 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1054
1054
|
.value=${c.key??""}
|
|
1055
1055
|
placeholder="Enter key"
|
|
1056
1056
|
?disabled=${e.apiKeyBusy||c.disabled}
|
|
1057
|
-
@input=${
|
|
1058
|
-
@keydown=${
|
|
1057
|
+
@input=${f=>o(c.id,f)}
|
|
1058
|
+
@keydown=${f=>{f.key==="Enter"&&i(c.id,f.target)}}
|
|
1059
1059
|
/>
|
|
1060
1060
|
<button
|
|
1061
1061
|
class="setup-apikey-icon-btn setup-apikey-eye"
|
|
1062
1062
|
style=${c.hasKey?"":"display: none;"}
|
|
1063
1063
|
title="Toggle visibility"
|
|
1064
1064
|
@click=${s}
|
|
1065
|
-
>${
|
|
1065
|
+
>${L.eye}</button>
|
|
1066
1066
|
${l?u`<span class="setup-apikey-badge saving">Saving\u2026</span>`:u`<button
|
|
1067
1067
|
class="setup-apikey-save setup-button"
|
|
1068
1068
|
style="display: none;"
|
|
1069
1069
|
?disabled=${e.apiKeyBusy}
|
|
1070
|
-
@click=${
|
|
1070
|
+
@click=${f=>i(c.id,f.currentTarget)}
|
|
1071
1071
|
>Save</button>`}
|
|
1072
1072
|
${c.hasKey&&!l?u`
|
|
1073
1073
|
<button
|
|
@@ -1075,14 +1075,14 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1075
1075
|
title="${c.disabled?"Enable":"Disable"}"
|
|
1076
1076
|
?disabled=${e.apiKeyBusy}
|
|
1077
1077
|
@click=${()=>e.onApiKeyDisable(c.id,!c.disabled)}
|
|
1078
|
-
>${
|
|
1078
|
+
>${L.power}</button>
|
|
1079
1079
|
<button
|
|
1080
1080
|
class="setup-apikey-icon-btn danger"
|
|
1081
1081
|
title="Remove key"
|
|
1082
1082
|
?disabled=${e.apiKeyBusy}
|
|
1083
1083
|
@click=${()=>e.onApiKeyRemove(c.id)}
|
|
1084
|
-
>${
|
|
1085
|
-
`:
|
|
1084
|
+
>${L.trash}</button>
|
|
1085
|
+
`:k}
|
|
1086
1086
|
</div>
|
|
1087
1087
|
</div>
|
|
1088
1088
|
`};return u`
|
|
@@ -1090,25 +1090,25 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1090
1090
|
<div class="setup-info-card" style="max-width: 480px;">
|
|
1091
1091
|
<h3 style="margin: 0 0 4px; text-align: center;">API Keys</h3>
|
|
1092
1092
|
<div class="setup-apikey-list">
|
|
1093
|
-
${e.apiKeyError?u`<p class="setup-error" style="margin: 0;">${e.apiKeyError}</p>`:
|
|
1093
|
+
${e.apiKeyError?u`<p class="setup-error" style="margin: 0;">${e.apiKeyError}</p>`:k}
|
|
1094
1094
|
${a.map(d)}
|
|
1095
1095
|
${r.length>0?u`
|
|
1096
1096
|
<details class="setup-apikey-advanced">
|
|
1097
1097
|
<summary>Additional keys</summary>
|
|
1098
1098
|
${r.map(d)}
|
|
1099
1099
|
</details>
|
|
1100
|
-
`:
|
|
1100
|
+
`:k}
|
|
1101
1101
|
</div>
|
|
1102
1102
|
</div>
|
|
1103
1103
|
</div>
|
|
1104
1104
|
`}function Cr(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 u`
|
|
1105
1105
|
<div class="setup-status-item">
|
|
1106
|
-
${
|
|
1106
|
+
${G(t)}
|
|
1107
1107
|
<div class="setup-status-info">
|
|
1108
1108
|
<strong>Software</strong>
|
|
1109
1109
|
<span>${n}</span>
|
|
1110
1110
|
</div>
|
|
1111
|
-
${
|
|
1111
|
+
${pe("update",e)}
|
|
1112
1112
|
${e.updateAvailable?u`
|
|
1113
1113
|
<button
|
|
1114
1114
|
class="setup-status-action ${i?"spinning":""}"
|
|
@@ -1116,7 +1116,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1116
1116
|
@click=${e.onUpdateRun}
|
|
1117
1117
|
title="Update Now"
|
|
1118
1118
|
>
|
|
1119
|
-
${e.updateRunning?
|
|
1119
|
+
${e.updateRunning?L.loader:L.download}
|
|
1120
1120
|
</button>
|
|
1121
1121
|
`:u`
|
|
1122
1122
|
<button
|
|
@@ -1125,13 +1125,13 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1125
1125
|
@click=${e.onUpdateCheck}
|
|
1126
1126
|
title="Check for Updates"
|
|
1127
1127
|
>
|
|
1128
|
-
${
|
|
1128
|
+
${L.rotateCw}
|
|
1129
1129
|
</button>
|
|
1130
1130
|
`}
|
|
1131
1131
|
</div>
|
|
1132
1132
|
`}const bg={anonymous:"Open access",verified:"WhatsApp OTP",choice:"Visitor chooses"};function Er(e){const t=e.publicChatEnabled;return u`
|
|
1133
1133
|
<div class="setup-status-item">
|
|
1134
|
-
${
|
|
1134
|
+
${G(t?"good":"unknown")}
|
|
1135
1135
|
<div class="setup-status-info">
|
|
1136
1136
|
<strong>Public Chat</strong>
|
|
1137
1137
|
${t?u`
|
|
@@ -1146,29 +1146,29 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1146
1146
|
</select>
|
|
1147
1147
|
`:u`<span>Disabled</span>`}
|
|
1148
1148
|
</div>
|
|
1149
|
-
${
|
|
1149
|
+
${pe("public-chat",e)}
|
|
1150
1150
|
<button
|
|
1151
1151
|
class="setup-info-btn"
|
|
1152
1152
|
title="${t?"Disable public chat":"Enable public chat"}"
|
|
1153
1153
|
?disabled=${e.publicChatBusy}
|
|
1154
1154
|
@click=${e.onPublicChatToggle}
|
|
1155
|
-
>${t?
|
|
1155
|
+
>${t?L.powerOff:L.power}</button>
|
|
1156
1156
|
</div>
|
|
1157
1157
|
`}function Tr(e){const t=!!(e.brandAccentColor||e.brandBackgroundColor||e.brandHasLogo),n=t?"good":"unknown",i=e.brandingBusy;return u`
|
|
1158
1158
|
<div class="setup-status-item">
|
|
1159
|
-
${
|
|
1159
|
+
${G(n)}
|
|
1160
1160
|
<div class="setup-status-info">
|
|
1161
1161
|
<strong>Branding</strong>
|
|
1162
1162
|
<span>${t?"Customised":"Default"}</span>
|
|
1163
1163
|
</div>
|
|
1164
|
-
${
|
|
1164
|
+
${pe("branding",e)}
|
|
1165
1165
|
<button
|
|
1166
1166
|
class="setup-link-btn"
|
|
1167
1167
|
?disabled=${i}
|
|
1168
1168
|
@click=${e.onBrandingToggle}
|
|
1169
1169
|
>${i?"...":"Edit"}</button>
|
|
1170
1170
|
</div>
|
|
1171
|
-
`}function _r(e){var s;if(!e.brandingExpanded)return
|
|
1171
|
+
`}function _r(e){var s;if(!e.brandingExpanded)return k;const t=e.brandingBusy,n=(s=e.wsProps)==null?void 0:s.selectedWorkspace,i=e.brandHasLogo&&n?`/brand-logo/${encodeURIComponent(n)}`:"";return u`
|
|
1172
1172
|
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&e.onBrandingToggle()}}>
|
|
1173
1173
|
<div class="setup-info-card" style="max-width: 400px; position: relative;">
|
|
1174
1174
|
<h3 style="margin-right: 24px;">Branding</h3>
|
|
@@ -1214,7 +1214,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1214
1214
|
@keydown=${o=>{if(o.key==="Enter"){const a=o.target.value.trim();/^#[0-9a-fA-F]{6}$/.test(a)&&e.onBrandAccentColorChange(a)}}}
|
|
1215
1215
|
@blur=${o=>{const a=o.target.value.trim();/^#[0-9a-fA-F]{6}$/.test(a)&&a!==(e.brandAccentColor||"#00d4ff")&&e.onBrandAccentColorChange(a)}}
|
|
1216
1216
|
/>
|
|
1217
|
-
${e.brandAccentColor?u`<button class="branding-clear-btn" ?disabled=${t} @click=${()=>e.onBrandAccentColorChange("")}>Clear</button>`:
|
|
1217
|
+
${e.brandAccentColor?u`<button class="branding-clear-btn" ?disabled=${t} @click=${()=>e.onBrandAccentColorChange("")}>Clear</button>`:k}
|
|
1218
1218
|
</div>
|
|
1219
1219
|
</div>
|
|
1220
1220
|
|
|
@@ -1237,7 +1237,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1237
1237
|
@keydown=${o=>{if(o.key==="Enter"){const a=o.target.value.trim();/^#[0-9a-fA-F]{6}$/.test(a)&&e.onBrandBackgroundColorChange(a)}}}
|
|
1238
1238
|
@blur=${o=>{const a=o.target.value.trim();/^#[0-9a-fA-F]{6}$/.test(a)&&a!==(e.brandBackgroundColor||"#12141a")&&e.onBrandBackgroundColorChange(a)}}
|
|
1239
1239
|
/>
|
|
1240
|
-
${e.brandBackgroundColor?u`<button class="branding-clear-btn" ?disabled=${t} @click=${()=>e.onBrandBackgroundColorChange("")}>Clear</button>`:
|
|
1240
|
+
${e.brandBackgroundColor?u`<button class="branding-clear-btn" ?disabled=${t} @click=${()=>e.onBrandBackgroundColorChange("")}>Clear</button>`:k}
|
|
1241
1241
|
</div>
|
|
1242
1242
|
</div>
|
|
1243
1243
|
|
|
@@ -1245,36 +1245,36 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1245
1245
|
<button class="branding-reset-btn" ?disabled=${t} @click=${e.onBrandReset}>
|
|
1246
1246
|
Reset to defaults
|
|
1247
1247
|
</button>
|
|
1248
|
-
`:
|
|
1248
|
+
`:k}
|
|
1249
1249
|
|
|
1250
1250
|
</div>
|
|
1251
1251
|
</div>
|
|
1252
|
-
`}function wg(e){if(!e.isMaster)return
|
|
1252
|
+
`}function wg(e){if(!e.isMaster)return k;const t=e.tailscaleStatus,n=e.tailscaleBusy,i=e.tailscaleAuthUrl;if(!t)return u`
|
|
1253
1253
|
<div class="setup-status-item">
|
|
1254
|
-
${
|
|
1254
|
+
${G("unknown")}
|
|
1255
1255
|
<div class="setup-status-info">
|
|
1256
1256
|
<strong>Remote Access</strong>
|
|
1257
1257
|
<span>Checking...</span>
|
|
1258
1258
|
</div>
|
|
1259
|
-
${
|
|
1259
|
+
${pe("remote-access",e)}
|
|
1260
1260
|
</div>
|
|
1261
1261
|
`;if(!t.installed)return u`
|
|
1262
1262
|
<div class="setup-status-item">
|
|
1263
|
-
${
|
|
1263
|
+
${G("unknown")}
|
|
1264
1264
|
<div class="setup-status-info">
|
|
1265
1265
|
<strong>Remote Access</strong>
|
|
1266
1266
|
<span>Tailscale not installed</span>
|
|
1267
1267
|
</div>
|
|
1268
|
-
${
|
|
1268
|
+
${pe("remote-access",e)}
|
|
1269
1269
|
</div>
|
|
1270
1270
|
`;if(i)return u`
|
|
1271
1271
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
1272
|
-
${
|
|
1272
|
+
${G("partial")}
|
|
1273
1273
|
<div class="setup-status-info">
|
|
1274
1274
|
<strong>Remote Access</strong>
|
|
1275
1275
|
<span>Waiting for authentication...</span>
|
|
1276
1276
|
</div>
|
|
1277
|
-
${
|
|
1277
|
+
${pe("remote-access",e)}
|
|
1278
1278
|
<div style="flex-basis: 100%; padding-top: 8px;">
|
|
1279
1279
|
<p style="margin: 0 0 8px; font-size: 13px; opacity: 0.8;">
|
|
1280
1280
|
Scan the QR code or open the link to log in with your Google or Microsoft account:
|
|
@@ -1298,12 +1298,12 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1298
1298
|
</div>
|
|
1299
1299
|
`;if(!t.loggedIn)return u`
|
|
1300
1300
|
<div class="setup-status-item">
|
|
1301
|
-
${
|
|
1301
|
+
${G("partial")}
|
|
1302
1302
|
<div class="setup-status-info">
|
|
1303
1303
|
<strong>Remote Access</strong>
|
|
1304
1304
|
<span>Not connected</span>
|
|
1305
1305
|
</div>
|
|
1306
|
-
${
|
|
1306
|
+
${pe("remote-access",e)}
|
|
1307
1307
|
<button
|
|
1308
1308
|
class="setup-link-btn"
|
|
1309
1309
|
?disabled=${n}
|
|
@@ -1312,27 +1312,27 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1312
1312
|
</div>
|
|
1313
1313
|
`;if(!t.serveEnabled)return u`
|
|
1314
1314
|
<div class="setup-status-item">
|
|
1315
|
-
${
|
|
1315
|
+
${G("partial")}
|
|
1316
1316
|
<div class="setup-status-info">
|
|
1317
1317
|
<strong>Remote Access</strong>
|
|
1318
1318
|
<span>Connected (not enabled)</span>
|
|
1319
1319
|
</div>
|
|
1320
|
-
${
|
|
1320
|
+
${pe("remote-access",e)}
|
|
1321
1321
|
<button
|
|
1322
1322
|
class="setup-info-btn"
|
|
1323
1323
|
title="Enable remote access"
|
|
1324
1324
|
?disabled=${n}
|
|
1325
1325
|
@click=${e.onTailscaleServeEnable}
|
|
1326
|
-
>${
|
|
1326
|
+
>${L.power}</button>
|
|
1327
1327
|
</div>
|
|
1328
1328
|
`;if(!t.serveActive)return u`
|
|
1329
1329
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
1330
|
-
${
|
|
1330
|
+
${G("bad")}
|
|
1331
1331
|
<div class="setup-status-info">
|
|
1332
1332
|
<strong>Remote Access</strong>
|
|
1333
1333
|
<span>Enabled but not active</span>
|
|
1334
1334
|
</div>
|
|
1335
|
-
${
|
|
1335
|
+
${pe("remote-access",e)}
|
|
1336
1336
|
<div style="flex-basis: 100%; padding-top: 4px;">
|
|
1337
1337
|
<p style="margin: 0; font-size: 13px; color: #f59e0b;">
|
|
1338
1338
|
Remote access is configured but not running. Try disabling and re-enabling, or check that Tailscale is connected.
|
|
@@ -1362,9 +1362,9 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1362
1362
|
rel="noopener"
|
|
1363
1363
|
style="color: var(--tasker-link, #60a5fa); font-size: 13px; word-break: break-all;"
|
|
1364
1364
|
>Open Tailscale admin to enable Funnel →</a>
|
|
1365
|
-
</div>`:e.tailscaleError?u`<p style="flex-basis: 100%; margin: 6px 0 0; font-size: 13px; color: #ef4444;">${e.tailscaleError}</p>`:
|
|
1365
|
+
</div>`:e.tailscaleError?u`<p style="flex-basis: 100%; margin: 6px 0 0; font-size: 13px; color: #ef4444;">${e.tailscaleError}</p>`:k;return u`
|
|
1366
1366
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
1367
|
-
${
|
|
1367
|
+
${G("good")}
|
|
1368
1368
|
<div class="setup-status-info">
|
|
1369
1369
|
<strong>Remote Access</strong>
|
|
1370
1370
|
<span style="display: inline-flex; align-items: center; gap: 4px;">
|
|
@@ -1378,27 +1378,27 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1378
1378
|
class="setup-info-btn"
|
|
1379
1379
|
title="Copy URL"
|
|
1380
1380
|
@click=${async r=>{const d=r.currentTarget;try{await navigator.clipboard.writeText(s)}catch{const c=document.createElement("textarea");c.value=s,c.style.position="fixed",c.style.opacity="0",document.body.appendChild(c),c.select(),document.execCommand("copy"),document.body.removeChild(c)}d.classList.add("copied"),setTimeout(()=>d.classList.remove("copied"),1500)}}
|
|
1381
|
-
>${
|
|
1381
|
+
>${L.copy}</button>
|
|
1382
1382
|
</span>
|
|
1383
1383
|
</div>
|
|
1384
|
-
${
|
|
1384
|
+
${pe("remote-access",e)}
|
|
1385
1385
|
${t.funnelEnabled?u`<button
|
|
1386
1386
|
class="setup-info-btn"
|
|
1387
1387
|
title="Disable internet access"
|
|
1388
1388
|
?disabled=${n}
|
|
1389
1389
|
@click=${e.onTailscaleFunnelDisable}
|
|
1390
|
-
>${
|
|
1390
|
+
>${L.globeOff}</button>`:u`<button
|
|
1391
1391
|
class="setup-info-btn"
|
|
1392
1392
|
title="Enable internet access"
|
|
1393
1393
|
?disabled=${n}
|
|
1394
1394
|
@click=${e.onTailscaleFunnelEnable}
|
|
1395
|
-
>${
|
|
1395
|
+
>${L.globe}</button>`}
|
|
1396
1396
|
<button
|
|
1397
1397
|
class="setup-info-btn"
|
|
1398
1398
|
title="Disable remote access"
|
|
1399
1399
|
?disabled=${n}
|
|
1400
1400
|
@click=${e.onTailscaleDisableConfirmToggle}
|
|
1401
|
-
>${
|
|
1401
|
+
>${L.powerOff}</button>
|
|
1402
1402
|
${a}
|
|
1403
1403
|
</div>
|
|
1404
1404
|
`}function Mr(e){const t=e>=70?4:e>=50?3:e>=30?2:1;return u`
|
|
@@ -1410,9 +1410,9 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1410
1410
|
background: ${s<t?"var(--tasker-accent, #00e5ff)":"rgba(255,255,255,0.15)"};
|
|
1411
1411
|
"></span>`)}
|
|
1412
1412
|
</span>
|
|
1413
|
-
`}function Pr(e){if(e.serverPlatform!=="linux")return
|
|
1413
|
+
`}function Pr(e){if(e.serverPlatform!=="linux")return k;const t=e.wifiStatus,n=e.wifiBusy;if(!t)return u`
|
|
1414
1414
|
<div class="setup-status-item">
|
|
1415
|
-
${
|
|
1415
|
+
${G("unknown")}
|
|
1416
1416
|
<div class="setup-status-info">
|
|
1417
1417
|
<strong>WiFi</strong>
|
|
1418
1418
|
<span>Checking...</span>
|
|
@@ -1420,38 +1420,38 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1420
1420
|
</div>
|
|
1421
1421
|
`;if(!t.available)return u`
|
|
1422
1422
|
<div class="setup-status-item">
|
|
1423
|
-
${
|
|
1423
|
+
${G("unknown")}
|
|
1424
1424
|
<div class="setup-status-info">
|
|
1425
1425
|
<strong>WiFi</strong>
|
|
1426
1426
|
<span>NetworkManager not available</span>
|
|
1427
1427
|
</div>
|
|
1428
1428
|
</div>
|
|
1429
|
-
`;const i=e.wifiNetworks,s=e.wifiSelectedSsid,o=i.length>0,a=!!t.savedSsid&&!t.connected,r=t.connected?"good":"partial",d=t.connected?u`${t.ssid} ${t.signal!=null?u`<span style="margin-left: 4px;">${Mr(t.signal)}</span>`:
|
|
1429
|
+
`;const i=e.wifiNetworks,s=e.wifiSelectedSsid,o=i.length>0,a=!!t.savedSsid&&!t.connected,r=t.connected?"good":"partial",d=t.connected?u`${t.ssid} ${t.signal!=null?u`<span style="margin-left: 4px;">${Mr(t.signal)}</span>`:k}`:a?u`${t.savedSsid} <span style="opacity: 0.4;">\u2014 reconnecting\u2026</span>`:"Not connected";return u`
|
|
1430
1430
|
<div>
|
|
1431
1431
|
<div class="setup-status-item">
|
|
1432
|
-
${
|
|
1432
|
+
${G(r)}
|
|
1433
1433
|
<div class="setup-status-info">
|
|
1434
1434
|
<strong>WiFi</strong>
|
|
1435
1435
|
<span>${d}</span>
|
|
1436
|
-
${t.connected&&t.ip?u`<span style="font-size: 11px; opacity: 0.5;">${t.ip}</span>`:
|
|
1436
|
+
${t.connected&&t.ip?u`<span style="font-size: 11px; opacity: 0.5;">${t.ip}</span>`:k}
|
|
1437
1437
|
</div>
|
|
1438
1438
|
${t.connected?u`<button
|
|
1439
1439
|
class="setup-status-action"
|
|
1440
1440
|
?disabled=${n}
|
|
1441
1441
|
@click=${e.onWifiDisconnect}
|
|
1442
1442
|
title="Disconnect"
|
|
1443
|
-
>${
|
|
1443
|
+
>${L.wifiOff}</button>`:k}
|
|
1444
1444
|
<button
|
|
1445
1445
|
class="setup-status-action ${n?"spinning":""}"
|
|
1446
1446
|
?disabled=${n}
|
|
1447
1447
|
@click=${o?e.onWifiDismiss:e.onWifiScan}
|
|
1448
1448
|
title="${o?"Close":"Scan for networks"}"
|
|
1449
|
-
>${o?
|
|
1449
|
+
>${o?L.x:n?L.loader:L.rotateCw}</button>
|
|
1450
1450
|
</div>
|
|
1451
1451
|
|
|
1452
1452
|
${e.wifiError?u`<div style="padding: 4px 0 4px 28px;">
|
|
1453
1453
|
<p style="margin: 0; font-size: 13px; color: #ef4444;">${e.wifiError}</p>
|
|
1454
|
-
</div>`:
|
|
1454
|
+
</div>`:k}
|
|
1455
1455
|
|
|
1456
1456
|
${o?u`
|
|
1457
1457
|
<div style="padding: 8px 0 4px 28px;">
|
|
@@ -1481,11 +1481,11 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1481
1481
|
@click=${()=>{c.active?e.onWifiDismiss():e.onWifiSelectSsid(s===c.ssid?null:c.ssid)}}
|
|
1482
1482
|
>
|
|
1483
1483
|
<span style="display: flex; align-items: center; gap: 8px;">
|
|
1484
|
-
${c.active?u`<span style="color: #22c55e;" title="Connected">\u2713</span>`:l?u`<span style="opacity: 0.4; font-size: 11px;" title="Saved">\u2605</span>`:
|
|
1484
|
+
${c.active?u`<span style="color: #22c55e;" title="Connected">\u2713</span>`:l?u`<span style="opacity: 0.4; font-size: 11px;" title="Saved">\u2605</span>`:k}
|
|
1485
1485
|
<span>${c.ssid}</span>
|
|
1486
1486
|
</span>
|
|
1487
1487
|
<span style="display: flex; align-items: center; gap: 8px;">
|
|
1488
|
-
${c.security!=="Open"?u`<span style="opacity: 0.4; font-size: 11px;" title="${c.security}">\uD83D\uDD12</span>`:
|
|
1488
|
+
${c.security!=="Open"?u`<span style="opacity: 0.4; font-size: 11px;" title="${c.security}">\uD83D\uDD12</span>`:k}
|
|
1489
1489
|
<span title="Signal: ${c.signal}%">${Mr(c.signal)}</span>
|
|
1490
1490
|
</span>
|
|
1491
1491
|
</button>
|
|
@@ -1494,13 +1494,13 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1494
1494
|
|
|
1495
1495
|
${s&&!i.find(c=>c.ssid===s&&c.active)?u`
|
|
1496
1496
|
<div style="display: flex; gap: 8px; align-items: center;">
|
|
1497
|
-
${(()=>{const c=i.find(
|
|
1497
|
+
${(()=>{const c=i.find(h=>h.ssid===s),l=(c==null?void 0:c.security)!=="Open",p=t.savedSsid===s;return l&&!p?u`
|
|
1498
1498
|
<input
|
|
1499
1499
|
type="password"
|
|
1500
1500
|
placeholder="Password"
|
|
1501
1501
|
.value=${e.wifiPassword}
|
|
1502
|
-
@input=${
|
|
1503
|
-
@keydown=${
|
|
1502
|
+
@input=${h=>e.onWifiPasswordChange(h.target.value)}
|
|
1503
|
+
@keydown=${h=>{h.key==="Enter"&&e.onWifiConnect()}}
|
|
1504
1504
|
?disabled=${n}
|
|
1505
1505
|
style="
|
|
1506
1506
|
flex: 1;
|
|
@@ -1512,7 +1512,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1512
1512
|
font-size: 13px;
|
|
1513
1513
|
outline: none;
|
|
1514
1514
|
"
|
|
1515
|
-
/>`:
|
|
1515
|
+
/>`:k})()}
|
|
1516
1516
|
<button
|
|
1517
1517
|
class="setup-button primary"
|
|
1518
1518
|
style="padding: 6px 16px; font-size: 13px;"
|
|
@@ -1524,13 +1524,13 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1524
1524
|
?disabled=${n}
|
|
1525
1525
|
@click=${e.onWifiForget}
|
|
1526
1526
|
style="font-size: 12px; opacity: 0.6;"
|
|
1527
|
-
>Forget</button>`:
|
|
1527
|
+
>Forget</button>`:k}
|
|
1528
1528
|
</div>
|
|
1529
|
-
`:
|
|
1529
|
+
`:k}
|
|
1530
1530
|
</div>
|
|
1531
|
-
`:
|
|
1531
|
+
`:k}
|
|
1532
1532
|
</div>
|
|
1533
|
-
`}function kg(e){var i,s,o;const t=e.updateRunning,n=e.updateLastResult;if(!t&&!n)return
|
|
1533
|
+
`}function kg(e){var i,s,o;const t=e.updateRunning,n=e.updateLastResult;if(!t&&!n)return k;if(t)return u`
|
|
1534
1534
|
<div class="setup-info-overlay">
|
|
1535
1535
|
<div class="setup-info-card" style="max-width: 400px;">
|
|
1536
1536
|
<h3>Software Update</h3>
|
|
@@ -1539,28 +1539,28 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1539
1539
|
${e.updateProgressSteps.map(a=>u`
|
|
1540
1540
|
<div class="setup-update-step ${a.status}">
|
|
1541
1541
|
<span class="setup-update-step-icon">
|
|
1542
|
-
${a.status==="running"?u`<span class="setup-update-spinner"></span>`:a.status==="done"?u`<span class="setup-update-icon-ok">${
|
|
1542
|
+
${a.status==="running"?u`<span class="setup-update-spinner"></span>`:a.status==="done"?u`<span class="setup-update-icon-ok">${L.check}</span>`:u`<span class="setup-update-icon-fail">${L.x}</span>`}
|
|
1543
1543
|
</span>
|
|
1544
1544
|
<span class="setup-update-step-name">${a.name}</span>
|
|
1545
|
-
${a.durationMs!=null?u`<span class="setup-update-step-time">${Lr(a.durationMs)}</span>`:
|
|
1545
|
+
${a.durationMs!=null?u`<span class="setup-update-step-time">${Lr(a.durationMs)}</span>`:k}
|
|
1546
1546
|
</div>
|
|
1547
1547
|
`)}
|
|
1548
1548
|
</div>
|
|
1549
1549
|
`:u`<div class="setup-spinner" style="margin: 16px auto;"></div>`}
|
|
1550
|
-
${e.updateMessage?u`<p style="text-align: center; color: var(--tasker-text-grey); font-size: 13px; margin: 12px 0 0;">${e.updateMessage}</p>`:
|
|
1550
|
+
${e.updateMessage?u`<p style="text-align: center; color: var(--tasker-text-grey); font-size: 13px; margin: 12px 0 0;">${e.updateMessage}</p>`:k}
|
|
1551
1551
|
</div>
|
|
1552
1552
|
</div>
|
|
1553
1553
|
`;if(n){const a=n.status==="ok";let r;if(a){const c=(i=n.before)==null?void 0:i.version,l=((s=n.after)==null?void 0:s.version)??n.currentVersion;r=c?`v${c} → v${l}`:`Updated to v${l}`}else r=n.reason??((o=n.failedStep)==null?void 0:o.name)??"unknown error";const d=n.durationMs!=null?Lr(n.durationMs):null;return u`
|
|
1554
1554
|
<div class="setup-info-overlay" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onUpdateDismissResult()}}>
|
|
1555
1555
|
<div class="setup-info-card" style="max-width: 360px; text-align: center;">
|
|
1556
|
-
<div class="setup-update-result-icon ${a?"ok":"fail"}">${a?
|
|
1556
|
+
<div class="setup-update-result-icon ${a?"ok":"fail"}">${a?L.circleCheck:L.circleX}</div>
|
|
1557
1557
|
<h3 style="color: ${a?"#22c55e":"#ef4444"};">
|
|
1558
1558
|
${a?"Update Complete":"Update Failed"}
|
|
1559
1559
|
</h3>
|
|
1560
1560
|
<p style="color: var(--tasker-text-grey); font-size: 14px; margin: 8px 0;">
|
|
1561
1561
|
${r}
|
|
1562
1562
|
</p>
|
|
1563
|
-
${d?u`<p style="color: rgba(255,255,255,0.3); font-size: 12px; margin: 4px 0 0;">${d}</p>`:
|
|
1563
|
+
${d?u`<p style="color: rgba(255,255,255,0.3); font-size: 12px; margin: 4px 0 0;">${d}</p>`:k}
|
|
1564
1564
|
<button
|
|
1565
1565
|
class="setup-button secondary"
|
|
1566
1566
|
style="margin-top: 20px; width: 100%; padding: 10px;"
|
|
@@ -1570,26 +1570,26 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1570
1570
|
</button>
|
|
1571
1571
|
</div>
|
|
1572
1572
|
</div>
|
|
1573
|
-
`}return
|
|
1573
|
+
`}return k}function Lr(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 Ir(e){const t=e.accountHasPin;return u`
|
|
1574
1574
|
<div class="setup-status-item">
|
|
1575
|
-
${
|
|
1575
|
+
${G(t?"good":"bad")}
|
|
1576
1576
|
<div class="setup-status-info">
|
|
1577
1577
|
<strong>Account PIN</strong>
|
|
1578
1578
|
<span>${t?"Set":"Not set"}</span>
|
|
1579
1579
|
</div>
|
|
1580
|
-
${
|
|
1580
|
+
${pe("account-pin",e)}
|
|
1581
1581
|
<button
|
|
1582
1582
|
class="setup-link-btn"
|
|
1583
1583
|
@click=${()=>e.onAccountPinModalOpen()}
|
|
1584
1584
|
>${t?"Change":"Set PIN"}</button>
|
|
1585
1585
|
</div>
|
|
1586
|
-
`}function Rr(e){if(!e.accountPinModalOpen)return
|
|
1586
|
+
`}function Rr(e){if(!e.accountPinModalOpen)return k;const t=e.accountHasPin,n=e.accountPinBusy;let i="",s="",o="";const a=c=>l=>{const p=l.target;p.value=p.value.replace(/\D/g,"").slice(0,6),c(p.value)},r=(c,l)=>{var h;let p=c.querySelector(".pin-modal-validation");p||(p=document.createElement("p"),p.className="login-error pin-modal-validation",(h=c.querySelector("button[type=submit]"))==null||h.before(p)),p.textContent=l},d=c=>{c.preventDefault();const l=c.target;if(!n){if(t&&!i){r(l,"Enter your current PIN");return}if(!s){r(l,"Enter a new PIN");return}if(!o){r(l,"Confirm your new PIN");return}if(s!==o){r(l,"PINs do not match");return}if(s.length<4){r(l,"PIN must be 4–6 digits");return}e.onAccountPinSave(t?i:null,s)}};return u`
|
|
1587
1587
|
<div class="setup-info-overlay" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onAccountPinModalClose()}}>
|
|
1588
1588
|
<div class="setup-info-card" style="max-width: 340px;">
|
|
1589
1589
|
<div class="setup-info-header">
|
|
1590
1590
|
<h3>${t?"Change Account PIN":"Set Account PIN"}</h3>
|
|
1591
1591
|
<button class="setup-info-close" @click=${()=>e.onAccountPinModalClose()}>
|
|
1592
|
-
${
|
|
1592
|
+
${L.close}
|
|
1593
1593
|
</button>
|
|
1594
1594
|
</div>
|
|
1595
1595
|
<form @submit=${d} style="display: flex; flex-direction: column; gap: 12px; padding: 16px 0 8px;">
|
|
@@ -1606,7 +1606,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1606
1606
|
@input=${a(c=>{i=c})}
|
|
1607
1607
|
autofocus
|
|
1608
1608
|
/>
|
|
1609
|
-
`:
|
|
1609
|
+
`:k}
|
|
1610
1610
|
<input
|
|
1611
1611
|
class="login-pin-input"
|
|
1612
1612
|
type="password"
|
|
@@ -1617,7 +1617,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1617
1617
|
placeholder="New PIN (4–6 digits)"
|
|
1618
1618
|
?disabled=${n}
|
|
1619
1619
|
@input=${a(c=>{s=c})}
|
|
1620
|
-
${t?
|
|
1620
|
+
${t?k:u`autofocus`}
|
|
1621
1621
|
/>
|
|
1622
1622
|
<input
|
|
1623
1623
|
class="login-pin-input"
|
|
@@ -1630,8 +1630,8 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1630
1630
|
?disabled=${n}
|
|
1631
1631
|
@input=${a(c=>{o=c})}
|
|
1632
1632
|
/>
|
|
1633
|
-
${e.accountPinError?u`<p class="login-error">${e.accountPinError}</p>`:
|
|
1634
|
-
${e.accountPinSuccess?u`<p class="login-success">${e.accountPinSuccess}</p>`:
|
|
1633
|
+
${e.accountPinError?u`<p class="login-error">${e.accountPinError}</p>`:k}
|
|
1634
|
+
${e.accountPinSuccess?u`<p class="login-success">${e.accountPinSuccess}</p>`:k}
|
|
1635
1635
|
<button
|
|
1636
1636
|
class="login-submit"
|
|
1637
1637
|
type="submit"
|
|
@@ -1640,7 +1640,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1640
1640
|
</form>
|
|
1641
1641
|
</div>
|
|
1642
1642
|
</div>
|
|
1643
|
-
`}function Dr(e){if(!e.addingWorkspace)return
|
|
1643
|
+
`}function Dr(e){if(!e.addingWorkspace)return k;const{workspaceSaving:t}=e;return u`
|
|
1644
1644
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1645
1645
|
<div class="setup-add-account">
|
|
1646
1646
|
<strong>New Account</strong>
|
|
@@ -1693,7 +1693,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1693
1693
|
</div>
|
|
1694
1694
|
</div>
|
|
1695
1695
|
</div>
|
|
1696
|
-
`}function Br(e){const t=
|
|
1696
|
+
`}function Br(e){const t=en(e);return!t||t.isDefault?k:e.workspaceRemoveConfirm===t.name?u`
|
|
1697
1697
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 12px;">
|
|
1698
1698
|
<div style="font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
|
1699
1699
|
<span style="color: var(--tasker-danger, #ef4444);">Remove "${t.displayName??t.name}" and its WhatsApp account?</span>
|
|
@@ -1767,7 +1767,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1767
1767
|
Cancel
|
|
1768
1768
|
</button>
|
|
1769
1769
|
</div>
|
|
1770
|
-
${e.uninstallError?u`<p class="setup-error" style="margin-top: 8px; font-size: 12px;">${e.uninstallError}</p>`:
|
|
1770
|
+
${e.uninstallError?u`<p class="setup-error" style="margin-top: 8px; font-size: 12px;">${e.uninstallError}</p>`:k}
|
|
1771
1771
|
</div>
|
|
1772
1772
|
`}return u`
|
|
1773
1773
|
<p class="setup-hint" style="margin-top: 8px;">
|
|
@@ -1795,7 +1795,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1795
1795
|
Scan the code above with your phone
|
|
1796
1796
|
</p>`}
|
|
1797
1797
|
<p class="setup-hint" style="margin-top: 16px;">
|
|
1798
|
-
<strong>Important:</strong> If you see "${
|
|
1798
|
+
<strong>Important:</strong> If you see "${Ve().name}" in your Linked
|
|
1799
1799
|
Devices, remove it first before scanning.
|
|
1800
1800
|
</p>
|
|
1801
1801
|
<div class="setup-actions" style="margin-top: 24px;">
|
|
@@ -1824,7 +1824,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1824
1824
|
${kr(e)}
|
|
1825
1825
|
${$r(e)}
|
|
1826
1826
|
${Sr(e)}
|
|
1827
|
-
${e.serverPlatform==="darwin"?xr(e):
|
|
1827
|
+
${e.serverPlatform==="darwin"?xr(e):k}
|
|
1828
1828
|
${Ir(e)}
|
|
1829
1829
|
${Cr(e)}
|
|
1830
1830
|
${Er(e)}
|
|
@@ -1840,7 +1840,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1840
1840
|
${Br(e)}
|
|
1841
1841
|
${Nr(e)}
|
|
1842
1842
|
${Fr()}
|
|
1843
|
-
${e.workspacesError?u`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:
|
|
1843
|
+
${e.workspacesError?u`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:k}
|
|
1844
1844
|
</div>
|
|
1845
1845
|
</div>
|
|
1846
1846
|
`:u`
|
|
@@ -1852,7 +1852,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1852
1852
|
${kr(e)}
|
|
1853
1853
|
${$r(e)}
|
|
1854
1854
|
${Sr(e)}
|
|
1855
|
-
${e.serverPlatform==="darwin"?xr(e):
|
|
1855
|
+
${e.serverPlatform==="darwin"?xr(e):k}
|
|
1856
1856
|
${Ir(e)}
|
|
1857
1857
|
${Cr(e)}
|
|
1858
1858
|
${Er(e)}
|
|
@@ -1867,15 +1867,15 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1867
1867
|
${Br(e)}
|
|
1868
1868
|
${Nr(e)}
|
|
1869
1869
|
${Fr()}
|
|
1870
|
-
${e.workspacesError?u`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:
|
|
1870
|
+
${e.workspacesError?u`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:k}
|
|
1871
1871
|
</div>
|
|
1872
1872
|
</div>
|
|
1873
1873
|
`:o?s===!1&&n&&!t?u`
|
|
1874
1874
|
<div class="setup-container">
|
|
1875
1875
|
<div class="setup-card">
|
|
1876
|
-
${
|
|
1876
|
+
${Ae("whatsapp")}
|
|
1877
1877
|
<div class="setup-status-row">
|
|
1878
|
-
${
|
|
1878
|
+
${G("bad")}
|
|
1879
1879
|
<span>Connection Failed</span>
|
|
1880
1880
|
</div>
|
|
1881
1881
|
<p class="setup-error">${n}</p>
|
|
@@ -1891,7 +1891,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1891
1891
|
`:u`
|
|
1892
1892
|
<div class="setup-container">
|
|
1893
1893
|
<div class="setup-card">
|
|
1894
|
-
${
|
|
1894
|
+
${Ae("whatsapp")}
|
|
1895
1895
|
${n?u`<p class="setup-error">${n}</p>`:u`<div class="setup-spinner"></div>
|
|
1896
1896
|
<p>Preparing...</p>`}
|
|
1897
1897
|
</div>
|
|
@@ -1899,7 +1899,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1899
1899
|
`:u`
|
|
1900
1900
|
<div class="setup-container">
|
|
1901
1901
|
<div class="setup-card">
|
|
1902
|
-
${
|
|
1902
|
+
${Ae("whatsapp")}
|
|
1903
1903
|
<div class="setup-spinner"></div>
|
|
1904
1904
|
<p>Checking connection status...</p>
|
|
1905
1905
|
<button
|
|
@@ -1934,7 +1934,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1934
1934
|
<p>${o?"Restarting gateway after update…":"Connecting to gateway..."}</p>
|
|
1935
1935
|
</div>
|
|
1936
1936
|
</div>
|
|
1937
|
-
`}let i;switch(n){case"license":i=vr(e);break;case"auth":i=pg(e);break;case"whatsapp":case"complete":i=$g(e);break;default:i=vr(e)}const s=
|
|
1937
|
+
`}let i;switch(n){case"license":i=vr(e);break;case"auth":i=pg(e);break;case"whatsapp":case"complete":i=$g(e);break;default:i=vr(e)}const s=Mt("Setup",e.wsProps);return u`${i}${ug(e)}${yg(e)}${mg(e)}${kg(e)}${s}`}function xg(e,t){const n=e.paired?"Paired phone (used to link WhatsApp)":"Admin access via WhatsApp DM";return u`
|
|
1938
1938
|
<div class="sp-list-item">
|
|
1939
1939
|
<div class="sp-list-item-main">
|
|
1940
1940
|
<div class="sp-list-item-title">${e.phone}</div>
|
|
@@ -1958,7 +1958,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1958
1958
|
</div>
|
|
1959
1959
|
`;const t=n=>{n.preventDefault(),e.newPhone.trim()&&e.onAdd(e.newPhone)};return u`
|
|
1960
1960
|
<div class="setup-container">
|
|
1961
|
-
${
|
|
1961
|
+
${Mt("Admins",e.wsProps)}
|
|
1962
1962
|
<div class="setup-card" style="max-width: 520px;">
|
|
1963
1963
|
<h1>Admin Phones</h1>
|
|
1964
1964
|
<p style="margin-bottom: 16px;">
|
|
@@ -1976,7 +1976,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1976
1976
|
</button>
|
|
1977
1977
|
</div>
|
|
1978
1978
|
|
|
1979
|
-
${e.error?u`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:
|
|
1979
|
+
${e.error?u`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:k}
|
|
1980
1980
|
|
|
1981
1981
|
<form style="display: flex; flex-direction: row; gap: 12px; margin-top: 20px; align-items: stretch;" @submit=${t}>
|
|
1982
1982
|
<input
|
|
@@ -2151,7 +2151,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2151
2151
|
</div>
|
|
2152
2152
|
<span class="contacts-record-meta">${s}</span>
|
|
2153
2153
|
</div>
|
|
2154
|
-
${n?_g(e,t):
|
|
2154
|
+
${n?_g(e,t):k}
|
|
2155
2155
|
</div>
|
|
2156
2156
|
`}function Pg(e){if(!e.connected)return u`
|
|
2157
2157
|
<div class="setup-container">
|
|
@@ -2162,7 +2162,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2162
2162
|
</div>
|
|
2163
2163
|
`;const t=o=>{o.preventDefault(),e.onSearchSubmit()},n=o=>{o.preventDefault(),e.newRecordPhone.trim()&&e.newRecordName.trim()&&e.onAdd(e.newRecordPhone,e.newRecordName)},i=e.deleteConfirmId?e.records.find(o=>o.id===e.deleteConfirmId):null,s=e.addFieldForId?e.records.find(o=>o.id===e.addFieldForId):null;return u`
|
|
2164
2164
|
<div class="setup-container">
|
|
2165
|
-
${
|
|
2165
|
+
${Mt("Contacts",e.wsProps)}
|
|
2166
2166
|
<div class="setup-card" style="max-width: 620px;">
|
|
2167
2167
|
<h1>Contact Records</h1>
|
|
2168
2168
|
<p style="margin-bottom: 16px;">
|
|
@@ -2187,7 +2187,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2187
2187
|
</button>
|
|
2188
2188
|
</div>
|
|
2189
2189
|
|
|
2190
|
-
${e.error?u`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:
|
|
2190
|
+
${e.error?u`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:k}
|
|
2191
2191
|
|
|
2192
2192
|
${e.showAddForm?u`
|
|
2193
2193
|
<form class="contacts-add-form" @submit=${n}>
|
|
@@ -2224,7 +2224,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2224
2224
|
</button>
|
|
2225
2225
|
</div>
|
|
2226
2226
|
</form>
|
|
2227
|
-
`:
|
|
2227
|
+
`:k}
|
|
2228
2228
|
|
|
2229
2229
|
<form
|
|
2230
2230
|
class="contacts-search"
|
|
@@ -2261,13 +2261,13 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2261
2261
|
</div>
|
|
2262
2262
|
</div>
|
|
2263
2263
|
|
|
2264
|
-
${i?Eg(i,e):
|
|
2265
|
-
${s?Tg(s,e):
|
|
2266
|
-
`}const vd={CHILD:2},bd=e=>(...t)=>({_$litDirective$:e,values:t});let wd=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:Lg}=pp,Or=e=>e,Ur=()=>document.createComment(""),ln=(e,t,n)=>{var o;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=i.insertBefore(Ur(),s),r=i.insertBefore(Ur(),s);n=new Lg(a,r,e,e.options)}else{const a=n._$AB.nextSibling,r=n._$AM,d=r!==e;if(d){let c;(o=n._$AQ)==null||o.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==r._$AU&&n._$AP(c)}if(a!==s||d){let c=n._$AA;for(;c!==a;){const l=Or(c).nextSibling;Or(i).insertBefore(c,s),c=l}}}return n},pt=(e,t,n=e)=>(e._$AI(t,n),e),Ig={},Rg=(e,t=Ig)=>e._$AH=t,Dg=e=>e._$AH,_s=e=>{e._$AR(),e._$AA.remove()};const Kr=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},Bg=bd(class extends wd{constructor(e){if(super(e),e.type!==vd.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=[],o=[];let a=0;for(const r of e)s[a]=i?i(r,a):a,o[a]=n(r,a),a++;return{values:o,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=Dg(e),{values:o,keys:a}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=a,o;const r=this.ut??(this.ut=[]),d=[];let c,l,p=0,f=s.length-1,v=0,h=o.length-1;for(;p<=f&&v<=h;)if(s[p]===null)p++;else if(s[f]===null)f--;else if(r[p]===a[v])d[v]=pt(s[p],o[v]),p++,v++;else if(r[f]===a[h])d[h]=pt(s[f],o[h]),f--,h--;else if(r[p]===a[h])d[h]=pt(s[p],o[h]),ln(e,d[h+1],s[p]),p++,h--;else if(r[f]===a[v])d[v]=pt(s[f],o[v]),ln(e,s[p],s[f]),f--,v++;else if(c===void 0&&(c=Kr(a,v,h),l=Kr(r,p,f)),c.has(r[p]))if(c.has(r[f])){const b=l.get(a[v]),S=b!==void 0?s[b]:null;if(S===null){const $=ln(e,s[p]);pt($,o[v]),d[v]=$}else d[v]=pt(S,o[v]),ln(e,s[p],S),s[b]=null;v++}else _s(s[f]),f--;else _s(s[p]),p++;for(;v<=h;){const b=ln(e,d[h+1]);pt(b,o[v]),d[v++]=b}for(;p<=f;){const b=s[p++];b!==null&&_s(b)}return this.ut=a,Rg(e,d),it}});class ho extends wd{constructor(t){if(super(t),this.it=w,t.type!==vd.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===w||t==null)return this._t=void 0,this.it=t;if(t===it)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:[]}}}ho.directiveName="unsafeHTML",ho.resultType=1;const Li=bd(ho);const{entries:kd,setPrototypeOf:Wr,isFrozen:Ng,getPrototypeOf:Fg,getOwnPropertyDescriptor:Og}=Object;let{freeze:fe,seal:ve,create:fo}=Object,{apply:go,construct:mo}=typeof Reflect<"u"&&Reflect;fe||(fe=function(t){return t});ve||(ve=function(t){return t});go||(go=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(n,s)});mo||(mo=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 ai=ge(Array.prototype.forEach),Ug=ge(Array.prototype.lastIndexOf),zr=ge(Array.prototype.pop),cn=ge(Array.prototype.push),Kg=ge(Array.prototype.splice),yi=ge(String.prototype.toLowerCase),Ms=ge(String.prototype.toString),Ps=ge(String.prototype.match),dn=ge(String.prototype.replace),Wg=ge(String.prototype.indexOf),zg=ge(String.prototype.trim),we=ge(Object.prototype.hasOwnProperty),de=ge(RegExp.prototype.test),un=qg(TypeError);function ge(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 go(e,t,i)}}function qg(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return mo(e,n)}}function U(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yi;Wr&&Wr(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(Ng(t)||(t[i]=o),s=o)}e[s]=!0}return e}function Hg(e){for(let t=0;t<e.length;t++)we(e,t)||(e[t]=null);return e}function Pe(e){const t=fo(null);for(const[n,i]of kd(e))we(e,n)&&(Array.isArray(i)?t[n]=Hg(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Pe(i):t[n]=i);return t}function pn(e,t){for(;e!==null;){const i=Og(e,t);if(i){if(i.get)return ge(i.get);if(typeof i.value=="function")return ge(i.value)}e=Fg(e)}function n(){return null}return n}const qr=fe(["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"]),Ls=fe(["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"]),Is=fe(["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"]),jg=fe(["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"]),Rs=fe(["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"]),Vg=fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Hr=fe(["#text"]),jr=fe(["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"]),Ds=fe(["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"]),Vr=fe(["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"]),ri=fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gg=ve(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qg=ve(/<%[\w\W]*|[\w\W]*%>/gm),Yg=ve(/\$\{[\w\W]*/gm),Jg=ve(/^data-[\-\w.\u00B7-\uFFFF]+$/),Xg=ve(/^aria-[\-\w]+$/),$d=ve(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zg=ve(/^(?:\w+script|data):/i),em=ve(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sd=ve(/^html$/i),tm=ve(/^[a-z][.\w]*(-[.\w]+)+$/i);var Gr=Object.freeze({__proto__:null,ARIA_ATTR:Xg,ATTR_WHITESPACE:em,CUSTOM_ELEMENT:tm,DATA_ATTR:Jg,DOCTYPE_NAME:Sd,ERB_EXPR:Qg,IS_ALLOWED_URI:$d,IS_SCRIPT_OR_DATA:Zg,MUSTACHE_EXPR:Gg,TMPLIT_EXPR:Yg});const hn={element:1,text:3,progressingInstruction:7,comment:8,document:9},nm=function(){return typeof window>"u"?null:window},im=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 o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Qr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nm();const t=R=>xd(R);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==hn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:r,Element:d,NodeFilter:c,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:v}=e,h=d.prototype,b=pn(h,"cloneNode"),S=pn(h,"remove"),$=pn(h,"nextSibling"),x=pn(h,"childNodes"),C=pn(h,"parentNode");if(typeof a=="function"){const R=n.createElement("template");R.content&&R.content.ownerDocument&&(n=R.content.ownerDocument)}let T,_="";const{implementation:D,createNodeIterator:O,createDocumentFragment:ne,getElementsByTagName:be}=n,{importNode:Ye}=i;let ee=Qr();t.isSupported=typeof kd=="function"&&typeof C=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:tn,ERB_EXPR:Lt,TMPLIT_EXPR:rt,DATA_ATTR:ss,ARIA_ATTR:os,IS_SCRIPT_OR_DATA:as,ATTR_WHITESPACE:Kn,CUSTOM_ELEMENT:rs}=Gr;let{IS_ALLOWED_URI:Wn}=Gr,J=null;const zn=U({},[...qr,...Ls,...Is,...Rs,...Hr]);let X=null;const qn=U({},[...jr,...Ds,...Vr,...ri]);let G=Object.seal(fo(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}})),lt=null,nn=null;const Je=Object.seal(fo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Hn=!0,A=!0,M=!1,N=!0,F=!1,Q=!0,H=!1,ce=!1,Xe=!1,It=!1,jn=!1,Vn=!1,Ea=!0,Ta=!1;const Du="user-content-";let ls=!0,sn=!1,Rt={},Ee=null;const cs=U({},["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 _a=null;const Ma=U({},["audio","video","img","source","image","track"]);let ds=null;const Pa=U({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gn="http://www.w3.org/1998/Math/MathML",Qn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let Dt=Oe,us=!1,ps=null;const Bu=U({},[Gn,Qn,Oe],Ms);let Yn=U({},["mi","mo","mn","ms","mtext"]),Jn=U({},["annotation-xml"]);const Nu=U({},["title","style","font","a","script"]);let on=null;const Fu=["application/xhtml+xml","text/html"],Ou="text/html";let te=null,Bt=null;const Uu=n.createElement("form"),La=function(k){return k instanceof RegExp||k instanceof Function},hs=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Bt&&Bt===k)){if((!k||typeof k!="object")&&(k={}),k=Pe(k),on=Fu.indexOf(k.PARSER_MEDIA_TYPE)===-1?Ou:k.PARSER_MEDIA_TYPE,te=on==="application/xhtml+xml"?Ms:yi,J=we(k,"ALLOWED_TAGS")?U({},k.ALLOWED_TAGS,te):zn,X=we(k,"ALLOWED_ATTR")?U({},k.ALLOWED_ATTR,te):qn,ps=we(k,"ALLOWED_NAMESPACES")?U({},k.ALLOWED_NAMESPACES,Ms):Bu,ds=we(k,"ADD_URI_SAFE_ATTR")?U(Pe(Pa),k.ADD_URI_SAFE_ATTR,te):Pa,_a=we(k,"ADD_DATA_URI_TAGS")?U(Pe(Ma),k.ADD_DATA_URI_TAGS,te):Ma,Ee=we(k,"FORBID_CONTENTS")?U({},k.FORBID_CONTENTS,te):cs,lt=we(k,"FORBID_TAGS")?U({},k.FORBID_TAGS,te):Pe({}),nn=we(k,"FORBID_ATTR")?U({},k.FORBID_ATTR,te):Pe({}),Rt=we(k,"USE_PROFILES")?k.USE_PROFILES:!1,Hn=k.ALLOW_ARIA_ATTR!==!1,A=k.ALLOW_DATA_ATTR!==!1,M=k.ALLOW_UNKNOWN_PROTOCOLS||!1,N=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,F=k.SAFE_FOR_TEMPLATES||!1,Q=k.SAFE_FOR_XML!==!1,H=k.WHOLE_DOCUMENT||!1,It=k.RETURN_DOM||!1,jn=k.RETURN_DOM_FRAGMENT||!1,Vn=k.RETURN_TRUSTED_TYPE||!1,Xe=k.FORCE_BODY||!1,Ea=k.SANITIZE_DOM!==!1,Ta=k.SANITIZE_NAMED_PROPS||!1,ls=k.KEEP_CONTENT!==!1,sn=k.IN_PLACE||!1,Wn=k.ALLOWED_URI_REGEXP||$d,Dt=k.NAMESPACE||Oe,Yn=k.MATHML_TEXT_INTEGRATION_POINTS||Yn,Jn=k.HTML_INTEGRATION_POINTS||Jn,G=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&La(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(G.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&La(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(G.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),F&&(A=!1),jn&&(It=!0),Rt&&(J=U({},Hr),X=[],Rt.html===!0&&(U(J,qr),U(X,jr)),Rt.svg===!0&&(U(J,Ls),U(X,Ds),U(X,ri)),Rt.svgFilters===!0&&(U(J,Is),U(X,Ds),U(X,ri)),Rt.mathMl===!0&&(U(J,Rs),U(X,Vr),U(X,ri))),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?Je.tagCheck=k.ADD_TAGS:(J===zn&&(J=Pe(J)),U(J,k.ADD_TAGS,te))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?Je.attributeCheck=k.ADD_ATTR:(X===qn&&(X=Pe(X)),U(X,k.ADD_ATTR,te))),k.ADD_URI_SAFE_ATTR&&U(ds,k.ADD_URI_SAFE_ATTR,te),k.FORBID_CONTENTS&&(Ee===cs&&(Ee=Pe(Ee)),U(Ee,k.FORBID_CONTENTS,te)),k.ADD_FORBID_CONTENTS&&(Ee===cs&&(Ee=Pe(Ee)),U(Ee,k.ADD_FORBID_CONTENTS,te)),ls&&(J["#text"]=!0),H&&U(J,["html","head","body"]),J.table&&(U(J,["tbody"]),delete lt.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=k.TRUSTED_TYPES_POLICY,_=T.createHTML("")}else T===void 0&&(T=im(v,s)),T!==null&&typeof _=="string"&&(_=T.createHTML(""));fe&&fe(k),Bt=k}},Ia=U({},[...Ls,...Is,...jg]),Ra=U({},[...Rs,...Vg]),Ku=function(k){let E=C(k);(!E||!E.tagName)&&(E={namespaceURI:Dt,tagName:"template"});const I=yi(k.tagName),j=yi(E.tagName);return ps[k.namespaceURI]?k.namespaceURI===Qn?E.namespaceURI===Oe?I==="svg":E.namespaceURI===Gn?I==="svg"&&(j==="annotation-xml"||Yn[j]):!!Ia[I]:k.namespaceURI===Gn?E.namespaceURI===Oe?I==="math":E.namespaceURI===Qn?I==="math"&&Jn[j]:!!Ra[I]:k.namespaceURI===Oe?E.namespaceURI===Qn&&!Jn[j]||E.namespaceURI===Gn&&!Yn[j]?!1:!Ra[I]&&(Nu[I]||!Ia[I]):!!(on==="application/xhtml+xml"&&ps[k.namespaceURI]):!1},Te=function(k){cn(t.removed,{element:k});try{C(k).removeChild(k)}catch{S(k)}},ct=function(k,E){try{cn(t.removed,{attribute:E.getAttributeNode(k),from:E})}catch{cn(t.removed,{attribute:null,from:E})}if(E.removeAttribute(k),k==="is")if(It||jn)try{Te(E)}catch{}else try{E.setAttribute(k,"")}catch{}},Da=function(k){let E=null,I=null;if(Xe)k="<remove></remove>"+k;else{const Z=Ps(k,/^[\r\n\t ]+/);I=Z&&Z[0]}on==="application/xhtml+xml"&&Dt===Oe&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const j=T?T.createHTML(k):k;if(Dt===Oe)try{E=new f().parseFromString(j,on)}catch{}if(!E||!E.documentElement){E=D.createDocument(Dt,"template",null);try{E.documentElement.innerHTML=us?_:j}catch{}}const ae=E.body||E.documentElement;return k&&I&&ae.insertBefore(n.createTextNode(I),ae.childNodes[0]||null),Dt===Oe?be.call(E,H?"html":"body")[0]:H?E.documentElement:ae},Ba=function(k){return O.call(k.ownerDocument||k,k,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},fs=function(k){return k instanceof p&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof l)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Na=function(k){return typeof r=="function"&&k instanceof r};function Ue(R,k,E){ai(R,I=>{I.call(t,k,E,Bt)})}const Fa=function(k){let E=null;if(Ue(ee.beforeSanitizeElements,k,null),fs(k))return Te(k),!0;const I=te(k.nodeName);if(Ue(ee.uponSanitizeElement,k,{tagName:I,allowedTags:J}),Q&&k.hasChildNodes()&&!Na(k.firstElementChild)&&de(/<[/\w!]/g,k.innerHTML)&&de(/<[/\w!]/g,k.textContent)||k.nodeType===hn.progressingInstruction||Q&&k.nodeType===hn.comment&&de(/<[/\w]/g,k.data))return Te(k),!0;if(!(Je.tagCheck instanceof Function&&Je.tagCheck(I))&&(!J[I]||lt[I])){if(!lt[I]&&Ua(I)&&(G.tagNameCheck instanceof RegExp&&de(G.tagNameCheck,I)||G.tagNameCheck instanceof Function&&G.tagNameCheck(I)))return!1;if(ls&&!Ee[I]){const j=C(k)||k.parentNode,ae=x(k)||k.childNodes;if(ae&&j){const Z=ae.length;for(let me=Z-1;me>=0;--me){const Ke=b(ae[me],!0);Ke.__removalCount=(k.__removalCount||0)+1,j.insertBefore(Ke,$(k))}}}return Te(k),!0}return k instanceof d&&!Ku(k)||(I==="noscript"||I==="noembed"||I==="noframes")&&de(/<\/no(script|embed|frames)/i,k.innerHTML)?(Te(k),!0):(F&&k.nodeType===hn.text&&(E=k.textContent,ai([tn,Lt,rt],j=>{E=dn(E,j," ")}),k.textContent!==E&&(cn(t.removed,{element:k.cloneNode()}),k.textContent=E)),Ue(ee.afterSanitizeElements,k,null),!1)},Oa=function(k,E,I){if(Ea&&(E==="id"||E==="name")&&(I in n||I in Uu))return!1;if(!(A&&!nn[E]&&de(ss,E))){if(!(Hn&&de(os,E))){if(!(Je.attributeCheck instanceof Function&&Je.attributeCheck(E,k))){if(!X[E]||nn[E]){if(!(Ua(k)&&(G.tagNameCheck instanceof RegExp&&de(G.tagNameCheck,k)||G.tagNameCheck instanceof Function&&G.tagNameCheck(k))&&(G.attributeNameCheck instanceof RegExp&&de(G.attributeNameCheck,E)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(E,k))||E==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&de(G.tagNameCheck,I)||G.tagNameCheck instanceof Function&&G.tagNameCheck(I))))return!1}else if(!ds[E]){if(!de(Wn,dn(I,Kn,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&k!=="script"&&Wg(I,"data:")===0&&_a[k])){if(!(M&&!de(as,dn(I,Kn,"")))){if(I)return!1}}}}}}}return!0},Ua=function(k){return k!=="annotation-xml"&&Ps(k,rs)},Ka=function(k){Ue(ee.beforeSanitizeAttributes,k,null);const{attributes:E}=k;if(!E||fs(k))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0};let j=E.length;for(;j--;){const ae=E[j],{name:Z,namespaceURI:me,value:Ke}=ae,Nt=te(Z),gs=Ke;let se=Z==="value"?gs:zg(gs);if(I.attrName=Nt,I.attrValue=se,I.keepAttr=!0,I.forceKeepAttr=void 0,Ue(ee.uponSanitizeAttribute,k,I),se=I.attrValue,Ta&&(Nt==="id"||Nt==="name")&&(ct(Z,k),se=Du+se),Q&&de(/((--!?|])>)|<\/(style|title|textarea)/i,se)){ct(Z,k);continue}if(Nt==="attributename"&&Ps(se,"href")){ct(Z,k);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){ct(Z,k);continue}if(!N&&de(/\/>/i,se)){ct(Z,k);continue}F&&ai([tn,Lt,rt],za=>{se=dn(se,za," ")});const Wa=te(k.nodeName);if(!Oa(Wa,Nt,se)){ct(Z,k);continue}if(T&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!me)switch(v.getAttributeType(Wa,Nt)){case"TrustedHTML":{se=T.createHTML(se);break}case"TrustedScriptURL":{se=T.createScriptURL(se);break}}if(se!==gs)try{me?k.setAttributeNS(me,Z,se):k.setAttribute(Z,se),fs(k)?Te(k):zr(t.removed)}catch{ct(Z,k)}}Ue(ee.afterSanitizeAttributes,k,null)},Wu=function R(k){let E=null;const I=Ba(k);for(Ue(ee.beforeSanitizeShadowDOM,k,null);E=I.nextNode();)Ue(ee.uponSanitizeShadowNode,E,null),Fa(E),Ka(E),E.content instanceof o&&R(E.content);Ue(ee.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(R){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,I=null,j=null,ae=null;if(us=!R,us&&(R="<!-->"),typeof R!="string"&&!Na(R))if(typeof R.toString=="function"){if(R=R.toString(),typeof R!="string")throw un("dirty is not a string, aborting")}else throw un("toString is not a function");if(!t.isSupported)return R;if(ce||hs(k),t.removed=[],typeof R=="string"&&(sn=!1),sn){if(R.nodeName){const Ke=te(R.nodeName);if(!J[Ke]||lt[Ke])throw un("root node is forbidden and cannot be sanitized in-place")}}else if(R instanceof r)E=Da("<!---->"),I=E.ownerDocument.importNode(R,!0),I.nodeType===hn.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?E=I:E.appendChild(I);else{if(!It&&!F&&!H&&R.indexOf("<")===-1)return T&&Vn?T.createHTML(R):R;if(E=Da(R),!E)return It?null:Vn?_:""}E&&Xe&&Te(E.firstChild);const Z=Ba(sn?R:E);for(;j=Z.nextNode();)Fa(j),Ka(j),j.content instanceof o&&Wu(j.content);if(sn)return R;if(It){if(jn)for(ae=ne.call(E.ownerDocument);E.firstChild;)ae.appendChild(E.firstChild);else ae=E;return(X.shadowroot||X.shadowrootmode)&&(ae=Ye.call(i,ae,!0)),ae}let me=H?E.outerHTML:E.innerHTML;return H&&J["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&de(Sd,E.ownerDocument.doctype.name)&&(me="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
|
|
2267
|
-
`+
|
|
2268
|
-
]`).replace("lheading",Ed).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ym=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_d=/^( {2,}|\\)\n(?!\s*$)/,bm=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,es=/[\p{P}\p{S}]/u,ga=/[\s\p{P}\p{S}]/u,Md=/[^\s\p{P}\p{S}]/u,wm=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ga).getRegex(),Pd=/(?!~)[\p{P}\p{S}]/u,km=/(?!~)[\s\p{P}\p{S}]/u,$m=/(?:[^\s\p{P}\p{S}]|~)/u,Sm=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",sm?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ld=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,xm=W(Ld,"u").replace(/punct/g,es).getRegex(),Am=W(Ld,"u").replace(/punct/g,Pd).getRegex(),Id="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Cm=W(Id,"gu").replace(/notPunctSpace/g,Md).replace(/punctSpace/g,ga).replace(/punct/g,es).getRegex(),Em=W(Id,"gu").replace(/notPunctSpace/g,$m).replace(/punctSpace/g,km).replace(/punct/g,Pd).getRegex(),Tm=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Md).replace(/punctSpace/g,ga).replace(/punct/g,es).getRegex(),_m=W(/\\(punct)/,"gu").replace(/punct/g,es).getRegex(),Mm=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Pm=W(ha).replace("(?:-->|$)","-->").getRegex(),Lm=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Pm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ii=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Im=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ii).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Rd=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Ii).replace("ref",pa).getRegex(),Dd=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",pa).getRegex(),Rm=W("reflink|nolink(?!\\()","g").replace("reflink",Rd).replace("nolink",Dd).getRegex(),Jr=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ma={_backpedal:An,anyPunctuation:_m,autolink:Mm,blockSkip:Sm,br:_d,code:vm,del:An,emStrongLDelim:xm,emStrongRDelimAst:Cm,emStrongRDelimUnd:Tm,escape:ym,link:Im,nolink:Dd,punctuation:wm,reflink:Rd,reflinkSearch:Rm,tag:Lm,text:bm,url:An},Dm={...ma,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Ii).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ii).getRegex()},vo={...ma,emStrongRDelimAst:Em,emStrongLDelim:Am,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Jr).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Jr).getRegex()},Bm={...vo,br:W(_d).replace("{2,}","*").getRegex(),text:W(vo.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},li={normal:fa,gfm:gm,pedantic:mm},fn={normal:ma,gfm:vo,breaks:Bm,pedantic:Dm},Nm={"&":"&","<":"<",">":">",'"':""","'":"'"},Xr=e=>Nm[e];function
|
|
2264
|
+
${i?Eg(i,e):k}
|
|
2265
|
+
${s?Tg(s,e):k}
|
|
2266
|
+
`}const vd={CHILD:2},bd=e=>(...t)=>({_$litDirective$:e,values:t});let wd=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:Lg}=pp,Or=e=>e,Ur=()=>document.createComment(""),ln=(e,t,n)=>{var o;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=i.insertBefore(Ur(),s),r=i.insertBefore(Ur(),s);n=new Lg(a,r,e,e.options)}else{const a=n._$AB.nextSibling,r=n._$AM,d=r!==e;if(d){let c;(o=n._$AQ)==null||o.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==r._$AU&&n._$AP(c)}if(a!==s||d){let c=n._$AA;for(;c!==a;){const l=Or(c).nextSibling;Or(i).insertBefore(c,s),c=l}}}return n},ht=(e,t,n=e)=>(e._$AI(t,n),e),Ig={},Rg=(e,t=Ig)=>e._$AH=t,Dg=e=>e._$AH,_s=e=>{e._$AR(),e._$AA.remove()};const Kr=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},Bg=bd(class extends wd{constructor(e){if(super(e),e.type!==vd.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=[],o=[];let a=0;for(const r of e)s[a]=i?i(r,a):a,o[a]=n(r,a),a++;return{values:o,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=Dg(e),{values:o,keys:a}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=a,o;const r=this.ut??(this.ut=[]),d=[];let c,l,p=0,h=s.length-1,v=0,S=o.length-1;for(;p<=h&&v<=S;)if(s[p]===null)p++;else if(s[h]===null)h--;else if(r[p]===a[v])d[v]=ht(s[p],o[v]),p++,v++;else if(r[h]===a[S])d[S]=ht(s[h],o[S]),h--,S--;else if(r[p]===a[S])d[S]=ht(s[p],o[S]),ln(e,d[S+1],s[p]),p++,S--;else if(r[h]===a[v])d[v]=ht(s[h],o[v]),ln(e,s[p],s[h]),h--,v++;else if(c===void 0&&(c=Kr(a,v,S),l=Kr(r,p,h)),c.has(r[p]))if(c.has(r[h])){const f=l.get(a[v]),w=f!==void 0?s[f]:null;if(w===null){const b=ln(e,s[p]);ht(b,o[v]),d[v]=b}else d[v]=ht(w,o[v]),ln(e,s[p],w),s[f]=null;v++}else _s(s[h]),h--;else _s(s[p]),p++;for(;v<=S;){const f=ln(e,d[S+1]);ht(f,o[v]),d[v++]=f}for(;p<=h;){const f=s[p++];f!==null&&_s(f)}return this.ut=a,Rg(e,d),it}});class ho extends wd{constructor(t){if(super(t),this.it=k,t.type!==vd.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===it)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:[]}}}ho.directiveName="unsafeHTML",ho.resultType=1;const Li=bd(ho);const{entries:kd,setPrototypeOf:Wr,isFrozen:Ng,getPrototypeOf:Fg,getOwnPropertyDescriptor:Og}=Object;let{freeze:ge,seal:we,create:fo}=Object,{apply:go,construct:mo}=typeof Reflect<"u"&&Reflect;ge||(ge=function(t){return t});we||(we=function(t){return t});go||(go=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(n,s)});mo||(mo=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 ai=me(Array.prototype.forEach),Ug=me(Array.prototype.lastIndexOf),zr=me(Array.prototype.pop),cn=me(Array.prototype.push),Kg=me(Array.prototype.splice),yi=me(String.prototype.toLowerCase),Ms=me(String.prototype.toString),Ps=me(String.prototype.match),dn=me(String.prototype.replace),Wg=me(String.prototype.indexOf),zg=me(String.prototype.trim),ke=me(Object.prototype.hasOwnProperty),ue=me(RegExp.prototype.test),un=qg(TypeError);function me(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 go(e,t,i)}}function qg(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return mo(e,n)}}function U(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yi;Wr&&Wr(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(Ng(t)||(t[i]=o),s=o)}e[s]=!0}return e}function Hg(e){for(let t=0;t<e.length;t++)ke(e,t)||(e[t]=null);return e}function Le(e){const t=fo(null);for(const[n,i]of kd(e))ke(e,n)&&(Array.isArray(i)?t[n]=Hg(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Le(i):t[n]=i);return t}function pn(e,t){for(;e!==null;){const i=Og(e,t);if(i){if(i.get)return me(i.get);if(typeof i.value=="function")return me(i.value)}e=Fg(e)}function n(){return null}return n}const qr=ge(["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"]),Ls=ge(["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"]),Is=ge(["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"]),jg=ge(["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"]),Rs=ge(["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"]),Vg=ge(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Hr=ge(["#text"]),jr=ge(["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"]),Ds=ge(["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"]),Vr=ge(["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"]),ri=ge(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gg=we(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qg=we(/<%[\w\W]*|[\w\W]*%>/gm),Yg=we(/\$\{[\w\W]*/gm),Jg=we(/^data-[\-\w.\u00B7-\uFFFF]+$/),Xg=we(/^aria-[\-\w]+$/),$d=we(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zg=we(/^(?:\w+script|data):/i),em=we(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sd=we(/^html$/i),tm=we(/^[a-z][.\w]*(-[.\w]+)+$/i);var Gr=Object.freeze({__proto__:null,ARIA_ATTR:Xg,ATTR_WHITESPACE:em,CUSTOM_ELEMENT:tm,DATA_ATTR:Jg,DOCTYPE_NAME:Sd,ERB_EXPR:Qg,IS_ALLOWED_URI:$d,IS_SCRIPT_OR_DATA:Zg,MUSTACHE_EXPR:Gg,TMPLIT_EXPR:Yg});const hn={element:1,text:3,progressingInstruction:7,comment:8,document:9},nm=function(){return typeof window>"u"?null:window},im=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 o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Qr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nm();const t=D=>xd(D);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==hn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:r,Element:d,NodeFilter:c,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:v}=e,S=d.prototype,f=pn(S,"cloneNode"),w=pn(S,"remove"),b=pn(S,"nextSibling"),x=pn(S,"childNodes"),C=pn(S,"parentNode");if(typeof a=="function"){const D=n.createElement("template");D.content&&D.content.ownerDocument&&(n=D.content.ownerDocument)}let T,P="";const{implementation:_,createNodeIterator:N,createDocumentFragment:H,getElementsByTagName:ie}=n,{importNode:be}=i;let X=Qr();t.isSupported=typeof kd=="function"&&typeof C=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:rt,ERB_EXPR:It,TMPLIT_EXPR:lt,DATA_ATTR:ss,ARIA_ATTR:os,IS_SCRIPT_OR_DATA:as,ATTR_WHITESPACE:Kn,CUSTOM_ELEMENT:rs}=Gr;let{IS_ALLOWED_URI:Wn}=Gr,Z=null;const zn=U({},[...qr,...Ls,...Is,...Rs,...Hr]);let ee=null;const qn=U({},[...jr,...Ds,...Vr,...ri]);let Q=Object.seal(fo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ct=null,nn=null;const Je=Object.seal(fo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Hn=!0,A=!0,M=!1,F=!0,O=!1,Y=!0,j=!1,de=!1,Xe=!1,Rt=!1,jn=!1,Vn=!1,Ea=!0,Ta=!1;const Du="user-content-";let ls=!0,sn=!1,Dt={},Te=null;const cs=U({},["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 _a=null;const Ma=U({},["audio","video","img","source","image","track"]);let ds=null;const Pa=U({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gn="http://www.w3.org/1998/Math/MathML",Qn="http://www.w3.org/2000/svg",Ue="http://www.w3.org/1999/xhtml";let Bt=Ue,us=!1,ps=null;const Bu=U({},[Gn,Qn,Ue],Ms);let Yn=U({},["mi","mo","mn","ms","mtext"]),Jn=U({},["annotation-xml"]);const Nu=U({},["title","style","font","a","script"]);let on=null;const Fu=["application/xhtml+xml","text/html"],Ou="text/html";let ne=null,Nt=null;const Uu=n.createElement("form"),La=function($){return $ instanceof RegExp||$ instanceof Function},hs=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Nt&&Nt===$)){if((!$||typeof $!="object")&&($={}),$=Le($),on=Fu.indexOf($.PARSER_MEDIA_TYPE)===-1?Ou:$.PARSER_MEDIA_TYPE,ne=on==="application/xhtml+xml"?Ms:yi,Z=ke($,"ALLOWED_TAGS")?U({},$.ALLOWED_TAGS,ne):zn,ee=ke($,"ALLOWED_ATTR")?U({},$.ALLOWED_ATTR,ne):qn,ps=ke($,"ALLOWED_NAMESPACES")?U({},$.ALLOWED_NAMESPACES,Ms):Bu,ds=ke($,"ADD_URI_SAFE_ATTR")?U(Le(Pa),$.ADD_URI_SAFE_ATTR,ne):Pa,_a=ke($,"ADD_DATA_URI_TAGS")?U(Le(Ma),$.ADD_DATA_URI_TAGS,ne):Ma,Te=ke($,"FORBID_CONTENTS")?U({},$.FORBID_CONTENTS,ne):cs,ct=ke($,"FORBID_TAGS")?U({},$.FORBID_TAGS,ne):Le({}),nn=ke($,"FORBID_ATTR")?U({},$.FORBID_ATTR,ne):Le({}),Dt=ke($,"USE_PROFILES")?$.USE_PROFILES:!1,Hn=$.ALLOW_ARIA_ATTR!==!1,A=$.ALLOW_DATA_ATTR!==!1,M=$.ALLOW_UNKNOWN_PROTOCOLS||!1,F=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=$.SAFE_FOR_TEMPLATES||!1,Y=$.SAFE_FOR_XML!==!1,j=$.WHOLE_DOCUMENT||!1,Rt=$.RETURN_DOM||!1,jn=$.RETURN_DOM_FRAGMENT||!1,Vn=$.RETURN_TRUSTED_TYPE||!1,Xe=$.FORCE_BODY||!1,Ea=$.SANITIZE_DOM!==!1,Ta=$.SANITIZE_NAMED_PROPS||!1,ls=$.KEEP_CONTENT!==!1,sn=$.IN_PLACE||!1,Wn=$.ALLOWED_URI_REGEXP||$d,Bt=$.NAMESPACE||Ue,Yn=$.MATHML_TEXT_INTEGRATION_POINTS||Yn,Jn=$.HTML_INTEGRATION_POINTS||Jn,Q=$.CUSTOM_ELEMENT_HANDLING||{},$.CUSTOM_ELEMENT_HANDLING&&La($.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=$.CUSTOM_ELEMENT_HANDLING.tagNameCheck),$.CUSTOM_ELEMENT_HANDLING&&La($.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=$.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=$.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),O&&(A=!1),jn&&(Rt=!0),Dt&&(Z=U({},Hr),ee=[],Dt.html===!0&&(U(Z,qr),U(ee,jr)),Dt.svg===!0&&(U(Z,Ls),U(ee,Ds),U(ee,ri)),Dt.svgFilters===!0&&(U(Z,Is),U(ee,Ds),U(ee,ri)),Dt.mathMl===!0&&(U(Z,Rs),U(ee,Vr),U(ee,ri))),$.ADD_TAGS&&(typeof $.ADD_TAGS=="function"?Je.tagCheck=$.ADD_TAGS:(Z===zn&&(Z=Le(Z)),U(Z,$.ADD_TAGS,ne))),$.ADD_ATTR&&(typeof $.ADD_ATTR=="function"?Je.attributeCheck=$.ADD_ATTR:(ee===qn&&(ee=Le(ee)),U(ee,$.ADD_ATTR,ne))),$.ADD_URI_SAFE_ATTR&&U(ds,$.ADD_URI_SAFE_ATTR,ne),$.FORBID_CONTENTS&&(Te===cs&&(Te=Le(Te)),U(Te,$.FORBID_CONTENTS,ne)),$.ADD_FORBID_CONTENTS&&(Te===cs&&(Te=Le(Te)),U(Te,$.ADD_FORBID_CONTENTS,ne)),ls&&(Z["#text"]=!0),j&&U(Z,["html","head","body"]),Z.table&&(U(Z,["tbody"]),delete ct.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=$.TRUSTED_TYPES_POLICY,P=T.createHTML("")}else T===void 0&&(T=im(v,s)),T!==null&&typeof P=="string"&&(P=T.createHTML(""));ge&&ge($),Nt=$}},Ia=U({},[...Ls,...Is,...jg]),Ra=U({},[...Rs,...Vg]),Ku=function($){let E=C($);(!E||!E.tagName)&&(E={namespaceURI:Bt,tagName:"template"});const R=yi($.tagName),V=yi(E.tagName);return ps[$.namespaceURI]?$.namespaceURI===Qn?E.namespaceURI===Ue?R==="svg":E.namespaceURI===Gn?R==="svg"&&(V==="annotation-xml"||Yn[V]):!!Ia[R]:$.namespaceURI===Gn?E.namespaceURI===Ue?R==="math":E.namespaceURI===Qn?R==="math"&&Jn[V]:!!Ra[R]:$.namespaceURI===Ue?E.namespaceURI===Qn&&!Jn[V]||E.namespaceURI===Gn&&!Yn[V]?!1:!Ra[R]&&(Nu[R]||!Ia[R]):!!(on==="application/xhtml+xml"&&ps[$.namespaceURI]):!1},_e=function($){cn(t.removed,{element:$});try{C($).removeChild($)}catch{w($)}},dt=function($,E){try{cn(t.removed,{attribute:E.getAttributeNode($),from:E})}catch{cn(t.removed,{attribute:null,from:E})}if(E.removeAttribute($),$==="is")if(Rt||jn)try{_e(E)}catch{}else try{E.setAttribute($,"")}catch{}},Da=function($){let E=null,R=null;if(Xe)$="<remove></remove>"+$;else{const te=Ps($,/^[\r\n\t ]+/);R=te&&te[0]}on==="application/xhtml+xml"&&Bt===Ue&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const V=T?T.createHTML($):$;if(Bt===Ue)try{E=new h().parseFromString(V,on)}catch{}if(!E||!E.documentElement){E=_.createDocument(Bt,"template",null);try{E.documentElement.innerHTML=us?P:V}catch{}}const re=E.body||E.documentElement;return $&&R&&re.insertBefore(n.createTextNode(R),re.childNodes[0]||null),Bt===Ue?ie.call(E,j?"html":"body")[0]:j?E.documentElement:re},Ba=function($){return N.call($.ownerDocument||$,$,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},fs=function($){return $ instanceof p&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof l)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},Na=function($){return typeof r=="function"&&$ instanceof r};function Ke(D,$,E){ai(D,R=>{R.call(t,$,E,Nt)})}const Fa=function($){let E=null;if(Ke(X.beforeSanitizeElements,$,null),fs($))return _e($),!0;const R=ne($.nodeName);if(Ke(X.uponSanitizeElement,$,{tagName:R,allowedTags:Z}),Y&&$.hasChildNodes()&&!Na($.firstElementChild)&&ue(/<[/\w!]/g,$.innerHTML)&&ue(/<[/\w!]/g,$.textContent)||$.nodeType===hn.progressingInstruction||Y&&$.nodeType===hn.comment&&ue(/<[/\w]/g,$.data))return _e($),!0;if(!(Je.tagCheck instanceof Function&&Je.tagCheck(R))&&(!Z[R]||ct[R])){if(!ct[R]&&Ua(R)&&(Q.tagNameCheck instanceof RegExp&&ue(Q.tagNameCheck,R)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(R)))return!1;if(ls&&!Te[R]){const V=C($)||$.parentNode,re=x($)||$.childNodes;if(re&&V){const te=re.length;for(let ye=te-1;ye>=0;--ye){const We=f(re[ye],!0);We.__removalCount=($.__removalCount||0)+1,V.insertBefore(We,b($))}}}return _e($),!0}return $ instanceof d&&!Ku($)||(R==="noscript"||R==="noembed"||R==="noframes")&&ue(/<\/no(script|embed|frames)/i,$.innerHTML)?(_e($),!0):(O&&$.nodeType===hn.text&&(E=$.textContent,ai([rt,It,lt],V=>{E=dn(E,V," ")}),$.textContent!==E&&(cn(t.removed,{element:$.cloneNode()}),$.textContent=E)),Ke(X.afterSanitizeElements,$,null),!1)},Oa=function($,E,R){if(Ea&&(E==="id"||E==="name")&&(R in n||R in Uu))return!1;if(!(A&&!nn[E]&&ue(ss,E))){if(!(Hn&&ue(os,E))){if(!(Je.attributeCheck instanceof Function&&Je.attributeCheck(E,$))){if(!ee[E]||nn[E]){if(!(Ua($)&&(Q.tagNameCheck instanceof RegExp&&ue(Q.tagNameCheck,$)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck($))&&(Q.attributeNameCheck instanceof RegExp&&ue(Q.attributeNameCheck,E)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(E,$))||E==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&ue(Q.tagNameCheck,R)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(R))))return!1}else if(!ds[E]){if(!ue(Wn,dn(R,Kn,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&$!=="script"&&Wg(R,"data:")===0&&_a[$])){if(!(M&&!ue(as,dn(R,Kn,"")))){if(R)return!1}}}}}}}return!0},Ua=function($){return $!=="annotation-xml"&&Ps($,rs)},Ka=function($){Ke(X.beforeSanitizeAttributes,$,null);const{attributes:E}=$;if(!E||fs($))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ee,forceKeepAttr:void 0};let V=E.length;for(;V--;){const re=E[V],{name:te,namespaceURI:ye,value:We}=re,Ft=ne(te),gs=We;let oe=te==="value"?gs:zg(gs);if(R.attrName=Ft,R.attrValue=oe,R.keepAttr=!0,R.forceKeepAttr=void 0,Ke(X.uponSanitizeAttribute,$,R),oe=R.attrValue,Ta&&(Ft==="id"||Ft==="name")&&(dt(te,$),oe=Du+oe),Y&&ue(/((--!?|])>)|<\/(style|title|textarea)/i,oe)){dt(te,$);continue}if(Ft==="attributename"&&Ps(oe,"href")){dt(te,$);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){dt(te,$);continue}if(!F&&ue(/\/>/i,oe)){dt(te,$);continue}O&&ai([rt,It,lt],za=>{oe=dn(oe,za," ")});const Wa=ne($.nodeName);if(!Oa(Wa,Ft,oe)){dt(te,$);continue}if(T&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!ye)switch(v.getAttributeType(Wa,Ft)){case"TrustedHTML":{oe=T.createHTML(oe);break}case"TrustedScriptURL":{oe=T.createScriptURL(oe);break}}if(oe!==gs)try{ye?$.setAttributeNS(ye,te,oe):$.setAttribute(te,oe),fs($)?_e($):zr(t.removed)}catch{dt(te,$)}}Ke(X.afterSanitizeAttributes,$,null)},Wu=function D($){let E=null;const R=Ba($);for(Ke(X.beforeSanitizeShadowDOM,$,null);E=R.nextNode();)Ke(X.uponSanitizeShadowNode,E,null),Fa(E),Ka(E),E.content instanceof o&&D(E.content);Ke(X.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(D){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,R=null,V=null,re=null;if(us=!D,us&&(D="<!-->"),typeof D!="string"&&!Na(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw un("dirty is not a string, aborting")}else throw un("toString is not a function");if(!t.isSupported)return D;if(de||hs($),t.removed=[],typeof D=="string"&&(sn=!1),sn){if(D.nodeName){const We=ne(D.nodeName);if(!Z[We]||ct[We])throw un("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof r)E=Da("<!---->"),R=E.ownerDocument.importNode(D,!0),R.nodeType===hn.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?E=R:E.appendChild(R);else{if(!Rt&&!O&&!j&&D.indexOf("<")===-1)return T&&Vn?T.createHTML(D):D;if(E=Da(D),!E)return Rt?null:Vn?P:""}E&&Xe&&_e(E.firstChild);const te=Ba(sn?D:E);for(;V=te.nextNode();)Fa(V),Ka(V),V.content instanceof o&&Wu(V.content);if(sn)return D;if(Rt){if(jn)for(re=H.call(E.ownerDocument);E.firstChild;)re.appendChild(E.firstChild);else re=E;return(ee.shadowroot||ee.shadowrootmode)&&(re=be.call(i,re,!0)),re}let ye=j?E.outerHTML:E.innerHTML;return j&&Z["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&ue(Sd,E.ownerDocument.doctype.name)&&(ye="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
|
|
2267
|
+
`+ye),O&&ai([rt,It,lt],We=>{ye=dn(ye,We," ")}),T&&Vn?T.createHTML(ye):ye},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hs(D),de=!0},t.clearConfig=function(){Nt=null,de=!1},t.isValidAttribute=function(D,$,E){Nt||hs({});const R=ne(D),V=ne($);return Oa(R,V,E)},t.addHook=function(D,$){typeof $=="function"&&cn(X[D],$)},t.removeHook=function(D,$){if($!==void 0){const E=Ug(X[D],$);return E===-1?void 0:Kg(X[D],E,1)[0]}return zr(X[D])},t.removeHooks=function(D){X[D]=[]},t.removeAllHooks=function(){X=Qr()},t}var yo=xd();function ca(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Pt=ca();function Ad(e){Pt=e}var An={exec:()=>null};function W(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(s,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(he.caret,"$1"),n=n.replace(s,a),i},getRegex:()=>new RegExp(n,t)};return i}var sm=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),he={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},om=/^(?:[ \t]*(?:\n|$))+/,am=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,On=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,lm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,da=/(?:[*+-]|\d{1,9}[.)])/,Cd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ed=W(Cd).replace(/bull/g,da).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(),cm=W(Cd).replace(/bull/g,da).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(),ua=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,dm=/^[^\n]+/,pa=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,um=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pa).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pm=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,da).getRegex(),Zi="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",ha=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,hm=W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ha).replace("tag",Zi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Td=W(ua).replace("hr",On).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",Zi).getRegex(),fm=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Td).getRegex(),fa={blockquote:fm,code:am,def:um,fences:rm,heading:lm,hr:On,html:hm,lheading:Ed,list:pm,newline:om,paragraph:Td,table:An,text:dm},Yr=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",On).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",Zi).getRegex(),gm={...fa,lheading:cm,table:Yr,paragraph:W(ua).replace("hr",On).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Yr).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",Zi).getRegex()},mm={...fa,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ha).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:An,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(ua).replace("hr",On).replace("heading",` *#{1,6} *[^
|
|
2268
|
+
]`).replace("lheading",Ed).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ym=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_d=/^( {2,}|\\)\n(?!\s*$)/,bm=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,es=/[\p{P}\p{S}]/u,ga=/[\s\p{P}\p{S}]/u,Md=/[^\s\p{P}\p{S}]/u,wm=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ga).getRegex(),Pd=/(?!~)[\p{P}\p{S}]/u,km=/(?!~)[\s\p{P}\p{S}]/u,$m=/(?:[^\s\p{P}\p{S}]|~)/u,Sm=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",sm?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ld=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,xm=W(Ld,"u").replace(/punct/g,es).getRegex(),Am=W(Ld,"u").replace(/punct/g,Pd).getRegex(),Id="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Cm=W(Id,"gu").replace(/notPunctSpace/g,Md).replace(/punctSpace/g,ga).replace(/punct/g,es).getRegex(),Em=W(Id,"gu").replace(/notPunctSpace/g,$m).replace(/punctSpace/g,km).replace(/punct/g,Pd).getRegex(),Tm=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Md).replace(/punctSpace/g,ga).replace(/punct/g,es).getRegex(),_m=W(/\\(punct)/,"gu").replace(/punct/g,es).getRegex(),Mm=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Pm=W(ha).replace("(?:-->|$)","-->").getRegex(),Lm=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Pm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ii=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Im=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ii).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Rd=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Ii).replace("ref",pa).getRegex(),Dd=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",pa).getRegex(),Rm=W("reflink|nolink(?!\\()","g").replace("reflink",Rd).replace("nolink",Dd).getRegex(),Jr=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ma={_backpedal:An,anyPunctuation:_m,autolink:Mm,blockSkip:Sm,br:_d,code:vm,del:An,emStrongLDelim:xm,emStrongRDelimAst:Cm,emStrongRDelimUnd:Tm,escape:ym,link:Im,nolink:Dd,punctuation:wm,reflink:Rd,reflinkSearch:Rm,tag:Lm,text:bm,url:An},Dm={...ma,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Ii).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ii).getRegex()},vo={...ma,emStrongRDelimAst:Em,emStrongLDelim:Am,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Jr).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Jr).getRegex()},Bm={...vo,br:W(_d).replace("{2,}","*").getRegex(),text:W(vo.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},li={normal:fa,gfm:gm,pedantic:mm},fn={normal:ma,gfm:vo,breaks:Bm,pedantic:Dm},Nm={"&":"&","<":"<",">":">",'"':""","'":"'"},Xr=e=>Nm[e];function qe(e,t){if(t){if(he.escapeTest.test(e))return e.replace(he.escapeReplace,Xr)}else if(he.escapeTestNoEncode.test(e))return e.replace(he.escapeReplaceNoEncode,Xr);return e}function Zr(e){try{e=encodeURI(e).replace(he.percentDecode,"%")}catch{return null}return e}function el(e,t){var o;let n=e.replace(he.findPipe,(a,r,d)=>{let c=!1,l=r;for(;--l>=0&&d[l]==="\\";)c=!c;return c?"|":" |"}),i=n.split(he.splitPipe),s=0;if(i[0].trim()||i.shift(),i.length>0&&!((o=i.at(-1))!=null&&o.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(he.slashPipe,"|");return i}function gn(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 Fm(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 tl(e,t,n,i,s){let o=t.href,a=t.title||null,r=e[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:a,text:r,tokens:i.inlineTokens(r)};return i.state.inLink=!1,d}function Om(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let s=i[1];return t.split(`
|
|
2269
2269
|
`).map(o=>{let a=o.match(n.other.beginningSpace);if(a===null)return o;let[r]=a;return r.length>=s.length?o.slice(s.length):o}).join(`
|
|
2270
|
-
`)}var Ri=class{constructor(e){K(this,"options");K(this,"rules");K(this,"lexer");this.options=e||
|
|
2270
|
+
`)}var Ri=class{constructor(e){K(this,"options");K(this,"rules");K(this,"lexer");this.options=e||Pt}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:gn(n,`
|
|
2271
2271
|
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=Om(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=gn(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:gn(t[0],`
|
|
2272
2272
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=gn(t[0],`
|
|
2273
2273
|
`).split(`
|
|
@@ -2275,37 +2275,37 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2275
2275
|
`),l=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
2276
2276
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
2277
2277
|
${c}`:c,s=s?`${s}
|
|
2278
|
-
${l}`:l;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,o,!0),this.lexer.state.top=p,n.length===0)break;let
|
|
2278
|
+
${l}`:l;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,o,!0),this.lexer.state.top=p,n.length===0)break;let h=o.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){let v=h,S=v.raw+`
|
|
2279
2279
|
`+n.join(`
|
|
2280
|
-
`),
|
|
2280
|
+
`),f=this.blockquote(S);o[o.length-1]=f,i=i.substring(0,i.length-v.raw.length)+f.raw,s=s.substring(0,s.length-v.text.length)+f.text;break}else if((h==null?void 0:h.type)==="list"){let v=h,S=v.raw+`
|
|
2281
2281
|
`+n.join(`
|
|
2282
|
-
`),
|
|
2283
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){var n,i;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),o=s.length>1,a={type:"list",raw:"",ordered:o,start:o?+s.slice(0,-1):"",loose:!1,items:[]};s=o?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=o?s:"[*+-]");let r=this.rules.other.listItemRegex(s),d=!1;for(;e;){let l=!1,p="",
|
|
2284
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs
|
|
2285
|
-
`,1)[0],
|
|
2286
|
-
`,e=e.substring(
|
|
2287
|
-
`,1)[0],
|
|
2288
|
-
`+
|
|
2289
|
-
`+
|
|
2290
|
-
`,e=e.substring(
|
|
2282
|
+
`),f=this.list(S);o[o.length-1]=f,i=i.substring(0,i.length-h.raw.length)+f.raw,s=s.substring(0,s.length-v.raw.length)+f.raw,n=S.substring(o.at(-1).raw.length).split(`
|
|
2283
|
+
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){var n,i;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),o=s.length>1,a={type:"list",raw:"",ordered:o,start:o?+s.slice(0,-1):"",loose:!1,items:[]};s=o?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=o?s:"[*+-]");let r=this.rules.other.listItemRegex(s),d=!1;for(;e;){let l=!1,p="",h="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let v=t[2].split(`
|
|
2284
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),S=e.split(`
|
|
2285
|
+
`,1)[0],f=!v.trim(),w=0;if(this.options.pedantic?(w=2,h=v.trimStart()):f?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=v.slice(w),w+=t[1].length),f&&this.rules.other.blankLine.test(S)&&(p+=S+`
|
|
2286
|
+
`,e=e.substring(S.length+1),l=!0),!l){let b=this.rules.other.nextBulletRegex(w),x=this.rules.other.hrRegex(w),C=this.rules.other.fencesBeginRegex(w),T=this.rules.other.headingBeginRegex(w),P=this.rules.other.htmlBeginRegex(w);for(;e;){let _=e.split(`
|
|
2287
|
+
`,1)[0],N;if(S=_,this.options.pedantic?(S=S.replace(this.rules.other.listReplaceNesting," "),N=S):N=S.replace(this.rules.other.tabCharGlobal," "),C.test(S)||T.test(S)||P.test(S)||b.test(S)||x.test(S))break;if(N.search(this.rules.other.nonSpaceChar)>=w||!S.trim())h+=`
|
|
2288
|
+
`+N.slice(w);else{if(f||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(v)||T.test(v)||x.test(v))break;h+=`
|
|
2289
|
+
`+S}!f&&!S.trim()&&(f=!0),p+=_+`
|
|
2290
|
+
`,e=e.substring(_.length+1),v=N.slice(w)}}a.loose||(d?a.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(d=!0)),a.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),a.raw+=p}let c=a.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let l of a.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),((n=l.tokens[0])==null?void 0:n.type)==="text"||((i=l.tokens[0])==null?void 0:i.type)==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,a.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}if(!a.loose){let p=l.tokens.filter(v=>v.type==="space"),h=p.length>0&&p.some(v=>this.rules.other.anyLine.test(v.raw));a.loose=h}}if(a.loose)for(let l of a.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return a}}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 a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=el(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
2291
2291
|
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let r of i)this.rules.other.tableAlignRight.test(r)?o.align.push("right"):this.rules.other.tableAlignCenter.test(r)?o.align.push("center"):this.rules.other.tableAlignLeft.test(r)?o.align.push("left"):o.align.push(null);for(let r=0;r<n.length;r++)o.header.push({text:n[r],tokens:this.lexer.inline(n[r]),header:!0,align:o.align[r]});for(let r of s)o.rows.push(el(r,o.header.length).map((d,c)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:o.align[c]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
2292
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=gn(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=Fm(t[2],"()");if(o===-2)return;if(o>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[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)),tl(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 o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return tl(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,o,a,r=s,d=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(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(a=[...o].length,i[3]||i[4]){r+=a;continue}else if((i[5]||i[6])&&s%3&&!((s+a)%3)){d+=a;continue}if(r-=a,r>0)continue;a=Math.min(a,a+r+d);let l=[...i[0]][0].length,p=e.slice(0,s+i.index+l+a);if(Math.min(s,a)%2){let v=p.slice(1,-1);return{type:"em",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}let
|
|
2293
|
-
`),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,o,a;for(this.options.pedantic&&(t=t.replace(
|
|
2292
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=gn(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=Fm(t[2],"()");if(o===-2)return;if(o>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[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)),tl(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 o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return tl(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,o,a,r=s,d=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(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(a=[...o].length,i[3]||i[4]){r+=a;continue}else if((i[5]||i[6])&&s%3&&!((s+a)%3)){d+=a;continue}if(r-=a,r>0)continue;a=Math.min(a,a+r+d);let l=[...i[0]][0].length,p=e.slice(0,s+i.index+l+a);if(Math.min(s,a)%2){let v=p.slice(1,-1);return{type:"em",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}let h=p.slice(2,-2);return{type:"strong",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}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 o;do o=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(o!==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}}}},Se=class bo{constructor(t){K(this,"tokens");K(this,"options");K(this,"state");K(this,"inlineQueue");K(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Pt,this.options.tokenizer=this.options.tokenizer||new Ri,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:he,block:li.normal,inline:fn.normal};this.options.pedantic?(n.block=li.pedantic,n.inline=fn.pedantic):this.options.gfm&&(n.block=li.gfm,this.options.breaks?n.inline=fn.breaks:n.inline=fn.gfm),this.tokenizer.rules=n}static get rules(){return{block:li,inline:fn}}static lex(t,n){return new bo(n).lex(t)}static lexInline(t,n){return new bo(n).inlineTokens(t)}lex(t){t=t.replace(he.carriageReturn,`
|
|
2293
|
+
`),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,o,a;for(this.options.pedantic&&(t=t.replace(he.tabCharGlobal," ").replace(he.spaceLine,""));t;){let r;if((o=(s=this.options.extensions)==null?void 0:s.block)!=null&&o.some(c=>(r=c.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let c=n.at(-1);r.raw.length===1&&c!==void 0?c.raw+=`
|
|
2294
2294
|
`:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.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(`
|
|
2295
2295
|
`)?"":`
|
|
2296
2296
|
`)+r.raw,c.text+=`
|
|
2297
2297
|
`+r.text,this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.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(`
|
|
2298
2298
|
`)?"":`
|
|
2299
2299
|
`)+r.raw,c.text+=`
|
|
2300
|
-
`+r.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let d=t;if((a=this.options.extensions)!=null&&a.startBlock){let c=1/0,l=t.slice(1),p;this.options.extensions.startBlock.forEach(
|
|
2300
|
+
`+r.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let d=t;if((a=this.options.extensions)!=null&&a.startBlock){let c=1/0,l=t.slice(1),p;this.options.extensions.startBlock.forEach(h=>{p=h.call({lexer:this},l),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(d=t.substring(0,c+1))}if(this.state.top&&(r=this.tokenizer.paragraph(d))){let c=n.at(-1);i&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
2301
2301
|
`)?"":`
|
|
2302
2302
|
`)+r.raw,c.text+=`
|
|
2303
2303
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r),i=d.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
2304
2304
|
`)?"":`
|
|
2305
2305
|
`)+r.raw,c.text+=`
|
|
2306
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r);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 d,c,l,p,
|
|
2307
|
-
`;return i?'<pre><code class="language-'+
|
|
2308
|
-
`:"<pre><code>"+(n?s:
|
|
2306
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r);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 d,c,l,p,h;let i=t,s=null;if(this.tokens.links){let v=Object.keys(this.tokens.links);if(v.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)v.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 o;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=s[2]?s[2].length:0,i=i.slice(0,s.index+o)+"["+"a".repeat(s[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((c=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:c.call({lexer:this},i))??i;let a=!1,r="";for(;t;){a||(r=""),a=!1;let v;if((p=(l=this.options.extensions)==null?void 0:l.inline)!=null&&p.some(f=>(v=f.call({lexer:this},t,n))?(t=t.substring(v.raw.length),n.push(v),!0):!1))continue;if(v=this.tokenizer.escape(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.tag(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.link(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(v.raw.length);let f=n.at(-1);v.type==="text"&&(f==null?void 0:f.type)==="text"?(f.raw+=v.raw,f.text+=v.text):n.push(v);continue}if(v=this.tokenizer.emStrong(t,i,r)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.codespan(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.br(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.del(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.autolink(t)){t=t.substring(v.raw.length),n.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(t))){t=t.substring(v.raw.length),n.push(v);continue}let S=t;if((h=this.options.extensions)!=null&&h.startInline){let f=1/0,w=t.slice(1),b;this.options.extensions.startInline.forEach(x=>{b=x.call({lexer:this},w),typeof b=="number"&&b>=0&&(f=Math.min(f,b))}),f<1/0&&f>=0&&(S=t.substring(0,f+1))}if(v=this.tokenizer.inlineText(S)){t=t.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(r=v.raw.slice(-1)),a=!0;let f=n.at(-1);(f==null?void 0:f.type)==="text"?(f.raw+=v.raw,f.text+=v.text):n.push(v);continue}if(t){let f="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return n}},Di=class{constructor(e){K(this,"options");K(this,"parser");this.options=e||Pt}space(e){return""}code({text:e,lang:t,escaped:n}){var o;let i=(o=(t||"").match(he.notSpaceStart))==null?void 0:o[0],s=e.replace(he.endingNewline,"")+`
|
|
2307
|
+
`;return i?'<pre><code class="language-'+qe(i)+'">'+(n?s:qe(s,!0))+`</code></pre>
|
|
2308
|
+
`:"<pre><code>"+(n?s:qe(s,!0))+`</code></pre>
|
|
2309
2309
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
2310
2310
|
${this.parser.parse(e)}</blockquote>
|
|
2311
2311
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
@@ -2321,8 +2321,8 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2321
2321
|
`}tablerow({text:e}){return`<tr>
|
|
2322
2322
|
${e}</tr>
|
|
2323
2323
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
2324
|
-
`}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>${
|
|
2325
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+
|
|
2324
|
+
`}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>${qe(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=Zr(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+qe(t)+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let s=Zr(e);if(s===null)return qe(n);e=s;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${qe(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:qe(e.text)}},ya=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}},xe=class wo{constructor(t){K(this,"options");K(this,"renderer");K(this,"textRenderer");this.options=t||Pt,this.options.renderer=this.options.renderer||new Di,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ya}static parse(t,n){return new wo(n).parse(t)}static parseInline(t,n){return new wo(n).parseInline(t)}parse(t){var i,s;let n="";for(let o=0;o<t.length;o++){let a=t[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let d=a,c=this.options.extensions.renderers[d.type].call({parser:this},d);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){n+=c||"";continue}}let r=a;switch(r.type){case"space":{n+=this.renderer.space(r);break}case"hr":{n+=this.renderer.hr(r);break}case"heading":{n+=this.renderer.heading(r);break}case"code":{n+=this.renderer.code(r);break}case"table":{n+=this.renderer.table(r);break}case"blockquote":{n+=this.renderer.blockquote(r);break}case"list":{n+=this.renderer.list(r);break}case"checkbox":{n+=this.renderer.checkbox(r);break}case"html":{n+=this.renderer.html(r);break}case"def":{n+=this.renderer.def(r);break}case"paragraph":{n+=this.renderer.paragraph(r);break}case"text":{n+=this.renderer.text(r);break}default:{let d='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var s,o;let i="";for(let a=0;a<t.length;a++){let r=t[a];if((o=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&o[r.type]){let c=this.options.extensions.renderers[r.type].call({parser:this},r);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){i+=c||"";continue}}let d=r;switch(d.type){case"escape":{i+=n.text(d);break}case"html":{i+=n.html(d);break}case"link":{i+=n.link(d);break}case"image":{i+=n.image(d);break}case"checkbox":{i+=n.checkbox(d);break}case"strong":{i+=n.strong(d);break}case"em":{i+=n.em(d);break}case"codespan":{i+=n.codespan(d);break}case"br":{i+=n.br(d);break}case"del":{i+=n.del(d);break}case"text":{i+=n.text(d);break}default:{let c='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return i}},fi,vn=(fi=class{constructor(e){K(this,"options");K(this,"block");this.options=e||Pt}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Se.lex:Se.lexInline}provideParser(){return this.block?xe.parse:xe.parseInline}},K(fi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),K(fi,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),fi),Um=class{constructor(...e){K(this,"defaults",ca());K(this,"options",this.setOptions);K(this,"parse",this.parseMarkdown(!0));K(this,"parseInline",this.parseMarkdown(!1));K(this,"Parser",xe);K(this,"Renderer",Di);K(this,"TextRenderer",ya);K(this,"Lexer",Se);K(this,"Tokenizer",Ri);K(this,"Hooks",vn);this.use(...e)}walkTokens(e,t){var i,s;let n=[];for(let o of e)switch(n=n.concat(t.call(this,o)),o.type){case"table":{let a=o;for(let r of a.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of a.rows)for(let d of r)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{let a=o;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=o;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(r=>{let d=a[r].flat(1/0);n=n.concat(this.walkTokens(d,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.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 o=t.renderers[s.name];o?t.renderers[s.name]=function(...a){let r=s.renderer.apply(this,a);return r===!1&&(r=o.apply(this,a)),r}: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 o=t[s.level];o?o.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 Di(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,r=n.renderer[a],d=s[a];s[a]=(...c)=>{let l=r.apply(s,c);return l===!1&&(l=d.apply(s,c)),l||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Ri(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,r=n.tokenizer[a],d=s[a];s[a]=(...c)=>{let l=r.apply(s,c);return l===!1&&(l=d.apply(s,c)),l}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new vn;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,r=n.hooks[a],d=s[a];vn.passThroughHooks.has(o)?s[a]=c=>{if(this.defaults.async&&vn.passThroughHooksRespectAsync.has(o))return(async()=>{let p=await r.call(s,c);return d.call(s,p)})();let l=r.call(s,c);return d.call(s,l)}:s[a]=(...c)=>{if(this.defaults.async)return(async()=>{let p=await r.apply(s,c);return p===!1&&(p=await d.apply(s,c)),p})();let l=r.apply(s,c);return l===!1&&(l=d.apply(s,c)),l}}i.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(a){let r=[];return r.push(o.call(this,a)),s&&(r=r.concat(s.call(this,a))),r}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Se.lex(e,t??this.defaults)}parser(e,t){return xe.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let a=s.hooks?await s.hooks.preprocess(t):t,r=await(s.hooks?await s.hooks.provideLexer():e?Se.lex:Se.lexInline)(a,s),d=s.hooks?await s.hooks.processAllTokens(r):r;s.walkTokens&&await Promise.all(this.walkTokens(d,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():e?xe.parse:xe.parseInline)(d,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(o);try{s.hooks&&(t=s.hooks.preprocess(t));let a=(s.hooks?s.hooks.provideLexer():e?Se.lex:Se.lexInline)(t,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let r=(s.hooks?s.hooks.provideParser():e?xe.parse:xe.parseInline)(a,s);return s.hooks&&(r=s.hooks.postprocess(r)),r}catch(a){return o(a)}}}onError(e,t){return n=>{if(n.message+=`
|
|
2325
|
+
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+qe(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Et=new Um;function q(e,t){return Et.parse(e,t)}q.options=q.setOptions=function(e){return Et.setOptions(e),q.defaults=Et.defaults,Ad(q.defaults),q};q.getDefaults=ca;q.defaults=Pt;q.use=function(...e){return Et.use(...e),q.defaults=Et.defaults,Ad(q.defaults),q};q.walkTokens=function(e,t){return Et.walkTokens(e,t)};q.parseInline=Et.parseInline;q.Parser=xe;q.parser=xe.parse;q.Renderer=Di;q.TextRenderer=ya;q.Lexer=Se;q.lexer=Se.lex;q.Tokenizer=Ri;q.Hooks=vn;q.parse=q;q.options;q.setOptions;q.use;q.walkTokens;q.parseInline;xe.parse;Se.lex;q.setOptions({gfm:!0,breaks:!0,mangle:!1});const nl=["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"],il=["class","href","rel","target","title","start"];let sl=!1;const Km=14e4,Wm=4e4,zm=200,Bs=5e4,vt=new Map;function qm(e){const t=vt.get(e);return t===void 0?null:(vt.delete(e),vt.set(e,t),t)}function ol(e,t){if(vt.set(e,t),vt.size<=zm)return;const n=vt.keys().next().value;n&&vt.delete(n)}function Hm(){sl||(sl=!0,yo.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function Bi(e){const t=e.trim();if(!t)return"";if(Hm(),t.length<=Bs){const a=qm(t);if(a!==null)return a}const n=ec(t,Km),i=n.truncated?`
|
|
2326
2326
|
|
|
2327
2327
|
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>Wm){const r=`<pre class="code-block">${jm(`${n.text}${i}`)}</pre>`,d=yo.sanitize(r,{ALLOWED_TAGS:nl,ALLOWED_ATTR:il});return t.length<=Bs&&ol(t,d),d}const s=q.parse(`${n.text}${i}`),o=yo.sanitize(s,{ALLOWED_TAGS:nl,ALLOWED_ATTR:il});return t.length<=Bs&&ol(t,o),o}function jm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Vm=1500,Gm=2e3,Bd="Copy as markdown",Qm="Copied",Ym="Copy failed";async function Jm(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 ci(e,t){e.title=t,e.setAttribute("aria-label",t)}function Xm(e){const t=e.label??Bd;return u`
|
|
2328
2328
|
<button
|
|
@@ -2333,11 +2333,11 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2333
2333
|
@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 Jm(e.text());if(i.isConnected){if(delete i.dataset.copying,i.removeAttribute("aria-busy"),i.disabled=!1,!s){i.dataset.error="1",ci(i,Ym),window.setTimeout(()=>{i.isConnected&&(delete i.dataset.error,ci(i,t))},Gm);return}i.dataset.copied="1",ci(i,Qm),window.setTimeout(()=>{i.isConnected&&(delete i.dataset.copied,ci(i,t))},Vm)}}}
|
|
2334
2334
|
>
|
|
2335
2335
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
2336
|
-
<span class="chat-copy-btn__icon-copy">${
|
|
2337
|
-
<span class="chat-copy-btn__icon-check">${
|
|
2336
|
+
<span class="chat-copy-btn__icon-copy">${L.copy}</span>
|
|
2337
|
+
<span class="chat-copy-btn__icon-check">${L.check}</span>
|
|
2338
2338
|
</span>
|
|
2339
2339
|
</button>
|
|
2340
|
-
`}function Zm(e){return Xm({text:()=>e,label:Bd})}function ey(e){const t=e,n=ty(t.content),i=[];for(const s of n){const o=String(s.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(o)||typeof s.name=="string"&&s.arguments!=null)&&i.push({kind:"call",name:s.name??"tool",args:ny(s.arguments??s.args)})}for(const s of n){const o=String(s.type??"").toLowerCase();if(o!=="toolresult"&&o!=="tool_result")continue;const a=iy(s),r=typeof s.name=="string"?s.name:"tool";i.push({kind:"result",name:r,text:a})}if(oc(e)&&!i.some(s=>s.kind==="result")){const s=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",o=tc(e)??void 0;i.push({kind:"result",name:s,text:o})}return i}function ty(e){return Array.isArray(e)?e.filter(Boolean):[]}function ny(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 iy(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}const Ns=40,Fs=new Map;async function sy(e){const t=Fs.get(e);if(t)return t;try{const n=new(window.AudioContext||window.webkitAudioContext),s=await(await fetch(e)).arrayBuffer(),a=(await n.decodeAudioData(s)).getChannelData(0),r=Math.floor(a.length/Ns),d=[];for(let p=0;p<Ns;p++){let
|
|
2340
|
+
`}function Zm(e){return Xm({text:()=>e,label:Bd})}function ey(e){const t=e,n=ty(t.content),i=[];for(const s of n){const o=String(s.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(o)||typeof s.name=="string"&&s.arguments!=null)&&i.push({kind:"call",name:s.name??"tool",args:ny(s.arguments??s.args)})}for(const s of n){const o=String(s.type??"").toLowerCase();if(o!=="toolresult"&&o!=="tool_result")continue;const a=iy(s),r=typeof s.name=="string"?s.name:"tool";i.push({kind:"result",name:r,text:a})}if(oc(e)&&!i.some(s=>s.kind==="result")){const s=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",o=tc(e)??void 0;i.push({kind:"result",name:s,text:o})}return i}function ty(e){return Array.isArray(e)?e.filter(Boolean):[]}function ny(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 iy(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}const Ns=40,Fs=new Map;async function sy(e){const t=Fs.get(e);if(t)return t;try{const n=new(window.AudioContext||window.webkitAudioContext),s=await(await fetch(e)).arrayBuffer(),a=(await n.decodeAudioData(s)).getChannelData(0),r=Math.floor(a.length/Ns),d=[];for(let p=0;p<Ns;p++){let h=0;const v=p*r,S=Math.min(v+r,a.length);for(let f=v;f<S;f++){const w=Math.abs(a[f]);w>h&&(h=w)}d.push(h)}const c=Math.max(...d,.01),l=d.map(p=>Math.max(p/c,.08));return Fs.set(e,l),n.close(),l}catch{const n=Array.from(e).reduce((s,o)=>(s<<5)-s+o.charCodeAt(0)|0,0),i=[];for(let s=0;s<Ns;s++){const o=Math.abs((n*(s+1)*9301+49297)%233280/233280);i.push(.15+o*.85)}return Fs.set(e,i),i}}const Os=[1,1.5,2],Ni=new Map;function oy(e){let t=Ni.get(e);if(t)return t;const n=new Audio;return n.preload="metadata",n.src=e,t={audio:n,playing:!1,currentTime:0,duration:0,speed:1,waveform:[]},Ni.set(e,t),sy(e).then(i=>{t.waveform=i,Nd(e)}),t}const Cn="http://www.w3.org/2000/svg";function ay(){const e=document.createElementNS(Cn,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","currentColor");const t=document.createElementNS(Cn,"polygon");return t.setAttribute("points","6,3 20,12 6,21"),e.appendChild(t),e}function ry(){const e=document.createElementNS(Cn,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","currentColor");const t=document.createElementNS(Cn,"rect");t.setAttribute("x","5"),t.setAttribute("y","3"),t.setAttribute("width","4"),t.setAttribute("height","18"),t.setAttribute("rx","1");const n=document.createElementNS(Cn,"rect");return n.setAttribute("x","15"),n.setAttribute("y","3"),n.setAttribute("width","4"),n.setAttribute("height","18"),n.setAttribute("rx","1"),e.append(t,n),e}function Kt(e){return document.querySelector(`.vnp[data-url="${CSS.escape(e)}"]`)}function Nd(e){const t=Kt(e);if(!t)return;const n=Ni.get(e);if(!n||n.waveform.length===0)return;const i=t.querySelector(".vnp__waveform");if(i){if(i.children.length===0){const s=document.createDocumentFragment();for(const o of n.waveform){const a=document.createElement("span");a.className="vnp__bar",a.style.height=`${Math.round(o*100)}%`,s.appendChild(a)}i.appendChild(s)}En(t,n)}}function En(e,t){const n=t.duration>0?t.currentTime/t.duration:0,i=e.querySelectorAll(".vnp__bar"),s=i.length;i.forEach((a,r)=>{a.classList.toggle("vnp__bar--active",r/s<n)});const o=e.querySelector(".vnp__time");o&&(o.textContent=t.playing||t.currentTime>0?Fi(t.currentTime):Fi(t.duration))}function Us(e,t){const n=e.querySelector(".vnp__play");if(!n)return;const i=n.querySelector("svg"),s=t?ry():ay();i?n.replaceChild(s,i):n.appendChild(s)}function Fi(e){if(!isFinite(e)||e<0)return"0:00";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}const al=new Set;function ly(e){if(al.has(e))return;al.add(e);const t=Ni.get(e);if(!t)return;const{audio:n}=t;n.addEventListener("loadedmetadata",()=>{t.duration=n.duration;const i=Kt(e);i&&En(i,t)}),n.addEventListener("timeupdate",()=>{t.currentTime=n.currentTime;const i=Kt(e);i&&En(i,t)}),n.addEventListener("ended",()=>{t.playing=!1,n.currentTime=0,t.currentTime=0;const i=Kt(e);i&&(En(i,t),Us(i,!1))}),n.addEventListener("pause",()=>{t.playing=!1;const i=Kt(e);i&&Us(i,!1)}),n.addEventListener("play",()=>{t.playing=!0;const i=Kt(e);i&&Us(i,!0)})}function cy(e,t){const n=oy(e);ly(e);const i=r=>{r.stopPropagation(),n.playing?n.audio.pause():n.audio.play()},s=r=>{r.stopPropagation();const d=Os.indexOf(n.speed),c=Os[(d+1)%Os.length];n.speed=c,n.audio.playbackRate=c;const l=r.target.closest(".vnp__speed");l&&(l.textContent=`${c}×`)},o=r=>{r.stopPropagation();const d=r.target.closest(".vnp__waveform");if(!d)return;const c=d.getBoundingClientRect(),l=Math.max(0,Math.min(1,(r.clientX-c.left)/c.width));if(n.duration>0){n.audio.currentTime=l*n.duration,n.currentTime=n.audio.currentTime;const p=d.closest(".vnp");p&&En(p,n)}},a=n.playing||n.currentTime>0?Fi(n.currentTime):Fi(n.duration);return queueMicrotask(()=>Nd(e)),u`
|
|
2341
2341
|
<div class="vnp" data-url=${e} @click=${r=>r.stopPropagation()}>
|
|
2342
2342
|
<button class="vnp__play" @click=${i} aria-label=${n.playing?"Pause":"Play"}>
|
|
2343
2343
|
${n.playing?uy():dy()}
|
|
@@ -2349,7 +2349,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2349
2349
|
<div class="vnp__meta">
|
|
2350
2350
|
<span class="vnp__time">${a}</span>
|
|
2351
2351
|
<button class="vnp__speed" @click=${s}>${n.speed}×</button>
|
|
2352
|
-
${t?u`<a class="vnp__name" href=${e} target="_blank" rel="noreferrer noopener">${t}</a>`:
|
|
2352
|
+
${t?u`<a class="vnp__name" href=${e} target="_blank" rel="noreferrer noopener">${t}</a>`:k}
|
|
2353
2353
|
</div>
|
|
2354
2354
|
</div>
|
|
2355
2355
|
</div>
|
|
@@ -2386,7 +2386,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2386
2386
|
</div>
|
|
2387
2387
|
</div>
|
|
2388
2388
|
</div>
|
|
2389
|
-
`}function by(e){return e.length===0?
|
|
2389
|
+
`}function by(e){return e.length===0?k:u`
|
|
2390
2390
|
<div class="chat-message-images">
|
|
2391
2391
|
${e.map(t=>u`
|
|
2392
2392
|
<img
|
|
@@ -2397,11 +2397,11 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2397
2397
|
/>
|
|
2398
2398
|
`)}
|
|
2399
2399
|
</div>
|
|
2400
|
-
`}function wy(e){return e.length===0?
|
|
2400
|
+
`}function wy(e){return e.length===0?k:u`
|
|
2401
2401
|
<div class="chat-message-files">
|
|
2402
2402
|
${e.map(t=>t.mimeType==="application/pdf"?$y(t):t.mimeType.startsWith("audio/")?cy(t.url,t.name):Sy(t))}
|
|
2403
2403
|
</div>
|
|
2404
|
-
`}function ky(e,t){const n=document.createElement("div");n.className="chat-pdf-modal-overlay";const i=document.createElement("div");i.className="chat-pdf-modal";const s=document.createElement("div");s.className="chat-pdf-modal__header";const o=document.createElement("span");o.className="chat-pdf-modal__title",o.textContent=t;const a=document.createElement("a");a.className="chat-pdf-modal__open",a.href=e,a.target="_blank",a.rel="noreferrer noopener",a.textContent="Open in new tab";const r=document.createElement("button");r.className="chat-pdf-modal__close",r.setAttribute("aria-label","Close");const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox","0 0 24 24");const c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1","18"),c.setAttribute("y1","6"),c.setAttribute("x2","6"),c.setAttribute("y2","18");const l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1","6"),l.setAttribute("y1","6"),l.setAttribute("x2","18"),l.setAttribute("y2","18"),d.append(c,l),r.appendChild(d),s.append(o,a,r);const p=document.createElement("iframe");p.className="chat-pdf-modal__frame",p.src=e,p.title=t,i.append(s,p),n.appendChild(i),n.addEventListener("click",
|
|
2404
|
+
`}function ky(e,t){const n=document.createElement("div");n.className="chat-pdf-modal-overlay";const i=document.createElement("div");i.className="chat-pdf-modal";const s=document.createElement("div");s.className="chat-pdf-modal__header";const o=document.createElement("span");o.className="chat-pdf-modal__title",o.textContent=t;const a=document.createElement("a");a.className="chat-pdf-modal__open",a.href=e,a.target="_blank",a.rel="noreferrer noopener",a.textContent="Open in new tab";const r=document.createElement("button");r.className="chat-pdf-modal__close",r.setAttribute("aria-label","Close");const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox","0 0 24 24");const c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1","18"),c.setAttribute("y1","6"),c.setAttribute("x2","6"),c.setAttribute("y2","18");const l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1","6"),l.setAttribute("y1","6"),l.setAttribute("x2","18"),l.setAttribute("y2","18"),d.append(c,l),r.appendChild(d),s.append(o,a,r);const p=document.createElement("iframe");p.className="chat-pdf-modal__frame",p.src=e,p.title=t,i.append(s,p),n.appendChild(i),n.addEventListener("click",h=>{h.target===n&&n.remove()}),r.addEventListener("click",()=>n.remove()),document.body.appendChild(n)}function $y(e){return u`
|
|
2405
2405
|
<div class="chat-pdf-preview" @click=${()=>ky(e.url,e.name)}>
|
|
2406
2406
|
<iframe
|
|
2407
2407
|
src=${e.url}
|
|
@@ -2426,15 +2426,15 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2426
2426
|
<span class="chat-file-card__icon">${fy(e.mimeType)}</span>
|
|
2427
2427
|
<span class="chat-file-card__name">${e.name}</span>
|
|
2428
2428
|
</a>
|
|
2429
|
-
`}function Fd(e,t,n){const i=e,s=typeof i.role=="string"?i.role:"unknown",o=oc(e)||s.toLowerCase()==="toolresult"||s.toLowerCase()==="tool_result"||typeof i.toolCallId=="string"||typeof i.tool_call_id=="string",r=ey(e).length>0,d=py(e),c=d.length>0,l=hy(e),p=l.length>0,
|
|
2429
|
+
`}function Fd(e,t,n){const i=e,s=typeof i.role=="string"?i.role:"unknown",o=oc(e)||s.toLowerCase()==="toolresult"||s.toLowerCase()==="tool_result"||typeof i.toolCallId=="string"||typeof i.tool_call_id=="string",r=ey(e).length>0,d=py(e),c=d.length>0,l=hy(e),p=l.length>0,h=tc(e),v=t.showReasoning&&s==="assistant"?Np(e):null,S=h!=null&&h.trim()?h:null,f=v?Op(v):null,w=S,b=(s==="assistant"||s==="user")&&!!(w!=null&&w.trim()),x=["chat-bubble",b?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!w&&(r||o)||!w&&!c&&!p?k:u`
|
|
2430
2430
|
<div class="${x}">
|
|
2431
|
-
${
|
|
2431
|
+
${b?Zm(w):k}
|
|
2432
2432
|
${by(d)}
|
|
2433
2433
|
${wy(l)}
|
|
2434
|
-
${
|
|
2435
|
-
${
|
|
2434
|
+
${f?u`<div class="chat-thinking">${Li(Bi(f))}</div>`:k}
|
|
2435
|
+
${w?u`<div class="chat-text">${Li(Bi(w))}</div>`:k}
|
|
2436
2436
|
</div>
|
|
2437
|
-
`}const B={active:!1,mode:"tap",startTime:0,elapsed:0,mediaRecorder:null,audioChunks:[],stream:null,timerId:null,startX:0,cancelled:!1};let z=null,
|
|
2437
|
+
`}const B={active:!1,mode:"tap",startTime:0,elapsed:0,mediaRecorder:null,audioChunks:[],stream:null,timerId:null,startX:0,cancelled:!1};let z=null,wt=null,kt=!1;function rl(e){const t=Math.floor(e/60),n=e%60;return`${t}:${n.toString().padStart(2,"0")}`}function gt(){if(B.timerId&&(clearInterval(B.timerId),B.timerId=null),B.stream){for(const e of B.stream.getTracks())e.stop();B.stream=null}wt&&(clearTimeout(wt),wt=null),Oi(),B.mediaRecorder=null,B.audioChunks=[],B.active=!1,B.cancelled=!1,kt=!1}async function Od(e){var t;try{if(!((t=navigator.mediaDevices)!=null&&t.getUserMedia))return console.warn("[voice] getUserMedia unavailable (requires secure context)"),gt(),!1;const n=await navigator.mediaDevices.getUserMedia({audio:!0});B.stream=n;const i=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":"",s=i?new MediaRecorder(n,{mimeType:i}):new MediaRecorder(n);return B.mediaRecorder=s,B.audioChunks=[],B.mode=e,B.startTime=Date.now(),B.elapsed=0,B.active=!0,B.cancelled=!1,s.ondataavailable=o=>{o.data.size>0&&B.audioChunks.push(o.data)},s.onstop=()=>{if(B.cancelled){gt(),z==null||z.onRequestRender();return}const o=new Blob(B.audioChunks,{type:s.mimeType});if(o.size===0){gt(),z==null||z.onRequestRender();return}const a=new FileReader;a.onload=()=>{const r=a.result,d=s.mimeType.includes("mp4")?"m4a":"webm",c={id:Qi(),dataUrl:r,mimeType:s.mimeType||"audio/webm",fileName:`voice-note-${Date.now()}.${d}`};gt(),z==null||z.onSend(c),z==null||z.onRequestRender()},a.onerror=()=>{gt(),z==null||z.onRequestRender()},a.readAsDataURL(o)},s.start(250),B.timerId=setInterval(()=>{B.elapsed=Math.floor((Date.now()-B.startTime)/1e3),z==null||z.onRequestRender()},1e3),z==null||z.onRequestRender(),!0}catch(n){return console.warn("[voice] startRecording failed:",n),gt(),!1}}function Ud(){!B.active||!B.mediaRecorder||(B.cancelled=!1,B.mediaRecorder.state==="recording"&&B.mediaRecorder.stop())}function Kd(){!B.active||!B.mediaRecorder||(B.cancelled=!0,B.mediaRecorder.state==="recording"?B.mediaRecorder.stop():(gt(),z==null||z.onRequestRender()))}function xy(){document.addEventListener("pointerup",Wd)}function Oi(){document.removeEventListener("pointerup",Wd)}function Wd(e){if(!kt&&!B.active){Oi();return}if(kt=!1,Oi(),wt&&(clearTimeout(wt),wt=null,!B.active)){Od("tap");return}B.active&&B.mode==="hold"&&(B.cancelled?Kd():Ud()),e.preventDefault()}function Ay(e){B.active||(kt=!0,B.startX=e.clientX,xy(),wt=setTimeout(async()=>{if(!kt)return;await Od("hold")||(kt=!1,Oi())},300))}function ll(e){if(!B.active||B.mode!=="hold"||!kt)return;const t=B.startX-e.clientX;t>80?(B.cancelled=!0,z==null||z.onRequestRender()):B.cancelled&&t<=60&&(B.cancelled=!1,z==null||z.onRequestRender())}function Cy(){return B.active}function Ey(e){z=e}function Ty(e){return u`
|
|
2438
2438
|
<button
|
|
2439
2439
|
class="btn btn--icon chat-compose__mic"
|
|
2440
2440
|
?disabled=${!e}
|
|
@@ -2442,7 +2442,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2442
2442
|
aria-label="Record voice note"
|
|
2443
2443
|
title="Tap to record, hold to send on release"
|
|
2444
2444
|
>
|
|
2445
|
-
${
|
|
2445
|
+
${L.mic}
|
|
2446
2446
|
</button>
|
|
2447
2447
|
`}function _y(){return B.active?B.mode==="tap"?u`
|
|
2448
2448
|
<div class="chat-voice-recording" @pointermove=${ll}>
|
|
@@ -2452,7 +2452,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2452
2452
|
aria-label="Cancel recording"
|
|
2453
2453
|
title="Discard"
|
|
2454
2454
|
>
|
|
2455
|
-
${
|
|
2455
|
+
${L.trash}
|
|
2456
2456
|
</button>
|
|
2457
2457
|
<div class="chat-voice-recording__indicator">
|
|
2458
2458
|
<span class="chat-voice-recording__dot"></span>
|
|
@@ -2464,7 +2464,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2464
2464
|
aria-label="Send voice note"
|
|
2465
2465
|
title="Send"
|
|
2466
2466
|
>
|
|
2467
|
-
${
|
|
2467
|
+
${L.send}
|
|
2468
2468
|
</button>
|
|
2469
2469
|
</div>
|
|
2470
2470
|
`:u`
|
|
@@ -2477,12 +2477,12 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2477
2477
|
</span>
|
|
2478
2478
|
</div>
|
|
2479
2479
|
</div>
|
|
2480
|
-
`:
|
|
2480
|
+
`:k}function My(e){return u`
|
|
2481
2481
|
<div class="sidebar-panel">
|
|
2482
2482
|
<div class="sidebar-header">
|
|
2483
2483
|
<div class="sidebar-title">Tool Output</div>
|
|
2484
2484
|
<button @click=${e.onClose} class="btn" title="Close sidebar">
|
|
2485
|
-
${
|
|
2485
|
+
${L.x}
|
|
2486
2486
|
</button>
|
|
2487
2487
|
</div>
|
|
2488
2488
|
<div class="sidebar-content">
|
|
@@ -2494,7 +2494,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2494
2494
|
`:e.content?u`<div class="sidebar-markdown">${Li(Bi(e.content))}</div>`:u`<div class="muted">No content available</div>`}
|
|
2495
2495
|
</div>
|
|
2496
2496
|
</div>
|
|
2497
|
-
`}var Py=Object.defineProperty,Ly=Object.getOwnPropertyDescriptor,ts=(e,t,n,i)=>{for(var s=i>1?void 0:i?Ly(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Py(t,n,s),s};let
|
|
2497
|
+
`}var Py=Object.defineProperty,Ly=Object.getOwnPropertyDescriptor,ts=(e,t,n,i)=>{for(var s=i>1?void 0:i?Ly(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Py(t,n,s),s};let Vt=class extends zt{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 o=this.startRatio+s;o=Math.max(this.minRatio,Math.min(this.maxRatio,o)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:o},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return u``}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)}};Vt.styles=Gu`
|
|
2498
2498
|
:host {
|
|
2499
2499
|
width: 4px;
|
|
2500
2500
|
cursor: col-resize;
|
|
@@ -2520,25 +2520,25 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2520
2520
|
:host(.dragging) {
|
|
2521
2521
|
background: var(--accent, #007bff);
|
|
2522
2522
|
}
|
|
2523
|
-
`;ts([Vi({type:Number})],jt.prototype,"splitRatio",2);ts([Vi({type:Number})],jt.prototype,"minRatio",2);ts([Vi({type:Number})],jt.prototype,"maxRatio",2);jt=ts([Vl("resizable-divider")],jt);function di(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function Ks(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const Iy=1,Ry=1,Pt="emoji",Vt="keyvalue",va="favorites",Dy="tokens",zd="tokens",By="unicode",qd="count",Ny="group",Fy="order",Hd="group-order",ko="eTag",Ui="url",cl="skinTone",en="readonly",ba="readwrite",jd="skinUnicodes",Oy="skinUnicodes",Uy="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Ky="en";function Wy(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function dl(e){return Wy(e,t=>t.unicode)}function zy(e){function t(n,i,s){const o=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[a,[r,d]]of Object.entries(s))o.createIndex(a,r,{multiEntry:d});return o}t(Vt),t(Pt,By,{[zd]:[Dy,!0],[Hd]:[[Ny,Fy]],[jd]:[Oy,!0]}),t(va,void 0,{[qd]:[""]})}const $o={},vi={},Ki={};function Vd(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function qy(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,Iy);$o[e]=s,s.onupgradeneeded=o=>{o.oldVersion<Ry&&zy(s.result)},Vd(n,i,s)});return t.onclose=()=>wa(e),t}function Hy(e){return vi[e]||(vi[e]=qy(e)),vi[e]}function Qe(e,t,n,i){return new Promise((s,o)=>{const a=e.transaction(t,n,{durability:"relaxed"}),r=typeof t=="string"?a.objectStore(t):t.map(c=>a.objectStore(c));let d;i(r,a,c=>{d=c}),a.oncomplete=()=>s(d),a.onerror=()=>o(a.error)})}function wa(e){const t=$o[e],n=t&&t.result;if(n){n.close();const i=Ki[e];if(i)for(const s of i)s()}delete $o[e],delete vi[e],delete Ki[e]}function jy(e){return new Promise((t,n)=>{wa(e);const i=indexedDB.deleteDatabase(e);Vd(t,n,i)})}function Vy(e,t){let n=Ki[e];n||(n=Ki[e]=[]),n.push(t)}const Gy=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 qt(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||Gy.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const Qy=2;function Gd(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=Qy)}function Yy(e){return e.map(({annotation:n,emoticon:i,group:s,order:o,shortcodes:a,skins:r,tags:d,emoji:c,version:l})=>{const p=[...new Set(Gd([...(a||[]).map(qt).flat(),...(d||[]).map(qt).flat(),...qt(n),i]))].sort(),f={annotation:n,group:s,order:o,tags:d,tokens:p,unicode:c,version:l};if(i&&(f.emoticon=i),a&&(f.shortcodes=a),r){f.skinTones=[],f.skinUnicodes=[],f.skinVersions=[];for(const{tone:v,emoji:h,version:b}of r)f.skinTones.push(v),f.skinUnicodes.push(h),f.skinVersions.push(b)}return f})}function Qd(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function Et(e,t,n){Qd(e,"get",t,n)}function Yd(e,t,n){Qd(e,"getAll",t,n)}function ka(e){e.commit&&e.commit()}function Jy(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 Jd(e,t){const n=Jy(e,s=>s.length),i=[];for(const s of n)e.some(o=>o.findIndex(a=>t(a)===t(s))===-1)||i.push(s);return i}async function Xy(e){return!await $a(e,Vt,Ui)}async function Zy(e,t,n){const[i,s]=await Promise.all([ko,Ui].map(o=>$a(e,Vt,o)));return i===n&&s===t}async function ev(e,t){return Qe(e,Pt,en,(i,s,o)=>{let a;const r=()=>{i.getAll(a&&IDBKeyRange.lowerBound(a,!0),50).onsuccess=d=>{const c=d.target.result;for(const l of c)if(a=l.unicode,t(l))return o(l);if(c.length<50)return o();r()}};r()})}async function Xd(e,t,n,i){{const s=Yy(t);await Qe(e,[Pt,Vt],ba,([o,a],r)=>{let d,c,l=0;function p(){++l===2&&f()}function f(){if(!(d===i&&c===n)){o.clear();for(const v of s)o.put(v);a.put(i,ko),a.put(n,Ui),ka(r)}}Et(a,ko,v=>{d=v,p()}),Et(a,Ui,v=>{c=v,p()})})}}async function tv(e,t){return Qe(e,Pt,en,(n,i,s)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Yd(n.index(Hd),o,s)})}async function Zd(e,t){const n=Gd(qt(t));return n.length?Qe(e,Pt,en,(i,s,o)=>{const a=[],r=()=>{a.length===n.length&&d()},d=()=>{const c=Jd(a,l=>l.unicode);o(c.sort((l,p)=>l.order<p.order?-1:1))};for(let c=0;c<n.length;c++){const l=n[c],p=c===n.length-1?IDBKeyRange.bound(l,l+"",!1,!0):IDBKeyRange.only(l);Yd(i.index(zd),p,f=>{a.push(f),r()})}}):[]}async function nv(e,t){const n=await Zd(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(o=>o.toLowerCase()).includes(t.toLowerCase()))[0]||null:await ev(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function iv(e,t){return Qe(e,Pt,en,(n,i,s)=>Et(n,t,o=>{if(o)return s(o);Et(n.index(jd),t,a=>s(a||null))}))}function $a(e,t,n){return Qe(e,t,en,(i,s,o)=>Et(i,n,o))}function sv(e,t,n,i){return Qe(e,t,ba,(s,o)=>{s.put(i,n),ka(o)})}function ov(e,t){return Qe(e,va,ba,(n,i)=>Et(n,t,s=>{n.put((s||0)+1,t),ka(i)}))}function av(e,t,n){return n===0?[]:Qe(e,[va,Pt],en,([i,s],o,a)=>{const r=[];i.index(qd).openCursor(void 0,"prev").onsuccess=d=>{const c=d.target.result;if(!c)return a(r);function l(v){if(r.push(v),r.length===n)return a(r);c.continue()}const p=c.primaryKey,f=t.byName(p);if(f)return l(f);Et(s,p,v=>{if(v)return l(v);c.continue()})}})}const ui="";function rv(e,t){const n=new Map;for(const s of e){const o=t(s);for(const a of o){let r=n;for(let c=0;c<a.length;c++){const l=a.charAt(c);let p=r.get(l);p||(p=new Map,r.set(l,p)),r=p}let d=r.get(ui);d||(d=[],r.set(ui,d)),d.push(s)}}return(s,o)=>{let a=n;for(let c=0;c<s.length;c++){const l=s.charAt(c),p=a.get(l);if(p)a=p;else return[]}if(o)return a.get(ui)||[];const r=[],d=[a];for(;d.length;){const l=[...d.shift().entries()].sort((p,f)=>p[0]<f[0]?-1:1);for(const[p,f]of l)p===ui?r.push(...f):d.push(f)}return r}}const lv=["name","url"];function cv(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||lv.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function ul(e){cv(e);const t=(f,v)=>f.name.toLowerCase()<v.name.toLowerCase()?-1:1,n=e.sort(t),s=rv(e,f=>{const v=new Set;if(f.shortcodes)for(const h of f.shortcodes)for(const b of qt(h))v.add(b);return v}),o=f=>s(f,!0),a=f=>s(f,!1),r=f=>{const v=qt(f),h=v.map((b,S)=>(S<v.length-1?o:a)(b));return Jd(h,b=>b.name).sort(t)},d=new Map,c=new Map;for(const f of e){c.set(f.name.toLowerCase(),f);for(const v of f.shortcodes||[])d.set(v.toLowerCase(),f)}return{all:n,search:r,byShortcode:f=>d.get(f.toLowerCase()),byName:f=>c.get(f.toLowerCase())}}const dv=typeof wrappedJSObject<"u";function mn(e){if(!e)return e;if(dv&&(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 eu(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const uv=["annotation","emoji","group","order","version"];function pv(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||uv.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function tu(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function hv(e){const t=await fetch(e,{method:"HEAD"});tu(t,e);const n=t.headers.get("etag");return eu(n),n}async function So(e){const t=await fetch(e);tu(t,e);const n=t.headers.get("etag");eu(n);const i=await t.json();return pv(i),[n,i]}function fv(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function gv(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 nu(e){const t=JSON.stringify(e);let n=gv(t);const i=await crypto.subtle.digest("SHA-1",n),s=fv(i);return btoa(s)}async function mv(e,t){let n,i=await hv(t);if(!i){const s=await So(t);i=s[0],n=s[1],i||(i=await nu(n))}await Zy(e,t,i)||(n||(n=(await So(t))[1]),await Xd(e,n,t,i))}async function yv(e,t){let[n,i]=await So(t);n||(n=await nu(i)),await Xd(e,i,t,n)}async function vv(e,t){try{await mv(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class bv{constructor({dataSource:t=Uy,locale:n=Ky,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=ul(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await Hy(this._dbName);Vy(this._dbName,this._clear);const n=this.dataSource;await Xy(t)?await yv(t,n):this._lazyUpdate=vv(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 Ks(t),await this.ready(),dl(await tv(this._db,t)).map(mn)}async getEmojiBySearchQuery(t){di(t),await this.ready();const n=this._custom.search(t),i=dl(await Zd(this._db,t)).map(mn);return[...n,...i]}async getEmojiByShortcode(t){di(t),await this.ready();const n=this._custom.byShortcode(t);return n||mn(await nv(this._db,t))}async getEmojiByUnicodeOrName(t){di(t),await this.ready();const n=this._custom.byName(t);return n||mn(await iv(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await $a(this._db,Vt,cl)||0}async setPreferredSkinTone(t){return Ks(t),await this.ready(),sv(this._db,Vt,cl,t)}async incrementFavoriteEmojiCount(t){return di(t),await this.ready(),ov(this._db,t)}async getTopFavoriteEmoji(t){return Ks(t),await this.ready(),(await av(this._db,this._custom,t)).map(mn)}set customEmoji(t){this._custom=ul(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 wa(this._dbName)}async delete(){await this._shutdown(),await jy(this._dbName)}}const xo=[[-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})),Ws=xo.slice(1),wv=2,pl=6,iu=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function hl(e){return e.unicode.includes("")}const kv={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},$v=1e3,Sv="🖐️",xv=8,Av=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],su='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Cv=(e,t)=>e<t?-1:e>t?1:0,fl=(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 ${su}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Ev=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Tv(e){const t=fl(e,"#000"),n=fl(e,"#fff");return t&&n&&Ev(t,n)}function _v(){const e=Object.entries(kv);try{for(const[t,n]of e)if(Tv(t))return n}catch{}return e[0][1]}let zs;const qs=()=>(zs||(zs=new Promise(e=>iu(()=>e(_v())))),zs),Ao=new Map,Mv="️",Pv="\uD83C",Lv="",Iv=127995,Rv=57339;function Dv(e,t){if(t===0)return e;const n=e.indexOf(Lv);return n!==-1?e.substring(0,n)+String.fromCodePoint(Iv+t-1)+e.substring(n):(e.endsWith(Mv)&&(e=e.substring(0,e.length-1)),e+Pv+String.fromCodePoint(Rv+t-1))}function Me(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 ou(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function Bv(e,t){const n=i=>{const s={};for(const o of i)typeof o.tone=="number"&&o.version<=t&&(s[o.tone]=o.unicode);return s};return e.map(({unicode:i,skins:s,shortcodes:o,url:a,name:r,category:d,annotation:c})=>({unicode:i,name:r,shortcodes:o,url:a,category:d,annotation:c,id:i||r,skins:s&&n(s)}))}const bi=requestAnimationFrame;let Nv=typeof ResizeObserver=="function";function Fv(e,t,n){let i;Nv?(i=new ResizeObserver(n),i.observe(e)):bi(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function gl(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let js;function Ov(e,t,n){let i=!0,s=!1;for(const o of e){const a=n(o);if(!a)continue;const r=gl(a);r===0&&(s=!0),typeof js>"u"&&(js=gl(t));const d=r/1.8<js;Ao.set(o.unicode,d),d||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
2523
|
+
`;ts([Vi({type:Number})],Vt.prototype,"splitRatio",2);ts([Vi({type:Number})],Vt.prototype,"minRatio",2);ts([Vi({type:Number})],Vt.prototype,"maxRatio",2);Vt=ts([Vl("resizable-divider")],Vt);function di(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function Ks(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const Iy=1,Ry=1,Lt="emoji",Gt="keyvalue",va="favorites",Dy="tokens",zd="tokens",By="unicode",qd="count",Ny="group",Fy="order",Hd="group-order",ko="eTag",Ui="url",cl="skinTone",tn="readonly",ba="readwrite",jd="skinUnicodes",Oy="skinUnicodes",Uy="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Ky="en";function Wy(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function dl(e){return Wy(e,t=>t.unicode)}function zy(e){function t(n,i,s){const o=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[a,[r,d]]of Object.entries(s))o.createIndex(a,r,{multiEntry:d});return o}t(Gt),t(Lt,By,{[zd]:[Dy,!0],[Hd]:[[Ny,Fy]],[jd]:[Oy,!0]}),t(va,void 0,{[qd]:[""]})}const $o={},vi={},Ki={};function Vd(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function qy(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,Iy);$o[e]=s,s.onupgradeneeded=o=>{o.oldVersion<Ry&&zy(s.result)},Vd(n,i,s)});return t.onclose=()=>wa(e),t}function Hy(e){return vi[e]||(vi[e]=qy(e)),vi[e]}function Ye(e,t,n,i){return new Promise((s,o)=>{const a=e.transaction(t,n,{durability:"relaxed"}),r=typeof t=="string"?a.objectStore(t):t.map(c=>a.objectStore(c));let d;i(r,a,c=>{d=c}),a.oncomplete=()=>s(d),a.onerror=()=>o(a.error)})}function wa(e){const t=$o[e],n=t&&t.result;if(n){n.close();const i=Ki[e];if(i)for(const s of i)s()}delete $o[e],delete vi[e],delete Ki[e]}function jy(e){return new Promise((t,n)=>{wa(e);const i=indexedDB.deleteDatabase(e);Vd(t,n,i)})}function Vy(e,t){let n=Ki[e];n||(n=Ki[e]=[]),n.push(t)}const Gy=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 Ht(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||Gy.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const Qy=2;function Gd(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=Qy)}function Yy(e){return e.map(({annotation:n,emoticon:i,group:s,order:o,shortcodes:a,skins:r,tags:d,emoji:c,version:l})=>{const p=[...new Set(Gd([...(a||[]).map(Ht).flat(),...(d||[]).map(Ht).flat(),...Ht(n),i]))].sort(),h={annotation:n,group:s,order:o,tags:d,tokens:p,unicode:c,version:l};if(i&&(h.emoticon=i),a&&(h.shortcodes=a),r){h.skinTones=[],h.skinUnicodes=[],h.skinVersions=[];for(const{tone:v,emoji:S,version:f}of r)h.skinTones.push(v),h.skinUnicodes.push(S),h.skinVersions.push(f)}return h})}function Qd(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function Tt(e,t,n){Qd(e,"get",t,n)}function Yd(e,t,n){Qd(e,"getAll",t,n)}function ka(e){e.commit&&e.commit()}function Jy(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 Jd(e,t){const n=Jy(e,s=>s.length),i=[];for(const s of n)e.some(o=>o.findIndex(a=>t(a)===t(s))===-1)||i.push(s);return i}async function Xy(e){return!await $a(e,Gt,Ui)}async function Zy(e,t,n){const[i,s]=await Promise.all([ko,Ui].map(o=>$a(e,Gt,o)));return i===n&&s===t}async function ev(e,t){return Ye(e,Lt,tn,(i,s,o)=>{let a;const r=()=>{i.getAll(a&&IDBKeyRange.lowerBound(a,!0),50).onsuccess=d=>{const c=d.target.result;for(const l of c)if(a=l.unicode,t(l))return o(l);if(c.length<50)return o();r()}};r()})}async function Xd(e,t,n,i){{const s=Yy(t);await Ye(e,[Lt,Gt],ba,([o,a],r)=>{let d,c,l=0;function p(){++l===2&&h()}function h(){if(!(d===i&&c===n)){o.clear();for(const v of s)o.put(v);a.put(i,ko),a.put(n,Ui),ka(r)}}Tt(a,ko,v=>{d=v,p()}),Tt(a,Ui,v=>{c=v,p()})})}}async function tv(e,t){return Ye(e,Lt,tn,(n,i,s)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Yd(n.index(Hd),o,s)})}async function Zd(e,t){const n=Gd(Ht(t));return n.length?Ye(e,Lt,tn,(i,s,o)=>{const a=[],r=()=>{a.length===n.length&&d()},d=()=>{const c=Jd(a,l=>l.unicode);o(c.sort((l,p)=>l.order<p.order?-1:1))};for(let c=0;c<n.length;c++){const l=n[c],p=c===n.length-1?IDBKeyRange.bound(l,l+"",!1,!0):IDBKeyRange.only(l);Yd(i.index(zd),p,h=>{a.push(h),r()})}}):[]}async function nv(e,t){const n=await Zd(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(o=>o.toLowerCase()).includes(t.toLowerCase()))[0]||null:await ev(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function iv(e,t){return Ye(e,Lt,tn,(n,i,s)=>Tt(n,t,o=>{if(o)return s(o);Tt(n.index(jd),t,a=>s(a||null))}))}function $a(e,t,n){return Ye(e,t,tn,(i,s,o)=>Tt(i,n,o))}function sv(e,t,n,i){return Ye(e,t,ba,(s,o)=>{s.put(i,n),ka(o)})}function ov(e,t){return Ye(e,va,ba,(n,i)=>Tt(n,t,s=>{n.put((s||0)+1,t),ka(i)}))}function av(e,t,n){return n===0?[]:Ye(e,[va,Lt],tn,([i,s],o,a)=>{const r=[];i.index(qd).openCursor(void 0,"prev").onsuccess=d=>{const c=d.target.result;if(!c)return a(r);function l(v){if(r.push(v),r.length===n)return a(r);c.continue()}const p=c.primaryKey,h=t.byName(p);if(h)return l(h);Tt(s,p,v=>{if(v)return l(v);c.continue()})}})}const ui="";function rv(e,t){const n=new Map;for(const s of e){const o=t(s);for(const a of o){let r=n;for(let c=0;c<a.length;c++){const l=a.charAt(c);let p=r.get(l);p||(p=new Map,r.set(l,p)),r=p}let d=r.get(ui);d||(d=[],r.set(ui,d)),d.push(s)}}return(s,o)=>{let a=n;for(let c=0;c<s.length;c++){const l=s.charAt(c),p=a.get(l);if(p)a=p;else return[]}if(o)return a.get(ui)||[];const r=[],d=[a];for(;d.length;){const l=[...d.shift().entries()].sort((p,h)=>p[0]<h[0]?-1:1);for(const[p,h]of l)p===ui?r.push(...h):d.push(h)}return r}}const lv=["name","url"];function cv(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||lv.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function ul(e){cv(e);const t=(h,v)=>h.name.toLowerCase()<v.name.toLowerCase()?-1:1,n=e.sort(t),s=rv(e,h=>{const v=new Set;if(h.shortcodes)for(const S of h.shortcodes)for(const f of Ht(S))v.add(f);return v}),o=h=>s(h,!0),a=h=>s(h,!1),r=h=>{const v=Ht(h),S=v.map((f,w)=>(w<v.length-1?o:a)(f));return Jd(S,f=>f.name).sort(t)},d=new Map,c=new Map;for(const h of e){c.set(h.name.toLowerCase(),h);for(const v of h.shortcodes||[])d.set(v.toLowerCase(),h)}return{all:n,search:r,byShortcode:h=>d.get(h.toLowerCase()),byName:h=>c.get(h.toLowerCase())}}const dv=typeof wrappedJSObject<"u";function mn(e){if(!e)return e;if(dv&&(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 eu(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const uv=["annotation","emoji","group","order","version"];function pv(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||uv.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function tu(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function hv(e){const t=await fetch(e,{method:"HEAD"});tu(t,e);const n=t.headers.get("etag");return eu(n),n}async function So(e){const t=await fetch(e);tu(t,e);const n=t.headers.get("etag");eu(n);const i=await t.json();return pv(i),[n,i]}function fv(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function gv(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 nu(e){const t=JSON.stringify(e);let n=gv(t);const i=await crypto.subtle.digest("SHA-1",n),s=fv(i);return btoa(s)}async function mv(e,t){let n,i=await hv(t);if(!i){const s=await So(t);i=s[0],n=s[1],i||(i=await nu(n))}await Zy(e,t,i)||(n||(n=(await So(t))[1]),await Xd(e,n,t,i))}async function yv(e,t){let[n,i]=await So(t);n||(n=await nu(i)),await Xd(e,i,t,n)}async function vv(e,t){try{await mv(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class bv{constructor({dataSource:t=Uy,locale:n=Ky,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=ul(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await Hy(this._dbName);Vy(this._dbName,this._clear);const n=this.dataSource;await Xy(t)?await yv(t,n):this._lazyUpdate=vv(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 Ks(t),await this.ready(),dl(await tv(this._db,t)).map(mn)}async getEmojiBySearchQuery(t){di(t),await this.ready();const n=this._custom.search(t),i=dl(await Zd(this._db,t)).map(mn);return[...n,...i]}async getEmojiByShortcode(t){di(t),await this.ready();const n=this._custom.byShortcode(t);return n||mn(await nv(this._db,t))}async getEmojiByUnicodeOrName(t){di(t),await this.ready();const n=this._custom.byName(t);return n||mn(await iv(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await $a(this._db,Gt,cl)||0}async setPreferredSkinTone(t){return Ks(t),await this.ready(),sv(this._db,Gt,cl,t)}async incrementFavoriteEmojiCount(t){return di(t),await this.ready(),ov(this._db,t)}async getTopFavoriteEmoji(t){return Ks(t),await this.ready(),(await av(this._db,this._custom,t)).map(mn)}set customEmoji(t){this._custom=ul(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 wa(this._dbName)}async delete(){await this._shutdown(),await jy(this._dbName)}}const xo=[[-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})),Ws=xo.slice(1),wv=2,pl=6,iu=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function hl(e){return e.unicode.includes("")}const kv={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},$v=1e3,Sv="🖐️",xv=8,Av=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],su='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Cv=(e,t)=>e<t?-1:e>t?1:0,fl=(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 ${su}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Ev=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Tv(e){const t=fl(e,"#000"),n=fl(e,"#fff");return t&&n&&Ev(t,n)}function _v(){const e=Object.entries(kv);try{for(const[t,n]of e)if(Tv(t))return n}catch{}return e[0][1]}let zs;const qs=()=>(zs||(zs=new Promise(e=>iu(()=>e(_v())))),zs),Ao=new Map,Mv="️",Pv="\uD83C",Lv="",Iv=127995,Rv=57339;function Dv(e,t){if(t===0)return e;const n=e.indexOf(Lv);return n!==-1?e.substring(0,n)+String.fromCodePoint(Iv+t-1)+e.substring(n):(e.endsWith(Mv)&&(e=e.substring(0,e.length-1)),e+Pv+String.fromCodePoint(Rv+t-1))}function Pe(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 ou(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function Bv(e,t){const n=i=>{const s={};for(const o of i)typeof o.tone=="number"&&o.version<=t&&(s[o.tone]=o.unicode);return s};return e.map(({unicode:i,skins:s,shortcodes:o,url:a,name:r,category:d,annotation:c})=>({unicode:i,name:r,shortcodes:o,url:a,category:d,annotation:c,id:i||r,skins:s&&n(s)}))}const bi=requestAnimationFrame;let Nv=typeof ResizeObserver=="function";function Fv(e,t,n){let i;Nv?(i=new ResizeObserver(n),i.observe(e)):bi(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function gl(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let js;function Ov(e,t,n){let i=!0,s=!1;for(const o of e){const a=n(o);if(!a)continue;const r=gl(a);r===0&&(s=!0),typeof js>"u"&&(js=gl(t));const d=r/1.8<js;Ao.set(o.unicode,d),d||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
2524
2524
|
This is likely due to using \`display:none\` which is unsupported.
|
|
2525
2525
|
If this is a Jest/Vitest environment, you can ignore this warning.
|
|
2526
|
-
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function Uv(e){return ou(e,t=>t)}function Kv(e){e&&(e.scrollTop=0)}function Tn(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function ml(e){return""+e}function Wv(e){const t=document.createElement("template");return t.innerHTML=e,t}const zv=new WeakMap,qv=new WeakMap,Hv=Symbol("un-keyed"),jv="replaceChildren"in Element.prototype;function Vv(e,t){jv?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function Gv(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 Qv(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=Gv(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&Vv(i,e)}function Yv(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:o,attributeName:a,attributeValuePre:r,attributeValuePost:d}}=n,c=e[o];if(s!==c)if(n.currentExpression=c,a)if(c===null)i.removeAttribute(a);else{const l=r+ml(c)+d;i.setAttribute(a,l)}else{let l;Array.isArray(c)?Qv(c,n):c instanceof Element?(l=c,i.replaceWith(l)):i.nodeValue=ml(c),l&&(n.targetNode=l)}}}function Jv(e){let t="",n=!1,i=!1,s=-1;const o=new Map,a=[];let r=0;for(let c=0,l=e.length;c<l;c++){const p=e[c];if(t+=p.slice(r),c===l-1)break;for(let x=0;x<p.length;x++)switch(p.charAt(x)){case"<":{p.charAt(x+1)==="/"?a.pop():(n=!0,a.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const f=a[a.length-1],v=Tn(o,f,()=>[]);let h,b,S;if(i){const x=/(\S+)="?([^"=]*)$/.exec(p);h=x[1],b=x[2];const C=/^([^">]*)("?)/.exec(e[c+1]);S=C[1],t=t.slice(0,-1*x[0].length),r=C[0].length}else r=0;const $={attributeName:h,attributeValuePre:b,attributeValuePost:S,expressionIndex:c};v.push($),!n&&!i&&(t+=" ")}return{template:Wv(t),elementsToBindings:o}}function yl(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],o=s.attributeName?t:t.firstChild,a={binding:s,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(a)}}function Xv(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))yl(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,a=-1;do{const r=t.get(++a);r&&yl(r,o,n)}while(o=s.nextNode())}return n}function Zv(e){const{template:t,elementsToBindings:n}=Tn(zv,e,()=>Jv(e)),i=t.cloneNode(!0).content.firstElementChild,s=Xv(i,n);return function(a){return Yv(a,s),i}}function eb(e){const t=Tn(qv,e,()=>new Map);let n=Hv;function i(o,...a){const r=Tn(t,o,()=>new Map);return Tn(r,n,()=>Zv(o))(a)}function s(o,a,r){return o.map((d,c)=>{const l=n;n=r(d);try{return a(d,c)}finally{n=l}})}return{map:s,html:i}}function tb(e,t,n,i,s,o,a,r,d){const{labelWithSkin:c,titleForEmoji:l,unicodeWithSkin:p}=n,{html:f,map:v}=eb(t);function h(x,C,T){return v(x,(_,D)=>f`<button role="${C?"option":"menuitem"}" aria-selected="${C?D===t.activeSearchItem:null}" aria-label="${c(_,t.currentSkinTone)}" title="${l(_)}" class="${"emoji"+(C&&D===t.activeSearchItem?" active":"")+(_.unicode?"":" custom-emoji")}" id="${`${T}-${_.id}`}" style="${_.unicode?null:`--custom-emoji-background: url(${JSON.stringify(_.url)})`}">${_.unicode?p(_,t.currentSkinTone):""}</button>`,_=>`${T}-${_.id}`)}const S=f`<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">${v(t.skinTones,(x,C)=>f`<div id="skintone-${C}" class="emoji ${C===t.activeSkinTone?"active":""}" aria-selected="${C===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[C]}" aria-label="${t.i18n.skinTones[C]}">${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">${v(t.groups,x=>f`<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">${v(t.currentEmojisWithCategories,(x,C)=>f`<div><div id="menu-label-${C}" 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 ${C!==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-${C}" id="${t.searchMode?"search-results":null}">${h(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">${h(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,$=(x,C)=>{for(const T of e.querySelectorAll(`[${x}]`))C(T,T.getAttribute(x))};if(d){e.appendChild(S);for(const x of["click","focusout","input","keydown","keyup"])$(`data-on-${x}`,(C,T)=>{C.addEventListener(x,i[T])});$("data-ref",(x,C)=>{o[C]=x}),a.addEventListener("abort",()=>{e.removeChild(S)})}$("data-action",(x,C)=>{let T=r.get(C);T||r.set(C,T=new WeakSet),T.has(x)||(T.add(x),s[C](x))})}const Wi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function nb(e){let t=!1,n;const i=new Map,s=new Set;let o;const a=()=>{if(t)return;const c=[...s];s.clear();try{for(const l of c)l()}finally{o=!1,s.size&&(o=!0,Wi(a))}},r=new Proxy({},{get(c,l){if(n){let p=i.get(l);p||(p=new Set,i.set(l,p)),p.add(n)}return c[l]},set(c,l,p){if(c[l]!==p){c[l]=p;const f=i.get(l);if(f){for(const v of f)s.add(v);o||(o=!0,Wi(a))}}return!0}}),d=c=>{const l=()=>{const p=n;n=l;try{return c()}finally{n=p}};return l()};return e.addEventListener("abort",()=>{t=!0}),{state:r,createEffect:d}}function Vs(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 vl=new WeakMap;function ib(e,t,n){{const i=e.closest(".tabpanel");let s=vl.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),vl.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const Gs=[],{assign:pi}=Object;function sb(e,t){const n={},i=new AbortController,s=i.signal,{state:o,createEffect:a}=nb(s),r=new Map;pi(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),pi(o,t),pi(o,{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:xv,isRtl:!1,currentGroupIndex:0,groups:Ws,databaseLoaded:!1,activeSearchItemId:void 0}),a(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const d=A=>{e.getElementById(A).focus()},c=A=>e.getElementById(`emo-${A.id}`),l=(A,M)=>{n.rootElement.dispatchEvent(new CustomEvent(A,{detail:M,bubbles:!0,composed:!0}))},p=(A,M)=>A.id===M.id,f=(A,M)=>{const{category:N,emojis:F}=A,{category:Q,emojis:H}=M;return N!==Q?!1:Vs(F,H,p)},v=A=>{Vs(o.currentEmojis,A,p)||(o.currentEmojis=A)},h=A=>{o.searchMode!==A&&(o.searchMode=A)},b=A=>{Vs(o.currentEmojisWithCategories,A,f)||(o.currentEmojisWithCategories=A)},S=(A,M)=>M&&A.skins&&A.skins[M]||A.unicode,C={labelWithSkin:(A,M)=>Uv([A.name||S(A,M),A.annotation,...A.shortcodes||Gs].filter(Boolean)).join(", "),titleForEmoji:A=>A.annotation||(A.shortcodes||Gs).join(", "),unicodeWithSkin:S},T={onClickSkinToneButton:G,onEmojiClick:zn,onNavClick:Kn,onNavKeydown:rs,onSearchKeydown:as,onSkinToneOptionsClick:qn,onSkinToneOptionsFocusOut:Je,onSkinToneOptionsKeydown:lt,onSkinToneOptionsKeyup:nn,onSearchInput:Hn},_={calculateEmojiGridStyle:ne,updateOnIntersection:be};let D=!0;a(()=>{tb(e,o,C,T,_,n,s,r,D),D=!1}),o.emojiVersion||qs().then(A=>{A||(o.message=o.i18n.emojiUnsupportedMessage)}),a(()=>{async function A(){let M=!1;const N=setTimeout(()=>{M=!0,o.message=o.i18n.loadingMessage},$v);try{await o.database.ready(),o.databaseLoaded=!0}catch(F){console.error(F),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(N),M&&(M=!1,o.message="")}}o.database&&A()}),a(()=>{o.pickerStyle=`
|
|
2526
|
+
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function Uv(e){return ou(e,t=>t)}function Kv(e){e&&(e.scrollTop=0)}function Tn(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function ml(e){return""+e}function Wv(e){const t=document.createElement("template");return t.innerHTML=e,t}const zv=new WeakMap,qv=new WeakMap,Hv=Symbol("un-keyed"),jv="replaceChildren"in Element.prototype;function Vv(e,t){jv?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function Gv(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 Qv(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=Gv(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&Vv(i,e)}function Yv(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:o,attributeName:a,attributeValuePre:r,attributeValuePost:d}}=n,c=e[o];if(s!==c)if(n.currentExpression=c,a)if(c===null)i.removeAttribute(a);else{const l=r+ml(c)+d;i.setAttribute(a,l)}else{let l;Array.isArray(c)?Qv(c,n):c instanceof Element?(l=c,i.replaceWith(l)):i.nodeValue=ml(c),l&&(n.targetNode=l)}}}function Jv(e){let t="",n=!1,i=!1,s=-1;const o=new Map,a=[];let r=0;for(let c=0,l=e.length;c<l;c++){const p=e[c];if(t+=p.slice(r),c===l-1)break;for(let x=0;x<p.length;x++)switch(p.charAt(x)){case"<":{p.charAt(x+1)==="/"?a.pop():(n=!0,a.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const h=a[a.length-1],v=Tn(o,h,()=>[]);let S,f,w;if(i){const x=/(\S+)="?([^"=]*)$/.exec(p);S=x[1],f=x[2];const C=/^([^">]*)("?)/.exec(e[c+1]);w=C[1],t=t.slice(0,-1*x[0].length),r=C[0].length}else r=0;const b={attributeName:S,attributeValuePre:f,attributeValuePost:w,expressionIndex:c};v.push(b),!n&&!i&&(t+=" ")}return{template:Wv(t),elementsToBindings:o}}function yl(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],o=s.attributeName?t:t.firstChild,a={binding:s,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(a)}}function Xv(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))yl(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,a=-1;do{const r=t.get(++a);r&&yl(r,o,n)}while(o=s.nextNode())}return n}function Zv(e){const{template:t,elementsToBindings:n}=Tn(zv,e,()=>Jv(e)),i=t.cloneNode(!0).content.firstElementChild,s=Xv(i,n);return function(a){return Yv(a,s),i}}function eb(e){const t=Tn(qv,e,()=>new Map);let n=Hv;function i(o,...a){const r=Tn(t,o,()=>new Map);return Tn(r,n,()=>Zv(o))(a)}function s(o,a,r){return o.map((d,c)=>{const l=n;n=r(d);try{return a(d,c)}finally{n=l}})}return{map:s,html:i}}function tb(e,t,n,i,s,o,a,r,d){const{labelWithSkin:c,titleForEmoji:l,unicodeWithSkin:p}=n,{html:h,map:v}=eb(t);function S(x,C,T){return v(x,(P,_)=>h`<button role="${C?"option":"menuitem"}" aria-selected="${C?_===t.activeSearchItem:null}" aria-label="${c(P,t.currentSkinTone)}" title="${l(P)}" class="${"emoji"+(C&&_===t.activeSearchItem?" active":"")+(P.unicode?"":" custom-emoji")}" id="${`${T}-${P.id}`}" style="${P.unicode?null:`--custom-emoji-background: url(${JSON.stringify(P.url)})`}">${P.unicode?p(P,t.currentSkinTone):""}</button>`,P=>`${T}-${P.id}`)}const w=h`<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">${v(t.skinTones,(x,C)=>h`<div id="skintone-${C}" class="emoji ${C===t.activeSkinTone?"active":""}" aria-selected="${C===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[C]}" aria-label="${t.i18n.skinTones[C]}">${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">${v(t.groups,x=>h`<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">${v(t.currentEmojisWithCategories,(x,C)=>h`<div><div id="menu-label-${C}" 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 ${C!==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-${C}" id="${t.searchMode?"search-results":null}">${S(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">${S(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,b=(x,C)=>{for(const T of e.querySelectorAll(`[${x}]`))C(T,T.getAttribute(x))};if(d){e.appendChild(w);for(const x of["click","focusout","input","keydown","keyup"])b(`data-on-${x}`,(C,T)=>{C.addEventListener(x,i[T])});b("data-ref",(x,C)=>{o[C]=x}),a.addEventListener("abort",()=>{e.removeChild(w)})}b("data-action",(x,C)=>{let T=r.get(C);T||r.set(C,T=new WeakSet),T.has(x)||(T.add(x),s[C](x))})}const Wi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function nb(e){let t=!1,n;const i=new Map,s=new Set;let o;const a=()=>{if(t)return;const c=[...s];s.clear();try{for(const l of c)l()}finally{o=!1,s.size&&(o=!0,Wi(a))}},r=new Proxy({},{get(c,l){if(n){let p=i.get(l);p||(p=new Set,i.set(l,p)),p.add(n)}return c[l]},set(c,l,p){if(c[l]!==p){c[l]=p;const h=i.get(l);if(h){for(const v of h)s.add(v);o||(o=!0,Wi(a))}}return!0}}),d=c=>{const l=()=>{const p=n;n=l;try{return c()}finally{n=p}};return l()};return e.addEventListener("abort",()=>{t=!0}),{state:r,createEffect:d}}function Vs(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 vl=new WeakMap;function ib(e,t,n){{const i=e.closest(".tabpanel");let s=vl.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),vl.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const Gs=[],{assign:pi}=Object;function sb(e,t){const n={},i=new AbortController,s=i.signal,{state:o,createEffect:a}=nb(s),r=new Map;pi(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),pi(o,t),pi(o,{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:xv,isRtl:!1,currentGroupIndex:0,groups:Ws,databaseLoaded:!1,activeSearchItemId:void 0}),a(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const d=A=>{e.getElementById(A).focus()},c=A=>e.getElementById(`emo-${A.id}`),l=(A,M)=>{n.rootElement.dispatchEvent(new CustomEvent(A,{detail:M,bubbles:!0,composed:!0}))},p=(A,M)=>A.id===M.id,h=(A,M)=>{const{category:F,emojis:O}=A,{category:Y,emojis:j}=M;return F!==Y?!1:Vs(O,j,p)},v=A=>{Vs(o.currentEmojis,A,p)||(o.currentEmojis=A)},S=A=>{o.searchMode!==A&&(o.searchMode=A)},f=A=>{Vs(o.currentEmojisWithCategories,A,h)||(o.currentEmojisWithCategories=A)},w=(A,M)=>M&&A.skins&&A.skins[M]||A.unicode,C={labelWithSkin:(A,M)=>Uv([A.name||w(A,M),A.annotation,...A.shortcodes||Gs].filter(Boolean)).join(", "),titleForEmoji:A=>A.annotation||(A.shortcodes||Gs).join(", "),unicodeWithSkin:w},T={onClickSkinToneButton:Q,onEmojiClick:zn,onNavClick:Kn,onNavKeydown:rs,onSearchKeydown:as,onSkinToneOptionsClick:qn,onSkinToneOptionsFocusOut:Je,onSkinToneOptionsKeydown:ct,onSkinToneOptionsKeyup:nn,onSearchInput:Hn},P={calculateEmojiGridStyle:H,updateOnIntersection:ie};let _=!0;a(()=>{tb(e,o,C,T,P,n,s,r,_),_=!1}),o.emojiVersion||qs().then(A=>{A||(o.message=o.i18n.emojiUnsupportedMessage)}),a(()=>{async function A(){let M=!1;const F=setTimeout(()=>{M=!0,o.message=o.i18n.loadingMessage},$v);try{await o.database.ready(),o.databaseLoaded=!0}catch(O){console.error(O),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(F),M&&(M=!1,o.message="")}}o.database&&A()}),a(()=>{o.pickerStyle=`
|
|
2527
2527
|
--num-groups: ${o.groups.length};
|
|
2528
2528
|
--indicator-opacity: ${o.searchMode?0:1};
|
|
2529
|
-
--num-skintones: ${pl};`}),a(()=>{o.customEmoji&&o.database&&O()}),a(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==xo&&(o.groups=xo):o.groups!==Ws&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=Ws)}),a(()=>{async function A(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}A()}),a(()=>{o.skinTones=Array(pl).fill().map((A,M)=>Dv(o.skinToneEmoji,M))}),a(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),a(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),a(()=>{async function A(){const{database:M}=o,N=(await Promise.all(Av.map(F=>M.getEmojiByUnicodeOrName(F)))).filter(Boolean);o.defaultFavoriteEmojis=N}o.databaseLoaded&&A()});function O(){const{customEmoji:A,database:M}=o,N=A||Gs;M.customEmoji!==N&&(M.customEmoji=N)}a(()=>{async function A(){O();const{database:M,defaultFavoriteEmojis:N,numColumns:F}=o,Q=await M.getTopFavoriteEmoji(F),H=await rt(ou([...Q,...N],ce=>ce.unicode||ce.name).slice(0,F));o.currentFavorites=H}o.databaseLoaded&&o.defaultFavoriteEmojis&&A()});function ne(A){Fv(A,s,()=>{{const M=getComputedStyle(n.rootElement),N=parseInt(M.getPropertyValue("--num-columns"),10),F=M.getPropertyValue("direction")==="rtl";o.numColumns=N,o.isRtl=F}})}function be(A){ib(A,s,M=>{for(const{target:N,isIntersecting:F}of M)N.classList.toggle("onscreen",F)})}a(()=>{async function A(){const{searchText:M,currentGroup:N,databaseLoaded:F,customEmoji:Q}=o;if(!F)o.currentEmojis=[],o.searchMode=!1;else if(M.length>=wv){const H=await os(M);o.searchText===M&&(v(H),h(!0))}else{const{id:H}=N;if(H!==-1||Q&&Q.length){const ce=await ss(H);o.currentGroup.id===H&&(v(ce),h(!1))}}}A()});const Ye=()=>{bi(()=>Kv(n.tabpanelElement))};a(()=>{const{currentEmojis:A,emojiVersion:M}=o,N=A.filter(F=>F.unicode).filter(F=>hl(F)&&!Ao.has(F.unicode));if(!M&&N.length)v(A),bi(()=>ee(N));else{const F=M?A:A.filter(tn);v(F),Ye()}});function ee(A){Ov(A,n.baselineEmoji,c)?Ye():o.currentEmojis=[...o.currentEmojis]}function tn(A){return!A.unicode||!hl(A)||Ao.get(A.unicode)}async function Lt(A){const M=o.emojiVersion||await qs();return A.filter(({version:N})=>!N||N<=M)}async function rt(A){return Bv(A,o.emojiVersion||await qs())}async function ss(A){const M=A===-1?o.customEmoji:await o.database.getEmojiByGroup(A);return rt(await Lt(M))}async function os(A){return rt(await Lt(await o.database.getEmojiBySearchQuery(A)))}a(()=>{}),a(()=>{function A(){const{searchMode:N,currentEmojis:F}=o;if(N)return[{category:"",emojis:F}];const Q=new Map;for(const H of F){const ce=H.category||"";let Xe=Q.get(ce);Xe||(Xe=[],Q.set(ce,Xe)),Xe.push(H)}return[...Q.entries()].map(([H,ce])=>({category:H,emojis:ce})).sort((H,ce)=>o.customCategorySorting(H.category,ce.category))}const M=A();b(M)}),a(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),a(()=>{const{rawSearchText:A}=o;iu(()=>{o.searchText=(A||"").trim(),o.activeSearchItem=-1})});function as(A){if(!o.searchMode||!o.currentEmojis.length)return;const M=N=>{Me(A),o.activeSearchItem=Hs(N,o.activeSearchItem,o.currentEmojis)};switch(A.key){case"ArrowDown":return M(!1);case"ArrowUp":return M(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return Me(A),J(o.currentEmojis[o.activeSearchItem].id)}}function Kn(A){const{target:M}=A,N=M.closest(".nav-button");if(!N)return;const F=parseInt(N.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(Q=>Q.id===F)}function rs(A){const{target:M,key:N}=A,F=Q=>{Q&&(Me(A),Q.focus())};switch(N){case"ArrowLeft":return F(M.previousElementSibling);case"ArrowRight":return F(M.nextElementSibling);case"Home":return F(M.parentElement.firstElementChild);case"End":return F(M.parentElement.lastElementChild)}}async function Wn(A){const M=await o.database.getEmojiByUnicodeOrName(A),N=[...o.currentEmojis,...o.currentFavorites].find(Q=>Q.id===A),F=N.unicode&&S(N,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(A),{emoji:M,skinTone:o.currentSkinTone,...F&&{unicode:F},...N.name&&{name:N.name}}}async function J(A){const M=Wn(A);l("emoji-click-sync",M),l("emoji-click",await M)}function zn(A){const{target:M}=A;if(!M.classList.contains("emoji"))return;Me(A);const N=M.id.substring(4);J(N)}function X(A){o.currentSkinTone=A,o.skinTonePickerExpanded=!1,d("skintone-button"),l("skin-tone-change",{skinTone:A}),o.database.setPreferredSkinTone(A)}function qn(A){const{target:{id:M}}=A,N=M&&M.match(/^skintone-(\d)/);if(!N)return;Me(A);const F=parseInt(N[1],10);X(F)}function G(A){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&(Me(A),bi(()=>d("skintone-list")))}a(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function lt(A){if(!o.skinTonePickerExpanded)return;const M=async N=>{Me(A),o.activeSkinTone=N};switch(A.key){case"ArrowUp":return M(Hs(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return M(Hs(!1,o.activeSkinTone,o.skinTones));case"Home":return M(0);case"End":return M(o.skinTones.length-1);case"Enter":return Me(A),X(o.activeSkinTone);case"Escape":return Me(A),o.skinTonePickerExpanded=!1,d("skintone-button")}}function nn(A){if(o.skinTonePickerExpanded&&A.key===" ")return Me(A),X(o.activeSkinTone)}async function Je(A){const{relatedTarget:M}=A;(!M||M.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function Hn(A){o.rawSearchText=A.target.value}return{$set(A){pi(o,A)},$destroy(){i.abort()}}}const ob="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",ab="en";var rb={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"}},lb=':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 au=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],cb=`:host{--emoji-font-family:${su}}`;class Sa extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=lb+cb,this.shadowRoot.appendChild(n),this._ctx={locale:ab,dataSource:ob,skinToneEmoji:Sv,customCategorySorting:Cv,customEmoji:null,i18n:rb,emojiVersion:null,...t};for(const i of au)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){bl(this),this._cmp||(this._cmp=sb(this.shadowRoot,this._ctx))}disconnectedCallback(){bl(this),Wi(()=>{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,o)=>o.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 bv({locale:t,dataSource:n}))}_dbFlush(){Wi(()=>this._dbCreate())}}const ru={};for(const e of au)ru[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(Sa.prototype,ru);function bl(e){e instanceof Sa||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Sa);function db(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 wl(e){e.style.height="44px",e.style.overflowY="hidden"}const ub=5e3;function pb(e){return e?e.active?u`
|
|
2529
|
+
--num-skintones: ${pl};`}),a(()=>{o.customEmoji&&o.database&&N()}),a(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==xo&&(o.groups=xo):o.groups!==Ws&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=Ws)}),a(()=>{async function A(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}A()}),a(()=>{o.skinTones=Array(pl).fill().map((A,M)=>Dv(o.skinToneEmoji,M))}),a(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),a(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),a(()=>{async function A(){const{database:M}=o,F=(await Promise.all(Av.map(O=>M.getEmojiByUnicodeOrName(O)))).filter(Boolean);o.defaultFavoriteEmojis=F}o.databaseLoaded&&A()});function N(){const{customEmoji:A,database:M}=o,F=A||Gs;M.customEmoji!==F&&(M.customEmoji=F)}a(()=>{async function A(){N();const{database:M,defaultFavoriteEmojis:F,numColumns:O}=o,Y=await M.getTopFavoriteEmoji(O),j=await lt(ou([...Y,...F],de=>de.unicode||de.name).slice(0,O));o.currentFavorites=j}o.databaseLoaded&&o.defaultFavoriteEmojis&&A()});function H(A){Fv(A,s,()=>{{const M=getComputedStyle(n.rootElement),F=parseInt(M.getPropertyValue("--num-columns"),10),O=M.getPropertyValue("direction")==="rtl";o.numColumns=F,o.isRtl=O}})}function ie(A){ib(A,s,M=>{for(const{target:F,isIntersecting:O}of M)F.classList.toggle("onscreen",O)})}a(()=>{async function A(){const{searchText:M,currentGroup:F,databaseLoaded:O,customEmoji:Y}=o;if(!O)o.currentEmojis=[],o.searchMode=!1;else if(M.length>=wv){const j=await os(M);o.searchText===M&&(v(j),S(!0))}else{const{id:j}=F;if(j!==-1||Y&&Y.length){const de=await ss(j);o.currentGroup.id===j&&(v(de),S(!1))}}}A()});const be=()=>{bi(()=>Kv(n.tabpanelElement))};a(()=>{const{currentEmojis:A,emojiVersion:M}=o,F=A.filter(O=>O.unicode).filter(O=>hl(O)&&!Ao.has(O.unicode));if(!M&&F.length)v(A),bi(()=>X(F));else{const O=M?A:A.filter(rt);v(O),be()}});function X(A){Ov(A,n.baselineEmoji,c)?be():o.currentEmojis=[...o.currentEmojis]}function rt(A){return!A.unicode||!hl(A)||Ao.get(A.unicode)}async function It(A){const M=o.emojiVersion||await qs();return A.filter(({version:F})=>!F||F<=M)}async function lt(A){return Bv(A,o.emojiVersion||await qs())}async function ss(A){const M=A===-1?o.customEmoji:await o.database.getEmojiByGroup(A);return lt(await It(M))}async function os(A){return lt(await It(await o.database.getEmojiBySearchQuery(A)))}a(()=>{}),a(()=>{function A(){const{searchMode:F,currentEmojis:O}=o;if(F)return[{category:"",emojis:O}];const Y=new Map;for(const j of O){const de=j.category||"";let Xe=Y.get(de);Xe||(Xe=[],Y.set(de,Xe)),Xe.push(j)}return[...Y.entries()].map(([j,de])=>({category:j,emojis:de})).sort((j,de)=>o.customCategorySorting(j.category,de.category))}const M=A();f(M)}),a(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),a(()=>{const{rawSearchText:A}=o;iu(()=>{o.searchText=(A||"").trim(),o.activeSearchItem=-1})});function as(A){if(!o.searchMode||!o.currentEmojis.length)return;const M=F=>{Pe(A),o.activeSearchItem=Hs(F,o.activeSearchItem,o.currentEmojis)};switch(A.key){case"ArrowDown":return M(!1);case"ArrowUp":return M(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return Pe(A),Z(o.currentEmojis[o.activeSearchItem].id)}}function Kn(A){const{target:M}=A,F=M.closest(".nav-button");if(!F)return;const O=parseInt(F.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(Y=>Y.id===O)}function rs(A){const{target:M,key:F}=A,O=Y=>{Y&&(Pe(A),Y.focus())};switch(F){case"ArrowLeft":return O(M.previousElementSibling);case"ArrowRight":return O(M.nextElementSibling);case"Home":return O(M.parentElement.firstElementChild);case"End":return O(M.parentElement.lastElementChild)}}async function Wn(A){const M=await o.database.getEmojiByUnicodeOrName(A),F=[...o.currentEmojis,...o.currentFavorites].find(Y=>Y.id===A),O=F.unicode&&w(F,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(A),{emoji:M,skinTone:o.currentSkinTone,...O&&{unicode:O},...F.name&&{name:F.name}}}async function Z(A){const M=Wn(A);l("emoji-click-sync",M),l("emoji-click",await M)}function zn(A){const{target:M}=A;if(!M.classList.contains("emoji"))return;Pe(A);const F=M.id.substring(4);Z(F)}function ee(A){o.currentSkinTone=A,o.skinTonePickerExpanded=!1,d("skintone-button"),l("skin-tone-change",{skinTone:A}),o.database.setPreferredSkinTone(A)}function qn(A){const{target:{id:M}}=A,F=M&&M.match(/^skintone-(\d)/);if(!F)return;Pe(A);const O=parseInt(F[1],10);ee(O)}function Q(A){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&(Pe(A),bi(()=>d("skintone-list")))}a(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function ct(A){if(!o.skinTonePickerExpanded)return;const M=async F=>{Pe(A),o.activeSkinTone=F};switch(A.key){case"ArrowUp":return M(Hs(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return M(Hs(!1,o.activeSkinTone,o.skinTones));case"Home":return M(0);case"End":return M(o.skinTones.length-1);case"Enter":return Pe(A),ee(o.activeSkinTone);case"Escape":return Pe(A),o.skinTonePickerExpanded=!1,d("skintone-button")}}function nn(A){if(o.skinTonePickerExpanded&&A.key===" ")return Pe(A),ee(o.activeSkinTone)}async function Je(A){const{relatedTarget:M}=A;(!M||M.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function Hn(A){o.rawSearchText=A.target.value}return{$set(A){pi(o,A)},$destroy(){i.abort()}}}const ob="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",ab="en";var rb={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"}},lb=':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 au=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],cb=`:host{--emoji-font-family:${su}}`;class Sa extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=lb+cb,this.shadowRoot.appendChild(n),this._ctx={locale:ab,dataSource:ob,skinToneEmoji:Sv,customCategorySorting:Cv,customEmoji:null,i18n:rb,emojiVersion:null,...t};for(const i of au)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){bl(this),this._cmp||(this._cmp=sb(this.shadowRoot,this._ctx))}disconnectedCallback(){bl(this),Wi(()=>{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,o)=>o.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 bv({locale:t,dataSource:n}))}_dbFlush(){Wi(()=>this._dbCreate())}}const ru={};for(const e of au)ru[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(Sa.prototype,ru);function bl(e){e instanceof Sa||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Sa);function db(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 wl(e){e.style.height="44px",e.style.overflowY="hidden"}const ub=5e3;function pb(e){return e?e.active?u`
|
|
2530
2530
|
<div class="callout info compaction-indicator compaction-indicator--active">
|
|
2531
|
-
${
|
|
2531
|
+
${L.loader} Compacting context...
|
|
2532
2532
|
</div>
|
|
2533
2533
|
`:e.completedAt&&Date.now()-e.completedAt<ub?u`
|
|
2534
2534
|
<div class="callout success compaction-indicator compaction-indicator--complete">
|
|
2535
|
-
${
|
|
2535
|
+
${L.check} Context compacted
|
|
2536
2536
|
</div>
|
|
2537
|
-
`:
|
|
2537
|
+
`:k:k}const He=5*1024*1024;function je(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Ce(e,t){var i,s,o;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 a=(s=e.closest(".chat"))==null?void 0:s.querySelector(".chat-compose");(o=a==null?void 0:a.parentElement)==null||o.insertBefore(n,a)}n.textContent=t,setTimeout(()=>n==null?void 0:n.remove(),4e3)}const hb=/\.(md|txt|csv|json|xml|html|css|js|ts|py|sh|yaml|yml|toml|ini|cfg|log|sql)$/i;function lu(e){return e.type.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name)}function cu(e){return e.type.startsWith("text/")||e.type==="application/json"||e.type==="application/xml"||hb.test(e.name)}function du(e){return e.type==="application/pdf"||/\.pdf$/i.test(e.name)}function uu(e){return e.type.startsWith("video/")||/\.(mp4|webm|mov|avi|mkv|m4v)$/i.test(e.name)}function fb(e,t){if(!t.onAttachmentsChange)return;const n=document.querySelector(".chat");if(lu(e)){if(e.size>He){n&&Ce(n,`Image too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:je(),dataUrl:i.result,mimeType:e.type};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else if(cu(e)){if(e.size>He){n&&Ce(n,`File too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:je(),dataUrl:"",mimeType:e.type||"text/plain",fileName:e.name,textContent:i.result};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsText(e)}else if(du(e)){if(e.size>He){n&&Ce(n,`PDF too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:je(),dataUrl:i.result,mimeType:"application/pdf",fileName:e.name};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else if(uu(e)){if(e.size>He){n&&Ce(n,`Video too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:je(),dataUrl:i.result,mimeType:e.type||"video/mp4",fileName:e.name};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else n&&Ce(n,`Unsupported file type: ${e.name}. Use the Files page to upload to workspace.`)}function gb(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 o=0;o<i.length;o++){const a=i[o];if(lu(a)){if(!t.onAttachmentsChange)continue;if(a.size>He){Ce(n,`Image too large (${(a.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const r=new FileReader;r.onload=()=>{var p;const d=r.result,c={id:je(),dataUrl:d,mimeType:a.type},l=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...l,c])},r.readAsDataURL(a)}else if(cu(a)){if(!t.onAttachmentsChange)continue;if(a.size>He){Ce(n,`File too large (${(a.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const r=new FileReader;r.onload=()=>{var p;const d=r.result,c={id:je(),dataUrl:"",mimeType:a.type||"text/plain",fileName:a.name,textContent:d},l=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...l,c])},r.readAsText(a)}else if(du(a)){if(!t.onAttachmentsChange)continue;if(a.size>He){Ce(n,`PDF too large (${(a.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const r=new FileReader;r.onload=()=>{var p;const d=r.result,c={id:je(),dataUrl:d,mimeType:"application/pdf",fileName:a.name},l=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...l,c])},r.readAsDataURL(a)}else if(uu(a)){if(!t.onAttachmentsChange)continue;if(a.size>He){Ce(n,`Video too large (${(a.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const r=new FileReader;r.onload=()=>{var p;const d=r.result,c={id:je(),dataUrl:d,mimeType:a.type||"video/mp4",fileName:a.name},l=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...l,c])},r.readAsDataURL(a)}else Ce(n,`Unsupported file type: ${a.name}. Use the Files page to upload to workspace.`)}}function mb(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),e.currentTarget.classList.add("chat--dragover")}function yb(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&t.classList.remove("chat--dragover")}function vb(e,t){var s,o,a;const n=(s=e.clipboardData)==null?void 0:s.items;if(!n||!t.onAttachmentsChange)return;const i=[];for(let r=0;r<n.length;r++){const d=n[r];(d.type.startsWith("image/")||d.type.startsWith("video/"))&&i.push(d)}if(i.length!==0){e.preventDefault();for(const r of i){const d=r.getAsFile();if(!d)continue;const c=d.type.startsWith("video/")?"Video":"Image";if(d.size>He){const p=((a=(o=e.target)==null?void 0:o.closest)==null?void 0:a.call(o,".chat"))??document.querySelector(".chat");p&&Ce(p,`${c} too large (${(d.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const l=new FileReader;l.onload=()=>{var f;const p=l.result,h=d.type.startsWith("video/"),v={id:je(),dataUrl:p,mimeType:d.type,fileName:h?d.name||"video.mp4":void 0},S=t.attachments??[];(f=t.onAttachmentsChange)==null||f.call(t,[...S,v])},l.readAsDataURL(d)}}}function bb(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 o=a=>{i.contains(a.target)||t.contains(a.target)||(i.classList.remove("active"),t.classList.remove("active"),document.removeEventListener("click",o,!0))};requestAnimationFrame(()=>document.addEventListener("click",o,!0))}}function wb(e,t){const n=e.detail,i=n==null?void 0:n.unicode;if(!i)return;const s=e.currentTarget.closest(".chat-compose"),o=s==null?void 0:s.querySelector("textarea");if(!o)return;const a=o.selectionStart??t.draft.length,r=o.selectionEnd??a,d=t.draft.slice(0,a),c=t.draft.slice(r);t.onDraftChange(d+i+c);const l=s==null?void 0:s.querySelector(".emoji-picker-popup"),p=s==null?void 0:s.querySelector(".chat-compose__emoji");l==null||l.classList.remove("active"),p==null||p.classList.remove("active"),requestAnimationFrame(()=>{o.focus();const h=a+i.length;o.setSelectionRange(h,h)})}function kb(e){const t=e.attachments??[];return t.length===0?k:u`
|
|
2538
2538
|
<div class="chat-attachments">
|
|
2539
2539
|
${t.map(n=>{var i;return n.fileName?u`
|
|
2540
2540
|
<div class="chat-attachment chat-attachment--file">
|
|
2541
|
-
<span class="chat-attachment__icon">${(i=n.mimeType)!=null&&i.startsWith("video/")?
|
|
2541
|
+
<span class="chat-attachment__icon">${(i=n.mimeType)!=null&&i.startsWith("video/")?L.film:L.fileText}</span>
|
|
2542
2542
|
<span class="chat-attachment__name" title=${n.fileName}>${n.fileName}</span>
|
|
2543
2543
|
<button
|
|
2544
2544
|
class="chat-attachment__remove chat-attachment__remove--file"
|
|
@@ -2546,7 +2546,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2546
2546
|
aria-label="Remove attachment"
|
|
2547
2547
|
@click=${()=>{var o;const s=(e.attachments??[]).filter(a=>a.id!==n.id);(o=e.onAttachmentsChange)==null||o.call(e,s)}}
|
|
2548
2548
|
>
|
|
2549
|
-
${
|
|
2549
|
+
${L.x}
|
|
2550
2550
|
</button>
|
|
2551
2551
|
</div>
|
|
2552
2552
|
`:u`
|
|
@@ -2562,12 +2562,12 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2562
2562
|
aria-label="Remove attachment"
|
|
2563
2563
|
@click=${()=>{var o;const s=(e.attachments??[]).filter(a=>a.id!==n.id);(o=e.onAttachmentsChange)==null||o.call(e,s)}}
|
|
2564
2564
|
>
|
|
2565
|
-
${
|
|
2565
|
+
${L.x}
|
|
2566
2566
|
</button>
|
|
2567
2567
|
</div>
|
|
2568
2568
|
`})}
|
|
2569
2569
|
</div>
|
|
2570
|
-
`}function pu(e){var
|
|
2570
|
+
`}function pu(e){var S,f,w;const t=e.connected,n=e.sending||e.stream!==null,i=!!(e.canAbort&&e.onAbort),s=(f=(S=e.sessions)==null?void 0:S.sessions)==null?void 0:f.find(b=>b.key===e.sessionKey),o=(s==null?void 0:s.reasoningLevel)??"off",a=e.showThinking&&o!=="off";e.assistantName,e.assistantAvatar??e.assistantAvatarUrl;const r=(((w=e.attachments)==null?void 0:w.length)??0)>0,d=e.connected?r?"Add a message...":"Message...":"Connecting…";Ey({onSend:b=>{e.onAttachmentsChange&&e.onAttachmentsChange([...e.attachments??[],b]),requestAnimationFrame(()=>e.onSend())},onRequestRender:()=>{var b;(b=e.requestUpdate)==null||b.call(e)}});const c=Cy(),l=!c&&!e.draft.trim()&&!r&&!n,p=e.splitRatio??.6,h=!!(e.sidebarOpen&&e.onCloseSidebar),v=u`
|
|
2571
2571
|
<div
|
|
2572
2572
|
class="chat-thread"
|
|
2573
2573
|
role="log"
|
|
@@ -2575,21 +2575,21 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2575
2575
|
@scroll=${e.onChatScroll}
|
|
2576
2576
|
>
|
|
2577
2577
|
${e.hasMore?u`<div class="chat-load-more">
|
|
2578
|
-
${e.loadingOlder?u`<span class="chat-load-more__spinner">${
|
|
2579
|
-
</div>`:
|
|
2580
|
-
${e.loading?u`<div class="muted">Loading chat…</div>`:
|
|
2581
|
-
${Bg(Tb(e)
|
|
2578
|
+
${e.loadingOlder?u`<span class="chat-load-more__spinner">${L.loader}</span> Loading older messages…`:u`<button class="chat-load-more__btn" type="button" @click=${e.onLoadOlder}>Load older messages</button>`}
|
|
2579
|
+
</div>`:k}
|
|
2580
|
+
${e.loading?u`<div class="muted">Loading chat…</div>`:k}
|
|
2581
|
+
${Bg(Tb(e),b=>b.key,b=>b.kind==="interim"?my(b.text):b.kind==="reading-indicator"?gy():b.kind==="stream"?yy(b.text,b.startedAt,e.onOpenSidebar):b.kind==="group"?vy(b,{onOpenSidebar:e.onOpenSidebar,showReasoning:a,assistantName:e.assistantName}):k)}
|
|
2582
2582
|
</div>
|
|
2583
2583
|
`;return u`
|
|
2584
2584
|
<section
|
|
2585
2585
|
class="card chat"
|
|
2586
|
-
@drop=${
|
|
2586
|
+
@drop=${b=>gb(b,e)}
|
|
2587
2587
|
@dragover=${mb}
|
|
2588
2588
|
@dragleave=${yb}
|
|
2589
2589
|
>
|
|
2590
|
-
${e.disabledReason?u`<div class="callout">${e.disabledReason}</div>`:
|
|
2590
|
+
${e.disabledReason?u`<div class="callout">${e.disabledReason}</div>`:k}
|
|
2591
2591
|
|
|
2592
|
-
${e.error?u`<div class="callout danger">${e.error}</div>`:
|
|
2592
|
+
${e.error?u`<div class="callout danger">${e.error}</div>`:k}
|
|
2593
2593
|
|
|
2594
2594
|
${pb(e.compactionStatus)}
|
|
2595
2595
|
|
|
@@ -2601,42 +2601,42 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2601
2601
|
aria-label="Exit focus mode"
|
|
2602
2602
|
title="Exit focus mode"
|
|
2603
2603
|
>
|
|
2604
|
-
${
|
|
2604
|
+
${L.x}
|
|
2605
2605
|
</button>
|
|
2606
|
-
`:
|
|
2606
|
+
`:k}
|
|
2607
2607
|
|
|
2608
2608
|
<div
|
|
2609
|
-
class="chat-split-container ${
|
|
2609
|
+
class="chat-split-container ${h?"chat-split-container--open":""}"
|
|
2610
2610
|
>
|
|
2611
2611
|
<div
|
|
2612
2612
|
class="chat-main"
|
|
2613
|
-
style="flex: ${
|
|
2613
|
+
style="flex: ${h?`0 0 ${p*100}%`:"1 1 100%"}"
|
|
2614
2614
|
>
|
|
2615
2615
|
${v}
|
|
2616
2616
|
${e.nearBottom===!1?u`
|
|
2617
2617
|
<button
|
|
2618
2618
|
class="chat-scroll-bottom"
|
|
2619
2619
|
type="button"
|
|
2620
|
-
@click=${
|
|
2620
|
+
@click=${b=>{const x=b.currentTarget.closest(".chat-main"),C=x==null?void 0:x.querySelector(".chat-thread");C&&C.scrollTo({top:C.scrollHeight,behavior:"smooth"})}}
|
|
2621
2621
|
aria-label="Scroll to bottom"
|
|
2622
2622
|
title="Scroll to bottom"
|
|
2623
2623
|
>
|
|
2624
|
-
${
|
|
2624
|
+
${L.chevronDown}
|
|
2625
2625
|
</button>
|
|
2626
|
-
`:
|
|
2626
|
+
`:k}
|
|
2627
2627
|
</div>
|
|
2628
2628
|
|
|
2629
|
-
${
|
|
2629
|
+
${h?u`
|
|
2630
2630
|
<resizable-divider
|
|
2631
2631
|
.splitRatio=${p}
|
|
2632
|
-
@resize=${
|
|
2632
|
+
@resize=${b=>{var x;return(x=e.onSplitRatioChange)==null?void 0:x.call(e,b.detail.splitRatio)}}
|
|
2633
2633
|
></resizable-divider>
|
|
2634
2634
|
<div class="chat-sidebar">
|
|
2635
2635
|
${My({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
|
|
2636
2636
|
${e.sidebarContent}
|
|
2637
2637
|
\`\`\``)}})}
|
|
2638
2638
|
</div>
|
|
2639
|
-
`:
|
|
2639
|
+
`:k}
|
|
2640
2640
|
</div>
|
|
2641
2641
|
|
|
2642
2642
|
${e.suggestion?u`
|
|
@@ -2644,12 +2644,12 @@ ${e.sidebarContent}
|
|
|
2644
2644
|
<button
|
|
2645
2645
|
class="chat-suggestion-chip"
|
|
2646
2646
|
type="button"
|
|
2647
|
-
@click=${()=>{var
|
|
2647
|
+
@click=${()=>{var b;return(b=e.onSuggestionClick)==null?void 0:b.call(e,e.suggestion)}}
|
|
2648
2648
|
>
|
|
2649
2649
|
${e.suggestion}
|
|
2650
2650
|
</button>
|
|
2651
2651
|
</div>
|
|
2652
|
-
`:
|
|
2652
|
+
`:k}
|
|
2653
2653
|
|
|
2654
2654
|
<div class="chat-compose">
|
|
2655
2655
|
${kb(e)}
|
|
@@ -2662,16 +2662,16 @@ ${e.sidebarContent}
|
|
|
2662
2662
|
aria-label="Emoji"
|
|
2663
2663
|
title="Emoji"
|
|
2664
2664
|
>
|
|
2665
|
-
${
|
|
2665
|
+
${L.smile}
|
|
2666
2666
|
</button>
|
|
2667
2667
|
<button
|
|
2668
2668
|
class="chat-compose__attach"
|
|
2669
2669
|
type="button"
|
|
2670
|
-
@click=${
|
|
2670
|
+
@click=${b=>{var C;const x=(C=b.currentTarget.closest(".chat-compose__row"))==null?void 0:C.querySelector(".chat-compose__file-input");x==null||x.click()}}
|
|
2671
2671
|
aria-label="Attach file"
|
|
2672
2672
|
title="Attach file"
|
|
2673
2673
|
>
|
|
2674
|
-
${
|
|
2674
|
+
${L.paperclip}
|
|
2675
2675
|
</button>
|
|
2676
2676
|
<input
|
|
2677
2677
|
class="chat-compose__file-input"
|
|
@@ -2679,16 +2679,16 @@ ${e.sidebarContent}
|
|
|
2679
2679
|
multiple
|
|
2680
2680
|
accept="image/*,video/*,.pdf,.md,.txt,.csv,.json,.xml,.html,.css,.js,.ts,.py,.sh,.yaml,.yml,.toml,.ini,.cfg,.log,.sql"
|
|
2681
2681
|
style="display:none"
|
|
2682
|
-
@change=${
|
|
2682
|
+
@change=${b=>{const x=b.target,C=x.files;if(!(!C||C.length===0||!e.onAttachmentsChange)){for(let T=0;T<C.length;T++)fb(C[T],e);x.value=""}}}
|
|
2683
2683
|
/>
|
|
2684
2684
|
<label class="field chat-compose__field">
|
|
2685
2685
|
<span>Message</span>
|
|
2686
2686
|
<textarea
|
|
2687
2687
|
.value=${e.draft}
|
|
2688
2688
|
?disabled=${!e.connected}
|
|
2689
|
-
@keydown=${
|
|
2690
|
-
@input=${
|
|
2691
|
-
@paste=${
|
|
2689
|
+
@keydown=${b=>{b.key==="Enter"&&(b.isComposing||b.keyCode===229||b.shiftKey||e.connected&&(b.preventDefault(),t&&(e.onSend(),wl(b.target))))}}
|
|
2690
|
+
@input=${b=>{const x=b.target;e.onDraftChange(x.value),db(x)}}
|
|
2691
|
+
@paste=${b=>vb(b,e)}
|
|
2692
2692
|
placeholder=${d}
|
|
2693
2693
|
></textarea>
|
|
2694
2694
|
</label>
|
|
@@ -2699,29 +2699,29 @@ ${e.sidebarContent}
|
|
|
2699
2699
|
aria-label="Stop"
|
|
2700
2700
|
title="Stop generating"
|
|
2701
2701
|
>
|
|
2702
|
-
${
|
|
2702
|
+
${L.square}
|
|
2703
2703
|
</button>
|
|
2704
|
-
`:
|
|
2704
|
+
`:k}
|
|
2705
2705
|
${l?Ty(e.connected):u`
|
|
2706
2706
|
<button
|
|
2707
2707
|
class="btn btn--icon chat-compose__send primary"
|
|
2708
2708
|
?disabled=${!e.connected}
|
|
2709
|
-
@click=${
|
|
2709
|
+
@click=${b=>{var C;e.onSend();const x=(C=b.target.closest(".chat-compose"))==null?void 0:C.querySelector("textarea");x&&wl(x)}}
|
|
2710
2710
|
aria-label="${n?"Queue":"Send"}"
|
|
2711
2711
|
title="${n?"Queue message":"Send (Enter)"}"
|
|
2712
2712
|
>
|
|
2713
|
-
${
|
|
2713
|
+
${L.send}
|
|
2714
2714
|
</button>`}
|
|
2715
2715
|
</div>`}
|
|
2716
2716
|
<div class="emoji-picker-popup">
|
|
2717
2717
|
<emoji-picker
|
|
2718
|
-
@emoji-click=${
|
|
2718
|
+
@emoji-click=${b=>wb(b,e)}
|
|
2719
2719
|
></emoji-picker>
|
|
2720
2720
|
</div>
|
|
2721
|
-
${e.publicMode?
|
|
2721
|
+
${e.publicMode?k:Cb(e)}
|
|
2722
2722
|
</div>
|
|
2723
2723
|
</section>
|
|
2724
|
-
`}const $b=[{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 Sb(e){const t=new Set(e.filter(n=>n.provider==="anthropic").map(n=>n.id));return $b.filter(n=>t.has(n.id)).map(n=>({key:`anthropic/${n.id}`,...n}))}const xb=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Ab(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(o=>o.classList.remove("active")),!i){n.classList.add("active");const o=a=>{!n.contains(a.target)&&a.target!==t&&!t.contains(a.target)&&(n.classList.remove("active"),document.removeEventListener("click",o))};requestAnimationFrame(()=>document.addEventListener("click",o))}}function Cb(e){if(!e.connected)return
|
|
2724
|
+
`}const $b=[{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 Sb(e){const t=new Set(e.filter(n=>n.provider==="anthropic").map(n=>n.id));return $b.filter(n=>t.has(n.id)).map(n=>({key:`anthropic/${n.id}`,...n}))}const xb=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Ab(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(o=>o.classList.remove("active")),!i){n.classList.add("active");const o=a=>{!n.contains(a.target)&&a.target!==t&&!t.contains(a.target)&&(n.classList.remove("active"),document.removeEventListener("click",o))};requestAnimationFrame(()=>document.addEventListener("click",o))}}function Cb(e){if(!e.connected)return k;const t=e.modelCatalog??[],n=Sb(t);if(n.length===0)return k;const i=e.modelProvider&&e.model?`${e.modelProvider}/${e.model}`:null,s=e.thinkingLevel??"off",o=e.verboseLevel==="on"||e.verboseLevel==="full",a=e.fillerEnabled===!0;return u`
|
|
2725
2725
|
<div class="chat-model-bar">
|
|
2726
2726
|
<div class="chat-model-bar__select">
|
|
2727
2727
|
<select
|
|
@@ -2756,7 +2756,7 @@ ${e.sidebarContent}
|
|
|
2756
2756
|
aria-label="Message settings"
|
|
2757
2757
|
title="Message settings"
|
|
2758
2758
|
>
|
|
2759
|
-
${
|
|
2759
|
+
${L.slidersHorizontal}
|
|
2760
2760
|
</button>
|
|
2761
2761
|
<div class="chat-settings-menu">
|
|
2762
2762
|
<label class="chat-settings-menu__item">
|
|
@@ -2779,7 +2779,7 @@ ${e.sidebarContent}
|
|
|
2779
2779
|
</label>
|
|
2780
2780
|
</div>
|
|
2781
2781
|
</div>
|
|
2782
|
-
`}function Eb(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=ic(i.message),o=sc(s.role),a=s.timestamp||Date.now();!n||n.role!==o?(n&&t.push(n),n={kind:"group",key:`group:${o}:${i.key}`,role:o,messages:[{message:i.message,key:i.key}],timestamp:a,isStreaming:!1}):n.messages.push({message:i.message,key:i.key})}return n&&t.push(n),t}function Tb(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";for(let a=0;a<n.length;a++){const r=n[a],d=ic(r);if(!s&&d.role.toLowerCase()==="toolresult"){const c=r,p=(Array.isArray(c.content)?c.content:[]).filter(
|
|
2782
|
+
`}function Eb(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=ic(i.message),o=sc(s.role),a=s.timestamp||Date.now();!n||n.role!==o?(n&&t.push(n),n={kind:"group",key:`group:${o}:${i.key}`,role:o,messages:[{message:i.message,key:i.key}],timestamp:a,isStreaming:!1}):n.messages.push({message:i.message,key:i.key})}return n&&t.push(n),t}function Tb(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";for(let a=0;a<n.length;a++){const r=n[a],d=ic(r);if(!s&&d.role.toLowerCase()==="toolresult"){const c=r,p=(Array.isArray(c.content)?c.content:[]).filter(h=>{const v=h.type;return v==="image"||v==="file"});p.length>0&&t.push({kind:"message",key:Qs(r,a),message:{role:"assistant",content:p,timestamp:d.timestamp}});continue}t.push({kind:"message",key:Qs(r,a),message:r})}if(s)for(let a=0;a<i.length;a++)t.push({kind:"message",key:Qs(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 r=((o=a.attachments)==null?void 0:o.filter(c=>c.fileName).map(c=>c.fileName))??[],d=r.length>0?a.text?`${r.join(", ")}
|
|
2783
2783
|
|
|
2784
2784
|
${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,message:{role:"user",content:[{type:"text",text:d}],timestamp:a.createdAt}})}return Eb(t)}function Qs(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 o=typeof n.messageId=="string"?n.messageId:"";if(o)return`msg:${o}`;const a=typeof n.timestamp=="number"?n.timestamp:null,r=typeof n.role=="string"?n.role:"unknown";return a!=null?`msg:${r}:${a}:${t}`:`msg:${r}:${t}`}const _b=u`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>`;function Mb(e){if(!e.connected)return u`
|
|
2785
2785
|
<div class="setup-container">
|
|
@@ -2794,20 +2794,20 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2794
2794
|
target="_blank"
|
|
2795
2795
|
rel="noopener"
|
|
2796
2796
|
title="Open public chat in new tab"
|
|
2797
|
-
>Public ${_b}</a>`:
|
|
2797
|
+
>Public ${_b}</a>`:k;return u`
|
|
2798
2798
|
<div class="setup-container setup-container--full chat-page">
|
|
2799
|
-
${
|
|
2799
|
+
${Mt("Chat",e.wsProps)}
|
|
2800
2800
|
${t}
|
|
2801
2801
|
<div class="chat-viewport">
|
|
2802
2802
|
${pu(e)}
|
|
2803
2803
|
</div>
|
|
2804
2804
|
</div>
|
|
2805
|
-
`}function Pb(e){return e?`${Zl(e)} (${Gi(e)})`:"n/a"}function hu(e){const t=e.state??{},n=t.lastStatus??"n/a",i=t.lastRunAtMs?Gi(t.lastRunAtMs):"never";return`${n} · last ${i}`}function fu(e){const t=e.schedule;return t.kind==="at"?`One-time: ${Zl(t.atMs)}`:t.kind==="every"?`Every ${Bo(t.everyMs)}`:Lb(t.expr,t.tz)}function Lb(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[i,s,o,a,r]=n,d=t?` (${t.replace(/^.*\//,"").replace(/_/g," ")})`:"",c=(
|
|
2805
|
+
`}function Pb(e){return e?`${Zl(e)} (${Gi(e)})`:"n/a"}function hu(e){const t=e.state??{},n=t.lastStatus??"n/a",i=t.lastRunAtMs?Gi(t.lastRunAtMs):"never";return`${n} · last ${i}`}function fu(e){const t=e.schedule;return t.kind==="at"?`One-time: ${Zl(t.atMs)}`:t.kind==="every"?`Every ${Bo(t.everyMs)}`:Lb(t.expr,t.tz)}function Lb(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[i,s,o,a,r]=n,d=t?` (${t.replace(/^.*\//,"").replace(/_/g," ")})`:"",c=(f,w)=>new Date(2e3,0,1,f,w).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),l=/^\d{1,2}$/.test(i)?parseInt(i,10):null,p=kl(s);if(l===null||!p)return`${e}${t?` (${t})`:""}`;const h=p.map(f=>c(f,l)),v=h.length<=3?h.join(" & "):`${h.slice(0,-1).join(", ")} & ${h[h.length-1]}`,S=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(o==="*"&&a==="*"){if(r==="*")return`Daily at ${v}${d}`;if(r==="1-5")return`Weekdays at ${v}${d}`;if(r==="0,6"||r==="6,0")return`Weekends at ${v}${d}`;const f=kl(r);if(f)return`${f.map(b=>S[b%7]??String(b)).join(", ")} at ${v}${d}`}return`${e}${t?` (${t})`:""}`}function kl(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 Ib(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 $l(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=[];if(i){const a=i.split(",").map(r=>r.trim()).filter(Boolean).map(r=>r.toLowerCase()==="admins"?"All admins":r);s.push(a.join(", "))}return n&&n!=="last"&&s.push(`via ${n}`),s.join(" ")||null}let ve=null;function Rb(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(o=>i.has(o)?!1:(i.add(o),!0))}function Db(e,t){var i,s;if(t==="last")return"last";const n=(i=e.channelMeta)==null?void 0:i.find(o=>o.id===t);return n!=null&&n.label?n.label:((s=e.channelLabels)==null?void 0:s[t])??t}function Bb(e){return e.split(",").map(n=>n.trim()).filter(Boolean).map(n=>n.toLowerCase()==="admins"?"All admins":n).join(", ")}function Nb(e){return e||"Default"}const Fb=u`<svg viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg>`,Ob=u`<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>`,Ub=u`<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>`,ns=u`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,Kb=u`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,gu=u`<svg viewBox="0 0 24 24"><path d="M12 5v14"/><path d="M5 12h14"/></svg>`,Wb=u`<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>`;function Sl(e){const t=e.detailJobId?e.jobs.find(i=>i.id===e.detailJobId)??null:null,n=e.newEventModalOpen||!!e.editJobId;return u`
|
|
2806
2806
|
${zb(e)}
|
|
2807
2807
|
${qb(e)}
|
|
2808
|
-
${n?jb(e):
|
|
2809
|
-
${t?Qb(t,e):
|
|
2810
|
-
${e.runModalJobId?Yb(e):
|
|
2808
|
+
${n?jb(e):k}
|
|
2809
|
+
${t?Qb(t,e):k}
|
|
2810
|
+
${e.runModalJobId?Yb(e):k}
|
|
2811
2811
|
`}function zb(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 u`
|
|
2812
2812
|
<div class="event-status-bar">
|
|
2813
2813
|
<div class="event-status-bar__info">
|
|
@@ -2818,7 +2818,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2818
2818
|
${s?u`
|
|
2819
2819
|
<span class="event-status-bar__sep">\u00b7</span>
|
|
2820
2820
|
<span>Next: ${Gi(s)}</span>
|
|
2821
|
-
`:
|
|
2821
|
+
`:k}
|
|
2822
2822
|
<button
|
|
2823
2823
|
class="btn btn--sm"
|
|
2824
2824
|
?disabled=${e.loading}
|
|
@@ -2827,7 +2827,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2827
2827
|
>
|
|
2828
2828
|
${e.loading?"Refreshing…":"Refresh"}
|
|
2829
2829
|
</button>
|
|
2830
|
-
${e.error?u`<span class="muted">${e.error}</span>`:
|
|
2830
|
+
${e.error?u`<span class="muted">${e.error}</span>`:k}
|
|
2831
2831
|
</div>
|
|
2832
2832
|
<button class="btn primary btn--sm" @click=${e.onNewEventModalOpen}>
|
|
2833
2833
|
${gu} New Event
|
|
@@ -2849,8 +2849,8 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2849
2849
|
</span>
|
|
2850
2850
|
</div>
|
|
2851
2851
|
<div class="event-card__schedule">${fu(e)}</div>
|
|
2852
|
-
${e.agentId?u`<div class="event-card__agent">${Nb(e.agentId)}</div>`:
|
|
2853
|
-
${$l(e)?u`<div class="event-card__agent muted" style="font-size: 11px;">\u2192 ${$l(e)}</div>`:
|
|
2852
|
+
${e.agentId?u`<div class="event-card__agent">${Nb(e.agentId)}</div>`:k}
|
|
2853
|
+
${$l(e)?u`<div class="event-card__agent muted" style="font-size: 11px;">\u2192 ${$l(e)}</div>`:k}
|
|
2854
2854
|
<div class="event-card__footer">
|
|
2855
2855
|
<div class="event-card__status">
|
|
2856
2856
|
<span class="muted" style="font-size: 11px;">${hu(e)}</span>
|
|
@@ -2875,12 +2875,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2875
2875
|
${t.pendingDeleteId===e.id?u`<button
|
|
2876
2876
|
class="btn danger btn--sm"
|
|
2877
2877
|
?disabled=${t.busy}
|
|
2878
|
-
@click=${()=>{
|
|
2878
|
+
@click=${()=>{ve&&clearTimeout(ve),ve=null,t.onRemove(e)}}
|
|
2879
2879
|
>Confirm delete?</button>`:u`<button
|
|
2880
2880
|
class="btn-icon danger"
|
|
2881
2881
|
title="Delete"
|
|
2882
2882
|
?disabled=${t.busy}
|
|
2883
|
-
@click=${()=>{t.onArmDelete(e.id),
|
|
2883
|
+
@click=${()=>{t.onArmDelete(e.id),ve&&clearTimeout(ve),ve=setTimeout(()=>{t.onArmDelete(""),ve=null},3e3)}}
|
|
2884
2884
|
>${Ub}</button>`}
|
|
2885
2885
|
</div>
|
|
2886
2886
|
</div>
|
|
@@ -3035,9 +3035,9 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3035
3035
|
@input=${s=>e.onFormChange({postToMainPrefix:s.target.value})}
|
|
3036
3036
|
/>
|
|
3037
3037
|
</label>
|
|
3038
|
-
`:
|
|
3038
|
+
`:k}
|
|
3039
3039
|
</div>
|
|
3040
|
-
`:
|
|
3040
|
+
`:k}
|
|
3041
3041
|
|
|
3042
3042
|
<div class="row" style="margin-top: 16px; justify-content: flex-end;">
|
|
3043
3043
|
<button class="btn" @click=${i}>Cancel</button>
|
|
@@ -3060,7 +3060,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3060
3060
|
${gu} Add
|
|
3061
3061
|
</button>
|
|
3062
3062
|
</div>
|
|
3063
|
-
${t.length===0&&!e.form.toAdmins?u`<div class="muted" style="font-size: 12px; padding: 4px 0;">No recipients. Add a phone number or enable "All admins".</div>`:
|
|
3063
|
+
${t.length===0&&!e.form.toAdmins?u`<div class="muted" style="font-size: 12px; padding: 4px 0;">No recipients. Add a phone number or enable "All admins".</div>`:k}
|
|
3064
3064
|
${t.map((n,i)=>u`
|
|
3065
3065
|
<div style="display: flex; align-items: center; gap: 6px; margin-bottom: 6px;">
|
|
3066
3066
|
<input
|
|
@@ -3138,7 +3138,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3138
3138
|
</button>
|
|
3139
3139
|
</div>
|
|
3140
3140
|
|
|
3141
|
-
${e.description?u`<div style="color: var(--muted); font-size: 13px; margin-bottom: 16px;">${e.description}</div>`:
|
|
3141
|
+
${e.description?u`<div style="color: var(--muted); font-size: 13px; margin-bottom: 16px;">${e.description}</div>`:k}
|
|
3142
3142
|
|
|
3143
3143
|
<div class="row" style="margin-bottom: 16px; gap: 8px; justify-content: flex-start;">
|
|
3144
3144
|
<button
|
|
@@ -3165,7 +3165,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3165
3165
|
<button
|
|
3166
3166
|
class="btn danger"
|
|
3167
3167
|
?disabled=${t.busy}
|
|
3168
|
-
@click=${()=>{t.pendingDeleteId===e.id?(
|
|
3168
|
+
@click=${()=>{t.pendingDeleteId===e.id?(ve&&clearTimeout(ve),ve=null,t.onRemove(e),t.onDetailClose()):(t.onArmDelete(e.id),ve&&clearTimeout(ve),ve=setTimeout(()=>{t.onArmDelete(""),ve=null},3e3))}}
|
|
3169
3169
|
>
|
|
3170
3170
|
${t.pendingDeleteId===e.id?"Confirm delete?":"Delete"}
|
|
3171
3171
|
</button>
|
|
@@ -3189,7 +3189,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3189
3189
|
<span class="event-detail-label">Agent</span>
|
|
3190
3190
|
<span class="event-detail-value mono">${e.agentId}</span>
|
|
3191
3191
|
</div>
|
|
3192
|
-
`:
|
|
3192
|
+
`:k}
|
|
3193
3193
|
<div class="event-detail-row">
|
|
3194
3194
|
<span class="event-detail-label">Session</span>
|
|
3195
3195
|
<span class="event-detail-value">
|
|
@@ -3211,19 +3211,19 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3211
3211
|
<span class="event-detail-label">Send to</span>
|
|
3212
3212
|
<span class="event-detail-value mono">${Bb(e.payload.to)}</span>
|
|
3213
3213
|
</div>
|
|
3214
|
-
`:
|
|
3214
|
+
`:k}
|
|
3215
3215
|
${e.payload.kind==="agentTurn"&&(e.payload.channel??e.payload.provider)?u`
|
|
3216
3216
|
<div class="event-detail-row">
|
|
3217
3217
|
<span class="event-detail-label">Channel</span>
|
|
3218
3218
|
<span class="event-detail-value">${e.payload.channel??e.payload.provider}</span>
|
|
3219
3219
|
</div>
|
|
3220
|
-
`:
|
|
3220
|
+
`:k}
|
|
3221
3221
|
${e.payload.kind==="agentTurn"?u`
|
|
3222
3222
|
<div class="event-detail-row">
|
|
3223
3223
|
<span class="event-detail-label">Auto-deliver</span>
|
|
3224
3224
|
<span class="event-detail-value">${e.payload.deliver?"Yes":"No"}</span>
|
|
3225
3225
|
</div>
|
|
3226
|
-
`:
|
|
3226
|
+
`:k}
|
|
3227
3227
|
</div>
|
|
3228
3228
|
|
|
3229
3229
|
<div class="event-detail-section">
|
|
@@ -3236,7 +3236,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3236
3236
|
<span class="event-detail-label">Next run</span>
|
|
3237
3237
|
<span class="event-detail-value">${Pb(e.state.nextRunAtMs)}</span>
|
|
3238
3238
|
</div>
|
|
3239
|
-
`:
|
|
3239
|
+
`:k}
|
|
3240
3240
|
</div>
|
|
3241
3241
|
|
|
3242
3242
|
<div class="event-detail-section">
|
|
@@ -3278,20 +3278,20 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3278
3278
|
>
|
|
3279
3279
|
${i}
|
|
3280
3280
|
</span>
|
|
3281
|
-
${t.durationMs!=null?u`<span class="muted" style="font-size: 13px;">${Bo(t.durationMs)}</span>`:
|
|
3281
|
+
${t.durationMs!=null?u`<span class="muted" style="font-size: 13px;">${Bo(t.durationMs)}</span>`:k}
|
|
3282
3282
|
</div>
|
|
3283
3283
|
${t.summary?u`
|
|
3284
3284
|
<div style="white-space: pre-wrap; font-size: 13px; line-height: 1.6; max-height: 400px; overflow-y: auto; color: var(--fg);">
|
|
3285
3285
|
${t.summary}
|
|
3286
3286
|
</div>
|
|
3287
|
-
`:
|
|
3287
|
+
`:k}
|
|
3288
3288
|
${t.error?u`
|
|
3289
3289
|
<details style="margin-top: 12px;" open>
|
|
3290
3290
|
<summary class="muted" style="cursor: pointer; font-size: 13px;">Error details</summary>
|
|
3291
3291
|
<div class="muted" style="margin-top: 6px; white-space: pre-wrap; font-size: 12px;">${t.error}</div>
|
|
3292
3292
|
</details>
|
|
3293
|
-
`:
|
|
3294
|
-
${!t.summary&&!t.error?u`<div class="muted" style="font-size: 13px;">Job completed with no output.</div>`:
|
|
3293
|
+
`:k}
|
|
3294
|
+
${!t.summary&&!t.error?u`<div class="muted" style="font-size: 13px;">Job completed with no output.</div>`:k}
|
|
3295
3295
|
</div>
|
|
3296
3296
|
<div style="display: flex; justify-content: flex-end; margin-top: 16px;">
|
|
3297
3297
|
<button class="btn primary" @click=${e.onRunModalClose}>Close</button>
|
|
@@ -3308,13 +3308,13 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3308
3308
|
<span class="muted" style="font-size: 12px;">${Gi(e.ts)}</span>
|
|
3309
3309
|
<span class="muted" style="font-size: 12px;">${Bo(e.durationMs)}</span>
|
|
3310
3310
|
</div>
|
|
3311
|
-
${e.summary?u`<div class="muted" style="font-size: 12px;">${e.summary}</div>`:
|
|
3311
|
+
${e.summary?u`<div class="muted" style="font-size: 12px;">${e.summary}</div>`:k}
|
|
3312
3312
|
${e.error?u`
|
|
3313
3313
|
<details style="margin-top: 2px;">
|
|
3314
3314
|
<summary class="muted" style="cursor: pointer; font-size: 12px;">Error details</summary>
|
|
3315
3315
|
<div class="muted" style="margin-top: 4px; white-space: pre-wrap; font-size: 12px;">${e.error}</div>
|
|
3316
3316
|
</details>
|
|
3317
|
-
`:
|
|
3317
|
+
`:k}
|
|
3318
3318
|
</div>
|
|
3319
3319
|
`}function Zb(e){var a;const t=((a=e.report)==null?void 0:a.skills)??[],n=e.filter.trim().toLowerCase(),i=e.typeFilter,s=t.filter(r=>i==="preloaded"&&!r.preloaded||i==="user"&&r.preloaded?!1:n?[r.name,r.description].join(" ").toLowerCase().includes(n):!0),o=(r,d)=>u`
|
|
3320
3320
|
<button
|
|
@@ -3354,7 +3354,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3354
3354
|
<div class="muted">${s.length} shown</div>
|
|
3355
3355
|
</div>
|
|
3356
3356
|
|
|
3357
|
-
${e.error?u`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:
|
|
3357
|
+
${e.error?u`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:k}
|
|
3358
3358
|
|
|
3359
3359
|
${s.length===0?u`<div class="muted" style="margin-top: 16px;">No skills found.</div>`:u`
|
|
3360
3360
|
<div class="list" style="margin-top: 16px;">
|
|
@@ -3363,8 +3363,8 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3363
3363
|
`}
|
|
3364
3364
|
</section>
|
|
3365
3365
|
|
|
3366
|
-
${e.detail?tw(e):
|
|
3367
|
-
${e.addModal?nw(e):
|
|
3366
|
+
${e.detail?tw(e):k}
|
|
3367
|
+
${e.addModal?nw(e):k}
|
|
3368
3368
|
`}function ew(e,t){const n=t.busyKey===e.skillKey,i=t.edits[e.skillKey]??"",s=t.messages[e.skillKey]??null,o=e.install.length>0&&e.missing.bins.length>0,a=[...e.missing.bins.map(d=>`bin:${d}`),...e.missing.env.map(d=>`env:${d}`),...e.missing.config.map(d=>`config:${d}`),...e.missing.os.map(d=>`os:${d}`)],r=[];return e.disabled&&r.push("disabled"),e.blockedByAllowlist&&r.push("blocked by allowlist"),u`
|
|
3369
3369
|
<div class="list-item" style="cursor: pointer;" @click=${()=>t.onViewDetail(e.name)}>
|
|
3370
3370
|
<div class="list-main">
|
|
@@ -3376,36 +3376,36 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3376
3376
|
<span class="chip ${e.preloaded?"chip-ok":""}">
|
|
3377
3377
|
${e.preloaded?"Preloaded":"User"}
|
|
3378
3378
|
</span>
|
|
3379
|
-
${e.disabled?u`<span class="chip chip-warn">Disabled</span>`:
|
|
3379
|
+
${e.disabled?u`<span class="chip chip-warn">Disabled</span>`:k}
|
|
3380
3380
|
</div>
|
|
3381
3381
|
${a.length>0?u`
|
|
3382
3382
|
<div class="muted" style="margin-top: 6px;">
|
|
3383
3383
|
Missing: ${a.join(", ")}
|
|
3384
3384
|
</div>
|
|
3385
|
-
`:
|
|
3385
|
+
`:k}
|
|
3386
3386
|
${r.length>0?u`
|
|
3387
3387
|
<div class="muted" style="margin-top: 6px;">
|
|
3388
3388
|
Reason: ${r.join(", ")}
|
|
3389
3389
|
</div>
|
|
3390
|
-
`:
|
|
3390
|
+
`:k}
|
|
3391
3391
|
</div>
|
|
3392
3392
|
<div class="list-meta" @click=${d=>d.stopPropagation()}>
|
|
3393
3393
|
<div class="row" style="justify-content: flex-end; flex-wrap: wrap; gap: 6px;">
|
|
3394
|
-
${e.preloaded?
|
|
3394
|
+
${e.preloaded?k:u`<button
|
|
3395
3395
|
class="btn"
|
|
3396
3396
|
?disabled=${n}
|
|
3397
3397
|
@click=${()=>t.onToggle(e.skillKey,e.disabled)}
|
|
3398
3398
|
>
|
|
3399
3399
|
${e.disabled?"Enable":"Disable"}
|
|
3400
3400
|
</button>`}
|
|
3401
|
-
${e.preloaded?
|
|
3401
|
+
${e.preloaded?k:u`<button
|
|
3402
3402
|
class="btn"
|
|
3403
3403
|
?disabled=${n}
|
|
3404
3404
|
@click=${()=>t.onEditSkill(e.name)}
|
|
3405
3405
|
>
|
|
3406
3406
|
Edit
|
|
3407
3407
|
</button>`}
|
|
3408
|
-
${e.preloaded?
|
|
3408
|
+
${e.preloaded?k:u`<button
|
|
3409
3409
|
class="btn danger"
|
|
3410
3410
|
?disabled=${n}
|
|
3411
3411
|
@click=${()=>{confirm(`Delete skill "${e.name}"?`)&&t.onDelete(e.name)}}
|
|
@@ -3418,14 +3418,14 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3418
3418
|
@click=${()=>t.onInstall(e.skillKey,e.name,e.install[0].id)}
|
|
3419
3419
|
>
|
|
3420
3420
|
${n?"Installing…":e.install[0].label}
|
|
3421
|
-
</button>`:
|
|
3421
|
+
</button>`:k}
|
|
3422
3422
|
</div>
|
|
3423
3423
|
${s?u`<div
|
|
3424
3424
|
class="muted"
|
|
3425
3425
|
style="margin-top: 8px; color: ${s.kind==="error"?"var(--danger-color, #d14343)":"var(--success-color, #0a7f5a)"};"
|
|
3426
3426
|
>
|
|
3427
3427
|
${s.message}
|
|
3428
|
-
</div>`:
|
|
3428
|
+
</div>`:k}
|
|
3429
3429
|
${e.primaryEnv?u`
|
|
3430
3430
|
<div class="field" style="margin-top: 10px;">
|
|
3431
3431
|
<span>API key</span>
|
|
@@ -3443,7 +3443,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3443
3443
|
>
|
|
3444
3444
|
Save key
|
|
3445
3445
|
</button>
|
|
3446
|
-
`:
|
|
3446
|
+
`:k}
|
|
3447
3447
|
</div>
|
|
3448
3448
|
</div>
|
|
3449
3449
|
`}function tw(e){var d,c,l;const t=e.detail,n=["SKILL.md",...t.references.map(p=>p.name)],i=e.detailTab||"SKILL.md",s=i==="SKILL.md"?t.content:((d=t.references.find(p=>p.name===i))==null?void 0:d.content)??"",o=p=>{p.target.classList.contains("event-modal-overlay")&&e.onDetailClose()},a=(l=(c=e.report)==null?void 0:c.skills)==null?void 0:l.find(p=>p.name===t.name),r=a?!a.preloaded:!1;return u`
|
|
@@ -3452,7 +3452,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3452
3452
|
<div class="event-modal__header">
|
|
3453
3453
|
<div class="event-modal__title">${t.name}</div>
|
|
3454
3454
|
<div class="row" style="gap: 8px;">
|
|
3455
|
-
${r?u`<button class="btn" @click=${()=>e.onEditDetail(i)}>Edit</button>`:
|
|
3455
|
+
${r?u`<button class="btn" @click=${()=>e.onEditDetail(i)}>Edit</button>`:k}
|
|
3456
3456
|
<button class="event-modal__close" @click=${e.onDetailClose}>×</button>
|
|
3457
3457
|
</div>
|
|
3458
3458
|
</div>
|
|
@@ -3468,7 +3468,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3468
3468
|
</button>
|
|
3469
3469
|
`)}
|
|
3470
3470
|
</div>
|
|
3471
|
-
`:
|
|
3471
|
+
`:k}
|
|
3472
3472
|
<pre style="white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.5; max-height: 60vh; overflow-y: auto; background: var(--bg, #111); padding: 16px; border-radius: 8px; border: 1px solid var(--border);">${s}</pre>
|
|
3473
3473
|
</div>
|
|
3474
3474
|
</div>
|
|
@@ -3507,7 +3507,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3507
3507
|
${d("SKILL.md")}
|
|
3508
3508
|
${n.references.map(c=>d(c.name))}
|
|
3509
3509
|
</div>
|
|
3510
|
-
`:
|
|
3510
|
+
`:k}
|
|
3511
3511
|
${r?u`
|
|
3512
3512
|
<label class="field" style="margin-bottom: 12px;">
|
|
3513
3513
|
<span>${r.name}</span>
|
|
@@ -3582,7 +3582,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3582
3582
|
`}const ow=["user","assistant","tool_call","tool_result","thinking","error"],xl={user:"User",assistant:"Assistant",tool:"Tool",tool_call:"Call",tool_result:"Result",thinking:"Thinking",error:"Error",system:"System"};function mu(e){return e==="tool"?"tool_call":e}function aw(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 rw(e){return e.split(":").slice(2).join(":")||e}function lw(e,t){return t?[e.content,e.agentId,e.sessionKey,e.sessionId,e.toolName,e.toolCallId].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function cw(e,t){return`${e.sessionId}:${e.timestamp}:${t}`}const Al=300;function dw(e,t){const n=mu(e);return t[n]??!0}function uw(e){const t=e.filterText.trim().toLowerCase(),n=e.entries.filter(i=>!dw(i.type,e.typeFilters)||e.agents.length>0&&!(e.agentFilters[i.agentId]??!0)?!1:lw(i,t));return u`
|
|
3583
3583
|
<div>
|
|
3584
3584
|
<button class="chips-toggle" style="margin-top: 10px;" @click=${e.onToggleChips}>
|
|
3585
|
-
<span class="chips-toggle-icon ${e.chipsExpanded?"expanded":""}">${
|
|
3585
|
+
<span class="chips-toggle-icon ${e.chipsExpanded?"expanded":""}">${L.chevronDown}</span>
|
|
3586
3586
|
Filters
|
|
3587
3587
|
</button>
|
|
3588
3588
|
${e.chipsExpanded?u`
|
|
@@ -3616,9 +3616,9 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3616
3616
|
<span>Auto-follow</span>
|
|
3617
3617
|
</label>
|
|
3618
3618
|
</div>
|
|
3619
|
-
`:
|
|
3619
|
+
`:k}
|
|
3620
3620
|
|
|
3621
|
-
${e.error?u`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:
|
|
3621
|
+
${e.error?u`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:k}
|
|
3622
3622
|
|
|
3623
3623
|
<div class="log-stream" style="margin-top: 10px;" @scroll=${e.onScroll}>
|
|
3624
3624
|
${n.length===0?u`<div class="muted" style="padding: 12px;">No session log entries.</div>`:n.map((i,s)=>{const o=mu(i.type),a=cw(i,s),r=e.expandedIds.has(a),d=i.content.length>Al,c=r||!d?i.content:i.content.slice(0,Al)+"…";return u`
|
|
@@ -3628,15 +3628,15 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3628
3628
|
<span class="session-log-type ${o}">${xl[o]}</span>
|
|
3629
3629
|
<span class="log-subsystem mono">${i.agentId}</span>
|
|
3630
3630
|
<span class="session-label mono">${rw(i.sessionKey)}</span>
|
|
3631
|
-
${i.toolName?u`<span class="session-tool mono">${i.toolName}</span>`:
|
|
3632
|
-
${i.toolCallId?u`<span class="session-call-id mono">${i.toolCallId.slice(0,12)}</span>`:
|
|
3633
|
-
${i.model?u`<span class="session-model mono">${i.model}</span>`:
|
|
3631
|
+
${i.toolName?u`<span class="session-tool mono">${i.toolName}</span>`:k}
|
|
3632
|
+
${i.toolCallId?u`<span class="session-call-id mono">${i.toolCallId.slice(0,12)}</span>`:k}
|
|
3633
|
+
${i.model?u`<span class="session-model mono">${i.model}</span>`:k}
|
|
3634
3634
|
</div>
|
|
3635
3635
|
<div class="log-message mono">${c}</div>
|
|
3636
3636
|
${d?u`<button
|
|
3637
3637
|
class="log-expand-btn"
|
|
3638
3638
|
@click=${()=>e.onToggleExpand(a)}
|
|
3639
|
-
>${r?"Collapse":"Expand"}</button>`:
|
|
3639
|
+
>${r?"Collapse":"Expand"}</button>`:k}
|
|
3640
3640
|
</div>
|
|
3641
3641
|
`})}
|
|
3642
3642
|
</div>
|
|
@@ -3702,7 +3702,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3702
3702
|
</section>
|
|
3703
3703
|
`}function fw(e){const t=e.filterText.trim().toLowerCase();Co.some(i=>!e.levelFilters[i]);const n=e.entries.filter(i=>i.level&&!e.levelFilters[i.level]?!1:yu(i,t));return u`
|
|
3704
3704
|
<button class="chips-toggle" @click=${e.onToggleChips}>
|
|
3705
|
-
<span class="chips-toggle-icon ${e.chipsExpanded?"expanded":""}">${
|
|
3705
|
+
<span class="chips-toggle-icon ${e.chipsExpanded?"expanded":""}">${L.chevronDown}</span>
|
|
3706
3706
|
Filters
|
|
3707
3707
|
</button>
|
|
3708
3708
|
${e.chipsExpanded?u`
|
|
@@ -3726,13 +3726,13 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3726
3726
|
<span>Auto-follow</span>
|
|
3727
3727
|
</label>
|
|
3728
3728
|
</div>
|
|
3729
|
-
`:
|
|
3729
|
+
`:k}
|
|
3730
3730
|
|
|
3731
|
-
${e.file?u`<div class="muted" style="margin-top: 10px;">File: ${e.file}</div>`:
|
|
3731
|
+
${e.file?u`<div class="muted" style="margin-top: 10px;">File: ${e.file}</div>`:k}
|
|
3732
3732
|
${e.truncated?u`<div class="callout" style="margin-top: 10px;">
|
|
3733
3733
|
Log output truncated; showing latest chunk.
|
|
3734
|
-
</div>`:
|
|
3735
|
-
${e.error?u`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:
|
|
3734
|
+
</div>`:k}
|
|
3735
|
+
${e.error?u`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:k}
|
|
3736
3736
|
|
|
3737
3737
|
<div class="log-stream" style="margin-top: 10px;" @scroll=${e.onScroll}>
|
|
3738
3738
|
${n.length===0?u`<div class="muted" style="padding: 12px;">No log entries.</div>`:[...n].reverse().map(i=>u`
|
|
@@ -3748,7 +3748,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3748
3748
|
</div>
|
|
3749
3749
|
`}const gw=[{id:"cron",label:"Events"},{id:"skills",label:"Skills"},{id:"logs",label:"Logs"}];function mw(e){switch(e.activeTab){case"cron":return Sl(e.cronProps);case"skills":return Zb(e.skillsProps);case"logs":return hw(e.logsProps);default:return Sl(e.cronProps)}}function yw(e){return e.connected?u`
|
|
3750
3750
|
<div class="setup-container">
|
|
3751
|
-
${
|
|
3751
|
+
${Mt("Advanced",e.wsProps)}
|
|
3752
3752
|
<div class="setup-card sp-card-advanced" style="text-align: left;">
|
|
3753
3753
|
<div class="sp-tabs">
|
|
3754
3754
|
${gw.map(t=>u`
|
|
@@ -3770,25 +3770,25 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3770
3770
|
<p>Connecting to gateway...</p>
|
|
3771
3771
|
</div>
|
|
3772
3772
|
</div>
|
|
3773
|
-
`}function Cl(e){if(!e.show)return
|
|
3773
|
+
`}function Cl(e){if(!e.show)return k;const t=Ve(),n=e.isFirstTime,i=e.changePinMode===!0&&!n,s=e.changePinBusy===!0;let o=e.accounts.length>0?e.accounts[0].id:"";const a=v=>{var f;o=v.target.value;const S=(f=v.target.closest(".login-card"))==null?void 0:f.querySelector(".login-change-pin");S&&(S.style.display=o==="__master__"?"":"none")},r=v=>S=>{const f=S.target;f.value=f.value.replace(/\D/g,"").slice(0,6),v(f.value)},d=v=>{const S=v.currentTarget,f=S.closest(".login-pin-wrapper"),w=f==null?void 0:f.querySelector("input");if(!w)return;const b=w.type==="text";w.type=b?"password":"text",S.classList.toggle("active",!b)},c=!n&&e.accounts.length>1?u`
|
|
3774
3774
|
<select
|
|
3775
3775
|
class="login-account-select"
|
|
3776
3776
|
@change=${a}
|
|
3777
3777
|
?disabled=${e.busy||s}
|
|
3778
3778
|
>
|
|
3779
|
-
${e.accounts.map((v,
|
|
3780
|
-
<option value=${v.id} ?selected=${
|
|
3779
|
+
${e.accounts.map((v,S)=>u`
|
|
3780
|
+
<option value=${v.id} ?selected=${S===0}>
|
|
3781
3781
|
${v.displayName}
|
|
3782
3782
|
</option>
|
|
3783
3783
|
`)}
|
|
3784
3784
|
</select>
|
|
3785
|
-
`:
|
|
3785
|
+
`:k;if(i){let v="",S="",f="";const w=b=>{var x;b.preventDefault(),!s&&(!v||!S||!f||S===f&&o&&((x=e.onChangePin)==null||x.call(e,o,v,S)))};return u`
|
|
3786
3786
|
<div class="login-overlay">
|
|
3787
3787
|
<div class="login-card">
|
|
3788
3788
|
<img class="login-logo" src="${t.iconUrl}" alt="${t.name}" />
|
|
3789
3789
|
<h2 class="login-title">Change PIN</h2>
|
|
3790
3790
|
<p class="login-subtitle">Enter your current PIN, then choose a new one</p>
|
|
3791
|
-
<form class="login-form" @submit=${
|
|
3791
|
+
<form class="login-form" @submit=${w}>
|
|
3792
3792
|
${c}
|
|
3793
3793
|
<div class="login-pin-wrapper">
|
|
3794
3794
|
<input
|
|
@@ -3800,12 +3800,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3800
3800
|
maxlength="6"
|
|
3801
3801
|
placeholder="Current PIN"
|
|
3802
3802
|
?disabled=${s}
|
|
3803
|
-
@input=${r(
|
|
3803
|
+
@input=${r(b=>{v=b})}
|
|
3804
3804
|
autofocus
|
|
3805
3805
|
/>
|
|
3806
3806
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
3807
|
-
<span class="pin-eye-show">${
|
|
3808
|
-
<span class="pin-eye-hide">${
|
|
3807
|
+
<span class="pin-eye-show">${L.eye}</span>
|
|
3808
|
+
<span class="pin-eye-hide">${L.eyeOff}</span>
|
|
3809
3809
|
</button>
|
|
3810
3810
|
</div>
|
|
3811
3811
|
<div class="login-pin-wrapper">
|
|
@@ -3818,11 +3818,11 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3818
3818
|
maxlength="6"
|
|
3819
3819
|
placeholder="New PIN (4-6 digits)"
|
|
3820
3820
|
?disabled=${s}
|
|
3821
|
-
@input=${r(
|
|
3821
|
+
@input=${r(b=>{S=b})}
|
|
3822
3822
|
/>
|
|
3823
3823
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
3824
|
-
<span class="pin-eye-show">${
|
|
3825
|
-
<span class="pin-eye-hide">${
|
|
3824
|
+
<span class="pin-eye-show">${L.eye}</span>
|
|
3825
|
+
<span class="pin-eye-hide">${L.eyeOff}</span>
|
|
3826
3826
|
</button>
|
|
3827
3827
|
</div>
|
|
3828
3828
|
<div class="login-pin-wrapper">
|
|
@@ -3835,15 +3835,15 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3835
3835
|
maxlength="6"
|
|
3836
3836
|
placeholder="Confirm new PIN"
|
|
3837
3837
|
?disabled=${s}
|
|
3838
|
-
@input=${r(
|
|
3838
|
+
@input=${r(b=>{f=b})}
|
|
3839
3839
|
/>
|
|
3840
3840
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
3841
|
-
<span class="pin-eye-show">${
|
|
3842
|
-
<span class="pin-eye-hide">${
|
|
3841
|
+
<span class="pin-eye-show">${L.eye}</span>
|
|
3842
|
+
<span class="pin-eye-hide">${L.eyeOff}</span>
|
|
3843
3843
|
</button>
|
|
3844
3844
|
</div>
|
|
3845
|
-
${e.changePinError?u`<p class="login-error">${e.changePinError}</p>`:
|
|
3846
|
-
${e.changePinSuccess?u`<p class="login-success">${e.changePinSuccess}</p>`:
|
|
3845
|
+
${e.changePinError?u`<p class="login-error">${e.changePinError}</p>`:k}
|
|
3846
|
+
${e.changePinSuccess?u`<p class="login-success">${e.changePinSuccess}</p>`:k}
|
|
3847
3847
|
<button
|
|
3848
3848
|
class="login-submit"
|
|
3849
3849
|
type="submit"
|
|
@@ -3854,12 +3854,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3854
3854
|
<a
|
|
3855
3855
|
class="login-link"
|
|
3856
3856
|
href="#"
|
|
3857
|
-
@click=${
|
|
3857
|
+
@click=${b=>{var x;b.preventDefault(),(x=e.onToggleChangePinMode)==null||x.call(e)}}
|
|
3858
3858
|
>Back to login</a>
|
|
3859
3859
|
</p>
|
|
3860
3860
|
</div>
|
|
3861
3861
|
</div>
|
|
3862
|
-
`}let l="",p="";const
|
|
3862
|
+
`}let l="",p="";const h=v=>{if(v.preventDefault(),!e.busy)if(n){if(!l||!p||l!==p)return;e.onSubmit(l)}else{if(!l||!o)return;e.onSubmit(o,l)}};return u`
|
|
3863
3863
|
<div class="login-overlay">
|
|
3864
3864
|
<div class="login-card">
|
|
3865
3865
|
<img class="login-logo" src="${t.iconUrl}" alt="${t.name}" />
|
|
@@ -3867,7 +3867,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3867
3867
|
<p class="login-subtitle">
|
|
3868
3868
|
${n?"Set a PIN to protect this device":"Enter your PIN to continue"}
|
|
3869
3869
|
</p>
|
|
3870
|
-
<form class="login-form" @submit=${
|
|
3870
|
+
<form class="login-form" @submit=${h}>
|
|
3871
3871
|
${c}
|
|
3872
3872
|
<div class="login-pin-wrapper">
|
|
3873
3873
|
<input
|
|
@@ -3883,8 +3883,8 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3883
3883
|
autofocus
|
|
3884
3884
|
/>
|
|
3885
3885
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
3886
|
-
<span class="pin-eye-show">${
|
|
3887
|
-
<span class="pin-eye-hide">${
|
|
3886
|
+
<span class="pin-eye-show">${L.eye}</span>
|
|
3887
|
+
<span class="pin-eye-hide">${L.eyeOff}</span>
|
|
3888
3888
|
</button>
|
|
3889
3889
|
</div>
|
|
3890
3890
|
${n?u`
|
|
@@ -3901,12 +3901,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3901
3901
|
@input=${r(v=>{p=v})}
|
|
3902
3902
|
/>
|
|
3903
3903
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
3904
|
-
<span class="pin-eye-show">${
|
|
3905
|
-
<span class="pin-eye-hide">${
|
|
3904
|
+
<span class="pin-eye-show">${L.eye}</span>
|
|
3905
|
+
<span class="pin-eye-hide">${L.eyeOff}</span>
|
|
3906
3906
|
</button>
|
|
3907
3907
|
</div>
|
|
3908
|
-
`:
|
|
3909
|
-
${e.error?u`<p class="login-error">${e.error}</p>`:
|
|
3908
|
+
`:k}
|
|
3909
|
+
${e.error?u`<p class="login-error">${e.error}</p>`:k}
|
|
3910
3910
|
<button
|
|
3911
3911
|
class="login-submit"
|
|
3912
3912
|
type="submit"
|
|
@@ -3919,9 +3919,9 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3919
3919
|
<a
|
|
3920
3920
|
class="login-link"
|
|
3921
3921
|
href="#"
|
|
3922
|
-
@click=${v=>{var
|
|
3922
|
+
@click=${v=>{var S;v.preventDefault(),(S=e.onToggleChangePinMode)==null||S.call(e)}}
|
|
3923
3923
|
>Change PIN</a>
|
|
3924
|
-
</p>`:
|
|
3924
|
+
</p>`:k}
|
|
3925
3925
|
</div>
|
|
3926
3926
|
</div>
|
|
3927
3927
|
`}function vw(e){if(!e.connected)return u`
|
|
@@ -3940,7 +3940,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3940
3940
|
${pu(t)}
|
|
3941
3941
|
</div>
|
|
3942
3942
|
</div>
|
|
3943
|
-
`}async function bw(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 Un(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 ww(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 o=await e.client.request("config.get",{});e.configSnapshot=o;const a=o.hash;if(!a){e.workspacesError="Config hash missing; reload and retry.";return}const r={name:n,baseHash:a,whatsappAccountName:n};(i=t.workspacePath)!=null&&i.trim()&&(r.workspaceDir=t.workspacePath.trim());const d=await e.client.request("workspaces.create",r);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await Un(e),(s=t.onCreated)==null||s.call(t,d)}catch(o){e.workspacesError=String(o)}finally{e.workspaceSaving=!1}}async function kw(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 Un(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function $w(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 Un(e)}catch(i){e.workspacesError=String(i)}}}const hi=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:ww,loadWorkspaces:Un,removeWorkspace:kw,renameWorkspace:$w},Symbol.toStringTag,{value:"Module"})),vu={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"},El=vu,Eo={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(vu));new Set(Object.values(Eo));function Sw(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 xw=4008;class Aw{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 p;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 o=null,a=!1,r=this.opts.token;if(s){o=await Xh();const f=(p=tf({deviceId:o.deviceId,role:t}))==null?void 0:p.token;r=f??this.opts.token,a=!!(f&&this.opts.token)}const d=r||this.opts.password?{token:r,password:this.opts.password}:void 0;let c;if(s&&o){const f=Date.now(),v=this.connectNonce??void 0,h=Sw({deviceId:o.deviceId,clientId:this.opts.clientName??El.CONTROL_UI,clientMode:this.opts.mode??Eo.WEBCHAT,role:t,scopes:n,signedAtMs:f,token:r??null,nonce:v}),b=await Zh(o.privateKey,h);c={id:o.deviceId,publicKey:o.publicKey,signature:b,signedAt:f,nonce:v}}const l={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??El.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Eo.WEBCHAT,instanceId:this.opts.instanceId},role:t,scopes:n,device:c,caps:[],auth:d,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",l).then(f=>{var v,h,b;(v=f==null?void 0:f.auth)!=null&&v.deviceToken&&o&&nf({deviceId:o.deviceId,role:f.auth.role??t,token:f.auth.deviceToken,scopes:f.auth.scopes??[]}),this.backoffMs=800,(b=(h=this.opts).onHello)==null||b.call(h,f)}).catch(()=>{var f;a&&o&&sf({deviceId:o.deviceId,role:t}),(f=this.ws)==null||f.close(xw,"connect failed")})}handleMessage(t){var s,o,a,r,d,c;let n;try{n=JSON.parse(t)}catch{return}const i=n;if(i.type==="event"){const l=n;if(l.event==="connect.challenge"){const f=l.payload,v=f&&typeof f.nonce=="string"?f.nonce:null;v&&(this.connectNonce=v,this.sendConnect());return}const p=typeof l.seq=="number"?l.seq:null;p!==null&&(this.lastSeq!==null&&p>this.lastSeq+1&&((o=(s=this.opts).onGap)==null||o.call(s,{expected:this.lastSeq+1,received:p})),this.lastSeq=p);try{(r=(a=this.opts).onEvent)==null||r.call(a,l)}catch(f){console.error("[gateway] event handler error:",f)}return}if(i.type==="res"){const l=n,p=this.pending.get(l.id);if(!p)return;if(this.pending.delete(l.id),l.ok)p.resolve(l.payload);else{const f=new Error(((d=l.error)==null?void 0:d.message)??"request failed");f.payload=l.payload,f.details=(c=l.error)==null?void 0:c.details,p.reject(f)}return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const i=Qi(),s={type:"req",id:i,method:t,params:n},o=new Promise((a,r)=>{this.pending.set(i,{resolve:d=>a(d),reject:r})});return this.ws.send(JSON.stringify(s)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function To(e){return typeof e=="object"&&e!==null}function Cw(e){if(!To(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!To(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,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!s||!o?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:o}}function Ew(e){if(!To(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 bu(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Tw(e,t){const n=bu(e).filter(i=>i.id!==t.id);return n.push(t),n}function Tl(e,t){return bu(e).filter(n=>n.id!==t)}class _w{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,o=this.canvas.height/i.height,a=this.deviceWidth/this.canvas.width,r=this.deviceHeight/this.canvas.height;return{x:Math.round(t*s*a),y:Math.round(n*o*r)}}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 _n(){return Ys||(Ys=new _w),Ys}function xa(e){return e instanceof Error?e.message:String(e)}async function Mw(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=xa(t)}finally{e.browserLoading=!1}}async function Pw(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=xa(t)}finally{e.browserLoading=!1}}}async function Js(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 Xs(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 Lw(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=xa(t)}}function Iw(e){e.browserInputMode=!e.browserInputMode}function Rw(e){e.browserFullscreen=!e.browserFullscreen,_n().detach()}function Dw(e,t){if(!(t!=null&&t.data))return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,_n().updateFrame(t.data,t.metadata)}function Bw(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function Nw(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}async function _o(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 o=io(s);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}async function wi(e){return(await e.request("apikeys.list")).providers??[]}async function _l(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function Fw(e,t){await e.request("apikeys.remove",{provider:t})}async function Ow(e,t,n){await e.request("apikeys.disable",{provider:t,disabled:n})}const zi="taskmaster_update_pending";async function wu(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 Uw(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(zi,String(Date.now())),localStorage.removeItem(Aa)}catch{}try{const o=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(o.ok&&o.result.status==="ok")e.updateMessage="Updated — restarting gateway...",(n=e.requestUpdate)==null||n.call(e);else if(o.ok&&o.result.status==="skipped")Mn(),e.updateMessage=o.result.reason||"Update skipped",e.updateRunning=!1,(i=e.requestUpdate)==null||i.call(e);else throw Mn(),new Error(o.result.reason||"Update failed")}catch(o){Mn(),e.updateMessage=`Update failed: ${String(o)}`,e.updateRunning=!1,e.updateProgressSteps=[],(s=e.requestUpdate)==null||s.call(e)}}}function Kw(e,t){var i,s,o;const n=t.phase;if(n==="step-start"){const a=t.name,r=t.index,d=t.total;e.updateMessage=`Updating: ${a} (${r+1}/${d})`;const c=e.updateProgressSteps.find(l=>l.index===r);c?(c.status="running",c.name=a):e.updateProgressSteps=[...e.updateProgressSteps,{name:a,index:r,total:d,status:"running"}],(i=e.requestUpdate)==null||i.call(e)}else if(n==="step-done"){const a=t.name,r=t.index,d=t.total,c=t.ok,l=t.durationMs,p=e.updateProgressSteps.find(v=>v.index===r);p?(p.status=c?"done":"failed",p.durationMs=l):e.updateProgressSteps=[...e.updateProgressSteps,{name:a,index:r,total:d,status:c?"done":"failed",durationMs:l}];const f=!c&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=c?`Updating: ${a} done (${r+1}/${d})`:`Update step failed: ${a}${f}`,(s=e.requestUpdate)==null||s.call(e)}else if(n==="complete"){if(t.status==="ok")e.updateMessage="Update complete — restarting gateway...";else{const r=t.reason;e.updateMessage=r?`Update failed: ${r}`:"Update failed",e.updateRunning=!1,Mn()}(o=e.requestUpdate)==null||o.call(e)}}async function Ww(e){var n,i,s,o;if(!e.client||!e.connected)return;const t=qw();Mn();try{const a=await e.client.request("update.lastResult",{});if(!a.ok||!a.result)return;const r=5*6e4,d=Date.now()-a.result.ts<r;if(!t&&!d||Hw(a.result.ts))return;e.updateLastResult=a.result;const c=(n=a.result.after)==null?void 0:n.version;if(a.result.status==="ok"&&c&&(e.currentVersion=c),e.updateAvailable=!1,a.result.status==="ok"){const l=(i=a.result.before)==null?void 0:i.version,p=c??a.result.currentVersion;e.updateMessage=l?`Updated: v${l} → v${p}`:`Updated to v${p}`}else{const l=a.result.reason??((s=a.result.failedStep)==null?void 0:s.name)??"unknown error";e.updateMessage=`Update failed: ${l}`}}catch{}finally{e.updateRunning=!1,e.updateProgressSteps=[],(o=e.requestUpdate)==null||o.call(e)}}const Aa="taskmaster_update_dismissed";function zw(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(Aa,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function qw(){try{const e=localStorage.getItem(zi);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(zi),!1):!0:!1}catch{return!1}}function Mn(){try{localStorage.removeItem(zi)}catch{}}function Hw(e){try{const t=localStorage.getItem(Aa);return t?Number(t)>=e:!1}catch{return!1}}function Zs(e,t){var r,d,c;const n=(e??"").trim(),i=(r=t.mainSessionKey)==null?void 0:r.trim();if(!i)return n;if(!n)return i;const s=((d=t.mainKey)==null?void 0:d.trim())||"main",o=(c=t.defaultAgentId)==null?void 0:c.trim();return n==="main"||n===s||o&&(n===`agent:${o}:main`||n===`agent:${o}:${s}`)?i:n}function jw(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=Zs(e.sessionKey,t),i=Zs(e.settings.sessionKey,t),s=Zs(e.settings.lastActiveSessionKey,t),o=n||i||e.sessionKey,a={...e.settings,sessionKey:i||o,lastActiveSessionKey:s||o},r=a.sessionKey!==e.settings.sessionKey||a.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),r&&nt(e,a)}function Le(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.contactsPage||e.advancedPage,i=t?"public-chat":n?"setup-ui":"taskmaster-control-ui";(s=e.client)==null||s.stop(),e.client=new Aw({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:o=>{var a;if(e.connected=!0,e.lastError=null,e.hello=o,t){Ml(e,o),_o(e),(((a=e.publicChatConfig)==null?void 0:a.auth)??"anonymous")==="anonymous"&&Zw(e);return}Pi()&&(oa(),e.uninstallDone=!1),Ml(e,o),e.handleAccessCheck(),Ww(e).then(()=>{wu(e)}),_o(e),bw(e),(e.chatPage||e.setup)&&Qw(e),Vo(e,{quiet:!0}),jo(e,{quiet:!0}),Un(e).then(()=>{e.initWorkspaceSelection()}),e.startEmbeddingPoll(),(e.setup||e.chatPage)&&Ne(e),e.setup&&(Yw(e),Jw(e),Xw(e)),_i(e)},onClose:({code:o,reason:a})=>{e.connected=!1,o!==1012&&(e.lastError=`disconnected (${o}): ${a||"no reason"}`)},onEvent:o=>Vw(e,o),onGap:({expected:o,received:a})=>{console.warn(`[gateway] event gap: expected seq ${o}, got ${a}`),_i(e)}}),e.client.start()}function Vw(e,t){try{Gw(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Gw(e,t){var n;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;ih(e,t.payload);return}if(t.event==="chat"){const i=t.payload;i!=null&&i.sessionKey&&ad(e,i.sessionKey);const s=lc(e,i);if((s==="final"||s==="error"||s==="aborted")&&(Fo(e),Qf(e)),s==="final"){const o=e,a=Math.max((((n=o.chatMessages)==null?void 0:n.length)??0)+10,Be);De(o,{limit:a})}return}if(t.event==="suggestions"){const i=t.payload;(i==null?void 0:i.sessionKey)===e.sessionKey&&Array.isArray(i.suggestions)&&i.suggestions.length>0&&(e.chatSuggestion=i.suggestions[0]);return}if(t.event==="presence"){const i=t.payload;i!=null&&i.presence&&Array.isArray(i.presence)&&(e.presenceEntries=i.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"){const i=t.payload;i&&vh(e,i),e.tab==="cron"&&ia(e)}if((t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&jo(e,{quiet:!0}),t.event==="exec.approval.requested"){const i=Cw(t.payload);if(i){e.execApprovalQueue=Tw(e.execApprovalQueue,i),e.execApprovalError=null;const s=Math.max(0,i.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Tl(e.execApprovalQueue,i.id)},s)}return}if(t.event==="browser.screencast.frame"){Dw(e,t.payload);return}if(t.event==="browser.handoff"){Bw(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){Nw(e);return}if(t.event==="exec.approval.resolved"){const i=Ew(t.payload);i&&(e.execApprovalQueue=Tl(e.execApprovalQueue,i.id));return}if(t.event==="update.progress"){Kw(e,t.payload);return}}function Ml(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&&jw(e,n.sessionDefaults)}async function Qw(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 Yw(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await wi(e.client)}catch{}}async function Jw(e){if(!(!e.client||!e.connected))try{e.tailscaleStatus=await e.client.request("tailscale.status")}catch{}}async function Xw(e){if(!(!e.client||!e.connected))try{e.wifiStatus=await e.client.request("wifi.status")}catch{}}const Pl="taskmaster_public_id";function ku(e=30){var s;const t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${Pl}=`));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=`${Pl}=${n}; path=/; expires=${i}; SameSite=Lax`,n}async function Zw(e){var n,i,s;if(!e.client||!e.connected)return;const t=ku((n=e.publicChatConfig)==null?void 0:n.cookieTtlDays);try{const o=(i=e.publicChatConfig)==null?void 0:i.accountId,a=await e.client.request("public.session",{cookieId:t,accountId:o});if(a!=null&&a.sessionKey){e.publicChatSessionKey=a.sessionKey,e.sessionKey=a.sessionKey,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready";const r=((s=e.publicChatConfig)==null?void 0:s.accountId)??"";e.chatMessage=Rn(r,a.sessionKey),De(e)}}catch(o){console.error("[public-chat] failed to resolve anonymous session:",o),e.lastError="Failed to start chat session"}}let Ce=!1,he=null,Gt="",qi="";function $u(e){return e.replace(/[\s\-()]/g,"")}function Su(){Ce=!1,he=null,Gt="",qi=""}async function ek(e){if(!e.client||!e.connected)return;const t=ku(e.cookieTtlDays);try{const n=await e.client.request("public.session",{cookieId:t,accountId:e.accountId});n!=null&&n.sessionKey&&e.onAuthenticated(n.sessionKey)}catch(n){he=n instanceof Error?n.message:"Failed to start session",e.requestUpdate()}}async function Ll(e){if(!e.client||Ce)return;const t=$u(Gt);if(!t){he="Please enter your phone number",e.requestUpdate();return}Ce=!0,he=null,e.requestUpdate();try{const n=await e.client.request("public.otp.request",{phone:t,name:qi.trim()||void 0,accountId:e.accountId});n!=null&&n.ok?e.onAuthStepChange("otp"):he=(n==null?void 0:n.error)??"Failed to send verification code"}catch(n){he=n instanceof Error?n.message:"Failed to send verification code"}finally{Ce=!1,e.requestUpdate()}}async function Il(e,t){if(!(!e.client||Ce)){if(!t.trim()){he="Please enter the verification code",e.requestUpdate();return}Ce=!0,he=null,e.requestUpdate();try{const n=await e.client.request("public.otp.verify",{phone:$u(Gt),code:t.trim(),accountId:e.accountId});n!=null&&n.ok&&n.sessionKey?(Su(),e.onAuthenticated(n.sessionKey)):he=(n==null?void 0:n.error)??"Invalid verification code"}catch(n){he=n instanceof Error?n.message:"Verification failed"}finally{Ce=!1,e.requestUpdate()}}}function eo(e){return w}function Rl(e){return u`
|
|
3943
|
+
`}async function bw(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 Un(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 ww(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 o=await e.client.request("config.get",{});e.configSnapshot=o;const a=o.hash;if(!a){e.workspacesError="Config hash missing; reload and retry.";return}const r={name:n,baseHash:a,whatsappAccountName:n};(i=t.workspacePath)!=null&&i.trim()&&(r.workspaceDir=t.workspacePath.trim());const d=await e.client.request("workspaces.create",r);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await Un(e),(s=t.onCreated)==null||s.call(t,d)}catch(o){e.workspacesError=String(o)}finally{e.workspaceSaving=!1}}async function kw(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 Un(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function $w(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 Un(e)}catch(i){e.workspacesError=String(i)}}}const hi=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:ww,loadWorkspaces:Un,removeWorkspace:kw,renameWorkspace:$w},Symbol.toStringTag,{value:"Module"})),vu={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"},El=vu,Eo={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(vu));new Set(Object.values(Eo));function Sw(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 xw=4008;class Aw{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 p;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 o=null,a=!1,r=this.opts.token;if(s){o=await Xh();const h=(p=tf({deviceId:o.deviceId,role:t}))==null?void 0:p.token;r=h??this.opts.token,a=!!(h&&this.opts.token)}const d=r||this.opts.password?{token:r,password:this.opts.password}:void 0;let c;if(s&&o){const h=Date.now(),v=this.connectNonce??void 0,S=Sw({deviceId:o.deviceId,clientId:this.opts.clientName??El.CONTROL_UI,clientMode:this.opts.mode??Eo.WEBCHAT,role:t,scopes:n,signedAtMs:h,token:r??null,nonce:v}),f=await Zh(o.privateKey,S);c={id:o.deviceId,publicKey:o.publicKey,signature:f,signedAt:h,nonce:v}}const l={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??El.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Eo.WEBCHAT,instanceId:this.opts.instanceId},role:t,scopes:n,device:c,caps:[],auth:d,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",l).then(h=>{var v,S,f;(v=h==null?void 0:h.auth)!=null&&v.deviceToken&&o&&nf({deviceId:o.deviceId,role:h.auth.role??t,token:h.auth.deviceToken,scopes:h.auth.scopes??[]}),this.backoffMs=800,(f=(S=this.opts).onHello)==null||f.call(S,h)}).catch(()=>{var h;a&&o&&sf({deviceId:o.deviceId,role:t}),(h=this.ws)==null||h.close(xw,"connect failed")})}handleMessage(t){var s,o,a,r,d,c;let n;try{n=JSON.parse(t)}catch{return}const i=n;if(i.type==="event"){const l=n;if(l.event==="connect.challenge"){const h=l.payload,v=h&&typeof h.nonce=="string"?h.nonce:null;v&&(this.connectNonce=v,this.sendConnect());return}const p=typeof l.seq=="number"?l.seq:null;p!==null&&(this.lastSeq!==null&&p>this.lastSeq+1&&((o=(s=this.opts).onGap)==null||o.call(s,{expected:this.lastSeq+1,received:p})),this.lastSeq=p);try{(r=(a=this.opts).onEvent)==null||r.call(a,l)}catch(h){console.error("[gateway] event handler error:",h)}return}if(i.type==="res"){const l=n,p=this.pending.get(l.id);if(!p)return;if(this.pending.delete(l.id),l.ok)p.resolve(l.payload);else{const h=new Error(((d=l.error)==null?void 0:d.message)??"request failed");h.payload=l.payload,h.details=(c=l.error)==null?void 0:c.details,p.reject(h)}return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const i=Qi(),s={type:"req",id:i,method:t,params:n},o=new Promise((a,r)=>{this.pending.set(i,{resolve:d=>a(d),reject:r})});return this.ws.send(JSON.stringify(s)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function To(e){return typeof e=="object"&&e!==null}function Cw(e){if(!To(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!To(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,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!s||!o?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:o}}function Ew(e){if(!To(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 bu(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Tw(e,t){const n=bu(e).filter(i=>i.id!==t.id);return n.push(t),n}function Tl(e,t){return bu(e).filter(n=>n.id!==t)}class _w{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,o=this.canvas.height/i.height,a=this.deviceWidth/this.canvas.width,r=this.deviceHeight/this.canvas.height;return{x:Math.round(t*s*a),y:Math.round(n*o*r)}}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 _n(){return Ys||(Ys=new _w),Ys}function xa(e){return e instanceof Error?e.message:String(e)}async function Mw(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=xa(t)}finally{e.browserLoading=!1}}async function Pw(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=xa(t)}finally{e.browserLoading=!1}}}async function Js(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 Xs(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 Lw(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=xa(t)}}function Iw(e){e.browserInputMode=!e.browserInputMode}function Rw(e){e.browserFullscreen=!e.browserFullscreen,_n().detach()}function Dw(e,t){if(!(t!=null&&t.data))return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,_n().updateFrame(t.data,t.metadata)}function Bw(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function Nw(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}async function _o(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 o=io(s);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}async function wi(e){return(await e.request("apikeys.list")).providers??[]}async function _l(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function Fw(e,t){await e.request("apikeys.remove",{provider:t})}async function Ow(e,t,n){await e.request("apikeys.disable",{provider:t,disabled:n})}const zi="taskmaster_update_pending";async function wu(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 Uw(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(zi,String(Date.now())),localStorage.removeItem(Aa)}catch{}try{const o=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(o.ok&&o.result.status==="ok")e.updateMessage="Updated — restarting gateway...",(n=e.requestUpdate)==null||n.call(e);else if(o.ok&&o.result.status==="skipped")Mn(),e.updateMessage=o.result.reason||"Update skipped",e.updateRunning=!1,(i=e.requestUpdate)==null||i.call(e);else throw Mn(),new Error(o.result.reason||"Update failed")}catch(o){Mn(),e.updateMessage=`Update failed: ${String(o)}`,e.updateRunning=!1,e.updateProgressSteps=[],(s=e.requestUpdate)==null||s.call(e)}}}function Kw(e,t){var i,s,o;const n=t.phase;if(n==="step-start"){const a=t.name,r=t.index,d=t.total;e.updateMessage=`Updating: ${a} (${r+1}/${d})`;const c=e.updateProgressSteps.find(l=>l.index===r);c?(c.status="running",c.name=a):e.updateProgressSteps=[...e.updateProgressSteps,{name:a,index:r,total:d,status:"running"}],(i=e.requestUpdate)==null||i.call(e)}else if(n==="step-done"){const a=t.name,r=t.index,d=t.total,c=t.ok,l=t.durationMs,p=e.updateProgressSteps.find(v=>v.index===r);p?(p.status=c?"done":"failed",p.durationMs=l):e.updateProgressSteps=[...e.updateProgressSteps,{name:a,index:r,total:d,status:c?"done":"failed",durationMs:l}];const h=!c&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=c?`Updating: ${a} done (${r+1}/${d})`:`Update step failed: ${a}${h}`,(s=e.requestUpdate)==null||s.call(e)}else if(n==="complete"){if(t.status==="ok")e.updateMessage="Update complete — restarting gateway...";else{const r=t.reason;e.updateMessage=r?`Update failed: ${r}`:"Update failed",e.updateRunning=!1,Mn()}(o=e.requestUpdate)==null||o.call(e)}}async function Ww(e){var n,i,s,o;if(!e.client||!e.connected)return;const t=qw();Mn();try{const a=await e.client.request("update.lastResult",{});if(!a.ok||!a.result)return;const r=5*6e4,d=Date.now()-a.result.ts<r;if(!t&&!d||Hw(a.result.ts))return;e.updateLastResult=a.result;const c=(n=a.result.after)==null?void 0:n.version;if(a.result.status==="ok"&&c&&(e.currentVersion=c),e.updateAvailable=!1,a.result.status==="ok"){const l=(i=a.result.before)==null?void 0:i.version,p=c??a.result.currentVersion;e.updateMessage=l?`Updated: v${l} → v${p}`:`Updated to v${p}`}else{const l=a.result.reason??((s=a.result.failedStep)==null?void 0:s.name)??"unknown error";e.updateMessage=`Update failed: ${l}`}}catch{}finally{e.updateRunning=!1,e.updateProgressSteps=[],(o=e.requestUpdate)==null||o.call(e)}}const Aa="taskmaster_update_dismissed";function zw(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(Aa,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function qw(){try{const e=localStorage.getItem(zi);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(zi),!1):!0:!1}catch{return!1}}function Mn(){try{localStorage.removeItem(zi)}catch{}}function Hw(e){try{const t=localStorage.getItem(Aa);return t?Number(t)>=e:!1}catch{return!1}}function Zs(e,t){var r,d,c;const n=(e??"").trim(),i=(r=t.mainSessionKey)==null?void 0:r.trim();if(!i)return n;if(!n)return i;const s=((d=t.mainKey)==null?void 0:d.trim())||"main",o=(c=t.defaultAgentId)==null?void 0:c.trim();return n==="main"||n===s||o&&(n===`agent:${o}:main`||n===`agent:${o}:${s}`)?i:n}function jw(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=Zs(e.sessionKey,t),i=Zs(e.settings.sessionKey,t),s=Zs(e.settings.lastActiveSessionKey,t),o=n||i||e.sessionKey,a={...e.settings,sessionKey:i||o,lastActiveSessionKey:s||o},r=a.sessionKey!==e.settings.sessionKey||a.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),r&&nt(e,a)}function Ie(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.contactsPage||e.advancedPage,i=t?"public-chat":n?"setup-ui":"taskmaster-control-ui";(s=e.client)==null||s.stop(),e.client=new Aw({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:o=>{var a;if(e.connected=!0,e.lastError=null,e.hello=o,t){Ml(e,o),_o(e),(((a=e.publicChatConfig)==null?void 0:a.auth)??"anonymous")==="anonymous"&&Zw(e);return}Pi()&&(oa(),e.uninstallDone=!1),Ml(e,o),e.handleAccessCheck(),Ww(e).then(()=>{wu(e)}),_o(e),bw(e),(e.chatPage||e.setup)&&Qw(e),Vo(e,{quiet:!0}),jo(e,{quiet:!0}),Un(e).then(()=>{e.initWorkspaceSelection()}),e.startEmbeddingPoll(),(e.setup||e.chatPage)&&Fe(e),e.setup&&(Yw(e),Jw(e),Xw(e)),_i(e)},onClose:({code:o,reason:a})=>{e.connected=!1,o!==1012&&(e.lastError=`disconnected (${o}): ${a||"no reason"}`)},onEvent:o=>Vw(e,o),onGap:({expected:o,received:a})=>{console.warn(`[gateway] event gap: expected seq ${o}, got ${a}`),_i(e)}}),e.client.start()}function Vw(e,t){try{Gw(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Gw(e,t){var n;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;ih(e,t.payload);return}if(t.event==="chat"){const i=t.payload;i!=null&&i.sessionKey&&ad(e,i.sessionKey);const s=lc(e,i);if((s==="final"||s==="error"||s==="aborted")&&(Fo(e),Qf(e)),s==="final"){const o=e,a=Math.max((((n=o.chatMessages)==null?void 0:n.length)??0)+10,Ne);Be(o,{limit:a})}return}if(t.event==="suggestions"){const i=t.payload;(i==null?void 0:i.sessionKey)===e.sessionKey&&Array.isArray(i.suggestions)&&i.suggestions.length>0&&(e.chatSuggestion=i.suggestions[0]);return}if(t.event==="presence"){const i=t.payload;i!=null&&i.presence&&Array.isArray(i.presence)&&(e.presenceEntries=i.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"){const i=t.payload;i&&vh(e,i),e.tab==="cron"&&ia(e)}if((t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&jo(e,{quiet:!0}),t.event==="exec.approval.requested"){const i=Cw(t.payload);if(i){e.execApprovalQueue=Tw(e.execApprovalQueue,i),e.execApprovalError=null;const s=Math.max(0,i.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Tl(e.execApprovalQueue,i.id)},s)}return}if(t.event==="browser.screencast.frame"){Dw(e,t.payload);return}if(t.event==="browser.handoff"){Bw(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){Nw(e);return}if(t.event==="exec.approval.resolved"){const i=Ew(t.payload);i&&(e.execApprovalQueue=Tl(e.execApprovalQueue,i.id));return}if(t.event==="update.progress"){Kw(e,t.payload);return}}function Ml(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&&jw(e,n.sessionDefaults)}async function Qw(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 Yw(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await wi(e.client)}catch{}}async function Jw(e){if(!(!e.client||!e.connected))try{e.tailscaleStatus=await e.client.request("tailscale.status")}catch{}}async function Xw(e){if(!(!e.client||!e.connected))try{e.wifiStatus=await e.client.request("wifi.status")}catch{}}const Pl="taskmaster_public_id";function ku(e=30){var s;const t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${Pl}=`));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=`${Pl}=${n}; path=/; expires=${i}; SameSite=Lax`,n}async function Zw(e){var n,i,s;if(!e.client||!e.connected)return;const t=ku((n=e.publicChatConfig)==null?void 0:n.cookieTtlDays);try{const o=(i=e.publicChatConfig)==null?void 0:i.accountId,a=await e.client.request("public.session",{cookieId:t,accountId:o});if(a!=null&&a.sessionKey){e.publicChatSessionKey=a.sessionKey,e.sessionKey=a.sessionKey,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready";const r=((s=e.publicChatConfig)==null?void 0:s.accountId)??"";e.chatMessage=Rn(r,a.sessionKey),Be(e)}}catch(o){console.error("[public-chat] failed to resolve anonymous session:",o),e.lastError="Failed to start chat session"}}let Ee=!1,fe=null,Qt="",qi="";function $u(e){return e.replace(/[\s\-()]/g,"")}function Su(){Ee=!1,fe=null,Qt="",qi=""}async function ek(e){if(!e.client||!e.connected)return;const t=ku(e.cookieTtlDays);try{const n=await e.client.request("public.session",{cookieId:t,accountId:e.accountId});n!=null&&n.sessionKey&&e.onAuthenticated(n.sessionKey)}catch(n){fe=n instanceof Error?n.message:"Failed to start session",e.requestUpdate()}}async function Ll(e){if(!e.client||Ee)return;const t=$u(Qt);if(!t){fe="Please enter your phone number",e.requestUpdate();return}Ee=!0,fe=null,e.requestUpdate();try{const n=await e.client.request("public.otp.request",{phone:t,name:qi.trim()||void 0,accountId:e.accountId});n!=null&&n.ok?e.onAuthStepChange("otp"):fe=(n==null?void 0:n.error)??"Failed to send verification code"}catch(n){fe=n instanceof Error?n.message:"Failed to send verification code"}finally{Ee=!1,e.requestUpdate()}}async function Il(e,t){if(!(!e.client||Ee)){if(!t.trim()){fe="Please enter the verification code",e.requestUpdate();return}Ee=!0,fe=null,e.requestUpdate();try{const n=await e.client.request("public.otp.verify",{phone:$u(Qt),code:t.trim(),accountId:e.accountId});n!=null&&n.ok&&n.sessionKey?(Su(),e.onAuthenticated(n.sessionKey)):fe=(n==null?void 0:n.error)??"Invalid verification code"}catch(n){fe=n instanceof Error?n.message:"Verification failed"}finally{Ee=!1,e.requestUpdate()}}}function eo(e){return k}function Rl(e){return u`
|
|
3944
3944
|
<div class="public-auth__form">
|
|
3945
3945
|
<label class="field public-auth__field">
|
|
3946
3946
|
<span>Your name (optional)</span>
|
|
@@ -3955,26 +3955,26 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3955
3955
|
<span>WhatsApp number</span>
|
|
3956
3956
|
<input
|
|
3957
3957
|
type="tel"
|
|
3958
|
-
.value=${
|
|
3959
|
-
@input=${t=>{
|
|
3958
|
+
.value=${Qt}
|
|
3959
|
+
@input=${t=>{Qt=t.target.value}}
|
|
3960
3960
|
@keydown=${t=>{t.key==="Enter"&&(t.preventDefault(),Ll(e))}}
|
|
3961
3961
|
placeholder="+44 7123 456789"
|
|
3962
3962
|
required
|
|
3963
3963
|
/>
|
|
3964
3964
|
</label>
|
|
3965
|
-
${
|
|
3965
|
+
${fe?u`<div class="public-auth__error">${fe}</div>`:k}
|
|
3966
3966
|
<button
|
|
3967
3967
|
class="btn primary public-auth__btn"
|
|
3968
|
-
?disabled=${
|
|
3968
|
+
?disabled=${Ee}
|
|
3969
3969
|
@click=${()=>{Ll(e)}}
|
|
3970
3970
|
>
|
|
3971
|
-
${
|
|
3971
|
+
${Ee?"Sending...":"Send verification code"}
|
|
3972
3972
|
</button>
|
|
3973
3973
|
</div>
|
|
3974
3974
|
`}function Dl(e){let t="";return u`
|
|
3975
3975
|
<div class="public-auth__form">
|
|
3976
3976
|
<p class="public-auth__hint">
|
|
3977
|
-
We sent a verification code to <strong>${
|
|
3977
|
+
We sent a verification code to <strong>${Qt}</strong> via WhatsApp.
|
|
3978
3978
|
</p>
|
|
3979
3979
|
<label class="field public-auth__field">
|
|
3980
3980
|
<span>Verification code</span>
|
|
@@ -3988,17 +3988,17 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3988
3988
|
required
|
|
3989
3989
|
/>
|
|
3990
3990
|
</label>
|
|
3991
|
-
${
|
|
3991
|
+
${fe?u`<div class="public-auth__error">${fe}</div>`:k}
|
|
3992
3992
|
<button
|
|
3993
3993
|
class="btn primary public-auth__btn"
|
|
3994
|
-
?disabled=${
|
|
3994
|
+
?disabled=${Ee}
|
|
3995
3995
|
@click=${()=>{Il(e,t)}}
|
|
3996
3996
|
>
|
|
3997
|
-
${
|
|
3997
|
+
${Ee?"Verifying...":"Verify"}
|
|
3998
3998
|
</button>
|
|
3999
3999
|
<button
|
|
4000
4000
|
class="btn public-auth__btn public-auth__btn--link"
|
|
4001
|
-
@click=${()=>{
|
|
4001
|
+
@click=${()=>{fe=null,e.onAuthStepChange("phone")}}
|
|
4002
4002
|
>
|
|
4003
4003
|
Use a different number
|
|
4004
4004
|
</button>
|
|
@@ -4053,7 +4053,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4053
4053
|
</p>
|
|
4054
4054
|
</div>
|
|
4055
4055
|
</div>
|
|
4056
|
-
`}const Ca="taskmaster-access-session",xu={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function Au(){try{return localStorage.getItem(Ca)}catch{return null}}function Cu(e){try{localStorage.setItem(Ca,e)}catch{}}function nk(){try{localStorage.removeItem(Ca)}catch{}}async function Bl(e){if(e.client)try{const t=Au(),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 ik(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?(Cu(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 sk(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?(Cu(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 ok(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 ak(e){const t=Au();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}nk(),e.accessState={...xu,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}function rk(e,t="admin"){var s;if(!e)return[];const n=e.bindings;if(!Array.isArray(n))return[];const i=[];for(const o of n){if(!o||typeof o!="object"||o.agentId!==t&&o.agentId!=="management")continue;const a=o.match;if(!a||typeof a!="object"||(a.channel??"").toLowerCase()!=="whatsapp")continue;const d=a.peer;if(!d||typeof d!="object"||d.kind!=="dm")continue;const c=d.id??"";c&&i.push({phone:c,paired:((s=o.meta)==null?void 0:s.paired)===!0})}return i.sort((o,a)=>o.paired&&!a.paired?-1:!o.paired&&a.paired?1:0),i}function Eu(e,t,n="admin",i){const s=c=>c===n||c==="management",o=new Map,a=new Map;for(const c of e){if(!c||typeof c!="object"||!s(c.agentId))continue;const l=c.match;if(!l||typeof l!="object"||(l.channel??"").toLowerCase()!=="whatsapp")continue;const f=l.peer;if(!f||typeof f!="object"||f.kind!=="dm")continue;const v=f.id??"";v&&(c.meta&&o.set(v,c.meta),l.accountId&&a.set(v,l.accountId))}const r=e.filter(c=>{if(!c||typeof c!="object"||!s(c.agentId))return!0;const l=c.match;if(!l||typeof l!="object"||(l.channel??"").toLowerCase()!=="whatsapp")return!0;const f=l.peer;return!f||typeof f!="object"?!0:f.kind!=="dm"}),d=t.map(c=>{const l=i??a.get(c.phone),p={channel:"whatsapp",peer:{kind:"dm",id:c.phone}};l&&(p.accountId=l);const f={agentId:n,match:p},v=o.get(c.phone);return v?f.meta=v:c.paired&&(f.meta={paired:!0}),f});return[...r,...d]}async function is(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=st(s??{}),e.adminPhones=rk(s,n),e.configFormDirty=!1}catch(i){e.adminsError=String(i)}finally{e.adminsLoading=!1}}async function Tu(e,t,n,i){var a,r;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n;let o=t.replace(/[\s\-\(\)]/g,"");if(!o){e.adminsError="Phone number is required";return}if(o.startsWith("+")||(o="+"+o),!/^\+[1-9]\d{6,14}$/.test(o)){e.adminsError="Invalid phone number. Use international format (e.g., +44 7504 472444)";return}if(e.adminPhones.some(d=>d.phone===o)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const d=st(e.configForm??((a=e.configSnapshot)==null?void 0:a.config)??{}),c=d.bindings??[],l=[...e.adminPhones,{phone:o}],p=Eu(c,l,s,i);dc(d,["bindings"],p);const f=(r=e.configSnapshot)==null?void 0:r.hash;if(!f){e.adminsError="Config hash missing; reload and retry.";return}const v=$t(d);await e.client.request("config.set",{raw:v,baseHash:f}),await is(e,n)}catch(d){e.adminsError=String(d)}finally{e.adminsSaving=!1}}async function _u(e,t,n,i){var a,r;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n,o=e.adminPhones.find(d=>d.phone===t);if(o!=null&&o.paired){e.adminsError="Cannot remove the paired phone. Unlink WhatsApp first.";return}e.adminsSaving=!0,e.adminsError=null;try{const d=st(e.configForm??((a=e.configSnapshot)==null?void 0:a.config)??{}),c=d.bindings??[],l=e.adminPhones.filter(h=>h.phone!==t),p=Eu(c,l,s,i);dc(d,["bindings"],p);const f=(r=e.configSnapshot)==null?void 0:r.hash;if(!f){e.adminsError="Config hash missing; reload and retry.";return}const v=$t(d);await e.client.request("config.set",{raw:v,baseHash:f}),await is(e,n)}catch(d){e.adminsError=String(d)}finally{e.adminsSaving=!1}}const lk=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:Tu,loadAdmins:is,removeAdmin:_u},Symbol.toStringTag,{value:"Module"}));async function Tt(e,t){if(!(!e.client||!e.connected)){if(!t){e.contactsRecords=[];return}if(!e.contactsLoading){e.contactsLoading=!0,e.contactsError=null;try{const n=e.contactsSearchQuery.trim(),i=n?await e.client.request("records.search",{query:n,workspace:t}):await e.client.request("records.list",{workspace:t});e.contactsRecords=i.records??[]}catch(n){e.contactsError=String(n)}finally{e.contactsLoading=!1}}}}async function Mu(e,t,n,i){if(!e.client||!e.connected||e.contactsSaving)return;let s=t.replace(/[\s\-\(\)]/g,"");const o=n.trim();if(!s){e.contactsError="Phone number is required";return}if(!o){e.contactsError="Name is required";return}if(s.startsWith("+")||(s="+"+s),!/^\+[1-9]\d{6,14}$/.test(s)){e.contactsError="Invalid phone number. Use international format (e.g., +44 7490 553305)";return}e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.set",{id:s,name:o,fields:{},workspace:i}),e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName="",await Tt(e,i)}catch(a){e.contactsError=String(a)}finally{e.contactsSaving=!1}}async function Pu(e,t,n){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.delete",{id:t}),e.contactsEditingId===t&&(e.contactsEditingId=null),await Tt(e,n)}catch(i){e.contactsError=String(i)}finally{e.contactsSaving=!1}}}async function Mo(e,t,n,i,s){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.setField",{id:t,key:n,value:i}),await Tt(e,s)}catch(o){e.contactsError=String(o)}finally{e.contactsSaving=!1}}}async function Lu(e,t,n,i){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.deleteField",{id:t,key:n}),await Tt(e,i)}catch(s){e.contactsError=String(s)}finally{e.contactsSaving=!1}}}const ck=Object.freeze(Object.defineProperty({__proto__:null,addContact:Mu,deleteContact:Pu,deleteContactField:Lu,loadContacts:Tt,setContactField:Mo},Symbol.toStringTag,{value:"Module"}));function yn(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 dk(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 uk(e){const t=re(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 pk(e){const t=re(e);return(t==null?void 0:t.whatsappAccountId)??void 0}function hk(e){var i;const t=re(e);if(!t)return;const n=t.agents.find(s=>s.id.endsWith("-admin")||s.id==="admin");return(n==null?void 0:n.id)??((i=t.agents[0])==null?void 0:i.id)}function fk(e){return e.selectedWorkspace??void 0}function re(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const gk=/^data:/i,mk=/^https?:\/\//i;function Nl(e){var r,d;const t=((r=e.agentsList)==null?void 0:r.agents)??[],n=Xl(e.sessionKey),i=(n==null?void 0:n.agentId)??((d=e.agentsList)==null?void 0:d.defaultId)??"main",s=t.find(c=>c.id===i),o=s==null?void 0:s.identity,a=(o==null?void 0:o.avatarUrl)??(o==null?void 0:o.avatar);if(a)return gk.test(a)||mk.test(a)?a:o==null?void 0:o.avatarUrl}function yk(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 vk(e){var a;if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=(a=e.channelAccounts)==null?void 0:a.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,o=s!=null?s.ok===!0:i;return{configured:n.configured??!1,running:i,connected:o,lastError:n.lastError??null,selfChatMode:n.mode==="self-chat"||!!n.selfChatMode,dmPolicy:n.dmPolicy??null,cliPath:n.cliPath??null}}function bk(e){var a;const t=(a=e.configSnapshot)==null?void 0:a.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const i=n.find(r=>{var d,c;return((d=r.match)==null?void 0:d.channel)==="imessage"&&((c=r.meta)==null?void 0:c.imessageOwner)});if(!i)return null;const s=i.agentId;for(const r of e.workspaces)if(r.agents.some(d=>d.id===s))return r.name;if(s==="admin"||s==="public"){const r=e.workspaces.find(d=>d.isDefault);return(r==null?void 0:r.name)??null}const o=s.replace(/-(admin|public)$/,"");if(o!==s){const r=e.workspaces.find(d=>d.name===o);return(r==null?void 0:r.name)??null}return null}function wk(e){var t,n,i,s,o,a,r,d,c;if(e.embeddingDownloading&&!e.publicChat)return u`
|
|
4056
|
+
`}const Ca="taskmaster-access-session",xu={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function Au(){try{return localStorage.getItem(Ca)}catch{return null}}function Cu(e){try{localStorage.setItem(Ca,e)}catch{}}function nk(){try{localStorage.removeItem(Ca)}catch{}}async function Bl(e){if(e.client)try{const t=Au(),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 ik(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?(Cu(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 sk(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?(Cu(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 ok(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 ak(e){const t=Au();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}nk(),e.accessState={...xu,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}function rk(e,t="admin"){var s;if(!e)return[];const n=e.bindings;if(!Array.isArray(n))return[];const i=[];for(const o of n){if(!o||typeof o!="object"||o.agentId!==t&&o.agentId!=="management")continue;const a=o.match;if(!a||typeof a!="object"||(a.channel??"").toLowerCase()!=="whatsapp")continue;const d=a.peer;if(!d||typeof d!="object"||d.kind!=="dm")continue;const c=d.id??"";c&&i.push({phone:c,paired:((s=o.meta)==null?void 0:s.paired)===!0})}return i.sort((o,a)=>o.paired&&!a.paired?-1:!o.paired&&a.paired?1:0),i}function Eu(e,t,n="admin",i){const s=c=>c===n||c==="management",o=new Map,a=new Map;for(const c of e){if(!c||typeof c!="object"||!s(c.agentId))continue;const l=c.match;if(!l||typeof l!="object"||(l.channel??"").toLowerCase()!=="whatsapp")continue;const h=l.peer;if(!h||typeof h!="object"||h.kind!=="dm")continue;const v=h.id??"";v&&(c.meta&&o.set(v,c.meta),l.accountId&&a.set(v,l.accountId))}const r=e.filter(c=>{if(!c||typeof c!="object"||!s(c.agentId))return!0;const l=c.match;if(!l||typeof l!="object"||(l.channel??"").toLowerCase()!=="whatsapp")return!0;const h=l.peer;return!h||typeof h!="object"?!0:h.kind!=="dm"}),d=t.map(c=>{const l=i??a.get(c.phone),p={channel:"whatsapp",peer:{kind:"dm",id:c.phone}};l&&(p.accountId=l);const h={agentId:n,match:p},v=o.get(c.phone);return v?h.meta=v:c.paired&&(h.meta={paired:!0}),h});return[...r,...d]}async function is(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=st(s??{}),e.adminPhones=rk(s,n),e.configFormDirty=!1}catch(i){e.adminsError=String(i)}finally{e.adminsLoading=!1}}async function Tu(e,t,n,i){var a,r;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n;let o=t.replace(/[\s\-\(\)]/g,"");if(!o){e.adminsError="Phone number is required";return}if(o.startsWith("+")||(o="+"+o),!/^\+[1-9]\d{6,14}$/.test(o)){e.adminsError="Invalid phone number. Use international format (e.g., +44 7504 472444)";return}if(e.adminPhones.some(d=>d.phone===o)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const d=st(e.configForm??((a=e.configSnapshot)==null?void 0:a.config)??{}),c=d.bindings??[],l=[...e.adminPhones,{phone:o}],p=Eu(c,l,s,i);dc(d,["bindings"],p);const h=(r=e.configSnapshot)==null?void 0:r.hash;if(!h){e.adminsError="Config hash missing; reload and retry.";return}const v=St(d);await e.client.request("config.set",{raw:v,baseHash:h}),await is(e,n)}catch(d){e.adminsError=String(d)}finally{e.adminsSaving=!1}}async function _u(e,t,n,i){var a,r;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n,o=e.adminPhones.find(d=>d.phone===t);if(o!=null&&o.paired){e.adminsError="Cannot remove the paired phone. Unlink WhatsApp first.";return}e.adminsSaving=!0,e.adminsError=null;try{const d=st(e.configForm??((a=e.configSnapshot)==null?void 0:a.config)??{}),c=d.bindings??[],l=e.adminPhones.filter(S=>S.phone!==t),p=Eu(c,l,s,i);dc(d,["bindings"],p);const h=(r=e.configSnapshot)==null?void 0:r.hash;if(!h){e.adminsError="Config hash missing; reload and retry.";return}const v=St(d);await e.client.request("config.set",{raw:v,baseHash:h}),await is(e,n)}catch(d){e.adminsError=String(d)}finally{e.adminsSaving=!1}}const lk=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:Tu,loadAdmins:is,removeAdmin:_u},Symbol.toStringTag,{value:"Module"}));async function _t(e,t){if(!(!e.client||!e.connected)){if(!t){e.contactsRecords=[];return}if(!e.contactsLoading){e.contactsLoading=!0,e.contactsError=null;try{const n=e.contactsSearchQuery.trim(),i=n?await e.client.request("records.search",{query:n,workspace:t}):await e.client.request("records.list",{workspace:t});e.contactsRecords=i.records??[]}catch(n){e.contactsError=String(n)}finally{e.contactsLoading=!1}}}}async function Mu(e,t,n,i){if(!e.client||!e.connected||e.contactsSaving)return;let s=t.replace(/[\s\-\(\)]/g,"");const o=n.trim();if(!s){e.contactsError="Phone number is required";return}if(!o){e.contactsError="Name is required";return}if(s.startsWith("+")||(s="+"+s),!/^\+[1-9]\d{6,14}$/.test(s)){e.contactsError="Invalid phone number. Use international format (e.g., +44 7490 553305)";return}e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.set",{id:s,name:o,fields:{},workspace:i}),e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName="",await _t(e,i)}catch(a){e.contactsError=String(a)}finally{e.contactsSaving=!1}}async function Pu(e,t,n){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.delete",{id:t}),e.contactsEditingId===t&&(e.contactsEditingId=null),await _t(e,n)}catch(i){e.contactsError=String(i)}finally{e.contactsSaving=!1}}}async function Mo(e,t,n,i,s){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.setField",{id:t,key:n,value:i}),await _t(e,s)}catch(o){e.contactsError=String(o)}finally{e.contactsSaving=!1}}}async function Lu(e,t,n,i){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.deleteField",{id:t,key:n}),await _t(e,i)}catch(s){e.contactsError=String(s)}finally{e.contactsSaving=!1}}}const ck=Object.freeze(Object.defineProperty({__proto__:null,addContact:Mu,deleteContact:Pu,deleteContactField:Lu,loadContacts:_t,setContactField:Mo},Symbol.toStringTag,{value:"Module"}));function yn(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 dk(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 uk(e){const t=le(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 pk(e){const t=le(e);return(t==null?void 0:t.whatsappAccountId)??void 0}function hk(e){var i;const t=le(e);if(!t)return;const n=t.agents.find(s=>s.id.endsWith("-admin")||s.id==="admin");return(n==null?void 0:n.id)??((i=t.agents[0])==null?void 0:i.id)}function fk(e){return e.selectedWorkspace??void 0}function le(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const gk=/^data:/i,mk=/^https?:\/\//i;function Nl(e){var r,d;const t=((r=e.agentsList)==null?void 0:r.agents)??[],n=Xl(e.sessionKey),i=(n==null?void 0:n.agentId)??((d=e.agentsList)==null?void 0:d.defaultId)??"main",s=t.find(c=>c.id===i),o=s==null?void 0:s.identity,a=(o==null?void 0:o.avatarUrl)??(o==null?void 0:o.avatar);if(a)return gk.test(a)||mk.test(a)?a:o==null?void 0:o.avatarUrl}function yk(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 vk(e){var a;if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=(a=e.channelAccounts)==null?void 0:a.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,o=s!=null?s.ok===!0:i;return{configured:n.configured??!1,running:i,connected:o,lastError:n.lastError??null,selfChatMode:n.mode==="self-chat"||!!n.selfChatMode,dmPolicy:n.dmPolicy??null,cliPath:n.cliPath??null}}function bk(e){var a;const t=(a=e.configSnapshot)==null?void 0:a.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const i=n.find(r=>{var d,c;return((d=r.match)==null?void 0:d.channel)==="imessage"&&((c=r.meta)==null?void 0:c.imessageOwner)});if(!i)return null;const s=i.agentId;for(const r of e.workspaces)if(r.agents.some(d=>d.id===s))return r.name;if(s==="admin"||s==="public"){const r=e.workspaces.find(d=>d.isDefault);return(r==null?void 0:r.name)??null}const o=s.replace(/-(admin|public)$/,"");if(o!==s){const r=e.workspaces.find(d=>d.name===o);return(r==null?void 0:r.name)??null}return null}function wk(e){var t,n,i,s,o,a,r,d,c;if(e.embeddingDownloading&&!e.publicChat)return u`
|
|
4057
4057
|
<div class="setup-container">
|
|
4058
4058
|
<div class="setup-card" style="text-align:center; max-width:420px;">
|
|
4059
4059
|
<div class="setup-spinner"></div>
|
|
@@ -4067,14 +4067,14 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4067
4067
|
</p>
|
|
4068
4068
|
</div>
|
|
4069
4069
|
</div>
|
|
4070
|
-
`;if(e.publicChat)return e.connected?e.publicChatAuthenticated?vw({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??Nl(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(),
|
|
4070
|
+
`;if(e.publicChat)return e.connected?e.publicChatAuthenticated?vw({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??Nl(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(),ae(async()=>{const{loadChatHistory:l}=await Promise.resolve().then(()=>Ci);return{loadChatHistory:l}},void 0,import.meta.url).then(({loadChatHistory:l})=>{l(e)})),onDraftChange:l=>{var h;e.chatMessage=l;const p=((h=e.publicChatConfig)==null?void 0:h.accountId)??"";sr(p,e.sessionKey,l)},requestUpdate:()=>e.requestUpdate(),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,hasMore:e.chatHistoryHasMore,loadingOlder:e.chatLoadingOlder,onLoadOlder:()=>{e.handleLoadOlderChat()}}):tk({authMode:e.publicChatConfig.auth??"anonymous",authStep:e.publicChatAuthStep,connected:e.connected,client:e.client,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,accountId:e.publicChatConfig.accountId,cookieTtlDays:e.publicChatConfig.cookieTtlDays,onAuthenticated:l=>{var h;e.publicChatSessionKey=l,e.sessionKey=l,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready";const p=((h=e.publicChatConfig)==null?void 0:h.accountId)??"";e.chatMessage=Rn(p,l),ae(async()=>{const{loadChatHistory:v}=await Promise.resolve().then(()=>Ci);return{loadChatHistory:v}},void 0,import.meta.url).then(({loadChatHistory:v})=>{v(e)})},onAuthStepChange:l=>{e.publicChatAuthStep=l},requestUpdate:()=>{e.requestUpdate()}}):u`
|
|
4071
4071
|
<div class="setup-container">
|
|
4072
4072
|
<div class="setup-card">
|
|
4073
4073
|
<div class="setup-spinner"></div>
|
|
4074
4074
|
<p>Connecting...</p>
|
|
4075
4075
|
</div>
|
|
4076
4076
|
</div>
|
|
4077
|
-
`;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return Cl({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(p,f)=>{f!=null&&e.handlePinSubmit(p,f)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(p,f,v)=>e.handleChangePin(p,f,v)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return Cl({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:p=>e.handleSetMasterPin(p)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",w}if(e.setup){const l=yk(e.channelsSnapshot),p=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],f=vk(e.channelsSnapshot),v=bk(e);return Sg({connected:e.connected,serverPlatform:((s=(i=e.hello)==null?void 0:i.server)==null?void 0:s.platform)??null,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:h=>e.handleLicenseKeyChange(h),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:p,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:h=>e.handleUninstallConfirmTextChange(h),onUninstallRun:()=>e.handleUninstallRun(),onUninstallDismiss:()=>e.handleUninstallDismiss(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:h=>e.handleAuthSubmitCode(h),onAuthCodeChange:h=>e.handleAuthCodeChange(h),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async h=>{await e.handleWhatsAppStart(!0,h),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(h),await Y(e,!0),e.requestUpdate())},onWhatsAppUnlink:async h=>{await e.handleWhatsAppLogout(h)},onWhatsAppReset:async h=>{await e.handleWhatsAppLogout(h),await e.handleWhatsAppStart(!0,h),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(h),await Y(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await Y(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),Y(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:h=>e.handleRemoveWhatsAppAccount(h),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:h=>{e.newWorkspacePin=h},onWorkspaceCreate:async(h,b)=>{const S=e.newWorkspacePin;await e.handleWorkspaceCreate(h,b),S.match(/^\d{4,6}$/)&&(await ok(e,h,S),e.newWorkspacePin="")},onWorkspaceRemove:h=>e.handleWorkspaceRemove(h),onSetAddingWorkspace:h=>{e.addingWorkspace=h},onSetNewWorkspaceName:h=>{e.newWorkspaceName=h},onSetNewWorkspacePath:h=>{e.newWorkspacePath=h},onSetWorkspaceRemoveConfirm:h=>{e.workspaceRemoveConfirm=h},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(h,b)=>e.handleWorkspaceRename(h,b),whatsappDmPolicy:(()=>{const h=re(e),b=h==null?void 0:h.whatsappAccountId,S=b?p.find($=>$.accountId===b):p[0];return(S==null?void 0:S.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var T;const h=re(e),b=h==null?void 0:h.whatsappAccountId,S=b?p.find(_=>_.accountId===b):p[0];if(!S)return;const x=S.dmPolicy!=null&&S.dmPolicy!=="disabled"?"disabled":"open",C=x==="open"?{dmPolicy:x,allowFrom:["*"]}:{dmPolicy:x};try{const _=await e.client.request("config.get"),D=_.config,O=(T=D==null?void 0:D.channels)==null?void 0:T.whatsapp,be=((O==null?void 0:O.accounts)??{})[S.accountId]?{channels:{whatsapp:{accounts:{[S.accountId]:C}}}}:{channels:{whatsapp:C}};await e.client.request("config.patch",{raw:JSON.stringify(be),baseHash:_.hash,note:`WhatsApp DM policy → ${x}`,skipRestart:!0}),await Y(e,!1)}catch(_){console.error("DM toggle failed:",_)}},whatsappModel:(()=>{var T,_;const h=re(e);if(!h)return null;const b=h.agents.find(D=>D.id.endsWith("-public")||D.id==="public");if(!b)return null;const S=(T=e.configSnapshot)==null?void 0:T.config,$=(_=S==null?void 0:S.agents)==null?void 0:_.list;if(!Array.isArray($))return null;const x=$.find(D=>D.id===b.id);if(!(x!=null&&x.model))return null;const C=typeof x.model=="string"?x.model:x.model.primary;return(C==null?void 0:C.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async h=>{const b=re(e);if(!b)return;const S=b.agents.find($=>$.id.endsWith("-public")||$.id==="public");if(S)try{const $=await e.client.request("config.get"),x=$.config,C=(x==null?void 0:x.agents)??{},T=Array.isArray(C.list)?[...C.list]:[],_=T.findIndex(O=>O.id===S.id);if(h)_>=0?T[_]={...T[_],model:h}:T.push({id:S.id,model:h});else if(_>=0){const{model:O,...ne}=T[_];Object.keys(ne).length<=1?T.splice(_,1):T[_]=ne}const D=T.length>0?{agents:{list:T}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(D),baseHash:$.hash,note:`Public agent model → ${h||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Model change failed:",$)}},whatsappThinkingLevel:(()=>{var C,T,_;const h=re(e);if(!h)return null;const b=h.agents.find(D=>D.id.endsWith("-public")||D.id==="public");if(!b)return null;const S=(C=e.configSnapshot)==null?void 0:C.config,$=(T=S==null?void 0:S.agents)==null?void 0:T.list;if(!Array.isArray($))return null;const x=$.find(D=>D.id===b.id);return((_=x==null?void 0:x.thinkingLevel)==null?void 0:_.trim())||null})(),onWhatsAppThinkingChange:async h=>{const b=re(e);if(!b)return;const S=b.agents.find($=>$.id.endsWith("-public")||$.id==="public");if(S)try{const $=await e.client.request("config.get"),x=$.config,C=(x==null?void 0:x.agents)??{},T=Array.isArray(C.list)?[...C.list]:[],_=T.findIndex(ne=>ne.id===S.id),D=h==="off"?void 0:h;if(D)_>=0?T[_]={...T[_],thinkingLevel:D}:T.push({id:S.id,thinkingLevel:D});else if(_>=0){const{thinkingLevel:ne,...be}=T[_];Object.keys(be).length<=1?T.splice(_,1):T[_]=be}const O=T.length>0?{agents:{list:T}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(O),baseHash:$.hash,note:`Public agent thinking → ${D||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Thinking change failed:",$)}},whatsappGroupPolicy:(()=>{var _,D;const h=(_=e.configSnapshot)==null?void 0:_.config,b=(D=h==null?void 0:h.channels)==null?void 0:D.whatsapp,S=re(e),$=S==null?void 0:S.whatsappAccountId,x=(b==null?void 0:b.accounts)??{},C=$?x[$]:void 0;return(C==null?void 0:C.groupPolicy)??(b==null?void 0:b.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var D,O;const h=(D=e.configSnapshot)==null?void 0:D.config,b=(O=h==null?void 0:h.channels)==null?void 0:O.whatsapp,S=re(e),$=S==null?void 0:S.whatsappAccountId,x=(b==null?void 0:b.accounts)??{},C=$?x[$]:void 0,_=((C==null?void 0:C.groups)??(b==null?void 0:b.groups)??{})["*"];return(_==null?void 0:_.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var S;const h=re(e),b=h==null?void 0:h.whatsappAccountId;try{const $=await e.client.request("config.get"),x=$.config,C=((S=x==null?void 0:x.channels)==null?void 0:S.whatsapp)??{},T=C.accounts??{},_=b?T[b]:void 0,D=(_==null?void 0:_.groupPolicy)??C.groupPolicy??"allowlist",O=D==="disabled"||D==="allowlist",ne=O?"open":"disabled",be=O?{"*":{}}:void 0,Ye={groupPolicy:ne};be&&(Ye.groups=be);const ee=_?{channels:{whatsapp:{accounts:{[b]:Ye}}}}:{channels:{whatsapp:Ye}};await e.client.request("config.patch",{raw:JSON.stringify(ee),baseHash:$.hash,note:`WhatsApp groups → ${ne}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Group toggle failed:",$)}},onWhatsAppGroupMentionChange:async h=>{var $;const b=re(e),S=b==null?void 0:b.whatsappAccountId;try{const x=await e.client.request("config.get"),C=x.config,_=((($=C==null?void 0:C.channels)==null?void 0:$.whatsapp)??{}).accounts??{},D=S?_[S]:void 0,O={"*":{requireMention:h}},ne=D?{channels:{whatsapp:{accounts:{[S]:{groups:O}}}}}:{channels:{whatsapp:{groups:O}}};await e.client.request("config.patch",{raw:JSON.stringify(ne),baseHash:x.hash,note:`WhatsApp group mention → ${h?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Group mention change failed:",x)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:f.configured,imessageRunning:f.running,imessageConnected:f.connected,imessageLastError:f.lastError,imessageSelfChatMode:f.selfChatMode,imessageCliPath:f.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:v,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const h=await e.client.request("config.get"),b=h.config,S=(b==null?void 0:b.bindings)??[],$=re(e),x=$==null?void 0:$.agents.find(O=>O.id.endsWith("-admin")||O.id==="admin"),C=(x==null?void 0:x.id)??"admin",T=S.filter(O=>{var ne;return((ne=O.match)==null?void 0:ne.channel)!=="imessage"}),_=[{agentId:C,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],D=[...T,..._];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:D}),baseHash:h.hash,note:"Enable iMessage (self-chat) for "+(($==null?void 0:$.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([Y(e,!0),Ne(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await Y(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const h=await e.client.request("config.get"),b=h.config,$=((b==null?void 0:b.bindings)??[]).filter(x=>{var C;return((C=x.match)==null?void 0:C.channel)!=="imessage"});await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:$}),baseHash:h.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([Y(e,!0),Ne(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const h=await e.client.request("config.get"),b=h.config,S=(b==null?void 0:b.bindings)??[],$=re(e),x=$==null?void 0:$.agents.find(D=>D.id.endsWith("-admin")||D.id==="admin"),C=(x==null?void 0:x.id)??"admin",T=S.filter(D=>{var O;return((O=D.match)==null?void 0:O.channel)!=="imessage"}),_=[{agentId:C,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:[...T,..._]}),baseHash:h.hash,note:"Reassign iMessage to "+(($==null?void 0:$.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([Y(e,!0),Ne(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:h=>{e.infoModalOpen=h},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(h,b)=>{e.apiKeySavingProvider=h,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await _l(e.client,h,b);const S=`${h} key saved`;e.apiKeySuccess=S,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}h==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===S&&(e.apiKeySuccess=null)},2500)}catch(S){e.apiKeyError=S instanceof Error?S.message:"Failed to save key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async h=>{e.apiKeySavingProvider=h,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Fw(e.client,h);const b=`${h} key removed`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===b&&(e.apiKeySuccess=null)},2500)}catch(b){e.apiKeyError=b instanceof Error?b.message:"Failed to remove key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyDisable:async(h,b)=>{e.apiKeySavingProvider=h,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Ow(e.client,h,b);const S=`${h} ${b?"disabled":"enabled"}`;e.apiKeySuccess=S,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===S&&(e.apiKeySuccess=null)},2500)}catch(S){e.apiKeyError=S instanceof Error?S.message:`Failed to ${b?"disable":"enable"} 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:h=>{e.authApiKeyInput=h},onAuthApiKeySubmit:async()=>{const h=e.authApiKeyInput.trim();if(h){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await _l(e.client,"anthropic",h),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(b){e.authApiKeyError=b instanceof Error?b.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{var b;const h=e.selectedWorkspace??((b=e.workspaces[0])==null?void 0:b.name);return h?e.accessState.accounts.some(S=>S.id===h):!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:(h,b)=>{var $;const S=e.selectedWorkspace??(($=e.workspaces[0])==null?void 0:$.name);S&&e.handleAccountPinSave(S,h,b)},publicChatEnabled:(()=>{var S;const h=(S=e.configSnapshot)==null?void 0:S.config,b=h==null?void 0:h.publicChat;return(b==null?void 0:b.enabled)===!0})(),publicChatAuthMode:(()=>{var $;const h=($=e.configSnapshot)==null?void 0:$.config,b=h==null?void 0:h.publicChat,S=b==null?void 0:b.auth;return S==="verified"||S==="choice"?S:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var h;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get"),S=b.config,$=((h=S==null?void 0:S.publicChat)==null?void 0:h.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!$}}),baseHash:b.hash,note:`Public chat → ${$?"disabled":"enabled"}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat toggle failed:",b)}finally{e.publicChatToggleBusy=!1}}},onPublicChatAuthModeChange:async h=>{if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get");await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{auth:h}}),baseHash:b.hash,note:`Public chat auth → ${h}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat auth mode change failed:",b)}finally{e.publicChatToggleBusy=!1}}},brandAccentColor:(()=>{var S;const h=e.selectedWorkspace;return h?((S=Ie()[h])==null?void 0:S.accentColor)??"":""})(),brandBackgroundColor:(()=>{var S;const h=e.selectedWorkspace;return h?((S=Ie()[h])==null?void 0:S.backgroundColor)??"":""})(),brandHasLogo:(()=>{var S;const h=e.selectedWorkspace;return h?!!((S=Ie()[h])!=null&&S.logoUrl):!1})(),brandingBusy:e.brandingBusy,brandingExpanded:e.brandingExpanded,onBrandingToggle:()=>{e.brandingExpanded=!e.brandingExpanded},onBrandAccentColorChange:async h=>{var S;const b=e.selectedWorkspace;if(!(!b||e.brandingBusy)){e.brandingBusy=!0;try{const $=await e.client.request("config.get"),x=$.config,C=((S=x==null?void 0:x.workspaces)==null?void 0:S[b])??{},T=C.brand??{};await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[b]:{...C,brand:{...T,accentColor:h}}}}),baseHash:$.hash,note:`Brand accent → ${h}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");const _=Ie();_[b]||(_[b]={}),_[b].accentColor=h,kn(b)}catch($){console.error("Brand accent change failed:",$)}finally{e.brandingBusy=!1}}},onBrandBackgroundColorChange:async h=>{var S;const b=e.selectedWorkspace;if(!(!b||e.brandingBusy)){e.brandingBusy=!0;try{const $=await e.client.request("config.get"),x=$.config,C=((S=x==null?void 0:x.workspaces)==null?void 0:S[b])??{},T=C.brand??{};await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[b]:{...C,brand:{...T,backgroundColor:h}}}}),baseHash:$.hash,note:`Brand background → ${h}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");const _=Ie();_[b]||(_[b]={}),_[b].backgroundColor=h,kn(b)}catch($){console.error("Brand background change failed:",$)}finally{e.brandingBusy=!1}}},onBrandLogoUpload:async h=>{const b=e.selectedWorkspace;if(!(!b||e.brandingBusy)){e.brandingBusy=!0;try{const S=await h.arrayBuffer(),$=new Uint8Array(S);let x="";for(let _=0;_<$.length;_++)x+=String.fromCharCode($[_]);const C=btoa(x);await e.client.request("brand.uploadLogo",{workspace:b,data:C,mimeType:h.type});const T=Ie();T[b]||(T[b]={}),T[b].logoUrl=`/brand-logo/${encodeURIComponent(b)}`}catch(S){console.error("Brand logo upload failed:",S)}finally{e.brandingBusy=!1}}},onBrandLogoRemove:async()=>{const h=e.selectedWorkspace;if(!(!h||e.brandingBusy)){e.brandingBusy=!0;try{await e.client.request("brand.removeLogo",{workspace:h});const b=Ie();b[h]&&delete b[h].logoUrl}catch(b){console.error("Brand logo remove failed:",b)}finally{e.brandingBusy=!1}}},onBrandReset:async()=>{var b;const h=e.selectedWorkspace;if(!(!h||e.brandingBusy)){e.brandingBusy=!0;try{const S=await e.client.request("config.get"),$=S.config,x=((b=$==null?void 0:$.workspaces)==null?void 0:b[h])??{},{brand:C,...T}=x;await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[h]:{...T,brand:null}}}),baseHash:S.hash,note:"Brand reset to defaults",skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");try{await e.client.request("brand.removeLogo",{workspace:h})}catch{}const _=Ie();delete _[h],kn(h)}catch(S){console.error("Brand reset failed:",S)}finally{e.brandingBusy=!1}}},tailscaleStatus:e.tailscaleStatus,tailscaleBusy:e.tailscaleBusy,tailscaleAuthUrl:e.tailscaleAuthUrl,tailscaleError:e.tailscaleError,tailscaleFunnelEnableUrl:e.tailscaleFunnelEnableUrl,tailscaleDisableConfirm:e.tailscaleDisableConfirm,onTailscaleEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleAuthUrl=null;try{const h=await e.client.request("tailscale.enable");if(h.authUrl){e.tailscaleAuthUrl=h.authUrl;const b=setInterval(async()=>{try{const S=await e.client.request("tailscale.status");e.tailscaleStatus=S,S.loggedIn&&(clearInterval(b),e.tailscaleAuthUrl=null,e.tailscaleBusy=!1)}catch{}},3e3);setTimeout(()=>{clearInterval(b),e.tailscaleBusy&&(e.tailscaleBusy=!1)},3e5)}else h.alreadyLoggedIn&&(e.tailscaleStatus=await e.client.request("tailscale.status")),e.tailscaleBusy=!1}catch(h){console.error("Tailscale enable failed:",h),e.tailscaleBusy=!1}}},onTailscaleServeEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null;try{await e.client.request("tailscale.serve.enable")}catch(h){console.error("Tailscale serve enable failed:",h),e.tailscaleError=h.message||"Failed to enable Remote Access",e.tailscaleBusy=!1}}},onTailscaleServeDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.serve.disable")}catch(h){console.error("Tailscale serve disable failed:",h),e.tailscaleBusy=!1}}},onTailscaleFunnelEnable:async()=>{var h;if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null,e.tailscaleFunnelEnableUrl=null;try{await e.client.request("tailscale.funnel.enable")}catch(b){console.error("Tailscale funnel enable failed:",b);const S=b;(h=S.payload)!=null&&h.enableUrl&&(e.tailscaleFunnelEnableUrl=S.payload.enableUrl),e.tailscaleError=S.message||"Failed to enable Funnel",e.tailscaleBusy=!1}}},onTailscaleFunnelDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.funnel.disable")}catch(h){console.error("Tailscale funnel disable failed:",h),e.tailscaleBusy=!1}}},onTailscaleDisableConfirmToggle:()=>{e.tailscaleDisableConfirm=!e.tailscaleDisableConfirm},wifiStatus:e.wifiStatus,wifiNetworks:e.wifiNetworks,wifiBusy:e.wifiBusy,wifiError:e.wifiError,wifiPassword:e.wifiPassword,wifiSelectedSsid:e.wifiSelectedSsid,onWifiScan:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{const[h,b]=await Promise.all([e.client.request("wifi.scan"),e.client.request("wifi.status")]);e.wifiNetworks=h.networks,e.wifiStatus=b}catch(h){console.error("WiFi scan failed:",h),e.wifiError=h.message||"Failed to scan networks"}finally{e.wifiBusy=!1}}},onWifiConnect:async()=>{if(e.wifiBusy||!e.wifiSelectedSsid)return;const h=e.wifiSelectedSsid;e.wifiBusy=!0,e.wifiError=null;try{const b=await e.client.request("wifi.connect",{ssid:h,password:e.wifiPassword});e.wifiPassword="",e.wifiSelectedSsid=null,e.wifiNetworks=[],e.wifiStatus={available:!0,connected:b.connected,ssid:b.ssid,signal:null,ip:b.ip,savedSsid:b.ssid,autoconnect:!0},e.wifiBusy=!1;try{const S=await e.client.request("wifi.status");e.wifiStatus=S}catch{}}catch(b){console.error("WiFi connect failed:",b),e.wifiError=b.message||"Failed to connect",e.wifiBusy=!1}},onWifiDisconnect:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.disconnect"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const h=await e.client.request("wifi.status");e.wifiStatus=h}catch(h){console.error("WiFi disconnect failed:",h),e.wifiError=h.message||"Failed to disconnect"}finally{e.wifiBusy=!1}}},onWifiForget:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.forget"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const h=await e.client.request("wifi.status");e.wifiStatus=h}catch(h){console.error("WiFi forget failed:",h),e.wifiError=h.message||"Failed to forget network"}finally{e.wifiBusy=!1}}},onWifiDismiss:()=>{e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="",e.wifiError=null},onWifiSelectSsid:h=>{e.wifiSelectedSsid=h,e.wifiPassword="",e.wifiError=null},onWifiPasswordChange:h=>{e.wifiPassword=h},wsProps:dk(e)})}if(e.filesPage){const l=hk(e);return lg({connected:e.connected,wsProps:yn(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,currentDir:e.filesCurrentDir,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>Xt(e,l),onReindex:()=>xf(e,l),onSelectFile:p=>{e.filesPendingDeletePath=null,mf(e,p,l)},onToggleSelectFile:p=>yf(e,p,l),onToggleDir:p=>Af(e,p),onUpload:(p,f)=>wf(e,p,f,l),onNewFolder:(p,f)=>kf(e,p,f,l),onDownload:p=>od(e,p,l),onBulkDownload:()=>vf(e,l),onDelete:p=>{e.filesPendingDeletePath=null,$f(e,p,l)},pendingDeletePath:e.filesPendingDeletePath,onArmDelete:p=>{e.filesPendingDeletePath=p||null},onMoveToDir:(p,f)=>bf(e,p,f,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:p=>{const f=e.filesSearchAgentId??l;Cf(e,p,f)},onSearchAgentChange:p=>{e.filesSearchAgentId=p},onSearchClear:()=>{Ef(e)},onSearchQueryChange:p=>{e.filesSearchQuery=p}})}if(e.browserPage)return ng({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:()=>Mw(e),onStop:()=>Pw(e),onToggleInput:()=>Iw(e),onToggleFullscreen:()=>Rw(e),onCompleteHandoff:()=>Lw(e),onCanvasMouseDown:l=>{const f=l.target.getBoundingClientRect(),h=_n().translateCoordinates(l.clientX-f.left,l.clientY-f.top);Js(e,"mousePressed",h.x,h.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const f=l.target.getBoundingClientRect(),h=_n().translateCoordinates(l.clientX-f.left,l.clientY-f.top);Js(e,"mouseReleased",h.x,h.y)},onCanvasMouseMove:l=>{const p=_n();if(p.shouldThrottleMouseMove())return;const v=l.target.getBoundingClientRect(),h=p.translateCoordinates(l.clientX-v.left,l.clientY-v.top);Js(e,"mouseMoved",h.x,h.y)},onCanvasKeyDown:l=>{let p=0;l.altKey&&(p|=1),l.ctrlKey&&(p|=2),l.metaKey&&(p|=4),l.shiftKey&&(p|=8),Xs(e,"keyDown",l.key,{code:l.code,modifiers:p||void 0}),l.key.length===1&&Xs(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{Xs(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=uk(e),p=pk(e);return Ag({connected:e.connected,wsProps:yn(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>is(e,l),onAdd:f=>{Tu(e,f,l,p).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:f=>_u(e,f,l,p),onNewPhoneChange:f=>e.handleAdminsNewPhoneChange(f)})}if(e.contactsPage){const l=fk(e);return Pg({connected:e.connected,wsProps:yn(e),loading:e.contactsLoading,saving:e.contactsSaving,records:e.contactsRecords,error:e.contactsError,searchQuery:e.contactsSearchQuery,editingId:e.contactsEditingId,showAddForm:e.contactsShowAddForm,newRecordPhone:e.contactsNewPhone,newRecordName:e.contactsNewName,deleteConfirmId:e.contactsDeleteConfirmId,addFieldForId:e.contactsAddFieldForId,addFieldKey:e.contactsAddFieldKey,addFieldValue:e.contactsAddFieldValue,onSearch:p=>e.contactsSearchQuery=p,onSearchSubmit:()=>Tt(e,l),onAdd:(p,f)=>Mu(e,p,f,l),onDelete:p=>Pu(e,p,l),onSetField:(p,f,v)=>Mo(e,p,f,v,l),onDeleteField:(p,f)=>Lu(e,p,f,l),onToggleExpand:p=>{e.contactsEditingId=e.contactsEditingId===p?null:p},onShowAddForm:()=>e.contactsShowAddForm=!0,onCancelAddForm:()=>{e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName=""},onNewRecordPhoneChange:p=>e.handleContactsNewPhoneChange(p),onNewRecordNameChange:p=>e.handleContactsNewNameChange(p),onRefresh:()=>Tt(e,l),onDeleteConfirmOpen:p=>e.contactsDeleteConfirmId=p,onDeleteConfirmClose:()=>e.contactsDeleteConfirmId=null,onAddFieldOpen:p=>{e.contactsAddFieldForId=p,e.contactsAddFieldKey="",e.contactsAddFieldValue=""},onAddFieldClose:()=>{e.contactsAddFieldForId=null,e.contactsAddFieldKey="",e.contactsAddFieldValue=""},onAddFieldKeyChange:p=>e.contactsAddFieldKey=p,onAddFieldValueChange:p=>e.contactsAddFieldValue=p,onAddFieldSubmit:()=>{const p=e.contactsAddFieldForId,f=e.contactsAddFieldKey.trim();!p||!f||(Mo(e,p,f,e.contactsAddFieldValue,l),e.contactsAddFieldForId=null,e.contactsAddFieldKey="",e.contactsAddFieldValue="")}})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",p=Nl(e),f=e.chatAvatarUrl??p??null,v=(()=>{var S;const h=(S=e.configSnapshot)==null?void 0:S.config,b=h==null?void 0:h.publicChat;return(b==null?void 0:b.enabled)===!0})();return Mb({connected:e.connected,wsProps:yn(e),publicChatEnabled:v,publicChatAccountId:e.selectedWorkspace??void 0,sessionKey:e.sessionKey,onSessionKeyChange:h=>{const b=e.selectedWorkspace??"";so(),In(b,e.sessionKey,e.chatMessage),e.sessionKey=h,e.chatMessage=Rn(b,h),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:h,lastActiveSessionKey:h}),e.loadAssistantIdentity(),De(e),po(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:h=>{const b=Math.max(e.chatMessages.length+10,Be);ti(e,e.sessionKey,{model:h}).then(()=>{De(e,{limit:b})})},onThinkingLevelChange:h=>{const b=Math.max(e.chatMessages.length+10,Be);ti(e,e.sessionKey,{thinkingLevel:h==="off"?null:h}).then(()=>{De(e,{limit:b})})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:h=>{e.chatMessage=h,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:h=>{const b=Math.max(e.chatMessages.length+10,Be);ti(e,e.sessionKey,{verboseLevel:h==="off"?null:h}).then(()=>{De(e,{limit:b})})},onFillerChange:h=>{const b=Math.max(e.chatMessages.length+10,Be);ti(e,e.sessionKey,{fillerEnabled:h}).then(()=>{De(e,{limit:b})})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:f,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();const h=Math.max(e.chatMessages.length+10,Be);return Promise.all([De(e,{limit:h}),po(e)])},onToggleFocusMode:()=>{},onChatScroll:h=>e.handleChatScroll(h),nearBottom:e.chatUserNearBottom,hasMore:e.chatHistoryHasMore,loadingOlder:e.chatLoadingOlder,onLoadOlder:()=>{e.handleLoadOlderChat()},onDraftChange:h=>{e.chatMessage=h,sr(e.selectedWorkspace??"",e.sessionKey,h)},requestUpdate:()=>e.requestUpdate(),attachments:e.chatAttachments,onAttachmentsChange:h=>e.chatAttachments=h,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:h=>e.removeQueuedMessage(h),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:h=>e.handleOpenSidebar(h),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:h=>e.handleSplitRatioChange(h),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?yw({connected:e.connected,wsProps:yn(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&Ve(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?xn(e,{reset:!0}):zt(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(a=(o=e.channelsSnapshot)==null?void 0:o.channelMeta)!=null&&a.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((r=e.channelsSnapshot)==null?void 0:r.channelOrder)??[],channelLabels:((d=e.channelsSnapshot)==null?void 0:d.channelLabels)??{},channelMeta:((c=e.channelsSnapshot)==null?void 0:c.channelMeta)??[],agentIds:(()=>{var p;const l=re(e);return((p=l==null?void 0:l.agents)==null?void 0:p.map(f=>f.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1,e.cronEditJobId=null},detailJobId:e.cronDetailJobId,editJobId:e.cronEditJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,ao(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onEdit:l=>{e.cronForm=wh(l),e.cronEditJobId=l.id,e.cronDetailJobId=null},onEditSave:()=>{const l=e.cronEditJobId;l&&kh(e,l).then(()=>{e.cronEditJobId=null})},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{gh(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,p)=>mh(e,l,p),onRun:l=>yh(e,l),onRemove:l=>{e.cronPendingDeleteId=null,bh(e,l)},pendingDeleteId:e.cronPendingDeleteId,onArmDelete:l=>{e.cronPendingDeleteId=l||null},onLoadRuns:l=>ao(e,l),runModalJobId:e.cronRunModalJobId,runModalJobName:e.cronRunModalJobName,runResult:e.cronRunResult,onRunModalClose:()=>{e.cronRunModalJobId=null,e.cronRunModalJobName="",e.cronRunResult=null}},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,typeFilter:e.skillsTypeFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,detail:e.skillDetail,detailTab:e.skillDetailTab,addModal:e.skillAddModal,addForm:e.skillAddForm,formSource:e.skillAddFormSource,editTab:e.skillEditTab,drafts:e.skillDrafts,onFilterChange:l=>e.skillsFilter=l,onTypeFilterChange:l=>e.skillsTypeFilter=l,onRefresh:()=>Ve(e,{clearMessages:!0}),onToggle:(l,p)=>Nc(e,l,p),onEdit:(l,p)=>Bc(e,l,p),onSaveKey:l=>Fc(e,l),onInstall:(l,p,f)=>Oc(e,l,p,f),onViewDetail:l=>Uc(e,l),onDetailClose:()=>Kc(e),onDetailTab:l=>Wc(e,l),onAddOpen:()=>zc(e),onAddClose:()=>qc(e),onImportDraft:l=>Hc(e,l),onInstallDraft:l=>jc(e,l),onDeleteDraft:l=>Vc(e,l),onAddSave:()=>Go(e),onAddFormUpdate:(l,p)=>{e.skillAddForm={...e.skillAddForm,[l]:p}},onDelete:l=>Xc(e,l),onEditSkill:l=>Gc(e,l),onEditDetail:l=>Qc(e,l),onRefUpdate:(l,p)=>Yc(e,l,p),onEditTab:l=>Jc(e,l)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?xn(e,{reset:!0}):zt(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,chipsExpanded:e.sessionLogsChipsExpanded,expandedIds:e.sessionLogsExpandedIds,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,p)=>{const f=e;f.sessionLogsTypeFilters={...f.sessionLogsTypeFilters,[l]:p}},onAgentToggle:(l,p)=>{const f=e;f.sessionLogsAgentFilters={...f.sessionLogsAgentFilters,[l]:p}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onToggleChips:()=>{const l=e;l.sessionLogsChipsExpanded=!l.sessionLogsChipsExpanded},onToggleExpand:l=>{const p=e,f=new Set(p.sessionLogsExpandedIds);f.has(l)?f.delete(l):f.add(l),p.sessionLogsExpandedIds=f,p.requestUpdate()},onRefresh:()=>{xn(e,{reset:!0})},onExport:(l,p)=>e.exportSessionLogs(l,p),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,chipsExpanded:e.logsChipsExpanded,truncated:e.logsTruncated,onFilterTextChange:l=>e.logsFilterText=l,onLevelToggle:(l,p)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:p}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onToggleChips:()=>{const l=e;l.logsChipsExpanded=!l.logsChipsExpanded},onRefresh:()=>zt(e,{reset:!0}),onExport:(l,p)=>e.exportSessionLogs(l,p),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),u``)}function kk(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 Fl(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function $k(e,t,n){return u`
|
|
4077
|
+
`;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return Cl({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(p,h)=>{h!=null&&e.handlePinSubmit(p,h)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(p,h,v)=>e.handleChangePin(p,h,v)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return Cl({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:p=>e.handleSetMasterPin(p)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",k}if(e.setup){const l=yk(e.channelsSnapshot),p=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],h=vk(e.channelsSnapshot),v=bk(e),S=async()=>{e.tailscaleStatus=await e.client.request("tailscale.status")};return Sg({connected:e.connected,serverPlatform:((s=(i=e.hello)==null?void 0:i.server)==null?void 0:s.platform)??null,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:f=>e.handleLicenseKeyChange(f),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:p,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:f=>e.handleUninstallConfirmTextChange(f),onUninstallRun:()=>e.handleUninstallRun(),onUninstallDismiss:()=>e.handleUninstallDismiss(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:f=>e.handleAuthSubmitCode(f),onAuthCodeChange:f=>e.handleAuthCodeChange(f),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async f=>{await e.handleWhatsAppStart(!0,f),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(f),await J(e,!0),e.requestUpdate())},onWhatsAppUnlink:async f=>{await e.handleWhatsAppLogout(f)},onWhatsAppReset:async f=>{await e.handleWhatsAppLogout(f),await e.handleWhatsAppStart(!0,f),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(f),await J(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await J(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),J(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:f=>e.handleRemoveWhatsAppAccount(f),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:f=>{e.newWorkspacePin=f},onWorkspaceCreate:async(f,w)=>{const b=e.newWorkspacePin;await e.handleWorkspaceCreate(f,w),b.match(/^\d{4,6}$/)&&(await ok(e,f,b),e.newWorkspacePin="")},onWorkspaceRemove:f=>e.handleWorkspaceRemove(f),onSetAddingWorkspace:f=>{e.addingWorkspace=f},onSetNewWorkspaceName:f=>{e.newWorkspaceName=f},onSetNewWorkspacePath:f=>{e.newWorkspacePath=f},onSetWorkspaceRemoveConfirm:f=>{e.workspaceRemoveConfirm=f},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(f,w)=>e.handleWorkspaceRename(f,w),whatsappDmPolicy:(()=>{const f=le(e),w=f==null?void 0:f.whatsappAccountId,b=w?p.find(x=>x.accountId===w):p[0];return(b==null?void 0:b.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var P;const f=le(e),w=f==null?void 0:f.whatsappAccountId,b=w?p.find(_=>_.accountId===w):p[0];if(!b)return;const C=b.dmPolicy!=null&&b.dmPolicy!=="disabled"?"disabled":"open",T=C==="open"?{dmPolicy:C,allowFrom:["*"]}:{dmPolicy:C};try{const _=await e.client.request("config.get"),N=_.config,H=(P=N==null?void 0:N.channels)==null?void 0:P.whatsapp,be=((H==null?void 0:H.accounts)??{})[b.accountId]?{channels:{whatsapp:{accounts:{[b.accountId]:T}}}}:{channels:{whatsapp:T}};await e.client.request("config.patch",{raw:JSON.stringify(be),baseHash:_.hash,note:`WhatsApp DM policy → ${C}`,skipRestart:!0}),await J(e,!1)}catch(_){console.error("DM toggle failed:",_)}},whatsappModel:(()=>{var P,_;const f=le(e);if(!f)return null;const w=f.agents.find(N=>N.id.endsWith("-public")||N.id==="public");if(!w)return null;const b=(P=e.configSnapshot)==null?void 0:P.config,x=(_=b==null?void 0:b.agents)==null?void 0:_.list;if(!Array.isArray(x))return null;const C=x.find(N=>N.id===w.id);if(!(C!=null&&C.model))return null;const T=typeof C.model=="string"?C.model:C.model.primary;return(T==null?void 0:T.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async f=>{const w=le(e);if(!w)return;const b=w.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(b)try{const x=await e.client.request("config.get"),C=x.config,T=(C==null?void 0:C.agents)??{},P=Array.isArray(T.list)?[...T.list]:[],_=P.findIndex(H=>H.id===b.id);if(f)_>=0?P[_]={...P[_],model:f}:P.push({id:b.id,model:f});else if(_>=0){const{model:H,...ie}=P[_];Object.keys(ie).length<=1?P.splice(_,1):P[_]=ie}const N=P.length>0?{agents:{list:P}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(N),baseHash:x.hash,note:`Public agent model → ${f||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Model change failed:",x)}},whatsappThinkingLevel:(()=>{var T,P,_;const f=le(e);if(!f)return null;const w=f.agents.find(N=>N.id.endsWith("-public")||N.id==="public");if(!w)return null;const b=(T=e.configSnapshot)==null?void 0:T.config,x=(P=b==null?void 0:b.agents)==null?void 0:P.list;if(!Array.isArray(x))return null;const C=x.find(N=>N.id===w.id);return((_=C==null?void 0:C.thinkingLevel)==null?void 0:_.trim())||null})(),onWhatsAppThinkingChange:async f=>{const w=le(e);if(!w)return;const b=w.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(b)try{const x=await e.client.request("config.get"),C=x.config,T=(C==null?void 0:C.agents)??{},P=Array.isArray(T.list)?[...T.list]:[],_=P.findIndex(ie=>ie.id===b.id),N=f==="off"?void 0:f;if(N)_>=0?P[_]={...P[_],thinkingLevel:N}:P.push({id:b.id,thinkingLevel:N});else if(_>=0){const{thinkingLevel:ie,...be}=P[_];Object.keys(be).length<=1?P.splice(_,1):P[_]=be}const H=P.length>0?{agents:{list:P}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(H),baseHash:x.hash,note:`Public agent thinking → ${N||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Thinking change failed:",x)}},whatsappGroupPolicy:(()=>{var _,N;const f=(_=e.configSnapshot)==null?void 0:_.config,w=(N=f==null?void 0:f.channels)==null?void 0:N.whatsapp,b=le(e),x=b==null?void 0:b.whatsappAccountId,C=(w==null?void 0:w.accounts)??{},T=x?C[x]:void 0;return(T==null?void 0:T.groupPolicy)??(w==null?void 0:w.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var N,H;const f=(N=e.configSnapshot)==null?void 0:N.config,w=(H=f==null?void 0:f.channels)==null?void 0:H.whatsapp,b=le(e),x=b==null?void 0:b.whatsappAccountId,C=(w==null?void 0:w.accounts)??{},T=x?C[x]:void 0,_=((T==null?void 0:T.groups)??(w==null?void 0:w.groups)??{})["*"];return(_==null?void 0:_.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var b;const f=le(e),w=f==null?void 0:f.whatsappAccountId;try{const x=await e.client.request("config.get"),C=x.config,T=((b=C==null?void 0:C.channels)==null?void 0:b.whatsapp)??{},P=T.accounts??{},_=w?P[w]:void 0,N=(_==null?void 0:_.groupPolicy)??T.groupPolicy??"allowlist",H=N==="disabled"||N==="allowlist",ie=H?"open":"disabled",be=H?{"*":{}}:void 0,X={groupPolicy:ie};be&&(X.groups=be);const rt=_?{channels:{whatsapp:{accounts:{[w]:X}}}}:{channels:{whatsapp:X}};await e.client.request("config.patch",{raw:JSON.stringify(rt),baseHash:x.hash,note:`WhatsApp groups → ${ie}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Group toggle failed:",x)}},onWhatsAppGroupMentionChange:async f=>{var x;const w=le(e),b=w==null?void 0:w.whatsappAccountId;try{const C=await e.client.request("config.get"),T=C.config,_=(((x=T==null?void 0:T.channels)==null?void 0:x.whatsapp)??{}).accounts??{},N=b?_[b]:void 0,H={"*":{requireMention:f}},ie=N?{channels:{whatsapp:{accounts:{[b]:{groups:H}}}}}:{channels:{whatsapp:{groups:H}}};await e.client.request("config.patch",{raw:JSON.stringify(ie),baseHash:C.hash,note:`WhatsApp group mention → ${f?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(C){console.error("Group mention change failed:",C)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:h.configured,imessageRunning:h.running,imessageConnected:h.connected,imessageLastError:h.lastError,imessageSelfChatMode:h.selfChatMode,imessageCliPath:h.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:v,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),w=f.config,b=(w==null?void 0:w.bindings)??[],x=le(e),C=x==null?void 0:x.agents.find(H=>H.id.endsWith("-admin")||H.id==="admin"),T=(C==null?void 0:C.id)??"admin",P=b.filter(H=>{var ie;return((ie=H.match)==null?void 0:ie.channel)!=="imessage"}),_=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],N=[...P,..._];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:N}),baseHash:f.hash,note:"Enable iMessage (self-chat) for "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([J(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await J(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),w=f.config,x=((w==null?void 0:w.bindings)??[]).filter(C=>{var T;return((T=C.match)==null?void 0:T.channel)!=="imessage"});await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:x}),baseHash:f.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([J(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),w=f.config,b=(w==null?void 0:w.bindings)??[],x=le(e),C=x==null?void 0:x.agents.find(N=>N.id.endsWith("-admin")||N.id==="admin"),T=(C==null?void 0:C.id)??"admin",P=b.filter(N=>{var H;return((H=N.match)==null?void 0:H.channel)!=="imessage"}),_=[{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:[...P,..._]}),baseHash:f.hash,note:"Reassign iMessage to "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([J(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:f=>{e.infoModalOpen=f},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(f,w)=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await _l(e.client,f,w);const b=`${f} key saved`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}f==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===b&&(e.apiKeySuccess=null)},2500)}catch(b){e.apiKeyError=b instanceof Error?b.message:"Failed to save key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async f=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Fw(e.client,f);const w=`${f} key removed`;e.apiKeySuccess=w,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===w&&(e.apiKeySuccess=null)},2500)}catch(w){e.apiKeyError=w instanceof Error?w.message:"Failed to remove key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyDisable:async(f,w)=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Ow(e.client,f,w);const b=`${f} ${w?"disabled":"enabled"}`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===b&&(e.apiKeySuccess=null)},2500)}catch(b){e.apiKeyError=b instanceof Error?b.message:`Failed to ${w?"disable":"enable"} 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:f=>{e.authApiKeyInput=f},onAuthApiKeySubmit:async()=>{const f=e.authApiKeyInput.trim();if(f){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await _l(e.client,"anthropic",f),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(w){e.authApiKeyError=w instanceof Error?w.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{var w;const f=e.selectedWorkspace??((w=e.workspaces[0])==null?void 0:w.name);return f?e.accessState.accounts.some(b=>b.id===f):!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:(f,w)=>{var x;const b=e.selectedWorkspace??((x=e.workspaces[0])==null?void 0:x.name);b&&e.handleAccountPinSave(b,f,w)},publicChatEnabled:(()=>{var b;const f=(b=e.configSnapshot)==null?void 0:b.config,w=f==null?void 0:f.publicChat;return(w==null?void 0:w.enabled)===!0})(),publicChatAuthMode:(()=>{var x;const f=(x=e.configSnapshot)==null?void 0:x.config,w=f==null?void 0:f.publicChat,b=w==null?void 0:w.auth;return b==="verified"||b==="choice"?b:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var f;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const w=await e.client.request("config.get"),b=w.config,x=((f=b==null?void 0:b.publicChat)==null?void 0:f.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!x}}),baseHash:w.hash,note:`Public chat → ${x?"disabled":"enabled"}`}),e.configSnapshot=await e.client.request("config.get")}catch(w){console.error("Public chat toggle failed:",w)}finally{e.publicChatToggleBusy=!1}}},onPublicChatAuthModeChange:async f=>{if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const w=await e.client.request("config.get");await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{auth:f}}),baseHash:w.hash,note:`Public chat auth → ${f}`}),e.configSnapshot=await e.client.request("config.get")}catch(w){console.error("Public chat auth mode change failed:",w)}finally{e.publicChatToggleBusy=!1}}},brandAccentColor:(()=>{var b;const f=e.selectedWorkspace;return f?((b=Re()[f])==null?void 0:b.accentColor)??"":""})(),brandBackgroundColor:(()=>{var b;const f=e.selectedWorkspace;return f?((b=Re()[f])==null?void 0:b.backgroundColor)??"":""})(),brandHasLogo:(()=>{var b;const f=e.selectedWorkspace;return f?!!((b=Re()[f])!=null&&b.logoUrl):!1})(),brandingBusy:e.brandingBusy,brandingExpanded:e.brandingExpanded,onBrandingToggle:()=>{e.brandingExpanded=!e.brandingExpanded},onBrandAccentColorChange:async f=>{var b;const w=e.selectedWorkspace;if(!(!w||e.brandingBusy)){e.brandingBusy=!0;try{const x=await e.client.request("config.get"),C=x.config,T=((b=C==null?void 0:C.workspaces)==null?void 0:b[w])??{},P=T.brand??{};await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[w]:{...T,brand:{...P,accentColor:f}}}}),baseHash:x.hash,note:`Brand accent → ${f}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");const _=Re();_[w]||(_[w]={}),_[w].accentColor=f,kn(w)}catch(x){console.error("Brand accent change failed:",x)}finally{e.brandingBusy=!1}}},onBrandBackgroundColorChange:async f=>{var b;const w=e.selectedWorkspace;if(!(!w||e.brandingBusy)){e.brandingBusy=!0;try{const x=await e.client.request("config.get"),C=x.config,T=((b=C==null?void 0:C.workspaces)==null?void 0:b[w])??{},P=T.brand??{};await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[w]:{...T,brand:{...P,backgroundColor:f}}}}),baseHash:x.hash,note:`Brand background → ${f}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");const _=Re();_[w]||(_[w]={}),_[w].backgroundColor=f,kn(w)}catch(x){console.error("Brand background change failed:",x)}finally{e.brandingBusy=!1}}},onBrandLogoUpload:async f=>{const w=e.selectedWorkspace;if(!(!w||e.brandingBusy)){e.brandingBusy=!0;try{const b=await f.arrayBuffer(),x=new Uint8Array(b);let C="";for(let _=0;_<x.length;_++)C+=String.fromCharCode(x[_]);const T=btoa(C);await e.client.request("brand.uploadLogo",{workspace:w,data:T,mimeType:f.type});const P=Re();P[w]||(P[w]={}),P[w].logoUrl=`/brand-logo/${encodeURIComponent(w)}`}catch(b){console.error("Brand logo upload failed:",b)}finally{e.brandingBusy=!1}}},onBrandLogoRemove:async()=>{const f=e.selectedWorkspace;if(!(!f||e.brandingBusy)){e.brandingBusy=!0;try{await e.client.request("brand.removeLogo",{workspace:f});const w=Re();w[f]&&delete w[f].logoUrl}catch(w){console.error("Brand logo remove failed:",w)}finally{e.brandingBusy=!1}}},onBrandReset:async()=>{var w;const f=e.selectedWorkspace;if(!(!f||e.brandingBusy)){e.brandingBusy=!0;try{const b=await e.client.request("config.get"),x=b.config,C=((w=x==null?void 0:x.workspaces)==null?void 0:w[f])??{},{brand:T,...P}=C;await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[f]:{...P,brand:null}}}),baseHash:b.hash,note:"Brand reset to defaults",skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");try{await e.client.request("brand.removeLogo",{workspace:f})}catch{}const _=Re();delete _[f],kn(f)}catch(b){console.error("Brand reset failed:",b)}finally{e.brandingBusy=!1}}},tailscaleStatus:e.tailscaleStatus,tailscaleBusy:e.tailscaleBusy,tailscaleAuthUrl:e.tailscaleAuthUrl,tailscaleError:e.tailscaleError,tailscaleFunnelEnableUrl:e.tailscaleFunnelEnableUrl,tailscaleDisableConfirm:e.tailscaleDisableConfirm,onTailscaleEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleAuthUrl=null;try{const f=await e.client.request("tailscale.enable");if(f.authUrl){e.tailscaleAuthUrl=f.authUrl;const w=setInterval(async()=>{try{const b=await e.client.request("tailscale.status");e.tailscaleStatus=b,b.loggedIn&&(clearInterval(w),e.tailscaleAuthUrl=null,e.tailscaleBusy=!1)}catch{}},3e3);setTimeout(()=>{clearInterval(w),e.tailscaleBusy&&(e.tailscaleBusy=!1)},3e5)}else f.alreadyLoggedIn&&(e.tailscaleStatus=await e.client.request("tailscale.status")),e.tailscaleBusy=!1}catch(f){console.error("Tailscale enable failed:",f),e.tailscaleBusy=!1}}},onTailscaleServeEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null;try{await e.client.request("tailscale.serve.enable"),await S()}catch(f){console.error("Tailscale serve enable failed:",f),e.tailscaleError=f.message||"Failed to enable Remote Access"}finally{e.tailscaleBusy=!1}}},onTailscaleServeDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.serve.disable"),await S()}catch(f){console.error("Tailscale serve disable failed:",f)}finally{e.tailscaleBusy=!1}}},onTailscaleFunnelEnable:async()=>{var f;if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null,e.tailscaleFunnelEnableUrl=null;try{await e.client.request("tailscale.funnel.enable"),await S()}catch(w){console.error("Tailscale funnel enable failed:",w);const b=w;(f=b.payload)!=null&&f.enableUrl&&(e.tailscaleFunnelEnableUrl=b.payload.enableUrl),e.tailscaleError=b.message||"Failed to enable Funnel"}finally{e.tailscaleBusy=!1}}},onTailscaleFunnelDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.funnel.disable"),await S()}catch(f){console.error("Tailscale funnel disable failed:",f)}finally{e.tailscaleBusy=!1}}},onTailscaleDisableConfirmToggle:()=>{e.tailscaleDisableConfirm=!e.tailscaleDisableConfirm},wifiStatus:e.wifiStatus,wifiNetworks:e.wifiNetworks,wifiBusy:e.wifiBusy,wifiError:e.wifiError,wifiPassword:e.wifiPassword,wifiSelectedSsid:e.wifiSelectedSsid,onWifiScan:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{const[f,w]=await Promise.all([e.client.request("wifi.scan"),e.client.request("wifi.status")]);e.wifiNetworks=f.networks,e.wifiStatus=w}catch(f){console.error("WiFi scan failed:",f),e.wifiError=f.message||"Failed to scan networks"}finally{e.wifiBusy=!1}}},onWifiConnect:async()=>{if(e.wifiBusy||!e.wifiSelectedSsid)return;const f=e.wifiSelectedSsid;e.wifiBusy=!0,e.wifiError=null;try{const w=await e.client.request("wifi.connect",{ssid:f,password:e.wifiPassword});e.wifiPassword="",e.wifiSelectedSsid=null,e.wifiNetworks=[],e.wifiStatus={available:!0,connected:w.connected,ssid:w.ssid,signal:null,ip:w.ip,savedSsid:w.ssid,autoconnect:!0},e.wifiBusy=!1;try{const b=await e.client.request("wifi.status");e.wifiStatus=b}catch{}}catch(w){console.error("WiFi connect failed:",w),e.wifiError=w.message||"Failed to connect",e.wifiBusy=!1}},onWifiDisconnect:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.disconnect"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi disconnect failed:",f),e.wifiError=f.message||"Failed to disconnect"}finally{e.wifiBusy=!1}}},onWifiForget:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.forget"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi forget failed:",f),e.wifiError=f.message||"Failed to forget network"}finally{e.wifiBusy=!1}}},onWifiDismiss:()=>{e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="",e.wifiError=null},onWifiSelectSsid:f=>{e.wifiSelectedSsid=f,e.wifiPassword="",e.wifiError=null},onWifiPasswordChange:f=>{e.wifiPassword=f},wsProps:dk(e)})}if(e.filesPage){const l=hk(e);return lg({connected:e.connected,wsProps:yn(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,currentDir:e.filesCurrentDir,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>Zt(e,l),onReindex:()=>xf(e,l),onSelectFile:p=>{e.filesPendingDeletePath=null,mf(e,p,l)},onToggleSelectFile:p=>yf(e,p,l),onToggleDir:p=>Af(e,p),onUpload:(p,h)=>wf(e,p,h,l),onNewFolder:(p,h)=>kf(e,p,h,l),onDownload:p=>od(e,p,l),onBulkDownload:()=>vf(e,l),onDelete:p=>{e.filesPendingDeletePath=null,$f(e,p,l)},pendingDeletePath:e.filesPendingDeletePath,onArmDelete:p=>{e.filesPendingDeletePath=p||null},onMoveToDir:(p,h)=>bf(e,p,h,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:p=>{const h=e.filesSearchAgentId??l;Cf(e,p,h)},onSearchAgentChange:p=>{e.filesSearchAgentId=p},onSearchClear:()=>{Ef(e)},onSearchQueryChange:p=>{e.filesSearchQuery=p}})}if(e.browserPage)return ng({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:()=>Mw(e),onStop:()=>Pw(e),onToggleInput:()=>Iw(e),onToggleFullscreen:()=>Rw(e),onCompleteHandoff:()=>Lw(e),onCanvasMouseDown:l=>{const h=l.target.getBoundingClientRect(),S=_n().translateCoordinates(l.clientX-h.left,l.clientY-h.top);Js(e,"mousePressed",S.x,S.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const h=l.target.getBoundingClientRect(),S=_n().translateCoordinates(l.clientX-h.left,l.clientY-h.top);Js(e,"mouseReleased",S.x,S.y)},onCanvasMouseMove:l=>{const p=_n();if(p.shouldThrottleMouseMove())return;const v=l.target.getBoundingClientRect(),S=p.translateCoordinates(l.clientX-v.left,l.clientY-v.top);Js(e,"mouseMoved",S.x,S.y)},onCanvasKeyDown:l=>{let p=0;l.altKey&&(p|=1),l.ctrlKey&&(p|=2),l.metaKey&&(p|=4),l.shiftKey&&(p|=8),Xs(e,"keyDown",l.key,{code:l.code,modifiers:p||void 0}),l.key.length===1&&Xs(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{Xs(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=uk(e),p=pk(e);return Ag({connected:e.connected,wsProps:yn(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>is(e,l),onAdd:h=>{Tu(e,h,l,p).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:h=>_u(e,h,l,p),onNewPhoneChange:h=>e.handleAdminsNewPhoneChange(h)})}if(e.contactsPage){const l=fk(e);return Pg({connected:e.connected,wsProps:yn(e),loading:e.contactsLoading,saving:e.contactsSaving,records:e.contactsRecords,error:e.contactsError,searchQuery:e.contactsSearchQuery,editingId:e.contactsEditingId,showAddForm:e.contactsShowAddForm,newRecordPhone:e.contactsNewPhone,newRecordName:e.contactsNewName,deleteConfirmId:e.contactsDeleteConfirmId,addFieldForId:e.contactsAddFieldForId,addFieldKey:e.contactsAddFieldKey,addFieldValue:e.contactsAddFieldValue,onSearch:p=>e.contactsSearchQuery=p,onSearchSubmit:()=>_t(e,l),onAdd:(p,h)=>Mu(e,p,h,l),onDelete:p=>Pu(e,p,l),onSetField:(p,h,v)=>Mo(e,p,h,v,l),onDeleteField:(p,h)=>Lu(e,p,h,l),onToggleExpand:p=>{e.contactsEditingId=e.contactsEditingId===p?null:p},onShowAddForm:()=>e.contactsShowAddForm=!0,onCancelAddForm:()=>{e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName=""},onNewRecordPhoneChange:p=>e.handleContactsNewPhoneChange(p),onNewRecordNameChange:p=>e.handleContactsNewNameChange(p),onRefresh:()=>_t(e,l),onDeleteConfirmOpen:p=>e.contactsDeleteConfirmId=p,onDeleteConfirmClose:()=>e.contactsDeleteConfirmId=null,onAddFieldOpen:p=>{e.contactsAddFieldForId=p,e.contactsAddFieldKey="",e.contactsAddFieldValue=""},onAddFieldClose:()=>{e.contactsAddFieldForId=null,e.contactsAddFieldKey="",e.contactsAddFieldValue=""},onAddFieldKeyChange:p=>e.contactsAddFieldKey=p,onAddFieldValueChange:p=>e.contactsAddFieldValue=p,onAddFieldSubmit:()=>{const p=e.contactsAddFieldForId,h=e.contactsAddFieldKey.trim();!p||!h||(Mo(e,p,h,e.contactsAddFieldValue,l),e.contactsAddFieldForId=null,e.contactsAddFieldKey="",e.contactsAddFieldValue="")}})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",p=Nl(e),h=e.chatAvatarUrl??p??null,v=(()=>{var w;const S=(w=e.configSnapshot)==null?void 0:w.config,f=S==null?void 0:S.publicChat;return(f==null?void 0:f.enabled)===!0})();return Mb({connected:e.connected,wsProps:yn(e),publicChatEnabled:v,publicChatAccountId:e.selectedWorkspace??void 0,sessionKey:e.sessionKey,onSessionKeyChange:S=>{const f=e.selectedWorkspace??"";so(),In(f,e.sessionKey,e.chatMessage),e.sessionKey=S,e.chatMessage=Rn(f,S),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:S,lastActiveSessionKey:S}),e.loadAssistantIdentity(),Be(e),po(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:S=>{const f=Math.max(e.chatMessages.length+10,Ne);ti(e,e.sessionKey,{model:S}).then(()=>{Be(e,{limit:f})})},onThinkingLevelChange:S=>{const f=Math.max(e.chatMessages.length+10,Ne);ti(e,e.sessionKey,{thinkingLevel:S==="off"?null:S}).then(()=>{Be(e,{limit:f})})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:S=>{e.chatMessage=S,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:S=>{const f=Math.max(e.chatMessages.length+10,Ne);ti(e,e.sessionKey,{verboseLevel:S==="off"?null:S}).then(()=>{Be(e,{limit:f})})},onFillerChange:S=>{const f=Math.max(e.chatMessages.length+10,Ne);ti(e,e.sessionKey,{fillerEnabled:S}).then(()=>{Be(e,{limit:f})})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:h,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();const S=Math.max(e.chatMessages.length+10,Ne);return Promise.all([Be(e,{limit:S}),po(e)])},onToggleFocusMode:()=>{},onChatScroll:S=>e.handleChatScroll(S),nearBottom:e.chatUserNearBottom,hasMore:e.chatHistoryHasMore,loadingOlder:e.chatLoadingOlder,onLoadOlder:()=>{e.handleLoadOlderChat()},onDraftChange:S=>{e.chatMessage=S,sr(e.selectedWorkspace??"",e.sessionKey,S)},requestUpdate:()=>e.requestUpdate(),attachments:e.chatAttachments,onAttachmentsChange:S=>e.chatAttachments=S,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:S=>e.removeQueuedMessage(S),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:S=>e.handleOpenSidebar(S),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:S=>e.handleSplitRatioChange(S),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?yw({connected:e.connected,wsProps:yn(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&Ge(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?xn(e,{reset:!0}):qt(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(a=(o=e.channelsSnapshot)==null?void 0:o.channelMeta)!=null&&a.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((r=e.channelsSnapshot)==null?void 0:r.channelOrder)??[],channelLabels:((d=e.channelsSnapshot)==null?void 0:d.channelLabels)??{},channelMeta:((c=e.channelsSnapshot)==null?void 0:c.channelMeta)??[],agentIds:(()=>{var p;const l=le(e);return((p=l==null?void 0:l.agents)==null?void 0:p.map(h=>h.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1,e.cronEditJobId=null},detailJobId:e.cronDetailJobId,editJobId:e.cronEditJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,ao(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onEdit:l=>{e.cronForm=wh(l),e.cronEditJobId=l.id,e.cronDetailJobId=null},onEditSave:()=>{const l=e.cronEditJobId;l&&kh(e,l).then(()=>{e.cronEditJobId=null})},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{gh(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,p)=>mh(e,l,p),onRun:l=>yh(e,l),onRemove:l=>{e.cronPendingDeleteId=null,bh(e,l)},pendingDeleteId:e.cronPendingDeleteId,onArmDelete:l=>{e.cronPendingDeleteId=l||null},onLoadRuns:l=>ao(e,l),runModalJobId:e.cronRunModalJobId,runModalJobName:e.cronRunModalJobName,runResult:e.cronRunResult,onRunModalClose:()=>{e.cronRunModalJobId=null,e.cronRunModalJobName="",e.cronRunResult=null}},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,typeFilter:e.skillsTypeFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,detail:e.skillDetail,detailTab:e.skillDetailTab,addModal:e.skillAddModal,addForm:e.skillAddForm,formSource:e.skillAddFormSource,editTab:e.skillEditTab,drafts:e.skillDrafts,onFilterChange:l=>e.skillsFilter=l,onTypeFilterChange:l=>e.skillsTypeFilter=l,onRefresh:()=>Ge(e,{clearMessages:!0}),onToggle:(l,p)=>Nc(e,l,p),onEdit:(l,p)=>Bc(e,l,p),onSaveKey:l=>Fc(e,l),onInstall:(l,p,h)=>Oc(e,l,p,h),onViewDetail:l=>Uc(e,l),onDetailClose:()=>Kc(e),onDetailTab:l=>Wc(e,l),onAddOpen:()=>zc(e),onAddClose:()=>qc(e),onImportDraft:l=>Hc(e,l),onInstallDraft:l=>jc(e,l),onDeleteDraft:l=>Vc(e,l),onAddSave:()=>Go(e),onAddFormUpdate:(l,p)=>{e.skillAddForm={...e.skillAddForm,[l]:p}},onDelete:l=>Xc(e,l),onEditSkill:l=>Gc(e,l),onEditDetail:l=>Qc(e,l),onRefUpdate:(l,p)=>Yc(e,l,p),onEditTab:l=>Jc(e,l)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?xn(e,{reset:!0}):qt(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,chipsExpanded:e.sessionLogsChipsExpanded,expandedIds:e.sessionLogsExpandedIds,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,p)=>{const h=e;h.sessionLogsTypeFilters={...h.sessionLogsTypeFilters,[l]:p}},onAgentToggle:(l,p)=>{const h=e;h.sessionLogsAgentFilters={...h.sessionLogsAgentFilters,[l]:p}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onToggleChips:()=>{const l=e;l.sessionLogsChipsExpanded=!l.sessionLogsChipsExpanded},onToggleExpand:l=>{const p=e,h=new Set(p.sessionLogsExpandedIds);h.has(l)?h.delete(l):h.add(l),p.sessionLogsExpandedIds=h,p.requestUpdate()},onRefresh:()=>{xn(e,{reset:!0})},onExport:(l,p)=>e.exportSessionLogs(l,p),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,chipsExpanded:e.logsChipsExpanded,truncated:e.logsTruncated,onFilterTextChange:l=>e.logsFilterText=l,onLevelToggle:(l,p)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:p}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onToggleChips:()=>{const l=e;l.logsChipsExpanded=!l.logsChipsExpanded},onRefresh:()=>qt(e,{reset:!0}),onExport:(l,p)=>e.exportSessionLogs(l,p),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),u``)}function kk(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 Fl(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function $k(e,t,n){return u`
|
|
4078
4078
|
<div class="audit-modal-overlay" @click=${s=>{s.target.classList.contains("audit-modal-overlay")&&n()}}>
|
|
4079
4079
|
<div class="audit-modal-card">
|
|
4080
4080
|
<div class="audit-modal-header">
|
|
@@ -4106,7 +4106,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4106
4106
|
`}
|
|
4107
4107
|
</div>
|
|
4108
4108
|
</div>
|
|
4109
|
-
`}const Sk={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},xk={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",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};function Ak(e){e.basePath=Nf();const t=je();if(Ql(t.accentColor),Yl(t.backgroundColor),window.scrollTo(0,0),Mf(e),e.publicChat){const n=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__,i=(n==null?void 0:n.accountId)??"",s=i?i.charAt(0).toUpperCase()+i.slice(1):"Assistant";document.title=`Chat with ${s}`,Le(e);return}if(e.setup){document.title=`${t.name} Setup`,Le(e);return}if(e.filesPage){document.title=`${t.name} Files`,Lf(e),Le(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Le(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Le(e);return}if(e.contactsPage){document.title=`${t.name} Contacts`,Le(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Le(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Le(e);return}Kf(e,!0),Ff(e),Of(e),window.addEventListener("popstate",e.popStateHandler),Rf(e),Le(e),Tf(e),e.tab==="logs"&&(e.logsSubTab==="session"?Zo(e):Jo(e)),e.tab==="debug"&&ta(e)}function Ck(e){uh(e)}function Ek(e){var t;window.removeEventListener("popstate",e.popStateHandler),_f(e),Xo(e),ea(e),na(e),Pf(e),If(e),Uf(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Tk(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.contactsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleContactsLoad&&e.handleContactsLoad(),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(o=>{e.channelsSnapshot=o,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;Qt(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&cc(e,t.has("tab")||t.has("logsAutoFollow"))}}function _k(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 Mk(e,t,n){await Oo(e,t,n),await Y(e,!0)}async function Pk(e,t){await fc(e,t),await Y(e,!0)}async function Lk(e,t){await gc(e,t),await Y(e,!0)}async function Ik(e,t){await mc(e,t)}async function Rk(e,t){await yc(e,t)}async function Dk(e){await fh(e),await Ne(e),await Y(e,!0)}async function Bk(e){await Ne(e),await Y(e,!0)}function Nk(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 o=i.trim(),a=s.join(":").trim();o&&a&&(t[o]=a)}return t}function Iu(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 Ru(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Fk(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=_k(n??void 0)}function Ok(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Uk(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function Kk(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Wk(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Iu(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(Ru(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 o=(s==null?void 0:s.error)??`Profile update failed (${i.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Nk(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 Y(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function zk(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Iu(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(Ru(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 d=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:d,success:null};return}const o=s.merged??s.imported??null,a=o?{...t.values,...o}:t.values,r=!!(a.banner||a.website||a.nip05||a.lud16);e.nostrProfileFormState={...t,importing:!1,values:a,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:r},s.saved&&await Y(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function qk(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 Hk(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 jk(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 Vk(e,t){e.authCodeInput=t}function Gk(e){e.setupStep="whatsapp"}async function Qk(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 Yk(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 Jk(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 Xk(e,t){e.licenseKey=t}async function Zk(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 e0(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 t0=Object.defineProperty,n0=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?n0(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&t0(t,n,s),s};const to=bp();function i0(){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 s0(){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 o0(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function a0(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function r0(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function l0(){const e=window.location.pathname;return e==="/contacts"||e.endsWith("/contacts")}function c0(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function d0(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends Wt{constructor(){super(...arguments),this.settings=ws(),this.password="",this.tab="chat",this.onboarding=i0(),this.setup=s0(),this.filesPage=o0(),this.browserPage=a0(),this.adminsPage=r0(),this.contactsPage=l0(),this.chatPage=c0(),this.advancedPage=d0(),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=xu,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=to.name,this.assistantAvatar=to.avatar,this.assistantAgentId=to.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatHistoryTotal=0,this.chatHistoryHasMore=!1,this.chatLoadingOlder=!1,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=`{
|
|
4109
|
+
`}const Sk={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},xk={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",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};function Ak(e){e.basePath=Nf();const t=Ve();if(Ql(t.accentColor),Yl(t.backgroundColor),window.scrollTo(0,0),Mf(e),e.publicChat){const n=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__,i=(n==null?void 0:n.accountId)??"",s=i?i.charAt(0).toUpperCase()+i.slice(1):"Assistant";document.title=`Chat with ${s}`,Ie(e);return}if(e.setup){document.title=`${t.name} Setup`,Ie(e);return}if(e.filesPage){document.title=`${t.name} Files`,Lf(e),Ie(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Ie(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Ie(e);return}if(e.contactsPage){document.title=`${t.name} Contacts`,Ie(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Ie(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Ie(e);return}Kf(e,!0),Ff(e),Of(e),window.addEventListener("popstate",e.popStateHandler),Rf(e),Ie(e),Tf(e),e.tab==="logs"&&(e.logsSubTab==="session"?Zo(e):Jo(e)),e.tab==="debug"&&ta(e)}function Ck(e){uh(e)}function Ek(e){var t;window.removeEventListener("popstate",e.popStateHandler),_f(e),Xo(e),ea(e),na(e),Pf(e),If(e),Uf(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Tk(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.contactsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleContactsLoad&&e.handleContactsLoad(),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(o=>{e.channelsSnapshot=o,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;Yt(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&cc(e,t.has("tab")||t.has("logsAutoFollow"))}}function _k(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 Mk(e,t,n){await Oo(e,t,n),await J(e,!0)}async function Pk(e,t){await fc(e,t),await J(e,!0)}async function Lk(e,t){await gc(e,t),await J(e,!0)}async function Ik(e,t){await mc(e,t)}async function Rk(e,t){await yc(e,t)}async function Dk(e){await fh(e),await Fe(e),await J(e,!0)}async function Bk(e){await Fe(e),await J(e,!0)}function Nk(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 o=i.trim(),a=s.join(":").trim();o&&a&&(t[o]=a)}return t}function Iu(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 Ru(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Fk(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=_k(n??void 0)}function Ok(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Uk(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function Kk(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Wk(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Iu(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(Ru(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 o=(s==null?void 0:s.error)??`Profile update failed (${i.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Nk(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 J(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function zk(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Iu(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(Ru(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 d=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:d,success:null};return}const o=s.merged??s.imported??null,a=o?{...t.values,...o}:t.values,r=!!(a.banner||a.website||a.nip05||a.lud16);e.nostrProfileFormState={...t,importing:!1,values:a,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:r},s.saved&&await J(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function qk(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 Hk(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 jk(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 Vk(e,t){e.authCodeInput=t}function Gk(e){e.setupStep="whatsapp"}async function Qk(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 Yk(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 Jk(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 Xk(e,t){e.licenseKey=t}async function Zk(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 e0(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 t0=Object.defineProperty,n0=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?n0(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&t0(t,n,s),s};const to=bp();function i0(){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 s0(){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 o0(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function a0(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function r0(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function l0(){const e=window.location.pathname;return e==="/contacts"||e.endsWith("/contacts")}function c0(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function d0(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends zt{constructor(){super(...arguments),this.settings=ws(),this.password="",this.tab="chat",this.onboarding=i0(),this.setup=s0(),this.filesPage=o0(),this.browserPage=a0(),this.adminsPage=r0(),this.contactsPage=l0(),this.chatPage=c0(),this.advancedPage=d0(),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=xu,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=to.name,this.assistantAvatar=to.avatar,this.assistantAgentId=to.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatHistoryTotal=0,this.chatHistoryHasMore=!1,this.chatLoadingOlder=!1,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=`{
|
|
4110
4110
|
}
|
|
4111
|
-
`,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.brandingBusy=!1,this.brandingExpanded=!1,this.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleFunnelEnableUrl=null,this.tailscaleDisableConfirm=!1,this.wifiStatus=null,this.wifiNetworks=[],this.wifiBusy=!1,this.wifiError=null,this.wifiPassword="",this.wifiSelectedSsid=null,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={...xk},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.cronEditJobId=null,this.cronPendingDeleteId=null,this.cronRunModalJobId=null,this.cronRunModalJobName="",this.cronRunResult=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.filesCurrentDir=".",this.filesPendingDeletePath=null,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.filesResolvedAgentId=void 0,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillsTypeFilter="all",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillDetail=null,this.skillDetailTab="",this.skillAddModal=!1,this.skillAddForm={name:"",skillContent:"",references:[]},this.skillAddFormSource="draft",this.skillEditTab="SKILL.md",this.skillDrafts=[],this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.contactsLoading=!1,this.contactsSaving=!1,this.contactsRecords=[],this.contactsError=null,this.contactsSearchQuery="",this.contactsEditingId=null,this.contactsShowAddForm=!1,this.contactsNewPhone="",this.contactsNewName="",this.contactsDeleteConfirmId=null,this.contactsAddFieldForId=null,this.contactsAddFieldKey="",this.contactsAddFieldValue="",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={...Sk},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.logsChipsExpanded=!1,this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,tool_call:!0,tool_result:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsChipsExpanded=!1,this.sessionLogsExpandedIds=new Set,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.onLoadOlder=()=>this.handleLoadOlderChat(),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=()=>Wf(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,this._beforeUnloadHandler=()=>{var t;so();const e=this.selectedWorkspace??((t=this.publicChatConfig)==null?void 0:t.accountId)??"";e&&In(e,this.sessionKey,this.chatMessage)}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ak(this),window.addEventListener("beforeunload",this._beforeUnloadHandler)}firstUpdated(){Ck(this)}disconnectedCallback(){window.removeEventListener("beforeunload",this._beforeUnloadHandler),this.stopEmbeddingPoll(),Ek(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){Tk(this,e)}connect(){Le(this)}handleChatScroll(e){sh(this,e)}handleLogsScroll(e){ah(this,e)}handleSessionLogsScroll(e){rh(this,e)}exportLogs(e,t){ch(e,t)}exportSessionLogs(e,t){dh(e,t)}resetToolStream(){Fo(this)}resetChatScroll(){lh(this)}async loadAssistantIdentity(){await _o(this)}applySettings(e){nt(this,e)}setTab(e){Df(this,e)}setTheme(e,t){Bf(this,e,t)}async loadOverview(){await cd(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 ia(this)}async handleAbortChat(){await ud(this)}removeQueuedMessage(e){jf(this,e)}async handleSendChat(e,t){await Vf(this,e,t)}async handleWhatsAppStart(e,t){await Mk(this,e,t)}async handleWhatsAppWait(e){await Pk(this,e)}async handleWhatsAppLogout(e){await Lk(this,e)}async handleAddWhatsAppAccount(e){await Ik(this,e)}async handleRemoveWhatsAppAccount(e){await Rk(this,e)}async handleAccessCheck(){await Bl(this)}async handlePinSubmit(e,t){await ik(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await sk(this,e)}async handleLogout(){await ak(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 Bl(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 Qk(this)}async handleLicenseActivate(){await Yk(this)}async handleLicenseRemove(){await Jk(this)}handleLicenseKeyChange(e){Xk(this,e)}async handleAuthStatusCheck(){await qk(this)}async handleAuthStart(){await Hk(this)}async handleAuthSubmitCode(e){await jk(this,e)}handleAuthCodeChange(e){Vk(this,e)}handleSkipToWhatsApp(){Gk(this)}async handleGatewayHealthCheck(){await Zk(this)}async handleGatewayRestart(){await e0(this)}async handleUpdateCheck(){await wu(this)}async handleUpdateRun(){await Uw(this)}handleUpdateDismissResult(){zw(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 oe(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>yr);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){oe(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>yr);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await id(this)}async clearAudit(){await gf(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();this.filesResolvedAgentId=t,Xt(this,t),Yo(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();oe(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>lk);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 n;const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return(t==null?void 0:t.id)??((n=e.agents[0])==null?void 0:n.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.resetChatScroll(),this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}oe(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>Ci);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this).then(()=>{Qt(this,!0)})})}async handleLoadOlderChat(){if(this.chatLoadingOlder||!this.chatHistoryHasMore)return;const e=oh(this),{loadOlderChatHistory:t}=await oe(async()=>{const{loadOlderChatHistory:i}=await Promise.resolve().then(()=>Ci);return{loadOlderChatHistory:i}},void 0,import.meta.url);await t(this)&&e&&(await this.updateComplete,e())}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"?oe(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>nd);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):oe(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>Eh);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&oe(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>lf);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Dk(this)}async handleChannelConfigReload(){await Bk(this)}handleNostrProfileEdit(e,t){Fk(this,e,t)}handleNostrProfileCancel(){Ok(this)}handleNostrProfileFieldChange(e,t){Uk(this,e,t)}async handleNostrProfileSave(){await Wk(this)}async handleNostrProfileImport(){await zk(this)}handleNostrProfileToggleAdvanced(){Kk(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)}handleContactsLoad(){const e=this.selectedWorkspace??void 0;oe(async()=>{const{loadContacts:t}=await Promise.resolve().then(()=>ck);return{loadContacts:t}},void 0,import.meta.url).then(({loadContacts:t})=>{t(this,e)})}handleContactsNewPhoneChange(e){this.contactsNewPhone=e,this.contactsError&&(this.contactsError=null)}handleContactsNewNameChange(e){this.contactsNewName=e,this.contactsError&&(this.contactsError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await oe(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>hi);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await oe(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>hi);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await oe(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>$h);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const o=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,o),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(o),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await oe(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>hi);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 oe(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>hi);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){so(),this.selectedWorkspace&&In(this.selectedWorkspace,this.sessionKey,this.chatMessage),this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),kn(e),ir(e),this.settings=ws(),this.chatMessage=Rn(e,this.settings.sessionKey),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.contactsPage?this.handleContactsLoad():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)}kn(this.selectedWorkspace),ir(this.selectedWorkspace),this.settings=ws(),this.chatMessage=Rn(this.selectedWorkspace,this.settings.sessionKey),this.reloadCurrentPageData()}render(){return u`${wk(this)}${this.auditModalOpen?$k(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):w}`}};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,"contactsPage",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,"chatHistoryTotal",2);m([y()],g.prototype,"chatHistoryHasMore",2);m([y()],g.prototype,"chatLoadingOlder",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,"brandingBusy",2);m([y()],g.prototype,"brandingExpanded",2);m([y()],g.prototype,"tailscaleStatus",2);m([y()],g.prototype,"tailscaleBusy",2);m([y()],g.prototype,"tailscaleAuthUrl",2);m([y()],g.prototype,"tailscaleError",2);m([y()],g.prototype,"tailscaleFunnelEnableUrl",2);m([y()],g.prototype,"tailscaleDisableConfirm",2);m([y()],g.prototype,"wifiStatus",2);m([y()],g.prototype,"wifiNetworks",2);m([y()],g.prototype,"wifiBusy",2);m([y()],g.prototype,"wifiError",2);m([y()],g.prototype,"wifiPassword",2);m([y()],g.prototype,"wifiSelectedSsid",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,"cronEditJobId",2);m([y()],g.prototype,"cronPendingDeleteId",2);m([y()],g.prototype,"cronRunModalJobId",2);m([y()],g.prototype,"cronRunModalJobName",2);m([y()],g.prototype,"cronRunResult",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,"filesCurrentDir",2);m([y()],g.prototype,"filesPendingDeletePath",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,"skillsTypeFilter",2);m([y()],g.prototype,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",2);m([y()],g.prototype,"skillDetail",2);m([y()],g.prototype,"skillDetailTab",2);m([y()],g.prototype,"skillAddModal",2);m([y()],g.prototype,"skillAddForm",2);m([y()],g.prototype,"skillAddFormSource",2);m([y()],g.prototype,"skillEditTab",2);m([y()],g.prototype,"skillDrafts",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,"contactsLoading",2);m([y()],g.prototype,"contactsSaving",2);m([y()],g.prototype,"contactsRecords",2);m([y()],g.prototype,"contactsError",2);m([y()],g.prototype,"contactsSearchQuery",2);m([y()],g.prototype,"contactsEditingId",2);m([y()],g.prototype,"contactsShowAddForm",2);m([y()],g.prototype,"contactsNewPhone",2);m([y()],g.prototype,"contactsNewName",2);m([y()],g.prototype,"contactsDeleteConfirmId",2);m([y()],g.prototype,"contactsAddFieldForId",2);m([y()],g.prototype,"contactsAddFieldKey",2);m([y()],g.prototype,"contactsAddFieldValue",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,"logsChipsExpanded",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,"sessionLogsChipsExpanded",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([Vl("taskmaster-app")],g);
|
|
4112
|
-
//# sourceMappingURL=index-
|
|
4111
|
+
`,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.brandingBusy=!1,this.brandingExpanded=!1,this.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleFunnelEnableUrl=null,this.tailscaleDisableConfirm=!1,this.wifiStatus=null,this.wifiNetworks=[],this.wifiBusy=!1,this.wifiError=null,this.wifiPassword="",this.wifiSelectedSsid=null,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={...xk},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.cronEditJobId=null,this.cronPendingDeleteId=null,this.cronRunModalJobId=null,this.cronRunModalJobName="",this.cronRunResult=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.filesCurrentDir=".",this.filesPendingDeletePath=null,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.filesResolvedAgentId=void 0,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillsTypeFilter="all",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillDetail=null,this.skillDetailTab="",this.skillAddModal=!1,this.skillAddForm={name:"",skillContent:"",references:[]},this.skillAddFormSource="draft",this.skillEditTab="SKILL.md",this.skillDrafts=[],this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.contactsLoading=!1,this.contactsSaving=!1,this.contactsRecords=[],this.contactsError=null,this.contactsSearchQuery="",this.contactsEditingId=null,this.contactsShowAddForm=!1,this.contactsNewPhone="",this.contactsNewName="",this.contactsDeleteConfirmId=null,this.contactsAddFieldForId=null,this.contactsAddFieldKey="",this.contactsAddFieldValue="",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={...Sk},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.logsChipsExpanded=!1,this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,tool_call:!0,tool_result:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsChipsExpanded=!1,this.sessionLogsExpandedIds=new Set,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.onLoadOlder=()=>this.handleLoadOlderChat(),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=()=>Wf(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,this._beforeUnloadHandler=()=>{var t;so();const e=this.selectedWorkspace??((t=this.publicChatConfig)==null?void 0:t.accountId)??"";e&&In(e,this.sessionKey,this.chatMessage)}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ak(this),window.addEventListener("beforeunload",this._beforeUnloadHandler)}firstUpdated(){Ck(this)}disconnectedCallback(){window.removeEventListener("beforeunload",this._beforeUnloadHandler),this.stopEmbeddingPoll(),Ek(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){Tk(this,e)}connect(){Ie(this)}handleChatScroll(e){sh(this,e)}handleLogsScroll(e){ah(this,e)}handleSessionLogsScroll(e){rh(this,e)}exportLogs(e,t){ch(e,t)}exportSessionLogs(e,t){dh(e,t)}resetToolStream(){Fo(this)}resetChatScroll(){lh(this)}async loadAssistantIdentity(){await _o(this)}applySettings(e){nt(this,e)}setTab(e){Df(this,e)}setTheme(e,t){Bf(this,e,t)}async loadOverview(){await cd(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 ia(this)}async handleAbortChat(){await ud(this)}removeQueuedMessage(e){jf(this,e)}async handleSendChat(e,t){await Vf(this,e,t)}async handleWhatsAppStart(e,t){await Mk(this,e,t)}async handleWhatsAppWait(e){await Pk(this,e)}async handleWhatsAppLogout(e){await Lk(this,e)}async handleAddWhatsAppAccount(e){await Ik(this,e)}async handleRemoveWhatsAppAccount(e){await Rk(this,e)}async handleAccessCheck(){await Bl(this)}async handlePinSubmit(e,t){await ik(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await sk(this,e)}async handleLogout(){await ak(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 Bl(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 Qk(this)}async handleLicenseActivate(){await Yk(this)}async handleLicenseRemove(){await Jk(this)}handleLicenseKeyChange(e){Xk(this,e)}async handleAuthStatusCheck(){await qk(this)}async handleAuthStart(){await Hk(this)}async handleAuthSubmitCode(e){await jk(this,e)}handleAuthCodeChange(e){Vk(this,e)}handleSkipToWhatsApp(){Gk(this)}async handleGatewayHealthCheck(){await Zk(this)}async handleGatewayRestart(){await e0(this)}async handleUpdateCheck(){await wu(this)}async handleUpdateRun(){await Uw(this)}handleUpdateDismissResult(){zw(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 ae(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>yr);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){ae(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>yr);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await id(this)}async clearAudit(){await gf(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();this.filesResolvedAgentId=t,Zt(this,t),Yo(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();ae(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>lk);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 n;const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return(t==null?void 0:t.id)??((n=e.agents[0])==null?void 0:n.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.resetChatScroll(),this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}ae(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>Ci);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this).then(()=>{Yt(this,!0)})})}async handleLoadOlderChat(){if(this.chatLoadingOlder||!this.chatHistoryHasMore)return;const e=oh(this),{loadOlderChatHistory:t}=await ae(async()=>{const{loadOlderChatHistory:i}=await Promise.resolve().then(()=>Ci);return{loadOlderChatHistory:i}},void 0,import.meta.url);await t(this)&&e&&(await this.updateComplete,e())}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"?ae(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>nd);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):ae(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>Eh);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&ae(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>lf);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Dk(this)}async handleChannelConfigReload(){await Bk(this)}handleNostrProfileEdit(e,t){Fk(this,e,t)}handleNostrProfileCancel(){Ok(this)}handleNostrProfileFieldChange(e,t){Uk(this,e,t)}async handleNostrProfileSave(){await Wk(this)}async handleNostrProfileImport(){await zk(this)}handleNostrProfileToggleAdvanced(){Kk(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)}handleContactsLoad(){const e=this.selectedWorkspace??void 0;ae(async()=>{const{loadContacts:t}=await Promise.resolve().then(()=>ck);return{loadContacts:t}},void 0,import.meta.url).then(({loadContacts:t})=>{t(this,e)})}handleContactsNewPhoneChange(e){this.contactsNewPhone=e,this.contactsError&&(this.contactsError=null)}handleContactsNewNameChange(e){this.contactsNewName=e,this.contactsError&&(this.contactsError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await ae(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>hi);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await ae(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>hi);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await ae(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>$h);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const o=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,o),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(o),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await ae(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>hi);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 ae(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>hi);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){so(),this.selectedWorkspace&&In(this.selectedWorkspace,this.sessionKey,this.chatMessage),this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),kn(e),ir(e),this.settings=ws(),this.chatMessage=Rn(e,this.settings.sessionKey),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.contactsPage?this.handleContactsLoad():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)}kn(this.selectedWorkspace),ir(this.selectedWorkspace),this.settings=ws(),this.chatMessage=Rn(this.selectedWorkspace,this.settings.sessionKey),this.reloadCurrentPageData()}render(){return u`${wk(this)}${this.auditModalOpen?$k(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,"contactsPage",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,"chatHistoryTotal",2);m([y()],g.prototype,"chatHistoryHasMore",2);m([y()],g.prototype,"chatLoadingOlder",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,"brandingBusy",2);m([y()],g.prototype,"brandingExpanded",2);m([y()],g.prototype,"tailscaleStatus",2);m([y()],g.prototype,"tailscaleBusy",2);m([y()],g.prototype,"tailscaleAuthUrl",2);m([y()],g.prototype,"tailscaleError",2);m([y()],g.prototype,"tailscaleFunnelEnableUrl",2);m([y()],g.prototype,"tailscaleDisableConfirm",2);m([y()],g.prototype,"wifiStatus",2);m([y()],g.prototype,"wifiNetworks",2);m([y()],g.prototype,"wifiBusy",2);m([y()],g.prototype,"wifiError",2);m([y()],g.prototype,"wifiPassword",2);m([y()],g.prototype,"wifiSelectedSsid",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,"cronEditJobId",2);m([y()],g.prototype,"cronPendingDeleteId",2);m([y()],g.prototype,"cronRunModalJobId",2);m([y()],g.prototype,"cronRunModalJobName",2);m([y()],g.prototype,"cronRunResult",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,"filesCurrentDir",2);m([y()],g.prototype,"filesPendingDeletePath",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,"skillsTypeFilter",2);m([y()],g.prototype,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",2);m([y()],g.prototype,"skillDetail",2);m([y()],g.prototype,"skillDetailTab",2);m([y()],g.prototype,"skillAddModal",2);m([y()],g.prototype,"skillAddForm",2);m([y()],g.prototype,"skillAddFormSource",2);m([y()],g.prototype,"skillEditTab",2);m([y()],g.prototype,"skillDrafts",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,"contactsLoading",2);m([y()],g.prototype,"contactsSaving",2);m([y()],g.prototype,"contactsRecords",2);m([y()],g.prototype,"contactsError",2);m([y()],g.prototype,"contactsSearchQuery",2);m([y()],g.prototype,"contactsEditingId",2);m([y()],g.prototype,"contactsShowAddForm",2);m([y()],g.prototype,"contactsNewPhone",2);m([y()],g.prototype,"contactsNewName",2);m([y()],g.prototype,"contactsDeleteConfirmId",2);m([y()],g.prototype,"contactsAddFieldForId",2);m([y()],g.prototype,"contactsAddFieldKey",2);m([y()],g.prototype,"contactsAddFieldValue",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,"logsChipsExpanded",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,"sessionLogsChipsExpanded",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([Vl("taskmaster-app")],g);
|
|
4112
|
+
//# sourceMappingURL=index-BFPQ4MXV.js.map
|