@rubytech/taskmaster 1.0.92 → 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/taskmaster-tools.js +4 -4
- package/dist/agents/tool-policy.js +2 -2
- package/dist/agents/tools/contact-lookup-tool.js +45 -0
- package/dist/agents/tools/contact-update-tool.js +68 -0
- package/dist/agents/tools/memory-tool.js +10 -3
- package/dist/build-info.json +3 -3
- package/dist/cli/provision-seed.js +2 -2
- package/dist/control-ui/assets/{index-B7exVNNa.css → index-BWth4bv5.css} +1 -1
- package/dist/control-ui/assets/{index-hWMGux19.js → index-Bem0-Ojd.js} +220 -220
- package/dist/control-ui/assets/index-Bem0-Ojd.js.map +1 -0
- package/dist/control-ui/index.html +2 -2
- package/dist/gateway/chat-sanitize.js +121 -5
- package/dist/gateway/media-http.js +120 -0
- package/dist/gateway/public-chat-api.js +5 -3
- package/dist/gateway/server-http.js +3 -0
- package/dist/gateway/server-methods/chat.js +5 -3
- package/dist/infra/heartbeat-infra-alert.js +143 -0
- package/dist/infra/heartbeat-runner.js +13 -0
- package/dist/memory/manager.js +25 -8
- package/package.json +1 -1
- package/taskmaster-docs/USER-GUIDE.md +5 -5
- package/dist/control-ui/assets/index-hWMGux19.js.map +0 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var Pu=Object.defineProperty;var Lu=(e,t,n)=>t in e?Pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var U=(e,t,n)=>Lu(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();const Iu="modulepreload",Ru=function(e,t){return new URL(e,t).href},ao={},se=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let u=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=u(n.map(l=>{if(l=Ru(l,i),l in ao)return;ao[l]=!0;const d=l.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(i)for(let f=o.length-1;f>=0;f--){const b=o[f];if(b.href===l&&(!d||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${h}`))return;const v=document.createElement("link");if(v.rel=d?"stylesheet":Iu,d||(v.as="script"),v.crossOrigin="",v.href=l,c&&v.setAttribute("nonce",c),document.head.appendChild(v),d)return new Promise((f,b)=>{v.addEventListener("load",f),v.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${l}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return t().catch(r)})};const qn=globalThis,Xs=qn.ShadowRoot&&(qn.ShadyCSS===void 0||qn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Zs=Symbol(),lo=new WeakMap;let Ja=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==Zs)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(Xs&&t===void 0){const i=n!==void 0&&n.length===1;i&&(t=lo.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&lo.set(n,t))}return t}toString(){return this.cssText}};const Nu=e=>new Ja(typeof e=="string"?e:e+"",void 0,Zs),Du=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((i,s,r)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[r+1],e[0]);return new Ja(n,e,Zs)},Ou=(e,t)=>{if(Xs)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const i=document.createElement("style"),s=qn.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,e.appendChild(i)}},co=Xs?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const i of t.cssRules)n+=i.cssText;return Nu(n)})(e):e;const{is:Bu,defineProperty:Fu,getOwnPropertyDescriptor:Uu,getOwnPropertyNames:Wu,getOwnPropertySymbols:Ku,getPrototypeOf:zu}=Object,ze=globalThis,uo=ze.trustedTypes,ju=uo?uo.emptyScript:"",Ki=ze.reactiveElementPolyfillSupport,en=(e,t)=>e,Xn={toAttribute(e,t){switch(t){case Boolean:e=e?ju:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Js=(e,t)=>!Bu(e,t),po={attribute:!0,type:String,converter:Xn,reflect:!1,useDefault:!1,hasChanged:Js};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ze.litPropertyMetadata??(ze.litPropertyMetadata=new WeakMap);let At=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=po){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&&Fu(this.prototype,t,s)}}static getPropertyDescriptor(t,n,i){const{get:s,set:r}=Uu(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);r==null||r.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??po}static _$Ei(){if(this.hasOwnProperty(en("elementProperties")))return;const t=zu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(en("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(en("properties"))){const n=this.properties,i=[...Wu(n),...Ku(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(co(s))}else t!==void 0&&n.push(co(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 Ou(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostConnected)==null?void 0:i.call(n)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostDisconnected)==null?void 0:i.call(n)})}attributeChangedCallback(t,n,i){this._$AK(t,i)}_$ET(t,n){var r;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const o=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:Xn).toAttribute(n,i.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,n){var r,o;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=i.getPropertyOptions(s),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:Xn;this._$Em=s;const u=c.fromAttribute(n,a.type);this[s]=u??((o=this._$Ej)==null?void 0:o.get(s))??u,this._$Em=null}}requestUpdate(t,n,i,s=!1,r){var o;if(t!==void 0){const a=this.constructor;if(s===!1&&(r=this[t]),i??(i=a.getPropertyOptions(t)),!((i.hasChanged??Js)(r,n)||i.useDefault&&i.reflect&&r===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(a._$Eu(t,i))))return;this.C(t,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??n??this[t]),r!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(n=void 0),this._$AL.set(t,n)),s===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,o]of s){const{wrapped:a}=o,c=this[r];a!==!0||this._$AL.has(r)||c===void 0||this.C(r,void 0,o,c)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(s=>{var r;return(r=s.hostUpdate)==null?void 0:r.call(s)}),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){var n;(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(n=>this._$ET(n,this[n]))),this._$EM()}updated(t){}firstUpdated(t){}};At.elementStyles=[],At.shadowRootOptions={mode:"open"},At[en("elementProperties")]=new Map,At[en("finalized")]=new Map,Ki==null||Ki({ReactiveElement:At}),(ze.reactiveElementVersions??(ze.reactiveElementVersions=[])).push("2.1.2");const tn=globalThis,ho=e=>e,Zn=tn.trustedTypes,fo=Zn?Zn.createPolicy("lit-html",{createHTML:e=>e}):void 0,el="$lit$",Ke=`lit$${Math.random().toFixed(9).slice(2)}$`,tl="?"+Ke,Hu=`<${tl}>`,st=document,un=()=>st.createComment(""),dn=e=>e===null||typeof e!="object"&&typeof e!="function",er=Array.isArray,qu=e=>er(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",zi=`[
|
|
2
|
-
\f\r]`,Ut=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),yo=/'/g,vo=/"/g,nl=/^(?:script|style|textarea|title)$/i,Vu=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),p=Vu(1),He=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),bo=new WeakMap,tt=st.createTreeWalker(st,129);function il(e,t){if(!er(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return fo!==void 0?fo.createHTML(t):t}const Gu=(e,t)=>{const n=e.length-1,i=[];let s,r=t===2?"<svg>":t===3?"<math>":"",o=Ut;for(let a=0;a<n;a++){const c=e[a];let u,l,d=-1,h=0;for(;h<c.length&&(o.lastIndex=h,l=o.exec(c),l!==null);)h=o.lastIndex,o===Ut?l[1]==="!--"?o=go:l[1]!==void 0?o=mo:l[2]!==void 0?(nl.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=Ze):l[3]!==void 0&&(o=Ze):o===Ze?l[0]===">"?(o=s??Ut,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,u=l[1],o=l[3]===void 0?Ze:l[3]==='"'?vo:yo):o===vo||o===yo?o=Ze:o===go||o===mo?o=Ut:(o=Ze,s=void 0);const v=o===Ze&&e[a+1].startsWith("/>")?" ":"";r+=o===Ut?c+Hu:d>=0?(i.push(u),c.slice(0,d)+el+c.slice(d)+Ke+v):c+Ke+(d===-2?a:v)}return[il(e,r+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let As=class sl{constructor({strings:t,_$litType$:n},i){let s;this.parts=[];let r=0,o=0;const a=t.length-1,c=this.parts,[u,l]=Gu(t,n);if(this.el=sl.createElement(u,i),tt.currentNode=this.el.content,n===2||n===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=tt.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(el)){const h=l[o++],v=s.getAttribute(d).split(Ke),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:r,name:f[2],strings:v,ctor:f[1]==="."?Yu:f[1]==="?"?Xu:f[1]==="@"?Zu:vi}),s.removeAttribute(d)}else d.startsWith(Ke)&&(c.push({type:6,index:r}),s.removeAttribute(d));if(nl.test(s.tagName)){const d=s.textContent.split(Ke),h=d.length-1;if(h>0){s.textContent=Zn?Zn.emptyScript:"";for(let v=0;v<h;v++)s.append(d[v],un()),tt.nextNode(),c.push({type:2,index:++r});s.append(d[h],un())}}}else if(s.nodeType===8)if(s.data===tl)c.push({type:2,index:r});else{let d=-1;for(;(d=s.data.indexOf(Ke,d+1))!==-1;)c.push({type:7,index:r}),d+=Ke.length-1}r++}}static createElement(t,n){const i=st.createElement("template");return i.innerHTML=t,i}};function _t(e,t,n=e,i){var o,a;if(t===He)return t;let s=i!==void 0?(o=n._$Co)==null?void 0:o[i]:n._$Cl;const r=dn(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(e),s._$AT(e,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=s:n._$Cl=s),s!==void 0&&(t=_t(e,s._$AS(e,t.values),s,i)),t}class Qu{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)??st).importNode(n,!0);tt.currentNode=s;let r=tt.nextNode(),o=0,a=0,c=i[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new yi(r,r.nextSibling,this,t):c.type===1?u=new c.ctor(r,c.name,c.strings,this,t):c.type===6&&(u=new Ju(r,this,t)),this._$AV.push(u),c=i[++a]}o!==(c==null?void 0:c.index)&&(r=tt.nextNode(),o++)}return tt.currentNode=st,s}p(t){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}let yi=class rl{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,n,i,s){this.type=2,this._$AH=S,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=_t(this,t,n),dn(t)?t===S||t==null||t===""?(this._$AH!==S&&this._$AR(),this._$AH=S):t!==this._$AH&&t!==He&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):qu(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!==S&&dn(this._$AH)?this._$AA.nextSibling.data=t:this.T(st.createTextNode(t)),this._$AH=t}$(t){var r;const{values:n,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=As.createElement(il(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(n);else{const o=new Qu(s,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}_$AC(t){let n=bo.get(t.strings);return n===void 0&&bo.set(t.strings,n=new As(t)),n}k(t){er(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,s=0;for(const r of t)s===n.length?n.push(i=new rl(this.O(un()),this.O(un()),this,this.options)):i=n[s],i._$AI(r),s++;s<n.length&&(this._$AR(i&&i._$AB.nextSibling,s),n.length=s)}_$AR(t=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);t!==this._$AB;){const s=ho(t).nextSibling;ho(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}};class vi{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,s,r){this.type=1,this._$AH=S,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=S}_$AI(t,n=this,i,s){const r=this.strings;let o=!1;if(r===void 0)t=_t(this,t,n,0),o=!dn(t)||t!==this._$AH&&t!==He,o&&(this._$AH=t);else{const a=t;let c,u;for(t=r[0],c=0;c<r.length-1;c++)u=_t(this,a[i+c],n,c),u===He&&(u=this._$AH[c]),o||(o=!dn(u)||u!==this._$AH[c]),u===S?t=S:t!==S&&(t+=(u??"")+r[c+1]),this._$AH[c]=u}o&&!s&&this.j(t)}j(t){t===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let Yu=class extends vi{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===S?void 0:t}},Xu=class extends vi{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==S)}},Zu=class extends vi{constructor(t,n,i,s,r){super(t,n,i,s,r),this.type=5}_$AI(t,n=this){if((t=_t(this,t,n,0)??S)===He)return;const i=this._$AH,s=t===S&&i!==S||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==S&&(i===S||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,t):this._$AH.handleEvent(t)}},Ju=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){_t(this,t)}};const ed={I:yi},ji=tn.litHtmlPolyfillSupport;ji==null||ji(As,yi),(tn.litHtmlVersions??(tn.litHtmlVersions=[])).push("3.3.2");const td=(e,t,n)=>{const i=(n==null?void 0:n.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const r=(n==null?void 0:n.renderBefore)??null;i._$litPart$=s=new yi(t.insertBefore(un(),r),r,void 0,n??{})}return s._$AI(e),s};const it=globalThis;let Et=class extends At{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=td(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 He}};var Za;Et._$litElement$=!0,Et.finalized=!0,(Za=it.litElementHydrateSupport)==null||Za.call(it,{LitElement:Et});const Hi=it.litElementPolyfillSupport;Hi==null||Hi({LitElement:Et});(it.litElementVersions??(it.litElementVersions=[])).push("4.2.2");const ol=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const nd={attribute:!0,type:String,converter:Xn,reflect:!1,hasChanged:Js},id=(e=nd,t,n)=>{const{kind:i,metadata:s}=n;let r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),r.set(n.name,e),i==="accessor"){const{name:o}=n;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,e,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,e,a),a}}}if(i==="setter"){const{name:o}=n;return function(a){const c=this[o];t.call(this,a),this.requestUpdate(o,c,e,!0,a)}}throw Error("Unsupported decorator location: "+i)};function bi(e){return(t,n)=>typeof n=="object"?id(e,t,n):((i,s,r)=>{const o=s.hasOwnProperty(r);return s.constructor.createProperty(r,i),o?Object.getOwnPropertyDescriptor(s,r):void 0})(e,t,n)}function y(e){return bi({...e,state:!0,attribute:!1})}const sd=50,rd=200,od="Assistant";function wo(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function xs(e){const t=wo(e==null?void 0:e.name,sd)??od,n=wo((e==null?void 0:e.avatar)??void 0,rd)??null;return{agentId:typeof(e==null?void 0:e.agentId)=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function ad(){return xs(typeof window>"u"?{}:{name:window.__TASKMASTER_ASSISTANT_NAME__,avatar:window.__TASKMASTER_ASSISTANT_AVATAR__})}const Jn="taskmaster.control.settings.v1",al="taskmaster.account.settings.";function nn(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}`}const St={gatewayUrl:nn(),token:"",theme:"system",navCollapsed:!1,navGroupsCollapsed:{}},We={sessionKey:"main",lastActiveSessionKey:"main",chatFocusMode:!1,chatShowThinking:!1,splitRatio:.6};function ld(){try{const e=localStorage.getItem(Jn);if(!e)return{...St,gatewayUrl:nn()};const t=JSON.parse(e);return{gatewayUrl:typeof t.gatewayUrl=="string"&&t.gatewayUrl.trim()?t.gatewayUrl.trim():nn(),token:typeof t.token=="string"?t.token:St.token,theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:St.theme,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:St.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:St.navGroupsCollapsed}}catch{return{...St,gatewayUrl:nn()}}}function cd(e){if(!e)return{...We};try{const t=localStorage.getItem(al+e);if(!t)return{...We};const n=JSON.parse(t);return{sessionKey:typeof n.sessionKey=="string"&&n.sessionKey.trim()?n.sessionKey.trim():We.sessionKey,lastActiveSessionKey:typeof n.lastActiveSessionKey=="string"&&n.lastActiveSessionKey.trim()?n.lastActiveSessionKey.trim():typeof n.sessionKey=="string"&&n.sessionKey.trim()||We.lastActiveSessionKey,chatFocusMode:typeof n.chatFocusMode=="boolean"?n.chatFocusMode:We.chatFocusMode,chatShowThinking:typeof n.chatShowThinking=="boolean"?n.chatShowThinking:We.chatShowThinking,splitRatio:typeof n.splitRatio=="number"&&n.splitRatio>=.4&&n.splitRatio<=.7?n.splitRatio:We.splitRatio}}catch{return{...We}}}let ei=null;function ko(e){ei=e}function qi(){return{...ld(),...cd(ei)}}function ud(e){const t={gatewayUrl:e.gatewayUrl,token:e.token,theme:e.theme,navCollapsed:e.navCollapsed,navGroupsCollapsed:e.navGroupsCollapsed};if(localStorage.setItem(Jn,JSON.stringify(t)),ei){const n={sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,chatFocusMode:e.chatFocusMode,chatShowThinking:e.chatShowThinking,splitRatio:e.splitRatio};localStorage.setItem(al+ei,JSON.stringify(n))}}(function(){try{const t=localStorage.getItem(Jn);if(!t)return;const n=JSON.parse(t);if(!("sessionKey"in n))return;const i={gatewayUrl:typeof n.gatewayUrl=="string"?n.gatewayUrl:nn(),token:typeof n.token=="string"?n.token:"",theme:n.theme==="light"||n.theme==="dark"||n.theme==="system"?n.theme:"system",navCollapsed:typeof n.navCollapsed=="boolean"?n.navCollapsed:!1,navGroupsCollapsed:typeof n.navGroupsCollapsed=="object"&&n.navGroupsCollapsed!==null?n.navGroupsCollapsed:{}};localStorage.setItem(Jn,JSON.stringify(i))}catch{}})();function ll(e){var r;const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const i=(r=n[1])==null?void 0:r.trim(),s=n.slice(2).join(":");return!i||!s?null:{agentId:i,rest:s}}const dd=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Pn=/<\s*\/?\s*final\b[^>]*>/gi,So=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function pd(e,t){return e.trimStart()}function hd(e,t){if(!e||!dd.test(e))return e;let n=e;Pn.test(n)?(Pn.lastIndex=0,n=n.replace(Pn,"")):Pn.lastIndex=0,So.lastIndex=0;let i="",s=0,r=!1;for(const o of n.matchAll(So)){const a=o.index??0,c=o[1]==="/";r?c&&(r=!1):(i+=n.slice(s,a),c||(r=!0)),s=a+o[0].length}return i+=n.slice(s),pd(i)}function cl(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function wi(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0){const o=-t,a=Math.round(o/1e3);if(a<60)return`in ${a}s`;const c=Math.round(a/60);if(c<60)return`in ${c}m`;const u=Math.round(c/60);return u<48?`in ${u}h`:`in ${Math.round(u/24)}d`}const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const i=Math.round(n/60);if(i<60)return`${i}m ago`;const s=Math.round(i/60);return s<48?`${s}h ago`:`${Math.round(s/24)}d ago`}function ul(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const i=Math.round(n/60);return i<48?`${i}h`:`${Math.round(i/24)}d`}function fd(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function dl(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function ti(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Vi(e){return hd(e)}const gd=/^\[([^\]]+)\]\s*/,md=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Gi=new WeakMap,Qi=new WeakMap;function yd(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:md.some(t=>e.startsWith(`${t} `))}function Yi(e){const t=e.match(gd);if(!t)return e;const n=t[1]??"";return yd(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"?Vi(i):Yi(i);if(Array.isArray(i)){const s=i.map(r=>{const o=r;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(r=>typeof r=="string");if(s.length>0){const r=s.join(`
|
|
4
|
-
`);return n==="assistant"?Vi(
|
|
5
|
-
`);const s=bd(e);if(!s)return null;const
|
|
6
|
-
`):null}function vd(e){if(!e||typeof e!="object")return
|
|
1
|
+
var Pu=Object.defineProperty;var Lu=(e,t,n)=>t in e?Pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var U=(e,t,n)=>Lu(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 r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).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 Iu="modulepreload",Ru=function(e,t){return new URL(e,t).href},lr={},se=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let u=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const r=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=u(n.map(l=>{if(l=Ru(l,i),l in lr)return;lr[l]=!0;const d=l.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(i)for(let f=r.length-1;f>=0;f--){const b=r[f];if(b.href===l&&(!d||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${h}`))return;const v=document.createElement("link");if(v.rel=d?"stylesheet":Iu,d||(v.as="script"),v.crossOrigin="",v.href=l,c&&v.setAttribute("nonce",c),document.head.appendChild(v),d)return new Promise((f,b)=>{v.addEventListener("load",f),v.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(r){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r}return s.then(r=>{for(const a of r||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};const qn=globalThis,Xs=qn.ShadowRoot&&(qn.ShadyCSS===void 0||qn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Zs=Symbol(),cr=new WeakMap;let Ja=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==Zs)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(Xs&&t===void 0){const i=n!==void 0&&n.length===1;i&&(t=cr.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&cr.set(n,t))}return t}toString(){return this.cssText}};const Nu=e=>new Ja(typeof e=="string"?e:e+"",void 0,Zs),Du=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((i,s,o)=>i+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[o+1],e[0]);return new Ja(n,e,Zs)},Ou=(e,t)=>{if(Xs)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const i=document.createElement("style"),s=qn.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,e.appendChild(i)}},ur=Xs?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const i of t.cssRules)n+=i.cssText;return Nu(n)})(e):e;const{is:Bu,defineProperty:Fu,getOwnPropertyDescriptor:Uu,getOwnPropertyNames:Wu,getOwnPropertySymbols:Ku,getPrototypeOf:zu}=Object,ze=globalThis,dr=ze.trustedTypes,ju=dr?dr.emptyScript:"",Ki=ze.reactiveElementPolyfillSupport,en=(e,t)=>e,Xn={toAttribute(e,t){switch(t){case Boolean:e=e?ju:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Js=(e,t)=>!Bu(e,t),pr={attribute:!0,type:String,converter:Xn,reflect:!1,useDefault:!1,hasChanged:Js};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ze.litPropertyMetadata??(ze.litPropertyMetadata=new WeakMap);let At=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=pr){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&&Fu(this.prototype,t,s)}}static getPropertyDescriptor(t,n,i){const{get:s,set:o}=Uu(this.prototype,t)??{get(){return this[n]},set(r){this[n]=r}};return{get:s,set(r){const a=s==null?void 0:s.call(this);o==null||o.call(this,r),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??pr}static _$Ei(){if(this.hasOwnProperty(en("elementProperties")))return;const t=zu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(en("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(en("properties"))){const n=this.properties,i=[...Wu(n),...Ku(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(ur(s))}else t!==void 0&&n.push(ur(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 Ou(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 r=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:Xn).toAttribute(n,i.type);this._$Em=t,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,n){var o,r;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=i.getPropertyOptions(s),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((o=a.converter)==null?void 0:o.fromAttribute)!==void 0?a.converter:Xn;this._$Em=s;const u=c.fromAttribute(n,a.type);this[s]=u??((r=this._$Ej)==null?void 0:r.get(s))??u,this._$Em=null}}requestUpdate(t,n,i,s=!1,o){var r;if(t!==void 0){const a=this.constructor;if(s===!1&&(o=this[t]),i??(i=a.getPropertyOptions(t)),!((i.hasChanged??Js)(o,n)||i.useDefault&&i.reflect&&o===((r=this._$Ej)==null?void 0:r.get(t))&&!this.hasAttribute(a._$Eu(t,i))))return;this.C(t,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:i,reflect:s,wrapped:o},r){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,r??n??this[t]),o!==!0||r!==void 0)||(this._$AL.has(t)||(this.hasUpdated||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,r]of this._$Ep)this[o]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,r]of s){const{wrapped:a}=r,c=this[o];a!==!0||this._$AL.has(o)||c===void 0||this.C(o,void 0,r,c)}}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){}};At.elementStyles=[],At.shadowRootOptions={mode:"open"},At[en("elementProperties")]=new Map,At[en("finalized")]=new Map,Ki==null||Ki({ReactiveElement:At}),(ze.reactiveElementVersions??(ze.reactiveElementVersions=[])).push("2.1.2");const tn=globalThis,hr=e=>e,Zn=tn.trustedTypes,fr=Zn?Zn.createPolicy("lit-html",{createHTML:e=>e}):void 0,el="$lit$",Ke=`lit$${Math.random().toFixed(9).slice(2)}$`,tl="?"+Ke,Hu=`<${tl}>`,st=document,un=()=>st.createComment(""),dn=e=>e===null||typeof e!="object"&&typeof e!="function",eo=Array.isArray,qu=e=>eo(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",zi=`[
|
|
2
|
+
\f\r]`,Ut=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gr=/-->/g,mr=/>/g,Ze=RegExp(`>|${zi}(?:([^\\s"'>=/]+)(${zi}*=${zi}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),yr=/'/g,vr=/"/g,nl=/^(?:script|style|textarea|title)$/i,Vu=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),p=Vu(1),He=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),br=new WeakMap,tt=st.createTreeWalker(st,129);function il(e,t){if(!eo(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return fr!==void 0?fr.createHTML(t):t}const Gu=(e,t)=>{const n=e.length-1,i=[];let s,o=t===2?"<svg>":t===3?"<math>":"",r=Ut;for(let a=0;a<n;a++){const c=e[a];let u,l,d=-1,h=0;for(;h<c.length&&(r.lastIndex=h,l=r.exec(c),l!==null);)h=r.lastIndex,r===Ut?l[1]==="!--"?r=gr:l[1]!==void 0?r=mr:l[2]!==void 0?(nl.test(l[2])&&(s=RegExp("</"+l[2],"g")),r=Ze):l[3]!==void 0&&(r=Ze):r===Ze?l[0]===">"?(r=s??Ut,d=-1):l[1]===void 0?d=-2:(d=r.lastIndex-l[2].length,u=l[1],r=l[3]===void 0?Ze:l[3]==='"'?vr:yr):r===vr||r===yr?r=Ze:r===gr||r===mr?r=Ut:(r=Ze,s=void 0);const v=r===Ze&&e[a+1].startsWith("/>")?" ":"";o+=r===Ut?c+Hu:d>=0?(i.push(u),c.slice(0,d)+el+c.slice(d)+Ke+v):c+Ke+(d===-2?a:v)}return[il(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let As=class sl{constructor({strings:t,_$litType$:n},i){let s;this.parts=[];let o=0,r=0;const a=t.length-1,c=this.parts,[u,l]=Gu(t,n);if(this.el=sl.createElement(u,i),tt.currentNode=this.el.content,n===2||n===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=tt.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(el)){const h=l[r++],v=s.getAttribute(d).split(Ke),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:o,name:f[2],strings:v,ctor:f[1]==="."?Yu:f[1]==="?"?Xu:f[1]==="@"?Zu:vi}),s.removeAttribute(d)}else d.startsWith(Ke)&&(c.push({type:6,index:o}),s.removeAttribute(d));if(nl.test(s.tagName)){const d=s.textContent.split(Ke),h=d.length-1;if(h>0){s.textContent=Zn?Zn.emptyScript:"";for(let v=0;v<h;v++)s.append(d[v],un()),tt.nextNode(),c.push({type:2,index:++o});s.append(d[h],un())}}}else if(s.nodeType===8)if(s.data===tl)c.push({type:2,index:o});else{let d=-1;for(;(d=s.data.indexOf(Ke,d+1))!==-1;)c.push({type:7,index:o}),d+=Ke.length-1}o++}}static createElement(t,n){const i=st.createElement("template");return i.innerHTML=t,i}};function _t(e,t,n=e,i){var r,a;if(t===He)return t;let s=i!==void 0?(r=n._$Co)==null?void 0:r[i]:n._$Cl;const o=dn(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==o&&((a=s==null?void 0:s._$AO)==null||a.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=_t(e,s._$AS(e,t.values),s,i)),t}class Qu{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)??st).importNode(n,!0);tt.currentNode=s;let o=tt.nextNode(),r=0,a=0,c=i[0];for(;c!==void 0;){if(r===c.index){let u;c.type===2?u=new yi(o,o.nextSibling,this,t):c.type===1?u=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(u=new Ju(o,this,t)),this._$AV.push(u),c=i[++a]}r!==(c==null?void 0:c.index)&&(o=tt.nextNode(),r++)}return tt.currentNode=st,s}p(t){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}let yi=class ol{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,n,i,s){this.type=2,this._$AH=S,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=_t(this,t,n),dn(t)?t===S||t==null||t===""?(this._$AH!==S&&this._$AR(),this._$AH=S):t!==this._$AH&&t!==He&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):qu(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!==S&&dn(this._$AH)?this._$AA.nextSibling.data=t:this.T(st.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=As.createElement(il(i.h,i.h[0]),this.options)),i);if(((o=this._$AH)==null?void 0:o._$AD)===s)this._$AH.p(n);else{const r=new Qu(s,this),a=r.u(this.options);r.p(n),this.T(a),this._$AH=r}}_$AC(t){let n=br.get(t.strings);return n===void 0&&br.set(t.strings,n=new As(t)),n}k(t){eo(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 ol(this.O(un()),this.O(un()),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=hr(t).nextSibling;hr(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}};class vi{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,s,o){this.type=1,this._$AH=S,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=S}_$AI(t,n=this,i,s){const o=this.strings;let r=!1;if(o===void 0)t=_t(this,t,n,0),r=!dn(t)||t!==this._$AH&&t!==He,r&&(this._$AH=t);else{const a=t;let c,u;for(t=o[0],c=0;c<o.length-1;c++)u=_t(this,a[i+c],n,c),u===He&&(u=this._$AH[c]),r||(r=!dn(u)||u!==this._$AH[c]),u===S?t=S:t!==S&&(t+=(u??"")+o[c+1]),this._$AH[c]=u}r&&!s&&this.j(t)}j(t){t===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let Yu=class extends vi{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===S?void 0:t}},Xu=class extends vi{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==S)}},Zu=class extends vi{constructor(t,n,i,s,o){super(t,n,i,s,o),this.type=5}_$AI(t,n=this){if((t=_t(this,t,n,0)??S)===He)return;const i=this._$AH,s=t===S&&i!==S||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==S&&(i===S||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)}},Ju=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){_t(this,t)}};const ed={I:yi},ji=tn.litHtmlPolyfillSupport;ji==null||ji(As,yi),(tn.litHtmlVersions??(tn.litHtmlVersions=[])).push("3.3.2");const td=(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 yi(t.insertBefore(un(),o),o,void 0,n??{})}return s._$AI(e),s};const it=globalThis;let Et=class extends At{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=td(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 He}};var Za;Et._$litElement$=!0,Et.finalized=!0,(Za=it.litElementHydrateSupport)==null||Za.call(it,{LitElement:Et});const Hi=it.litElementPolyfillSupport;Hi==null||Hi({LitElement:Et});(it.litElementVersions??(it.litElementVersions=[])).push("4.2.2");const rl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const nd={attribute:!0,type:String,converter:Xn,reflect:!1,hasChanged:Js},id=(e=nd,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:r}=n;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(r,c,e,!0,a)},init(a){return a!==void 0&&this.C(r,void 0,e,a),a}}}if(i==="setter"){const{name:r}=n;return function(a){const c=this[r];t.call(this,a),this.requestUpdate(r,c,e,!0,a)}}throw Error("Unsupported decorator location: "+i)};function bi(e){return(t,n)=>typeof n=="object"?id(e,t,n):((i,s,o)=>{const r=s.hasOwnProperty(o);return s.constructor.createProperty(o,i),r?Object.getOwnPropertyDescriptor(s,o):void 0})(e,t,n)}function y(e){return bi({...e,state:!0,attribute:!1})}const sd=50,od=200,rd="Assistant";function wr(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function xs(e){const t=wr(e==null?void 0:e.name,sd)??rd,n=wr((e==null?void 0:e.avatar)??void 0,od)??null;return{agentId:typeof(e==null?void 0:e.agentId)=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function ad(){return xs(typeof window>"u"?{}:{name:window.__TASKMASTER_ASSISTANT_NAME__,avatar:window.__TASKMASTER_ASSISTANT_AVATAR__})}const Jn="taskmaster.control.settings.v1",al="taskmaster.account.settings.";function nn(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}`}const St={gatewayUrl:nn(),token:"",theme:"system",navCollapsed:!1,navGroupsCollapsed:{}},We={sessionKey:"main",lastActiveSessionKey:"main",chatFocusMode:!1,chatShowThinking:!1,splitRatio:.6};function ld(){try{const e=localStorage.getItem(Jn);if(!e)return{...St,gatewayUrl:nn()};const t=JSON.parse(e);return{gatewayUrl:typeof t.gatewayUrl=="string"&&t.gatewayUrl.trim()?t.gatewayUrl.trim():nn(),token:typeof t.token=="string"?t.token:St.token,theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:St.theme,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:St.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:St.navGroupsCollapsed}}catch{return{...St,gatewayUrl:nn()}}}function cd(e){if(!e)return{...We};try{const t=localStorage.getItem(al+e);if(!t)return{...We};const n=JSON.parse(t);return{sessionKey:typeof n.sessionKey=="string"&&n.sessionKey.trim()?n.sessionKey.trim():We.sessionKey,lastActiveSessionKey:typeof n.lastActiveSessionKey=="string"&&n.lastActiveSessionKey.trim()?n.lastActiveSessionKey.trim():typeof n.sessionKey=="string"&&n.sessionKey.trim()||We.lastActiveSessionKey,chatFocusMode:typeof n.chatFocusMode=="boolean"?n.chatFocusMode:We.chatFocusMode,chatShowThinking:typeof n.chatShowThinking=="boolean"?n.chatShowThinking:We.chatShowThinking,splitRatio:typeof n.splitRatio=="number"&&n.splitRatio>=.4&&n.splitRatio<=.7?n.splitRatio:We.splitRatio}}catch{return{...We}}}let ei=null;function kr(e){ei=e}function qi(){return{...ld(),...cd(ei)}}function ud(e){const t={gatewayUrl:e.gatewayUrl,token:e.token,theme:e.theme,navCollapsed:e.navCollapsed,navGroupsCollapsed:e.navGroupsCollapsed};if(localStorage.setItem(Jn,JSON.stringify(t)),ei){const n={sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,chatFocusMode:e.chatFocusMode,chatShowThinking:e.chatShowThinking,splitRatio:e.splitRatio};localStorage.setItem(al+ei,JSON.stringify(n))}}(function(){try{const t=localStorage.getItem(Jn);if(!t)return;const n=JSON.parse(t);if(!("sessionKey"in n))return;const i={gatewayUrl:typeof n.gatewayUrl=="string"?n.gatewayUrl:nn(),token:typeof n.token=="string"?n.token:"",theme:n.theme==="light"||n.theme==="dark"||n.theme==="system"?n.theme:"system",navCollapsed:typeof n.navCollapsed=="boolean"?n.navCollapsed:!1,navGroupsCollapsed:typeof n.navGroupsCollapsed=="object"&&n.navGroupsCollapsed!==null?n.navGroupsCollapsed:{}};localStorage.setItem(Jn,JSON.stringify(i))}catch{}})();function ll(e){var 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 dd=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Pn=/<\s*\/?\s*final\b[^>]*>/gi,Sr=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function pd(e,t){return e.trimStart()}function hd(e,t){if(!e||!dd.test(e))return e;let n=e;Pn.test(n)?(Pn.lastIndex=0,n=n.replace(Pn,"")):Pn.lastIndex=0,Sr.lastIndex=0;let i="",s=0,o=!1;for(const r of n.matchAll(Sr)){const a=r.index??0,c=r[1]==="/";o?c&&(o=!1):(i+=n.slice(s,a),c||(o=!0)),s=a+r[0].length}return i+=n.slice(s),pd(i)}function cl(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function wi(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0){const r=-t,a=Math.round(r/1e3);if(a<60)return`in ${a}s`;const c=Math.round(a/60);if(c<60)return`in ${c}m`;const u=Math.round(c/60);return u<48?`in ${u}h`:`in ${Math.round(u/24)}d`}const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const i=Math.round(n/60);if(i<60)return`${i}m ago`;const s=Math.round(i/60);return s<48?`${s}h ago`:`${Math.round(s/24)}d ago`}function ul(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const i=Math.round(n/60);return i<48?`${i}h`:`${Math.round(i/24)}d`}function fd(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function dl(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function ti(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Vi(e){return hd(e)}const gd=/^\[([^\]]+)\]\s*/,md=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Gi=new WeakMap,Qi=new WeakMap;function yd(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:md.some(t=>e.startsWith(`${t} `))}function Yi(e){const t=e.match(gd);if(!t)return e;const n=t[1]??"";return yd(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"?Vi(i):Yi(i);if(Array.isArray(i)){const s=i.map(o=>{const r=o;return r.type==="text"&&typeof r.text=="string"?r.text:null}).filter(o=>typeof o=="string");if(s.length>0){const o=s.join(`
|
|
4
|
+
`);return n==="assistant"?Vi(o):Yi(o)}}return typeof t.text=="string"?n==="assistant"?Vi(t.text):Yi(t.text):null}function pl(e){if(!e||typeof e!="object")return sn(e);const t=e;if(Gi.has(t))return Gi.get(t)??null;const n=sn(e);return Gi.set(t,n),n}function Ar(e){const n=e.content,i=[];if(Array.isArray(n))for(const a of n){const c=a;if(c.type==="thinking"&&typeof c.thinking=="string"){const u=c.thinking.trim();u&&i.push(u)}}if(i.length>0)return i.join(`
|
|
5
|
+
`);const s=bd(e);if(!s)return null;const r=[...s.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(a=>(a[1]??"").trim()).filter(Boolean);return r.length>0?r.join(`
|
|
6
|
+
`):null}function vd(e){if(!e||typeof e!="object")return Ar(e);const t=e;if(Qi.has(t))return Qi.get(t)??null;const n=Ar(e);return Qi.set(t,n),n}function bd(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 wd(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 kd=/Read HEARTBEAT\.md if it exists|reply HEARTBEAT_OK/i,Sd=/^[\s*`_]*HEARTBEAT_OK[\s*`_]*$/i,Ad=/^[\s*`_]*NO_REPLY[\s*`_]*$/i,xd=/^A new session was started via \/new or \/reset\./;function $d(e){const t=e,n=typeof t.role=="string"?t.role:"";let i="";typeof t.content=="string"?i=t.content:Array.isArray(t.content)?i=t.content.filter(
|
|
8
|
+
`):""}const kd=/Read HEARTBEAT\.md if it exists|reply HEARTBEAT_OK/i,Sd=/^[\s*`_]*HEARTBEAT_OK[\s*`_]*$/i,Ad=/^[\s*`_]*NO_REPLY[\s*`_]*$/i,xd=/^A new session was started via \/new or \/reset\./;function $d(e){const t=e,n=typeof t.role=="string"?t.role:"";let i="";typeof t.content=="string"?i=t.content:Array.isArray(t.content)?i=t.content.filter(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"&&kd.test(s)||n==="assistant"&&Sd.test(s)||n==="user"&&xd.test(s)||n==="assistant"&&Ad.test(s)):!1}function Ed(e){return e.filter(t=>!$d(t))}function hl(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,r=Array.isArray(o)&&o.some(d=>{const v=String(d.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),a=typeof t.toolName=="string"||typeof t.tool_name=="string";(i||r||a)&&(n="toolResult");let c=[];typeof t.content=="string"?c=[{type:"text",text:t.content}]:Array.isArray(t.content)?c=t.content.map(d=>({type:d.type||"text",text:d.text,name:d.name,args:d.args||d.arguments})):typeof t.text=="string"&&(c=[{type:"text",text:t.text}]);const u=typeof t.timestamp=="number"?t.timestamp:Date.now(),l=typeof t.id=="string"?t.id:void 0;return{role:n,content:c,timestamp:u,id:l}}function fl(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 gl(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}function xr(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 Td(){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 to(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),xr(t)}return xr(Td())}async function _e(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:5e3}),n=Array.isArray(t.messages)?t.messages:[];e.chatMessages=Ed(n),e.chatThinkingLevel=t.thinkingLevel??null,e.chatModelProvider=typeof t.modelProvider=="string"?t.modelProvider:null,e.chatModel=typeof t.model=="string"?t.model:null,e.chatVerboseLevel=typeof t.verboseLevel=="string"?t.verboseLevel:null,e.chatFillerEnabled=typeof t.fillerEnabled=="boolean"?t.fillerEnabled:null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Cd(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function ml(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(),r=(n??[]).filter(v=>!v.fileName),a=(n??[]).filter(v=>v.fileName),c=[],u=a.map(v=>v.fileName).filter(Boolean);if(u.length>0){const v=i?`${u.join(", ")}
|
|
9
9
|
|
|
10
|
-
${i}`:u.join(", ");c.push({type:"text",text:v})}else i&&c.push({type:"text",text:i});for(const v of
|
|
10
|
+
${i}`:u.join(", ");c.push({type:"text",text:v})}else i&&c.push({type:"text",text:i});for(const v of r)c.push({type:"image",source:{type:"base64",media_type:v.mimeType,data:v.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:c,timestamp:o}],e.chatSending=!0,e.lastError=null;const l=to();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=o;const d=[...r,...a],h=d.length>0?d.map(v=>{if(v.textContent)return{type:"document",mimeType:v.mimeType||"text/plain",fileName:v.fileName,content:btoa(unescape(encodeURIComponent(v.textContent)))};const f=Cd(v.dataUrl);return f?{type:v.fileName?"document":"image",mimeType:f.mimeType,fileName:v.fileName,content:f.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 f=String(v);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=f,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+f}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function yl(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 vl(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());return o&&(e.chatInterimText=e.chatInterimText?`${e.chatInterimText}
|
|
11
11
|
|
|
12
|
-
${
|
|
13
|
-
`)}function
|
|
12
|
+
${o}`:o),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 $s=Object.freeze(Object.defineProperty({__proto__:null,abortChatRun:yl,handleChatEvent:vl,loadChatHistory:_e,sendChatMessage:ml},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=ti(e.sessionsFilterActive??"",0),i=ti(e.sessionsFilterLimit??"",0);n>0&&(t.activeMinutes=n),i>0&&(t.limit=i);const s=await e.client.request("sessions.list",t);s&&(e.sessionsResult=s)}catch(t){e.sessionsError=String(t)}finally{e.sessionsLoading=!1}}}async function Ln(e,t,n){if(!e.client||!e.connected)return;const i={key:t};"label"in n&&(i.label=n.label),"thinkingLevel"in n&&(i.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(i.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(i.reasoningLevel=n.reasoningLevel),"model"in n&&(i.model=n.model),"fillerEnabled"in n&&(i.fillerEnabled=n.fillerEnabled);try{await e.client.request("sessions.patch",i),await no(e)}catch(s){e.sessionsError=String(s)}}const $r=50,_d=80,Md=12e4;function Pd(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
|
+
`)}function Er(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Pd(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=dl(n,Md);return i.truncated?`${i.text}
|
|
14
14
|
|
|
15
|
-
… truncated (${i.total} chars, showing first ${i.text.length}).`:i.text}function Ld(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 Id(e){if(e.toolStreamOrder.length<=$
|
|
15
|
+
… truncated (${i.total} chars, showing first ${i.text.length}).`:i.text}function Ld(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 Id(e){if(e.toolStreamOrder.length<=$r)return;const t=e.toolStreamOrder.length-$r,n=e.toolStreamOrder.splice(0,t);for(const i of n)e.toolStreamById.delete(i)}function Rd(e){e.chatToolMessages=e.toolStreamOrder.map(t=>{var n;return(n=e.toolStreamById.get(t))==null?void 0:n.message}).filter(t=>!!t)}function Es(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Rd(e)}function Nd(e,t=!1){if(t){Es(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>Es(e),_d))}function io(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],Es(e)}const Dd=5e3;function Od(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},Dd))}function Bd(e,t){if(!t)return;if(t.stream==="compaction"){Od(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",r=typeof i.phase=="string"?i.phase:"",a=r==="start"?i.args:void 0,c=r==="update"?Er(i.partialResult):r==="result"?Er(i.result):void 0,u=Date.now();let l=e.toolStreamById.get(s);l?(l.name=o,a!==void 0&&(l.args=a),c!==void 0&&(l.output=c),l.updatedAt=u):(l={toolCallId:s,runId:t.runId,sessionKey:n,name:o,args:a,output:c,startedAt:typeof t.ts=="number"?t.ts:u,updatedAt:u,message:{}},e.toolStreamById.set(s,l),e.toolStreamOrder.push(s)),l.message=Ld(l),Id(e),Nd(e,r==="result")}function fn(e,t=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const n=()=>{const i=e.querySelector(".chat-thread");if(i){const s=getComputedStyle(i).overflowY;if(s==="auto"||s==="scroll"||i.scrollHeight-i.clientHeight>1)return i}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const i=n();if(!i)return;const s=i.scrollHeight-i.scrollTop-i.clientHeight;if(!(t||e.chatUserNearBottom||s<200))return;t&&(e.chatHasAutoScrolled=!0),i.scrollTop=i.scrollHeight,e.chatUserNearBottom=!0;const r=t?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const a=n();if(!a)return;const c=a.scrollHeight-a.scrollTop-a.clientHeight;(t||e.chatUserNearBottom||c<200)&&(a.scrollTop=a.scrollHeight,e.chatUserNearBottom=!0)},r)})})}function bl(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 Fd(e,t){const n=t.currentTarget;if(!n)return;const i=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=i<200}function Ud(e,t){const n=t.currentTarget;n&&(e.logsAtBottom=n.scrollTop<80)}function Wd(e,t){const n=t.currentTarget;n&&(e.logsAtBottom=n.scrollTop<80)}function Kd(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0}function zd(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
16
16
|
`)}
|
|
17
|
-
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),
|
|
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 jd(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"),
|
|
20
|
-
`}function wl(e,t,n){if(t.length===0)return;let i=e;for(let r=0;r<t.length-1;r+=1){const o=t[r],a=t[r+1];if(typeof o=="number"){if(!Array.isArray(i))return;i[o]==null&&(i[o]=typeof a=="number"?[]:{}),i=i[o]}else{if(typeof i!="object"||i==null)return;const c=i;c[o]==null&&(c[o]=typeof a=="number"?[]:{}),i=c[o]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function Me(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Vd(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function kl(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});qd(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function qd(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Vd(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?rt(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=rt(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=qe(t.config??{}),e.configFormOriginal=qe(t.config??{}),e.configRawOriginal=n)}async function Gd(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?rt(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 Me(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function gn(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function ki(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t={includeDisabled:!0};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(t.agentIds=e.workspaceAgentIds);const n=await e.client.request("cron.list",t);e.cronJobs=Array.isArray(n.jobs)?n.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function Qd(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=ti(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const i=e.everyUnit;return{kind:"every",everyMs:n*(i==="minutes"?6e4:i==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function Yd(e){if(e.payloadKind==="systemEvent"){const s=e.payloadText.trim();if(!s)throw new Error("System event text required.");return{kind:"systemEvent",text:s}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const i=ti(e.timeoutSeconds,0);return i>0&&(n.timeoutSeconds=i),n}async function Xd(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=Qd(e.cronForm),i=Yd(e.cronForm),s=e.cronForm.agentId.trim(),r=(t=e.cronForm.accountId)==null?void 0:t.trim(),o={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:r||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!o.name)throw new Error("Name required.");await e.client.request("cron.add",o),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await ki(e),await gn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Zd(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await ki(e),await gn(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function Jd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await Ts(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ep(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await ki(e),await gn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ts(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function V(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function sr(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const i=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=i.message??null,e.whatsappLoginQrDataUrl=i.qrDataUrl??null,e.whatsappLoginConnected=null}catch(i){e.whatsappLoginMessage=String(i),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Sl(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.wait",{timeoutMs:12e4,accountId:t});e.whatsappLoginMessage=n.message??null,e.whatsappLoginConnected=n.connected??null,n.connected&&(e.whatsappLoginQrDataUrl=null,e.whatsappActiveQrAccountId=null,e.whatsappPairedPhone=n.selfPhone??null)}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Al(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null}catch(n){e.whatsappLoginMessage=String(n)}finally{e.whatsappBusy=!1}}}async function xl(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const i=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!i){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const r=qe(s.config??{});(!r.channels||typeof r.channels!="object")&&(r.channels={});const o=r.channels;(!o.whatsapp||typeof o.whatsapp!="object")&&(o.whatsapp={});const a=o.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const c=a.accounts;if(c[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}c[i]={name:n,provider:"baileys"};const u=s.hash;if(!u){e.whatsappAccountError="Config hash missing; reload and retry.";return}const l=rt(r);await e.client.request("config.set",{raw:l,baseHash:u}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await V(e,!0),await sr(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function $l(e,t){if(!(!e.client||!e.connected)&&!e.whatsappAccountSaving){e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=qe(n.config??{}),s=i.channels,r=s==null?void 0:s.whatsapp,o=r==null?void 0:r.accounts;if(!o){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(o).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!o[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete o[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(l=>{const d=l.match;return!d||d.channel!=="whatsapp"?!0:d.accountId!==t}));const c=n.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const u=rt(i);await e.client.request("config.set",{raw:u,baseHash:c}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await V(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const tp=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:xl,loadChannels:V,logoutWhatsApp:Al,removeWhatsAppAccount:$l,startWhatsAppLogin:sr,waitWhatsAppLogin:Sl},Symbol.toStringTag,{value:"Module"}));async function rr(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,i,s]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const r=i;e.debugModels=Array.isArray(r==null?void 0:r.models)?r==null?void 0:r.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const np=2e3,ip=new Set(["trace","debug","info","warn","error","fatal"]);function sp(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 rp(e){if(typeof e!="string")return null;const t=e.toLowerCase();return ip.has(t)?t:null}function El(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,i=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,s=rp((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),r=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,o=sp(r);let a=null;o&&(typeof o.subsystem=="string"?a=o.subsystem:typeof o.module=="string"&&(a=o.module)),!a&&r&&r.length<120&&(a=r);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:i,level:s,subsystem:a,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Tt(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.logsLoading=!0),e.logsError=null;try{const i=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),r=(Array.isArray(i.lines)?i.lines.filter(a=>typeof a=="string"):[]).map(El),o=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=o?r:[...e.logsEntries,...r].slice(-np),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 op=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:Tt,parseLogLine:El},Symbol.toStringTag,{value:"Module"}));const Tl={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:oe,n:Vn,Gx:To,Gy:Co,a:Xi,d:Zi,h:ap}=Tl,ot=32,or=64,lp=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},te=(e="")=>{const t=new Error(e);throw lp(t,te),t},cp=e=>typeof e=="bigint",up=e=>typeof e=="string",dp=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ge=(e,t,n="")=>{const i=dp(e),s=e==null?void 0:e.length,r=t!==void 0;if(!i||r&&s!==t){const o=n&&`"${n}" `,a=r?` of length ${t}`:"",c=i?`length=${s}`:`type=${typeof e}`;te(o+"expected Uint8Array"+a+", got "+c)}return e},Si=e=>new Uint8Array(e),Cl=e=>Uint8Array.from(e),_l=(e,t)=>e.toString(16).padStart(t,"0"),Ml=e=>Array.from(Ge(e)).map(t=>_l(t,2)).join(""),Re={_0:48,_9:57,A:65,F:70,a:97,f:102},_o=e=>{if(e>=Re._0&&e<=Re._9)return e-Re._0;if(e>=Re.A&&e<=Re.F)return e-(Re.A-10);if(e>=Re.a&&e<=Re.f)return e-(Re.a-10)},Pl=e=>{const t="hex invalid";if(!up(e))return te(t);const n=e.length,i=n/2;if(n%2)return te(t);const s=Si(i);for(let r=0,o=0;r<i;r++,o+=2){const a=_o(e.charCodeAt(o)),c=_o(e.charCodeAt(o+1));if(a===void 0||c===void 0)return te(t);s[r]=a*16+c}return s},Ll=()=>globalThis==null?void 0:globalThis.crypto,pp=()=>{var e;return((e=Ll())==null?void 0:e.subtle)??te("crypto.subtle must be defined, consider polyfill")},pn=(...e)=>{const t=Si(e.reduce((i,s)=>i+Ge(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},hp=(e=ot)=>Ll().getRandomValues(Si(e)),ni=BigInt,et=(e,t,n,i="bad number: out of range")=>cp(e)&&t<=e&&e<n?e:te(i),P=(e,t=oe)=>{const n=e%t;return n>=0n?n:t+n},Il=e=>P(e,Vn),fp=(e,t)=>{(e===0n||t<=0n)&&te("no inverse n="+e+" mod="+t);let n=P(e,t),i=t,s=0n,r=1n;for(;n!==0n;){const o=i/n,a=i%n,c=s-r*o;i=n,n=a,s=r,r=c}return i===1n?P(s,t):te("no inverse")},gp=e=>{const t=Ol[e];return typeof t!="function"&&te("hashes."+e+" not set"),t},Ji=e=>e instanceof at?e:te("Point expected"),Cs=2n**256n,Ce=class Ce{constructor(t,n,i,s){U(this,"X");U(this,"Y");U(this,"Z");U(this,"T");const r=Cs;this.X=et(t,0n,r),this.Y=et(n,0n,r),this.Z=et(i,1n,r),this.T=et(s,0n,r),Object.freeze(this)}static CURVE(){return Tl}static fromAffine(t){return new Ce(t.x,t.y,1n,P(t.x*t.y))}static fromBytes(t,n=!1){const i=Zi,s=Cl(Ge(t,ot)),r=t[31];s[31]=r&-129;const o=Nl(s);et(o,0n,n?Cs:oe);const c=P(o*o),u=P(c-1n),l=P(i*c+1n);let{isValid:d,value:h}=yp(u,l);d||te("bad point: y not sqrt");const v=(h&1n)===1n,f=(r&128)!==0;return!n&&h===0n&&f&&te("bad point: x==0, isLastByteOdd"),f!==v&&(h=P(-h)),new Ce(h,o,1n,P(h*o))}static fromHex(t,n){return Ce.fromBytes(Pl(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Xi,n=Zi,i=this;if(i.is0())return te("bad point: ZERO");const{X:s,Y:r,Z:o,T:a}=i,c=P(s*s),u=P(r*r),l=P(o*o),d=P(l*l),h=P(c*t),v=P(l*P(h+u)),f=P(d+P(n*P(c*u)));if(v!==f)return te("bad point: equation left != right (1)");const b=P(s*r),k=P(o*a);return b!==k?te("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:r,Y:o,Z:a}=Ji(t),c=P(n*a),u=P(r*s),l=P(i*a),d=P(o*s);return c===u&&l===d}is0(){return this.equals($t)}negate(){return new Ce(P(-this.X),this.Y,this.Z,P(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=Xi,r=P(t*t),o=P(n*n),a=P(2n*P(i*i)),c=P(s*r),u=t+n,l=P(P(u*u)-r-o),d=c+o,h=d-a,v=c-o,f=P(l*h),b=P(d*v),k=P(l*v),x=P(h*d);return new Ce(f,b,x,k)}add(t){const{X:n,Y:i,Z:s,T:r}=this,{X:o,Y:a,Z:c,T:u}=Ji(t),l=Xi,d=Zi,h=P(n*o),v=P(i*a),f=P(r*d*u),b=P(s*c),k=P((n+i)*(o+a)-h-v),x=P(b-f),$=P(b+f),T=P(v-l*h),C=P(k*x),M=P($*T),R=P(k*T),B=P(x*$);return new Ce(C,M,B,R)}subtract(t){return this.add(Ji(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return $t;if(et(t,1n,Vn),t===1n)return this;if(this.equals(lt))return Cp(t).p;let i=$t,s=lt;for(let r=this;t>0n;r=r.double(),t>>=1n)t&1n?i=i.add(r):n&&(s=s.add(r));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals($t))return{x:0n,y:1n};const s=fp(i,oe);P(i*s)!==1n&&te("invalid inverse");const r=P(t*s),o=P(n*s);return{x:r,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Rl(n);return i[31]|=t&1n?128:0,i}toHex(){return Ml(this.toBytes())}clearCofactor(){return this.multiply(ni(ap),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Vn/2n,!1).double();return Vn%2n&&(t=t.add(this)),t.is0()}};U(Ce,"BASE"),U(Ce,"ZERO");let at=Ce;const lt=new at(To,Co,1n,P(To*Co)),$t=new at(0n,1n,1n,0n);at.BASE=lt;at.ZERO=$t;const Rl=e=>Pl(_l(et(e,0n,Cs),or)).reverse(),Nl=e=>ni("0x"+Ml(Cl(Ge(e)).reverse())),xe=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=oe;return n},mp=e=>{const n=e*e%oe*e%oe,i=xe(n,2n)*n%oe,s=xe(i,1n)*e%oe,r=xe(s,5n)*s%oe,o=xe(r,10n)*r%oe,a=xe(o,20n)*o%oe,c=xe(a,40n)*a%oe,u=xe(c,80n)*c%oe,l=xe(u,80n)*c%oe,d=xe(l,10n)*r%oe;return{pow_p_5_8:xe(d,2n)*e%oe,b2:n}},Mo=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,yp=(e,t)=>{const n=P(t*t*t),i=P(n*n*t),s=mp(e*i).pow_p_5_8;let r=P(e*n*s);const o=P(t*r*r),a=r,c=P(r*Mo),u=o===e,l=o===P(-e),d=o===P(-e*Mo);return u&&(r=a),(l||d)&&(r=c),(P(r)&1n)===1n&&(r=P(-r)),{isValid:u||l,value:r}},_s=e=>Il(Nl(e)),ar=(...e)=>Ol.sha512Async(pn(...e)),vp=(...e)=>gp("sha512")(pn(...e)),Dl=e=>{const t=e.slice(0,ot);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(ot,or),i=_s(t),s=lt.multiply(i),r=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:r}},lr=e=>ar(Ge(e,ot)).then(Dl),bp=e=>Dl(vp(Ge(e,ot))),wp=e=>lr(e).then(t=>t.pointBytes),kp=e=>ar(e.hashable).then(e.finish),Sp=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,r=_s(t),o=lt.multiply(r).toBytes();return{hashable:pn(o,i,n),finish:u=>{const l=Il(r+_s(u)*s);return Ge(pn(o,Rl(l)),or)}}},Ap=async(e,t)=>{const n=Ge(e),i=await lr(t),s=await ar(i.prefix,n);return kp(Sp(i,s,n))},Ol={sha512Async:async e=>{const t=pp(),n=pn(e);return Si(await t.digest("SHA-512",n.buffer))},sha512:void 0},xp=(e=hp(ot))=>e,$p={getExtendedPublicKeyAsync:lr,getExtendedPublicKey:bp,randomSecretKey:xp},ii=8,Ep=256,Bl=Math.ceil(Ep/ii)+1,Ms=2**(ii-1),Tp=()=>{const e=[];let t=lt,n=t;for(let i=0;i<Bl;i++){n=t,e.push(n);for(let s=1;s<Ms;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Po;const Lo=(e,t)=>{const n=t.negate();return e?n:t},Cp=e=>{const t=Po||(Po=Tp());let n=$t,i=lt;const s=2**ii,r=s,o=ni(s-1),a=ni(ii);for(let c=0;c<Bl;c++){let u=Number(e&o);e>>=a,u>Ms&&(u-=r,e+=1n);const l=c*Ms,d=l,h=l+Math.abs(u)-1,v=c%2!==0,f=u<0;u===0?i=i.add(Lo(v,t[d])):n=n.add(Lo(f,t[h]))}return e!==0n&&te("invalid wnaf"),{p:n,f:i}},es="taskmaster-device-identity-v1";function Ps(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Fl(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),i=atob(n),s=new Uint8Array(i.length);for(let r=0;r<i.length;r+=1)s[r]=i.charCodeAt(r);return s}function _p(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Ul(e){const t=await crypto.subtle.digest("SHA-256",e);return _p(new Uint8Array(t))}async function Mp(){const e=$p.randomSecretKey(),t=await wp(e);return{deviceId:await Ul(t),publicKey:Ps(t),privateKey:Ps(e)}}async function Pp(){try{const n=localStorage.getItem(es);if(n){const i=JSON.parse(n);if((i==null?void 0:i.version)===1&&typeof i.deviceId=="string"&&typeof i.publicKey=="string"&&typeof i.privateKey=="string"){const s=await Ul(Fl(i.publicKey));if(s!==i.deviceId){const r={...i,deviceId:s};return localStorage.setItem(es,JSON.stringify(r)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await Mp(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(es,JSON.stringify(t)),e}async function Lp(e,t){const n=Fl(e),i=new TextEncoder().encode(t),s=await Ap(i,n);return Ps(s)}const Wl="taskmaster.device.auth.v1";function cr(e){return e.trim()}function Ip(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const i=n.trim();i&&t.add(i)}return[...t].sort()}function ur(){try{const e=window.localStorage.getItem(Wl);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function Kl(e){try{window.localStorage.setItem(Wl,JSON.stringify(e))}catch{}}function Rp(e){const t=ur();if(!t||t.deviceId!==e.deviceId)return null;const n=cr(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function Np(e){const t=cr(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=ur();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:Ip(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Kl(n),s}function Dp(e){const t=ur();if(!t||t.deviceId!==e.deviceId)return;const n=cr(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Kl(i)}async function dr(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t!=null&&t.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n==null?void 0:n.pending)?n.pending:[],paired:Array.isArray(n==null?void 0:n.paired)?n.paired:[]}}catch(n){t!=null&&t.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function pr(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t!=null&&t.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t!=null&&t.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function Op(e){return{method:"exec.approvals.get",params:{}}}async function Bp(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Op(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);Fp(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Fp(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=qe(t.file??{}))}async function zl(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function Mt(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Ai(e){return e instanceof Error?e.message:String(e)}async function ct(e,t){if(t!=null&&t.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=Ai(n)}finally{e.skillsLoading=!1}}}function jl(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Hl(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await ct(e),Mt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Ai(i);e.skillsError=s,Mt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function ql(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await ct(e),Mt(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Ai(n);e.skillsError=i,Mt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Vl(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 ct(e),Mt(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const r=Ai(s);e.skillsError=r,Mt(e,t,{kind:"error",message:r})}finally{e.skillsBusyKey=null}}}const Up=Object.freeze(Object.defineProperty({__proto__:null,installSkill:Vl,loadSkills:ct,saveSkillApiKey:ql,updateSkillEdit:jl,updateSkillEnabled:Hl},Symbol.toStringTag,{value:"Module"})),Gl={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},Ql=new Map(Object.entries(Gl).map(([e,t])=>[t,e]));function xi(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function hn(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 Wp(e,t=""){const n=xi(t),i=Gl[e];return n?`${n}${i}`:i}function Yl(e,t=""){const n=xi(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=hn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":Ql.get(s)??null}function Kp(e){let t=hn(e);if(t.endsWith("/index.html")&&(t=hn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let i=0;i<n.length;i++){const s=`/${n.slice(i).join("/")}`.toLowerCase();if(Ql.has(s)){const r=n.slice(0,i);return r.length?`/${r.join("/")}`:""}}return`/${n.join("/")}`}function zp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function hr(e){return e==="system"?zp():e}const In=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,jp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Rn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Hp=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var u;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const r=s.documentElement,o=s,a=jp();if(!!o.startViewTransition&&!a){let l=.5,d=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")l=In(n.pointerClientX/window.innerWidth),d=In(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=In((h.left+h.width/2)/window.innerWidth),d=In((h.top+h.height/2)/window.innerHeight))}r.style.setProperty("--theme-switch-x",`${l*100}%`),r.style.setProperty("--theme-switch-y",`${d*100}%`),r.classList.add("theme-transition");try{const h=(u=o.startViewTransition)==null?void 0:u.call(o,()=>{t()});h!=null&&h.finished?h.finished.finally(()=>Rn(r)):Rn(r)}catch{Rn(r),t()}return}t(),Rn(r)},qp=2e3;async function rn(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),r=Array.isArray(s.entries)?s.entries:[],o=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=o?r:[...e.sessionLogsEntries,...r].slice(-qp),s.cursors&&(e.sessionLogsCursors=s.cursors),Array.isArray(s.agents)&&(e.sessionLogsAgents=s.agents),e.sessionLogsLastFetchAt=Date.now()}catch(n){e.sessionLogsError=String(n)}finally{t!=null&&t.quiet||(e.sessionLogsLoading=!1)}}}const Xl=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:rn},Symbol.toStringTag,{value:"Module"}));async function Zl(e,t){if(!(!e.client||!e.connected))try{const n={},i=await e.client.request("memory.audit",n);i!=null&&i.ok&&(e.auditEntries=i.entries??[])}catch{}}async function Vp(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function De(e){return e instanceof Error?e.message:String(e)}let Nn=null;function mn(e,t){Nn&&clearTimeout(Nn),e.filesMessage={kind:"success",text:t},Nn=setTimeout(()=>{e.filesMessage=null,Nn=null},3e3)}async function yn(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=De(n)}finally{e.filesLoading=!1}}}}async function Gp(e,t,n){e.filesSelectedPaths=new Set([t]),await Jl(e,t,n)}async function Qp(e,t,n){const i=new Set(e.filesSelectedPaths);if(i.has(t)?i.delete(t):i.add(t),e.filesSelectedPaths=i,i.size===1){const s=[...i][0];await Jl(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Yp(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const r of n)try{await ec(e,r,t),i++}catch(o){s=De(o)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:mn(e,`${i} file${i!==1?"s":""} downloaded`)}async function Xp(e,t,n,i){const s=t.split("/").pop()??t,r=n==="."?s:`${n}/${s}`;r!==t&&await tc(e,t,r,i)}async function Jl(e,t,n){if(!(!e.client||!e.connected)){e.filesSelectedPath=t,e.filesPreviewLoading=!0,e.filesPreviewContent=null,e.filesPreviewBinary=!1,e.filesPreviewSize=null;try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.read",i);e.filesPreviewContent=(s==null?void 0:s.content)??null,e.filesPreviewBinary=(s==null?void 0:s.binary)??!1,e.filesPreviewSize=(s==null?void 0:s.size)??null}catch(i){e.filesError=De(i)}finally{e.filesPreviewLoading=!1}}}async function ec(e,t,n){if(!(!e.client||!e.connected))try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.download",i);if(!(s!=null&&s.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const r=Uint8Array.from(atob(s.base64),u=>u.charCodeAt(0)),o=new Blob([r]),a=URL.createObjectURL(o),c=document.createElement("a");c.href=a,c.download=s.name??t.split("/").pop()??"download",document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(a)}catch(i){e.filesMessage={kind:"error",text:De(i)}}}async function Zp(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,r="";for(const o of n)try{const a=await o.arrayBuffer(),c=btoa(new Uint8Array(a).reduce((l,d)=>l+String.fromCharCode(d),"")),u={path:t,name:o.name,data:c};i&&(u.agentId=i),await e.client.request("files.upload",u),s++}catch(a){r=De(a)}e.filesUploadBusy=!1,r?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${r}`:r}:mn(e,`${s} file${s!==1?"s":""} uploaded`),await yn(e,i)}async function Jp(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),mn(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await yn(e,n)}catch(i){e.filesMessage={kind:"error",text:De(i)}}}}async function tc(e,t,n,i){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={from:t,to:n};i&&(s.agentId=i),await e.client.request("files.move",s),mn(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await yn(e,i)}catch(s){e.filesMessage={kind:"error",text:De(s)}}}}async function fr(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const i=await e.client.request("memory.status",n);i!=null&&i.ok&&(e.filesMemoryStatus={dirty:i.dirty??!1,syncing:i.syncing,syncProgress:i.syncProgress,files:i.files??0,chunks:i.chunks??0,model:i.model,embeddingState:i.embeddingState})}catch{}}async function eh(e,t){if(!(!e.client||!e.connected)&&!e.filesReindexBusy){e.filesReindexBusy=!0,e.filesMessage=null;try{const n={force:!0};t&&(n.agentId=t);const i=await e.client.request("memory.reindex",n),s=(i==null?void 0:i.files)??0,r=(i==null?void 0:i.chunks)??0;mn(e,`Re-indexed: ${s} files, ${r} chunks`),await fr(e,t)}catch(n){e.filesMessage={kind:"error",text:De(n)}}finally{e.filesReindexBusy=!1}}}function th(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n}async function nh(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:De(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function ih(e){e.filesSearchQuery="",e.filesSearchResults=null}function sh(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{pr(e,{quiet:!0})},5e3))}function rh(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function gr(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Tt(e,{quiet:!0})},2e3))}function mr(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function yr(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||rn(e,{quiet:!0})},2e3))}function vr(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function br(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&rr(e)},3e3))}function wr(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function oh(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{Zl(e)},3e4))}function ah(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function lh(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{e.tab==="files"&&fr(e)},3e3))}function ch(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function je(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,ud(n),t.theme!==e.theme&&(e.theme=t.theme,$i(e,hr(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function nc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&je(e,{...e.settings,lastActiveSessionKey:n})}function uh(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),r=t.get("gatewayUrl");let o=!1;if(n!=null){const c=n.trim();c&&c!==e.settings.token&&je(e,{...e.settings,token:c}),t.delete("token"),o=!0}if(i!=null){const c=i.trim();c&&(e.password=c),t.delete("password"),o=!0}if(s!=null){const c=s.trim();c&&(e.sessionKey=c,je(e,{...e.settings,sessionKey:c,lastActiveSessionKey:c}))}if(r!=null){const c=r.trim();c&&c!==e.settings.gatewayUrl&&je(e,{...e.settings,gatewayUrl:c}),t.delete("gatewayUrl"),o=!0}if(!o)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function dh(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?yr(e):gr(e):(mr(e),vr(e)),t==="debug"?br(e):wr(e),si(e),sc(e,t,!1)}function ph(e,t,n){Hp({nextTheme:t,applyTheme:()=>{e.theme=t,je(e,{...e.settings,theme:t}),$i(e,hr(t))},context:n,currentTheme:e.theme})}async function si(e){if(e.tab==="overview"&&await rc(e),e.tab==="channels"&&await bh(e),e.tab==="instances"&&await zl(e),e.tab==="cron"&&await kr(e),e.tab==="skills"&&await ct(e),e.tab==="nodes"&&(await pr(e),await dr(e),await Me(e),await Bp(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await xh(e),fn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await kl(e),await Me(e)),e.tab==="debug"&&(await rr(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await se(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>Xl);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await Tt(e,{reset:!0});bl(e,!0)}}function hh(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?xi(e):Kp(window.location.pathname)}function fh(e){e.theme=e.settings.theme??"system",$i(e,hr(e.theme))}function $i(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function gh(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&$i(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function mh(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 yh(e,t){if(typeof window>"u")return;const n=Yl(window.location.pathname,e.basePath)??"chat";ic(e,n),sc(e,n,t)}function vh(e){var s;if(typeof window>"u")return;const t=Yl(window.location.pathname,e.basePath);if(!t)return;const i=(s=new URL(window.location.href).searchParams.get("session"))==null?void 0:s.trim();i&&(e.sessionKey=i,je(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),ic(e,t)}function ic(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?yr(e):gr(e):(mr(e),vr(e)),t==="debug"?br(e):wr(e),e.connected&&si(e)}function sc(e,t,n){if(typeof window>"u")return;const i=hn(Wp(t,e.basePath)),s=hn(window.location.pathname),r=new URL(window.location.href);t==="chat"&&e.sessionKey?r.searchParams.set("session",e.sessionKey):r.searchParams.delete("session"),s!==i&&(r.pathname=i),n?window.history.replaceState({},"",r.toString()):window.history.pushState({},"",r.toString())}async function rc(e){await Promise.all([V(e,!1),zl(e),nr(e),gn(e),rr(e)])}async function bh(e){await Promise.all([V(e,!0),kl(e),Me(e)])}async function kr(e){await Promise.all([V(e,!1),gn(e),ki(e)])}function oc(e){return e.chatSending||!!e.chatRunId}function wh(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}async function ac(e){e.connected&&(e.chatMessage="",await yl(e))}function kh(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:tr(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(r=>({...r})):void 0}],fn(e))}async function lc(e,t,n){var s,r;ir(e);const i=await ml(e,t,n==null?void 0:n.attachments);return!i&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!i&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),i&&nc(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((r=n.previousAttachments)!=null&&r.length)&&(e.chatAttachments=n.previousAttachments),fn(e),i&&!e.chatRunId&&cc(e),i}async function cc(e){if(!e.connected||oc(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await lc(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Sh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Ah(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),r=e.chatAttachments??[],o=t==null?r:[],a=o.length>0;if(!(!s&&!a)){if(wh(s)){await ac(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),oc(e)){kh(e,s,o);return}await lc(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?o:void 0,previousAttachments:t==null?r:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function xh(e){await Promise.all([_e(e),nr(e),Ls(e)]),fn(e,!0)}const $h=cc;function Eh(e){var s,r,o;const t=ll(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((o=(r=n==null?void 0:n.sessionDefaults)==null?void 0:r.defaultAgentId)==null?void 0:o.trim())||"main"}function Th(e,t){const n=xi(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function Ls(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Eh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Th(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),r=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=r||null}catch{e.chatAvatarUrl=null}}const O={messageSquare:p`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:p`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:p`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,unlink:p`<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:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:p`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:p`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:p`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:p`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:p`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:p`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:p`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,users:p`<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>`,menu:p`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:p`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:p`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:p`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:p`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:p`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:p`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:p`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,rotateCw:p`<svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,download:p`<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,wrench:p`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:p`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:p`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:p`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:p`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,image:p`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:p`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,plug:p`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`,puzzle:p`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`,info:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>`,send:p`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>`,slidersHorizontal:p`<svg viewBox="0 0 24 24"><line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/></svg>`,square:p`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:p`<svg viewBox="0 0 24 24"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`,eyeOff:p`<svg viewBox="0 0 24 24"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,trash:p`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,chevronDown:p`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:p`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`},Ch="Taskmaster",_h="/taskmaster-icon.png",uc="#00d4ff";let Dn=null;function Ve(){return Dn||(Dn={name:window.__TASKMASTER_BRAND_NAME__||Ch,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||_h,accentColor:window.__TASKMASTER_ACCENT_COLOR__||uc},Dn)}function Mh(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 Ph(e){if(e===uc)return;const t=Mh(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 Lh=p`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,Ih=p`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>`;let Io=!1;function Rh(){Io||(Io=!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 ht(e,t){const n=(l,d)=>l===e?p`<span class="sp-page-nav-current">${l}</span>`:p`<a href=${d}>${l}</a>`,i=p`
|
|
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 Hd(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 qe(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function ot(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
20
|
+
`}function wl(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const r=t[o],a=t[o+1];if(typeof r=="number"){if(!Array.isArray(i))return;i[r]==null&&(i[r]=typeof a=="number"?[]:{}),i=i[r]}else{if(typeof i!="object"||i==null)return;const c=i;c[r]==null&&(c[r]=typeof a=="number"?[]:{}),i=c[r]}}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 Me(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Vd(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function kl(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});qd(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function qd(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Vd(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?ot(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=ot(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=qe(t.config??{}),e.configFormOriginal=qe(t.config??{}),e.configRawOriginal=n)}async function Gd(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?ot(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 Me(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function gn(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function ki(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t={includeDisabled:!0};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(t.agentIds=e.workspaceAgentIds);const n=await e.client.request("cron.list",t);e.cronJobs=Array.isArray(n.jobs)?n.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function Qd(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=ti(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const i=e.everyUnit;return{kind:"every",everyMs:n*(i==="minutes"?6e4:i==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function Yd(e){if(e.payloadKind==="systemEvent"){const s=e.payloadText.trim();if(!s)throw new Error("System event text required.");return{kind:"systemEvent",text:s}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const i=ti(e.timeoutSeconds,0);return i>0&&(n.timeoutSeconds=i),n}async function Xd(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=Qd(e.cronForm),i=Yd(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),r={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(!r.name)throw new Error("Name required.");await e.client.request("cron.add",r),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await ki(e),await gn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Zd(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await ki(e),await gn(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function Jd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await Ts(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ep(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await ki(e),await gn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ts(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function V(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 so(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const i=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=i.message??null,e.whatsappLoginQrDataUrl=i.qrDataUrl??null,e.whatsappLoginConnected=null}catch(i){e.whatsappLoginMessage=String(i),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Sl(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.wait",{timeoutMs:12e4,accountId:t});e.whatsappLoginMessage=n.message??null,e.whatsappLoginConnected=n.connected??null,n.connected&&(e.whatsappLoginQrDataUrl=null,e.whatsappActiveQrAccountId=null,e.whatsappPairedPhone=n.selfPhone??null)}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Al(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null}catch(n){e.whatsappLoginMessage=String(n)}finally{e.whatsappBusy=!1}}}async function xl(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const i=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!i){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const o=qe(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const r=o.channels;(!r.whatsapp||typeof r.whatsapp!="object")&&(r.whatsapp={});const a=r.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const c=a.accounts;if(c[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}c[i]={name:n,provider:"baileys"};const u=s.hash;if(!u){e.whatsappAccountError="Config hash missing; reload and retry.";return}const l=ot(o);await e.client.request("config.set",{raw:l,baseHash:u}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await V(e,!0),await so(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function $l(e,t){if(!(!e.client||!e.connected)&&!e.whatsappAccountSaving){e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=qe(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,r=o==null?void 0:o.accounts;if(!r){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(r).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!r[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete r[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(l=>{const d=l.match;return!d||d.channel!=="whatsapp"?!0:d.accountId!==t}));const c=n.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const u=ot(i);await e.client.request("config.set",{raw:u,baseHash:c}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await V(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const tp=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:xl,loadChannels:V,logoutWhatsApp:Al,removeWhatsAppAccount:$l,startWhatsAppLogin:so,waitWhatsAppLogin:Sl},Symbol.toStringTag,{value:"Module"}));async function oo(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 np=2e3,ip=new Set(["trace","debug","info","warn","error","fatal"]);function sp(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 op(e){if(typeof e!="string")return null;const t=e.toLowerCase();return ip.has(t)?t:null}function El(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,i=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,s=op((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,r=sp(o);let a=null;r&&(typeof r.subsystem=="string"?a=r.subsystem:typeof r.module=="string"&&(a=r.module)),!a&&o&&o.length<120&&(a=o);let c=null;return typeof t[1]=="string"?c=t[1]:!r&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:i,level:s,subsystem:a,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Tt(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(a=>typeof a=="string"):[]).map(El),r=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-np),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const rp=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:Tt,parseLogLine:El},Symbol.toStringTag,{value:"Module"}));const Tl={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:re,n:Vn,Gx:Tr,Gy:Cr,a:Xi,d:Zi,h:ap}=Tl,rt=32,ro=64,lp=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},te=(e="")=>{const t=new Error(e);throw lp(t,te),t},cp=e=>typeof e=="bigint",up=e=>typeof e=="string",dp=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ge=(e,t,n="")=>{const i=dp(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const r=n&&`"${n}" `,a=o?` of length ${t}`:"",c=i?`length=${s}`:`type=${typeof e}`;te(r+"expected Uint8Array"+a+", got "+c)}return e},Si=e=>new Uint8Array(e),Cl=e=>Uint8Array.from(e),_l=(e,t)=>e.toString(16).padStart(t,"0"),Ml=e=>Array.from(Ge(e)).map(t=>_l(t,2)).join(""),Re={_0:48,_9:57,A:65,F:70,a:97,f:102},_r=e=>{if(e>=Re._0&&e<=Re._9)return e-Re._0;if(e>=Re.A&&e<=Re.F)return e-(Re.A-10);if(e>=Re.a&&e<=Re.f)return e-(Re.a-10)},Pl=e=>{const t="hex invalid";if(!up(e))return te(t);const n=e.length,i=n/2;if(n%2)return te(t);const s=Si(i);for(let o=0,r=0;o<i;o++,r+=2){const a=_r(e.charCodeAt(r)),c=_r(e.charCodeAt(r+1));if(a===void 0||c===void 0)return te(t);s[o]=a*16+c}return s},Ll=()=>globalThis==null?void 0:globalThis.crypto,pp=()=>{var e;return((e=Ll())==null?void 0:e.subtle)??te("crypto.subtle must be defined, consider polyfill")},pn=(...e)=>{const t=Si(e.reduce((i,s)=>i+Ge(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},hp=(e=rt)=>Ll().getRandomValues(Si(e)),ni=BigInt,et=(e,t,n,i="bad number: out of range")=>cp(e)&&t<=e&&e<n?e:te(i),P=(e,t=re)=>{const n=e%t;return n>=0n?n:t+n},Il=e=>P(e,Vn),fp=(e,t)=>{(e===0n||t<=0n)&&te("no inverse n="+e+" mod="+t);let n=P(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const r=i/n,a=i%n,c=s-o*r;i=n,n=a,s=o,o=c}return i===1n?P(s,t):te("no inverse")},gp=e=>{const t=Ol[e];return typeof t!="function"&&te("hashes."+e+" not set"),t},Ji=e=>e instanceof at?e:te("Point expected"),Cs=2n**256n,Ce=class Ce{constructor(t,n,i,s){U(this,"X");U(this,"Y");U(this,"Z");U(this,"T");const o=Cs;this.X=et(t,0n,o),this.Y=et(n,0n,o),this.Z=et(i,1n,o),this.T=et(s,0n,o),Object.freeze(this)}static CURVE(){return Tl}static fromAffine(t){return new Ce(t.x,t.y,1n,P(t.x*t.y))}static fromBytes(t,n=!1){const i=Zi,s=Cl(Ge(t,rt)),o=t[31];s[31]=o&-129;const r=Nl(s);et(r,0n,n?Cs:re);const c=P(r*r),u=P(c-1n),l=P(i*c+1n);let{isValid:d,value:h}=yp(u,l);d||te("bad point: y not sqrt");const v=(h&1n)===1n,f=(o&128)!==0;return!n&&h===0n&&f&&te("bad point: x==0, isLastByteOdd"),f!==v&&(h=P(-h)),new Ce(h,r,1n,P(h*r))}static fromHex(t,n){return Ce.fromBytes(Pl(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Xi,n=Zi,i=this;if(i.is0())return te("bad point: ZERO");const{X:s,Y:o,Z:r,T:a}=i,c=P(s*s),u=P(o*o),l=P(r*r),d=P(l*l),h=P(c*t),v=P(l*P(h+u)),f=P(d+P(n*P(c*u)));if(v!==f)return te("bad point: equation left != right (1)");const b=P(s*o),k=P(r*a);return b!==k?te("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:r,Z:a}=Ji(t),c=P(n*a),u=P(o*s),l=P(i*a),d=P(r*s);return c===u&&l===d}is0(){return this.equals($t)}negate(){return new Ce(P(-this.X),this.Y,this.Z,P(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=Xi,o=P(t*t),r=P(n*n),a=P(2n*P(i*i)),c=P(s*o),u=t+n,l=P(P(u*u)-o-r),d=c+r,h=d-a,v=c-r,f=P(l*h),b=P(d*v),k=P(l*v),x=P(h*d);return new Ce(f,b,x,k)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:r,Y:a,Z:c,T:u}=Ji(t),l=Xi,d=Zi,h=P(n*r),v=P(i*a),f=P(o*d*u),b=P(s*c),k=P((n+i)*(r+a)-h-v),x=P(b-f),$=P(b+f),T=P(v-l*h),C=P(k*x),M=P($*T),R=P(k*T),B=P(x*$);return new Ce(C,M,B,R)}subtract(t){return this.add(Ji(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return $t;if(et(t,1n,Vn),t===1n)return this;if(this.equals(lt))return Cp(t).p;let i=$t,s=lt;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($t))return{x:0n,y:1n};const s=fp(i,re);P(i*s)!==1n&&te("invalid inverse");const o=P(t*s),r=P(n*s);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Rl(n);return i[31]|=t&1n?128:0,i}toHex(){return Ml(this.toBytes())}clearCofactor(){return this.multiply(ni(ap),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Vn/2n,!1).double();return Vn%2n&&(t=t.add(this)),t.is0()}};U(Ce,"BASE"),U(Ce,"ZERO");let at=Ce;const lt=new at(Tr,Cr,1n,P(Tr*Cr)),$t=new at(0n,1n,1n,0n);at.BASE=lt;at.ZERO=$t;const Rl=e=>Pl(_l(et(e,0n,Cs),ro)).reverse(),Nl=e=>ni("0x"+Ml(Cl(Ge(e)).reverse())),xe=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=re;return n},mp=e=>{const n=e*e%re*e%re,i=xe(n,2n)*n%re,s=xe(i,1n)*e%re,o=xe(s,5n)*s%re,r=xe(o,10n)*o%re,a=xe(r,20n)*r%re,c=xe(a,40n)*a%re,u=xe(c,80n)*c%re,l=xe(u,80n)*c%re,d=xe(l,10n)*o%re;return{pow_p_5_8:xe(d,2n)*e%re,b2:n}},Mr=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,yp=(e,t)=>{const n=P(t*t*t),i=P(n*n*t),s=mp(e*i).pow_p_5_8;let o=P(e*n*s);const r=P(t*o*o),a=o,c=P(o*Mr),u=r===e,l=r===P(-e),d=r===P(-e*Mr);return u&&(o=a),(l||d)&&(o=c),(P(o)&1n)===1n&&(o=P(-o)),{isValid:u||l,value:o}},_s=e=>Il(Nl(e)),ao=(...e)=>Ol.sha512Async(pn(...e)),vp=(...e)=>gp("sha512")(pn(...e)),Dl=e=>{const t=e.slice(0,rt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(rt,ro),i=_s(t),s=lt.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},lo=e=>ao(Ge(e,rt)).then(Dl),bp=e=>Dl(vp(Ge(e,rt))),wp=e=>lo(e).then(t=>t.pointBytes),kp=e=>ao(e.hashable).then(e.finish),Sp=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=_s(t),r=lt.multiply(o).toBytes();return{hashable:pn(r,i,n),finish:u=>{const l=Il(o+_s(u)*s);return Ge(pn(r,Rl(l)),ro)}}},Ap=async(e,t)=>{const n=Ge(e),i=await lo(t),s=await ao(i.prefix,n);return kp(Sp(i,s,n))},Ol={sha512Async:async e=>{const t=pp(),n=pn(e);return Si(await t.digest("SHA-512",n.buffer))},sha512:void 0},xp=(e=hp(rt))=>e,$p={getExtendedPublicKeyAsync:lo,getExtendedPublicKey:bp,randomSecretKey:xp},ii=8,Ep=256,Bl=Math.ceil(Ep/ii)+1,Ms=2**(ii-1),Tp=()=>{const e=[];let t=lt,n=t;for(let i=0;i<Bl;i++){n=t,e.push(n);for(let s=1;s<Ms;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Pr;const Lr=(e,t)=>{const n=t.negate();return e?n:t},Cp=e=>{const t=Pr||(Pr=Tp());let n=$t,i=lt;const s=2**ii,o=s,r=ni(s-1),a=ni(ii);for(let c=0;c<Bl;c++){let u=Number(e&r);e>>=a,u>Ms&&(u-=o,e+=1n);const l=c*Ms,d=l,h=l+Math.abs(u)-1,v=c%2!==0,f=u<0;u===0?i=i.add(Lr(v,t[d])):n=n.add(Lr(f,t[h]))}return e!==0n&&te("invalid wnaf"),{p:n,f:i}},es="taskmaster-device-identity-v1";function Ps(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Fl(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),i=atob(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o+=1)s[o]=i.charCodeAt(o);return s}function _p(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Ul(e){const t=await crypto.subtle.digest("SHA-256",e);return _p(new Uint8Array(t))}async function Mp(){const e=$p.randomSecretKey(),t=await wp(e);return{deviceId:await Ul(t),publicKey:Ps(t),privateKey:Ps(e)}}async function Pp(){try{const n=localStorage.getItem(es);if(n){const i=JSON.parse(n);if((i==null?void 0:i.version)===1&&typeof i.deviceId=="string"&&typeof i.publicKey=="string"&&typeof i.privateKey=="string"){const s=await Ul(Fl(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(es,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 Mp(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(es,JSON.stringify(t)),e}async function Lp(e,t){const n=Fl(e),i=new TextEncoder().encode(t),s=await Ap(i,n);return Ps(s)}const Wl="taskmaster.device.auth.v1";function co(e){return e.trim()}function Ip(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 uo(){try{const e=window.localStorage.getItem(Wl);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function Kl(e){try{window.localStorage.setItem(Wl,JSON.stringify(e))}catch{}}function Rp(e){const t=uo();if(!t||t.deviceId!==e.deviceId)return null;const n=co(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function Np(e){const t=co(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=uo();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:Ip(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Kl(n),s}function Dp(e){const t=uo();if(!t||t.deviceId!==e.deviceId)return;const n=co(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Kl(i)}async function po(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 ho(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 Op(e){return{method:"exec.approvals.get",params:{}}}async function Bp(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Op(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);Fp(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Fp(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=qe(t.file??{}))}async function zl(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function Mt(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Ai(e){return e instanceof Error?e.message:String(e)}async function ct(e,t){if(t!=null&&t.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=Ai(n)}finally{e.skillsLoading=!1}}}function jl(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Hl(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await ct(e),Mt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Ai(i);e.skillsError=s,Mt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function ql(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await ct(e),Mt(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Ai(n);e.skillsError=i,Mt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Vl(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 ct(e),Mt(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=Ai(s);e.skillsError=o,Mt(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const Up=Object.freeze(Object.defineProperty({__proto__:null,installSkill:Vl,loadSkills:ct,saveSkillApiKey:ql,updateSkillEdit:jl,updateSkillEnabled:Hl},Symbol.toStringTag,{value:"Module"})),Gl={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},Ql=new Map(Object.entries(Gl).map(([e,t])=>[t,e]));function xi(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function hn(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 Wp(e,t=""){const n=xi(t),i=Gl[e];return n?`${n}${i}`:i}function Yl(e,t=""){const n=xi(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=hn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":Ql.get(s)??null}function Kp(e){let t=hn(e);if(t.endsWith("/index.html")&&(t=hn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let i=0;i<n.length;i++){const s=`/${n.slice(i).join("/")}`.toLowerCase();if(Ql.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function zp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function fo(e){return e==="system"?zp():e}const In=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,jp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Rn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Hp=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var u;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,r=s,a=jp();if(!!r.startViewTransition&&!a){let l=.5,d=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")l=In(n.pointerClientX/window.innerWidth),d=In(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=In((h.left+h.width/2)/window.innerWidth),d=In((h.top+h.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${l*100}%`),o.style.setProperty("--theme-switch-y",`${d*100}%`),o.classList.add("theme-transition");try{const h=(u=r.startViewTransition)==null?void 0:u.call(r,()=>{t()});h!=null&&h.finished?h.finished.finally(()=>Rn(o)):Rn(o)}catch{Rn(o),t()}return}t(),Rn(o)},qp=2e3;async function on(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:[],r=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=r?o:[...e.sessionLogsEntries,...o].slice(-qp),s.cursors&&(e.sessionLogsCursors=s.cursors),Array.isArray(s.agents)&&(e.sessionLogsAgents=s.agents),e.sessionLogsLastFetchAt=Date.now()}catch(n){e.sessionLogsError=String(n)}finally{t!=null&&t.quiet||(e.sessionLogsLoading=!1)}}}const Xl=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:on},Symbol.toStringTag,{value:"Module"}));async function Zl(e,t){if(!(!e.client||!e.connected))try{const n={},i=await e.client.request("memory.audit",n);i!=null&&i.ok&&(e.auditEntries=i.entries??[])}catch{}}async function Vp(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function De(e){return e instanceof Error?e.message:String(e)}let Nn=null;function mn(e,t){Nn&&clearTimeout(Nn),e.filesMessage={kind:"success",text:t},Nn=setTimeout(()=>{e.filesMessage=null,Nn=null},3e3)}async function yn(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=De(n)}finally{e.filesLoading=!1}}}}async function Gp(e,t,n){e.filesSelectedPaths=new Set([t]),await Jl(e,t,n)}async function Qp(e,t,n){const i=new Set(e.filesSelectedPaths);if(i.has(t)?i.delete(t):i.add(t),e.filesSelectedPaths=i,i.size===1){const s=[...i][0];await Jl(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Yp(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 ec(e,o,t),i++}catch(r){s=De(r)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:mn(e,`${i} file${i!==1?"s":""} downloaded`)}async function Xp(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await tc(e,t,o,i)}async function Jl(e,t,n){if(!(!e.client||!e.connected)){e.filesSelectedPath=t,e.filesPreviewLoading=!0,e.filesPreviewContent=null,e.filesPreviewBinary=!1,e.filesPreviewSize=null;try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.read",i);e.filesPreviewContent=(s==null?void 0:s.content)??null,e.filesPreviewBinary=(s==null?void 0:s.binary)??!1,e.filesPreviewSize=(s==null?void 0:s.size)??null}catch(i){e.filesError=De(i)}finally{e.filesPreviewLoading=!1}}}async function ec(e,t,n){if(!(!e.client||!e.connected))try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.download",i);if(!(s!=null&&s.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const o=Uint8Array.from(atob(s.base64),u=>u.charCodeAt(0)),r=new Blob([o]),a=URL.createObjectURL(r),c=document.createElement("a");c.href=a,c.download=s.name??t.split("/").pop()??"download",document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(a)}catch(i){e.filesMessage={kind:"error",text:De(i)}}}async function Zp(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const r of n)try{const a=await r.arrayBuffer(),c=btoa(new Uint8Array(a).reduce((l,d)=>l+String.fromCharCode(d),"")),u={path:t,name:r.name,data:c};i&&(u.agentId=i),await e.client.request("files.upload",u),s++}catch(a){o=De(a)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:mn(e,`${s} file${s!==1?"s":""} uploaded`),await yn(e,i)}async function Jp(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),mn(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await yn(e,n)}catch(i){e.filesMessage={kind:"error",text:De(i)}}}}async function tc(e,t,n,i){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={from:t,to:n};i&&(s.agentId=i),await e.client.request("files.move",s),mn(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await yn(e,i)}catch(s){e.filesMessage={kind:"error",text:De(s)}}}}async function go(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 eh(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;mn(e,`Re-indexed: ${s} files, ${o} chunks`),await go(e,t)}catch(n){e.filesMessage={kind:"error",text:De(n)}}finally{e.filesReindexBusy=!1}}}function th(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n}async function nh(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:De(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function ih(e){e.filesSearchQuery="",e.filesSearchResults=null}function sh(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{ho(e,{quiet:!0})},5e3))}function oh(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function mo(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Tt(e,{quiet:!0})},2e3))}function yo(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function vo(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||on(e,{quiet:!0})},2e3))}function bo(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function wo(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&oo(e)},3e3))}function ko(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function rh(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{Zl(e)},3e4))}function ah(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function lh(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{if(e.tab!=="files")return;const t=e;go(t,t.filesResolvedAgentId)},3e3))}function ch(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function je(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,ud(n),t.theme!==e.theme&&(e.theme=t.theme,$i(e,fo(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function nc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&je(e,{...e.settings,lastActiveSessionKey:n})}function uh(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 r=!1;if(n!=null){const c=n.trim();c&&c!==e.settings.token&&je(e,{...e.settings,token:c}),t.delete("token"),r=!0}if(i!=null){const c=i.trim();c&&(e.password=c),t.delete("password"),r=!0}if(s!=null){const c=s.trim();c&&(e.sessionKey=c,je(e,{...e.settings,sessionKey:c,lastActiveSessionKey:c}))}if(o!=null){const c=o.trim();c&&c!==e.settings.gatewayUrl&&je(e,{...e.settings,gatewayUrl:c}),t.delete("gatewayUrl"),r=!0}if(!r)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function dh(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?vo(e):mo(e):(yo(e),bo(e)),t==="debug"?wo(e):ko(e),si(e),sc(e,t,!1)}function ph(e,t,n){Hp({nextTheme:t,applyTheme:()=>{e.theme=t,je(e,{...e.settings,theme:t}),$i(e,fo(t))},context:n,currentTheme:e.theme})}async function si(e){if(e.tab==="overview"&&await oc(e),e.tab==="channels"&&await bh(e),e.tab==="instances"&&await zl(e),e.tab==="cron"&&await So(e),e.tab==="skills"&&await ct(e),e.tab==="nodes"&&(await ho(e),await po(e),await Me(e),await Bp(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await xh(e),fn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await kl(e),await Me(e)),e.tab==="debug"&&(await oo(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await se(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>Xl);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await Tt(e,{reset:!0});bl(e,!0)}}function hh(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?xi(e):Kp(window.location.pathname)}function fh(e){e.theme=e.settings.theme??"system",$i(e,fo(e.theme))}function $i(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function gh(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&$i(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function mh(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 yh(e,t){if(typeof window>"u")return;const n=Yl(window.location.pathname,e.basePath)??"chat";ic(e,n),sc(e,n,t)}function vh(e){var s;if(typeof window>"u")return;const t=Yl(window.location.pathname,e.basePath);if(!t)return;const i=(s=new URL(window.location.href).searchParams.get("session"))==null?void 0:s.trim();i&&(e.sessionKey=i,je(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),ic(e,t)}function ic(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?vo(e):mo(e):(yo(e),bo(e)),t==="debug"?wo(e):ko(e),e.connected&&si(e)}function sc(e,t,n){if(typeof window>"u")return;const i=hn(Wp(t,e.basePath)),s=hn(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 oc(e){await Promise.all([V(e,!1),zl(e),no(e),gn(e),oo(e)])}async function bh(e){await Promise.all([V(e,!0),kl(e),Me(e)])}async function So(e){await Promise.all([V(e,!1),gn(e),ki(e)])}function rc(e){return e.chatSending||!!e.chatRunId}function wh(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}async function ac(e){e.connected&&(e.chatMessage="",await yl(e))}function kh(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:to(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],fn(e))}async function lc(e,t,n){var s,o;io(e);const i=await ml(e,t,n==null?void 0:n.attachments);return!i&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!i&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),i&&nc(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((o=n.previousAttachments)!=null&&o.length)&&(e.chatAttachments=n.previousAttachments),fn(e),i&&!e.chatRunId&&cc(e),i}async function cc(e){if(!e.connected||rc(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await lc(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Sh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Ah(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],a=r.length>0;if(!(!s&&!a)){if(wh(s)){await ac(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),rc(e)){kh(e,s,r);return}await lc(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function xh(e){await Promise.all([_e(e),no(e),Ls(e)]),fn(e,!0)}const $h=cc;function Eh(e){var s,o,r;const t=ll(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((r=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:r.trim())||"main"}function Th(e,t){const n=xi(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function Ls(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Eh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Th(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 O={messageSquare:p`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:p`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:p`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,unlink:p`<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:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:p`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:p`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:p`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:p`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:p`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:p`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:p`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,users:p`<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>`,menu:p`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:p`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:p`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:p`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:p`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:p`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:p`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:p`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,rotateCw:p`<svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,download:p`<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,wrench:p`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:p`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:p`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:p`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:p`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,image:p`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:p`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,plug:p`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`,puzzle:p`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`,info:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>`,send:p`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>`,slidersHorizontal:p`<svg viewBox="0 0 24 24"><line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/></svg>`,square:p`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:p`<svg viewBox="0 0 24 24"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`,eyeOff:p`<svg viewBox="0 0 24 24"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,trash:p`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,chevronDown:p`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:p`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`},Ch="Taskmaster",_h="/taskmaster-icon.png",uc="#00d4ff";let Dn=null;function Ve(){return Dn||(Dn={name:window.__TASKMASTER_BRAND_NAME__||Ch,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||_h,accentColor:window.__TASKMASTER_ACCENT_COLOR__||uc},Dn)}function Mh(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 Ph(e){if(e===uc)return;const t=Mh(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 Lh=p`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,Ih=p`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>`;let Ir=!1;function Rh(){Ir||(Ir=!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 ht(e,t){const n=(l,d)=>l===e?p`<span class="sp-page-nav-current">${l}</span>`:p`<a href=${d}>${l}</a>`,i=p`
|
|
21
21
|
${n("Setup","/setup")}
|
|
22
22
|
${n("Chat","/chat")}
|
|
23
23
|
${n("Admins","/admins")}
|
|
24
|
-
${n("
|
|
24
|
+
${n("Contacts","/contacts")}
|
|
25
25
|
${n("Files","/files")}
|
|
26
26
|
${n("Browser","/browser")}
|
|
27
27
|
${n("Advanced","/advanced")}
|
|
28
|
-
`,
|
|
28
|
+
`,o=t&&(t.isMaster!==!1||!t.hasPins)?Nh(t):S,r=t!=null&&t.hasPins&&t.onLogout?p`<button class="nav-logout-btn" @click=${t.onLogout} title="Lock">${Lh}</button>`:S,a=(t==null?void 0:t.auditCount)??0,c=a>0&&(t!=null&&t.onAuditClick)?p`<button class="nav-audit-btn" @click=${t.onAuditClick} title="Memory writes to review">
|
|
29
29
|
${Ih}
|
|
30
30
|
<span class="nav-audit-badge">${a>99?"99+":a}</span>
|
|
31
31
|
</button>`:S,u=()=>{const l=document.getElementById("nav-burger-toggle");l&&(l.checked=!1)};return Rh(),p`
|
|
@@ -37,16 +37,16 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
37
37
|
${i}
|
|
38
38
|
</nav>
|
|
39
39
|
<div class="setup-header-right">
|
|
40
|
-
${
|
|
40
|
+
${o!==S?p`<span class="nav-selector-inline">${o}</span>`:S}
|
|
41
41
|
${c}
|
|
42
|
-
${
|
|
42
|
+
${r}
|
|
43
43
|
<label for="nav-burger-toggle" class="nav-burger-button" aria-label="Toggle menu">
|
|
44
44
|
<span class="nav-burger-icon"></span>
|
|
45
45
|
</label>
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
<nav class="setup-header-dropdown" @click=${u}>
|
|
49
|
-
${
|
|
49
|
+
${o!==S?p`<div class="nav-selector-mobile">${o}</div>`:S}
|
|
50
50
|
${i}
|
|
51
51
|
</nav>
|
|
52
52
|
</div>
|
|
@@ -54,11 +54,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
54
54
|
<select
|
|
55
55
|
class="sp-workspace-selector"
|
|
56
56
|
.value=${n??""}
|
|
57
|
-
@change=${
|
|
57
|
+
@change=${o=>{const r=o.target,a=r.value;if(a==="__add__"){r.value=n??"",e.onAddAccount?e.onAddAccount():window.location.href="/setup";return}i(a)}}
|
|
58
58
|
>
|
|
59
|
-
${t.map(
|
|
60
|
-
<option value=${
|
|
61
|
-
${
|
|
59
|
+
${t.map(o=>p`
|
|
60
|
+
<option value=${o.name} ?selected=${o.name===n}>
|
|
61
|
+
${o.displayName??o.name}
|
|
62
62
|
</option>
|
|
63
63
|
`)}
|
|
64
64
|
<option disabled>───</option>
|
|
@@ -196,10 +196,10 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
196
196
|
<p>Connecting to gateway...</p>
|
|
197
197
|
</div>
|
|
198
198
|
</div>
|
|
199
|
-
`}const
|
|
199
|
+
`}const oi="application/x-taskmaster-file-path";function dc(e){return e==null?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function pc(e){const t=e.split("/");return t.length>1?t.slice(0,-1).join("/"):"."}function Oh(e,t,n){var o,r;e.preventDefault(),e.stopPropagation(),e.currentTarget.classList.remove("sp-drop-target");const i=(o=e.dataTransfer)==null?void 0:o.getData(oi);if(i){pc(i)!==t&&n.onMoveToDir(i,t);return}const s=(r=e.dataTransfer)==null?void 0:r.files;if(s&&s.length>0){const a=Array.from(s).filter(c=>c.name.toLowerCase().endsWith(".md"));a.length>0&&n.onUpload(t,a)}}function hc(e,t,n){const i=e.type==="directory"||e.type==="symlink"&&e.children!=null,s=t.expandedDirs.has(e.path),o=t.selectedPaths.has(e.path),r=n*20+12;return i?p`
|
|
200
200
|
<div
|
|
201
201
|
class="sp-tree-item sp-tree-dir ${s?"expanded":""}"
|
|
202
|
-
style="padding-left: ${
|
|
202
|
+
style="padding-left: ${r}px;"
|
|
203
203
|
@click=${()=>t.onToggleDir(e.path)}
|
|
204
204
|
@dragover=${a=>{a.preventDefault(),a.stopPropagation(),a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.currentTarget.classList.add("sp-drop-target")}}
|
|
205
205
|
@dragleave=${a=>{a.currentTarget.classList.remove("sp-drop-target")}}
|
|
@@ -212,11 +212,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
212
212
|
${s&&e.children?e.children.map(a=>hc(a,t,n+1)):S}
|
|
213
213
|
`:p`
|
|
214
214
|
<div
|
|
215
|
-
class="sp-tree-item sp-tree-file ${
|
|
216
|
-
style="padding-left: ${
|
|
215
|
+
class="sp-tree-item sp-tree-file ${o?"selected":""}"
|
|
216
|
+
style="padding-left: ${r}px;"
|
|
217
217
|
draggable="true"
|
|
218
218
|
@click=${a=>{a.metaKey||a.ctrlKey?t.onToggleSelectFile(e.path):t.onSelectFile(e.path)}}
|
|
219
|
-
@dragstart=${a=>{a.dataTransfer&&(a.dataTransfer.effectAllowed="move",a.dataTransfer.setData(
|
|
219
|
+
@dragstart=${a=>{a.dataTransfer&&(a.dataTransfer.effectAllowed="move",a.dataTransfer.setData(oi,e.path),a.dataTransfer.setData("text/plain",e.name))}}
|
|
220
220
|
>
|
|
221
221
|
<span class="sp-tree-icon">${O.fileText}</span>
|
|
222
222
|
<span class="sp-tree-name">${e.name}</span>
|
|
@@ -357,7 +357,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
357
357
|
class="setup-status-light"
|
|
358
358
|
style="width: 10px; height: 10px; background: ${e.memoryStatus.syncing?"#f59e0b":e.memoryStatus.dirty?"#ef4444":"#22c55e"}"
|
|
359
359
|
></span>
|
|
360
|
-
${(()=>{var c;if(e.memoryStatus.syncing&&e.memoryStatus.syncProgress){const{completed:u,total:l,label:d}=e.memoryStatus.syncProgress;return d||(l>0?`Indexing ${u}/${l} files…`:"Indexing…")}const n=e.memoryStatus.files,i=e.memoryStatus.chunks,s=`${n} file${n!==1?"s":""}, ${i} chunks`,
|
|
360
|
+
${(()=>{var c;if(e.memoryStatus.syncing&&e.memoryStatus.syncProgress){const{completed:u,total:l,label:d}=e.memoryStatus.syncProgress;return d||(l>0?`Indexing ${u}/${l} files…`:"Indexing…")}const n=e.memoryStatus.files,i=e.memoryStatus.chunks,s=`${n} file${n!==1?"s":""}, ${i} chunks`,o=(c=e.memoryStatus)==null?void 0:c.model;if(!o)return s;const a=(o.includes("/")?o.split("/").pop():o).replace(/[-_]Q\d.*$/i,"").replace(/\.gguf$/i,"");return`${s} · ${a}`})()}
|
|
361
361
|
</span>`:S}
|
|
362
362
|
</div>
|
|
363
363
|
|
|
@@ -373,8 +373,8 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
373
373
|
|
|
374
374
|
${e.searchResults!==null?Kh(e):p`<div
|
|
375
375
|
class="sp-file-tree"
|
|
376
|
-
@dragover=${n=>{n.preventDefault(),n.dataTransfer&&(n.dataTransfer.dropEffect=n.dataTransfer.types.includes(
|
|
377
|
-
@drop=${n=>{var r
|
|
376
|
+
@dragover=${n=>{n.preventDefault(),n.dataTransfer&&(n.dataTransfer.dropEffect=n.dataTransfer.types.includes(oi)?"move":"copy")}}
|
|
377
|
+
@drop=${n=>{var o,r;n.preventDefault();const i=(o=n.dataTransfer)==null?void 0:o.getData(oi);if(i){pc(i)!=="."&&e.onMoveToDir(i,".");return}const s=(r=n.dataTransfer)==null?void 0:r.files;if(s&&s.length>0){const a=Array.from(s).filter(c=>c.name.toLowerCase().endsWith(".md"));a.length>0&&e.onUpload(t,a)}}}
|
|
378
378
|
>
|
|
379
379
|
${e.tree.length===0&&!e.loading?p`<div style="padding: 24px; color: var(--tasker-muted-grey); text-align: center;">No files found. Drop .md files here to upload.</div>`:e.tree.map(n=>hc(n,e,0))}
|
|
380
380
|
</div>`}
|
|
@@ -390,7 +390,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
390
390
|
<p>Connecting to gateway...</p>
|
|
391
391
|
</div>
|
|
392
392
|
</div>
|
|
393
|
-
`}const
|
|
393
|
+
`}const Ao="taskmaster_uninstall_done";async function jh(e){var t,n;if(!(!e.client||!e.connected)&&!e.uninstallBusy){e.uninstallBusy=!0,e.uninstallError=null,(t=e.requestUpdate)==null||t.call(e),Hh();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 ri(){try{return localStorage.getItem(Ao)==="1"}catch{return!1}}function xo(){try{localStorage.removeItem(Ao)}catch{}}function Hh(){try{localStorage.setItem(Ao,"1")}catch{}}const Rr=Object.freeze(Object.defineProperty({__proto__:null,checkUninstallDone:ri,clearUninstallDone:xo,runUninstall:jh},Symbol.toStringTag,{value:"Module"}));function X(e){return p`
|
|
394
394
|
<span
|
|
395
395
|
class="setup-status-light"
|
|
396
396
|
style="background: ${{good:"#22c55e",bad:"#ef4444",partial:"#eab308",unknown:"#6b7280"}[e]}"
|
|
@@ -403,7 +403,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
403
403
|
>
|
|
404
404
|
${O.info}
|
|
405
405
|
</button>
|
|
406
|
-
`}function qh(e){var i;if(!e.infoModalOpen)return S;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
|
|
406
|
+
`}function qh(e){var i;if(!e.infoModalOpen)return S;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 r=Math.floor(s/60),a=s%60;o=a>0?`${r}h ${a}m`:`${r}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=Rt(e),o=s?$o(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:fc(o.lastError)}]:[]];break}case"imessage":{const{thisWsOwns:s}=Eo(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"internet":{const s=e.tailscaleStatus,o=s?s.installed?s.loggedIn?s.funnelEnabled&&s.funnelActive?"Active":s.funnelEnabled&&!s.funnelActive?"Enabled but not active":"Connected (not public)":"Not connected":"Not installed":"Checking...";t="Internet Access",n=[{label:"Status",value:o},{label:"What",value:"Makes your public chat and API reachable from the internet, not just your local network"},{label:"How",value:"Uses Tailscale Funnel — a free, secure tunnel that gives your device a public HTTPS address"},{label:"Security",value:"Only the /public/* paths are exposed. The control panel stays LAN-only."},...s!=null&&s.publicUrl?[{label:"Public URL",value:s.publicUrl}]:[],...s!=null&&s.hostname?[{label:"Hostname",value:s.hostname}]:[]];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:"Access mode",value:ef[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}default:return S}return p`
|
|
407
407
|
<div class="setup-info-overlay" @click=${s=>{s.target.classList.contains("setup-info-overlay")&&e.onInfoModalClose()}}>
|
|
408
408
|
<div class="setup-info-card">
|
|
409
409
|
<h3>${t}</h3>
|
|
@@ -424,16 +424,16 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
424
424
|
</div>
|
|
425
425
|
`}function we(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 p`
|
|
426
426
|
<div class="setup-steps">
|
|
427
|
-
${t.map(s=>{const
|
|
427
|
+
${t.map(s=>{const o=n.indexOf(s.id),r=e===s.id,a=i>o;return p`
|
|
428
428
|
<div
|
|
429
|
-
class="setup-step ${
|
|
429
|
+
class="setup-step ${r?"active":""} ${a?"completed":""}"
|
|
430
430
|
>
|
|
431
431
|
<span class="setup-step-dot"></span>
|
|
432
432
|
<span class="setup-step-label">${s.label}</span>
|
|
433
433
|
</div>
|
|
434
434
|
`})}
|
|
435
435
|
</div>
|
|
436
|
-
`}function
|
|
436
|
+
`}function Nr(e){const{licenseKey:t,licenseBusy:n,licenseValid:i,licenseMessage:s,licenseDeviceId:o,onLicenseKeyChange:r,onLicenseActivate:a}=e;return i===!0?p`
|
|
437
437
|
<div class="setup-container">
|
|
438
438
|
<div class="setup-card setup-success">
|
|
439
439
|
${we("license")}
|
|
@@ -458,14 +458,14 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
458
458
|
${we("license")}
|
|
459
459
|
<h1>Activate License</h1>
|
|
460
460
|
<p>Enter your license key to get started.</p>
|
|
461
|
-
${
|
|
461
|
+
${o?p`
|
|
462
462
|
<div class="setup-device-id">
|
|
463
463
|
<span class="setup-device-id-label">Your Device ID</span>
|
|
464
|
-
<code class="setup-device-id-value">${
|
|
464
|
+
<code class="setup-device-id-value">${o}</code>
|
|
465
465
|
<button
|
|
466
466
|
class="setup-device-id-copy"
|
|
467
467
|
title="Copy Device ID"
|
|
468
|
-
@click=${async c=>{const u=c.currentTarget;try{await navigator.clipboard.writeText(
|
|
468
|
+
@click=${async c=>{const u=c.currentTarget;try{await navigator.clipboard.writeText(o),u.textContent="Copied!",setTimeout(()=>{u.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),u.textContent="Copied!",setTimeout(()=>{u.textContent="Copy"},1500)}}}
|
|
469
469
|
>Copy</button>
|
|
470
470
|
<p class="setup-hint" style="margin-top: 4px;">
|
|
471
471
|
Send this ID along with your order number to our WhatsApp to receive your license key.
|
|
@@ -477,7 +477,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
477
477
|
type="text"
|
|
478
478
|
placeholder="Paste your license key here"
|
|
479
479
|
.value=${t}
|
|
480
|
-
@input=${c=>
|
|
480
|
+
@input=${c=>r(c.target.value)}
|
|
481
481
|
@keydown=${c=>{c.key==="Enter"&&t.trim()&&a()}}
|
|
482
482
|
/>
|
|
483
483
|
<button
|
|
@@ -502,7 +502,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
502
502
|
</p>
|
|
503
503
|
</div>
|
|
504
504
|
</div>
|
|
505
|
-
`}function Vh(e){const{authConnected:t,authBusy:n,authMessage:i,authUrl:s,authCodeInput:
|
|
505
|
+
`}function Vh(e){const{authConnected:t,authBusy:n,authMessage:i,authUrl:s,authCodeInput:o,authExpiresIn:r,onStartAuth:a,onSubmitAuthCode:c,onAuthCodeChange:u,onSkipToWhatsApp:l}=e;return t===!0?p`
|
|
506
506
|
<div class="setup-container">
|
|
507
507
|
<div class="setup-card setup-success">
|
|
508
508
|
${we("auth")}
|
|
@@ -512,8 +512,8 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
512
512
|
</div>
|
|
513
513
|
<p>
|
|
514
514
|
Your Claude Pro subscription is linked.
|
|
515
|
-
${
|
|
516
|
-
>Expires in ${
|
|
515
|
+
${r?p`<br /><span class="setup-hint"
|
|
516
|
+
>Expires in ${r} minutes</span
|
|
517
517
|
>`:S}
|
|
518
518
|
</p>
|
|
519
519
|
<p style="color: var(--tasker-text-grey); font-size: 14px;">
|
|
@@ -553,14 +553,14 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
553
553
|
<input
|
|
554
554
|
type="text"
|
|
555
555
|
placeholder="Enter authorization code"
|
|
556
|
-
.value=${
|
|
556
|
+
.value=${o}
|
|
557
557
|
@input=${d=>u(d.target.value)}
|
|
558
|
-
@keydown=${d=>{d.key==="Enter"&&
|
|
558
|
+
@keydown=${d=>{d.key==="Enter"&&o.trim()&&c(o.trim())}}
|
|
559
559
|
/>
|
|
560
560
|
<button
|
|
561
561
|
class="setup-button"
|
|
562
|
-
?disabled=${!
|
|
563
|
-
@click=${()=>c(
|
|
562
|
+
?disabled=${!o.trim()||n}
|
|
563
|
+
@click=${()=>c(o.trim())}
|
|
564
564
|
>
|
|
565
565
|
${n?"Verifying...":"Submit"}
|
|
566
566
|
</button>
|
|
@@ -634,13 +634,13 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
634
634
|
</p>
|
|
635
635
|
</div>
|
|
636
636
|
</div>
|
|
637
|
-
`}function
|
|
637
|
+
`}function $o(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 Rt(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 Dr(e){const t=Rt(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 p`
|
|
638
638
|
<div style="display: flex; align-items: center; gap: 6px; margin-bottom: 4px;">
|
|
639
639
|
<input
|
|
640
640
|
type="text"
|
|
641
641
|
.value=${e.renameWorkspaceName}
|
|
642
|
-
@input=${
|
|
643
|
-
@keydown=${
|
|
642
|
+
@input=${o=>{e.renameWorkspaceName=o.target.value}}
|
|
643
|
+
@keydown=${o=>{o.key==="Enter"&&s(),o.key==="Escape"&&e.onWorkspaceRenameCancel()}}
|
|
644
644
|
style="flex: 1; font-size: 18px; font-weight: 600; background: var(--tasker-bg-input, rgba(255,255,255,0.08)); border: 1px solid var(--tasker-border, rgba(255,255,255,0.15)); border-radius: 6px; color: var(--tasker-white); padding: 4px 8px; outline: none;"
|
|
645
645
|
autofocus
|
|
646
646
|
/>
|
|
@@ -676,7 +676,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
676
676
|
${O.rotateCw}
|
|
677
677
|
</button>
|
|
678
678
|
</div>
|
|
679
|
-
`}function
|
|
679
|
+
`}function Or(e){return p`
|
|
680
680
|
<div class="setup-status-item">
|
|
681
681
|
${X(e.gatewayHealthy===!1?"bad":"good")}
|
|
682
682
|
<div class="setup-status-info">
|
|
@@ -693,7 +693,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
693
693
|
${O.rotateCw}
|
|
694
694
|
</button>
|
|
695
695
|
</div>
|
|
696
|
-
`}function
|
|
696
|
+
`}function Br(e){const t=e.authConnected===!0;return p`
|
|
697
697
|
<div class="setup-status-item">
|
|
698
698
|
${X(t?"good":"bad")}
|
|
699
699
|
<div class="setup-status-info">
|
|
@@ -722,7 +722,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
722
722
|
</button>
|
|
723
723
|
`}
|
|
724
724
|
</div>
|
|
725
|
-
`}function
|
|
725
|
+
`}function Fr(e){return p`
|
|
726
726
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
727
727
|
${X("good")}
|
|
728
728
|
<div class="setup-status-info">
|
|
@@ -762,13 +762,13 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
762
762
|
</div>
|
|
763
763
|
`:S}
|
|
764
764
|
</div>
|
|
765
|
-
`}function fc(e){var t,n;try{const i=JSON.parse(e),s=(i==null?void 0:i.error)??i,
|
|
765
|
+
`}function fc(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 Ur(e){var d;const t=Rt(e);if(!t)return S;const n=$o(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,r=i?"good":s?"partial":o?"bad":"unknown",a=i?"Connected":s?"Linked, not connected":o?n!=null&&n.lastError?fc(n.lastError):"Not connected":"Not paired",c=!(n!=null&&n.provider)||(n==null?void 0:n.provider)==="baileys",u=t.whatsappAccountId??(t.isDefault&&e.whatsappAccounts.length===1?(d=e.whatsappAccounts[0])==null?void 0:d.accountId:void 0),l=u!=null&&e.whatsappActiveQrAccountId===u;return p`
|
|
766
766
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
767
|
-
${X(
|
|
767
|
+
${X(r)}
|
|
768
768
|
<div class="setup-status-info">
|
|
769
769
|
<div style="display: flex; align-items: center; gap: 4px;">
|
|
770
770
|
<strong>WhatsApp</strong>
|
|
771
|
-
${
|
|
771
|
+
${o&&i?p`
|
|
772
772
|
<button
|
|
773
773
|
class="setup-status-action"
|
|
774
774
|
@click=${e.onWhatsAppSettingsOpen}
|
|
@@ -823,7 +823,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
823
823
|
</div>
|
|
824
824
|
`:S}
|
|
825
825
|
</div>
|
|
826
|
-
`}const Gh=[{id:"claude-opus-4-6",shortName:"Opus"},{id:"claude-sonnet-4-5-20250929",shortName:"Sonnet"},{id:"claude-haiku-4-5-20251001",shortName:"Haiku"}],Qh="anthropic/claude-sonnet-4-5-20250929",Yh=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Xh(e){if(!e.whatsappSettingsOpen)return S;const t=Rt(e);if(!t)return S;const n
|
|
826
|
+
`}const Gh=[{id:"claude-opus-4-6",shortName:"Opus"},{id:"claude-sonnet-4-5-20250929",shortName:"Sonnet"},{id:"claude-haiku-4-5-20251001",shortName:"Haiku"}],Qh="anthropic/claude-sonnet-4-5-20250929",Yh=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Xh(e){if(!e.whatsappSettingsOpen)return S;const t=Rt(e);if(!t)return S;const n=$o(t,e),i=(n==null?void 0:n.running)&&(n==null?void 0:n.connected);if(!n||!i)return S;const s=()=>e.onWhatsAppSettingsClose(),o=e.whatsappModelCatalog??[],r=new Set(o.filter(l=>l.provider==="anthropic").map(l=>l.id)),a=Gh.filter(l=>r.has(l.id)),c=e.whatsappModel??Qh,u=e.whatsappThinkingLevel??"off";return p`
|
|
827
827
|
<div class="setup-info-overlay" @click=${l=>{l.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
828
828
|
<div class="setup-info-card" style="max-width: 360px;">
|
|
829
829
|
<h3>Public Agent Settings</h3>
|
|
@@ -926,12 +926,12 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
926
926
|
</button>
|
|
927
927
|
</div>
|
|
928
928
|
</div>
|
|
929
|
-
`}function
|
|
929
|
+
`}function Eo(e){const t=Rt(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 Wr(e){const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=Eo(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"),p`
|
|
930
930
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
931
931
|
${X(s)}
|
|
932
932
|
<div class="setup-status-info">
|
|
933
933
|
<strong>iMessage</strong>
|
|
934
|
-
<span>${
|
|
934
|
+
<span>${o}</span>
|
|
935
935
|
</div>
|
|
936
936
|
${ce("imessage",e)}
|
|
937
937
|
<button
|
|
@@ -944,8 +944,8 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
944
944
|
</button>
|
|
945
945
|
${S}
|
|
946
946
|
</div>
|
|
947
|
-
`}function Zh(e){if(!e.imessageEnableConfirm)return S;const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}
|
|
948
|
-
<div class="setup-info-overlay" @click=${
|
|
947
|
+
`}function Zh(e){if(!e.imessageEnableConfirm)return S;const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=Eo(e),s=()=>{e.onIMessageEnableCancel()};return n?p`
|
|
948
|
+
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
949
949
|
<div class="setup-info-card" style="text-align: center;">
|
|
950
950
|
<h3>iMessage</h3>
|
|
951
951
|
<p style="color: var(--tasker-text-grey); font-size: 13px; margin: 8px 0 16px;">
|
|
@@ -972,7 +972,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
972
972
|
</div>
|
|
973
973
|
</div>
|
|
974
974
|
`:i?p`
|
|
975
|
-
<div class="setup-info-overlay" @click=${
|
|
975
|
+
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
976
976
|
<div class="setup-info-card" style="text-align: center;">
|
|
977
977
|
<h3>Connect iMessage</h3>
|
|
978
978
|
<p style="color: var(--tasker-text-grey); font-size: 13px; margin: 8px 0 16px;">
|
|
@@ -997,7 +997,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
997
997
|
</div>
|
|
998
998
|
</div>
|
|
999
999
|
`:p`
|
|
1000
|
-
<div class="setup-info-overlay" @click=${
|
|
1000
|
+
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
1001
1001
|
<div class="setup-info-card" style="text-align: center;">
|
|
1002
1002
|
<h3>Enable iMessage</h3>
|
|
1003
1003
|
<p style="color: var(--tasker-text-grey); font-size: 13px; margin: 8px 0 16px;">
|
|
@@ -1020,7 +1020,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1020
1020
|
</button>
|
|
1021
1021
|
</div>
|
|
1022
1022
|
</div>
|
|
1023
|
-
`}function
|
|
1023
|
+
`}function Kr(e){if(!e.isMaster)return S;const n=e.apiKeyProviders.filter(i=>i.hasKey).length;return p`
|
|
1024
1024
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1025
1025
|
<div class="setup-status-item">
|
|
1026
1026
|
${X(n>0?"good":"bad")}
|
|
@@ -1035,7 +1035,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1035
1035
|
</div>
|
|
1036
1036
|
</div>
|
|
1037
1037
|
${Jh(e)}
|
|
1038
|
-
`}function Jh(e){if(!e.apiKeyModalOpen)return S;const t=e.apiKeyProviders,n={};for(const u of t)u.key&&(n[u.id]=u.key);const i=(u,l)=>{const d=l==null?void 0:l.closest(".setup-apikey-input"),h=d==null?void 0:d.querySelector("input"),v=h==null?void 0:h.value.trim();!v||v===n[u]||e.onApiKeySave(u,v)},s=u=>{const l=u.currentTarget,d=l.closest(".setup-apikey-input"),h=d==null?void 0:d.querySelector("input");if(!h)return;const v=h.type==="text";h.type=v?"password":"text",l.classList.toggle("active",!v)},
|
|
1038
|
+
`}function Jh(e){if(!e.apiKeyModalOpen)return S;const t=e.apiKeyProviders,n={};for(const u of t)u.key&&(n[u.id]=u.key);const i=(u,l)=>{const d=l==null?void 0:l.closest(".setup-apikey-input"),h=d==null?void 0:d.querySelector("input"),v=h==null?void 0:h.value.trim();!v||v===n[u]||e.onApiKeySave(u,v)},s=u=>{const l=u.currentTarget,d=l.closest(".setup-apikey-input"),h=d==null?void 0:d.querySelector("input");if(!h)return;const v=h.type==="text";h.type=v?"password":"text",l.classList.toggle("active",!v)},o=(u,l)=>{const d=l.target,h=d.closest(".setup-apikey-input"),v=d.value.trim(),f=v.length>0&&v!==n[u],b=h==null?void 0:h.querySelector(".setup-apikey-save");b&&(b.style.display=f?"":"none");const k=h==null?void 0:h.querySelector(".setup-apikey-eye");k&&(k.style.display=v.length>0?"":"none")},r=t.filter(u=>u.primary),a=t.filter(u=>!u.primary),c=u=>{const l=e.apiKeySavingProvider===u.id&&e.apiKeyBusy,d=!e.apiKeyBusy&&e.apiKeySuccess===`${u.id} key saved`,h=!e.apiKeyBusy&&e.apiKeySuccess===`${u.id} key removed`;return p`
|
|
1039
1039
|
<div class="setup-apikey-row">
|
|
1040
1040
|
<div class="setup-apikey-info">
|
|
1041
1041
|
<strong>${u.name}</strong>
|
|
@@ -1049,7 +1049,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1049
1049
|
.value=${u.key??""}
|
|
1050
1050
|
placeholder="Enter key"
|
|
1051
1051
|
?disabled=${e.apiKeyBusy}
|
|
1052
|
-
@input=${v=>
|
|
1052
|
+
@input=${v=>o(u.id,v)}
|
|
1053
1053
|
@keydown=${v=>{v.key==="Enter"&&i(u.id,v.target)}}
|
|
1054
1054
|
/>
|
|
1055
1055
|
<button
|
|
@@ -1080,7 +1080,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1080
1080
|
<h3 style="margin: 0 0 4px; text-align: center;">API Keys</h3>
|
|
1081
1081
|
<div class="setup-apikey-list">
|
|
1082
1082
|
${e.apiKeyError?p`<p class="setup-error" style="margin: 0;">${e.apiKeyError}</p>`:S}
|
|
1083
|
-
${
|
|
1083
|
+
${r.map(c)}
|
|
1084
1084
|
${a.length>0?p`
|
|
1085
1085
|
<details class="setup-apikey-advanced">
|
|
1086
1086
|
<summary>Additional keys</summary>
|
|
@@ -1090,7 +1090,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1090
1090
|
</div>
|
|
1091
1091
|
</div>
|
|
1092
1092
|
</div>
|
|
1093
|
-
`}function
|
|
1093
|
+
`}function zr(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 p`
|
|
1094
1094
|
<div class="setup-status-item">
|
|
1095
1095
|
${X(t)}
|
|
1096
1096
|
<div class="setup-status-info">
|
|
@@ -1118,7 +1118,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1118
1118
|
</button>
|
|
1119
1119
|
`}
|
|
1120
1120
|
</div>
|
|
1121
|
-
`}const ef={anonymous:"Open access",verified:"WhatsApp OTP",choice:"Visitor chooses"};function
|
|
1121
|
+
`}const ef={anonymous:"Open access",verified:"WhatsApp OTP",choice:"Visitor chooses"};function jr(e){const t=e.publicChatEnabled;return p`
|
|
1122
1122
|
<div class="setup-status-item">
|
|
1123
1123
|
${X(t?"good":"unknown")}
|
|
1124
1124
|
<div class="setup-status-info">
|
|
@@ -1205,7 +1205,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1205
1205
|
@click=${e.onTailscaleEnable}
|
|
1206
1206
|
>${n?"...":"Connect"}</button>
|
|
1207
1207
|
</div>
|
|
1208
|
-
`;if(!t.funnelEnabled){const
|
|
1208
|
+
`;if(!t.funnelEnabled){const o=e.tailscaleFunnelEnableUrl;return p`
|
|
1209
1209
|
<div>
|
|
1210
1210
|
<div class="setup-status-item">
|
|
1211
1211
|
${X("partial")}
|
|
@@ -1220,12 +1220,12 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1220
1220
|
@click=${e.onTailscaleFunnelEnable}
|
|
1221
1221
|
>${n?"...":"Enable"}</button>
|
|
1222
1222
|
</div>
|
|
1223
|
-
${
|
|
1223
|
+
${o?p`<div style="padding: 8px 0 4px 28px;">
|
|
1224
1224
|
<p style="margin: 0 0 6px; font-size: 13px; color: #f59e0b;">
|
|
1225
1225
|
Funnel must be enabled on your Tailscale account first.
|
|
1226
1226
|
</p>
|
|
1227
1227
|
<a
|
|
1228
|
-
href="${
|
|
1228
|
+
href="${o}"
|
|
1229
1229
|
target="_blank"
|
|
1230
1230
|
rel="noopener"
|
|
1231
1231
|
style="color: var(--tasker-link, #60a5fa); font-size: 13px; word-break: break-all;"
|
|
@@ -1233,7 +1233,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1233
1233
|
<p style="margin: 6px 0 0; font-size: 12px; opacity: 0.6;">
|
|
1234
1234
|
After enabling, come back here and click Enable again.
|
|
1235
1235
|
</p>
|
|
1236
|
-
</div>`:e.tailscaleError&&!
|
|
1236
|
+
</div>`:e.tailscaleError&&!o?p`<div style="padding: 8px 0 4px 28px;">
|
|
1237
1237
|
<p style="margin: 0; font-size: 13px; color: #ef4444;">${e.tailscaleError}</p>
|
|
1238
1238
|
</div>`:S}
|
|
1239
1239
|
</div>
|
|
@@ -1281,7 +1281,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1281
1281
|
<button
|
|
1282
1282
|
class="setup-info-btn"
|
|
1283
1283
|
title="Copy URL"
|
|
1284
|
-
@click=${
|
|
1284
|
+
@click=${o=>{const r=o.currentTarget;navigator.clipboard.writeText(s).then(()=>{r.classList.add("copied"),setTimeout(()=>r.classList.remove("copied"),1500)})}}
|
|
1285
1285
|
>${O.copy}</button>
|
|
1286
1286
|
<button
|
|
1287
1287
|
class="setup-link-btn"
|
|
@@ -1289,19 +1289,19 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1289
1289
|
@click=${e.onTailscaleFunnelDisable}
|
|
1290
1290
|
>${n?"...":"Disable"}</button>
|
|
1291
1291
|
</div>
|
|
1292
|
-
`}function nf(e){var i,s,
|
|
1292
|
+
`}function nf(e){var i,s,o;const t=e.updateRunning,n=e.updateLastResult;if(!t&&!n)return S;if(t)return p`
|
|
1293
1293
|
<div class="setup-info-overlay">
|
|
1294
1294
|
<div class="setup-info-card" style="max-width: 400px;">
|
|
1295
1295
|
<h3>Software Update</h3>
|
|
1296
1296
|
${e.updateProgressSteps.length>0?p`
|
|
1297
1297
|
<div class="setup-update-progress">
|
|
1298
|
-
${e.updateProgressSteps.map(
|
|
1299
|
-
<div class="setup-update-step ${
|
|
1298
|
+
${e.updateProgressSteps.map(r=>p`
|
|
1299
|
+
<div class="setup-update-step ${r.status}">
|
|
1300
1300
|
<span class="setup-update-step-icon">
|
|
1301
|
-
${
|
|
1301
|
+
${r.status==="running"?p`<span class="setup-update-spinner"></span>`:r.status==="done"?p`<span class="setup-update-icon-ok">${O.check}</span>`:p`<span class="setup-update-icon-fail">${O.x}</span>`}
|
|
1302
1302
|
</span>
|
|
1303
|
-
<span class="setup-update-step-name">${
|
|
1304
|
-
${
|
|
1303
|
+
<span class="setup-update-step-name">${r.name}</span>
|
|
1304
|
+
${r.durationMs!=null?p`<span class="setup-update-step-time">${Hr(r.durationMs)}</span>`:S}
|
|
1305
1305
|
</div>
|
|
1306
1306
|
`)}
|
|
1307
1307
|
</div>
|
|
@@ -1309,12 +1309,12 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1309
1309
|
${e.updateMessage?p`<p style="text-align: center; color: var(--tasker-text-grey); font-size: 13px; margin: 12px 0 0;">${e.updateMessage}</p>`:S}
|
|
1310
1310
|
</div>
|
|
1311
1311
|
</div>
|
|
1312
|
-
`;if(n){const
|
|
1312
|
+
`;if(n){const r=n.status==="ok";let a;if(r){const u=(i=n.before)==null?void 0:i.version,l=((s=n.after)==null?void 0:s.version)??n.currentVersion;a=u?`v${u} → v${l}`:`Updated to v${l}`}else a=n.reason??((o=n.failedStep)==null?void 0:o.name)??"unknown error";const c=n.durationMs!=null?Hr(n.durationMs):null;return p`
|
|
1313
1313
|
<div class="setup-info-overlay" @click=${u=>{u.target.classList.contains("setup-info-overlay")&&e.onUpdateDismissResult()}}>
|
|
1314
1314
|
<div class="setup-info-card" style="max-width: 360px; text-align: center;">
|
|
1315
|
-
<div class="setup-update-result-icon ${
|
|
1316
|
-
<h3 style="color: ${
|
|
1317
|
-
${
|
|
1315
|
+
<div class="setup-update-result-icon ${r?"ok":"fail"}">${r?O.circleCheck:O.circleX}</div>
|
|
1316
|
+
<h3 style="color: ${r?"#22c55e":"#ef4444"};">
|
|
1317
|
+
${r?"Update Complete":"Update Failed"}
|
|
1318
1318
|
</h3>
|
|
1319
1319
|
<p style="color: var(--tasker-text-grey); font-size: 14px; margin: 8px 0;">
|
|
1320
1320
|
${a}
|
|
@@ -1329,7 +1329,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1329
1329
|
</button>
|
|
1330
1330
|
</div>
|
|
1331
1331
|
</div>
|
|
1332
|
-
`}return S}function
|
|
1332
|
+
`}return S}function Hr(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 qr(e){const t=e.accountHasPin;return p`
|
|
1333
1333
|
<div class="setup-status-item">
|
|
1334
1334
|
${X(t?"good":"bad")}
|
|
1335
1335
|
<div class="setup-status-info">
|
|
@@ -1342,7 +1342,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1342
1342
|
@click=${()=>e.onAccountPinModalOpen()}
|
|
1343
1343
|
>${t?"Change":"Set PIN"}</button>
|
|
1344
1344
|
</div>
|
|
1345
|
-
`}function
|
|
1345
|
+
`}function Vr(e){if(!e.accountPinModalOpen)return S;const t=e.accountHasPin,n=e.accountPinBusy;let i="",s="",o="";const r=u=>l=>{const d=l.target;d.value=d.value.replace(/\D/g,"").slice(0,6),u(d.value)},a=(u,l)=>{var h;let d=u.querySelector(".pin-modal-validation");d||(d=document.createElement("p"),d.className="login-error pin-modal-validation",(h=u.querySelector("button[type=submit]"))==null||h.before(d)),d.textContent=l},c=u=>{u.preventDefault();const l=u.target;if(!n){if(t&&!i){a(l,"Enter your current PIN");return}if(!s){a(l,"Enter a new PIN");return}if(!o){a(l,"Confirm your new PIN");return}if(s!==o){a(l,"PINs do not match");return}if(s.length<4){a(l,"PIN must be 4–6 digits");return}e.onAccountPinSave(t?i:null,s)}};return p`
|
|
1346
1346
|
<div class="setup-info-overlay" @click=${u=>{u.target.classList.contains("setup-info-overlay")&&e.onAccountPinModalClose()}}>
|
|
1347
1347
|
<div class="setup-info-card" style="max-width: 340px;">
|
|
1348
1348
|
<div class="setup-info-header">
|
|
@@ -1362,7 +1362,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1362
1362
|
maxlength="6"
|
|
1363
1363
|
placeholder="Current PIN"
|
|
1364
1364
|
?disabled=${n}
|
|
1365
|
-
@input=${
|
|
1365
|
+
@input=${r(u=>{i=u})}
|
|
1366
1366
|
autofocus
|
|
1367
1367
|
/>
|
|
1368
1368
|
`:S}
|
|
@@ -1375,7 +1375,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1375
1375
|
maxlength="6"
|
|
1376
1376
|
placeholder="New PIN (4–6 digits)"
|
|
1377
1377
|
?disabled=${n}
|
|
1378
|
-
@input=${
|
|
1378
|
+
@input=${r(u=>{s=u})}
|
|
1379
1379
|
${t?S:p`autofocus`}
|
|
1380
1380
|
/>
|
|
1381
1381
|
<input
|
|
@@ -1387,7 +1387,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1387
1387
|
maxlength="6"
|
|
1388
1388
|
placeholder="Confirm PIN"
|
|
1389
1389
|
?disabled=${n}
|
|
1390
|
-
@input=${
|
|
1390
|
+
@input=${r(u=>{o=u})}
|
|
1391
1391
|
/>
|
|
1392
1392
|
${e.accountPinError?p`<p class="login-error">${e.accountPinError}</p>`:S}
|
|
1393
1393
|
${e.accountPinSuccess?p`<p class="login-success">${e.accountPinSuccess}</p>`:S}
|
|
@@ -1399,7 +1399,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1399
1399
|
</form>
|
|
1400
1400
|
</div>
|
|
1401
1401
|
</div>
|
|
1402
|
-
`}function
|
|
1402
|
+
`}function Gr(e){if(!e.addingWorkspace)return S;const{workspaceSaving:t}=e;return p`
|
|
1403
1403
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1404
1404
|
<div class="setup-add-account">
|
|
1405
1405
|
<strong>New Account</strong>
|
|
@@ -1452,7 +1452,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1452
1452
|
</div>
|
|
1453
1453
|
</div>
|
|
1454
1454
|
</div>
|
|
1455
|
-
`}function
|
|
1455
|
+
`}function Qr(e){const t=Rt(e);return!t||t.isDefault?S:e.workspaceRemoveConfirm===t.name?p`
|
|
1456
1456
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 12px;">
|
|
1457
1457
|
<div style="font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
|
1458
1458
|
<span style="color: var(--tasker-danger, #ef4444);">Remove "${t.displayName??t.name}" and its WhatsApp account?</span>
|
|
@@ -1481,7 +1481,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1481
1481
|
@click=${i=>{i.preventDefault(),e.onSetWorkspaceRemoveConfirm(t.name)}}
|
|
1482
1482
|
>Remove Account</a>
|
|
1483
1483
|
</p>
|
|
1484
|
-
`}function
|
|
1484
|
+
`}function Yr(e){if(e.uninstallDone)return p`
|
|
1485
1485
|
<div style="margin-top: 24px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1486
1486
|
<p style="color: var(--tasker-danger, #ef4444); font-size: 13px; font-weight: 600; margin: 0 0 8px 0;">
|
|
1487
1487
|
Taskmaster has been uninstalled.
|
|
@@ -1536,11 +1536,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1536
1536
|
@click=${t=>{t.preventDefault(),e.onUninstallConfirm()}}
|
|
1537
1537
|
>Uninstall Taskmaster</a>
|
|
1538
1538
|
</p>
|
|
1539
|
-
`}function
|
|
1539
|
+
`}function Xr(){return p`
|
|
1540
1540
|
<p class="setup-hint" style="margin-top: 4px; font-size: 12px; opacity: 0.6;">
|
|
1541
1541
|
Need help? <a href="https://wa.me/447591215452" target="_blank" rel="noopener" style="color: var(--tasker-orange);">Message Dave on WhatsApp</a>
|
|
1542
1542
|
</p>
|
|
1543
|
-
`}function sf(e){const{whatsappBusy:t,whatsappLoginMessage:n,whatsappLoginQrDataUrl:i,whatsappLoginConnected:s,whatsappChannelStatus:
|
|
1543
|
+
`}function sf(e){const{whatsappBusy:t,whatsappLoginMessage:n,whatsappLoginQrDataUrl:i,whatsappLoginConnected:s,whatsappChannelStatus:o}=e;if(i)return p`
|
|
1544
1544
|
<div class="setup-container">
|
|
1545
1545
|
<div class="setup-card">
|
|
1546
1546
|
<h1>Scan with WhatsApp</h1>
|
|
@@ -1574,56 +1574,56 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1574
1574
|
<p>${n||"Connecting to WhatsApp..."}</p>
|
|
1575
1575
|
</div>
|
|
1576
1576
|
</div>
|
|
1577
|
-
`;const
|
|
1577
|
+
`;const r=(o==null?void 0:o.running)&&(o==null?void 0:o.connected);return o?(e.whatsappAccounts.length>1?e.whatsappAccounts.every(l=>l.running&&l.connected):r)&&e.authConnected?p`
|
|
1578
1578
|
<div class="setup-container">
|
|
1579
1579
|
<div class="setup-card setup-success setup-dashboard-wide">
|
|
1580
|
-
${
|
|
1580
|
+
${Dr(e)}
|
|
1581
1581
|
<div class="setup-status-dashboard">
|
|
1582
|
-
${
|
|
1583
|
-
${
|
|
1584
|
-
${
|
|
1585
|
-
${
|
|
1586
|
-
${e.serverPlatform==="darwin"?
|
|
1587
|
-
${
|
|
1588
|
-
${
|
|
1589
|
-
${
|
|
1582
|
+
${Or(e)}
|
|
1583
|
+
${Br(e)}
|
|
1584
|
+
${Fr(e)}
|
|
1585
|
+
${Ur(e)}
|
|
1586
|
+
${e.serverPlatform==="darwin"?Wr(e):S}
|
|
1587
|
+
${qr(e)}
|
|
1588
|
+
${zr(e)}
|
|
1589
|
+
${jr(e)}
|
|
1590
1590
|
${tf(e)}
|
|
1591
1591
|
</div>
|
|
1592
1592
|
|
|
1593
|
-
${
|
|
1594
|
-
${
|
|
1595
|
-
${
|
|
1596
|
-
${
|
|
1597
|
-
${
|
|
1598
|
-
${
|
|
1593
|
+
${Vr(e)}
|
|
1594
|
+
${Kr(e)}
|
|
1595
|
+
${Gr(e)}
|
|
1596
|
+
${Qr(e)}
|
|
1597
|
+
${Yr(e)}
|
|
1598
|
+
${Xr()}
|
|
1599
1599
|
${e.workspacesError?p`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:S}
|
|
1600
1600
|
</div>
|
|
1601
1601
|
</div>
|
|
1602
1602
|
`:p`
|
|
1603
1603
|
<div class="setup-container">
|
|
1604
1604
|
<div class="setup-card setup-dashboard-wide">
|
|
1605
|
-
${
|
|
1605
|
+
${Dr(e)}
|
|
1606
1606
|
<div class="setup-status-dashboard">
|
|
1607
|
-
${
|
|
1608
|
-
${
|
|
1609
|
-
${
|
|
1610
|
-
${
|
|
1611
|
-
${e.serverPlatform==="darwin"?
|
|
1612
|
-
${
|
|
1613
|
-
${
|
|
1614
|
-
${
|
|
1607
|
+
${Or(e)}
|
|
1608
|
+
${Br(e)}
|
|
1609
|
+
${Fr(e)}
|
|
1610
|
+
${Ur(e)}
|
|
1611
|
+
${e.serverPlatform==="darwin"?Wr(e):S}
|
|
1612
|
+
${qr(e)}
|
|
1613
|
+
${zr(e)}
|
|
1614
|
+
${jr(e)}
|
|
1615
1615
|
</div>
|
|
1616
1616
|
|
|
1617
|
-
${
|
|
1618
|
-
${
|
|
1619
|
-
${
|
|
1620
|
-
${
|
|
1621
|
-
${
|
|
1622
|
-
${
|
|
1617
|
+
${Vr(e)}
|
|
1618
|
+
${Kr(e)}
|
|
1619
|
+
${Gr(e)}
|
|
1620
|
+
${Qr(e)}
|
|
1621
|
+
${Yr(e)}
|
|
1622
|
+
${Xr()}
|
|
1623
1623
|
${e.workspacesError?p`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:S}
|
|
1624
1624
|
</div>
|
|
1625
1625
|
</div>
|
|
1626
|
-
`:
|
|
1626
|
+
`:o?s===!1&&n&&!t?p`
|
|
1627
1627
|
<div class="setup-container">
|
|
1628
1628
|
<div class="setup-card">
|
|
1629
1629
|
${we("whatsapp")}
|
|
@@ -1664,7 +1664,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1664
1664
|
</button>
|
|
1665
1665
|
</div>
|
|
1666
1666
|
</div>
|
|
1667
|
-
`}function
|
|
1667
|
+
`}function of(e){const{connected:t,currentStep:n}=e;if(t&&ri()&&xo(),e.uninstallDone||!t&&ri())return p`
|
|
1668
1668
|
<div class="setup-container">
|
|
1669
1669
|
<div class="setup-card">
|
|
1670
1670
|
<p style="color: var(--tasker-danger, #ef4444); font-size: 16px; font-weight: 600; margin: 0 0 12px 0;">
|
|
@@ -1680,14 +1680,14 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1680
1680
|
<p style="font-size: 12px; color: var(--tasker-text-grey); margin: 0;">You can close this tab.</p>
|
|
1681
1681
|
</div>
|
|
1682
1682
|
</div>
|
|
1683
|
-
`;if(!t){const
|
|
1683
|
+
`;if(!t){const o=e.updateRunning;return p`
|
|
1684
1684
|
<div class="setup-container">
|
|
1685
1685
|
<div class="setup-card">
|
|
1686
1686
|
<div class="setup-spinner"></div>
|
|
1687
|
-
<p>${
|
|
1687
|
+
<p>${o?"Restarting gateway after update…":"Connecting to gateway..."}</p>
|
|
1688
1688
|
</div>
|
|
1689
1689
|
</div>
|
|
1690
|
-
`}let i;switch(n){case"license":i=
|
|
1690
|
+
`}let i;switch(n){case"license":i=Nr(e);break;case"auth":i=Vh(e);break;case"whatsapp":case"complete":i=sf(e);break;default:i=Nr(e)}const s=ht("Setup",e.wsProps);return p`${i}${qh(e)}${Zh(e)}${Xh(e)}${nf(e)}${s}`}function rf(e,t){const n=e.paired?"Paired phone (used to link WhatsApp)":"Admin access via WhatsApp DM";return p`
|
|
1691
1691
|
<div class="sp-list-item">
|
|
1692
1692
|
<div class="sp-list-item-main">
|
|
1693
1693
|
<div class="sp-list-item-title">${e.phone}</div>
|
|
@@ -1751,7 +1751,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1751
1751
|
</form>
|
|
1752
1752
|
|
|
1753
1753
|
<div class="sp-list" style="margin-top: 20px;">
|
|
1754
|
-
${e.phones.length===0?p`<div class="sp-list-empty">No admin phones configured yet.</div>`:e.phones.map(n=>
|
|
1754
|
+
${e.phones.length===0?p`<div class="sp-list-empty">No admin phones configured yet.</div>`:e.phones.map(n=>rf(n,e))}
|
|
1755
1755
|
</div>
|
|
1756
1756
|
|
|
1757
1757
|
<div class="setup-hint" style="margin-top: 20px; padding: 14px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; text-align: left;">
|
|
@@ -1763,9 +1763,9 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1763
1763
|
</div>
|
|
1764
1764
|
</div>
|
|
1765
1765
|
`}function lf(e){return Object.keys(e.fields).length}function cf(e,t){const n=Object.entries(e.fields);return p`
|
|
1766
|
-
<div class="
|
|
1766
|
+
<div class="contacts-record-fields">
|
|
1767
1767
|
${n.length===0?p`<div style="color: rgba(255,255,255,0.4); font-size: 13px; margin-top: 12px;">No fields yet. Add one below.</div>`:n.map(([i,s])=>p`
|
|
1768
|
-
<div class="
|
|
1768
|
+
<div class="contacts-field-row">
|
|
1769
1769
|
<input
|
|
1770
1770
|
class="field-key"
|
|
1771
1771
|
type="text"
|
|
@@ -1777,7 +1777,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1777
1777
|
class="field-value"
|
|
1778
1778
|
type="text"
|
|
1779
1779
|
.value=${s}
|
|
1780
|
-
@change=${
|
|
1780
|
+
@change=${o=>t.onSetField(e.id,i,o.target.value)}
|
|
1781
1781
|
?disabled=${t.saving}
|
|
1782
1782
|
title="Field value"
|
|
1783
1783
|
/>
|
|
@@ -1790,7 +1790,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1790
1790
|
</button>
|
|
1791
1791
|
</div>
|
|
1792
1792
|
`)}
|
|
1793
|
-
<div class="
|
|
1793
|
+
<div class="contacts-record-actions">
|
|
1794
1794
|
<button
|
|
1795
1795
|
class="setup-button secondary"
|
|
1796
1796
|
style="font-size: 13px; padding: 8px 14px;"
|
|
@@ -1803,23 +1803,23 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1803
1803
|
class="setup-button danger"
|
|
1804
1804
|
style="font-size: 13px; padding: 8px 14px;"
|
|
1805
1805
|
?disabled=${t.saving}
|
|
1806
|
-
@click=${()=>{confirm(`Delete
|
|
1806
|
+
@click=${()=>{confirm(`Delete contact "${e.name}" (${e.id})?`)&&t.onDelete(e.id)}}
|
|
1807
1807
|
>
|
|
1808
|
-
Delete
|
|
1808
|
+
Delete Contact
|
|
1809
1809
|
</button>
|
|
1810
1810
|
</div>
|
|
1811
1811
|
</div>
|
|
1812
1812
|
`}function uf(e,t){const n=t.editingId===e.id,i=lf(e),s=i===0?"No fields":`${i} field${i>1?"s":""}`;return p`
|
|
1813
|
-
<div class="
|
|
1813
|
+
<div class="contacts-record">
|
|
1814
1814
|
<div
|
|
1815
|
-
class="
|
|
1815
|
+
class="contacts-record-header"
|
|
1816
1816
|
@click=${()=>t.onToggleExpand(e.id)}
|
|
1817
1817
|
>
|
|
1818
|
-
<div class="
|
|
1819
|
-
<span class="
|
|
1820
|
-
<span class="
|
|
1818
|
+
<div class="contacts-record-info">
|
|
1819
|
+
<span class="contacts-record-name">${e.name}</span>
|
|
1820
|
+
<span class="contacts-record-phone">${e.id}</span>
|
|
1821
1821
|
</div>
|
|
1822
|
-
<span class="
|
|
1822
|
+
<span class="contacts-record-meta">${s}</span>
|
|
1823
1823
|
</div>
|
|
1824
1824
|
${n?cf(e,t):S}
|
|
1825
1825
|
</div>
|
|
@@ -1832,11 +1832,11 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1832
1832
|
</div>
|
|
1833
1833
|
`;const t=i=>{i.preventDefault(),e.onSearchSubmit()},n=i=>{i.preventDefault(),e.newRecordPhone.trim()&&e.newRecordName.trim()&&e.onAdd(e.newRecordPhone,e.newRecordName)};return p`
|
|
1834
1834
|
<div class="setup-container">
|
|
1835
|
-
${ht("
|
|
1835
|
+
${ht("Contacts",e.wsProps)}
|
|
1836
1836
|
<div class="setup-card" style="max-width: 620px;">
|
|
1837
|
-
<h1>
|
|
1837
|
+
<h1>Contact Records</h1>
|
|
1838
1838
|
<p style="margin-bottom: 16px;">
|
|
1839
|
-
Verified
|
|
1839
|
+
Verified contact data managed by the business owner. Agents can read these records but cannot modify them.
|
|
1840
1840
|
</p>
|
|
1841
1841
|
|
|
1842
1842
|
<div class="sp-toolbar" style="display: flex; gap: 8px;">
|
|
@@ -1853,14 +1853,14 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1853
1853
|
style="padding: 10px 20px; font-size: 14px;"
|
|
1854
1854
|
@click=${e.onShowAddForm}
|
|
1855
1855
|
>
|
|
1856
|
-
+ Add
|
|
1856
|
+
+ Add Contact
|
|
1857
1857
|
</button>
|
|
1858
1858
|
</div>
|
|
1859
1859
|
|
|
1860
1860
|
${e.error?p`<div class="setup-error" style="margin-top: 16px;">${e.error}</div>`:S}
|
|
1861
1861
|
|
|
1862
1862
|
${e.showAddForm?p`
|
|
1863
|
-
<form class="
|
|
1863
|
+
<form class="contacts-add-form" @submit=${n}>
|
|
1864
1864
|
<input
|
|
1865
1865
|
type="tel"
|
|
1866
1866
|
placeholder="+447490553305"
|
|
@@ -1870,12 +1870,12 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1870
1870
|
/>
|
|
1871
1871
|
<input
|
|
1872
1872
|
type="text"
|
|
1873
|
-
placeholder="
|
|
1873
|
+
placeholder="Contact name"
|
|
1874
1874
|
.value=${e.newRecordName}
|
|
1875
1875
|
@input=${i=>e.onNewRecordNameChange(i.target.value)}
|
|
1876
1876
|
?disabled=${e.saving}
|
|
1877
1877
|
/>
|
|
1878
|
-
<div class="
|
|
1878
|
+
<div class="contacts-add-form-buttons">
|
|
1879
1879
|
<button
|
|
1880
1880
|
type="submit"
|
|
1881
1881
|
class="setup-button primary"
|
|
@@ -1897,7 +1897,7 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1897
1897
|
`:S}
|
|
1898
1898
|
|
|
1899
1899
|
<form
|
|
1900
|
-
class="
|
|
1900
|
+
class="contacts-search"
|
|
1901
1901
|
style="margin-top: 16px;"
|
|
1902
1902
|
@submit=${t}
|
|
1903
1903
|
>
|
|
@@ -1917,81 +1917,81 @@ ${r}`:r),e.chatStream="","working"}else if(t.state==="block"){const s=sn(t.messa
|
|
|
1917
1917
|
</form>
|
|
1918
1918
|
|
|
1919
1919
|
<div style="margin-top: 16px;">
|
|
1920
|
-
${e.records.length===0?p`<div class="
|
|
1921
|
-
${e.searchQuery.trim()?`No records matching "${e.searchQuery}".`:"No
|
|
1920
|
+
${e.records.length===0?p`<div class="contacts-empty">
|
|
1921
|
+
${e.searchQuery.trim()?`No records matching "${e.searchQuery}".`:"No contact records yet. Add one to get started."}
|
|
1922
1922
|
</div>`:e.records.map(i=>uf(i,e))}
|
|
1923
1923
|
</div>
|
|
1924
1924
|
|
|
1925
1925
|
<div class="setup-hint" style="margin-top: 20px; padding: 14px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; text-align: left;">
|
|
1926
1926
|
<strong style="color: var(--tasker-white);">How it works:</strong><br/>
|
|
1927
1927
|
Records stored here are <strong>read-only for agents</strong> — they use the
|
|
1928
|
-
<code style="background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; color: var(--tasker-orange);">
|
|
1928
|
+
<code style="background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; color: var(--tasker-orange);">contact_lookup</code>
|
|
1929
1929
|
tool to check payment status and account details, but cannot modify them. This prevents prompt injection from altering sensitive data.
|
|
1930
1930
|
</div>
|
|
1931
1931
|
</div>
|
|
1932
1932
|
</div>
|
|
1933
|
-
`}const gc={CHILD:2},mc=e=>(...t)=>({_$litDirective$:e,values:t});let yc=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,i){this._$Ct=t,this._$AM=n,this._$Ci=i}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:pf}=ed,Zo=e=>e,Jo=()=>document.createComment(""),Wt=(e,t,n)=>{var r;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=i.insertBefore(Jo(),s),a=i.insertBefore(Jo(),s);n=new pf(o,a,e,e.options)}else{const o=n._$AB.nextSibling,a=n._$AM,c=a!==e;if(c){let u;(r=n._$AQ)==null||r.call(n,e),n._$AM=e,n._$AP!==void 0&&(u=e._$AU)!==a._$AU&&n._$AP(u)}if(o!==s||c){let u=n._$AA;for(;u!==o;){const l=Zo(u).nextSibling;Zo(i).insertBefore(u,s),u=l}}}return n},Je=(e,t,n=e)=>(e._$AI(t,n),e),hf={},ff=(e,t=hf)=>e._$AH=t,gf=e=>e._$AH,ts=e=>{e._$AR(),e._$AA.remove()};const ea=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},mf=mc(class extends yc{constructor(e){if(super(e),e.type!==gc.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;n===void 0?n=t:t!==void 0&&(i=t);const s=[],r=[];let o=0;for(const a of e)s[o]=i?i(a,o):o,r[o]=n(a,o),o++;return{values:r,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=gf(e),{values:r,keys:o}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=o,r;const a=this.ut??(this.ut=[]),c=[];let u,l,d=0,h=s.length-1,v=0,f=r.length-1;for(;d<=h&&v<=f;)if(s[d]===null)d++;else if(s[h]===null)h--;else if(a[d]===o[v])c[v]=Je(s[d],r[v]),d++,v++;else if(a[h]===o[f])c[f]=Je(s[h],r[f]),h--,f--;else if(a[d]===o[f])c[f]=Je(s[d],r[f]),Wt(e,c[f+1],s[d]),d++,f--;else if(a[h]===o[v])c[v]=Je(s[h],r[v]),Wt(e,s[d],s[h]),h--,v++;else if(u===void 0&&(u=ea(o,v,f),l=ea(a,d,h)),u.has(a[d]))if(u.has(a[h])){const b=l.get(o[v]),k=b!==void 0?s[b]:null;if(k===null){const x=Wt(e,s[d]);Je(x,r[v]),c[v]=x}else c[v]=Je(k,r[v]),Wt(e,s[d],k),s[b]=null;v++}else ts(s[h]),h--;else ts(s[d]),d++;for(;v<=f;){const b=Wt(e,c[f+1]);Je(b,r[v]),c[v++]=b}for(;d<=h;){const b=s[d++];b!==null&&ts(b)}return this.ut=o,ff(e,c),He}});class Is extends yc{constructor(t){if(super(t),this.it=S,t.type!==gc.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===S||t==null)return this._t=void 0,this.it=t;if(t===He)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}Is.directiveName="unsafeHTML",Is.resultType=1;const ai=mc(Is);const{entries:vc,setPrototypeOf:ta,isFrozen:yf,getPrototypeOf:vf,getOwnPropertyDescriptor:bf}=Object;let{freeze:pe,seal:ge,create:Rs}=Object,{apply:Ns,construct:Ds}=typeof Reflect<"u"&&Reflect;pe||(pe=function(t){return t});ge||(ge=function(t){return t});Ns||(Ns=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r<i;r++)s[r-2]=arguments[r];return t.apply(n,s)});Ds||(Ds=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const On=he(Array.prototype.forEach),wf=he(Array.prototype.lastIndexOf),na=he(Array.prototype.pop),Kt=he(Array.prototype.push),kf=he(Array.prototype.splice),Gn=he(String.prototype.toLowerCase),ns=he(String.prototype.toString),is=he(String.prototype.match),zt=he(String.prototype.replace),Sf=he(String.prototype.indexOf),Af=he(String.prototype.trim),ye=he(Object.prototype.hasOwnProperty),le=he(RegExp.prototype.test),jt=xf(TypeError);function he(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return Ns(e,t,i)}}function xf(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Ds(e,n)}}function F(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Gn;ta&&ta(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const r=n(s);r!==s&&(yf(t)||(t[i]=r),s=r)}e[s]=!0}return e}function $f(e){for(let t=0;t<e.length;t++)ye(e,t)||(e[t]=null);return e}function Ee(e){const t=Rs(null);for(const[n,i]of vc(e))ye(e,n)&&(Array.isArray(i)?t[n]=$f(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ee(i):t[n]=i);return t}function Ht(e,t){for(;e!==null;){const i=bf(e,t);if(i){if(i.get)return he(i.get);if(typeof i.value=="function")return he(i.value)}e=vf(e)}function n(){return null}return n}const ia=pe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ss=pe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),rs=pe(["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"]),Ef=pe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),os=pe(["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"]),Tf=pe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sa=pe(["#text"]),ra=pe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),as=pe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),oa=pe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Bn=pe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Cf=ge(/\{\{[\w\W]*|[\w\W]*\}\}/gm),_f=ge(/<%[\w\W]*|[\w\W]*%>/gm),Mf=ge(/\$\{[\w\W]*/gm),Pf=ge(/^data-[\-\w.\u00B7-\uFFFF]+$/),Lf=ge(/^aria-[\-\w]+$/),bc=ge(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),If=ge(/^(?:\w+script|data):/i),Rf=ge(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wc=ge(/^html$/i),Nf=ge(/^[a-z][.\w]*(-[.\w]+)+$/i);var aa=Object.freeze({__proto__:null,ARIA_ATTR:Lf,ATTR_WHITESPACE:Rf,CUSTOM_ELEMENT:Nf,DATA_ATTR:Pf,DOCTYPE_NAME:wc,ERB_EXPR:_f,IS_ALLOWED_URI:bc,IS_SCRIPT_OR_DATA:If,MUSTACHE_EXPR:Cf,TMPLIT_EXPR:Mf});const qt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Df=function(){return typeof window>"u"?null:window},Of=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},la=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function kc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Df();const t=I=>kc(I);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==qt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:v}=e,f=c.prototype,b=Ht(f,"cloneNode"),k=Ht(f,"remove"),x=Ht(f,"nextSibling"),$=Ht(f,"childNodes"),T=Ht(f,"parentNode");if(typeof o=="function"){const I=n.createElement("template");I.content&&I.content.ownerDocument&&(n=I.content.ownerDocument)}let C,M="";const{implementation:R,createNodeIterator:B,createDocumentFragment:ee,getElementsByTagName:me}=n,{importNode:Be}=i;let Z=la();t.isSupported=typeof vc=="function"&&typeof T=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Dt,ERB_EXPR:mt,TMPLIT_EXPR:Qe,DATA_ATTR:Mi,ARIA_ATTR:Pi,IS_SCRIPT_OR_DATA:Li,ATTR_WHITESPACE:wn,CUSTOM_ELEMENT:Ii}=aa;let{IS_ALLOWED_URI:kn}=aa,G=null;const Sn=F({},[...ia,...ss,...rs,...os,...sa]);let Q=null;const An=F({},[...ra,...as,...oa,...Bn]);let H=Object.seal(Rs(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ye=null,Ot=null;const Fe=Object.seal(Rs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let xn=!0,A=!0,_=!1,N=!0,D=!1,q=!0,z=!1,ae=!1,Ue=!1,yt=!1,$n=!1,En=!1,jr=!0,Hr=!1;const Au="user-content-";let Ri=!0,Bt=!1,vt={},Se=null;const Ni=F({},["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 qr=null;const Vr=F({},["audio","video","img","source","image","track"]);let Di=null;const Gr=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Tn="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",Pe="http://www.w3.org/1999/xhtml";let bt=Pe,Oi=!1,Bi=null;const xu=F({},[Tn,Cn,Pe],ns);let _n=F({},["mi","mo","mn","ms","mtext"]),Mn=F({},["annotation-xml"]);const $u=F({},["title","style","font","a","script"]);let Ft=null;const Eu=["application/xhtml+xml","text/html"],Tu="text/html";let J=null,wt=null;const Cu=n.createElement("form"),Qr=function(w){return w instanceof RegExp||w instanceof Function},Fi=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(wt&&wt===w)){if((!w||typeof w!="object")&&(w={}),w=Ee(w),Ft=Eu.indexOf(w.PARSER_MEDIA_TYPE)===-1?Tu:w.PARSER_MEDIA_TYPE,J=Ft==="application/xhtml+xml"?ns:Gn,G=ye(w,"ALLOWED_TAGS")?F({},w.ALLOWED_TAGS,J):Sn,Q=ye(w,"ALLOWED_ATTR")?F({},w.ALLOWED_ATTR,J):An,Bi=ye(w,"ALLOWED_NAMESPACES")?F({},w.ALLOWED_NAMESPACES,ns):xu,Di=ye(w,"ADD_URI_SAFE_ATTR")?F(Ee(Gr),w.ADD_URI_SAFE_ATTR,J):Gr,qr=ye(w,"ADD_DATA_URI_TAGS")?F(Ee(Vr),w.ADD_DATA_URI_TAGS,J):Vr,Se=ye(w,"FORBID_CONTENTS")?F({},w.FORBID_CONTENTS,J):Ni,Ye=ye(w,"FORBID_TAGS")?F({},w.FORBID_TAGS,J):Ee({}),Ot=ye(w,"FORBID_ATTR")?F({},w.FORBID_ATTR,J):Ee({}),vt=ye(w,"USE_PROFILES")?w.USE_PROFILES:!1,xn=w.ALLOW_ARIA_ATTR!==!1,A=w.ALLOW_DATA_ATTR!==!1,_=w.ALLOW_UNKNOWN_PROTOCOLS||!1,N=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,D=w.SAFE_FOR_TEMPLATES||!1,q=w.SAFE_FOR_XML!==!1,z=w.WHOLE_DOCUMENT||!1,yt=w.RETURN_DOM||!1,$n=w.RETURN_DOM_FRAGMENT||!1,En=w.RETURN_TRUSTED_TYPE||!1,Ue=w.FORCE_BODY||!1,jr=w.SANITIZE_DOM!==!1,Hr=w.SANITIZE_NAMED_PROPS||!1,Ri=w.KEEP_CONTENT!==!1,Bt=w.IN_PLACE||!1,kn=w.ALLOWED_URI_REGEXP||bc,bt=w.NAMESPACE||Pe,_n=w.MATHML_TEXT_INTEGRATION_POINTS||_n,Mn=w.HTML_INTEGRATION_POINTS||Mn,H=w.CUSTOM_ELEMENT_HANDLING||{},w.CUSTOM_ELEMENT_HANDLING&&Qr(w.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=w.CUSTOM_ELEMENT_HANDLING.tagNameCheck),w.CUSTOM_ELEMENT_HANDLING&&Qr(w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),D&&(A=!1),$n&&(yt=!0),vt&&(G=F({},sa),Q=[],vt.html===!0&&(F(G,ia),F(Q,ra)),vt.svg===!0&&(F(G,ss),F(Q,as),F(Q,Bn)),vt.svgFilters===!0&&(F(G,rs),F(Q,as),F(Q,Bn)),vt.mathMl===!0&&(F(G,os),F(Q,oa),F(Q,Bn))),w.ADD_TAGS&&(typeof w.ADD_TAGS=="function"?Fe.tagCheck=w.ADD_TAGS:(G===Sn&&(G=Ee(G)),F(G,w.ADD_TAGS,J))),w.ADD_ATTR&&(typeof w.ADD_ATTR=="function"?Fe.attributeCheck=w.ADD_ATTR:(Q===An&&(Q=Ee(Q)),F(Q,w.ADD_ATTR,J))),w.ADD_URI_SAFE_ATTR&&F(Di,w.ADD_URI_SAFE_ATTR,J),w.FORBID_CONTENTS&&(Se===Ni&&(Se=Ee(Se)),F(Se,w.FORBID_CONTENTS,J)),w.ADD_FORBID_CONTENTS&&(Se===Ni&&(Se=Ee(Se)),F(Se,w.ADD_FORBID_CONTENTS,J)),Ri&&(G["#text"]=!0),z&&F(G,["html","head","body"]),G.table&&(F(G,["tbody"]),delete Ye.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw jt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw jt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=w.TRUSTED_TYPES_POLICY,M=C.createHTML("")}else C===void 0&&(C=Of(v,s)),C!==null&&typeof M=="string"&&(M=C.createHTML(""));pe&&pe(w),wt=w}},Yr=F({},[...ss,...rs,...Ef]),Xr=F({},[...os,...Tf]),_u=function(w){let E=T(w);(!E||!E.tagName)&&(E={namespaceURI:bt,tagName:"template"});const L=Gn(w.tagName),j=Gn(E.tagName);return Bi[w.namespaceURI]?w.namespaceURI===Cn?E.namespaceURI===Pe?L==="svg":E.namespaceURI===Tn?L==="svg"&&(j==="annotation-xml"||_n[j]):!!Yr[L]:w.namespaceURI===Tn?E.namespaceURI===Pe?L==="math":E.namespaceURI===Cn?L==="math"&&Mn[j]:!!Xr[L]:w.namespaceURI===Pe?E.namespaceURI===Cn&&!Mn[j]||E.namespaceURI===Tn&&!_n[j]?!1:!Xr[L]&&($u[L]||!Yr[L]):!!(Ft==="application/xhtml+xml"&&Bi[w.namespaceURI]):!1},Ae=function(w){Kt(t.removed,{element:w});try{T(w).removeChild(w)}catch{k(w)}},Xe=function(w,E){try{Kt(t.removed,{attribute:E.getAttributeNode(w),from:E})}catch{Kt(t.removed,{attribute:null,from:E})}if(E.removeAttribute(w),w==="is")if(yt||$n)try{Ae(E)}catch{}else try{E.setAttribute(w,"")}catch{}},Zr=function(w){let E=null,L=null;if(Ue)w="<remove></remove>"+w;else{const Y=is(w,/^[\r\n\t ]+/);L=Y&&Y[0]}Ft==="application/xhtml+xml"&&bt===Pe&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const j=C?C.createHTML(w):w;if(bt===Pe)try{E=new h().parseFromString(j,Ft)}catch{}if(!E||!E.documentElement){E=R.createDocument(bt,"template",null);try{E.documentElement.innerHTML=Oi?M:j}catch{}}const ie=E.body||E.documentElement;return w&&L&&ie.insertBefore(n.createTextNode(L),ie.childNodes[0]||null),bt===Pe?me.call(E,z?"html":"body")[0]:z?E.documentElement:ie},Jr=function(w){return B.call(w.ownerDocument||w,w,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Ui=function(w){return w instanceof d&&(typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||!(w.attributes instanceof l)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function")},eo=function(w){return typeof a=="function"&&w instanceof a};function Le(I,w,E){On(I,L=>{L.call(t,w,E,wt)})}const to=function(w){let E=null;if(Le(Z.beforeSanitizeElements,w,null),Ui(w))return Ae(w),!0;const L=J(w.nodeName);if(Le(Z.uponSanitizeElement,w,{tagName:L,allowedTags:G}),q&&w.hasChildNodes()&&!eo(w.firstElementChild)&&le(/<[/\w!]/g,w.innerHTML)&&le(/<[/\w!]/g,w.textContent)||w.nodeType===qt.progressingInstruction||q&&w.nodeType===qt.comment&&le(/<[/\w]/g,w.data))return Ae(w),!0;if(!(Fe.tagCheck instanceof Function&&Fe.tagCheck(L))&&(!G[L]||Ye[L])){if(!Ye[L]&&io(L)&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L)))return!1;if(Ri&&!Se[L]){const j=T(w)||w.parentNode,ie=$(w)||w.childNodes;if(ie&&j){const Y=ie.length;for(let fe=Y-1;fe>=0;--fe){const Ie=b(ie[fe],!0);Ie.__removalCount=(w.__removalCount||0)+1,j.insertBefore(Ie,x(w))}}}return Ae(w),!0}return w instanceof c&&!_u(w)||(L==="noscript"||L==="noembed"||L==="noframes")&&le(/<\/no(script|embed|frames)/i,w.innerHTML)?(Ae(w),!0):(D&&w.nodeType===qt.text&&(E=w.textContent,On([Dt,mt,Qe],j=>{E=zt(E,j," ")}),w.textContent!==E&&(Kt(t.removed,{element:w.cloneNode()}),w.textContent=E)),Le(Z.afterSanitizeElements,w,null),!1)},no=function(w,E,L){if(jr&&(E==="id"||E==="name")&&(L in n||L in Cu))return!1;if(!(A&&!Ot[E]&&le(Mi,E))){if(!(xn&&le(Pi,E))){if(!(Fe.attributeCheck instanceof Function&&Fe.attributeCheck(E,w))){if(!Q[E]||Ot[E]){if(!(io(w)&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,w)||H.tagNameCheck instanceof Function&&H.tagNameCheck(w))&&(H.attributeNameCheck instanceof RegExp&&le(H.attributeNameCheck,E)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(E,w))||E==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L))))return!1}else if(!Di[E]){if(!le(kn,zt(L,wn,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&w!=="script"&&Sf(L,"data:")===0&&qr[w])){if(!(_&&!le(Li,zt(L,wn,"")))){if(L)return!1}}}}}}}return!0},io=function(w){return w!=="annotation-xml"&&is(w,Ii)},so=function(w){Le(Z.beforeSanitizeAttributes,w,null);const{attributes:E}=w;if(!E||Ui(w))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Q,forceKeepAttr:void 0};let j=E.length;for(;j--;){const ie=E[j],{name:Y,namespaceURI:fe,value:Ie}=ie,kt=J(Y),Wi=Ie;let ne=Y==="value"?Wi:Af(Wi);if(L.attrName=kt,L.attrValue=ne,L.keepAttr=!0,L.forceKeepAttr=void 0,Le(Z.uponSanitizeAttribute,w,L),ne=L.attrValue,Hr&&(kt==="id"||kt==="name")&&(Xe(Y,w),ne=Au+ne),q&&le(/((--!?|])>)|<\/(style|title|textarea)/i,ne)){Xe(Y,w);continue}if(kt==="attributename"&&is(ne,"href")){Xe(Y,w);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){Xe(Y,w);continue}if(!N&&le(/\/>/i,ne)){Xe(Y,w);continue}D&&On([Dt,mt,Qe],oo=>{ne=zt(ne,oo," ")});const ro=J(w.nodeName);if(!no(ro,kt,ne)){Xe(Y,w);continue}if(C&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!fe)switch(v.getAttributeType(ro,kt)){case"TrustedHTML":{ne=C.createHTML(ne);break}case"TrustedScriptURL":{ne=C.createScriptURL(ne);break}}if(ne!==Wi)try{fe?w.setAttributeNS(fe,Y,ne):w.setAttribute(Y,ne),Ui(w)?Ae(w):na(t.removed)}catch{Xe(Y,w)}}Le(Z.afterSanitizeAttributes,w,null)},Mu=function I(w){let E=null;const L=Jr(w);for(Le(Z.beforeSanitizeShadowDOM,w,null);E=L.nextNode();)Le(Z.uponSanitizeShadowNode,E,null),to(E),so(E),E.content instanceof r&&I(E.content);Le(Z.afterSanitizeShadowDOM,w,null)};return t.sanitize=function(I){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,L=null,j=null,ie=null;if(Oi=!I,Oi&&(I="<!-->"),typeof I!="string"&&!eo(I))if(typeof I.toString=="function"){if(I=I.toString(),typeof I!="string")throw jt("dirty is not a string, aborting")}else throw jt("toString is not a function");if(!t.isSupported)return I;if(ae||Fi(w),t.removed=[],typeof I=="string"&&(Bt=!1),Bt){if(I.nodeName){const Ie=J(I.nodeName);if(!G[Ie]||Ye[Ie])throw jt("root node is forbidden and cannot be sanitized in-place")}}else if(I instanceof a)E=Zr("<!---->"),L=E.ownerDocument.importNode(I,!0),L.nodeType===qt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?E=L:E.appendChild(L);else{if(!yt&&!D&&!z&&I.indexOf("<")===-1)return C&&En?C.createHTML(I):I;if(E=Zr(I),!E)return yt?null:En?M:""}E&&Ue&&Ae(E.firstChild);const Y=Jr(Bt?I:E);for(;j=Y.nextNode();)to(j),so(j),j.content instanceof r&&Mu(j.content);if(Bt)return I;if(yt){if($n)for(ie=ee.call(E.ownerDocument);E.firstChild;)ie.appendChild(E.firstChild);else ie=E;return(Q.shadowroot||Q.shadowrootmode)&&(ie=Be.call(i,ie,!0)),ie}let fe=z?E.outerHTML:E.innerHTML;return z&&G["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&le(wc,E.ownerDocument.doctype.name)&&(fe="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
|
|
1934
|
-
`+fe),D&&On([Dt,mt,Qe],Ie=>{fe=zt(fe,Ie," ")}),C&&En?C.createHTML(fe):fe},t.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fi(I),ae=!0},t.clearConfig=function(){wt=null,ae=!1},t.isValidAttribute=function(I,w,E){wt||Fi({});const L=J(I),j=J(w);return
|
|
1935
|
-
]`).replace("lheading",xc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Zf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ec=/^( {2,}|\\)\n(?!\s*$)/,Jf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ti=/[\p{P}\p{S}]/u,
|
|
1936
|
-
`).map(
|
|
1933
|
+
`}const gc={CHILD:2},mc=e=>(...t)=>({_$litDirective$:e,values:t});let yc=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,i){this._$Ct=t,this._$AM=n,this._$Ci=i}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:pf}=ed,Zr=e=>e,Jr=()=>document.createComment(""),Wt=(e,t,n)=>{var o;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const r=i.insertBefore(Jr(),s),a=i.insertBefore(Jr(),s);n=new pf(r,a,e,e.options)}else{const r=n._$AB.nextSibling,a=n._$AM,c=a!==e;if(c){let u;(o=n._$AQ)==null||o.call(n,e),n._$AM=e,n._$AP!==void 0&&(u=e._$AU)!==a._$AU&&n._$AP(u)}if(r!==s||c){let u=n._$AA;for(;u!==r;){const l=Zr(u).nextSibling;Zr(i).insertBefore(u,s),u=l}}}return n},Je=(e,t,n=e)=>(e._$AI(t,n),e),hf={},ff=(e,t=hf)=>e._$AH=t,gf=e=>e._$AH,ts=e=>{e._$AR(),e._$AA.remove()};const ea=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},mf=mc(class extends yc{constructor(e){if(super(e),e.type!==gc.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;n===void 0?n=t:t!==void 0&&(i=t);const s=[],o=[];let r=0;for(const a of e)s[r]=i?i(a,r):r,o[r]=n(a,r),r++;return{values:o,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=gf(e),{values:o,keys:r}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=r,o;const a=this.ut??(this.ut=[]),c=[];let u,l,d=0,h=s.length-1,v=0,f=o.length-1;for(;d<=h&&v<=f;)if(s[d]===null)d++;else if(s[h]===null)h--;else if(a[d]===r[v])c[v]=Je(s[d],o[v]),d++,v++;else if(a[h]===r[f])c[f]=Je(s[h],o[f]),h--,f--;else if(a[d]===r[f])c[f]=Je(s[d],o[f]),Wt(e,c[f+1],s[d]),d++,f--;else if(a[h]===r[v])c[v]=Je(s[h],o[v]),Wt(e,s[d],s[h]),h--,v++;else if(u===void 0&&(u=ea(r,v,f),l=ea(a,d,h)),u.has(a[d]))if(u.has(a[h])){const b=l.get(r[v]),k=b!==void 0?s[b]:null;if(k===null){const x=Wt(e,s[d]);Je(x,o[v]),c[v]=x}else c[v]=Je(k,o[v]),Wt(e,s[d],k),s[b]=null;v++}else ts(s[h]),h--;else ts(s[d]),d++;for(;v<=f;){const b=Wt(e,c[f+1]);Je(b,o[v]),c[v++]=b}for(;d<=h;){const b=s[d++];b!==null&&ts(b)}return this.ut=r,ff(e,c),He}});class Is extends yc{constructor(t){if(super(t),this.it=S,t.type!==gc.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===S||t==null)return this._t=void 0,this.it=t;if(t===He)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}Is.directiveName="unsafeHTML",Is.resultType=1;const ai=mc(Is);const{entries:vc,setPrototypeOf:ta,isFrozen:yf,getPrototypeOf:vf,getOwnPropertyDescriptor:bf}=Object;let{freeze:pe,seal:ge,create:Rs}=Object,{apply:Ns,construct:Ds}=typeof Reflect<"u"&&Reflect;pe||(pe=function(t){return t});ge||(ge=function(t){return t});Ns||(Ns=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)});Ds||(Ds=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const On=he(Array.prototype.forEach),wf=he(Array.prototype.lastIndexOf),na=he(Array.prototype.pop),Kt=he(Array.prototype.push),kf=he(Array.prototype.splice),Gn=he(String.prototype.toLowerCase),ns=he(String.prototype.toString),is=he(String.prototype.match),zt=he(String.prototype.replace),Sf=he(String.prototype.indexOf),Af=he(String.prototype.trim),ye=he(Object.prototype.hasOwnProperty),le=he(RegExp.prototype.test),jt=xf(TypeError);function he(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return Ns(e,t,i)}}function xf(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Ds(e,n)}}function F(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Gn;ta&&ta(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(yf(t)||(t[i]=o),s=o)}e[s]=!0}return e}function $f(e){for(let t=0;t<e.length;t++)ye(e,t)||(e[t]=null);return e}function Ee(e){const t=Rs(null);for(const[n,i]of vc(e))ye(e,n)&&(Array.isArray(i)?t[n]=$f(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ee(i):t[n]=i);return t}function Ht(e,t){for(;e!==null;){const i=bf(e,t);if(i){if(i.get)return he(i.get);if(typeof i.value=="function")return he(i.value)}e=vf(e)}function n(){return null}return n}const ia=pe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ss=pe(["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"]),os=pe(["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"]),Ef=pe(["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=pe(["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"]),Tf=pe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sa=pe(["#text"]),oa=pe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),as=pe(["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"]),ra=pe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Bn=pe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Cf=ge(/\{\{[\w\W]*|[\w\W]*\}\}/gm),_f=ge(/<%[\w\W]*|[\w\W]*%>/gm),Mf=ge(/\$\{[\w\W]*/gm),Pf=ge(/^data-[\-\w.\u00B7-\uFFFF]+$/),Lf=ge(/^aria-[\-\w]+$/),bc=ge(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),If=ge(/^(?:\w+script|data):/i),Rf=ge(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wc=ge(/^html$/i),Nf=ge(/^[a-z][.\w]*(-[.\w]+)+$/i);var aa=Object.freeze({__proto__:null,ARIA_ATTR:Lf,ATTR_WHITESPACE:Rf,CUSTOM_ELEMENT:Nf,DATA_ATTR:Pf,DOCTYPE_NAME:wc,ERB_EXPR:_f,IS_ALLOWED_URI:bc,IS_SCRIPT_OR_DATA:If,MUSTACHE_EXPR:Cf,TMPLIT_EXPR:Mf});const qt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Df=function(){return typeof window>"u"?null:window},Of=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(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},la=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function kc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Df();const t=I=>kc(I);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==qt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:a,Element:c,NodeFilter:u,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:v}=e,f=c.prototype,b=Ht(f,"cloneNode"),k=Ht(f,"remove"),x=Ht(f,"nextSibling"),$=Ht(f,"childNodes"),T=Ht(f,"parentNode");if(typeof r=="function"){const I=n.createElement("template");I.content&&I.content.ownerDocument&&(n=I.content.ownerDocument)}let C,M="";const{implementation:R,createNodeIterator:B,createDocumentFragment:ee,getElementsByTagName:me}=n,{importNode:Be}=i;let Z=la();t.isSupported=typeof vc=="function"&&typeof T=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Dt,ERB_EXPR:mt,TMPLIT_EXPR:Qe,DATA_ATTR:Mi,ARIA_ATTR:Pi,IS_SCRIPT_OR_DATA:Li,ATTR_WHITESPACE:wn,CUSTOM_ELEMENT:Ii}=aa;let{IS_ALLOWED_URI:kn}=aa,G=null;const Sn=F({},[...ia,...ss,...os,...rs,...sa]);let Q=null;const An=F({},[...oa,...as,...ra,...Bn]);let H=Object.seal(Rs(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ye=null,Ot=null;const Fe=Object.seal(Rs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let xn=!0,A=!0,_=!1,N=!0,D=!1,q=!0,z=!1,ae=!1,Ue=!1,yt=!1,$n=!1,En=!1,Ho=!0,qo=!1;const Au="user-content-";let Ri=!0,Bt=!1,vt={},Se=null;const Ni=F({},["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 Vo=null;const Go=F({},["audio","video","img","source","image","track"]);let Di=null;const Qo=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Tn="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",Pe="http://www.w3.org/1999/xhtml";let bt=Pe,Oi=!1,Bi=null;const xu=F({},[Tn,Cn,Pe],ns);let _n=F({},["mi","mo","mn","ms","mtext"]),Mn=F({},["annotation-xml"]);const $u=F({},["title","style","font","a","script"]);let Ft=null;const Eu=["application/xhtml+xml","text/html"],Tu="text/html";let J=null,wt=null;const Cu=n.createElement("form"),Yo=function(w){return w instanceof RegExp||w instanceof Function},Fi=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(wt&&wt===w)){if((!w||typeof w!="object")&&(w={}),w=Ee(w),Ft=Eu.indexOf(w.PARSER_MEDIA_TYPE)===-1?Tu:w.PARSER_MEDIA_TYPE,J=Ft==="application/xhtml+xml"?ns:Gn,G=ye(w,"ALLOWED_TAGS")?F({},w.ALLOWED_TAGS,J):Sn,Q=ye(w,"ALLOWED_ATTR")?F({},w.ALLOWED_ATTR,J):An,Bi=ye(w,"ALLOWED_NAMESPACES")?F({},w.ALLOWED_NAMESPACES,ns):xu,Di=ye(w,"ADD_URI_SAFE_ATTR")?F(Ee(Qo),w.ADD_URI_SAFE_ATTR,J):Qo,Vo=ye(w,"ADD_DATA_URI_TAGS")?F(Ee(Go),w.ADD_DATA_URI_TAGS,J):Go,Se=ye(w,"FORBID_CONTENTS")?F({},w.FORBID_CONTENTS,J):Ni,Ye=ye(w,"FORBID_TAGS")?F({},w.FORBID_TAGS,J):Ee({}),Ot=ye(w,"FORBID_ATTR")?F({},w.FORBID_ATTR,J):Ee({}),vt=ye(w,"USE_PROFILES")?w.USE_PROFILES:!1,xn=w.ALLOW_ARIA_ATTR!==!1,A=w.ALLOW_DATA_ATTR!==!1,_=w.ALLOW_UNKNOWN_PROTOCOLS||!1,N=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,D=w.SAFE_FOR_TEMPLATES||!1,q=w.SAFE_FOR_XML!==!1,z=w.WHOLE_DOCUMENT||!1,yt=w.RETURN_DOM||!1,$n=w.RETURN_DOM_FRAGMENT||!1,En=w.RETURN_TRUSTED_TYPE||!1,Ue=w.FORCE_BODY||!1,Ho=w.SANITIZE_DOM!==!1,qo=w.SANITIZE_NAMED_PROPS||!1,Ri=w.KEEP_CONTENT!==!1,Bt=w.IN_PLACE||!1,kn=w.ALLOWED_URI_REGEXP||bc,bt=w.NAMESPACE||Pe,_n=w.MATHML_TEXT_INTEGRATION_POINTS||_n,Mn=w.HTML_INTEGRATION_POINTS||Mn,H=w.CUSTOM_ELEMENT_HANDLING||{},w.CUSTOM_ELEMENT_HANDLING&&Yo(w.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=w.CUSTOM_ELEMENT_HANDLING.tagNameCheck),w.CUSTOM_ELEMENT_HANDLING&&Yo(w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),D&&(A=!1),$n&&(yt=!0),vt&&(G=F({},sa),Q=[],vt.html===!0&&(F(G,ia),F(Q,oa)),vt.svg===!0&&(F(G,ss),F(Q,as),F(Q,Bn)),vt.svgFilters===!0&&(F(G,os),F(Q,as),F(Q,Bn)),vt.mathMl===!0&&(F(G,rs),F(Q,ra),F(Q,Bn))),w.ADD_TAGS&&(typeof w.ADD_TAGS=="function"?Fe.tagCheck=w.ADD_TAGS:(G===Sn&&(G=Ee(G)),F(G,w.ADD_TAGS,J))),w.ADD_ATTR&&(typeof w.ADD_ATTR=="function"?Fe.attributeCheck=w.ADD_ATTR:(Q===An&&(Q=Ee(Q)),F(Q,w.ADD_ATTR,J))),w.ADD_URI_SAFE_ATTR&&F(Di,w.ADD_URI_SAFE_ATTR,J),w.FORBID_CONTENTS&&(Se===Ni&&(Se=Ee(Se)),F(Se,w.FORBID_CONTENTS,J)),w.ADD_FORBID_CONTENTS&&(Se===Ni&&(Se=Ee(Se)),F(Se,w.ADD_FORBID_CONTENTS,J)),Ri&&(G["#text"]=!0),z&&F(G,["html","head","body"]),G.table&&(F(G,["tbody"]),delete Ye.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw jt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw jt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=w.TRUSTED_TYPES_POLICY,M=C.createHTML("")}else C===void 0&&(C=Of(v,s)),C!==null&&typeof M=="string"&&(M=C.createHTML(""));pe&&pe(w),wt=w}},Xo=F({},[...ss,...os,...Ef]),Zo=F({},[...rs,...Tf]),_u=function(w){let E=T(w);(!E||!E.tagName)&&(E={namespaceURI:bt,tagName:"template"});const L=Gn(w.tagName),j=Gn(E.tagName);return Bi[w.namespaceURI]?w.namespaceURI===Cn?E.namespaceURI===Pe?L==="svg":E.namespaceURI===Tn?L==="svg"&&(j==="annotation-xml"||_n[j]):!!Xo[L]:w.namespaceURI===Tn?E.namespaceURI===Pe?L==="math":E.namespaceURI===Cn?L==="math"&&Mn[j]:!!Zo[L]:w.namespaceURI===Pe?E.namespaceURI===Cn&&!Mn[j]||E.namespaceURI===Tn&&!_n[j]?!1:!Zo[L]&&($u[L]||!Xo[L]):!!(Ft==="application/xhtml+xml"&&Bi[w.namespaceURI]):!1},Ae=function(w){Kt(t.removed,{element:w});try{T(w).removeChild(w)}catch{k(w)}},Xe=function(w,E){try{Kt(t.removed,{attribute:E.getAttributeNode(w),from:E})}catch{Kt(t.removed,{attribute:null,from:E})}if(E.removeAttribute(w),w==="is")if(yt||$n)try{Ae(E)}catch{}else try{E.setAttribute(w,"")}catch{}},Jo=function(w){let E=null,L=null;if(Ue)w="<remove></remove>"+w;else{const Y=is(w,/^[\r\n\t ]+/);L=Y&&Y[0]}Ft==="application/xhtml+xml"&&bt===Pe&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const j=C?C.createHTML(w):w;if(bt===Pe)try{E=new h().parseFromString(j,Ft)}catch{}if(!E||!E.documentElement){E=R.createDocument(bt,"template",null);try{E.documentElement.innerHTML=Oi?M:j}catch{}}const ie=E.body||E.documentElement;return w&&L&&ie.insertBefore(n.createTextNode(L),ie.childNodes[0]||null),bt===Pe?me.call(E,z?"html":"body")[0]:z?E.documentElement:ie},er=function(w){return B.call(w.ownerDocument||w,w,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Ui=function(w){return w instanceof d&&(typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||!(w.attributes instanceof l)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function")},tr=function(w){return typeof a=="function"&&w instanceof a};function Le(I,w,E){On(I,L=>{L.call(t,w,E,wt)})}const nr=function(w){let E=null;if(Le(Z.beforeSanitizeElements,w,null),Ui(w))return Ae(w),!0;const L=J(w.nodeName);if(Le(Z.uponSanitizeElement,w,{tagName:L,allowedTags:G}),q&&w.hasChildNodes()&&!tr(w.firstElementChild)&&le(/<[/\w!]/g,w.innerHTML)&&le(/<[/\w!]/g,w.textContent)||w.nodeType===qt.progressingInstruction||q&&w.nodeType===qt.comment&&le(/<[/\w]/g,w.data))return Ae(w),!0;if(!(Fe.tagCheck instanceof Function&&Fe.tagCheck(L))&&(!G[L]||Ye[L])){if(!Ye[L]&&sr(L)&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L)))return!1;if(Ri&&!Se[L]){const j=T(w)||w.parentNode,ie=$(w)||w.childNodes;if(ie&&j){const Y=ie.length;for(let fe=Y-1;fe>=0;--fe){const Ie=b(ie[fe],!0);Ie.__removalCount=(w.__removalCount||0)+1,j.insertBefore(Ie,x(w))}}}return Ae(w),!0}return w instanceof c&&!_u(w)||(L==="noscript"||L==="noembed"||L==="noframes")&&le(/<\/no(script|embed|frames)/i,w.innerHTML)?(Ae(w),!0):(D&&w.nodeType===qt.text&&(E=w.textContent,On([Dt,mt,Qe],j=>{E=zt(E,j," ")}),w.textContent!==E&&(Kt(t.removed,{element:w.cloneNode()}),w.textContent=E)),Le(Z.afterSanitizeElements,w,null),!1)},ir=function(w,E,L){if(Ho&&(E==="id"||E==="name")&&(L in n||L in Cu))return!1;if(!(A&&!Ot[E]&&le(Mi,E))){if(!(xn&&le(Pi,E))){if(!(Fe.attributeCheck instanceof Function&&Fe.attributeCheck(E,w))){if(!Q[E]||Ot[E]){if(!(sr(w)&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,w)||H.tagNameCheck instanceof Function&&H.tagNameCheck(w))&&(H.attributeNameCheck instanceof RegExp&&le(H.attributeNameCheck,E)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(E,w))||E==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L))))return!1}else if(!Di[E]){if(!le(kn,zt(L,wn,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&w!=="script"&&Sf(L,"data:")===0&&Vo[w])){if(!(_&&!le(Li,zt(L,wn,"")))){if(L)return!1}}}}}}}return!0},sr=function(w){return w!=="annotation-xml"&&is(w,Ii)},or=function(w){Le(Z.beforeSanitizeAttributes,w,null);const{attributes:E}=w;if(!E||Ui(w))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Q,forceKeepAttr:void 0};let j=E.length;for(;j--;){const ie=E[j],{name:Y,namespaceURI:fe,value:Ie}=ie,kt=J(Y),Wi=Ie;let ne=Y==="value"?Wi:Af(Wi);if(L.attrName=kt,L.attrValue=ne,L.keepAttr=!0,L.forceKeepAttr=void 0,Le(Z.uponSanitizeAttribute,w,L),ne=L.attrValue,qo&&(kt==="id"||kt==="name")&&(Xe(Y,w),ne=Au+ne),q&&le(/((--!?|])>)|<\/(style|title|textarea)/i,ne)){Xe(Y,w);continue}if(kt==="attributename"&&is(ne,"href")){Xe(Y,w);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){Xe(Y,w);continue}if(!N&&le(/\/>/i,ne)){Xe(Y,w);continue}D&&On([Dt,mt,Qe],ar=>{ne=zt(ne,ar," ")});const rr=J(w.nodeName);if(!ir(rr,kt,ne)){Xe(Y,w);continue}if(C&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!fe)switch(v.getAttributeType(rr,kt)){case"TrustedHTML":{ne=C.createHTML(ne);break}case"TrustedScriptURL":{ne=C.createScriptURL(ne);break}}if(ne!==Wi)try{fe?w.setAttributeNS(fe,Y,ne):w.setAttribute(Y,ne),Ui(w)?Ae(w):na(t.removed)}catch{Xe(Y,w)}}Le(Z.afterSanitizeAttributes,w,null)},Mu=function I(w){let E=null;const L=er(w);for(Le(Z.beforeSanitizeShadowDOM,w,null);E=L.nextNode();)Le(Z.uponSanitizeShadowNode,E,null),nr(E),or(E),E.content instanceof o&&I(E.content);Le(Z.afterSanitizeShadowDOM,w,null)};return t.sanitize=function(I){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,L=null,j=null,ie=null;if(Oi=!I,Oi&&(I="<!-->"),typeof I!="string"&&!tr(I))if(typeof I.toString=="function"){if(I=I.toString(),typeof I!="string")throw jt("dirty is not a string, aborting")}else throw jt("toString is not a function");if(!t.isSupported)return I;if(ae||Fi(w),t.removed=[],typeof I=="string"&&(Bt=!1),Bt){if(I.nodeName){const Ie=J(I.nodeName);if(!G[Ie]||Ye[Ie])throw jt("root node is forbidden and cannot be sanitized in-place")}}else if(I instanceof a)E=Jo("<!---->"),L=E.ownerDocument.importNode(I,!0),L.nodeType===qt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?E=L:E.appendChild(L);else{if(!yt&&!D&&!z&&I.indexOf("<")===-1)return C&&En?C.createHTML(I):I;if(E=Jo(I),!E)return yt?null:En?M:""}E&&Ue&&Ae(E.firstChild);const Y=er(Bt?I:E);for(;j=Y.nextNode();)nr(j),or(j),j.content instanceof o&&Mu(j.content);if(Bt)return I;if(yt){if($n)for(ie=ee.call(E.ownerDocument);E.firstChild;)ie.appendChild(E.firstChild);else ie=E;return(Q.shadowroot||Q.shadowrootmode)&&(ie=Be.call(i,ie,!0)),ie}let fe=z?E.outerHTML:E.innerHTML;return z&&G["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&le(wc,E.ownerDocument.doctype.name)&&(fe="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
|
|
1934
|
+
`+fe),D&&On([Dt,mt,Qe],Ie=>{fe=zt(fe,Ie," ")}),C&&En?C.createHTML(fe):fe},t.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fi(I),ae=!0},t.clearConfig=function(){wt=null,ae=!1},t.isValidAttribute=function(I,w,E){wt||Fi({});const L=J(I),j=J(w);return ir(L,j,E)},t.addHook=function(I,w){typeof w=="function"&&Kt(Z[I],w)},t.removeHook=function(I,w){if(w!==void 0){const E=wf(Z[I],w);return E===-1?void 0:kf(Z[I],E,1)[0]}return na(Z[I])},t.removeHooks=function(I){Z[I]=[]},t.removeAllHooks=function(){Z=la()},t}var Os=kc();function To(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ft=To();function Sc(e){ft=e}var rn={exec:()=>null};function W(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(s,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(ue.caret,"$1"),n=n.replace(s,r),i},getRegex:()=>new RegExp(n,t)};return i}var Bf=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ue={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")},Ff=/^(?:[ \t]*(?:\n|$))+/,Uf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Kf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Co=/(?:[*+-]|\d{1,9}[.)])/,Ac=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,xc=W(Ac).replace(/bull/g,Co).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(),zf=W(Ac).replace(/bull/g,Co).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(),_o=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,jf=/^[^\n]+/,Mo=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Hf=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Mo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),qf=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Co).getRegex(),Ei="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Po=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Vf=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",Po).replace("tag",Ei).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$c=W(_o).replace("hr",vn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ei).getRegex(),Gf=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",$c).getRegex(),Lo={blockquote:Gf,code:Uf,def:Hf,fences:Wf,heading:Kf,hr:vn,html:Vf,lheading:xc,list:qf,newline:Ff,paragraph:$c,table:rn,text:jf},ca=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ei).getRegex(),Qf={...Lo,lheading:zf,table:ca,paragraph:W(_o).replace("hr",vn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ca).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ei).getRegex()},Yf={...Lo,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Po).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:rn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(_o).replace("hr",vn).replace("heading",` *#{1,6} *[^
|
|
1935
|
+
]`).replace("lheading",xc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Zf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ec=/^( {2,}|\\)\n(?!\s*$)/,Jf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ti=/[\p{P}\p{S}]/u,Io=/[\s\p{P}\p{S}]/u,Tc=/[^\s\p{P}\p{S}]/u,eg=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Io).getRegex(),Cc=/(?!~)[\p{P}\p{S}]/u,tg=/(?!~)[\s\p{P}\p{S}]/u,ng=/(?:[^\s\p{P}\p{S}]|~)/u,ig=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Bf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),_c=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,sg=W(_c,"u").replace(/punct/g,Ti).getRegex(),og=W(_c,"u").replace(/punct/g,Cc).getRegex(),Mc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",rg=W(Mc,"gu").replace(/notPunctSpace/g,Tc).replace(/punctSpace/g,Io).replace(/punct/g,Ti).getRegex(),ag=W(Mc,"gu").replace(/notPunctSpace/g,ng).replace(/punctSpace/g,tg).replace(/punct/g,Cc).getRegex(),lg=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Tc).replace(/punctSpace/g,Io).replace(/punct/g,Ti).getRegex(),cg=W(/\\(punct)/,"gu").replace(/punct/g,Ti).getRegex(),ug=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(),dg=W(Po).replace("(?:-->|$)","-->").getRegex(),pg=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",dg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),li=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,hg=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",li).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pc=W(/^!?\[(label)\]\[(ref)\]/).replace("label",li).replace("ref",Mo).getRegex(),Lc=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",Mo).getRegex(),fg=W("reflink|nolink(?!\\()","g").replace("reflink",Pc).replace("nolink",Lc).getRegex(),ua=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ro={_backpedal:rn,anyPunctuation:cg,autolink:ug,blockSkip:ig,br:Ec,code:Zf,del:rn,emStrongLDelim:sg,emStrongRDelimAst:rg,emStrongRDelimUnd:lg,escape:Xf,link:hg,nolink:Lc,punctuation:eg,reflink:Pc,reflinkSearch:fg,tag:pg,text:Jf,url:rn},gg={...Ro,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",li).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",li).getRegex()},Bs={...Ro,emStrongRDelimAst:ag,emStrongLDelim:og,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ua).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",ua).getRegex()},mg={...Bs,br:W(Ec).replace("{2,}","*").getRegex(),text:W(Bs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fn={normal:Lo,gfm:Qf,pedantic:Yf},Vt={normal:Ro,gfm:Bs,breaks:mg,pedantic:gg},yg={"&":"&","<":"<",">":">",'"':""","'":"'"},da=e=>yg[e];function Ne(e,t){if(t){if(ue.escapeTest.test(e))return e.replace(ue.escapeReplace,da)}else if(ue.escapeTestNoEncode.test(e))return e.replace(ue.escapeReplaceNoEncode,da);return e}function pa(e){try{e=encodeURI(e).replace(ue.percentDecode,"%")}catch{return null}return e}function ha(e,t){var o;let n=e.replace(ue.findPipe,(r,a,c)=>{let u=!1,l=a;for(;--l>=0&&c[l]==="\\";)u=!u;return u?"|":" |"}),i=n.split(ue.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(ue.slashPipe,"|");return i}function Gt(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 vg(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 fa(e,t,n,i,s){let o=t.href,r=t.title||null,a=e[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,c}function bg(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let s=i[1];return t.split(`
|
|
1936
|
+
`).map(o=>{let r=o.match(n.other.beginningSpace);if(r===null)return o;let[a]=r;return a.length>=s.length?o.slice(s.length):o}).join(`
|
|
1937
1937
|
`)}var ci=class{constructor(e){U(this,"options");U(this,"rules");U(this,"lexer");this.options=e||ft}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:Gt(n,`
|
|
1938
1938
|
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=bg(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=Gt(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:Gt(t[0],`
|
|
1939
1939
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Gt(t[0],`
|
|
1940
1940
|
`).split(`
|
|
1941
|
-
`),i="",s="",
|
|
1941
|
+
`),i="",s="",o=[];for(;n.length>0;){let r=!1,a=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))a.push(n[c]),r=!0;else if(!r)a.push(n[c]);else break;n=n.slice(c);let u=a.join(`
|
|
1942
1942
|
`),l=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
1943
1943
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
1944
1944
|
${u}`:u,s=s?`${s}
|
|
1945
|
-
${l}`:l;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,
|
|
1945
|
+
${l}`:l;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,o,!0),this.lexer.state.top=d,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,f=v.raw+`
|
|
1946
1946
|
`+n.join(`
|
|
1947
|
-
`),b=this.blockquote(f);
|
|
1947
|
+
`),b=this.blockquote(f);o[o.length-1]=b,i=i.substring(0,i.length-v.raw.length)+b.raw,s=s.substring(0,s.length-v.text.length)+b.text;break}else if((h==null?void 0:h.type)==="list"){let v=h,f=v.raw+`
|
|
1948
1948
|
`+n.join(`
|
|
1949
|
-
`),b=this.list(f);
|
|
1950
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:
|
|
1949
|
+
`),b=this.list(f);o[o.length-1]=b,i=i.substring(0,i.length-h.raw.length)+b.raw,s=s.substring(0,s.length-v.raw.length)+b.raw,n=f.substring(o.at(-1).raw.length).split(`
|
|
1950
|
+
`);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,r={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 a=this.rules.other.listItemRegex(s),c=!1;for(;e;){let l=!1,d="",h="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let v=t[2].split(`
|
|
1951
1951
|
`,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),f=e.split(`
|
|
1952
1952
|
`,1)[0],b=!v.trim(),k=0;if(this.options.pedantic?(k=2,h=v.trimStart()):b?k=t[1].length+1:(k=t[2].search(this.rules.other.nonSpaceChar),k=k>4?1:k,h=v.slice(k),k+=t[1].length),b&&this.rules.other.blankLine.test(f)&&(d+=f+`
|
|
1953
1953
|
`,e=e.substring(f.length+1),l=!0),!l){let x=this.rules.other.nextBulletRegex(k),$=this.rules.other.hrRegex(k),T=this.rules.other.fencesBeginRegex(k),C=this.rules.other.headingBeginRegex(k),M=this.rules.other.htmlBeginRegex(k);for(;e;){let R=e.split(`
|
|
1954
1954
|
`,1)[0],B;if(f=R,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),B=f):B=f.replace(this.rules.other.tabCharGlobal," "),T.test(f)||C.test(f)||M.test(f)||x.test(f)||$.test(f))break;if(B.search(this.rules.other.nonSpaceChar)>=k||!f.trim())h+=`
|
|
1955
1955
|
`+B.slice(k);else{if(b||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(v)||C.test(v)||$.test(v))break;h+=`
|
|
1956
1956
|
`+f}!b&&!f.trim()&&(b=!0),d+=R+`
|
|
1957
|
-
`,e=e.substring(R.length+1),v=B.slice(k)}}
|
|
1958
|
-
`):[],
|
|
1959
|
-
`?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
|
|
1960
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){var s,r
|
|
1957
|
+
`,e=e.substring(R.length+1),v=B.slice(k)}}r.loose||(c?r.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(c=!0)),r.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),r.raw+=d}let u=r.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.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 d=this.rules.other.listTaskCheckbox.exec(l.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};l.checked=h.checked,r.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(!r.loose){let d=l.tokens.filter(v=>v.type==="space"),h=d.length>0&&d.some(v=>this.rules.other.anyLine.test(v.raw));r.loose=h}}if(r.loose)for(let l of r.items){l.loose=!0;for(let d of l.tokens)d.type==="text"&&(d.type="paragraph")}return r}}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 r;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ha(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(r=t[3])!=null&&r.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
1958
|
+
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<n.length;a++)o.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:o.align[a]});for(let a of s)o.rows.push(ha(a,o.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:o.align[u]})));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)===`
|
|
1959
|
+
`?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=Gt(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=vg(t[2],"()");if(o===-2)return;if(o>-1){let r=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let 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)),fa(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 fa(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,r,a=s,c=0,u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+s);(i=u.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(r=[...o].length,i[3]||i[4]){a+=r;continue}else if((i[5]||i[6])&&s%3&&!((s+r)%3)){c+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+c);let l=[...i[0]][0].length,d=e.slice(0,s+i.index+l+r);if(Math.min(s,r)%2){let v=d.slice(1,-1);return{type:"em",raw:d,text:v,tokens:this.lexer.inlineTokens(v)}}let h=d.slice(2,-2);return{type:"strong",raw:d,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}}}},ve=class Fs{constructor(t){U(this,"tokens");U(this,"options");U(this,"state");U(this,"inlineQueue");U(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ft,this.options.tokenizer=this.options.tokenizer||new ci,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:ue,block:Fn.normal,inline:Vt.normal};this.options.pedantic?(n.block=Fn.pedantic,n.inline=Vt.pedantic):this.options.gfm&&(n.block=Fn.gfm,this.options.breaks?n.inline=Vt.breaks:n.inline=Vt.gfm),this.tokenizer.rules=n}static get rules(){return{block:Fn,inline:Vt}}static lex(t,n){return new Fs(n).lex(t)}static lexInline(t,n){return new Fs(n).inlineTokens(t)}lex(t){t=t.replace(ue.carriageReturn,`
|
|
1960
|
+
`),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,r;for(this.options.pedantic&&(t=t.replace(ue.tabCharGlobal," ").replace(ue.spaceLine,""));t;){let a;if((o=(s=this.options.extensions)==null?void 0:s.block)!=null&&o.some(u=>(a=u.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let u=n.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
|
|
1961
1961
|
`:n.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
1962
1962
|
`)?"":`
|
|
1963
1963
|
`)+a.raw,u.text+=`
|
|
1964
1964
|
`+a.text,this.inlineQueue.at(-1).src=u.text):n.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
1965
1965
|
`)?"":`
|
|
1966
1966
|
`)+a.raw,u.text+=`
|
|
1967
|
-
`+a.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},n.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),n.push(a);continue}let c=t;if((
|
|
1967
|
+
`+a.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},n.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),n.push(a);continue}let c=t;if((r=this.options.extensions)!=null&&r.startBlock){let u=1/0,l=t.slice(1),d;this.options.extensions.startBlock.forEach(h=>{d=h.call({lexer:this},l),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(c=t.substring(0,u+1))}if(this.state.top&&(a=this.tokenizer.paragraph(c))){let u=n.at(-1);i&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
|
|
1968
1968
|
`)?"":`
|
|
1969
1969
|
`)+a.raw,u.text+=`
|
|
1970
1970
|
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(a),i=c.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
1971
1971
|
`)?"":`
|
|
1972
1972
|
`)+a.raw,u.text+=`
|
|
1973
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(a);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var c,u,l,d,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
|
|
1973
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(a);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var c,u,l,d,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=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},i))??i;let r=!1,a="";for(;t;){r||(a=""),r=!1;let v;if((d=(l=this.options.extensions)==null?void 0:l.inline)!=null&&d.some(b=>(v=b.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 b=n.at(-1);v.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=v.raw,b.text+=v.text):n.push(v);continue}if(v=this.tokenizer.emStrong(t,i,a)){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 f=t;if((h=this.options.extensions)!=null&&h.startInline){let b=1/0,k=t.slice(1),x;this.options.extensions.startInline.forEach($=>{x=$.call({lexer:this},k),typeof x=="number"&&x>=0&&(b=Math.min(b,x))}),b<1/0&&b>=0&&(f=t.substring(0,b+1))}if(v=this.tokenizer.inlineText(f)){t=t.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(a=v.raw.slice(-1)),r=!0;let b=n.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=v.raw,b.text+=v.text):n.push(v);continue}if(t){let b="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(b);break}else throw new Error(b)}}return n}},ui=class{constructor(e){U(this,"options");U(this,"parser");this.options=e||ft}space(e){return""}code({text:e,lang:t,escaped:n}){var o;let i=(o=(t||"").match(ue.notSpaceStart))==null?void 0:o[0],s=e.replace(ue.endingNewline,"")+`
|
|
1974
1974
|
`;return i?'<pre><code class="language-'+Ne(i)+'">'+(n?s:Ne(s,!0))+`</code></pre>
|
|
1975
1975
|
`:"<pre><code>"+(n?s:Ne(s,!0))+`</code></pre>
|
|
1976
1976
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
1977
1977
|
${this.parser.parse(e)}</blockquote>
|
|
1978
1978
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1979
1979
|
`}hr(e){return`<hr>
|
|
1980
|
-
`}list(e){let t=e.ordered,n=e.start,i="";for(let
|
|
1980
|
+
`}list(e){let t=e.ordered,n=e.start,i="";for(let r=0;r<e.items.length;r++){let a=e.items[r];i+=this.listitem(a)}let s=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
|
|
1981
1981
|
`+i+"</"+s+`>
|
|
1982
1982
|
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
1983
1983
|
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
1984
|
-
`}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let
|
|
1984
|
+
`}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let r=0;r<o.length;r++)n+=this.tablecell(o[r]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
1985
1985
|
<thead>
|
|
1986
1986
|
`+t+`</thead>
|
|
1987
1987
|
`+i+`</table>
|
|
1988
1988
|
`}tablerow({text:e}){return`<tr>
|
|
1989
1989
|
${e}</tr>
|
|
1990
1990
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
1991
|
-
`}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>${Ne(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=pa(e);if(s===null)return i;e=s;let
|
|
1992
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Ne(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},ut=new wg;function K(e,t){return ut.parse(e,t)}K.options=K.setOptions=function(e){return ut.setOptions(e),K.defaults=ut.defaults,Sc(K.defaults),K};K.getDefaults=
|
|
1991
|
+
`}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>${Ne(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=pa(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+Ne(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=pa(e);if(s===null)return Ne(n);e=s;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${Ne(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ne(e.text)}},No=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}},be=class Us{constructor(t){U(this,"options");U(this,"renderer");U(this,"textRenderer");this.options=t||ft,this.options.renderer=this.options.renderer||new ui,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new No}static parse(t,n){return new Us(n).parse(t)}static parseInline(t,n){return new Us(n).parseInline(t)}parse(t){var i,s;let n="";for(let o=0;o<t.length;o++){let r=t[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[r.type]){let c=r,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){n+=u||"";continue}}let a=r;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(t,n=this.renderer){var s,o;let i="";for(let r=0;r<t.length;r++){let a=t[r];if((o=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&o[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=u||"";continue}}let c=a;switch(c.type){case"escape":{i+=n.text(c);break}case"html":{i+=n.html(c);break}case"link":{i+=n.link(c);break}case"image":{i+=n.image(c);break}case"checkbox":{i+=n.checkbox(c);break}case"strong":{i+=n.strong(c);break}case"em":{i+=n.em(c);break}case"codespan":{i+=n.codespan(c);break}case"br":{i+=n.br(c);break}case"del":{i+=n.del(c);break}case"text":{i+=n.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return i}},Hn,Xt=(Hn=class{constructor(e){U(this,"options");U(this,"block");this.options=e||ft}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?ve.lex:ve.lexInline}provideParser(){return this.block?be.parse:be.parseInline}},U(Hn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),U(Hn,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Hn),wg=class{constructor(...e){U(this,"defaults",To());U(this,"options",this.setOptions);U(this,"parse",this.parseMarkdown(!0));U(this,"parseInline",this.parseMarkdown(!1));U(this,"Parser",be);U(this,"Renderer",ui);U(this,"TextRenderer",No);U(this,"Lexer",ve);U(this,"Tokenizer",ci);U(this,"Hooks",Xt);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 r=o;for(let a of r.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of r.rows)for(let c of a)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let r=o;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=o;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[r.type]?this.defaults.extensions.childTokens[r.type].forEach(a=>{let c=r[a].flat(1/0);n=n.concat(this.walkTokens(c,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.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(...r){let a=s.renderer.apply(this,r);return a===!1&&(a=o.apply(this,r)),a}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let 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 ui(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 r=o,a=n.renderer[r],c=s[r];s[r]=(...u)=>{let l=a.apply(s,u);return l===!1&&(l=c.apply(s,u)),l||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new ci(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 r=o,a=n.tokenizer[r],c=s[r];s[r]=(...u)=>{let l=a.apply(s,u);return l===!1&&(l=c.apply(s,u)),l}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Xt;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 r=o,a=n.hooks[r],c=s[r];Xt.passThroughHooks.has(o)?s[r]=u=>{if(this.defaults.async&&Xt.passThroughHooksRespectAsync.has(o))return(async()=>{let d=await a.call(s,u);return c.call(s,d)})();let l=a.call(s,u);return c.call(s,l)}:s[r]=(...u)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(s,u);return d===!1&&(d=await c.apply(s,u)),d})();let l=a.apply(s,u);return l===!1&&(l=c.apply(s,u)),l}}i.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(r){let a=[];return a.push(o.call(this,r)),s&&(a=a.concat(s.call(this,r))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ve.lex(e,t??this.defaults)}parser(e,t){return be.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 r=s.hooks?await s.hooks.preprocess(t):t,a=await(s.hooks?await s.hooks.provideLexer():e?ve.lex:ve.lexInline)(r,s),c=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?be.parse:be.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(o);try{s.hooks&&(t=s.hooks.preprocess(t));let r=(s.hooks?s.hooks.provideLexer():e?ve.lex:ve.lexInline)(t,s);s.hooks&&(r=s.hooks.processAllTokens(r)),s.walkTokens&&this.walkTokens(r,s.walkTokens);let a=(s.hooks?s.hooks.provideParser():e?be.parse:be.parseInline)(r,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(r){return o(r)}}}onError(e,t){return n=>{if(n.message+=`
|
|
1992
|
+
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Ne(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},ut=new wg;function K(e,t){return ut.parse(e,t)}K.options=K.setOptions=function(e){return ut.setOptions(e),K.defaults=ut.defaults,Sc(K.defaults),K};K.getDefaults=To;K.defaults=ft;K.use=function(...e){return ut.use(...e),K.defaults=ut.defaults,Sc(K.defaults),K};K.walkTokens=function(e,t){return ut.walkTokens(e,t)};K.parseInline=ut.parseInline;K.Parser=be;K.parser=be.parse;K.Renderer=ui;K.TextRenderer=No;K.Lexer=ve;K.lexer=ve.lex;K.Tokenizer=ci;K.Hooks=Xt;K.parse=K;K.options;K.setOptions;K.use;K.walkTokens;K.parseInline;be.parse;ve.lex;K.setOptions({gfm:!0,breaks:!0,mangle:!1});const ga=["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"],ma=["class","href","rel","target","title","start"];let ya=!1;const kg=14e4,Sg=4e4,Ag=200,ls=5e4,nt=new Map;function xg(e){const t=nt.get(e);return t===void 0?null:(nt.delete(e),nt.set(e,t),t)}function va(e,t){if(nt.set(e,t),nt.size<=Ag)return;const n=nt.keys().next().value;n&&nt.delete(n)}function $g(){ya||(ya=!0,Os.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function di(e){const t=e.trim();if(!t)return"";if($g(),t.length<=ls){const r=xg(t);if(r!==null)return r}const n=dl(t,kg),i=n.truncated?`
|
|
1993
1993
|
|
|
1994
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>Sg){const a=`<pre class="code-block">${Eg(`${n.text}${i}`)}</pre>`,c=Os.sanitize(a,{ALLOWED_TAGS:ga,ALLOWED_ATTR:ma});return t.length<=ls&&va(t,c),c}const s=K.parse(`${n.text}${i}`),
|
|
1994
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>Sg){const a=`<pre class="code-block">${Eg(`${n.text}${i}`)}</pre>`,c=Os.sanitize(a,{ALLOWED_TAGS:ga,ALLOWED_ATTR:ma});return t.length<=ls&&va(t,c),c}const s=K.parse(`${n.text}${i}`),o=Os.sanitize(s,{ALLOWED_TAGS:ga,ALLOWED_ATTR:ma});return t.length<=ls&&va(t,o),o}function Eg(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Tg=1500,Cg=2e3,Ic="Copy as markdown",_g="Copied",Mg="Copy failed";async function Pg(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}}function Un(e,t){e.title=t,e.setAttribute("aria-label",t)}function Lg(e){const t=e.label??Ic;return p`
|
|
1995
1995
|
<button
|
|
1996
1996
|
class="chat-copy-btn"
|
|
1997
1997
|
type="button"
|
|
@@ -2004,7 +2004,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2004
2004
|
<span class="chat-copy-btn__icon-check">${O.check}</span>
|
|
2005
2005
|
</span>
|
|
2006
2006
|
</button>
|
|
2007
|
-
`}function Ig(e){return Lg({text:()=>e,label:Ic})}function Rg(e){const t=e,n=Ng(t.content),i=[];for(const s of n){const
|
|
2007
|
+
`}function Ig(e){return Lg({text:()=>e,label:Ic})}function Rg(e){const t=e,n=Ng(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:Dg(s.arguments??s.args)})}for(const s of n){const o=String(s.type??"").toLowerCase();if(o!=="toolresult"&&o!=="tool_result")continue;const r=Og(s),a=typeof s.name=="string"?s.name:"tool";i.push({kind:"result",name:a,text:r})}if(gl(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=pl(e)??void 0;i.push({kind:"result",name:s,text:o})}return i}function Ng(e){return Array.isArray(e)?e.filter(Boolean):[]}function Dg(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 Og(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function Bg(e){var s;const n=e.content,i=[];if(Array.isArray(n))for(const o of n){if(typeof o!="object"||o===null)continue;const r=o;if(r.type==="image")if(((s=r.source)==null?void 0:s.type)==="base64"){const a=r.source,c=a.data,u=a.media_type||"image/png",l=c.startsWith("data:")?c:`data:${u};base64,${c}`;i.push({url:l})}else if(typeof r.data=="string"&&r.data){const a=r.data,c=r.mimeType||r.media_type||"image/png",u=a.startsWith("data:")?a:`data:${c};base64,${a}`;i.push({url:u})}else typeof r.url=="string"&&i.push({url:r.url});else if(r.type==="image_url"){const a=r.image_url;typeof(a==null?void 0:a.url)=="string"&&i.push({url:a.url})}}return i}function Fg(e){return p`
|
|
2008
2008
|
<div class="chat-group assistant">
|
|
2009
2009
|
<div class="chat-group-messages">
|
|
2010
2010
|
<div class="chat-bubble chat-reading-indicator" aria-hidden="true">
|
|
@@ -2031,7 +2031,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2031
2031
|
`}function Kg(e,t){const n=fl(e.role),i=n==="user"?"user":n==="assistant"?"assistant":"other",s=new Date(e.timestamp).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"});return p`
|
|
2032
2032
|
<div class="chat-group ${i}">
|
|
2033
2033
|
<div class="chat-group-messages">
|
|
2034
|
-
${e.messages.map((r
|
|
2034
|
+
${e.messages.map((o,r)=>Rc(o.message,{isStreaming:e.isStreaming&&r===e.messages.length-1,showReasoning:t.showReasoning}))}
|
|
2035
2035
|
<div class="chat-group-footer">
|
|
2036
2036
|
<span class="chat-group-timestamp">${s}</span>
|
|
2037
2037
|
</div>
|
|
@@ -2048,7 +2048,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2048
2048
|
/>
|
|
2049
2049
|
`)}
|
|
2050
2050
|
</div>
|
|
2051
|
-
`}function Rc(e,t,n){const i=e,s=typeof i.role=="string"?i.role:"unknown",
|
|
2051
|
+
`}function Rc(e,t,n){const i=e,s=typeof i.role=="string"?i.role:"unknown",o=gl(e)||s.toLowerCase()==="toolresult"||s.toLowerCase()==="tool_result"||typeof i.toolCallId=="string"||typeof i.tool_call_id=="string",a=Rg(e).length>0,c=Bg(e),u=c.length>0,l=pl(e),d=t.showReasoning&&s==="assistant"?vd(e):null,h=l!=null&&l.trim()?l:null,v=d?wd(d):null,f=h,b=(s==="assistant"||s==="user")&&!!(f!=null&&f.trim()),k=["chat-bubble",b?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!f&&(a||o)||!f&&!u?S:p`
|
|
2052
2052
|
<div class="${k}">
|
|
2053
2053
|
${b?Ig(f):S}
|
|
2054
2054
|
${zg(c)}
|
|
@@ -2072,7 +2072,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2072
2072
|
`:e.content?p`<div class="sidebar-markdown">${ai(di(e.content))}</div>`:p`<div class="muted">No content available</div>`}
|
|
2073
2073
|
</div>
|
|
2074
2074
|
</div>
|
|
2075
|
-
`}var Hg=Object.defineProperty,qg=Object.getOwnPropertyDescriptor,Ci=(e,t,n,i)=>{for(var s=i>1?void 0:i?qg(t,n):t,
|
|
2075
|
+
`}var Hg=Object.defineProperty,qg=Object.getOwnPropertyDescriptor,Ci=(e,t,n,i)=>{for(var s=i>1?void 0:i?qg(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(s=(i?r(t,n,s):r(s))||s);return i&&s&&Hg(t,n,s),s};let Pt=class extends Et{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 p``}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)}};Pt.styles=Du`
|
|
2076
2076
|
:host {
|
|
2077
2077
|
width: 4px;
|
|
2078
2078
|
cursor: col-resize;
|
|
@@ -2098,13 +2098,13 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2098
2098
|
:host(.dragging) {
|
|
2099
2099
|
background: var(--accent, #007bff);
|
|
2100
2100
|
}
|
|
2101
|
-
`;Ci([bi({type:Number})],Pt.prototype,"splitRatio",2);Ci([bi({type:Number})],Pt.prototype,"minRatio",2);Ci([bi({type:Number})],Pt.prototype,"maxRatio",2);Pt=Ci([ol("resizable-divider")],Pt);function Wn(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function cs(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const Vg=1,Gg=1,gt="emoji",Lt="keyvalue",Nr="favorites",Qg="tokens",Nc="tokens",Yg="unicode",Dc="count",Xg="group",Zg="order",Oc="group-order",Ws="eTag",pi="url",ba="skinTone",Nt="readonly",Dr="readwrite",Bc="skinUnicodes",Jg="skinUnicodes",em="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",tm="en";function nm(e,t){const n=new Set,i=[];for(const s of e){const r=t(s);n.has(r)||(n.add(r),i.push(s))}return i}function wa(e){return nm(e,t=>t.unicode)}function im(e){function t(n,i,s){const r=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[o,[a,c]]of Object.entries(s))r.createIndex(o,a,{multiEntry:c});return r}t(Lt),t(gt,Yg,{[Nc]:[Qg,!0],[Oc]:[[Xg,Zg]],[Bc]:[Jg,!0]}),t(Nr,void 0,{[Dc]:[""]})}const Ks={},Qn={},hi={};function Fc(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function sm(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,Vg);Ks[e]=s,s.onupgradeneeded=r=>{r.oldVersion<Gg&&im(s.result)},Fc(n,i,s)});return t.onclose=()=>Or(e),t}function rm(e){return Qn[e]||(Qn[e]=sm(e)),Qn[e]}function Oe(e,t,n,i){return new Promise((s,r)=>{const o=e.transaction(t,n,{durability:"relaxed"}),a=typeof t=="string"?o.objectStore(t):t.map(u=>o.objectStore(u));let c;i(a,o,u=>{c=u}),o.oncomplete=()=>s(c),o.onerror=()=>r(o.error)})}function Or(e){const t=Ks[e],n=t&&t.result;if(n){n.close();const i=hi[e];if(i)for(const s of i)s()}delete Ks[e],delete Qn[e],delete hi[e]}function om(e){return new Promise((t,n)=>{Or(e);const i=indexedDB.deleteDatabase(e);Fc(t,n,i)})}function am(e,t){let n=hi[e];n||(n=hi[e]=[]),n.push(t)}const lm=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 Ct(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||lm.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const cm=2;function Uc(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=cm)}function um(e){return e.map(({annotation:n,emoticon:i,group:s,order:r,shortcodes:o,skins:a,tags:c,emoji:u,version:l})=>{const d=[...new Set(Uc([...(o||[]).map(Ct).flat(),...(c||[]).map(Ct).flat(),...Ct(n),i]))].sort(),h={annotation:n,group:s,order:r,tags:c,tokens:d,unicode:u,version:l};if(i&&(h.emoticon=i),o&&(h.shortcodes=o),a){h.skinTones=[],h.skinUnicodes=[],h.skinVersions=[];for(const{tone:v,emoji:f,version:b}of a)h.skinTones.push(v),h.skinUnicodes.push(f),h.skinVersions.push(b)}return h})}function Wc(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function dt(e,t,n){Wc(e,"get",t,n)}function Kc(e,t,n){Wc(e,"getAll",t,n)}function Br(e){e.commit&&e.commit()}function dm(e,t){let n=e[0];for(let i=1;i<e.length;i++){const s=e[i];t(n)>t(s)&&(n=s)}return n}function zc(e,t){const n=dm(e,s=>s.length),i=[];for(const s of n)e.some(r=>r.findIndex(o=>t(o)===t(s))===-1)||i.push(s);return i}async function pm(e){return!await Fr(e,Lt,pi)}async function hm(e,t,n){const[i,s]=await Promise.all([Ws,pi].map(r=>Fr(e,Lt,r)));return i===n&&s===t}async function fm(e,t){return Oe(e,gt,Nt,(i,s,r)=>{let o;const a=()=>{i.getAll(o&&IDBKeyRange.lowerBound(o,!0),50).onsuccess=c=>{const u=c.target.result;for(const l of u)if(o=l.unicode,t(l))return r(l);if(u.length<50)return r();a()}};a()})}async function jc(e,t,n,i){{const s=um(t);await Oe(e,[gt,Lt],Dr,([r,o],a)=>{let c,u,l=0;function d(){++l===2&&h()}function h(){if(!(c===i&&u===n)){r.clear();for(const v of s)r.put(v);o.put(i,Ws),o.put(n,pi),Br(a)}}dt(o,Ws,v=>{c=v,d()}),dt(o,pi,v=>{u=v,d()})})}}async function gm(e,t){return Oe(e,gt,Nt,(n,i,s)=>{const r=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Kc(n.index(Oc),r,s)})}async function Hc(e,t){const n=Uc(Ct(t));return n.length?Oe(e,gt,Nt,(i,s,r)=>{const o=[],a=()=>{o.length===n.length&&c()},c=()=>{const u=zc(o,l=>l.unicode);r(u.sort((l,d)=>l.order<d.order?-1:1))};for(let u=0;u<n.length;u++){const l=n[u],d=u===n.length-1?IDBKeyRange.bound(l,l+"",!1,!0):IDBKeyRange.only(l);Kc(i.index(Nc),d,h=>{o.push(h),a()})}}):[]}async function mm(e,t){const n=await Hc(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(r=>r.toLowerCase()).includes(t.toLowerCase()))[0]||null:await fm(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function ym(e,t){return Oe(e,gt,Nt,(n,i,s)=>dt(n,t,r=>{if(r)return s(r);dt(n.index(Bc),t,o=>s(o||null))}))}function Fr(e,t,n){return Oe(e,t,Nt,(i,s,r)=>dt(i,n,r))}function vm(e,t,n,i){return Oe(e,t,Dr,(s,r)=>{s.put(i,n),Br(r)})}function bm(e,t){return Oe(e,Nr,Dr,(n,i)=>dt(n,t,s=>{n.put((s||0)+1,t),Br(i)}))}function wm(e,t,n){return n===0?[]:Oe(e,[Nr,gt],Nt,([i,s],r,o)=>{const a=[];i.index(Dc).openCursor(void 0,"prev").onsuccess=c=>{const u=c.target.result;if(!u)return o(a);function l(v){if(a.push(v),a.length===n)return o(a);u.continue()}const d=u.primaryKey,h=t.byName(d);if(h)return l(h);dt(s,d,v=>{if(v)return l(v);u.continue()})}})}const Kn="";function km(e,t){const n=new Map;for(const s of e){const r=t(s);for(const o of r){let a=n;for(let u=0;u<o.length;u++){const l=o.charAt(u);let d=a.get(l);d||(d=new Map,a.set(l,d)),a=d}let c=a.get(Kn);c||(c=[],a.set(Kn,c)),c.push(s)}}return(s,r)=>{let o=n;for(let u=0;u<s.length;u++){const l=s.charAt(u),d=o.get(l);if(d)o=d;else return[]}if(r)return o.get(Kn)||[];const a=[],c=[o];for(;c.length;){const l=[...c.shift().entries()].sort((d,h)=>d[0]<h[0]?-1:1);for(const[d,h]of l)d===Kn?a.push(...h):c.push(h)}return a}}const Sm=["name","url"];function Am(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||Sm.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function ka(e){Am(e);const t=(h,v)=>h.name.toLowerCase()<v.name.toLowerCase()?-1:1,n=e.sort(t),s=km(e,h=>{const v=new Set;if(h.shortcodes)for(const f of h.shortcodes)for(const b of Ct(f))v.add(b);return v}),r=h=>s(h,!0),o=h=>s(h,!1),a=h=>{const v=Ct(h),f=v.map((b,k)=>(k<v.length-1?r:o)(b));return zc(f,b=>b.name).sort(t)},c=new Map,u=new Map;for(const h of e){u.set(h.name.toLowerCase(),h);for(const v of h.shortcodes||[])c.set(v.toLowerCase(),h)}return{all:n,search:a,byShortcode:h=>c.get(h.toLowerCase()),byName:h=>u.get(h.toLowerCase())}}const xm=typeof wrappedJSObject<"u";function Qt(e){if(!e)return e;if(xm&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function qc(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const $m=["annotation","emoji","group","order","version"];function Em(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||$m.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function Vc(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function Tm(e){const t=await fetch(e,{method:"HEAD"});Vc(t,e);const n=t.headers.get("etag");return qc(n),n}async function zs(e){const t=await fetch(e);Vc(t,e);const n=t.headers.get("etag");qc(n);const i=await t.json();return Em(i),[n,i]}function Cm(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function _m(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=-1;++s<t;)i[s]=e.charCodeAt(s);return n}async function Gc(e){const t=JSON.stringify(e);let n=_m(t);const i=await crypto.subtle.digest("SHA-1",n),s=Cm(i);return btoa(s)}async function Mm(e,t){let n,i=await Tm(t);if(!i){const s=await zs(t);i=s[0],n=s[1],i||(i=await Gc(n))}await hm(e,t,i)||(n||(n=(await zs(t))[1]),await jc(e,n,t,i))}async function Pm(e,t){let[n,i]=await zs(t);n||(n=await Gc(i)),await jc(e,i,t,n)}async function Lm(e,t){try{await Mm(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class Im{constructor({dataSource:t=em,locale:n=tm,customEmoji:i=[]}={}){this.dataSource=t,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=ka(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await rm(this._dbName);am(this._dbName,this._clear);const n=this.dataSource;await pm(t)?await Pm(t,n):this._lazyUpdate=Lm(t,n)}async ready(){const t=async()=>(this._ready||(this._ready=this._init()),this._ready);await t(),this._db||await t()}async getEmojiByGroup(t){return cs(t),await this.ready(),wa(await gm(this._db,t)).map(Qt)}async getEmojiBySearchQuery(t){Wn(t),await this.ready();const n=this._custom.search(t),i=wa(await Hc(this._db,t)).map(Qt);return[...n,...i]}async getEmojiByShortcode(t){Wn(t),await this.ready();const n=this._custom.byShortcode(t);return n||Qt(await mm(this._db,t))}async getEmojiByUnicodeOrName(t){Wn(t),await this.ready();const n=this._custom.byName(t);return n||Qt(await ym(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await Fr(this._db,Lt,ba)||0}async setPreferredSkinTone(t){return cs(t),await this.ready(),vm(this._db,Lt,ba,t)}async incrementFavoriteEmojiCount(t){return Wn(t),await this.ready(),bm(this._db,t)}async getTopFavoriteEmoji(t){return cs(t),await this.ready(),(await wm(this._db,this._custom,t)).map(Qt)}set customEmoji(t){this._custom=ka(t)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await Or(this._dbName)}async delete(){await this._shutdown(),await om(this._dbName)}}const js=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([e,t,n])=>({id:e,emoji:t,name:n})),us=js.slice(1),Rm=2,Sa=6,Qc=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function Aa(e){return e.unicode.includes("")}const Nm={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},Dm=1e3,Om="🖐️",Bm=8,Fm=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],Yc='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Um=(e,t)=>e<t?-1:e>t?1:0,xa=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const i=n.getContext("2d",{willReadFrequently:!0});return i.textBaseline="top",i.font=`100px ${Yc}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Wm=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Km(e){const t=xa(e,"#000"),n=xa(e,"#fff");return t&&n&&Wm(t,n)}function zm(){const e=Object.entries(Nm);try{for(const[t,n]of e)if(Km(t))return n}catch{}return e[0][1]}let ds;const ps=()=>(ds||(ds=new Promise(e=>Qc(()=>e(zm())))),ds),Hs=new Map,jm="️",Hm="\uD83C",qm="",Vm=127995,Gm=57339;function Qm(e,t){if(t===0)return e;const n=e.indexOf(qm);return n!==-1?e.substring(0,n)+String.fromCodePoint(Vm+t-1)+e.substring(n):(e.endsWith(jm)&&(e=e.substring(0,e.length-1)),e+Hm+String.fromCodePoint(Gm+t-1))}function $e(e){e.preventDefault(),e.stopPropagation()}function hs(e,t,n){return t+=e?-1:1,t<0?t=n.length-1:t>=n.length&&(t=0),t}function Xc(e,t){const n=new Set,i=[];for(const s of e){const r=t(s);n.has(r)||(n.add(r),i.push(s))}return i}function Ym(e,t){const n=i=>{const s={};for(const r of i)typeof r.tone=="number"&&r.version<=t&&(s[r.tone]=r.unicode);return s};return e.map(({unicode:i,skins:s,shortcodes:r,url:o,name:a,category:c,annotation:u})=>({unicode:i,name:a,shortcodes:r,url:o,category:c,annotation:u,id:i||a,skins:s&&n(s)}))}const Yn=requestAnimationFrame;let Xm=typeof ResizeObserver=="function";function Zm(e,t,n){let i;Xm?(i=new ResizeObserver(n),i.observe(e)):Yn(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function $a(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let fs;function Jm(e,t,n){let i=!0,s=!1;for(const r of e){const o=n(r);if(!o)continue;const a=$a(o);a===0&&(s=!0),typeof fs>"u"&&(fs=$a(t));const c=a/1.8<fs;Hs.set(r.unicode,c),c||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
2101
|
+
`;Ci([bi({type:Number})],Pt.prototype,"splitRatio",2);Ci([bi({type:Number})],Pt.prototype,"minRatio",2);Ci([bi({type:Number})],Pt.prototype,"maxRatio",2);Pt=Ci([rl("resizable-divider")],Pt);function Wn(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function cs(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const Vg=1,Gg=1,gt="emoji",Lt="keyvalue",Do="favorites",Qg="tokens",Nc="tokens",Yg="unicode",Dc="count",Xg="group",Zg="order",Oc="group-order",Ws="eTag",pi="url",ba="skinTone",Nt="readonly",Oo="readwrite",Bc="skinUnicodes",Jg="skinUnicodes",em="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",tm="en";function nm(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 wa(e){return nm(e,t=>t.unicode)}function im(e){function t(n,i,s){const o=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[r,[a,c]]of Object.entries(s))o.createIndex(r,a,{multiEntry:c});return o}t(Lt),t(gt,Yg,{[Nc]:[Qg,!0],[Oc]:[[Xg,Zg]],[Bc]:[Jg,!0]}),t(Do,void 0,{[Dc]:[""]})}const Ks={},Qn={},hi={};function Fc(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function sm(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,Vg);Ks[e]=s,s.onupgradeneeded=o=>{o.oldVersion<Gg&&im(s.result)},Fc(n,i,s)});return t.onclose=()=>Bo(e),t}function om(e){return Qn[e]||(Qn[e]=sm(e)),Qn[e]}function Oe(e,t,n,i){return new Promise((s,o)=>{const r=e.transaction(t,n,{durability:"relaxed"}),a=typeof t=="string"?r.objectStore(t):t.map(u=>r.objectStore(u));let c;i(a,r,u=>{c=u}),r.oncomplete=()=>s(c),r.onerror=()=>o(r.error)})}function Bo(e){const t=Ks[e],n=t&&t.result;if(n){n.close();const i=hi[e];if(i)for(const s of i)s()}delete Ks[e],delete Qn[e],delete hi[e]}function rm(e){return new Promise((t,n)=>{Bo(e);const i=indexedDB.deleteDatabase(e);Fc(t,n,i)})}function am(e,t){let n=hi[e];n||(n=hi[e]=[]),n.push(t)}const lm=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 Ct(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||lm.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const cm=2;function Uc(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=cm)}function um(e){return e.map(({annotation:n,emoticon:i,group:s,order:o,shortcodes:r,skins:a,tags:c,emoji:u,version:l})=>{const d=[...new Set(Uc([...(r||[]).map(Ct).flat(),...(c||[]).map(Ct).flat(),...Ct(n),i]))].sort(),h={annotation:n,group:s,order:o,tags:c,tokens:d,unicode:u,version:l};if(i&&(h.emoticon=i),r&&(h.shortcodes=r),a){h.skinTones=[],h.skinUnicodes=[],h.skinVersions=[];for(const{tone:v,emoji:f,version:b}of a)h.skinTones.push(v),h.skinUnicodes.push(f),h.skinVersions.push(b)}return h})}function Wc(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function dt(e,t,n){Wc(e,"get",t,n)}function Kc(e,t,n){Wc(e,"getAll",t,n)}function Fo(e){e.commit&&e.commit()}function dm(e,t){let n=e[0];for(let i=1;i<e.length;i++){const s=e[i];t(n)>t(s)&&(n=s)}return n}function zc(e,t){const n=dm(e,s=>s.length),i=[];for(const s of n)e.some(o=>o.findIndex(r=>t(r)===t(s))===-1)||i.push(s);return i}async function pm(e){return!await Uo(e,Lt,pi)}async function hm(e,t,n){const[i,s]=await Promise.all([Ws,pi].map(o=>Uo(e,Lt,o)));return i===n&&s===t}async function fm(e,t){return Oe(e,gt,Nt,(i,s,o)=>{let r;const a=()=>{i.getAll(r&&IDBKeyRange.lowerBound(r,!0),50).onsuccess=c=>{const u=c.target.result;for(const l of u)if(r=l.unicode,t(l))return o(l);if(u.length<50)return o();a()}};a()})}async function jc(e,t,n,i){{const s=um(t);await Oe(e,[gt,Lt],Oo,([o,r],a)=>{let c,u,l=0;function d(){++l===2&&h()}function h(){if(!(c===i&&u===n)){o.clear();for(const v of s)o.put(v);r.put(i,Ws),r.put(n,pi),Fo(a)}}dt(r,Ws,v=>{c=v,d()}),dt(r,pi,v=>{u=v,d()})})}}async function gm(e,t){return Oe(e,gt,Nt,(n,i,s)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Kc(n.index(Oc),o,s)})}async function Hc(e,t){const n=Uc(Ct(t));return n.length?Oe(e,gt,Nt,(i,s,o)=>{const r=[],a=()=>{r.length===n.length&&c()},c=()=>{const u=zc(r,l=>l.unicode);o(u.sort((l,d)=>l.order<d.order?-1:1))};for(let u=0;u<n.length;u++){const l=n[u],d=u===n.length-1?IDBKeyRange.bound(l,l+"",!1,!0):IDBKeyRange.only(l);Kc(i.index(Nc),d,h=>{r.push(h),a()})}}):[]}async function mm(e,t){const n=await Hc(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(o=>o.toLowerCase()).includes(t.toLowerCase()))[0]||null:await fm(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function ym(e,t){return Oe(e,gt,Nt,(n,i,s)=>dt(n,t,o=>{if(o)return s(o);dt(n.index(Bc),t,r=>s(r||null))}))}function Uo(e,t,n){return Oe(e,t,Nt,(i,s,o)=>dt(i,n,o))}function vm(e,t,n,i){return Oe(e,t,Oo,(s,o)=>{s.put(i,n),Fo(o)})}function bm(e,t){return Oe(e,Do,Oo,(n,i)=>dt(n,t,s=>{n.put((s||0)+1,t),Fo(i)}))}function wm(e,t,n){return n===0?[]:Oe(e,[Do,gt],Nt,([i,s],o,r)=>{const a=[];i.index(Dc).openCursor(void 0,"prev").onsuccess=c=>{const u=c.target.result;if(!u)return r(a);function l(v){if(a.push(v),a.length===n)return r(a);u.continue()}const d=u.primaryKey,h=t.byName(d);if(h)return l(h);dt(s,d,v=>{if(v)return l(v);u.continue()})}})}const Kn="";function km(e,t){const n=new Map;for(const s of e){const o=t(s);for(const r of o){let a=n;for(let u=0;u<r.length;u++){const l=r.charAt(u);let d=a.get(l);d||(d=new Map,a.set(l,d)),a=d}let c=a.get(Kn);c||(c=[],a.set(Kn,c)),c.push(s)}}return(s,o)=>{let r=n;for(let u=0;u<s.length;u++){const l=s.charAt(u),d=r.get(l);if(d)r=d;else return[]}if(o)return r.get(Kn)||[];const a=[],c=[r];for(;c.length;){const l=[...c.shift().entries()].sort((d,h)=>d[0]<h[0]?-1:1);for(const[d,h]of l)d===Kn?a.push(...h):c.push(h)}return a}}const Sm=["name","url"];function Am(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||Sm.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function ka(e){Am(e);const t=(h,v)=>h.name.toLowerCase()<v.name.toLowerCase()?-1:1,n=e.sort(t),s=km(e,h=>{const v=new Set;if(h.shortcodes)for(const f of h.shortcodes)for(const b of Ct(f))v.add(b);return v}),o=h=>s(h,!0),r=h=>s(h,!1),a=h=>{const v=Ct(h),f=v.map((b,k)=>(k<v.length-1?o:r)(b));return zc(f,b=>b.name).sort(t)},c=new Map,u=new Map;for(const h of e){u.set(h.name.toLowerCase(),h);for(const v of h.shortcodes||[])c.set(v.toLowerCase(),h)}return{all:n,search:a,byShortcode:h=>c.get(h.toLowerCase()),byName:h=>u.get(h.toLowerCase())}}const xm=typeof wrappedJSObject<"u";function Qt(e){if(!e)return e;if(xm&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function qc(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const $m=["annotation","emoji","group","order","version"];function Em(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||$m.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function Vc(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function Tm(e){const t=await fetch(e,{method:"HEAD"});Vc(t,e);const n=t.headers.get("etag");return qc(n),n}async function zs(e){const t=await fetch(e);Vc(t,e);const n=t.headers.get("etag");qc(n);const i=await t.json();return Em(i),[n,i]}function Cm(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function _m(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=-1;++s<t;)i[s]=e.charCodeAt(s);return n}async function Gc(e){const t=JSON.stringify(e);let n=_m(t);const i=await crypto.subtle.digest("SHA-1",n),s=Cm(i);return btoa(s)}async function Mm(e,t){let n,i=await Tm(t);if(!i){const s=await zs(t);i=s[0],n=s[1],i||(i=await Gc(n))}await hm(e,t,i)||(n||(n=(await zs(t))[1]),await jc(e,n,t,i))}async function Pm(e,t){let[n,i]=await zs(t);n||(n=await Gc(i)),await jc(e,i,t,n)}async function Lm(e,t){try{await Mm(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class Im{constructor({dataSource:t=em,locale:n=tm,customEmoji:i=[]}={}){this.dataSource=t,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=ka(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await om(this._dbName);am(this._dbName,this._clear);const n=this.dataSource;await pm(t)?await Pm(t,n):this._lazyUpdate=Lm(t,n)}async ready(){const t=async()=>(this._ready||(this._ready=this._init()),this._ready);await t(),this._db||await t()}async getEmojiByGroup(t){return cs(t),await this.ready(),wa(await gm(this._db,t)).map(Qt)}async getEmojiBySearchQuery(t){Wn(t),await this.ready();const n=this._custom.search(t),i=wa(await Hc(this._db,t)).map(Qt);return[...n,...i]}async getEmojiByShortcode(t){Wn(t),await this.ready();const n=this._custom.byShortcode(t);return n||Qt(await mm(this._db,t))}async getEmojiByUnicodeOrName(t){Wn(t),await this.ready();const n=this._custom.byName(t);return n||Qt(await ym(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await Uo(this._db,Lt,ba)||0}async setPreferredSkinTone(t){return cs(t),await this.ready(),vm(this._db,Lt,ba,t)}async incrementFavoriteEmojiCount(t){return Wn(t),await this.ready(),bm(this._db,t)}async getTopFavoriteEmoji(t){return cs(t),await this.ready(),(await wm(this._db,this._custom,t)).map(Qt)}set customEmoji(t){this._custom=ka(t)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await Bo(this._dbName)}async delete(){await this._shutdown(),await rm(this._dbName)}}const js=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([e,t,n])=>({id:e,emoji:t,name:n})),us=js.slice(1),Rm=2,Sa=6,Qc=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function Aa(e){return e.unicode.includes("")}const Nm={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},Dm=1e3,Om="🖐️",Bm=8,Fm=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],Yc='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Um=(e,t)=>e<t?-1:e>t?1:0,xa=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const i=n.getContext("2d",{willReadFrequently:!0});return i.textBaseline="top",i.font=`100px ${Yc}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Wm=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Km(e){const t=xa(e,"#000"),n=xa(e,"#fff");return t&&n&&Wm(t,n)}function zm(){const e=Object.entries(Nm);try{for(const[t,n]of e)if(Km(t))return n}catch{}return e[0][1]}let ds;const ps=()=>(ds||(ds=new Promise(e=>Qc(()=>e(zm())))),ds),Hs=new Map,jm="️",Hm="\uD83C",qm="",Vm=127995,Gm=57339;function Qm(e,t){if(t===0)return e;const n=e.indexOf(qm);return n!==-1?e.substring(0,n)+String.fromCodePoint(Vm+t-1)+e.substring(n):(e.endsWith(jm)&&(e=e.substring(0,e.length-1)),e+Hm+String.fromCodePoint(Gm+t-1))}function $e(e){e.preventDefault(),e.stopPropagation()}function hs(e,t,n){return t+=e?-1:1,t<0?t=n.length-1:t>=n.length&&(t=0),t}function Xc(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function Ym(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:r,name:a,category:c,annotation:u})=>({unicode:i,name:a,shortcodes:o,url:r,category:c,annotation:u,id:i||a,skins:s&&n(s)}))}const Yn=requestAnimationFrame;let Xm=typeof ResizeObserver=="function";function Zm(e,t,n){let i;Xm?(i=new ResizeObserver(n),i.observe(e)):Yn(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function $a(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let fs;function Jm(e,t,n){let i=!0,s=!1;for(const o of e){const r=n(o);if(!r)continue;const a=$a(r);a===0&&(s=!0),typeof fs>"u"&&(fs=$a(t));const c=a/1.8<fs;Hs.set(o.unicode,c),c||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
2102
2102
|
This is likely due to using \`display:none\` which is unsupported.
|
|
2103
2103
|
If this is a Jest/Vitest environment, you can ignore this warning.
|
|
2104
|
-
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function ey(e){return Xc(e,t=>t)}function ty(e){e&&(e.scrollTop=0)}function an(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function Ea(e){return""+e}function ny(e){const t=document.createElement("template");return t.innerHTML=e,t}const iy=new WeakMap,sy=new WeakMap,ry=Symbol("un-keyed"),oy="replaceChildren"in Element.prototype;function ay(e,t){oy?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function ly(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 cy(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=ly(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&ay(i,e)}function uy(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:r,attributeName:o,attributeValuePre:a,attributeValuePost:c}}=n,u=e[r];if(s!==u)if(n.currentExpression=u,o)if(u===null)i.removeAttribute(o);else{const l=a+Ea(u)+c;i.setAttribute(o,l)}else{let l;Array.isArray(u)?cy(u,n):u instanceof Element?(l=u,i.replaceWith(l)):i.nodeValue=Ea(u),l&&(n.targetNode=l)}}}function dy(e){let t="",n=!1,i=!1,s=-1;const r=new Map,o=[];let a=0;for(let u=0,l=e.length;u<l;u++){const d=e[u];if(t+=d.slice(a),u===l-1)break;for(let $=0;$<d.length;$++)switch(d.charAt($)){case"<":{d.charAt($+1)==="/"?o.pop():(n=!0,o.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const h=o[o.length-1],v=an(r,h,()=>[]);let f,b,k;if(i){const $=/(\S+)="?([^"=]*)$/.exec(d);f=$[1],b=$[2];const T=/^([^">]*)("?)/.exec(e[u+1]);k=T[1],t=t.slice(0,-1*$[0].length),a=T[0].length}else a=0;const x={attributeName:f,attributeValuePre:b,attributeValuePost:k,expressionIndex:u};v.push(x),!n&&!i&&(t+=" ")}return{template:ny(t),elementsToBindings:r}}function Ta(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],r=s.attributeName?t:t.firstChild,o={binding:s,targetNode:r,targetParentNode:void 0,currentExpression:void 0};n.push(o)}}function py(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))Ta(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let r=e,o=-1;do{const a=t.get(++o);a&&Ta(a,r,n)}while(r=s.nextNode())}return n}function hy(e){const{template:t,elementsToBindings:n}=an(iy,e,()=>dy(e)),i=t.cloneNode(!0).content.firstElementChild,s=py(i,n);return function(o){return uy(o,s),i}}function fy(e){const t=an(sy,e,()=>new Map);let n=ry;function i(r,...o){const a=an(t,r,()=>new Map);return an(a,n,()=>hy(r))(o)}function s(r,o,a){return r.map((c,u)=>{const l=n;n=a(c);try{return o(c,u)}finally{n=l}})}return{map:s,html:i}}function gy(e,t,n,i,s,r,o,a,c){const{labelWithSkin:u,titleForEmoji:l,unicodeWithSkin:d}=n,{html:h,map:v}=fy(t);function f($,T,C){return v($,(M,R)=>h`<button role="${T?"option":"menuitem"}" aria-selected="${T?R===t.activeSearchItem:null}" aria-label="${u(M,t.currentSkinTone)}" title="${l(M)}" class="${"emoji"+(T&&R===t.activeSearchItem?" active":"")+(M.unicode?"":" custom-emoji")}" id="${`${C}-${M.id}`}" style="${M.unicode?null:`--custom-emoji-background: url(${JSON.stringify(M.url)})`}">${M.unicode?d(M,t.currentSkinTone):""}</button>`,M=>`${C}-${M.id}`)}const k=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,($,T)=>h`<div id="skintone-${T}" class="emoji ${T===t.activeSkinTone?"active":""}" aria-selected="${T===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[T]}" aria-label="${t.i18n.skinTones[T]}">${$}</div>`,$=>$)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${v(t.groups,$=>h`<button role="tab" class="nav-button" aria-controls="tab-${$.id}" aria-label="${t.i18n.categories[$.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===$.id}" title="${t.i18n.categories[$.name]}" data-group-id="${$.id}"><div class="nav-emoji emoji">${$.emoji}</div></button>`,$=>$.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${v(t.currentEmojisWithCategories,($,T)=>h`<div><div id="menu-label-${T}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:$.category?$.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${T!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil($.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${T}" id="${t.searchMode?"search-results":null}">${f($.emojis,t.searchMode,"emo")}</div></div>`,$=>$.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${f(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,x=($,T)=>{for(const C of e.querySelectorAll(`[${$}]`))T(C,C.getAttribute($))};if(c){e.appendChild(k);for(const $ of["click","focusout","input","keydown","keyup"])x(`data-on-${$}`,(T,C)=>{T.addEventListener($,i[C])});x("data-ref",($,T)=>{r[T]=$}),o.addEventListener("abort",()=>{e.removeChild(k)})}x("data-action",($,T)=>{let C=a.get(T);C||a.set(T,C=new WeakSet),C.has($)||(C.add($),s[T]($))})}const fi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function my(e){let t=!1,n;const i=new Map,s=new Set;let r;const o=()=>{if(t)return;const u=[...s];s.clear();try{for(const l of u)l()}finally{r=!1,s.size&&(r=!0,fi(o))}},a=new Proxy({},{get(u,l){if(n){let d=i.get(l);d||(d=new Set,i.set(l,d)),d.add(n)}return u[l]},set(u,l,d){if(u[l]!==d){u[l]=d;const h=i.get(l);if(h){for(const v of h)s.add(v);r||(r=!0,fi(o))}}return!0}}),c=u=>{const l=()=>{const d=n;n=l;try{return u()}finally{n=d}};return l()};return e.addEventListener("abort",()=>{t=!0}),{state:a,createEffect:c}}function gs(e,t,n){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}const Ca=new WeakMap;function yy(e,t,n){{const i=e.closest(".tabpanel");let s=Ca.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),Ca.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const ms=[],{assign:zn}=Object;function vy(e,t){const n={},i=new AbortController,s=i.signal,{state:r,createEffect:o}=my(s),a=new Map;zn(r,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),zn(r,t),zn(r,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Bm,isRtl:!1,currentGroupIndex:0,groups:us,databaseLoaded:!1,activeSearchItemId:void 0}),o(()=>{r.currentGroup!==r.groups[r.currentGroupIndex]&&(r.currentGroup=r.groups[r.currentGroupIndex])});const c=A=>{e.getElementById(A).focus()},u=A=>e.getElementById(`emo-${A.id}`),l=(A,_)=>{n.rootElement.dispatchEvent(new CustomEvent(A,{detail:_,bubbles:!0,composed:!0}))},d=(A,_)=>A.id===_.id,h=(A,_)=>{const{category:N,emojis:D}=A,{category:q,emojis:z}=_;return N!==q?!1:gs(D,z,d)},v=A=>{gs(r.currentEmojis,A,d)||(r.currentEmojis=A)},f=A=>{r.searchMode!==A&&(r.searchMode=A)},b=A=>{gs(r.currentEmojisWithCategories,A,h)||(r.currentEmojisWithCategories=A)},k=(A,_)=>_&&A.skins&&A.skins[_]||A.unicode,T={labelWithSkin:(A,_)=>ey([A.name||k(A,_),A.annotation,...A.shortcodes||ms].filter(Boolean)).join(", "),titleForEmoji:A=>A.annotation||(A.shortcodes||ms).join(", "),unicodeWithSkin:k},C={onClickSkinToneButton:H,onEmojiClick:Sn,onNavClick:wn,onNavKeydown:Ii,onSearchKeydown:Li,onSkinToneOptionsClick:An,onSkinToneOptionsFocusOut:Fe,onSkinToneOptionsKeydown:Ye,onSkinToneOptionsKeyup:Ot,onSearchInput:xn},M={calculateEmojiGridStyle:ee,updateOnIntersection:me};let R=!0;o(()=>{gy(e,r,T,C,M,n,s,a,R),R=!1}),r.emojiVersion||ps().then(A=>{A||(r.message=r.i18n.emojiUnsupportedMessage)}),o(()=>{async function A(){let _=!1;const N=setTimeout(()=>{_=!0,r.message=r.i18n.loadingMessage},Dm);try{await r.database.ready(),r.databaseLoaded=!0}catch(D){console.error(D),r.message=r.i18n.networkErrorMessage}finally{clearTimeout(N),_&&(_=!1,r.message="")}}r.database&&A()}),o(()=>{r.pickerStyle=`
|
|
2105
|
-
--num-groups: ${
|
|
2106
|
-
--indicator-opacity: ${
|
|
2107
|
-
--num-skintones: ${Sa};`}),o(()=>{r.customEmoji&&r.database&&B()}),o(()=>{r.customEmoji&&r.customEmoji.length?r.groups!==js&&(r.groups=js):r.groups!==us&&(r.currentGroupIndex&&r.currentGroupIndex--,r.groups=us)}),o(()=>{async function A(){r.databaseLoaded&&(r.currentSkinTone=await r.database.getPreferredSkinTone())}A()}),o(()=>{r.skinTones=Array(Sa).fill().map((A,_)=>Qm(r.skinToneEmoji,_))}),o(()=>{r.skinToneButtonText=r.skinTones[r.currentSkinTone]}),o(()=>{r.skinToneButtonLabel=r.i18n.skinToneLabel.replace("{skinTone}",r.i18n.skinTones[r.currentSkinTone])}),o(()=>{async function A(){const{database:_}=r,N=(await Promise.all(Fm.map(D=>_.getEmojiByUnicodeOrName(D)))).filter(Boolean);r.defaultFavoriteEmojis=N}r.databaseLoaded&&A()});function B(){const{customEmoji:A,database:_}=r,N=A||ms;_.customEmoji!==N&&(_.customEmoji=N)}o(()=>{async function A(){B();const{database:_,defaultFavoriteEmojis:N,numColumns:D}=r,q=await _.getTopFavoriteEmoji(D),z=await Qe(Xc([...q,...N],ae=>ae.unicode||ae.name).slice(0,D));r.currentFavorites=z}r.databaseLoaded&&r.defaultFavoriteEmojis&&A()});function ee(A){Zm(A,s,()=>{{const _=getComputedStyle(n.rootElement),N=parseInt(_.getPropertyValue("--num-columns"),10),D=_.getPropertyValue("direction")==="rtl";r.numColumns=N,r.isRtl=D}})}function me(A){yy(A,s,_=>{for(const{target:N,isIntersecting:D}of _)N.classList.toggle("onscreen",D)})}o(()=>{async function A(){const{searchText:_,currentGroup:N,databaseLoaded:D,customEmoji:q}=r;if(!D)r.currentEmojis=[],r.searchMode=!1;else if(_.length>=Rm){const z=await Pi(_);r.searchText===_&&(v(z),f(!0))}else{const{id:z}=N;if(z!==-1||q&&q.length){const ae=await Mi(z);r.currentGroup.id===z&&(v(ae),f(!1))}}}A()});const Be=()=>{Yn(()=>ty(n.tabpanelElement))};o(()=>{const{currentEmojis:A,emojiVersion:_}=r,N=A.filter(D=>D.unicode).filter(D=>Aa(D)&&!Hs.has(D.unicode));if(!_&&N.length)v(A),Yn(()=>Z(N));else{const D=_?A:A.filter(Dt);v(D),Be()}});function Z(A){Jm(A,n.baselineEmoji,u)?Be():r.currentEmojis=[...r.currentEmojis]}function Dt(A){return!A.unicode||!Aa(A)||Hs.get(A.unicode)}async function mt(A){const _=r.emojiVersion||await ps();return A.filter(({version:N})=>!N||N<=_)}async function Qe(A){return Ym(A,r.emojiVersion||await ps())}async function Mi(A){const _=A===-1?r.customEmoji:await r.database.getEmojiByGroup(A);return Qe(await mt(_))}async function Pi(A){return Qe(await mt(await r.database.getEmojiBySearchQuery(A)))}o(()=>{}),o(()=>{function A(){const{searchMode:N,currentEmojis:D}=r;if(N)return[{category:"",emojis:D}];const q=new Map;for(const z of D){const ae=z.category||"";let Ue=q.get(ae);Ue||(Ue=[],q.set(ae,Ue)),Ue.push(z)}return[...q.entries()].map(([z,ae])=>({category:z,emojis:ae})).sort((z,ae)=>r.customCategorySorting(z.category,ae.category))}const _=A();b(_)}),o(()=>{r.activeSearchItemId=r.activeSearchItem!==-1&&r.currentEmojis[r.activeSearchItem].id}),o(()=>{const{rawSearchText:A}=r;Qc(()=>{r.searchText=(A||"").trim(),r.activeSearchItem=-1})});function Li(A){if(!r.searchMode||!r.currentEmojis.length)return;const _=N=>{$e(A),r.activeSearchItem=hs(N,r.activeSearchItem,r.currentEmojis)};switch(A.key){case"ArrowDown":return _(!1);case"ArrowUp":return _(!0);case"Enter":if(r.activeSearchItem===-1)r.activeSearchItem=0;else return $e(A),G(r.currentEmojis[r.activeSearchItem].id)}}function wn(A){const{target:_}=A,N=_.closest(".nav-button");if(!N)return;const D=parseInt(N.dataset.groupId,10);n.searchElement.value="",r.rawSearchText="",r.searchText="",r.activeSearchItem=-1,r.currentGroupIndex=r.groups.findIndex(q=>q.id===D)}function Ii(A){const{target:_,key:N}=A,D=q=>{q&&($e(A),q.focus())};switch(N){case"ArrowLeft":return D(_.previousElementSibling);case"ArrowRight":return D(_.nextElementSibling);case"Home":return D(_.parentElement.firstElementChild);case"End":return D(_.parentElement.lastElementChild)}}async function kn(A){const _=await r.database.getEmojiByUnicodeOrName(A),N=[...r.currentEmojis,...r.currentFavorites].find(q=>q.id===A),D=N.unicode&&k(N,r.currentSkinTone);return await r.database.incrementFavoriteEmojiCount(A),{emoji:_,skinTone:r.currentSkinTone,...D&&{unicode:D},...N.name&&{name:N.name}}}async function G(A){const _=kn(A);l("emoji-click-sync",_),l("emoji-click",await _)}function Sn(A){const{target:_}=A;if(!_.classList.contains("emoji"))return;$e(A);const N=_.id.substring(4);G(N)}function Q(A){r.currentSkinTone=A,r.skinTonePickerExpanded=!1,c("skintone-button"),l("skin-tone-change",{skinTone:A}),r.database.setPreferredSkinTone(A)}function An(A){const{target:{id:_}}=A,N=_&&_.match(/^skintone-(\d)/);if(!N)return;$e(A);const D=parseInt(N[1],10);Q(D)}function H(A){r.skinTonePickerExpanded=!r.skinTonePickerExpanded,r.activeSkinTone=r.currentSkinTone,r.skinTonePickerExpanded&&($e(A),Yn(()=>c("skintone-list")))}o(()=>{r.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{r.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):r.skinTonePickerExpandedAfterAnimation=!1});function Ye(A){if(!r.skinTonePickerExpanded)return;const _=async N=>{$e(A),r.activeSkinTone=N};switch(A.key){case"ArrowUp":return _(hs(!0,r.activeSkinTone,r.skinTones));case"ArrowDown":return _(hs(!1,r.activeSkinTone,r.skinTones));case"Home":return _(0);case"End":return _(r.skinTones.length-1);case"Enter":return $e(A),Q(r.activeSkinTone);case"Escape":return $e(A),r.skinTonePickerExpanded=!1,c("skintone-button")}}function Ot(A){if(r.skinTonePickerExpanded&&A.key===" ")return $e(A),Q(r.activeSkinTone)}async function Fe(A){const{relatedTarget:_}=A;(!_||_.id!=="skintone-list")&&(r.skinTonePickerExpanded=!1)}function xn(A){r.rawSearchText=A.target.value}return{$set(A){zn(r,A)},$destroy(){i.abort()}}}const by="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",wy="en";var ky={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"}},Sy=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const Zc=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],Ay=`:host{--emoji-font-family:${Yc}}`;class Ur extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=Sy+Ay,this.shadowRoot.appendChild(n),this._ctx={locale:wy,dataSource:by,skinToneEmoji:Om,customCategorySorting:Um,customEmoji:null,i18n:ky,emojiVersion:null,...t};for(const i of Zc)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){_a(this),this._cmp||(this._cmp=vy(this.shadowRoot,this._ctx))}disconnectedCallback(){_a(this),fi(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,i){this._set(t.replace(/-([a-z])/g,(s,r)=>r.toUpperCase()),t==="emoji-version"?parseFloat(i):i)}_set(t,n){this._ctx[t]=n,this._cmp&&this._cmp.$set({[t]:n}),["locale","dataSource"].includes(t)&&this._dbFlush()}_dbCreate(){const{locale:t,dataSource:n,database:i}=this._ctx;(!i||i.locale!==t||i.dataSource!==n)&&this._set("database",new Im({locale:t,dataSource:n}))}_dbFlush(){fi(()=>this._dbCreate())}}const Jc={};for(const e of Zc)Jc[e]={get(){return e==="database"&&this._dbCreate(),this._ctx[e]},set(t){if(e==="database")throw new Error("database is read-only");this._set(e,t)}};Object.defineProperties(Ur.prototype,Jc);function _a(e){e instanceof Ur||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Ur);function xy(e){e.style.height="0";const t=Math.max(e.scrollHeight,44);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>e.offsetHeight?"auto":"hidden"}function Ma(e){e.style.height="44px",e.style.overflowY="hidden"}const $y=5e3;function Ey(e){return e?e.active?p`
|
|
2104
|
+
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function ey(e){return Xc(e,t=>t)}function ty(e){e&&(e.scrollTop=0)}function an(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function Ea(e){return""+e}function ny(e){const t=document.createElement("template");return t.innerHTML=e,t}const iy=new WeakMap,sy=new WeakMap,oy=Symbol("un-keyed"),ry="replaceChildren"in Element.prototype;function ay(e,t){ry?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function ly(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 cy(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=ly(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&ay(i,e)}function uy(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:o,attributeName:r,attributeValuePre:a,attributeValuePost:c}}=n,u=e[o];if(s!==u)if(n.currentExpression=u,r)if(u===null)i.removeAttribute(r);else{const l=a+Ea(u)+c;i.setAttribute(r,l)}else{let l;Array.isArray(u)?cy(u,n):u instanceof Element?(l=u,i.replaceWith(l)):i.nodeValue=Ea(u),l&&(n.targetNode=l)}}}function dy(e){let t="",n=!1,i=!1,s=-1;const o=new Map,r=[];let a=0;for(let u=0,l=e.length;u<l;u++){const d=e[u];if(t+=d.slice(a),u===l-1)break;for(let $=0;$<d.length;$++)switch(d.charAt($)){case"<":{d.charAt($+1)==="/"?r.pop():(n=!0,r.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const h=r[r.length-1],v=an(o,h,()=>[]);let f,b,k;if(i){const $=/(\S+)="?([^"=]*)$/.exec(d);f=$[1],b=$[2];const T=/^([^">]*)("?)/.exec(e[u+1]);k=T[1],t=t.slice(0,-1*$[0].length),a=T[0].length}else a=0;const x={attributeName:f,attributeValuePre:b,attributeValuePost:k,expressionIndex:u};v.push(x),!n&&!i&&(t+=" ")}return{template:ny(t),elementsToBindings:o}}function Ta(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],o=s.attributeName?t:t.firstChild,r={binding:s,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(r)}}function py(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))Ta(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,r=-1;do{const a=t.get(++r);a&&Ta(a,o,n)}while(o=s.nextNode())}return n}function hy(e){const{template:t,elementsToBindings:n}=an(iy,e,()=>dy(e)),i=t.cloneNode(!0).content.firstElementChild,s=py(i,n);return function(r){return uy(r,s),i}}function fy(e){const t=an(sy,e,()=>new Map);let n=oy;function i(o,...r){const a=an(t,o,()=>new Map);return an(a,n,()=>hy(o))(r)}function s(o,r,a){return o.map((c,u)=>{const l=n;n=a(c);try{return r(c,u)}finally{n=l}})}return{map:s,html:i}}function gy(e,t,n,i,s,o,r,a,c){const{labelWithSkin:u,titleForEmoji:l,unicodeWithSkin:d}=n,{html:h,map:v}=fy(t);function f($,T,C){return v($,(M,R)=>h`<button role="${T?"option":"menuitem"}" aria-selected="${T?R===t.activeSearchItem:null}" aria-label="${u(M,t.currentSkinTone)}" title="${l(M)}" class="${"emoji"+(T&&R===t.activeSearchItem?" active":"")+(M.unicode?"":" custom-emoji")}" id="${`${C}-${M.id}`}" style="${M.unicode?null:`--custom-emoji-background: url(${JSON.stringify(M.url)})`}">${M.unicode?d(M,t.currentSkinTone):""}</button>`,M=>`${C}-${M.id}`)}const k=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,($,T)=>h`<div id="skintone-${T}" class="emoji ${T===t.activeSkinTone?"active":""}" aria-selected="${T===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[T]}" aria-label="${t.i18n.skinTones[T]}">${$}</div>`,$=>$)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${v(t.groups,$=>h`<button role="tab" class="nav-button" aria-controls="tab-${$.id}" aria-label="${t.i18n.categories[$.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===$.id}" title="${t.i18n.categories[$.name]}" data-group-id="${$.id}"><div class="nav-emoji emoji">${$.emoji}</div></button>`,$=>$.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${v(t.currentEmojisWithCategories,($,T)=>h`<div><div id="menu-label-${T}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:$.category?$.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${T!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil($.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${T}" id="${t.searchMode?"search-results":null}">${f($.emojis,t.searchMode,"emo")}</div></div>`,$=>$.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${f(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,x=($,T)=>{for(const C of e.querySelectorAll(`[${$}]`))T(C,C.getAttribute($))};if(c){e.appendChild(k);for(const $ of["click","focusout","input","keydown","keyup"])x(`data-on-${$}`,(T,C)=>{T.addEventListener($,i[C])});x("data-ref",($,T)=>{o[T]=$}),r.addEventListener("abort",()=>{e.removeChild(k)})}x("data-action",($,T)=>{let C=a.get(T);C||a.set(T,C=new WeakSet),C.has($)||(C.add($),s[T]($))})}const fi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function my(e){let t=!1,n;const i=new Map,s=new Set;let o;const r=()=>{if(t)return;const u=[...s];s.clear();try{for(const l of u)l()}finally{o=!1,s.size&&(o=!0,fi(r))}},a=new Proxy({},{get(u,l){if(n){let d=i.get(l);d||(d=new Set,i.set(l,d)),d.add(n)}return u[l]},set(u,l,d){if(u[l]!==d){u[l]=d;const h=i.get(l);if(h){for(const v of h)s.add(v);o||(o=!0,fi(r))}}return!0}}),c=u=>{const l=()=>{const d=n;n=l;try{return u()}finally{n=d}};return l()};return e.addEventListener("abort",()=>{t=!0}),{state:a,createEffect:c}}function gs(e,t,n){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}const Ca=new WeakMap;function yy(e,t,n){{const i=e.closest(".tabpanel");let s=Ca.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),Ca.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const ms=[],{assign:zn}=Object;function vy(e,t){const n={},i=new AbortController,s=i.signal,{state:o,createEffect:r}=my(s),a=new Map;zn(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),zn(o,t),zn(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:Bm,isRtl:!1,currentGroupIndex:0,groups:us,databaseLoaded:!1,activeSearchItemId:void 0}),r(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const c=A=>{e.getElementById(A).focus()},u=A=>e.getElementById(`emo-${A.id}`),l=(A,_)=>{n.rootElement.dispatchEvent(new CustomEvent(A,{detail:_,bubbles:!0,composed:!0}))},d=(A,_)=>A.id===_.id,h=(A,_)=>{const{category:N,emojis:D}=A,{category:q,emojis:z}=_;return N!==q?!1:gs(D,z,d)},v=A=>{gs(o.currentEmojis,A,d)||(o.currentEmojis=A)},f=A=>{o.searchMode!==A&&(o.searchMode=A)},b=A=>{gs(o.currentEmojisWithCategories,A,h)||(o.currentEmojisWithCategories=A)},k=(A,_)=>_&&A.skins&&A.skins[_]||A.unicode,T={labelWithSkin:(A,_)=>ey([A.name||k(A,_),A.annotation,...A.shortcodes||ms].filter(Boolean)).join(", "),titleForEmoji:A=>A.annotation||(A.shortcodes||ms).join(", "),unicodeWithSkin:k},C={onClickSkinToneButton:H,onEmojiClick:Sn,onNavClick:wn,onNavKeydown:Ii,onSearchKeydown:Li,onSkinToneOptionsClick:An,onSkinToneOptionsFocusOut:Fe,onSkinToneOptionsKeydown:Ye,onSkinToneOptionsKeyup:Ot,onSearchInput:xn},M={calculateEmojiGridStyle:ee,updateOnIntersection:me};let R=!0;r(()=>{gy(e,o,T,C,M,n,s,a,R),R=!1}),o.emojiVersion||ps().then(A=>{A||(o.message=o.i18n.emojiUnsupportedMessage)}),r(()=>{async function A(){let _=!1;const N=setTimeout(()=>{_=!0,o.message=o.i18n.loadingMessage},Dm);try{await o.database.ready(),o.databaseLoaded=!0}catch(D){console.error(D),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(N),_&&(_=!1,o.message="")}}o.database&&A()}),r(()=>{o.pickerStyle=`
|
|
2105
|
+
--num-groups: ${o.groups.length};
|
|
2106
|
+
--indicator-opacity: ${o.searchMode?0:1};
|
|
2107
|
+
--num-skintones: ${Sa};`}),r(()=>{o.customEmoji&&o.database&&B()}),r(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==js&&(o.groups=js):o.groups!==us&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=us)}),r(()=>{async function A(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}A()}),r(()=>{o.skinTones=Array(Sa).fill().map((A,_)=>Qm(o.skinToneEmoji,_))}),r(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),r(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),r(()=>{async function A(){const{database:_}=o,N=(await Promise.all(Fm.map(D=>_.getEmojiByUnicodeOrName(D)))).filter(Boolean);o.defaultFavoriteEmojis=N}o.databaseLoaded&&A()});function B(){const{customEmoji:A,database:_}=o,N=A||ms;_.customEmoji!==N&&(_.customEmoji=N)}r(()=>{async function A(){B();const{database:_,defaultFavoriteEmojis:N,numColumns:D}=o,q=await _.getTopFavoriteEmoji(D),z=await Qe(Xc([...q,...N],ae=>ae.unicode||ae.name).slice(0,D));o.currentFavorites=z}o.databaseLoaded&&o.defaultFavoriteEmojis&&A()});function ee(A){Zm(A,s,()=>{{const _=getComputedStyle(n.rootElement),N=parseInt(_.getPropertyValue("--num-columns"),10),D=_.getPropertyValue("direction")==="rtl";o.numColumns=N,o.isRtl=D}})}function me(A){yy(A,s,_=>{for(const{target:N,isIntersecting:D}of _)N.classList.toggle("onscreen",D)})}r(()=>{async function A(){const{searchText:_,currentGroup:N,databaseLoaded:D,customEmoji:q}=o;if(!D)o.currentEmojis=[],o.searchMode=!1;else if(_.length>=Rm){const z=await Pi(_);o.searchText===_&&(v(z),f(!0))}else{const{id:z}=N;if(z!==-1||q&&q.length){const ae=await Mi(z);o.currentGroup.id===z&&(v(ae),f(!1))}}}A()});const Be=()=>{Yn(()=>ty(n.tabpanelElement))};r(()=>{const{currentEmojis:A,emojiVersion:_}=o,N=A.filter(D=>D.unicode).filter(D=>Aa(D)&&!Hs.has(D.unicode));if(!_&&N.length)v(A),Yn(()=>Z(N));else{const D=_?A:A.filter(Dt);v(D),Be()}});function Z(A){Jm(A,n.baselineEmoji,u)?Be():o.currentEmojis=[...o.currentEmojis]}function Dt(A){return!A.unicode||!Aa(A)||Hs.get(A.unicode)}async function mt(A){const _=o.emojiVersion||await ps();return A.filter(({version:N})=>!N||N<=_)}async function Qe(A){return Ym(A,o.emojiVersion||await ps())}async function Mi(A){const _=A===-1?o.customEmoji:await o.database.getEmojiByGroup(A);return Qe(await mt(_))}async function Pi(A){return Qe(await mt(await o.database.getEmojiBySearchQuery(A)))}r(()=>{}),r(()=>{function A(){const{searchMode:N,currentEmojis:D}=o;if(N)return[{category:"",emojis:D}];const q=new Map;for(const z of D){const ae=z.category||"";let Ue=q.get(ae);Ue||(Ue=[],q.set(ae,Ue)),Ue.push(z)}return[...q.entries()].map(([z,ae])=>({category:z,emojis:ae})).sort((z,ae)=>o.customCategorySorting(z.category,ae.category))}const _=A();b(_)}),r(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),r(()=>{const{rawSearchText:A}=o;Qc(()=>{o.searchText=(A||"").trim(),o.activeSearchItem=-1})});function Li(A){if(!o.searchMode||!o.currentEmojis.length)return;const _=N=>{$e(A),o.activeSearchItem=hs(N,o.activeSearchItem,o.currentEmojis)};switch(A.key){case"ArrowDown":return _(!1);case"ArrowUp":return _(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return $e(A),G(o.currentEmojis[o.activeSearchItem].id)}}function wn(A){const{target:_}=A,N=_.closest(".nav-button");if(!N)return;const D=parseInt(N.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(q=>q.id===D)}function Ii(A){const{target:_,key:N}=A,D=q=>{q&&($e(A),q.focus())};switch(N){case"ArrowLeft":return D(_.previousElementSibling);case"ArrowRight":return D(_.nextElementSibling);case"Home":return D(_.parentElement.firstElementChild);case"End":return D(_.parentElement.lastElementChild)}}async function kn(A){const _=await o.database.getEmojiByUnicodeOrName(A),N=[...o.currentEmojis,...o.currentFavorites].find(q=>q.id===A),D=N.unicode&&k(N,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(A),{emoji:_,skinTone:o.currentSkinTone,...D&&{unicode:D},...N.name&&{name:N.name}}}async function G(A){const _=kn(A);l("emoji-click-sync",_),l("emoji-click",await _)}function Sn(A){const{target:_}=A;if(!_.classList.contains("emoji"))return;$e(A);const N=_.id.substring(4);G(N)}function Q(A){o.currentSkinTone=A,o.skinTonePickerExpanded=!1,c("skintone-button"),l("skin-tone-change",{skinTone:A}),o.database.setPreferredSkinTone(A)}function An(A){const{target:{id:_}}=A,N=_&&_.match(/^skintone-(\d)/);if(!N)return;$e(A);const D=parseInt(N[1],10);Q(D)}function H(A){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&($e(A),Yn(()=>c("skintone-list")))}r(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function Ye(A){if(!o.skinTonePickerExpanded)return;const _=async N=>{$e(A),o.activeSkinTone=N};switch(A.key){case"ArrowUp":return _(hs(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return _(hs(!1,o.activeSkinTone,o.skinTones));case"Home":return _(0);case"End":return _(o.skinTones.length-1);case"Enter":return $e(A),Q(o.activeSkinTone);case"Escape":return $e(A),o.skinTonePickerExpanded=!1,c("skintone-button")}}function Ot(A){if(o.skinTonePickerExpanded&&A.key===" ")return $e(A),Q(o.activeSkinTone)}async function Fe(A){const{relatedTarget:_}=A;(!_||_.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function xn(A){o.rawSearchText=A.target.value}return{$set(A){zn(o,A)},$destroy(){i.abort()}}}const by="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",wy="en";var ky={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"}},Sy=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const Zc=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],Ay=`:host{--emoji-font-family:${Yc}}`;class Wo extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=Sy+Ay,this.shadowRoot.appendChild(n),this._ctx={locale:wy,dataSource:by,skinToneEmoji:Om,customCategorySorting:Um,customEmoji:null,i18n:ky,emojiVersion:null,...t};for(const i of Zc)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){_a(this),this._cmp||(this._cmp=vy(this.shadowRoot,this._ctx))}disconnectedCallback(){_a(this),fi(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,i){this._set(t.replace(/-([a-z])/g,(s,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 Im({locale:t,dataSource:n}))}_dbFlush(){fi(()=>this._dbCreate())}}const Jc={};for(const e of Zc)Jc[e]={get(){return e==="database"&&this._dbCreate(),this._ctx[e]},set(t){if(e==="database")throw new Error("database is read-only");this._set(e,t)}};Object.defineProperties(Wo.prototype,Jc);function _a(e){e instanceof Wo||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Wo);function xy(e){e.style.height="0";const t=Math.max(e.scrollHeight,44);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>e.offsetHeight?"auto":"hidden"}function Ma(e){e.style.height="44px",e.style.overflowY="hidden"}const $y=5e3;function Ey(e){return e?e.active?p`
|
|
2108
2108
|
<div class="callout info compaction-indicator compaction-indicator--active">
|
|
2109
2109
|
${O.loader} Compacting context...
|
|
2110
2110
|
</div>
|
|
@@ -2112,7 +2112,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2112
2112
|
<div class="callout success compaction-indicator compaction-indicator--complete">
|
|
2113
2113
|
${O.check} Context compacted
|
|
2114
2114
|
</div>
|
|
2115
|
-
`:S:S}const Zt=5*1024*1024;function Jt(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function xt(e,t){var i,s,
|
|
2115
|
+
`:S:S}const Zt=5*1024*1024;function Jt(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function xt(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 r=(s=e.closest(".chat"))==null?void 0:s.querySelector(".chat-compose");(o=r==null?void 0:r.parentElement)==null||o.insertBefore(n,r)}n.textContent=t,setTimeout(()=>n==null?void 0:n.remove(),4e3)}const Ty=/\.(md|txt|csv|json|xml|html|css|js|ts|py|sh|yaml|yml|toml|ini|cfg|log|sql)$/i;function Cy(e){return e.type.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name)}function _y(e){return e.type.startsWith("text/")||e.type==="application/json"||e.type==="application/xml"||Ty.test(e.name)}function My(e){return e.type==="application/pdf"||/\.pdf$/i.test(e.name)}function Py(e){return e.type.startsWith("video/")||/\.(mp4|webm|mov|avi|mkv|m4v)$/i.test(e.name)}function Ly(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 r=i[o];if(Cy(r)){if(!t.onAttachmentsChange)continue;if(r.size>Zt){xt(n,`Image too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var d;const c=a.result,u={id:Jt(),dataUrl:c,mimeType:r.type},l=t.attachments??[];(d=t.onAttachmentsChange)==null||d.call(t,[...l,u])},a.readAsDataURL(r)}else if(_y(r)){if(!t.onAttachmentsChange)continue;if(r.size>Zt){xt(n,`File too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var d;const c=a.result,u={id:Jt(),dataUrl:"",mimeType:r.type||"text/plain",fileName:r.name,textContent:c},l=t.attachments??[];(d=t.onAttachmentsChange)==null||d.call(t,[...l,u])},a.readAsText(r)}else if(My(r)){if(!t.onAttachmentsChange)continue;if(r.size>Zt){xt(n,`PDF too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var d;const c=a.result,u={id:Jt(),dataUrl:c,mimeType:"application/pdf",fileName:r.name},l=t.attachments??[];(d=t.onAttachmentsChange)==null||d.call(t,[...l,u])},a.readAsDataURL(r)}else if(Py(r)){if(!t.onAttachmentsChange)continue;if(r.size>Zt){xt(n,`Video too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var d;const c=a.result,u={id:Jt(),dataUrl:c,mimeType:r.type||"video/mp4",fileName:r.name},l=t.attachments??[];(d=t.onAttachmentsChange)==null||d.call(t,[...l,u])},a.readAsDataURL(r)}else xt(n,`Unsupported file type: ${r.name}. Use the Files page to upload to workspace.`)}}function Iy(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),e.currentTarget.classList.add("chat--dragover")}function Ry(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&t.classList.remove("chat--dragover")}function Ny(e,t){var s,o,r;const n=(s=e.clipboardData)==null?void 0:s.items;if(!n||!t.onAttachmentsChange)return;const i=[];for(let a=0;a<n.length;a++){const c=n[a];(c.type.startsWith("image/")||c.type.startsWith("video/"))&&i.push(c)}if(i.length!==0){e.preventDefault();for(const a of i){const c=a.getAsFile();if(!c)continue;const u=c.type.startsWith("video/")?"Video":"Image";if(c.size>Zt){const d=((r=(o=e.target)==null?void 0:o.closest)==null?void 0:r.call(o,".chat"))??document.querySelector(".chat");d&&xt(d,`${u} too large (${(c.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const l=new FileReader;l.onload=()=>{var b;const d=l.result,h=c.type.startsWith("video/"),v={id:Jt(),dataUrl:d,mimeType:c.type,fileName:h?c.name||"video.mp4":void 0},f=t.attachments??[];(b=t.onAttachmentsChange)==null||b.call(t,[...f,v])},l.readAsDataURL(c)}}}function Dy(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=r=>{i.contains(r.target)||t.contains(r.target)||(i.classList.remove("active"),t.classList.remove("active"),document.removeEventListener("click",o,!0))};requestAnimationFrame(()=>document.addEventListener("click",o,!0))}}function Oy(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 r=o.selectionStart??t.draft.length,a=o.selectionEnd??r,c=t.draft.slice(0,r),u=t.draft.slice(a);t.onDraftChange(c+i+u);const l=s==null?void 0:s.querySelector(".emoji-picker-popup"),d=s==null?void 0:s.querySelector(".chat-compose__emoji");l==null||l.classList.remove("active"),d==null||d.classList.remove("active"),requestAnimationFrame(()=>{o.focus();const h=r+i.length;o.setSelectionRange(h,h)})}function By(e){const t=e.attachments??[];return t.length===0?S:p`
|
|
2116
2116
|
<div class="chat-attachments">
|
|
2117
2117
|
${t.map(n=>{var i;return n.fileName?p`
|
|
2118
2118
|
<div class="chat-attachment chat-attachment--file">
|
|
@@ -2122,7 +2122,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2122
2122
|
class="chat-attachment__remove chat-attachment__remove--file"
|
|
2123
2123
|
type="button"
|
|
2124
2124
|
aria-label="Remove attachment"
|
|
2125
|
-
@click=${()=>{var
|
|
2125
|
+
@click=${()=>{var o;const s=(e.attachments??[]).filter(r=>r.id!==n.id);(o=e.onAttachmentsChange)==null||o.call(e,s)}}
|
|
2126
2126
|
>
|
|
2127
2127
|
${O.x}
|
|
2128
2128
|
</button>
|
|
@@ -2138,14 +2138,14 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2138
2138
|
class="chat-attachment__remove"
|
|
2139
2139
|
type="button"
|
|
2140
2140
|
aria-label="Remove attachment"
|
|
2141
|
-
@click=${()=>{var
|
|
2141
|
+
@click=${()=>{var o;const s=(e.attachments??[]).filter(r=>r.id!==n.id);(o=e.onAttachmentsChange)==null||o.call(e,s)}}
|
|
2142
2142
|
>
|
|
2143
2143
|
${O.x}
|
|
2144
2144
|
</button>
|
|
2145
2145
|
</div>
|
|
2146
2146
|
`})}
|
|
2147
2147
|
</div>
|
|
2148
|
-
`}function eu(e){var h,v,f;const t=e.connected,n=e.sending||e.stream!==null,i=!!(e.canAbort&&e.onAbort),s=(v=(h=e.sessions)==null?void 0:h.sessions)==null?void 0:v.find(b=>b.key===e.sessionKey),
|
|
2148
|
+
`}function eu(e){var h,v,f;const t=e.connected,n=e.sending||e.stream!==null,i=!!(e.canAbort&&e.onAbort),s=(v=(h=e.sessions)==null?void 0:h.sessions)==null?void 0:v.find(b=>b.key===e.sessionKey),o=(s==null?void 0:s.reasoningLevel)??"off",r=e.showThinking&&o!=="off";e.assistantName,e.assistantAvatar??e.assistantAvatarUrl;const a=(((f=e.attachments)==null?void 0:f.length)??0)>0,c=e.connected?a?"Add a message...":"Message...":"Connecting…",u=e.splitRatio??.6,l=!!(e.sidebarOpen&&e.onCloseSidebar),d=p`
|
|
2149
2149
|
<div
|
|
2150
2150
|
class="chat-thread"
|
|
2151
2151
|
role="log"
|
|
@@ -2153,7 +2153,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2153
2153
|
@scroll=${e.onChatScroll}
|
|
2154
2154
|
>
|
|
2155
2155
|
${e.loading?p`<div class="muted">Loading chat…</div>`:S}
|
|
2156
|
-
${mf(Hy(e),b=>b.key,b=>b.kind==="interim"?Ug(b.text):b.kind==="reading-indicator"?Fg():b.kind==="stream"?Wg(b.text,b.startedAt,e.onOpenSidebar):b.kind==="group"?Kg(b,{onOpenSidebar:e.onOpenSidebar,showReasoning:
|
|
2156
|
+
${mf(Hy(e),b=>b.key,b=>b.kind==="interim"?Ug(b.text):b.kind==="reading-indicator"?Fg():b.kind==="stream"?Wg(b.text,b.startedAt,e.onOpenSidebar):b.kind==="group"?Kg(b,{onOpenSidebar:e.onOpenSidebar,showReasoning:r,assistantName:e.assistantName}):S)}
|
|
2157
2157
|
</div>
|
|
2158
2158
|
`;return p`
|
|
2159
2159
|
<section
|
|
@@ -2277,7 +2277,7 @@ ${e.sidebarContent}
|
|
|
2277
2277
|
${e.publicMode?S:zy(e)}
|
|
2278
2278
|
</div>
|
|
2279
2279
|
</section>
|
|
2280
|
-
`}const Fy=[{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 Uy(e){const t=new Set(e.filter(n=>n.provider==="anthropic").map(n=>n.id));return Fy.filter(n=>t.has(n.id)).map(n=>({key:`anthropic/${n.id}`,...n}))}const Wy=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Ky(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(
|
|
2280
|
+
`}const Fy=[{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 Uy(e){const t=new Set(e.filter(n=>n.provider==="anthropic").map(n=>n.id));return Fy.filter(n=>t.has(n.id)).map(n=>({key:`anthropic/${n.id}`,...n}))}const Wy=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Ky(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=r=>{!n.contains(r.target)&&r.target!==t&&!t.contains(r.target)&&(n.classList.remove("active"),document.removeEventListener("click",o))};requestAnimationFrame(()=>document.addEventListener("click",o))}}function zy(e){if(!e.connected)return S;const t=e.modelCatalog??[],n=Uy(t);if(n.length===0)return S;const i=e.modelProvider&&e.model?`${e.modelProvider}/${e.model}`:null,s=e.thinkingLevel??"off",o=e.verboseLevel==="on"||e.verboseLevel==="full",r=e.fillerEnabled===!0;return p`
|
|
2281
2281
|
<div class="chat-model-bar">
|
|
2282
2282
|
<div class="chat-model-bar__select">
|
|
2283
2283
|
<select
|
|
@@ -2318,7 +2318,7 @@ ${e.sidebarContent}
|
|
|
2318
2318
|
<label class="chat-settings-menu__item">
|
|
2319
2319
|
<input
|
|
2320
2320
|
type="checkbox"
|
|
2321
|
-
.checked=${
|
|
2321
|
+
.checked=${o}
|
|
2322
2322
|
@change=${a=>{const c=a.target.checked;e.onVerboseChange&&e.onVerboseChange(c?"on":"off")}}
|
|
2323
2323
|
/>
|
|
2324
2324
|
<span>Verbose</span>
|
|
@@ -2327,7 +2327,7 @@ ${e.sidebarContent}
|
|
|
2327
2327
|
<label class="chat-settings-menu__item">
|
|
2328
2328
|
<input
|
|
2329
2329
|
type="checkbox"
|
|
2330
|
-
.checked=${
|
|
2330
|
+
.checked=${r}
|
|
2331
2331
|
@change=${a=>{const c=a.target.checked;e.onFillerChange&&e.onFillerChange(c)}}
|
|
2332
2332
|
/>
|
|
2333
2333
|
<span>Filler</span>
|
|
@@ -2335,9 +2335,9 @@ ${e.sidebarContent}
|
|
|
2335
2335
|
</label>
|
|
2336
2336
|
</div>
|
|
2337
2337
|
</div>
|
|
2338
|
-
`}const Pa=200;function jy(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=hl(i.message),
|
|
2338
|
+
`}const Pa=200;function jy(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=hl(i.message),o=fl(s.role),r=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:r,isStreaming:!1}):n.messages.push({message:i.message,key:i.key})}return n&&t.push(n),t}function Hy(e){var r;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",o=Math.max(0,n.length-Pa);o>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Pa} messages (${o} hidden).`,timestamp:Date.now()}});for(let a=o;a<n.length;a++){const c=n[a],u=hl(c);!s&&u.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:La(c,a),message:c})}if(s)for(let a=0;a<i.length;a++)t.push({kind:"message",key:La(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 c=((r=a.attachments)==null?void 0:r.filter(l=>l.fileName).map(l=>l.fileName))??[],u=c.length>0?a.text?`${c.join(", ")}
|
|
2339
2339
|
|
|
2340
|
-
${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,message:{role:"user",content:[{type:"text",text:u}],timestamp:a.createdAt}})}return jy(t)}function La(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
|
|
2340
|
+
${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,message:{role:"user",content:[{type:"text",text:u}],timestamp:a.createdAt}})}return jy(t)}function La(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 r=typeof n.timestamp=="number"?n.timestamp:null,a=typeof n.role=="string"?n.role:"unknown";return r!=null?`msg:${a}:${r}:${t}`:`msg:${a}:${t}`}const qy=p`<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 Vy(e){if(!e.connected)return p`
|
|
2341
2341
|
<div class="setup-container">
|
|
2342
2342
|
<div class="setup-card">
|
|
2343
2343
|
<div class="setup-spinner"></div>
|
|
@@ -2358,10 +2358,10 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2358
2358
|
${eu(e)}
|
|
2359
2359
|
</div>
|
|
2360
2360
|
</div>
|
|
2361
|
-
`}function Gy(e){return e?`${cl(e)} (${wi(e)})`:"n/a"}function tu(e){const t=e.state??{},n=t.lastStatus??"n/a",i=t.lastRunAtMs?wi(t.lastRunAtMs):"never";return`${n} · last ${i}`}function nu(e){const t=e.schedule;return t.kind==="at"?`One-time: ${cl(t.atMs)}`:t.kind==="every"?`Every ${ul(t.everyMs)}`:Qy(t.expr,t.tz)}function Qy(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[i,s,r,
|
|
2361
|
+
`}function Gy(e){return e?`${cl(e)} (${wi(e)})`:"n/a"}function tu(e){const t=e.state??{},n=t.lastStatus??"n/a",i=t.lastRunAtMs?wi(t.lastRunAtMs):"never";return`${n} · last ${i}`}function nu(e){const t=e.schedule;return t.kind==="at"?`One-time: ${cl(t.atMs)}`:t.kind==="every"?`Every ${ul(t.everyMs)}`:Qy(t.expr,t.tz)}function Qy(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[i,s,o,r,a]=n,c=t?` (${t.replace(/^.*\//,"").replace(/_/g," ")})`:"",u=(b,k)=>new Date(2e3,0,1,b,k).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),l=/^\d{1,2}$/.test(i)?parseInt(i,10):null,d=Ia(s);if(l===null||!d)return`${e}${t?` (${t})`:""}`;const h=d.map(b=>u(b,l)),v=h.length<=3?h.join(" & "):`${h.slice(0,-1).join(", ")} & ${h[h.length-1]}`,f=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(o==="*"&&r==="*"){if(a==="*")return`Daily at ${v}${c}`;if(a==="1-5")return`Weekdays at ${v}${c}`;if(a==="0,6"||a==="6,0")return`Weekends at ${v}${c}`;const b=Ia(a);if(b)return`${b.map(x=>f[x%7]??String(x)).join(", ")} at ${v}${c}`}return`${e}${t?` (${t})`:""}`}function Ia(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 Yy(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 Ra(e){const t=e.payload;if(t.kind!=="agentTurn")return null;const n=t.channel??t.provider,i=t.to;if(!i&&!n)return null;const s=[];return i&&s.push(i),n&&n!=="last"&&s.push(`via ${n}`),s.join(" ")||null}function Xy(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 Zy(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 Jy(e){return e||"Default"}const Na=p`<svg viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg>`,ev=p`<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>`,tv=p`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,iu=p`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,nv=p`<svg viewBox="0 0 24 24"><path d="M12 5v14"/><path d="M5 12h14"/></svg>`;function Da(e){const t=e.detailJobId?e.jobs.find(n=>n.id===e.detailJobId)??null:null;return p`
|
|
2362
2362
|
${iv(e)}
|
|
2363
2363
|
${sv(e)}
|
|
2364
|
-
${e.newEventModalOpen?
|
|
2364
|
+
${e.newEventModalOpen?rv(e):S}
|
|
2365
2365
|
${t?lv(t,e):S}
|
|
2366
2366
|
`}function iv(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 p`
|
|
2367
2367
|
<div class="event-status-bar">
|
|
@@ -2390,9 +2390,9 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2390
2390
|
</div>
|
|
2391
2391
|
`}function sv(e){return e.jobs.length===0?p`<div class="muted" style="padding: 20px 0;">No events yet. Create one to get started.</div>`:p`
|
|
2392
2392
|
<div class="event-grid">
|
|
2393
|
-
${e.jobs.map(t=>
|
|
2393
|
+
${e.jobs.map(t=>ov(t,e))}
|
|
2394
2394
|
</div>
|
|
2395
|
-
`}function
|
|
2395
|
+
`}function ov(e,t){return p`
|
|
2396
2396
|
<div
|
|
2397
2397
|
class="event-card ${e.enabled?"":"disabled"}"
|
|
2398
2398
|
@click=${()=>t.onDetailOpen(e)}
|
|
@@ -2438,7 +2438,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2438
2438
|
</div>
|
|
2439
2439
|
</div>
|
|
2440
2440
|
</div>
|
|
2441
|
-
`}function
|
|
2441
|
+
`}function rv(e){const t=Xy(e);return p`
|
|
2442
2442
|
<div class="event-modal-overlay" @click=${e.onNewEventModalClose}>
|
|
2443
2443
|
<div class="event-modal" @click=${n=>n.stopPropagation()}>
|
|
2444
2444
|
<div class="event-modal__header">
|
|
@@ -2779,7 +2779,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2779
2779
|
</details>
|
|
2780
2780
|
`:S}
|
|
2781
2781
|
</div>
|
|
2782
|
-
`}function dv(e){var s;const t=((s=e.report)==null?void 0:s.skills)??[],n=e.filter.trim().toLowerCase(),i=n?t.filter(
|
|
2782
|
+
`}function dv(e){var s;const t=((s=e.report)==null?void 0:s.skills)??[],n=e.filter.trim().toLowerCase(),i=n?t.filter(o=>[o.name,o.description,o.source].join(" ").toLowerCase().includes(n)):t;return p`
|
|
2783
2783
|
<section class="card">
|
|
2784
2784
|
<div class="row" style="justify-content: space-between;">
|
|
2785
2785
|
<div>
|
|
@@ -2796,7 +2796,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2796
2796
|
<span>Filter</span>
|
|
2797
2797
|
<input
|
|
2798
2798
|
.value=${e.filter}
|
|
2799
|
-
@input=${
|
|
2799
|
+
@input=${o=>e.onFilterChange(o.target.value)}
|
|
2800
2800
|
placeholder="Search skills"
|
|
2801
2801
|
/>
|
|
2802
2802
|
</label>
|
|
@@ -2807,11 +2807,11 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2807
2807
|
|
|
2808
2808
|
${i.length===0?p`<div class="muted" style="margin-top: 16px;">No skills found.</div>`:p`
|
|
2809
2809
|
<div class="list" style="margin-top: 16px;">
|
|
2810
|
-
${i.map(
|
|
2810
|
+
${i.map(o=>pv(o,e))}
|
|
2811
2811
|
</div>
|
|
2812
2812
|
`}
|
|
2813
2813
|
</section>
|
|
2814
|
-
`}function pv(e,t){const n=t.busyKey===e.skillKey,i=t.edits[e.skillKey]??"",s=t.messages[e.skillKey]??null,
|
|
2814
|
+
`}function pv(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,r=[...e.missing.bins.map(c=>`bin:${c}`),...e.missing.env.map(c=>`env:${c}`),...e.missing.config.map(c=>`config:${c}`),...e.missing.os.map(c=>`os:${c}`)],a=[];return e.disabled&&a.push("disabled"),e.blockedByAllowlist&&a.push("blocked by allowlist"),p`
|
|
2815
2815
|
<div class="list-item">
|
|
2816
2816
|
<div class="list-main">
|
|
2817
2817
|
<div class="list-title">
|
|
@@ -2825,9 +2825,9 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2825
2825
|
</span>
|
|
2826
2826
|
${e.disabled?p`<span class="chip chip-warn">disabled</span>`:S}
|
|
2827
2827
|
</div>
|
|
2828
|
-
${
|
|
2828
|
+
${r.length>0?p`
|
|
2829
2829
|
<div class="muted" style="margin-top: 6px;">
|
|
2830
|
-
Missing: ${
|
|
2830
|
+
Missing: ${r.join(", ")}
|
|
2831
2831
|
</div>
|
|
2832
2832
|
`:S}
|
|
2833
2833
|
${a.length>0?p`
|
|
@@ -2845,7 +2845,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2845
2845
|
>
|
|
2846
2846
|
${e.disabled?"Enable":"Disable"}
|
|
2847
2847
|
</button>
|
|
2848
|
-
${
|
|
2848
|
+
${o?p`<button
|
|
2849
2849
|
class="btn"
|
|
2850
2850
|
?disabled=${n}
|
|
2851
2851
|
@click=${()=>t.onInstall(e.skillKey,e.name,e.install[0].id)}
|
|
@@ -2959,7 +2959,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2959
2959
|
<button
|
|
2960
2960
|
class="btn"
|
|
2961
2961
|
?disabled=${e.entries.length===0}
|
|
2962
|
-
@click=${()=>{const t=e.filterText.trim().toLowerCase(),n=qs.some(
|
|
2962
|
+
@click=${()=>{const t=e.filterText.trim().toLowerCase(),n=qs.some(o=>!e.levelFilters[o]),i=e.entries.filter(o=>o.level&&!e.levelFilters[o.level]?!1:su(o,t)),s=t||n?"filtered":"visible";e.onExport(i.map(o=>o.raw),s)}}
|
|
2963
2963
|
>
|
|
2964
2964
|
Export
|
|
2965
2965
|
</button>
|
|
@@ -2970,7 +2970,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2970
2970
|
<button
|
|
2971
2971
|
class="btn"
|
|
2972
2972
|
?disabled=${e.sessionLogsProps.entries.length===0}
|
|
2973
|
-
@click=${()=>{const t=e.sessionLogsProps,n=t.filterText.trim().toLowerCase(),s=t.entries.filter(
|
|
2973
|
+
@click=${()=>{const t=e.sessionLogsProps,n=t.filterText.trim().toLowerCase(),s=t.entries.filter(o=>!t.typeFilters[o.type]||t.agents.length>0&&!(t.agentFilters[o.agentId]??!0)?!1:n?[o.content,o.agentId,o.sessionKey,o.sessionId,o.toolName].filter(Boolean).join(" ").toLowerCase().includes(n):!0).map(o=>`${o.timestamp} [${o.type}] ${o.agentId} ${o.sessionKey} ${o.toolName??""} ${o.content}`);t.onExport(s,n?"filtered":"visible")}}
|
|
2974
2974
|
>
|
|
2975
2975
|
Export
|
|
2976
2976
|
</button>
|
|
@@ -3067,10 +3067,10 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3067
3067
|
<p>Connecting to gateway...</p>
|
|
3068
3068
|
</div>
|
|
3069
3069
|
</div>
|
|
3070
|
-
`}function Fa(e){if(!e.show)return S;const t=Ve(),n=e.isFirstTime,i=e.changePinMode===!0&&!n,s=e.changePinBusy===!0;let
|
|
3070
|
+
`}function Fa(e){if(!e.show)return S;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 r=h=>{var f;o=h.target.value;const v=(f=h.target.closest(".login-card"))==null?void 0:f.querySelector(".login-change-pin");v&&(v.style.display=o==="__master__"?"":"none")},a=h=>v=>{const f=v.target;f.value=f.value.replace(/\D/g,"").slice(0,6),h(f.value)},c=!n&&e.accounts.length>1?p`
|
|
3071
3071
|
<select
|
|
3072
3072
|
class="login-account-select"
|
|
3073
|
-
@change=${
|
|
3073
|
+
@change=${r}
|
|
3074
3074
|
?disabled=${e.busy||s}
|
|
3075
3075
|
>
|
|
3076
3076
|
${e.accounts.map((h,v)=>p`
|
|
@@ -3079,7 +3079,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3079
3079
|
</option>
|
|
3080
3080
|
`)}
|
|
3081
3081
|
</select>
|
|
3082
|
-
`:S;if(i){let h="",v="",f="";const b=k=>{var x;k.preventDefault(),!s&&(!h||!v||!f||v===f&&
|
|
3082
|
+
`:S;if(i){let h="",v="",f="";const b=k=>{var x;k.preventDefault(),!s&&(!h||!v||!f||v===f&&o&&((x=e.onChangePin)==null||x.call(e,o,h,v)))};return p`
|
|
3083
3083
|
<div class="login-overlay">
|
|
3084
3084
|
<div class="login-card">
|
|
3085
3085
|
<img class="login-logo" src="${t.iconUrl}" alt="${t.name}" />
|
|
@@ -3138,7 +3138,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3138
3138
|
</p>
|
|
3139
3139
|
</div>
|
|
3140
3140
|
</div>
|
|
3141
|
-
`}let u="",l="";const d=h=>{if(h.preventDefault(),!e.busy)if(n){if(!u||!l||u!==l)return;e.onSubmit(u)}else{if(!u||!
|
|
3141
|
+
`}let u="",l="";const d=h=>{if(h.preventDefault(),!e.busy)if(n){if(!u||!l||u!==l)return;e.onSubmit(u)}else{if(!u||!o)return;e.onSubmit(o,u)}};return p`
|
|
3142
3142
|
<div class="login-overlay">
|
|
3143
3143
|
<div class="login-card">
|
|
3144
3144
|
<img class="login-logo" src="${t.iconUrl}" alt="${t.name}" />
|
|
@@ -3182,7 +3182,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3182
3182
|
${e.busy?p`<span class="login-spinner"></span>`:n?"Set PIN":"Unlock"}
|
|
3183
3183
|
</button>
|
|
3184
3184
|
</form>
|
|
3185
|
-
${n?p`<p class="login-hint">This PIN protects all accounts on this device. You'll need it every time you open the dashboard.</p>`:e.accounts.some(h=>h.id==="__master__")?p`<p class="login-hint login-change-pin" style="margin-top: 16px;${
|
|
3185
|
+
${n?p`<p class="login-hint">This PIN protects all accounts on this device. You'll need it every time you open the dashboard.</p>`:e.accounts.some(h=>h.id==="__master__")?p`<p class="login-hint login-change-pin" style="margin-top: 16px;${o!=="__master__"?" display: none;":""}">
|
|
3186
3186
|
<a
|
|
3187
3187
|
class="login-link"
|
|
3188
3188
|
href="#"
|
|
@@ -3207,7 +3207,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3207
3207
|
${eu(t)}
|
|
3208
3208
|
</div>
|
|
3209
3209
|
</div>
|
|
3210
|
-
`}async function $v(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 bn(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 Ev(e,t){var i,s;if(!e.client||!e.connected||e.workspaceSaving)return;const n=t.name.trim();if(!n){e.workspacesError="Account name is required.";return}e.workspaceSaving=!0,e.workspacesError=null;try{const r=await e.client.request("config.get",{});e.configSnapshot=r;const o=r.hash;if(!o){e.workspacesError="Config hash missing; reload and retry.";return}const a={name:n,baseHash:o,whatsappAccountName:n};(i=t.workspacePath)!=null&&i.trim()&&(a.workspaceDir=t.workspacePath.trim());const c=await e.client.request("workspaces.create",a);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await bn(e),(s=t.onCreated)==null||s.call(t,c)}catch(r){e.workspacesError=String(r)}finally{e.workspaceSaving=!1}}async function Tv(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 bn(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function Cv(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 bn(e)}catch(i){e.workspacesError=String(i)}}}const jn=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:Ev,loadWorkspaces:bn,removeWorkspace:Tv,renameWorkspace:Cv},Symbol.toStringTag,{value:"Module"})),ru={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"taskmaster-control-ui",SETUP_UI:"setup-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"taskmaster-macos",IOS_APP:"taskmaster-ios",ANDROID_APP:"taskmaster-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"taskmaster-probe",PUBLIC_CHAT:"public-chat"},Ua=ru,Vs={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(ru));new Set(Object.values(Vs));function _v(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 Mv=4008;class Pv{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 d;if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=this.opts.role??"operator",n=this.opts.scopes??["operator.admin","operator.approvals","operator.pairing"],s=!(t!=="operator")&&typeof crypto<"u"&&!!crypto.subtle;let r=null,o=!1,a=this.opts.token;if(s){r=await Pp();const h=(d=Rp({deviceId:r.deviceId,role:t}))==null?void 0:d.token;a=h??this.opts.token,o=!!(h&&this.opts.token)}const c=a||this.opts.password?{token:a,password:this.opts.password}:void 0;let u;if(s&&r){const h=Date.now(),v=this.connectNonce??void 0,f=_v({deviceId:r.deviceId,clientId:this.opts.clientName??Ua.CONTROL_UI,clientMode:this.opts.mode??Vs.WEBCHAT,role:t,scopes:n,signedAtMs:h,token:a??null,nonce:v}),b=await Lp(r.privateKey,f);u={id:r.deviceId,publicKey:r.publicKey,signature:b,signedAt:h,nonce:v}}const l={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ua.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Vs.WEBCHAT,instanceId:this.opts.instanceId},role:t,scopes:n,device:u,caps:[],auth:c,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",l).then(h=>{var v,f,b;(v=h==null?void 0:h.auth)!=null&&v.deviceToken&&r&&Np({deviceId:r.deviceId,role:h.auth.role??t,token:h.auth.deviceToken,scopes:h.auth.scopes??[]}),this.backoffMs=800,(b=(f=this.opts).onHello)==null||b.call(f,h)}).catch(()=>{var h;o&&r&&Dp({deviceId:r.deviceId,role:t}),(h=this.ws)==null||h.close(Mv,"connect failed")})}handleMessage(t){var s,r,o,a,c,u;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 d=typeof l.seq=="number"?l.seq:null;d!==null&&(this.lastSeq!==null&&d>this.lastSeq+1&&((r=(s=this.opts).onGap)==null||r.call(s,{expected:this.lastSeq+1,received:d})),this.lastSeq=d);try{(a=(o=this.opts).onEvent)==null||a.call(o,l)}catch(h){console.error("[gateway] event handler error:",h)}return}if(i.type==="res"){const l=n,d=this.pending.get(l.id);if(!d)return;if(this.pending.delete(l.id),l.ok)d.resolve(l.payload);else{const h=new Error(((c=l.error)==null?void 0:c.message)??"request failed");h.payload=l.payload,h.details=(u=l.error)==null?void 0:u.details,d.reject(h)}return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const i=tr(),s={type:"req",id:i,method:t,params:n},r=new Promise((o,a)=>{this.pending.set(i,{resolve:c=>o(c),reject:a})});return this.ws.send(JSON.stringify(s)),r}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Gs(e){return typeof e=="object"&&e!==null}function Lv(e){if(!Gs(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Gs(n))return null;const i=typeof n.command=="string"?n.command.trim():"";if(!i)return null;const s=typeof e.createdAtMs=="number"?e.createdAtMs:0,r=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!s||!r?null:{id:t,request:{command:i,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:s,expiresAtMs:r}}function Iv(e){if(!Gs(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function ou(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Rv(e,t){const n=ou(e).filter(i=>i.id!==t.id);return n.push(t),n}function Wa(e,t){return ou(e).filter(n=>n.id!==t)}class Nv{constructor(){this.canvas=null,this.ctx=null,this.img=new Image,this.pendingFrame=null,this.rafId=null,this.deviceWidth=1280,this.deviceHeight=720,this.lastMouseMoveAt=0,this.MOUSE_THROTTLE_MS=30}attach(t){this.canvas=t,this.ctx=t.getContext("2d")}detach(){this.rafId!=null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas=null,this.ctx=null,this.pendingFrame=null}updateFrame(t,n){if(n!=null&&n.deviceWidth&&(this.deviceWidth=n.deviceWidth),n!=null&&n.deviceHeight&&(this.deviceHeight=n.deviceHeight),this.pendingFrame=t,!this.canvas){const i=document.getElementById("browser-screencast-canvas");i&&this.attach(i)}this.rafId==null&&(this.rafId=requestAnimationFrame(()=>this.renderFrame()))}renderFrame(){this.rafId=null;const t=this.pendingFrame;!t||!this.canvas||!this.ctx||(this.pendingFrame=null,this.img.onload=()=>{!this.canvas||!this.ctx||((this.canvas.width!==this.img.width||this.canvas.height!==this.img.height)&&(this.canvas.width=this.img.width,this.canvas.height=this.img.height),this.ctx.drawImage(this.img,0,0))},this.img.src=`data:image/jpeg;base64,${t}`)}translateCoordinates(t,n){if(!this.canvas)return{x:t,y:n};const i=this.canvas.getBoundingClientRect(),s=this.canvas.width/i.width,r=this.canvas.height/i.height,o=this.deviceWidth/this.canvas.width,a=this.deviceHeight/this.canvas.height;return{x:Math.round(t*s*o),y:Math.round(n*r*a)}}shouldThrottleMouseMove(){const t=performance.now();return t-this.lastMouseMoveAt<this.MOUSE_THROTTLE_MS?!0:(this.lastMouseMoveAt=t,!1)}getDeviceDimensions(){return{width:this.deviceWidth,height:this.deviceHeight}}}let ys=null;function ln(){return ys||(ys=new Nv),ys}function Wr(e){return e instanceof Error?e.message:String(e)}async function Dv(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=Wr(t)}finally{e.browserLoading=!1}}async function Ov(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=Wr(t)}finally{e.browserLoading=!1}}}async function vs(e,t,n,i,s){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"mouse",action:t,x:n,y:i,button:s??"left",clickCount:t==="mousePressed"?1:0})}catch{}}async function bs(e,t,n,i){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"key",action:t,key:n,...i!=null&&i.text?{text:i.text}:{},...i!=null&&i.code?{code:i.code}:{},...i!=null&&i.modifiers?{modifiers:i.modifiers}:{}})}catch{}}async function Bv(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=Wr(t)}}function Fv(e){e.browserInputMode=!e.browserInputMode}function Uv(e){e.browserFullscreen=!e.browserFullscreen,ln().detach()}function Wv(e,t){if(!(t!=null&&t.data))return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,ln().updateFrame(t.data,t.metadata)}function Kv(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function zv(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}async function Qs(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),i=n?{sessionKey:n}:{};try{const s=await e.client.request("agent.identity.get",i);if(!s)return;const r=xs(s);e.assistantName=r.name,e.assistantAvatar=r.avatar,e.assistantAgentId=r.agentId??null}catch{}}async function Ys(e){return(await e.request("apikeys.list")).providers??[]}async function Ka(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function jv(e,t){await e.request("apikeys.remove",{provider:t})}const gi="taskmaster_update_pending";async function au(e){var t,n;if(!(!e.client||!e.connected)&&!e.updateChecking){e.updateChecking=!0,e.updateMessage=null,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("update.status",{});e.currentVersion=i.current,e.latestVersion=i.latest,e.updateAvailable=i.updateAvailable,e.updateMessage=i.updateAvailable?`v${i.latest} available`:"Up to date"}catch(i){e.updateMessage=`Check failed: ${String(i)}`,e.updateAvailable=null}finally{e.updateChecking=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function Hv(e){var t,n,i,s;if(!(!e.client||e.updateRunning)){e.updateRunning=!0,e.updateMessage="Starting update...",e.updateProgressSteps=[],e.updateLastResult=null,(t=e.requestUpdate)==null||t.call(e);try{localStorage.setItem(gi,String(Date.now())),localStorage.removeItem(Kr)}catch{}try{const r=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(r.ok&&r.result.status==="ok")e.updateMessage="Updated — restarting gateway...",(n=e.requestUpdate)==null||n.call(e);else if(r.ok&&r.result.status==="skipped")cn(),e.updateMessage=r.result.reason||"Update skipped",e.updateRunning=!1,(i=e.requestUpdate)==null||i.call(e);else throw cn(),new Error(r.result.reason||"Update failed")}catch(r){cn(),e.updateMessage=`Update failed: ${String(r)}`,e.updateRunning=!1,e.updateProgressSteps=[],(s=e.requestUpdate)==null||s.call(e)}}}function qv(e,t){var i,s,r;const n=t.phase;if(n==="step-start"){const o=t.name,a=t.index,c=t.total;e.updateMessage=`Updating: ${o} (${a+1}/${c})`;const u=e.updateProgressSteps.find(l=>l.index===a);u?(u.status="running",u.name=o):e.updateProgressSteps=[...e.updateProgressSteps,{name:o,index:a,total:c,status:"running"}],(i=e.requestUpdate)==null||i.call(e)}else if(n==="step-done"){const o=t.name,a=t.index,c=t.total,u=t.ok,l=t.durationMs,d=e.updateProgressSteps.find(v=>v.index===a);d?(d.status=u?"done":"failed",d.durationMs=l):e.updateProgressSteps=[...e.updateProgressSteps,{name:o,index:a,total:c,status:u?"done":"failed",durationMs:l}];const h=!u&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=u?`Updating: ${o} done (${a+1}/${c})`:`Update step failed: ${o}${h}`,(s=e.requestUpdate)==null||s.call(e)}else if(n==="complete"){if(t.status==="ok")e.updateMessage="Update complete — restarting gateway...";else{const a=t.reason;e.updateMessage=a?`Update failed: ${a}`:"Update failed",e.updateRunning=!1,cn()}(r=e.requestUpdate)==null||r.call(e)}}async function Vv(e){var n,i,s,r;if(!e.client||!e.connected)return;const t=Qv();cn();try{const o=await e.client.request("update.lastResult",{});if(!o.ok||!o.result)return;const a=5*6e4,c=Date.now()-o.result.ts<a;if(!t&&!c||Yv(o.result.ts))return;e.updateLastResult=o.result;const u=(n=o.result.after)==null?void 0:n.version;if(o.result.status==="ok"&&u&&(e.currentVersion=u),e.updateAvailable=!1,o.result.status==="ok"){const l=(i=o.result.before)==null?void 0:i.version,d=u??o.result.currentVersion;e.updateMessage=l?`Updated: v${l} → v${d}`:`Updated to v${d}`}else{const l=o.result.reason??((s=o.result.failedStep)==null?void 0:s.name)??"unknown error";e.updateMessage=`Update failed: ${l}`}}catch{}finally{e.updateRunning=!1,e.updateProgressSteps=[],(r=e.requestUpdate)==null||r.call(e)}}const Kr="taskmaster_update_dismissed";function Gv(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(Kr,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function Qv(){try{const e=localStorage.getItem(gi);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(gi),!1):!0:!1}catch{return!1}}function cn(){try{localStorage.removeItem(gi)}catch{}}function Yv(e){try{const t=localStorage.getItem(Kr);return t?Number(t)>=e:!1}catch{return!1}}function ws(e,t){var a,c,u;const n=(e??"").trim(),i=(a=t.mainSessionKey)==null?void 0:a.trim();if(!i)return n;if(!n)return i;const s=((c=t.mainKey)==null?void 0:c.trim())||"main",r=(u=t.defaultAgentId)==null?void 0:u.trim();return n==="main"||n===s||r&&(n===`agent:${r}:main`||n===`agent:${r}:${s}`)?i:n}function Xv(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=ws(e.sessionKey,t),i=ws(e.settings.sessionKey,t),s=ws(e.settings.lastActiveSessionKey,t),r=n||i||e.sessionKey,o={...e.settings,sessionKey:i||r,lastActiveSessionKey:s||r},a=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;r!==e.sessionKey&&(e.sessionKey=r),a&&je(e,o)}function Te(e){var s;e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=!!e.publicChat,n=e.setup||e.filesPage||e.browserPage||e.chatPage||e.adminsPage||e.customersPage||e.advancedPage,i=t?"public-chat":n?"setup-ui":"taskmaster-control-ui";(s=e.client)==null||s.stop(),e.client=new Pv({url:e.settings.gatewayUrl,token:t?void 0:e.settings.token.trim()?e.settings.token:void 0,password:t?void 0:e.password.trim()?e.password:void 0,clientName:i,mode:"webchat",role:t?"public":void 0,scopes:t?[]:void 0,onHello:r=>{var o;if(e.connected=!0,e.lastError=null,e.hello=r,t){za(e,r),Qs(e),(((o=e.publicChatConfig)==null?void 0:o.auth)??"anonymous")==="anonymous"&&ib(e);return}oi()&&(Ar(),e.uninstallDone=!1),za(e,r),e.handleAccessCheck(),Vv(e).then(()=>{au(e)}),Qs(e),$v(e),(e.chatPage||e.setup)&&eb(e),pr(e,{quiet:!0}),dr(e,{quiet:!0}),bn(e).then(()=>{e.initWorkspaceSelection()}),e.startEmbeddingPoll(),(e.setup||e.chatPage)&&Me(e),e.setup&&(tb(e),nb(e)),si(e)},onClose:({code:r,reason:o})=>{e.connected=!1,r!==1012&&(e.lastError=`disconnected (${r}): ${o||"no reason"}`)},onEvent:r=>Zv(e,r),onGap:({expected:r,received:o})=>{console.warn(`[gateway] event gap: expected seq ${r}, got ${o}`),si(e)}}),e.client.start()}function Zv(e,t){try{Jv(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Jv(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;Bd(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n!=null&&n.sessionKey&&nc(e,n.sessionKey);const i=vl(e,n);(i==="final"||i==="error"||i==="aborted")&&(ir(e),$h(e)),i==="final"&&_e(e);return}if(t.event==="suggestions"){const n=t.payload;(n==null?void 0:n.sessionKey)===e.sessionKey&&Array.isArray(n.suggestions)&&n.suggestions.length>0&&(e.chatSuggestion=n.suggestions[0]);return}if(t.event==="presence"){const n=t.payload;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&kr(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&dr(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=Lv(t.payload);if(n){e.execApprovalQueue=Rv(e.execApprovalQueue,n),e.execApprovalError=null;const i=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Wa(e.execApprovalQueue,n.id)},i)}return}if(t.event==="browser.screencast.frame"){Wv(e,t.payload);return}if(t.event==="browser.handoff"){Kv(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){zv(e);return}if(t.event==="exec.approval.resolved"){const n=Iv(t.payload);n&&(e.execApprovalQueue=Wa(e.execApprovalQueue,n.id));return}if(t.event==="update.progress"){qv(e,t.payload);return}}function za(e,t){const n=t.snapshot;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n!=null&&n.health&&(e.debugHealth=n.health),n!=null&&n.sessionDefaults&&Xv(e,n.sessionDefaults)}async function eb(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 tb(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await Ys(e.client)}catch{}}async function nb(e){if(!(!e.client||!e.connected))try{e.tailscaleStatus=await e.client.request("tailscale.status")}catch{}}const ja="taskmaster_public_id";function lu(e=30){var s;const t=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(`${ja}=`));if(t)return t.split("=")[1];const n=`anon-${((s=crypto.randomUUID)==null?void 0:s.call(crypto))??Math.random().toString(36).slice(2)}`,i=new Date(Date.now()+e*864e5).toUTCString();return document.cookie=`${ja}=${n}; path=/; expires=${i}; SameSite=Lax`,n}async function ib(e){var n,i;if(!e.client||!e.connected)return;const t=lu((n=e.publicChatConfig)==null?void 0:n.cookieTtlDays);try{const s=(i=e.publicChatConfig)==null?void 0:i.accountId,r=await e.client.request("public.session",{cookieId:t,accountId:s});r!=null&&r.sessionKey&&(e.publicChatSessionKey=r.sessionKey,e.sessionKey=r.sessionKey,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready",_e(e))}catch(s){console.error("[public-chat] failed to resolve anonymous session:",s),e.lastError="Failed to start chat session"}}let ke=!1,de=null,It="",mi="";function cu(e){return e.replace(/[\s\-()]/g,"")}function uu(){ke=!1,de=null,It="",mi=""}async function sb(e){if(!e.client||!e.connected)return;const t=lu(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){de=n instanceof Error?n.message:"Failed to start session",e.requestUpdate()}}async function Ha(e){if(!e.client||ke)return;const t=cu(It);if(!t){de="Please enter your phone number",e.requestUpdate();return}ke=!0,de=null,e.requestUpdate();try{const n=await e.client.request("public.otp.request",{phone:t,name:mi.trim()||void 0});n!=null&&n.ok?e.onAuthStepChange("otp"):de=(n==null?void 0:n.error)??"Failed to send verification code"}catch(n){de=n instanceof Error?n.message:"Failed to send verification code"}finally{ke=!1,e.requestUpdate()}}async function qa(e,t){if(!(!e.client||ke)){if(!t.trim()){de="Please enter the verification code",e.requestUpdate();return}ke=!0,de=null,e.requestUpdate();try{const n=await e.client.request("public.otp.verify",{phone:cu(It),code:t.trim(),accountId:e.accountId});n!=null&&n.ok&&n.sessionKey?(uu(),e.onAuthenticated(n.sessionKey)):de=(n==null?void 0:n.error)??"Invalid verification code"}catch(n){de=n instanceof Error?n.message:"Verification failed"}finally{ke=!1,e.requestUpdate()}}}function ks(e){return S}function Va(e){return p`
|
|
3210
|
+
`}async function $v(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 bn(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 Ev(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 r=o.hash;if(!r){e.workspacesError="Config hash missing; reload and retry.";return}const a={name:n,baseHash:r,whatsappAccountName:n};(i=t.workspacePath)!=null&&i.trim()&&(a.workspaceDir=t.workspacePath.trim());const c=await e.client.request("workspaces.create",a);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await bn(e),(s=t.onCreated)==null||s.call(t,c)}catch(o){e.workspacesError=String(o)}finally{e.workspaceSaving=!1}}async function Tv(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 bn(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function Cv(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 bn(e)}catch(i){e.workspacesError=String(i)}}}const jn=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:Ev,loadWorkspaces:bn,removeWorkspace:Tv,renameWorkspace:Cv},Symbol.toStringTag,{value:"Module"})),ou={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"taskmaster-control-ui",SETUP_UI:"setup-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"taskmaster-macos",IOS_APP:"taskmaster-ios",ANDROID_APP:"taskmaster-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"taskmaster-probe",PUBLIC_CHAT:"public-chat"},Ua=ou,Vs={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(ou));new Set(Object.values(Vs));function _v(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 Mv=4008;class Pv{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 d;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,r=!1,a=this.opts.token;if(s){o=await Pp();const h=(d=Rp({deviceId:o.deviceId,role:t}))==null?void 0:d.token;a=h??this.opts.token,r=!!(h&&this.opts.token)}const c=a||this.opts.password?{token:a,password:this.opts.password}:void 0;let u;if(s&&o){const h=Date.now(),v=this.connectNonce??void 0,f=_v({deviceId:o.deviceId,clientId:this.opts.clientName??Ua.CONTROL_UI,clientMode:this.opts.mode??Vs.WEBCHAT,role:t,scopes:n,signedAtMs:h,token:a??null,nonce:v}),b=await Lp(o.privateKey,f);u={id:o.deviceId,publicKey:o.publicKey,signature:b,signedAt:h,nonce:v}}const l={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ua.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Vs.WEBCHAT,instanceId:this.opts.instanceId},role:t,scopes:n,device:u,caps:[],auth:c,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",l).then(h=>{var v,f,b;(v=h==null?void 0:h.auth)!=null&&v.deviceToken&&o&&Np({deviceId:o.deviceId,role:h.auth.role??t,token:h.auth.deviceToken,scopes:h.auth.scopes??[]}),this.backoffMs=800,(b=(f=this.opts).onHello)==null||b.call(f,h)}).catch(()=>{var h;r&&o&&Dp({deviceId:o.deviceId,role:t}),(h=this.ws)==null||h.close(Mv,"connect failed")})}handleMessage(t){var s,o,r,a,c,u;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 d=typeof l.seq=="number"?l.seq:null;d!==null&&(this.lastSeq!==null&&d>this.lastSeq+1&&((o=(s=this.opts).onGap)==null||o.call(s,{expected:this.lastSeq+1,received:d})),this.lastSeq=d);try{(a=(r=this.opts).onEvent)==null||a.call(r,l)}catch(h){console.error("[gateway] event handler error:",h)}return}if(i.type==="res"){const l=n,d=this.pending.get(l.id);if(!d)return;if(this.pending.delete(l.id),l.ok)d.resolve(l.payload);else{const h=new Error(((c=l.error)==null?void 0:c.message)??"request failed");h.payload=l.payload,h.details=(u=l.error)==null?void 0:u.details,d.reject(h)}return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const i=to(),s={type:"req",id:i,method:t,params:n},o=new Promise((r,a)=>{this.pending.set(i,{resolve:c=>r(c),reject:a})});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 Gs(e){return typeof e=="object"&&e!==null}function Lv(e){if(!Gs(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Gs(n))return null;const i=typeof n.command=="string"?n.command.trim():"";if(!i)return null;const s=typeof e.createdAtMs=="number"?e.createdAtMs:0,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 Iv(e){if(!Gs(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function ru(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Rv(e,t){const n=ru(e).filter(i=>i.id!==t.id);return n.push(t),n}function Wa(e,t){return ru(e).filter(n=>n.id!==t)}class Nv{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,r=this.deviceWidth/this.canvas.width,a=this.deviceHeight/this.canvas.height;return{x:Math.round(t*s*r),y:Math.round(n*o*a)}}shouldThrottleMouseMove(){const t=performance.now();return t-this.lastMouseMoveAt<this.MOUSE_THROTTLE_MS?!0:(this.lastMouseMoveAt=t,!1)}getDeviceDimensions(){return{width:this.deviceWidth,height:this.deviceHeight}}}let ys=null;function ln(){return ys||(ys=new Nv),ys}function Ko(e){return e instanceof Error?e.message:String(e)}async function Dv(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=Ko(t)}finally{e.browserLoading=!1}}async function Ov(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=Ko(t)}finally{e.browserLoading=!1}}}async function vs(e,t,n,i,s){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"mouse",action:t,x:n,y:i,button:s??"left",clickCount:t==="mousePressed"?1:0})}catch{}}async function bs(e,t,n,i){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"key",action:t,key:n,...i!=null&&i.text?{text:i.text}:{},...i!=null&&i.code?{code:i.code}:{},...i!=null&&i.modifiers?{modifiers:i.modifiers}:{}})}catch{}}async function Bv(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=Ko(t)}}function Fv(e){e.browserInputMode=!e.browserInputMode}function Uv(e){e.browserFullscreen=!e.browserFullscreen,ln().detach()}function Wv(e,t){if(!(t!=null&&t.data))return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,ln().updateFrame(t.data,t.metadata)}function Kv(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function zv(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}async function Qs(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),i=n?{sessionKey:n}:{};try{const s=await e.client.request("agent.identity.get",i);if(!s)return;const o=xs(s);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}async function Ys(e){return(await e.request("apikeys.list")).providers??[]}async function Ka(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function jv(e,t){await e.request("apikeys.remove",{provider:t})}const gi="taskmaster_update_pending";async function au(e){var t,n;if(!(!e.client||!e.connected)&&!e.updateChecking){e.updateChecking=!0,e.updateMessage=null,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("update.status",{});e.currentVersion=i.current,e.latestVersion=i.latest,e.updateAvailable=i.updateAvailable,e.updateMessage=i.updateAvailable?`v${i.latest} available`:"Up to date"}catch(i){e.updateMessage=`Check failed: ${String(i)}`,e.updateAvailable=null}finally{e.updateChecking=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function Hv(e){var t,n,i,s;if(!(!e.client||e.updateRunning)){e.updateRunning=!0,e.updateMessage="Starting update...",e.updateProgressSteps=[],e.updateLastResult=null,(t=e.requestUpdate)==null||t.call(e);try{localStorage.setItem(gi,String(Date.now())),localStorage.removeItem(zo)}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")cn(),e.updateMessage=o.result.reason||"Update skipped",e.updateRunning=!1,(i=e.requestUpdate)==null||i.call(e);else throw cn(),new Error(o.result.reason||"Update failed")}catch(o){cn(),e.updateMessage=`Update failed: ${String(o)}`,e.updateRunning=!1,e.updateProgressSteps=[],(s=e.requestUpdate)==null||s.call(e)}}}function qv(e,t){var i,s,o;const n=t.phase;if(n==="step-start"){const r=t.name,a=t.index,c=t.total;e.updateMessage=`Updating: ${r} (${a+1}/${c})`;const u=e.updateProgressSteps.find(l=>l.index===a);u?(u.status="running",u.name=r):e.updateProgressSteps=[...e.updateProgressSteps,{name:r,index:a,total:c,status:"running"}],(i=e.requestUpdate)==null||i.call(e)}else if(n==="step-done"){const r=t.name,a=t.index,c=t.total,u=t.ok,l=t.durationMs,d=e.updateProgressSteps.find(v=>v.index===a);d?(d.status=u?"done":"failed",d.durationMs=l):e.updateProgressSteps=[...e.updateProgressSteps,{name:r,index:a,total:c,status:u?"done":"failed",durationMs:l}];const h=!u&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=u?`Updating: ${r} done (${a+1}/${c})`:`Update step failed: ${r}${h}`,(s=e.requestUpdate)==null||s.call(e)}else if(n==="complete"){if(t.status==="ok")e.updateMessage="Update complete — restarting gateway...";else{const a=t.reason;e.updateMessage=a?`Update failed: ${a}`:"Update failed",e.updateRunning=!1,cn()}(o=e.requestUpdate)==null||o.call(e)}}async function Vv(e){var n,i,s,o;if(!e.client||!e.connected)return;const t=Qv();cn();try{const r=await e.client.request("update.lastResult",{});if(!r.ok||!r.result)return;const a=5*6e4,c=Date.now()-r.result.ts<a;if(!t&&!c||Yv(r.result.ts))return;e.updateLastResult=r.result;const u=(n=r.result.after)==null?void 0:n.version;if(r.result.status==="ok"&&u&&(e.currentVersion=u),e.updateAvailable=!1,r.result.status==="ok"){const l=(i=r.result.before)==null?void 0:i.version,d=u??r.result.currentVersion;e.updateMessage=l?`Updated: v${l} → v${d}`:`Updated to v${d}`}else{const l=r.result.reason??((s=r.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 zo="taskmaster_update_dismissed";function Gv(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(zo,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function Qv(){try{const e=localStorage.getItem(gi);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(gi),!1):!0:!1}catch{return!1}}function cn(){try{localStorage.removeItem(gi)}catch{}}function Yv(e){try{const t=localStorage.getItem(zo);return t?Number(t)>=e:!1}catch{return!1}}function ws(e,t){var a,c,u;const n=(e??"").trim(),i=(a=t.mainSessionKey)==null?void 0:a.trim();if(!i)return n;if(!n)return i;const s=((c=t.mainKey)==null?void 0:c.trim())||"main",o=(u=t.defaultAgentId)==null?void 0:u.trim();return n==="main"||n===s||o&&(n===`agent:${o}:main`||n===`agent:${o}:${s}`)?i:n}function Xv(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=ws(e.sessionKey,t),i=ws(e.settings.sessionKey,t),s=ws(e.settings.lastActiveSessionKey,t),o=n||i||e.sessionKey,r={...e.settings,sessionKey:i||o,lastActiveSessionKey:s||o},a=r.sessionKey!==e.settings.sessionKey||r.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),a&&je(e,r)}function Te(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 Pv({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 r;if(e.connected=!0,e.lastError=null,e.hello=o,t){za(e,o),Qs(e),(((r=e.publicChatConfig)==null?void 0:r.auth)??"anonymous")==="anonymous"&&ib(e);return}ri()&&(xo(),e.uninstallDone=!1),za(e,o),e.handleAccessCheck(),Vv(e).then(()=>{au(e)}),Qs(e),$v(e),(e.chatPage||e.setup)&&eb(e),ho(e,{quiet:!0}),po(e,{quiet:!0}),bn(e).then(()=>{e.initWorkspaceSelection()}),e.startEmbeddingPoll(),(e.setup||e.chatPage)&&Me(e),e.setup&&(tb(e),nb(e)),si(e)},onClose:({code:o,reason:r})=>{e.connected=!1,o!==1012&&(e.lastError=`disconnected (${o}): ${r||"no reason"}`)},onEvent:o=>Zv(e,o),onGap:({expected:o,received:r})=>{console.warn(`[gateway] event gap: expected seq ${o}, got ${r}`),si(e)}}),e.client.start()}function Zv(e,t){try{Jv(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Jv(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;Bd(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n!=null&&n.sessionKey&&nc(e,n.sessionKey);const i=vl(e,n);(i==="final"||i==="error"||i==="aborted")&&(io(e),$h(e)),i==="final"&&_e(e);return}if(t.event==="suggestions"){const n=t.payload;(n==null?void 0:n.sessionKey)===e.sessionKey&&Array.isArray(n.suggestions)&&n.suggestions.length>0&&(e.chatSuggestion=n.suggestions[0]);return}if(t.event==="presence"){const n=t.payload;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&So(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&po(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=Lv(t.payload);if(n){e.execApprovalQueue=Rv(e.execApprovalQueue,n),e.execApprovalError=null;const i=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Wa(e.execApprovalQueue,n.id)},i)}return}if(t.event==="browser.screencast.frame"){Wv(e,t.payload);return}if(t.event==="browser.handoff"){Kv(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){zv(e);return}if(t.event==="exec.approval.resolved"){const n=Iv(t.payload);n&&(e.execApprovalQueue=Wa(e.execApprovalQueue,n.id));return}if(t.event==="update.progress"){qv(e,t.payload);return}}function za(e,t){const n=t.snapshot;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n!=null&&n.health&&(e.debugHealth=n.health),n!=null&&n.sessionDefaults&&Xv(e,n.sessionDefaults)}async function eb(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 tb(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await Ys(e.client)}catch{}}async function nb(e){if(!(!e.client||!e.connected))try{e.tailscaleStatus=await e.client.request("tailscale.status")}catch{}}const ja="taskmaster_public_id";function lu(e=30){var s;const t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${ja}=`));if(t)return t.split("=")[1];const n=`anon-${((s=crypto.randomUUID)==null?void 0:s.call(crypto))??Math.random().toString(36).slice(2)}`,i=new Date(Date.now()+e*864e5).toUTCString();return document.cookie=`${ja}=${n}; path=/; expires=${i}; SameSite=Lax`,n}async function ib(e){var n,i;if(!e.client||!e.connected)return;const t=lu((n=e.publicChatConfig)==null?void 0:n.cookieTtlDays);try{const s=(i=e.publicChatConfig)==null?void 0:i.accountId,o=await e.client.request("public.session",{cookieId:t,accountId:s});o!=null&&o.sessionKey&&(e.publicChatSessionKey=o.sessionKey,e.sessionKey=o.sessionKey,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready",_e(e))}catch(s){console.error("[public-chat] failed to resolve anonymous session:",s),e.lastError="Failed to start chat session"}}let ke=!1,de=null,It="",mi="";function cu(e){return e.replace(/[\s\-()]/g,"")}function uu(){ke=!1,de=null,It="",mi=""}async function sb(e){if(!e.client||!e.connected)return;const t=lu(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){de=n instanceof Error?n.message:"Failed to start session",e.requestUpdate()}}async function Ha(e){if(!e.client||ke)return;const t=cu(It);if(!t){de="Please enter your phone number",e.requestUpdate();return}ke=!0,de=null,e.requestUpdate();try{const n=await e.client.request("public.otp.request",{phone:t,name:mi.trim()||void 0});n!=null&&n.ok?e.onAuthStepChange("otp"):de=(n==null?void 0:n.error)??"Failed to send verification code"}catch(n){de=n instanceof Error?n.message:"Failed to send verification code"}finally{ke=!1,e.requestUpdate()}}async function qa(e,t){if(!(!e.client||ke)){if(!t.trim()){de="Please enter the verification code",e.requestUpdate();return}ke=!0,de=null,e.requestUpdate();try{const n=await e.client.request("public.otp.verify",{phone:cu(It),code:t.trim(),accountId:e.accountId});n!=null&&n.ok&&n.sessionKey?(uu(),e.onAuthenticated(n.sessionKey)):de=(n==null?void 0:n.error)??"Invalid verification code"}catch(n){de=n instanceof Error?n.message:"Verification failed"}finally{ke=!1,e.requestUpdate()}}}function ks(e){return S}function Va(e){return p`
|
|
3211
3211
|
<div class="public-auth__form">
|
|
3212
3212
|
<label class="field public-auth__field">
|
|
3213
3213
|
<span>Your name (optional)</span>
|
|
@@ -3270,7 +3270,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3270
3270
|
Use a different number
|
|
3271
3271
|
</button>
|
|
3272
3272
|
</div>
|
|
3273
|
-
`}function
|
|
3273
|
+
`}function ob(e){const{authMode:t,authStep:n}=e;return t==="anonymous"?p`
|
|
3274
3274
|
<div class="setup-container">
|
|
3275
3275
|
<div class="setup-card">
|
|
3276
3276
|
<div class="setup-spinner"></div>
|
|
@@ -3320,7 +3320,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3320
3320
|
</p>
|
|
3321
3321
|
</div>
|
|
3322
3322
|
</div>
|
|
3323
|
-
`}const zr="taskmaster-access-session",du={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function pu(){try{return localStorage.getItem(zr)}catch{return null}}function hu(e){try{localStorage.setItem(zr,e)}catch{}}function ob(){try{localStorage.removeItem(zr)}catch{}}async function Qa(e){if(e.client)try{const t=pu(),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 ab(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?(hu(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 lb(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?(hu(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 cb(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 ub(e){const t=pu();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}ob(),e.accessState={...du,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}function db(e,t="admin"){var s;if(!e)return[];const n=e.bindings;if(!Array.isArray(n))return[];const i=[];for(const r of n){if(!r||typeof r!="object"||r.agentId!==t&&r.agentId!=="management")continue;const o=r.match;if(!o||typeof o!="object"||(o.channel??"").toLowerCase()!=="whatsapp")continue;const c=o.peer;if(!c||typeof c!="object"||c.kind!=="dm")continue;const u=c.id??"";u&&i.push({phone:u,paired:((s=r.meta)==null?void 0:s.paired)===!0})}return i.sort((r,o)=>r.paired&&!o.paired?-1:!r.paired&&o.paired?1:0),i}function fu(e,t,n="admin",i){const s=u=>u===n||u==="management",r=new Map,o=new Map;for(const u of e){if(!u||typeof u!="object"||!s(u.agentId))continue;const l=u.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&&(u.meta&&r.set(v,u.meta),l.accountId&&o.set(v,l.accountId))}const a=e.filter(u=>{if(!u||typeof u!="object"||!s(u.agentId))return!0;const l=u.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"}),c=t.map(u=>{const l=i??o.get(u.phone),d={channel:"whatsapp",peer:{kind:"dm",id:u.phone}};l&&(d.accountId=l);const h={agentId:n,match:d},v=r.get(u.phone);return v?h.meta=v:u.paired&&(h.meta={paired:!0}),h});return[...a,...c]}async function _i(e,t){if(!e.client||!e.connected)return;if(!t){e.adminPhones=[];return}if(e.adminsLoading)return;e.adminsLoading=!0,e.adminsError=null;const n=t;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.config;e.configForm=qe(s??{}),e.adminPhones=db(s,n),e.configFormDirty=!1}catch(i){e.adminsError=String(i)}finally{e.adminsLoading=!1}}async function gu(e,t,n,i){var o,a;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n;let r=t.replace(/[\s\-\(\)]/g,"");if(!r){e.adminsError="Phone number is required";return}if(r.startsWith("+")||(r="+"+r),!/^\+[1-9]\d{6,14}$/.test(r)){e.adminsError="Invalid phone number. Use international format (e.g., +44 7504 472444)";return}if(e.adminPhones.some(c=>c.phone===r)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const c=qe(e.configForm??((o=e.configSnapshot)==null?void 0:o.config)??{}),u=c.bindings??[],l=[...e.adminPhones,{phone:r}],d=fu(u,l,s,i);wl(c,["bindings"],d);const h=(a=e.configSnapshot)==null?void 0:a.hash;if(!h){e.adminsError="Config hash missing; reload and retry.";return}const v=rt(c);await e.client.request("config.set",{raw:v,baseHash:h}),await _i(e,n)}catch(c){e.adminsError=String(c)}finally{e.adminsSaving=!1}}async function mu(e,t,n,i){var o,a;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n,r=e.adminPhones.find(c=>c.phone===t);if(r!=null&&r.paired){e.adminsError="Cannot remove the paired phone. Unlink WhatsApp first.";return}e.adminsSaving=!0,e.adminsError=null;try{const c=qe(e.configForm??((o=e.configSnapshot)==null?void 0:o.config)??{}),u=c.bindings??[],l=e.adminPhones.filter(f=>f.phone!==t),d=fu(u,l,s,i);wl(c,["bindings"],d);const h=(a=e.configSnapshot)==null?void 0:a.hash;if(!h){e.adminsError="Config hash missing; reload and retry.";return}const v=rt(c);await e.client.request("config.set",{raw:v,baseHash:h}),await _i(e,n)}catch(c){e.adminsError=String(c)}finally{e.adminsSaving=!1}}const pb=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:gu,loadAdmins:_i,removeAdmin:mu},Symbol.toStringTag,{value:"Module"}));async function pt(e,t){if(!(!e.client||!e.connected)){if(!t){e.customersRecords=[];return}if(!e.customersLoading){e.customersLoading=!0,e.customersError=null;try{const n=e.customersSearchQuery.trim(),i=n?await e.client.request("records.search",{query:n,workspace:t}):await e.client.request("records.list",{workspace:t});e.customersRecords=i.records??[]}catch(n){e.customersError=String(n)}finally{e.customersLoading=!1}}}}async function yu(e,t,n,i){if(!e.client||!e.connected||e.customersSaving)return;let s=t.replace(/[\s\-\(\)]/g,"");const r=n.trim();if(!s){e.customersError="Phone number is required";return}if(!r){e.customersError="Name is required";return}if(s.startsWith("+")||(s="+"+s),!/^\+[1-9]\d{6,14}$/.test(s)){e.customersError="Invalid phone number. Use international format (e.g., +44 7490 553305)";return}e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.set",{id:s,name:r,fields:{},workspace:i}),e.customersShowAddForm=!1,e.customersNewPhone="",e.customersNewName="",await pt(e,i)}catch(o){e.customersError=String(o)}finally{e.customersSaving=!1}}async function vu(e,t,n){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.delete",{id:t}),e.customersEditingId===t&&(e.customersEditingId=null),await pt(e,n)}catch(i){e.customersError=String(i)}finally{e.customersSaving=!1}}}async function bu(e,t,n,i,s){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.setField",{id:t,key:n,value:i}),await pt(e,s)}catch(r){e.customersError=String(r)}finally{e.customersSaving=!1}}}async function wu(e,t,n,i){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.deleteField",{id:t,key:n}),await pt(e,i)}catch(s){e.customersError=String(s)}finally{e.customersSaving=!1}}}const hb=Object.freeze(Object.defineProperty({__proto__:null,addCustomer:yu,deleteCustomer:vu,deleteCustomerField:wu,loadCustomers:pt,setCustomerField:bu},Symbol.toStringTag,{value:"Module"}));function Yt(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 fb(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 gb(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 mb(e){const t=re(e);return(t==null?void 0:t.whatsappAccountId)??void 0}function yb(e){var n;const t=re(e);if(t)return(n=t.agents[0])==null?void 0:n.id}function vb(e){return e.selectedWorkspace??void 0}function re(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const bb=/^data:/i,wb=/^https?:\/\//i;function Ya(e){var a,c;const t=((a=e.agentsList)==null?void 0:a.agents)??[],n=ll(e.sessionKey),i=(n==null?void 0:n.agentId)??((c=e.agentsList)==null?void 0:c.defaultId)??"main",s=t.find(u=>u.id===i),r=s==null?void 0:s.identity,o=(r==null?void 0:r.avatarUrl)??(r==null?void 0:r.avatar);if(o)return bb.test(o)||wb.test(o)?o:r==null?void 0:r.avatarUrl}function kb(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 Sb(e){var o;if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=(o=e.channelAccounts)==null?void 0:o.imessage;if(!t||t.length===0)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const n=t[0],i=n.running??!1,s=n.probe,r=s!=null?s.ok===!0:i;return{configured:n.configured??!1,running:i,connected:r,lastError:n.lastError??null,selfChatMode:n.mode==="self-chat"||!!n.selfChatMode,dmPolicy:n.dmPolicy??null,cliPath:n.cliPath??null}}function Ab(e){var o;const t=(o=e.configSnapshot)==null?void 0:o.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const i=n.find(a=>{var c,u;return((c=a.match)==null?void 0:c.channel)==="imessage"&&((u=a.meta)==null?void 0:u.imessageOwner)});if(!i)return null;const s=i.agentId;for(const a of e.workspaces)if(a.agents.some(c=>c.id===s))return a.name;if(s==="admin"||s==="public"){const a=e.workspaces.find(c=>c.isDefault);return(a==null?void 0:a.name)??null}const r=s.replace(/-(admin|public)$/,"");if(r!==s){const a=e.workspaces.find(c=>c.name===r);return(a==null?void 0:a.name)??null}return null}function xb(e){var t,n,i,s,r,o,a,c,u;if(e.embeddingDownloading&&!e.publicChat)return p`
|
|
3323
|
+
`}const jo="taskmaster-access-session",du={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function pu(){try{return localStorage.getItem(jo)}catch{return null}}function hu(e){try{localStorage.setItem(jo,e)}catch{}}function rb(){try{localStorage.removeItem(jo)}catch{}}async function Qa(e){if(e.client)try{const t=pu(),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 ab(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?(hu(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 lb(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?(hu(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 cb(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 ub(e){const t=pu();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}rb(),e.accessState={...du,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}function db(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 r=o.match;if(!r||typeof r!="object"||(r.channel??"").toLowerCase()!=="whatsapp")continue;const c=r.peer;if(!c||typeof c!="object"||c.kind!=="dm")continue;const u=c.id??"";u&&i.push({phone:u,paired:((s=o.meta)==null?void 0:s.paired)===!0})}return i.sort((o,r)=>o.paired&&!r.paired?-1:!o.paired&&r.paired?1:0),i}function fu(e,t,n="admin",i){const s=u=>u===n||u==="management",o=new Map,r=new Map;for(const u of e){if(!u||typeof u!="object"||!s(u.agentId))continue;const l=u.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&&(u.meta&&o.set(v,u.meta),l.accountId&&r.set(v,l.accountId))}const a=e.filter(u=>{if(!u||typeof u!="object"||!s(u.agentId))return!0;const l=u.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"}),c=t.map(u=>{const l=i??r.get(u.phone),d={channel:"whatsapp",peer:{kind:"dm",id:u.phone}};l&&(d.accountId=l);const h={agentId:n,match:d},v=o.get(u.phone);return v?h.meta=v:u.paired&&(h.meta={paired:!0}),h});return[...a,...c]}async function _i(e,t){if(!e.client||!e.connected)return;if(!t){e.adminPhones=[];return}if(e.adminsLoading)return;e.adminsLoading=!0,e.adminsError=null;const n=t;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.config;e.configForm=qe(s??{}),e.adminPhones=db(s,n),e.configFormDirty=!1}catch(i){e.adminsError=String(i)}finally{e.adminsLoading=!1}}async function gu(e,t,n,i){var r,a;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(c=>c.phone===o)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const c=qe(e.configForm??((r=e.configSnapshot)==null?void 0:r.config)??{}),u=c.bindings??[],l=[...e.adminPhones,{phone:o}],d=fu(u,l,s,i);wl(c,["bindings"],d);const h=(a=e.configSnapshot)==null?void 0:a.hash;if(!h){e.adminsError="Config hash missing; reload and retry.";return}const v=ot(c);await e.client.request("config.set",{raw:v,baseHash:h}),await _i(e,n)}catch(c){e.adminsError=String(c)}finally{e.adminsSaving=!1}}async function mu(e,t,n,i){var r,a;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(c=>c.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 c=qe(e.configForm??((r=e.configSnapshot)==null?void 0:r.config)??{}),u=c.bindings??[],l=e.adminPhones.filter(f=>f.phone!==t),d=fu(u,l,s,i);wl(c,["bindings"],d);const h=(a=e.configSnapshot)==null?void 0:a.hash;if(!h){e.adminsError="Config hash missing; reload and retry.";return}const v=ot(c);await e.client.request("config.set",{raw:v,baseHash:h}),await _i(e,n)}catch(c){e.adminsError=String(c)}finally{e.adminsSaving=!1}}const pb=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:gu,loadAdmins:_i,removeAdmin:mu},Symbol.toStringTag,{value:"Module"}));async function pt(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 yu(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 pt(e,i)}catch(r){e.contactsError=String(r)}finally{e.contactsSaving=!1}}async function vu(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 pt(e,n)}catch(i){e.contactsError=String(i)}finally{e.contactsSaving=!1}}}async function bu(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 pt(e,s)}catch(o){e.contactsError=String(o)}finally{e.contactsSaving=!1}}}async function wu(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 pt(e,i)}catch(s){e.contactsError=String(s)}finally{e.contactsSaving=!1}}}const hb=Object.freeze(Object.defineProperty({__proto__:null,addContact:yu,deleteContact:vu,deleteContactField:wu,loadContacts:pt,setContactField:bu},Symbol.toStringTag,{value:"Module"}));function Yt(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 fb(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 gb(e){const t=oe(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 mb(e){const t=oe(e);return(t==null?void 0:t.whatsappAccountId)??void 0}function yb(e){var i;const t=oe(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 vb(e){return e.selectedWorkspace??void 0}function oe(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const bb=/^data:/i,wb=/^https?:\/\//i;function Ya(e){var a,c;const t=((a=e.agentsList)==null?void 0:a.agents)??[],n=ll(e.sessionKey),i=(n==null?void 0:n.agentId)??((c=e.agentsList)==null?void 0:c.defaultId)??"main",s=t.find(u=>u.id===i),o=s==null?void 0:s.identity,r=(o==null?void 0:o.avatarUrl)??(o==null?void 0:o.avatar);if(r)return bb.test(r)||wb.test(r)?r:o==null?void 0:o.avatarUrl}function kb(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 Sb(e){var r;if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=(r=e.channelAccounts)==null?void 0:r.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 Ab(e){var r;const t=(r=e.configSnapshot)==null?void 0:r.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const i=n.find(a=>{var c,u;return((c=a.match)==null?void 0:c.channel)==="imessage"&&((u=a.meta)==null?void 0:u.imessageOwner)});if(!i)return null;const s=i.agentId;for(const a of e.workspaces)if(a.agents.some(c=>c.id===s))return a.name;if(s==="admin"||s==="public"){const a=e.workspaces.find(c=>c.isDefault);return(a==null?void 0:a.name)??null}const o=s.replace(/-(admin|public)$/,"");if(o!==s){const a=e.workspaces.find(c=>c.name===o);return(a==null?void 0:a.name)??null}return null}function xb(e){var t,n,i,s,o,r,a,c,u;if(e.embeddingDownloading&&!e.publicChat)return p`
|
|
3324
3324
|
<div class="setup-container">
|
|
3325
3325
|
<div class="setup-card" style="text-align:center; max-width:420px;">
|
|
3326
3326
|
<div class="setup-spinner"></div>
|
|
@@ -3334,14 +3334,14 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3334
3334
|
</p>
|
|
3335
3335
|
</div>
|
|
3336
3336
|
</div>
|
|
3337
|
-
`;if(e.publicChat)return e.connected?e.publicChatAuthenticated?xv({connected:e.connected,sessionKey:e.sessionKey,loading:e.chatLoading,sending:e.chatSending,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,assistantAvatarUrl:e.chatAvatarUrl??Ya(e)??null,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,canAbort:!!e.chatRunId,disabledReason:e.connected?null:"Disconnected.",error:e.lastError,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,suggestion:e.chatSuggestion,onSuggestionClick:l=>{e.chatMessage=l,e.chatSuggestion=null,e.handleSendChat()},onRefresh:()=>(e.resetToolStream(),se(async()=>{const{loadChatHistory:l}=await Promise.resolve().then(()=>$s);return{loadChatHistory:l}},void 0,import.meta.url).then(({loadChatHistory:l})=>{l(e)})),onDraftChange:l=>e.chatMessage=l,attachments:e.chatAttachments,onAttachmentsChange:l=>e.chatAttachments=l,onSend:()=>e.handleSendChat(),onAbort:()=>{e.handleAbortChat()},onQueueRemove:l=>e.removeQueuedMessage(l),onChatScroll:l=>e.handleChatScroll(l),nearBottom:e.chatUserNearBottom}):
|
|
3337
|
+
`;if(e.publicChat)return e.connected?e.publicChatAuthenticated?xv({connected:e.connected,sessionKey:e.sessionKey,loading:e.chatLoading,sending:e.chatSending,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,assistantAvatarUrl:e.chatAvatarUrl??Ya(e)??null,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,canAbort:!!e.chatRunId,disabledReason:e.connected?null:"Disconnected.",error:e.lastError,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,suggestion:e.chatSuggestion,onSuggestionClick:l=>{e.chatMessage=l,e.chatSuggestion=null,e.handleSendChat()},onRefresh:()=>(e.resetToolStream(),se(async()=>{const{loadChatHistory:l}=await Promise.resolve().then(()=>$s);return{loadChatHistory:l}},void 0,import.meta.url).then(({loadChatHistory:l})=>{l(e)})),onDraftChange:l=>e.chatMessage=l,attachments:e.chatAttachments,onAttachmentsChange:l=>e.chatAttachments=l,onSend:()=>e.handleSendChat(),onAbort:()=>{e.handleAbortChat()},onQueueRemove:l=>e.removeQueuedMessage(l),onChatScroll:l=>e.handleChatScroll(l),nearBottom:e.chatUserNearBottom}):ob({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=>{e.publicChatSessionKey=l,e.sessionKey=l,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready",se(async()=>{const{loadChatHistory:d}=await Promise.resolve().then(()=>$s);return{loadChatHistory:d}},void 0,import.meta.url).then(({loadChatHistory:d})=>{d(e)})},onAuthStepChange:l=>{e.publicChatAuthStep=l},requestUpdate:()=>{e.requestUpdate()}}):p`
|
|
3338
3338
|
<div class="setup-container">
|
|
3339
3339
|
<div class="setup-card">
|
|
3340
3340
|
<div class="setup-spinner"></div>
|
|
3341
3341
|
<p>Connecting...</p>
|
|
3342
3342
|
</div>
|
|
3343
3343
|
</div>
|
|
3344
|
-
`;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return Fa({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(d,h)=>{h!=null&&e.handlePinSubmit(d,h)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(d,h,v)=>e.handleChangePin(d,h,v)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return Fa({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:d=>e.handleSetMasterPin(d)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",S}if(e.setup){const l=kb(e.channelsSnapshot),d=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],h=Sb(e.channelsSnapshot),v=Ab(e);return rf({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:d,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 V(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 V(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await V(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),V(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,b)=>{const k=e.newWorkspacePin;await e.handleWorkspaceCreate(f,b),k.match(/^\d{4,6}$/)&&(await cb(e,f,k),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,b)=>e.handleWorkspaceRename(f,b),whatsappDmPolicy:(()=>{const f=re(e),b=f==null?void 0:f.whatsappAccountId,k=b?d.find(x=>x.accountId===b):d[0];return(k==null?void 0:k.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var C;const f=re(e),b=f==null?void 0:f.whatsappAccountId,k=b?d.find(M=>M.accountId===b):d[0];if(!k)return;const $=k.dmPolicy!=null&&k.dmPolicy!=="disabled"?"disabled":"open",T=$==="open"?{dmPolicy:$,allowFrom:["*"]}:{dmPolicy:$};try{const M=await e.client.request("config.get"),R=M.config,B=(C=R==null?void 0:R.channels)==null?void 0:C.whatsapp,me=((B==null?void 0:B.accounts)??{})[k.accountId]?{channels:{whatsapp:{accounts:{[k.accountId]:T}}}}:{channels:{whatsapp:T}};await e.client.request("config.patch",{raw:JSON.stringify(me),baseHash:M.hash,note:`WhatsApp DM policy → ${$}`,skipRestart:!0}),await V(e,!1)}catch(M){console.error("DM toggle failed:",M)}},whatsappModel:(()=>{var C,M;const f=re(e);if(!f)return null;const b=f.agents.find(R=>R.id.endsWith("-public")||R.id==="public");if(!b)return null;const k=(C=e.configSnapshot)==null?void 0:C.config,x=(M=k==null?void 0:k.agents)==null?void 0:M.list;if(!Array.isArray(x))return null;const $=x.find(R=>R.id===b.id);if(!($!=null&&$.model))return null;const T=typeof $.model=="string"?$.model:$.model.primary;return(T==null?void 0:T.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async f=>{const b=re(e);if(!b)return;const k=b.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(k)try{const x=await e.client.request("config.get"),$=x.config,T=($==null?void 0:$.agents)??{},C=Array.isArray(T.list)?[...T.list]:[],M=C.findIndex(B=>B.id===k.id);if(f)M>=0?C[M]={...C[M],model:f}:C.push({id:k.id,model:f});else if(M>=0){const{model:B,...ee}=C[M];Object.keys(ee).length<=1?C.splice(M,1):C[M]=ee}const R=C.length>0?{agents:{list:C}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(R),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,C,M;const f=re(e);if(!f)return null;const b=f.agents.find(R=>R.id.endsWith("-public")||R.id==="public");if(!b)return null;const k=(T=e.configSnapshot)==null?void 0:T.config,x=(C=k==null?void 0:k.agents)==null?void 0:C.list;if(!Array.isArray(x))return null;const $=x.find(R=>R.id===b.id);return((M=$==null?void 0:$.thinkingLevel)==null?void 0:M.trim())||null})(),onWhatsAppThinkingChange:async f=>{const b=re(e);if(!b)return;const k=b.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(k)try{const x=await e.client.request("config.get"),$=x.config,T=($==null?void 0:$.agents)??{},C=Array.isArray(T.list)?[...T.list]:[],M=C.findIndex(ee=>ee.id===k.id),R=f==="off"?void 0:f;if(R)M>=0?C[M]={...C[M],thinkingLevel:R}:C.push({id:k.id,thinkingLevel:R});else if(M>=0){const{thinkingLevel:ee,...me}=C[M];Object.keys(me).length<=1?C.splice(M,1):C[M]=me}const B=C.length>0?{agents:{list:C}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(B),baseHash:x.hash,note:`Public agent thinking → ${R||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Thinking change failed:",x)}},whatsappGroupPolicy:(()=>{var M,R;const f=(M=e.configSnapshot)==null?void 0:M.config,b=(R=f==null?void 0:f.channels)==null?void 0:R.whatsapp,k=re(e),x=k==null?void 0:k.whatsappAccountId,$=(b==null?void 0:b.accounts)??{},T=x?$[x]:void 0;return(T==null?void 0:T.groupPolicy)??(b==null?void 0:b.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var R,B;const f=(R=e.configSnapshot)==null?void 0:R.config,b=(B=f==null?void 0:f.channels)==null?void 0:B.whatsapp,k=re(e),x=k==null?void 0:k.whatsappAccountId,$=(b==null?void 0:b.accounts)??{},T=x?$[x]:void 0,M=((T==null?void 0:T.groups)??(b==null?void 0:b.groups)??{})["*"];return(M==null?void 0:M.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var k;const f=re(e),b=f==null?void 0:f.whatsappAccountId;try{const x=await e.client.request("config.get"),$=x.config,T=((k=$==null?void 0:$.channels)==null?void 0:k.whatsapp)??{},C=T.accounts??{},M=b?C[b]:void 0,R=(M==null?void 0:M.groupPolicy)??T.groupPolicy??"allowlist",B=R==="disabled"||R==="allowlist",ee=B?"open":"disabled",me=B?{"*":{}}:void 0,Be={groupPolicy:ee};me&&(Be.groups=me);const Z=M?{channels:{whatsapp:{accounts:{[b]:Be}}}}:{channels:{whatsapp:Be}};await e.client.request("config.patch",{raw:JSON.stringify(Z),baseHash:x.hash,note:`WhatsApp groups → ${ee}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Group toggle failed:",x)}},onWhatsAppGroupMentionChange:async f=>{var x;const b=re(e),k=b==null?void 0:b.whatsappAccountId;try{const $=await e.client.request("config.get"),T=$.config,M=(((x=T==null?void 0:T.channels)==null?void 0:x.whatsapp)??{}).accounts??{},R=k?M[k]:void 0,B={"*":{requireMention:f}},ee=R?{channels:{whatsapp:{accounts:{[k]:{groups:B}}}}}:{channels:{whatsapp:{groups:B}}};await e.client.request("config.patch",{raw:JSON.stringify(ee),baseHash:$.hash,note:`WhatsApp group mention → ${f?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Group mention change failed:",$)}},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"),b=f.config,k=(b==null?void 0:b.bindings)??[],x=re(e),$=x==null?void 0:x.agents.find(B=>B.id.endsWith("-admin")||B.id==="admin"),T=($==null?void 0:$.id)??"admin",C=k.filter(B=>{var ee;return((ee=B.match)==null?void 0:ee.channel)!=="imessage"}),M=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],R=[...C,...M];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:R}),baseHash:f.hash,note:"Enable iMessage (self-chat) for "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([V(e,!0),Me(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await V(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,x=((b==null?void 0:b.bindings)??[]).filter($=>{var T;return((T=$.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([V(e,!0),Me(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,k=(b==null?void 0:b.bindings)??[],x=re(e),$=x==null?void 0:x.agents.find(R=>R.id.endsWith("-admin")||R.id==="admin"),T=($==null?void 0:$.id)??"admin",C=k.filter(R=>{var B;return((B=R.match)==null?void 0:B.channel)!=="imessage"}),M=[{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:[...C,...M]}),baseHash:f.hash,note:"Reassign iMessage to "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([V(e,!0),Me(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,b)=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Ka(e.client,f,b);const k=`${f} key saved`;e.apiKeySuccess=k,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await Ys(e.client)}catch{}f==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===k&&(e.apiKeySuccess=null)},2500)}catch(k){e.apiKeyError=k instanceof Error?k.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 jv(e.client,f);const b=`${f} key removed`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await Ys(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}},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 Ka(e.client,"anthropic",f),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 f=e.selectedWorkspace??((b=e.workspaces[0])==null?void 0:b.name);return f?e.accessState.accounts.some(k=>k.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,b)=>{var x;const k=e.selectedWorkspace??((x=e.workspaces[0])==null?void 0:x.name);k&&e.handleAccountPinSave(k,f,b)},publicChatEnabled:(()=>{var k;const f=(k=e.configSnapshot)==null?void 0:k.config,b=f==null?void 0:f.publicChat;return(b==null?void 0:b.enabled)===!0})(),publicChatAuthMode:(()=>{var x;const f=(x=e.configSnapshot)==null?void 0:x.config,b=f==null?void 0:f.publicChat,k=b==null?void 0:b.auth;return k==="verified"||k==="choice"?k:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var f;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get"),k=b.config,x=((f=k==null?void 0:k.publicChat)==null?void 0:f.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!x}}),baseHash:b.hash,note:`Public chat → ${x?"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 f=>{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:f}}),baseHash:b.hash,note:`Public chat auth → ${f}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat auth mode change failed:",b)}finally{e.publicChatToggleBusy=!1}}},tailscaleStatus:e.tailscaleStatus,tailscaleBusy:e.tailscaleBusy,tailscaleAuthUrl:e.tailscaleAuthUrl,tailscaleError:e.tailscaleError,tailscaleFunnelEnableUrl:e.tailscaleFunnelEnableUrl,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 b=setInterval(async()=>{try{const k=await e.client.request("tailscale.status");e.tailscaleStatus=k,k.loggedIn&&(clearInterval(b),e.tailscaleAuthUrl=null,e.tailscaleBusy=!1)}catch{}},3e3);setTimeout(()=>{clearInterval(b),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}}},onTailscaleFunnelEnable:async()=>{var f;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 k=b;(f=k.payload)!=null&&f.enableUrl&&(e.tailscaleFunnelEnableUrl=k.payload.enableUrl),e.tailscaleError=k.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(f){console.error("Tailscale funnel disable failed:",f),e.tailscaleBusy=!1}}},wsProps:fb(e)})}if(e.filesPage){const l=yb(e);return zh({connected:e.connected,wsProps:Yt(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>yn(e,l),onReindex:()=>eh(e,l),onSelectFile:d=>Gp(e,d,l),onToggleSelectFile:d=>Qp(e,d,l),onToggleDir:d=>th(e,d),onUpload:(d,h)=>Zp(e,d,h,l),onDownload:d=>ec(e,d,l),onBulkDownload:()=>Yp(e,l),onDelete:d=>Jp(e,d,l),onMove:(d,h)=>tc(e,d,h,l),onMoveToDir:(d,h)=>Xp(e,d,h,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:d=>{const h=e.filesSearchAgentId??l;nh(e,d,h)},onSearchAgentChange:d=>{e.filesSearchAgentId=d},onSearchClear:()=>{ih(e)},onSearchQueryChange:d=>{e.filesSearchQuery=d}})}if(e.browserPage)return Dh({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:()=>Dv(e),onStop:()=>Ov(e),onToggleInput:()=>Fv(e),onToggleFullscreen:()=>Uv(e),onCompleteHandoff:()=>Bv(e),onCanvasMouseDown:l=>{const h=l.target.getBoundingClientRect(),f=ln().translateCoordinates(l.clientX-h.left,l.clientY-h.top);vs(e,"mousePressed",f.x,f.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const h=l.target.getBoundingClientRect(),f=ln().translateCoordinates(l.clientX-h.left,l.clientY-h.top);vs(e,"mouseReleased",f.x,f.y)},onCanvasMouseMove:l=>{const d=ln();if(d.shouldThrottleMouseMove())return;const v=l.target.getBoundingClientRect(),f=d.translateCoordinates(l.clientX-v.left,l.clientY-v.top);vs(e,"mouseMoved",f.x,f.y)},onCanvasKeyDown:l=>{let d=0;l.altKey&&(d|=1),l.ctrlKey&&(d|=2),l.metaKey&&(d|=4),l.shiftKey&&(d|=8),bs(e,"keyDown",l.key,{code:l.code,modifiers:d||void 0}),l.key.length===1&&bs(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{bs(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=gb(e),d=mb(e);return af({connected:e.connected,wsProps:Yt(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>_i(e,l),onAdd:h=>{gu(e,h,l,d).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:h=>mu(e,h,l,d),onNewPhoneChange:h=>e.handleAdminsNewPhoneChange(h)})}if(e.customersPage){const l=vb(e);return df({connected:e.connected,wsProps:Yt(e),loading:e.customersLoading,saving:e.customersSaving,records:e.customersRecords,error:e.customersError,searchQuery:e.customersSearchQuery,editingId:e.customersEditingId,showAddForm:e.customersShowAddForm,newRecordPhone:e.customersNewPhone,newRecordName:e.customersNewName,onSearch:d=>e.customersSearchQuery=d,onSearchSubmit:()=>pt(e,l),onAdd:(d,h)=>yu(e,d,h,l),onDelete:d=>vu(e,d,l),onSetField:(d,h,v)=>bu(e,d,h,v,l),onDeleteField:(d,h)=>wu(e,d,h,l),onToggleExpand:d=>{e.customersEditingId=e.customersEditingId===d?null:d},onShowAddForm:()=>e.customersShowAddForm=!0,onCancelAddForm:()=>{e.customersShowAddForm=!1,e.customersNewPhone="",e.customersNewName=""},onNewRecordPhoneChange:d=>e.handleCustomersNewPhoneChange(d),onNewRecordNameChange:d=>e.handleCustomersNewNameChange(d),onRefresh:()=>pt(e,l)})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",d=Ya(e),h=e.chatAvatarUrl??d??null,v=(()=>{var k;const f=(k=e.configSnapshot)==null?void 0:k.config,b=f==null?void 0:f.publicChat;return(b==null?void 0:b.enabled)===!0})();return Vy({connected:e.connected,wsProps:Yt(e),publicChatEnabled:v,publicChatAccountId:e.selectedWorkspace??void 0,sessionKey:e.sessionKey,onSessionKeyChange:f=>{e.sessionKey=f,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatInterimText=null,e.chatSuggestion=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:f,lastActiveSessionKey:f}),e.loadAssistantIdentity(),_e(e),Ls(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:f=>{Ln(e,e.sessionKey,{model:f}).then(()=>{_e(e)})},onThinkingLevelChange:f=>{Ln(e,e.sessionKey,{thinkingLevel:f==="off"?null:f}).then(()=>{_e(e)})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:f=>{e.chatMessage=f,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:f=>{Ln(e,e.sessionKey,{verboseLevel:f==="off"?null:f}).then(()=>{_e(e)})},onFillerChange:f=>{Ln(e,e.sessionKey,{fillerEnabled:f}).then(()=>{_e(e)})},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(),Promise.all([_e(e),Ls(e)])),onToggleFocusMode:()=>{},onChatScroll:f=>e.handleChatScroll(f),nearBottom:e.chatUserNearBottom,onDraftChange:f=>e.chatMessage=f,attachments:e.chatAttachments,onAttachmentsChange:f=>e.chatAttachments=f,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:f=>e.removeQueuedMessage(f),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:f=>e.handleOpenSidebar(f),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:f=>e.handleSplitRatioChange(f),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?Av({connected:e.connected,wsProps:Yt(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&ct(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?rn(e,{reset:!0}):Tt(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(o=(r=e.channelsSnapshot)==null?void 0:r.channelMeta)!=null&&o.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((a=e.channelsSnapshot)==null?void 0:a.channelOrder)??[],channelLabels:((c=e.channelsSnapshot)==null?void 0:c.channelLabels)??{},channelMeta:((u=e.channelsSnapshot)==null?void 0:u.channelMeta)??[],agentIds:(()=>{var d;const l=re(e);return((d=l==null?void 0:l.agents)==null?void 0:d.map(h=>h.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1},detailJobId:e.cronDetailJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,Ts(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{Xd(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,d)=>Zd(e,l,d),onRun:l=>Jd(e,l),onRemove:l=>ep(e,l),onLoadRuns:l=>Ts(e,l)},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:l=>e.skillsFilter=l,onRefresh:()=>ct(e,{clearMessages:!0}),onToggle:(l,d)=>Hl(e,l,d),onEdit:(l,d)=>jl(e,l,d),onSaveKey:l=>ql(e,l),onInstall:(l,d,h)=>Vl(e,l,d,h)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?rn(e,{reset:!0}):Tt(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,d)=>{const h=e;h.sessionLogsTypeFilters={...h.sessionLogsTypeFilters,[l]:d}},onAgentToggle:(l,d)=>{const h=e;h.sessionLogsAgentFilters={...h.sessionLogsAgentFilters,[l]:d}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onRefresh:()=>{rn(e,{reset:!0})},onExport:(l,d)=>e.exportSessionLogs(l,d),onScroll:l=>e.handleSessionLogsScroll(l)},loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:l=>e.logsFilterText=l,onLevelToggle:(l,d)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:d}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onRefresh:()=>Tt(e,{reset:!0}),onExport:(l,d)=>e.exportSessionLogs(l,d),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),p``)}function $b(e){const t=new Date(e),n=t.toLocaleDateString("en-GB",{day:"2-digit",month:"short"}),i=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return`${n} ${i}`}function Xa(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function Eb(e,t,n){return p`
|
|
3344
|
+
`;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return Fa({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(d,h)=>{h!=null&&e.handlePinSubmit(d,h)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(d,h,v)=>e.handleChangePin(d,h,v)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return Fa({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:d=>e.handleSetMasterPin(d)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",S}if(e.setup){const l=kb(e.channelsSnapshot),d=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],h=Sb(e.channelsSnapshot),v=Ab(e);return of({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:d,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 V(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 V(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await V(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),V(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,b)=>{const k=e.newWorkspacePin;await e.handleWorkspaceCreate(f,b),k.match(/^\d{4,6}$/)&&(await cb(e,f,k),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,b)=>e.handleWorkspaceRename(f,b),whatsappDmPolicy:(()=>{const f=oe(e),b=f==null?void 0:f.whatsappAccountId,k=b?d.find(x=>x.accountId===b):d[0];return(k==null?void 0:k.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var C;const f=oe(e),b=f==null?void 0:f.whatsappAccountId,k=b?d.find(M=>M.accountId===b):d[0];if(!k)return;const $=k.dmPolicy!=null&&k.dmPolicy!=="disabled"?"disabled":"open",T=$==="open"?{dmPolicy:$,allowFrom:["*"]}:{dmPolicy:$};try{const M=await e.client.request("config.get"),R=M.config,B=(C=R==null?void 0:R.channels)==null?void 0:C.whatsapp,me=((B==null?void 0:B.accounts)??{})[k.accountId]?{channels:{whatsapp:{accounts:{[k.accountId]:T}}}}:{channels:{whatsapp:T}};await e.client.request("config.patch",{raw:JSON.stringify(me),baseHash:M.hash,note:`WhatsApp DM policy → ${$}`,skipRestart:!0}),await V(e,!1)}catch(M){console.error("DM toggle failed:",M)}},whatsappModel:(()=>{var C,M;const f=oe(e);if(!f)return null;const b=f.agents.find(R=>R.id.endsWith("-public")||R.id==="public");if(!b)return null;const k=(C=e.configSnapshot)==null?void 0:C.config,x=(M=k==null?void 0:k.agents)==null?void 0:M.list;if(!Array.isArray(x))return null;const $=x.find(R=>R.id===b.id);if(!($!=null&&$.model))return null;const T=typeof $.model=="string"?$.model:$.model.primary;return(T==null?void 0:T.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async f=>{const b=oe(e);if(!b)return;const k=b.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(k)try{const x=await e.client.request("config.get"),$=x.config,T=($==null?void 0:$.agents)??{},C=Array.isArray(T.list)?[...T.list]:[],M=C.findIndex(B=>B.id===k.id);if(f)M>=0?C[M]={...C[M],model:f}:C.push({id:k.id,model:f});else if(M>=0){const{model:B,...ee}=C[M];Object.keys(ee).length<=1?C.splice(M,1):C[M]=ee}const R=C.length>0?{agents:{list:C}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(R),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,C,M;const f=oe(e);if(!f)return null;const b=f.agents.find(R=>R.id.endsWith("-public")||R.id==="public");if(!b)return null;const k=(T=e.configSnapshot)==null?void 0:T.config,x=(C=k==null?void 0:k.agents)==null?void 0:C.list;if(!Array.isArray(x))return null;const $=x.find(R=>R.id===b.id);return((M=$==null?void 0:$.thinkingLevel)==null?void 0:M.trim())||null})(),onWhatsAppThinkingChange:async f=>{const b=oe(e);if(!b)return;const k=b.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(k)try{const x=await e.client.request("config.get"),$=x.config,T=($==null?void 0:$.agents)??{},C=Array.isArray(T.list)?[...T.list]:[],M=C.findIndex(ee=>ee.id===k.id),R=f==="off"?void 0:f;if(R)M>=0?C[M]={...C[M],thinkingLevel:R}:C.push({id:k.id,thinkingLevel:R});else if(M>=0){const{thinkingLevel:ee,...me}=C[M];Object.keys(me).length<=1?C.splice(M,1):C[M]=me}const B=C.length>0?{agents:{list:C}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(B),baseHash:x.hash,note:`Public agent thinking → ${R||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Thinking change failed:",x)}},whatsappGroupPolicy:(()=>{var M,R;const f=(M=e.configSnapshot)==null?void 0:M.config,b=(R=f==null?void 0:f.channels)==null?void 0:R.whatsapp,k=oe(e),x=k==null?void 0:k.whatsappAccountId,$=(b==null?void 0:b.accounts)??{},T=x?$[x]:void 0;return(T==null?void 0:T.groupPolicy)??(b==null?void 0:b.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var R,B;const f=(R=e.configSnapshot)==null?void 0:R.config,b=(B=f==null?void 0:f.channels)==null?void 0:B.whatsapp,k=oe(e),x=k==null?void 0:k.whatsappAccountId,$=(b==null?void 0:b.accounts)??{},T=x?$[x]:void 0,M=((T==null?void 0:T.groups)??(b==null?void 0:b.groups)??{})["*"];return(M==null?void 0:M.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var k;const f=oe(e),b=f==null?void 0:f.whatsappAccountId;try{const x=await e.client.request("config.get"),$=x.config,T=((k=$==null?void 0:$.channels)==null?void 0:k.whatsapp)??{},C=T.accounts??{},M=b?C[b]:void 0,R=(M==null?void 0:M.groupPolicy)??T.groupPolicy??"allowlist",B=R==="disabled"||R==="allowlist",ee=B?"open":"disabled",me=B?{"*":{}}:void 0,Be={groupPolicy:ee};me&&(Be.groups=me);const Z=M?{channels:{whatsapp:{accounts:{[b]:Be}}}}:{channels:{whatsapp:Be}};await e.client.request("config.patch",{raw:JSON.stringify(Z),baseHash:x.hash,note:`WhatsApp groups → ${ee}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Group toggle failed:",x)}},onWhatsAppGroupMentionChange:async f=>{var x;const b=oe(e),k=b==null?void 0:b.whatsappAccountId;try{const $=await e.client.request("config.get"),T=$.config,M=(((x=T==null?void 0:T.channels)==null?void 0:x.whatsapp)??{}).accounts??{},R=k?M[k]:void 0,B={"*":{requireMention:f}},ee=R?{channels:{whatsapp:{accounts:{[k]:{groups:B}}}}}:{channels:{whatsapp:{groups:B}}};await e.client.request("config.patch",{raw:JSON.stringify(ee),baseHash:$.hash,note:`WhatsApp group mention → ${f?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Group mention change failed:",$)}},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"),b=f.config,k=(b==null?void 0:b.bindings)??[],x=oe(e),$=x==null?void 0:x.agents.find(B=>B.id.endsWith("-admin")||B.id==="admin"),T=($==null?void 0:$.id)??"admin",C=k.filter(B=>{var ee;return((ee=B.match)==null?void 0:ee.channel)!=="imessage"}),M=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],R=[...C,...M];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:R}),baseHash:f.hash,note:"Enable iMessage (self-chat) for "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([V(e,!0),Me(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await V(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,x=((b==null?void 0:b.bindings)??[]).filter($=>{var T;return((T=$.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([V(e,!0),Me(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,k=(b==null?void 0:b.bindings)??[],x=oe(e),$=x==null?void 0:x.agents.find(R=>R.id.endsWith("-admin")||R.id==="admin"),T=($==null?void 0:$.id)??"admin",C=k.filter(R=>{var B;return((B=R.match)==null?void 0:B.channel)!=="imessage"}),M=[{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:[...C,...M]}),baseHash:f.hash,note:"Reassign iMessage to "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([V(e,!0),Me(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,b)=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Ka(e.client,f,b);const k=`${f} key saved`;e.apiKeySuccess=k,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await Ys(e.client)}catch{}f==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===k&&(e.apiKeySuccess=null)},2500)}catch(k){e.apiKeyError=k instanceof Error?k.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 jv(e.client,f);const b=`${f} key removed`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await Ys(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}},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 Ka(e.client,"anthropic",f),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 f=e.selectedWorkspace??((b=e.workspaces[0])==null?void 0:b.name);return f?e.accessState.accounts.some(k=>k.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,b)=>{var x;const k=e.selectedWorkspace??((x=e.workspaces[0])==null?void 0:x.name);k&&e.handleAccountPinSave(k,f,b)},publicChatEnabled:(()=>{var k;const f=(k=e.configSnapshot)==null?void 0:k.config,b=f==null?void 0:f.publicChat;return(b==null?void 0:b.enabled)===!0})(),publicChatAuthMode:(()=>{var x;const f=(x=e.configSnapshot)==null?void 0:x.config,b=f==null?void 0:f.publicChat,k=b==null?void 0:b.auth;return k==="verified"||k==="choice"?k:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var f;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get"),k=b.config,x=((f=k==null?void 0:k.publicChat)==null?void 0:f.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!x}}),baseHash:b.hash,note:`Public chat → ${x?"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 f=>{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:f}}),baseHash:b.hash,note:`Public chat auth → ${f}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat auth mode change failed:",b)}finally{e.publicChatToggleBusy=!1}}},tailscaleStatus:e.tailscaleStatus,tailscaleBusy:e.tailscaleBusy,tailscaleAuthUrl:e.tailscaleAuthUrl,tailscaleError:e.tailscaleError,tailscaleFunnelEnableUrl:e.tailscaleFunnelEnableUrl,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 b=setInterval(async()=>{try{const k=await e.client.request("tailscale.status");e.tailscaleStatus=k,k.loggedIn&&(clearInterval(b),e.tailscaleAuthUrl=null,e.tailscaleBusy=!1)}catch{}},3e3);setTimeout(()=>{clearInterval(b),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}}},onTailscaleFunnelEnable:async()=>{var f;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 k=b;(f=k.payload)!=null&&f.enableUrl&&(e.tailscaleFunnelEnableUrl=k.payload.enableUrl),e.tailscaleError=k.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(f){console.error("Tailscale funnel disable failed:",f),e.tailscaleBusy=!1}}},wsProps:fb(e)})}if(e.filesPage){const l=yb(e);return zh({connected:e.connected,wsProps:Yt(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>yn(e,l),onReindex:()=>eh(e,l),onSelectFile:d=>Gp(e,d,l),onToggleSelectFile:d=>Qp(e,d,l),onToggleDir:d=>th(e,d),onUpload:(d,h)=>Zp(e,d,h,l),onDownload:d=>ec(e,d,l),onBulkDownload:()=>Yp(e,l),onDelete:d=>Jp(e,d,l),onMove:(d,h)=>tc(e,d,h,l),onMoveToDir:(d,h)=>Xp(e,d,h,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:d=>{const h=e.filesSearchAgentId??l;nh(e,d,h)},onSearchAgentChange:d=>{e.filesSearchAgentId=d},onSearchClear:()=>{ih(e)},onSearchQueryChange:d=>{e.filesSearchQuery=d}})}if(e.browserPage)return Dh({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:()=>Dv(e),onStop:()=>Ov(e),onToggleInput:()=>Fv(e),onToggleFullscreen:()=>Uv(e),onCompleteHandoff:()=>Bv(e),onCanvasMouseDown:l=>{const h=l.target.getBoundingClientRect(),f=ln().translateCoordinates(l.clientX-h.left,l.clientY-h.top);vs(e,"mousePressed",f.x,f.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const h=l.target.getBoundingClientRect(),f=ln().translateCoordinates(l.clientX-h.left,l.clientY-h.top);vs(e,"mouseReleased",f.x,f.y)},onCanvasMouseMove:l=>{const d=ln();if(d.shouldThrottleMouseMove())return;const v=l.target.getBoundingClientRect(),f=d.translateCoordinates(l.clientX-v.left,l.clientY-v.top);vs(e,"mouseMoved",f.x,f.y)},onCanvasKeyDown:l=>{let d=0;l.altKey&&(d|=1),l.ctrlKey&&(d|=2),l.metaKey&&(d|=4),l.shiftKey&&(d|=8),bs(e,"keyDown",l.key,{code:l.code,modifiers:d||void 0}),l.key.length===1&&bs(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{bs(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=gb(e),d=mb(e);return af({connected:e.connected,wsProps:Yt(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>_i(e,l),onAdd:h=>{gu(e,h,l,d).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:h=>mu(e,h,l,d),onNewPhoneChange:h=>e.handleAdminsNewPhoneChange(h)})}if(e.contactsPage){const l=vb(e);return df({connected:e.connected,wsProps:Yt(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,onSearch:d=>e.contactsSearchQuery=d,onSearchSubmit:()=>pt(e,l),onAdd:(d,h)=>yu(e,d,h,l),onDelete:d=>vu(e,d,l),onSetField:(d,h,v)=>bu(e,d,h,v,l),onDeleteField:(d,h)=>wu(e,d,h,l),onToggleExpand:d=>{e.contactsEditingId=e.contactsEditingId===d?null:d},onShowAddForm:()=>e.contactsShowAddForm=!0,onCancelAddForm:()=>{e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName=""},onNewRecordPhoneChange:d=>e.handleContactsNewPhoneChange(d),onNewRecordNameChange:d=>e.handleContactsNewNameChange(d),onRefresh:()=>pt(e,l)})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",d=Ya(e),h=e.chatAvatarUrl??d??null,v=(()=>{var k;const f=(k=e.configSnapshot)==null?void 0:k.config,b=f==null?void 0:f.publicChat;return(b==null?void 0:b.enabled)===!0})();return Vy({connected:e.connected,wsProps:Yt(e),publicChatEnabled:v,publicChatAccountId:e.selectedWorkspace??void 0,sessionKey:e.sessionKey,onSessionKeyChange:f=>{e.sessionKey=f,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatInterimText=null,e.chatSuggestion=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:f,lastActiveSessionKey:f}),e.loadAssistantIdentity(),_e(e),Ls(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:f=>{Ln(e,e.sessionKey,{model:f}).then(()=>{_e(e)})},onThinkingLevelChange:f=>{Ln(e,e.sessionKey,{thinkingLevel:f==="off"?null:f}).then(()=>{_e(e)})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:f=>{e.chatMessage=f,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:f=>{Ln(e,e.sessionKey,{verboseLevel:f==="off"?null:f}).then(()=>{_e(e)})},onFillerChange:f=>{Ln(e,e.sessionKey,{fillerEnabled:f}).then(()=>{_e(e)})},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(),Promise.all([_e(e),Ls(e)])),onToggleFocusMode:()=>{},onChatScroll:f=>e.handleChatScroll(f),nearBottom:e.chatUserNearBottom,onDraftChange:f=>e.chatMessage=f,attachments:e.chatAttachments,onAttachmentsChange:f=>e.chatAttachments=f,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:f=>e.removeQueuedMessage(f),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:f=>e.handleOpenSidebar(f),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:f=>e.handleSplitRatioChange(f),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?Av({connected:e.connected,wsProps:Yt(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&ct(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?on(e,{reset:!0}):Tt(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(r=(o=e.channelsSnapshot)==null?void 0:o.channelMeta)!=null&&r.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((a=e.channelsSnapshot)==null?void 0:a.channelOrder)??[],channelLabels:((c=e.channelsSnapshot)==null?void 0:c.channelLabels)??{},channelMeta:((u=e.channelsSnapshot)==null?void 0:u.channelMeta)??[],agentIds:(()=>{var d;const l=oe(e);return((d=l==null?void 0:l.agents)==null?void 0:d.map(h=>h.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1},detailJobId:e.cronDetailJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,Ts(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{Xd(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,d)=>Zd(e,l,d),onRun:l=>Jd(e,l),onRemove:l=>ep(e,l),onLoadRuns:l=>Ts(e,l)},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:l=>e.skillsFilter=l,onRefresh:()=>ct(e,{clearMessages:!0}),onToggle:(l,d)=>Hl(e,l,d),onEdit:(l,d)=>jl(e,l,d),onSaveKey:l=>ql(e,l),onInstall:(l,d,h)=>Vl(e,l,d,h)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?on(e,{reset:!0}):Tt(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,d)=>{const h=e;h.sessionLogsTypeFilters={...h.sessionLogsTypeFilters,[l]:d}},onAgentToggle:(l,d)=>{const h=e;h.sessionLogsAgentFilters={...h.sessionLogsAgentFilters,[l]:d}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onRefresh:()=>{on(e,{reset:!0})},onExport:(l,d)=>e.exportSessionLogs(l,d),onScroll:l=>e.handleSessionLogsScroll(l)},loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:l=>e.logsFilterText=l,onLevelToggle:(l,d)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:d}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onRefresh:()=>Tt(e,{reset:!0}),onExport:(l,d)=>e.exportSessionLogs(l,d),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),p``)}function $b(e){const t=new Date(e),n=t.toLocaleDateString("en-GB",{day:"2-digit",month:"short"}),i=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return`${n} ${i}`}function Xa(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function Eb(e,t,n){return p`
|
|
3345
3345
|
<div class="audit-modal-overlay" @click=${s=>{s.target.classList.contains("audit-modal-overlay")&&n()}}>
|
|
3346
3346
|
<div class="audit-modal-card">
|
|
3347
3347
|
<div class="audit-modal-header">
|
|
@@ -3373,7 +3373,7 @@ ${a.text}`:c.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3373
3373
|
`}
|
|
3374
3374
|
</div>
|
|
3375
3375
|
</div>
|
|
3376
|
-
`}const Tb={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Cb={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};function _b(e){e.basePath=hh();const t=Ve();if(Ph(t.accentColor),window.scrollTo(0,0),oh(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}`,Te(e);return}if(e.setup){document.title=`${t.name} Setup`,Te(e);return}if(e.filesPage){document.title=`${t.name} Files`,lh(e),Te(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Te(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Te(e);return}if(e.customersPage){document.title=`${t.name} Customers`,Te(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Te(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Te(e);return}yh(e,!0),fh(e),gh(e),window.addEventListener("popstate",e.popStateHandler),uh(e),Te(e),sh(e),e.tab==="logs"&&(e.logsSubTab==="session"?yr(e):gr(e)),e.tab==="debug"&&br(e)}function Mb(e){Hd(e)}function Pb(e){var t;window.removeEventListener("popstate",e.popStateHandler),rh(e),mr(e),vr(e),wr(e),ah(e),ch(e),mh(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Lb(e,t){if(!e.publicChat){if(e.filesPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleFilesLoad&&e.handleFilesLoad(),e.adminsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdminsLoad&&e.handleAdminsLoad(),e.customersPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleCustomersLoad&&e.handleCustomersLoad(),e.chatPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleChatLoad&&e.handleChatLoad(),e.advancedPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdvancedLoad&&e.handleAdvancedLoad(),e.setup&&e.connected){const n=t.has("connected")&&t.get("connected")===!1;n&&e.handleLicenseStatusCheck&&e.licenseValid===null&&!e.licenseBusy&&e.handleLicenseStatusCheck(),n&&e.handleUpdateCheck&&e.handleUpdateCheck();const i=t.has("setupStep")&&e.setupStep==="auth";(n||i)&&e.setupStep==="auth"&&e.handleAuthStatusCheck&&e.authConnected===null&&!e.authBusy&&e.handleAuthStatusCheck(),e.setupStep==="whatsapp"&&t.has("setupStep")&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(r=>{e.channelsSnapshot=r,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1})),t.has("whatsappLoginConnected")&&e.whatsappLoginConnected===!0&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(s=>{e.channelsSnapshot=s,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1}))}if(e.tab==="chat"&&!e.advancedPage&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),i=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;fn(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&bl(e,t.has("tab")||t.has("logsAutoFollow"))}}function Ib(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 Rb(e,t,n){await sr(e,t,n),await V(e,!0)}async function Nb(e,t){await Sl(e,t),await V(e,!0)}async function Db(e,t){await Al(e,t),await V(e,!0)}async function Ob(e,t){await xl(e,t)}async function Bb(e,t){await $l(e,t)}async function Fb(e){await Gd(e),await Me(e),await V(e,!0)}async function Ub(e){await Me(e),await V(e,!0)}function Wb(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[i,...s]=n.split(":");if(!i||s.length===0)continue;const r=i.trim(),o=s.join(":").trim();r&&o&&(t[r]=o)}return t}function ku(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 Su(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Kb(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Ib(n??void 0)}function zb(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function jb(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function Hb(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function qb(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=ku(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(Su(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const r=(s==null?void 0:s.error)??`Profile update failed (${i.status})`;e.nostrProfileFormState={...t,saving:!1,error:r,success:null,fieldErrors:Wb(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 V(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function Vb(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=ku(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(Su(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 c=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:c,success:null};return}const r=s.merged??s.imported??null,o=r?{...t.values,...r}:t.values,a=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:a},s.saved&&await V(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function Gb(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 Qb(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 Yb(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 Xb(e,t){e.authCodeInput=t}function Zb(e){e.setupStep="whatsapp"}async function Jb(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 ew(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 tw(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 nw(e,t){e.licenseKey=t}async function iw(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 sw(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 rw=Object.defineProperty,ow=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?ow(t,n):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(s=(i?o(t,n,s):o(s))||s);return i&&s&&rw(t,n,s),s};const Ss=ad();function aw(){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 lw(){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 cw(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function uw(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function dw(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function pw(){const e=window.location.pathname;return e==="/customers"||e.endsWith("/customers")}function hw(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function fw(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends Et{constructor(){super(...arguments),this.settings=qi(),this.password="",this.tab="chat",this.onboarding=aw(),this.setup=lw(),this.filesPage=cw(),this.browserPage=uw(),this.adminsPage=dw(),this.customersPage=pw(),this.chatPage=hw(),this.advancedPage=fw(),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=du,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=Ss.name,this.assistantAvatar=Ss.avatar,this.assistantAgentId=Ss.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatModelProvider=null,this.chatModel=null,this.chatModelCatalog=[],this.chatVerboseLevel=null,this.chatFillerEnabled=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.configLoading=!1,this.configRaw=`{
|
|
3376
|
+
`}const Tb={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Cb={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};function _b(e){e.basePath=hh();const t=Ve();if(Ph(t.accentColor),window.scrollTo(0,0),rh(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}`,Te(e);return}if(e.setup){document.title=`${t.name} Setup`,Te(e);return}if(e.filesPage){document.title=`${t.name} Files`,lh(e),Te(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Te(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Te(e);return}if(e.contactsPage){document.title=`${t.name} Contacts`,Te(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Te(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Te(e);return}yh(e,!0),fh(e),gh(e),window.addEventListener("popstate",e.popStateHandler),uh(e),Te(e),sh(e),e.tab==="logs"&&(e.logsSubTab==="session"?vo(e):mo(e)),e.tab==="debug"&&wo(e)}function Mb(e){Hd(e)}function Pb(e){var t;window.removeEventListener("popstate",e.popStateHandler),oh(e),yo(e),bo(e),ko(e),ah(e),ch(e),mh(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Lb(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;fn(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&bl(e,t.has("tab")||t.has("logsAutoFollow"))}}function Ib(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 Rb(e,t,n){await so(e,t,n),await V(e,!0)}async function Nb(e,t){await Sl(e,t),await V(e,!0)}async function Db(e,t){await Al(e,t),await V(e,!0)}async function Ob(e,t){await xl(e,t)}async function Bb(e,t){await $l(e,t)}async function Fb(e){await Gd(e),await Me(e),await V(e,!0)}async function Ub(e){await Me(e),await V(e,!0)}function Wb(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(),r=s.join(":").trim();o&&r&&(t[o]=r)}return t}function ku(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 Su(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Kb(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Ib(n??void 0)}function zb(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function jb(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function Hb(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function qb(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=ku(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(Su(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:Wb(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 V(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function Vb(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=ku(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(Su(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 c=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:c,success:null};return}const o=s.merged??s.imported??null,r=o?{...t.values,...o}:t.values,a=!!(r.banner||r.website||r.nip05||r.lud16);e.nostrProfileFormState={...t,importing:!1,values:r,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:a},s.saved&&await V(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function Gb(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 Qb(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 Yb(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 Xb(e,t){e.authCodeInput=t}function Zb(e){e.setupStep="whatsapp"}async function Jb(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 ew(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 tw(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 nw(e,t){e.licenseKey=t}async function iw(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 sw(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 ow=Object.defineProperty,rw=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?rw(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(s=(i?r(t,n,s):r(s))||s);return i&&s&&ow(t,n,s),s};const Ss=ad();function aw(){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 lw(){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 cw(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function uw(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function dw(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function pw(){const e=window.location.pathname;return e==="/contacts"||e.endsWith("/contacts")}function hw(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function fw(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends Et{constructor(){super(...arguments),this.settings=qi(),this.password="",this.tab="chat",this.onboarding=aw(),this.setup=lw(),this.filesPage=cw(),this.browserPage=uw(),this.adminsPage=dw(),this.contactsPage=pw(),this.chatPage=hw(),this.advancedPage=fw(),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=du,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=Ss.name,this.assistantAvatar=Ss.avatar,this.assistantAgentId=Ss.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatModelProvider=null,this.chatModel=null,this.chatModelCatalog=[],this.chatVerboseLevel=null,this.chatFillerEnabled=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.configLoading=!1,this.configRaw=`{
|
|
3377
3377
|
}
|
|
3378
|
-
`,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.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleFunnelEnableUrl=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={...Cb},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserFullscreen=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.embeddingDownloading=!1,this.embeddingPollTimer=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.customersLoading=!1,this.customersSaving=!1,this.customersRecords=[],this.customersError=null,this.customersSearchQuery="",this.customersEditingId=null,this.customersShowAddForm=!1,this.customersNewPhone="",this.customersNewName="",this.imessageEnableConfirm=!1,this.imessageEnabling=!1,this.infoModalOpen=null,this.workspaces=[],this.workspacesLoading=!1,this.workspacesError=null,this.selectedWorkspace=null,this.addingWorkspace=!1,this.newWorkspaceName="",this.newWorkspacePath="",this.newWorkspacePin="",this.accountPinModalOpen=!1,this.accountPinBusy=!1,this.accountPinError=null,this.accountPinSuccess=null,this.apiKeyProviders=[],this.apiKeyModalOpen=!1,this.apiKeyBusy=!1,this.apiKeyError=null,this.apiKeySuccess=null,this.apiKeySavingProvider=null,this.authApiKeyMode=!1,this.authApiKeyInput="",this.authApiKeyBusy=!1,this.authApiKeyError=null,this.pinChanging=null,this.pinChangeBusy=!1,this.pinChangeError=null,this.loginChangePinMode=!1,this.changePinBusy=!1,this.changePinError=null,this.changePinSuccess=null,this.workspaceSaving=!1,this.workspaceRemoveConfirm=null,this.renamingWorkspace=!1,this.renameWorkspaceName="",this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...Tb},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.logsSubTab="session",this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>vh(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),_b(this)}firstUpdated(){Mb(this)}disconnectedCallback(){this.stopEmbeddingPoll(),Pb(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){Lb(this,e)}connect(){Te(this)}handleChatScroll(e){Fd(this,e)}handleLogsScroll(e){Ud(this,e)}handleSessionLogsScroll(e){Wd(this,e)}exportLogs(e,t){zd(e,t)}exportSessionLogs(e,t){jd(e,t)}resetToolStream(){ir(this)}resetChatScroll(){Kd(this)}async loadAssistantIdentity(){await Qs(this)}applySettings(e){je(this,e)}setTab(e){dh(this,e)}setTheme(e,t){ph(this,e,t)}async loadOverview(){await rc(this)}async loadCron(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.cronForm={...this.cronForm,accountId:(e==null?void 0:e.whatsappAccountId)??void 0},await kr(this)}async handleAbortChat(){await ac(this)}removeQueuedMessage(e){Sh(this,e)}async handleSendChat(e,t){await Ah(this,e,t)}async handleWhatsAppStart(e,t){await Rb(this,e,t)}async handleWhatsAppWait(e){await Nb(this,e)}async handleWhatsAppLogout(e){await Db(this,e)}async handleAddWhatsAppAccount(e){await Ob(this,e)}async handleRemoveWhatsAppAccount(e){await Bb(this,e)}async handleAccessCheck(){await Qa(this)}async handlePinSubmit(e,t){await ab(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await lb(this,e)}async handleLogout(){await ub(this)}toggleChangePinMode(){this.loginChangePinMode=!this.loginChangePinMode,this.changePinError=null,this.changePinSuccess=null}async handleChangePin(e,t,n){if(this.client){this.changePinBusy=!0,this.changePinError=null,this.changePinSuccess=null;try{const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.changePinError=i.message??"Incorrect current PIN",this.changePinBusy=!1;return}e==="__master__"?await this.client.request("access.setMasterPin",{pin:n}):await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.changePinSuccess="PIN changed successfully",this.changePinBusy=!1,setTimeout(()=>{this.loginChangePinMode=!1,this.changePinSuccess=null},2e3)}catch{this.changePinError="Failed to change PIN",this.changePinBusy=!1}}}async handleAccountPinSave(e,t,n){if(this.client){this.accountPinBusy=!0,this.accountPinError=null,this.accountPinSuccess=null;try{if(t!==null){const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.accountPinError=i.message??"Incorrect current PIN",this.accountPinBusy=!1;return}}await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.accountPinSuccess="PIN saved",this.accountPinBusy=!1,await Qa(this),setTimeout(()=>{this.accountPinModalOpen=!1,this.accountPinSuccess=null,this.accountPinError=null},1500)}catch{this.accountPinError="Failed to save PIN",this.accountPinBusy=!1}}}async handleLicenseStatusCheck(){await Jb(this)}async handleLicenseActivate(){await ew(this)}async handleLicenseRemove(){await tw(this)}handleLicenseKeyChange(e){nw(this,e)}async handleAuthStatusCheck(){await Gb(this)}async handleAuthStart(){await Qb(this)}async handleAuthSubmitCode(e){await Yb(this,e)}handleAuthCodeChange(e){Xb(this,e)}handleSkipToWhatsApp(){Zb(this)}async handleGatewayHealthCheck(){await iw(this)}async handleGatewayRestart(){await sw(this)}async handleUpdateCheck(){await au(this)}async handleUpdateRun(){await Hv(this)}handleUpdateDismissResult(){Gv(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 se(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>Ro);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){se(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>Ro);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await Zl(this)}async clearAudit(){await Vp(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();yn(this,t),fr(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();se(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>pb);return{loadAdmins:t}},void 0,import.meta.url).then(({loadAdmins:t})=>{t(this,e)})}resolveAdminAgentId(){const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(n=>n.id.endsWith("-admin")||n.id==="admin");return t==null?void 0:t.id}resolveFilesAgentId(){var t;const e=this.getSelectedWorkspaceInfo();if(e)return(t=e.agents[0])==null?void 0:t.id}handleChatLoad(){const e=this.resolveAdminAgentId();if(e){const t=`agent:${e}:main`;t!==this.sessionKey&&(this.sessionKey=t,this.chatMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatRunId=null,this.chatSuggestion=null,this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}se(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>$s);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this)})}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.loadCron(),this.advancedTab==="logs"&&(this.logsSubTab==="session"?se(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>Xl);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):se(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>op);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&se(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>Up);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Fb(this)}async handleChannelConfigReload(){await Ub(this)}handleNostrProfileEdit(e,t){Kb(this,e,t)}handleNostrProfileCancel(){zb(this)}handleNostrProfileFieldChange(e,t){jb(this,e,t)}async handleNostrProfileSave(){await qb(this)}async handleNostrProfileImport(){await Vb(this)}handleNostrProfileToggleAdvanced(){Hb(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleCustomersLoad(){const e=this.selectedWorkspace??void 0;se(async()=>{const{loadCustomers:t}=await Promise.resolve().then(()=>hb);return{loadCustomers:t}},void 0,import.meta.url).then(({loadCustomers:t})=>{t(this,e)})}handleCustomersNewPhoneChange(e){this.customersNewPhone=e,this.customersError&&(this.customersError=null)}handleCustomersNewNameChange(e){this.customersNewName=e,this.customersError&&(this.customersError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await se(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>jn);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await se(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>jn);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await se(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>tp);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const r=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,r),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(r),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await se(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>jn);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=(e==null?void 0:e.displayName)??(e==null?void 0:e.name)??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await se(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>jn);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),ko(e),this.settings=qi(),this.chatMessage="",this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.reloadCurrentPageData()}getSelectedWorkspaceInfo(){return this.selectedWorkspace?this.workspaces.find(e=>e.name===this.selectedWorkspace)??null:null}reloadCurrentPageData(){this.loadAuditEntries(),this.adminsPage?this.handleAdminsLoad():this.customersPage?this.handleCustomersLoad():this.filesPage?this.handleFilesLoad():this.chatPage?this.handleChatLoad():this.advancedPage&&this.handleAdvancedLoad()}initWorkspaceSelection(){if(this.workspaces.length===0){this.reloadCurrentPageData();return}const e=localStorage.getItem("taskmaster-selected-workspace"),t=e?this.workspaces.find(n=>n.name===e):null;if(t)this.selectedWorkspace=t.name;else{const n=this.workspaces.find(i=>i.isDefault)??this.workspaces[0];this.selectedWorkspace=n.name,localStorage.setItem("taskmaster-selected-workspace",n.name)}ko(this.selectedWorkspace),this.settings=qi(),this.reloadCurrentPageData()}render(){return p`${xb(this)}${this.auditModalOpen?Eb(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):S}`}};m([y()],g.prototype,"settings",2);m([y()],g.prototype,"password",2);m([y()],g.prototype,"tab",2);m([y()],g.prototype,"onboarding",2);m([y()],g.prototype,"setup",2);m([y()],g.prototype,"filesPage",2);m([y()],g.prototype,"browserPage",2);m([y()],g.prototype,"adminsPage",2);m([y()],g.prototype,"customersPage",2);m([y()],g.prototype,"chatPage",2);m([y()],g.prototype,"advancedPage",2);m([y()],g.prototype,"advancedTab",2);m([y()],g.prototype,"publicChat",2);m([y()],g.prototype,"publicChatConfig",2);m([y()],g.prototype,"publicChatSessionKey",2);m([y()],g.prototype,"publicChatAuthenticated",2);m([y()],g.prototype,"publicChatAuthStep",2);m([y()],g.prototype,"connected",2);m([y()],g.prototype,"accessState",2);m([y()],g.prototype,"theme",2);m([y()],g.prototype,"themeResolved",2);m([y()],g.prototype,"hello",2);m([y()],g.prototype,"lastError",2);m([y()],g.prototype,"eventLog",2);m([y()],g.prototype,"assistantName",2);m([y()],g.prototype,"assistantAvatar",2);m([y()],g.prototype,"assistantAgentId",2);m([y()],g.prototype,"sessionKey",2);m([y()],g.prototype,"chatLoading",2);m([y()],g.prototype,"chatSending",2);m([y()],g.prototype,"chatMessage",2);m([y()],g.prototype,"chatMessages",2);m([y()],g.prototype,"chatToolMessages",2);m([y()],g.prototype,"chatStream",2);m([y()],g.prototype,"chatInterimText",2);m([y()],g.prototype,"chatSuggestion",2);m([y()],g.prototype,"chatStreamStartedAt",2);m([y()],g.prototype,"chatRunId",2);m([y()],g.prototype,"compactionStatus",2);m([y()],g.prototype,"chatAvatarUrl",2);m([y()],g.prototype,"chatThinkingLevel",2);m([y()],g.prototype,"chatModelProvider",2);m([y()],g.prototype,"chatModel",2);m([y()],g.prototype,"chatModelCatalog",2);m([y()],g.prototype,"chatVerboseLevel",2);m([y()],g.prototype,"chatFillerEnabled",2);m([y()],g.prototype,"chatQueue",2);m([y()],g.prototype,"chatAttachments",2);m([y()],g.prototype,"sidebarOpen",2);m([y()],g.prototype,"sidebarContent",2);m([y()],g.prototype,"sidebarError",2);m([y()],g.prototype,"splitRatio",2);m([y()],g.prototype,"nodesLoading",2);m([y()],g.prototype,"nodes",2);m([y()],g.prototype,"devicesLoading",2);m([y()],g.prototype,"devicesError",2);m([y()],g.prototype,"devicesList",2);m([y()],g.prototype,"execApprovalsLoading",2);m([y()],g.prototype,"execApprovalsSaving",2);m([y()],g.prototype,"execApprovalsDirty",2);m([y()],g.prototype,"execApprovalsSnapshot",2);m([y()],g.prototype,"execApprovalsForm",2);m([y()],g.prototype,"execApprovalsSelectedAgent",2);m([y()],g.prototype,"execApprovalsTarget",2);m([y()],g.prototype,"execApprovalsTargetNodeId",2);m([y()],g.prototype,"execApprovalQueue",2);m([y()],g.prototype,"execApprovalBusy",2);m([y()],g.prototype,"execApprovalError",2);m([y()],g.prototype,"configLoading",2);m([y()],g.prototype,"configRaw",2);m([y()],g.prototype,"configRawOriginal",2);m([y()],g.prototype,"configValid",2);m([y()],g.prototype,"configIssues",2);m([y()],g.prototype,"configSaving",2);m([y()],g.prototype,"configApplying",2);m([y()],g.prototype,"updateRunning",2);m([y()],g.prototype,"applySessionKey",2);m([y()],g.prototype,"configSnapshot",2);m([y()],g.prototype,"configSchema",2);m([y()],g.prototype,"configSchemaVersion",2);m([y()],g.prototype,"configSchemaLoading",2);m([y()],g.prototype,"configUiHints",2);m([y()],g.prototype,"configForm",2);m([y()],g.prototype,"configFormOriginal",2);m([y()],g.prototype,"configFormDirty",2);m([y()],g.prototype,"configFormMode",2);m([y()],g.prototype,"configSearchQuery",2);m([y()],g.prototype,"configActiveSection",2);m([y()],g.prototype,"configActiveSubsection",2);m([y()],g.prototype,"channelsLoading",2);m([y()],g.prototype,"channelsSnapshot",2);m([y()],g.prototype,"channelsError",2);m([y()],g.prototype,"channelsLastSuccess",2);m([y()],g.prototype,"whatsappLoginMessage",2);m([y()],g.prototype,"whatsappLoginQrDataUrl",2);m([y()],g.prototype,"whatsappLoginConnected",2);m([y()],g.prototype,"whatsappBusy",2);m([y()],g.prototype,"whatsappActiveQrAccountId",2);m([y()],g.prototype,"whatsappPairedPhone",2);m([y()],g.prototype,"addingWhatsAppAccount",2);m([y()],g.prototype,"newWhatsAppAccountName",2);m([y()],g.prototype,"whatsappAccountError",2);m([y()],g.prototype,"whatsappAccountSaving",2);m([y()],g.prototype,"whatsappSettingsOpen",2);m([y()],g.prototype,"publicChatToggleBusy",2);m([y()],g.prototype,"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,"licenseKey",2);m([y()],g.prototype,"licenseBusy",2);m([y()],g.prototype,"licenseValid",2);m([y()],g.prototype,"licenseMessage",2);m([y()],g.prototype,"licenseTier",2);m([y()],g.prototype,"licenseDeviceId",2);m([y()],g.prototype,"licenseStoredKey",2);m([y()],g.prototype,"licenseRemoveConfirm",2);m([y()],g.prototype,"authConnected",2);m([y()],g.prototype,"authBusy",2);m([y()],g.prototype,"authMessage",2);m([y()],g.prototype,"authUrl",2);m([y()],g.prototype,"authCodeInput",2);m([y()],g.prototype,"authExpiresIn",2);m([y()],g.prototype,"setupStep",2);m([y()],g.prototype,"gatewayHealthy",2);m([y()],g.prototype,"gatewayHealthLoading",2);m([y()],g.prototype,"gatewayHealthMessage",2);m([y()],g.prototype,"gatewayRestartBusy",2);m([y()],g.prototype,"updateAvailable",2);m([y()],g.prototype,"currentVersion",2);m([y()],g.prototype,"latestVersion",2);m([y()],g.prototype,"updateChecking",2);m([y()],g.prototype,"updateMessage",2);m([y()],g.prototype,"updateProgressSteps",2);m([y()],g.prototype,"updateLastResult",2);m([y()],g.prototype,"uninstallConfirm",2);m([y()],g.prototype,"uninstallBusy",2);m([y()],g.prototype,"uninstallDone",2);m([y()],g.prototype,"uninstallError",2);m([y()],g.prototype,"uninstallConfirmText",2);m([y()],g.prototype,"nostrProfileFormState",2);m([y()],g.prototype,"nostrProfileAccountId",2);m([y()],g.prototype,"presenceLoading",2);m([y()],g.prototype,"presenceEntries",2);m([y()],g.prototype,"presenceError",2);m([y()],g.prototype,"presenceStatus",2);m([y()],g.prototype,"agentsLoading",2);m([y()],g.prototype,"agentsList",2);m([y()],g.prototype,"agentsError",2);m([y()],g.prototype,"sessionsLoading",2);m([y()],g.prototype,"sessionsResult",2);m([y()],g.prototype,"sessionsError",2);m([y()],g.prototype,"cronLoading",2);m([y()],g.prototype,"cronJobs",2);m([y()],g.prototype,"cronStatus",2);m([y()],g.prototype,"cronError",2);m([y()],g.prototype,"cronForm",2);m([y()],g.prototype,"cronRunsJobId",2);m([y()],g.prototype,"cronRuns",2);m([y()],g.prototype,"cronBusy",2);m([y()],g.prototype,"cronNewEventModal",2);m([y()],g.prototype,"cronDetailJobId",2);m([y()],g.prototype,"browserScreencastActive",2);m([y()],g.prototype,"browserScreencastFrame",2);m([y()],g.prototype,"browserScreencastMetadata",2);m([y()],g.prototype,"browserHandoffPending",2);m([y()],g.prototype,"browserHandoffReason",2);m([y()],g.prototype,"browserHandoffId",2);m([y()],g.prototype,"browserInputMode",2);m([y()],g.prototype,"browserFullscreen",2);m([y()],g.prototype,"browserLoading",2);m([y()],g.prototype,"browserError",2);m([y()],g.prototype,"filesLoading",2);m([y()],g.prototype,"filesTree",2);m([y()],g.prototype,"filesRoot",2);m([y()],g.prototype,"filesError",2);m([y()],g.prototype,"filesSelectedPath",2);m([y()],g.prototype,"filesSelectedPaths",2);m([y()],g.prototype,"filesPreviewContent",2);m([y()],g.prototype,"filesPreviewLoading",2);m([y()],g.prototype,"filesPreviewBinary",2);m([y()],g.prototype,"filesPreviewSize",2);m([y()],g.prototype,"filesExpandedDirs",2);m([y()],g.prototype,"filesMessage",2);m([y()],g.prototype,"filesUploadBusy",2);m([y()],g.prototype,"filesReindexBusy",2);m([y()],g.prototype,"filesMemoryStatus",2);m([y()],g.prototype,"embeddingDownloading",2);m([y()],g.prototype,"filesSearchQuery",2);m([y()],g.prototype,"filesSearchResults",2);m([y()],g.prototype,"filesSearchLoading",2);m([y()],g.prototype,"filesSearchAgentId",2);m([y()],g.prototype,"auditEntries",2);m([y()],g.prototype,"auditLoading",2);m([y()],g.prototype,"auditModalOpen",2);m([y()],g.prototype,"skillsLoading",2);m([y()],g.prototype,"skillsReport",2);m([y()],g.prototype,"skillsError",2);m([y()],g.prototype,"skillsFilter",2);m([y()],g.prototype,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",2);m([y()],g.prototype,"adminsLoading",2);m([y()],g.prototype,"adminPhones",2);m([y()],g.prototype,"adminsError",2);m([y()],g.prototype,"adminsSaving",2);m([y()],g.prototype,"adminsNewPhone",2);m([y()],g.prototype,"customersLoading",2);m([y()],g.prototype,"customersSaving",2);m([y()],g.prototype,"customersRecords",2);m([y()],g.prototype,"customersError",2);m([y()],g.prototype,"customersSearchQuery",2);m([y()],g.prototype,"customersEditingId",2);m([y()],g.prototype,"customersShowAddForm",2);m([y()],g.prototype,"customersNewPhone",2);m([y()],g.prototype,"customersNewName",2);m([y()],g.prototype,"imessageEnableConfirm",2);m([y()],g.prototype,"imessageEnabling",2);m([y()],g.prototype,"infoModalOpen",2);m([y()],g.prototype,"workspaces",2);m([y()],g.prototype,"workspacesLoading",2);m([y()],g.prototype,"workspacesError",2);m([y()],g.prototype,"selectedWorkspace",2);m([y()],g.prototype,"addingWorkspace",2);m([y()],g.prototype,"newWorkspaceName",2);m([y()],g.prototype,"newWorkspacePath",2);m([y()],g.prototype,"newWorkspacePin",2);m([y()],g.prototype,"accountPinModalOpen",2);m([y()],g.prototype,"accountPinBusy",2);m([y()],g.prototype,"accountPinError",2);m([y()],g.prototype,"accountPinSuccess",2);m([y()],g.prototype,"apiKeyProviders",2);m([y()],g.prototype,"apiKeyModalOpen",2);m([y()],g.prototype,"apiKeyBusy",2);m([y()],g.prototype,"apiKeyError",2);m([y()],g.prototype,"apiKeySuccess",2);m([y()],g.prototype,"apiKeySavingProvider",2);m([y()],g.prototype,"authApiKeyMode",2);m([y()],g.prototype,"authApiKeyInput",2);m([y()],g.prototype,"authApiKeyBusy",2);m([y()],g.prototype,"authApiKeyError",2);m([y()],g.prototype,"pinChanging",2);m([y()],g.prototype,"pinChangeBusy",2);m([y()],g.prototype,"pinChangeError",2);m([y()],g.prototype,"loginChangePinMode",2);m([y()],g.prototype,"changePinBusy",2);m([y()],g.prototype,"changePinError",2);m([y()],g.prototype,"changePinSuccess",2);m([y()],g.prototype,"workspaceSaving",2);m([y()],g.prototype,"workspaceRemoveConfirm",2);m([y()],g.prototype,"renamingWorkspace",2);m([y()],g.prototype,"renameWorkspaceName",2);m([y()],g.prototype,"debugLoading",2);m([y()],g.prototype,"debugStatus",2);m([y()],g.prototype,"debugHealth",2);m([y()],g.prototype,"debugModels",2);m([y()],g.prototype,"debugHeartbeat",2);m([y()],g.prototype,"debugCallMethod",2);m([y()],g.prototype,"debugCallParams",2);m([y()],g.prototype,"debugCallResult",2);m([y()],g.prototype,"debugCallError",2);m([y()],g.prototype,"logsLoading",2);m([y()],g.prototype,"logsError",2);m([y()],g.prototype,"logsFile",2);m([y()],g.prototype,"logsEntries",2);m([y()],g.prototype,"logsFilterText",2);m([y()],g.prototype,"logsLevelFilters",2);m([y()],g.prototype,"logsAutoFollow",2);m([y()],g.prototype,"logsTruncated",2);m([y()],g.prototype,"logsCursor",2);m([y()],g.prototype,"logsLastFetchAt",2);m([y()],g.prototype,"logsLimit",2);m([y()],g.prototype,"logsMaxBytes",2);m([y()],g.prototype,"logsAtBottom",2);m([y()],g.prototype,"logsSubTab",2);m([y()],g.prototype,"sessionLogsLoading",2);m([y()],g.prototype,"sessionLogsError",2);m([y()],g.prototype,"sessionLogsEntries",2);m([y()],g.prototype,"sessionLogsFilterText",2);m([y()],g.prototype,"sessionLogsTypeFilters",2);m([y()],g.prototype,"sessionLogsAgentFilters",2);m([y()],g.prototype,"sessionLogsAgents",2);m([y()],g.prototype,"sessionLogsAutoFollow",2);m([y()],g.prototype,"sessionLogsCursors",2);m([y()],g.prototype,"sessionLogsLastFetchAt",2);m([y()],g.prototype,"sessionLogsAtBottom",2);m([y()],g.prototype,"chatUserNearBottom",2);g=m([ol("taskmaster-app")],g);
|
|
3379
|
-
//# sourceMappingURL=index-
|
|
3378
|
+
`,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.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleFunnelEnableUrl=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={...Cb},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserFullscreen=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.embeddingDownloading=!1,this.embeddingPollTimer=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.filesResolvedAgentId=void 0,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.contactsLoading=!1,this.contactsSaving=!1,this.contactsRecords=[],this.contactsError=null,this.contactsSearchQuery="",this.contactsEditingId=null,this.contactsShowAddForm=!1,this.contactsNewPhone="",this.contactsNewName="",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={...Tb},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.logsSubTab="session",this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>vh(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),_b(this)}firstUpdated(){Mb(this)}disconnectedCallback(){this.stopEmbeddingPoll(),Pb(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){Lb(this,e)}connect(){Te(this)}handleChatScroll(e){Fd(this,e)}handleLogsScroll(e){Ud(this,e)}handleSessionLogsScroll(e){Wd(this,e)}exportLogs(e,t){zd(e,t)}exportSessionLogs(e,t){jd(e,t)}resetToolStream(){io(this)}resetChatScroll(){Kd(this)}async loadAssistantIdentity(){await Qs(this)}applySettings(e){je(this,e)}setTab(e){dh(this,e)}setTheme(e,t){ph(this,e,t)}async loadOverview(){await oc(this)}async loadCron(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.cronForm={...this.cronForm,accountId:(e==null?void 0:e.whatsappAccountId)??void 0},await So(this)}async handleAbortChat(){await ac(this)}removeQueuedMessage(e){Sh(this,e)}async handleSendChat(e,t){await Ah(this,e,t)}async handleWhatsAppStart(e,t){await Rb(this,e,t)}async handleWhatsAppWait(e){await Nb(this,e)}async handleWhatsAppLogout(e){await Db(this,e)}async handleAddWhatsAppAccount(e){await Ob(this,e)}async handleRemoveWhatsAppAccount(e){await Bb(this,e)}async handleAccessCheck(){await Qa(this)}async handlePinSubmit(e,t){await ab(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await lb(this,e)}async handleLogout(){await ub(this)}toggleChangePinMode(){this.loginChangePinMode=!this.loginChangePinMode,this.changePinError=null,this.changePinSuccess=null}async handleChangePin(e,t,n){if(this.client){this.changePinBusy=!0,this.changePinError=null,this.changePinSuccess=null;try{const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.changePinError=i.message??"Incorrect current PIN",this.changePinBusy=!1;return}e==="__master__"?await this.client.request("access.setMasterPin",{pin:n}):await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.changePinSuccess="PIN changed successfully",this.changePinBusy=!1,setTimeout(()=>{this.loginChangePinMode=!1,this.changePinSuccess=null},2e3)}catch{this.changePinError="Failed to change PIN",this.changePinBusy=!1}}}async handleAccountPinSave(e,t,n){if(this.client){this.accountPinBusy=!0,this.accountPinError=null,this.accountPinSuccess=null;try{if(t!==null){const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.accountPinError=i.message??"Incorrect current PIN",this.accountPinBusy=!1;return}}await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.accountPinSuccess="PIN saved",this.accountPinBusy=!1,await Qa(this),setTimeout(()=>{this.accountPinModalOpen=!1,this.accountPinSuccess=null,this.accountPinError=null},1500)}catch{this.accountPinError="Failed to save PIN",this.accountPinBusy=!1}}}async handleLicenseStatusCheck(){await Jb(this)}async handleLicenseActivate(){await ew(this)}async handleLicenseRemove(){await tw(this)}handleLicenseKeyChange(e){nw(this,e)}async handleAuthStatusCheck(){await Gb(this)}async handleAuthStart(){await Qb(this)}async handleAuthSubmitCode(e){await Yb(this,e)}handleAuthCodeChange(e){Xb(this,e)}handleSkipToWhatsApp(){Zb(this)}async handleGatewayHealthCheck(){await iw(this)}async handleGatewayRestart(){await sw(this)}async handleUpdateCheck(){await au(this)}async handleUpdateRun(){await Hv(this)}handleUpdateDismissResult(){Gv(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 se(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>Rr);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){se(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>Rr);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await Zl(this)}async clearAudit(){await Vp(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,yn(this,t),go(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();se(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>pb);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.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}se(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>$s);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this)})}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.loadCron(),this.advancedTab==="logs"&&(this.logsSubTab==="session"?se(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>Xl);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):se(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>rp);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&se(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>Up);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Fb(this)}async handleChannelConfigReload(){await Ub(this)}handleNostrProfileEdit(e,t){Kb(this,e,t)}handleNostrProfileCancel(){zb(this)}handleNostrProfileFieldChange(e,t){jb(this,e,t)}async handleNostrProfileSave(){await qb(this)}async handleNostrProfileImport(){await Vb(this)}handleNostrProfileToggleAdvanced(){Hb(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;se(async()=>{const{loadContacts:t}=await Promise.resolve().then(()=>hb);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 se(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>jn);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await se(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>jn);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await se(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>tp);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 se(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>jn);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=(e==null?void 0:e.displayName)??(e==null?void 0:e.name)??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await se(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>jn);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),kr(e),this.settings=qi(),this.chatMessage="",this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.reloadCurrentPageData()}getSelectedWorkspaceInfo(){return this.selectedWorkspace?this.workspaces.find(e=>e.name===this.selectedWorkspace)??null:null}reloadCurrentPageData(){this.loadAuditEntries(),this.adminsPage?this.handleAdminsLoad():this.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)}kr(this.selectedWorkspace),this.settings=qi(),this.reloadCurrentPageData()}render(){return p`${xb(this)}${this.auditModalOpen?Eb(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):S}`}};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,"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,"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,"licenseKey",2);m([y()],g.prototype,"licenseBusy",2);m([y()],g.prototype,"licenseValid",2);m([y()],g.prototype,"licenseMessage",2);m([y()],g.prototype,"licenseTier",2);m([y()],g.prototype,"licenseDeviceId",2);m([y()],g.prototype,"licenseStoredKey",2);m([y()],g.prototype,"licenseRemoveConfirm",2);m([y()],g.prototype,"authConnected",2);m([y()],g.prototype,"authBusy",2);m([y()],g.prototype,"authMessage",2);m([y()],g.prototype,"authUrl",2);m([y()],g.prototype,"authCodeInput",2);m([y()],g.prototype,"authExpiresIn",2);m([y()],g.prototype,"setupStep",2);m([y()],g.prototype,"gatewayHealthy",2);m([y()],g.prototype,"gatewayHealthLoading",2);m([y()],g.prototype,"gatewayHealthMessage",2);m([y()],g.prototype,"gatewayRestartBusy",2);m([y()],g.prototype,"updateAvailable",2);m([y()],g.prototype,"currentVersion",2);m([y()],g.prototype,"latestVersion",2);m([y()],g.prototype,"updateChecking",2);m([y()],g.prototype,"updateMessage",2);m([y()],g.prototype,"updateProgressSteps",2);m([y()],g.prototype,"updateLastResult",2);m([y()],g.prototype,"uninstallConfirm",2);m([y()],g.prototype,"uninstallBusy",2);m([y()],g.prototype,"uninstallDone",2);m([y()],g.prototype,"uninstallError",2);m([y()],g.prototype,"uninstallConfirmText",2);m([y()],g.prototype,"nostrProfileFormState",2);m([y()],g.prototype,"nostrProfileAccountId",2);m([y()],g.prototype,"presenceLoading",2);m([y()],g.prototype,"presenceEntries",2);m([y()],g.prototype,"presenceError",2);m([y()],g.prototype,"presenceStatus",2);m([y()],g.prototype,"agentsLoading",2);m([y()],g.prototype,"agentsList",2);m([y()],g.prototype,"agentsError",2);m([y()],g.prototype,"sessionsLoading",2);m([y()],g.prototype,"sessionsResult",2);m([y()],g.prototype,"sessionsError",2);m([y()],g.prototype,"cronLoading",2);m([y()],g.prototype,"cronJobs",2);m([y()],g.prototype,"cronStatus",2);m([y()],g.prototype,"cronError",2);m([y()],g.prototype,"cronForm",2);m([y()],g.prototype,"cronRunsJobId",2);m([y()],g.prototype,"cronRuns",2);m([y()],g.prototype,"cronBusy",2);m([y()],g.prototype,"cronNewEventModal",2);m([y()],g.prototype,"cronDetailJobId",2);m([y()],g.prototype,"browserScreencastActive",2);m([y()],g.prototype,"browserScreencastFrame",2);m([y()],g.prototype,"browserScreencastMetadata",2);m([y()],g.prototype,"browserHandoffPending",2);m([y()],g.prototype,"browserHandoffReason",2);m([y()],g.prototype,"browserHandoffId",2);m([y()],g.prototype,"browserInputMode",2);m([y()],g.prototype,"browserFullscreen",2);m([y()],g.prototype,"browserLoading",2);m([y()],g.prototype,"browserError",2);m([y()],g.prototype,"filesLoading",2);m([y()],g.prototype,"filesTree",2);m([y()],g.prototype,"filesRoot",2);m([y()],g.prototype,"filesError",2);m([y()],g.prototype,"filesSelectedPath",2);m([y()],g.prototype,"filesSelectedPaths",2);m([y()],g.prototype,"filesPreviewContent",2);m([y()],g.prototype,"filesPreviewLoading",2);m([y()],g.prototype,"filesPreviewBinary",2);m([y()],g.prototype,"filesPreviewSize",2);m([y()],g.prototype,"filesExpandedDirs",2);m([y()],g.prototype,"filesMessage",2);m([y()],g.prototype,"filesUploadBusy",2);m([y()],g.prototype,"filesReindexBusy",2);m([y()],g.prototype,"filesMemoryStatus",2);m([y()],g.prototype,"embeddingDownloading",2);m([y()],g.prototype,"filesSearchQuery",2);m([y()],g.prototype,"filesSearchResults",2);m([y()],g.prototype,"filesSearchLoading",2);m([y()],g.prototype,"filesSearchAgentId",2);m([y()],g.prototype,"auditEntries",2);m([y()],g.prototype,"auditLoading",2);m([y()],g.prototype,"auditModalOpen",2);m([y()],g.prototype,"skillsLoading",2);m([y()],g.prototype,"skillsReport",2);m([y()],g.prototype,"skillsError",2);m([y()],g.prototype,"skillsFilter",2);m([y()],g.prototype,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",2);m([y()],g.prototype,"adminsLoading",2);m([y()],g.prototype,"adminPhones",2);m([y()],g.prototype,"adminsError",2);m([y()],g.prototype,"adminsSaving",2);m([y()],g.prototype,"adminsNewPhone",2);m([y()],g.prototype,"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,"imessageEnableConfirm",2);m([y()],g.prototype,"imessageEnabling",2);m([y()],g.prototype,"infoModalOpen",2);m([y()],g.prototype,"workspaces",2);m([y()],g.prototype,"workspacesLoading",2);m([y()],g.prototype,"workspacesError",2);m([y()],g.prototype,"selectedWorkspace",2);m([y()],g.prototype,"addingWorkspace",2);m([y()],g.prototype,"newWorkspaceName",2);m([y()],g.prototype,"newWorkspacePath",2);m([y()],g.prototype,"newWorkspacePin",2);m([y()],g.prototype,"accountPinModalOpen",2);m([y()],g.prototype,"accountPinBusy",2);m([y()],g.prototype,"accountPinError",2);m([y()],g.prototype,"accountPinSuccess",2);m([y()],g.prototype,"apiKeyProviders",2);m([y()],g.prototype,"apiKeyModalOpen",2);m([y()],g.prototype,"apiKeyBusy",2);m([y()],g.prototype,"apiKeyError",2);m([y()],g.prototype,"apiKeySuccess",2);m([y()],g.prototype,"apiKeySavingProvider",2);m([y()],g.prototype,"authApiKeyMode",2);m([y()],g.prototype,"authApiKeyInput",2);m([y()],g.prototype,"authApiKeyBusy",2);m([y()],g.prototype,"authApiKeyError",2);m([y()],g.prototype,"pinChanging",2);m([y()],g.prototype,"pinChangeBusy",2);m([y()],g.prototype,"pinChangeError",2);m([y()],g.prototype,"loginChangePinMode",2);m([y()],g.prototype,"changePinBusy",2);m([y()],g.prototype,"changePinError",2);m([y()],g.prototype,"changePinSuccess",2);m([y()],g.prototype,"workspaceSaving",2);m([y()],g.prototype,"workspaceRemoveConfirm",2);m([y()],g.prototype,"renamingWorkspace",2);m([y()],g.prototype,"renameWorkspaceName",2);m([y()],g.prototype,"debugLoading",2);m([y()],g.prototype,"debugStatus",2);m([y()],g.prototype,"debugHealth",2);m([y()],g.prototype,"debugModels",2);m([y()],g.prototype,"debugHeartbeat",2);m([y()],g.prototype,"debugCallMethod",2);m([y()],g.prototype,"debugCallParams",2);m([y()],g.prototype,"debugCallResult",2);m([y()],g.prototype,"debugCallError",2);m([y()],g.prototype,"logsLoading",2);m([y()],g.prototype,"logsError",2);m([y()],g.prototype,"logsFile",2);m([y()],g.prototype,"logsEntries",2);m([y()],g.prototype,"logsFilterText",2);m([y()],g.prototype,"logsLevelFilters",2);m([y()],g.prototype,"logsAutoFollow",2);m([y()],g.prototype,"logsTruncated",2);m([y()],g.prototype,"logsCursor",2);m([y()],g.prototype,"logsLastFetchAt",2);m([y()],g.prototype,"logsLimit",2);m([y()],g.prototype,"logsMaxBytes",2);m([y()],g.prototype,"logsAtBottom",2);m([y()],g.prototype,"logsSubTab",2);m([y()],g.prototype,"sessionLogsLoading",2);m([y()],g.prototype,"sessionLogsError",2);m([y()],g.prototype,"sessionLogsEntries",2);m([y()],g.prototype,"sessionLogsFilterText",2);m([y()],g.prototype,"sessionLogsTypeFilters",2);m([y()],g.prototype,"sessionLogsAgentFilters",2);m([y()],g.prototype,"sessionLogsAgents",2);m([y()],g.prototype,"sessionLogsAutoFollow",2);m([y()],g.prototype,"sessionLogsCursors",2);m([y()],g.prototype,"sessionLogsLastFetchAt",2);m([y()],g.prototype,"sessionLogsAtBottom",2);m([y()],g.prototype,"chatUserNearBottom",2);g=m([rl("taskmaster-app")],g);
|
|
3379
|
+
//# sourceMappingURL=index-Bem0-Ojd.js.map
|