@rubytech/taskmaster 1.25.1 → 1.26.1

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.
@@ -17,7 +17,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Mn(t.
17
17
  `],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function gh(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
18
18
  `)}
19
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 mh(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 lt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Ct(e){return`${JSON.stringify(e,null,2).trimEnd()}
20
- `}function cc(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const a=t[o],r=t[o+1];if(typeof a=="number"){if(!Array.isArray(i))return;i[a]==null&&(i[a]=typeof r=="number"?[]:{}),i=i[a]}else{if(typeof i!="object"||i==null)return;const l=i;l[a]==null&&(l[a]=typeof r=="number"?[]:{}),i=l[a]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function We(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});vh(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function dc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});yh(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function yh(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function vh(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?Ct(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=Ct(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=lt(t.config??{}),e.configFormOriginal=lt(t.config??{}),e.configRawOriginal=n)}async function bh(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?Ct(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 We(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function on(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 jn(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),e.accountId&&(t.accountId=e.accountId);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 uc(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=Ni(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 pc(e){if(e.payloadKind==="systemEvent"){const o=e.payloadText.trim();if(!o)throw new Error("System event text required.");return{kind:"systemEvent",text:o}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel);const i=[];e.toAdmins&&i.push("admins");for(const o of e.recipients){const a=o.trim();a&&i.push(a)}i.length>0&&(n.to=i.join(","));const s=Ni(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function wh(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=uc(e.cronForm),i=pc(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:o||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await jn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function kh(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 jn(e),await on(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function xh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null,e.cronRunModalJobId=t.id,e.cronRunModalJobName=t.name||"Untitled",e.cronRunResult=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await Ao(e,t.id)}catch(n){e.cronError=String(n),e.cronRunResult={status:"error",error:String(n)}}finally{e.cronBusy=!1}}}function $h(e,t){e.cronRunModalJobId&&t.jobId===e.cronRunModalJobId&&t.action==="finished"&&(e.cronRunResult={status:t.status??"unknown",durationMs:t.durationMs,summary:t.summary,outputText:t.outputText,error:t.error})}async function Sh(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 jn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}function Ah(e){var n;const t={name:e.name||"",description:e.description||"",agentId:e.agentId||"",enabled:e.enabled,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"",cronTz:"",sessionTarget:e.sessionTarget||"main",wakeMode:e.wakeMode||"next-heartbeat",payloadKind:e.payload.kind,payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};if(e.schedule.kind==="at"){const i=new Date(e.schedule.atMs),s=o=>String(o).padStart(2,"0");t.scheduleAt=`${i.getFullYear()}-${s(i.getMonth()+1)}-${s(i.getDate())}T${s(i.getHours())}:${s(i.getMinutes())}`}else if(e.schedule.kind==="every"){const i=e.schedule.everyMs;i%864e5===0?(t.everyAmount=String(i/864e5),t.everyUnit="days"):i%36e5===0?(t.everyAmount=String(i/36e5),t.everyUnit="hours"):(t.everyAmount=String(i/6e4),t.everyUnit="minutes")}else e.schedule.kind==="cron"&&(t.cronExpr=e.schedule.expr,t.cronTz=e.schedule.tz||"");if(e.payload.kind==="systemEvent")t.payloadText=e.payload.text;else if(e.payload.kind==="agentTurn"){t.payloadText=e.payload.message,t.deliver=e.payload.deliver??!1,t.timeoutSeconds=e.payload.timeoutSeconds?String(e.payload.timeoutSeconds):"";const i=e.payload.channel??e.payload.provider;t.channel=i||"last";const s=e.payload.to||"";if(s){const o=s.split(",").map(a=>a.trim()).filter(Boolean);t.toAdmins=o.some(a=>a.toLowerCase()==="admins"),t.recipients=o.filter(a=>a.toLowerCase()!=="admins")}}return(n=e.isolation)!=null&&n.postToMainPrefix&&(t.postToMainPrefix=e.isolation.postToMainPrefix),t}async function Ch(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=uc(e.cronForm),i=pc(e.cronForm),s={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:e.cronForm.agentId.trim()||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i};if(e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?s.isolation={postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:s.isolation=void 0,!s.name)throw new Error("Name required.");await e.client.request("cron.update",{id:t,patch:s}),await jn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ao(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function Z(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 ia(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 hc(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 fc(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 gc(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=lt(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const a=o.channels;(!a.whatsapp||typeof a.whatsapp!="object")&&(a.whatsapp={});const r=a.whatsapp;(!r.accounts||typeof r.accounts!="object")&&(r.accounts={});const l=r.accounts;if(l[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}l[i]={name:n,provider:"baileys"};const d=s.hash;if(!d){e.whatsappAccountError="Config hash missing; reload and retry.";return}const h=Ct(o);await e.client.request("config.set",{raw:h,baseHash:d}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await Z(e,!0),await ia(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function mc(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=lt(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,a=o==null?void 0:o.accounts;if(!a){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(a).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!a[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete a[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(h=>{const u=h.match;return!u||u.channel!=="whatsapp"?!0:u.accountId!==t}));const l=n.hash;if(!l){e.whatsappAccountError="Config hash missing; reload and retry.";return}const d=Ct(i);await e.client.request("config.set",{raw:d,baseHash:l}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await Z(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const Eh=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:gc,loadChannels:Z,logoutWhatsApp:fc,removeWhatsAppAccount:mc,startWhatsAppLogin:ia,waitWhatsAppLogin:hc},Symbol.toStringTag,{value:"Module"}));async function sa(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 oa="taskmaster-access-session",yc={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function aa(){try{return localStorage.getItem(oa)}catch{return null}}function vc(e){try{localStorage.setItem(oa,e)}catch{}}function Th(){try{localStorage.removeItem(oa)}catch{}}async function Er(e){if(e.client)try{const t=aa(),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 _h(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?(vc(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 Mh(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?(vc(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 Ph(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 Ih(e){const t=aa();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}Th(),e.accessState={...yc,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}const Rh=2e3,Lh=new Set(["trace","debug","info","warn","error","fatal"]);function Dh(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 Bh(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Lh.has(t)?t:null}function bc(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=Bh((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),o=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,a=Dh(o);let r=null;a&&(typeof a.subsystem=="string"?r=a.subsystem:typeof a.module=="string"&&(r=a.module)),!r&&o&&o.length<120&&(r=o);let l=null;return typeof t[1]=="string"?l=t[1]:!a&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:i,level:s,subsystem:r,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function bt(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,date:e.logsDate??void 0,accessToken:aa()??void 0}),o=(Array.isArray(i.lines)?i.lines.filter(r=>typeof r=="string"):[]).map(bc),a=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=a?o:[...e.logsEntries,...o].slice(-Rh),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),Array.isArray(i.availableDates)&&(e.logsAvailableDates=i.availableDates.filter(r=>typeof r=="string")),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const Nh=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:bt,parseLogLine:bc},Symbol.toStringTag,{value:"Module"}));const wc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Ai,Gx:Tr,Gy:_r,a:Ws,d:zs,h:Oh}=wc,Et=32,ra=64,Fh=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},re=(e="")=>{const t=new Error(e);throw Fh(t,re),t},Uh=e=>typeof e=="bigint",Wh=e=>typeof e=="string",zh=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",ct=(e,t,n="")=>{const i=zh(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const a=n&&`"${n}" `,r=o?` of length ${t}`:"",l=i?`length=${s}`:`type=${typeof e}`;re(a+"expected Uint8Array"+r+", got "+l)}return e},cs=e=>new Uint8Array(e),kc=e=>Uint8Array.from(e),xc=(e,t)=>e.toString(16).padStart(t,"0"),$c=e=>Array.from(ct(e)).map(t=>xc(t,2)).join(""),Ge={_0:48,_9:57,A:65,F:70,a:97,f:102},Mr=e=>{if(e>=Ge._0&&e<=Ge._9)return e-Ge._0;if(e>=Ge.A&&e<=Ge.F)return e-(Ge.A-10);if(e>=Ge.a&&e<=Ge.f)return e-(Ge.a-10)},Sc=e=>{const t="hex invalid";if(!Wh(e))return re(t);const n=e.length,i=n/2;if(n%2)return re(t);const s=cs(i);for(let o=0,a=0;o<i;o++,a+=2){const r=Mr(e.charCodeAt(a)),l=Mr(e.charCodeAt(a+1));if(r===void 0||l===void 0)return re(t);s[o]=r*16+l}return s},Ac=()=>globalThis==null?void 0:globalThis.crypto,Kh=()=>{var e;return((e=Ac())==null?void 0:e.subtle)??re("crypto.subtle must be defined, consider polyfill")},Kn=(...e)=>{const t=cs(e.reduce((i,s)=>i+ct(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},Hh=(e=Et)=>Ac().getRandomValues(cs(e)),Fi=BigInt,gt=(e,t,n,i="bad number: out of range")=>Uh(e)&&t<=e&&e<n?e:re(i),L=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Cc=e=>L(e,Ai),qh=(e,t)=>{(e===0n||t<=0n)&&re("no inverse n="+e+" mod="+t);let n=L(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const a=i/n,r=i%n,l=s-o*a;i=n,n=r,s=o,o=l}return i===1n?L(s,t):re("no inverse")},jh=e=>{const t=Mc[e];return typeof t!="function"&&re("hashes."+e+" not set"),t},Ks=e=>e instanceof Tt?e:re("Point expected"),Co=2n**256n,Ue=class Ue{constructor(t,n,i,s){q(this,"X");q(this,"Y");q(this,"Z");q(this,"T");const o=Co;this.X=gt(t,0n,o),this.Y=gt(n,0n,o),this.Z=gt(i,1n,o),this.T=gt(s,0n,o),Object.freeze(this)}static CURVE(){return wc}static fromAffine(t){return new Ue(t.x,t.y,1n,L(t.x*t.y))}static fromBytes(t,n=!1){const i=zs,s=kc(ct(t,Et)),o=t[31];s[31]=o&-129;const a=Tc(s);gt(a,0n,n?Co:ue);const l=L(a*a),d=L(l-1n),h=L(i*l+1n);let{isValid:u,value:p}=Vh(d,h);u||re("bad point: y not sqrt");const v=(p&1n)===1n,$=(o&128)!==0;return!n&&p===0n&&$&&re("bad point: x==0, isLastByteOdd"),$!==v&&(p=L(-p)),new Ue(p,a,1n,L(p*a))}static fromHex(t,n){return Ue.fromBytes(Sc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Ws,n=zs,i=this;if(i.is0())return re("bad point: ZERO");const{X:s,Y:o,Z:a,T:r}=i,l=L(s*s),d=L(o*o),h=L(a*a),u=L(h*h),p=L(l*t),v=L(h*L(p+d)),$=L(u+L(n*L(l*d)));if(v!==$)return re("bad point: equation left != right (1)");const S=L(s*o),M=L(a*r);return S!==M?re("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:a,Z:r}=Ks(t),l=L(n*r),d=L(o*s),h=L(i*r),u=L(a*s);return l===d&&h===u}is0(){return this.equals(jt)}negate(){return new Ue(L(-this.X),this.Y,this.Z,L(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=Ws,o=L(t*t),a=L(n*n),r=L(2n*L(i*i)),l=L(s*o),d=t+n,h=L(L(d*d)-o-a),u=l+a,p=u-r,v=l-a,$=L(h*p),S=L(u*v),M=L(h*v),y=L(p*u);return new Ue($,S,y,M)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:r,Z:l,T:d}=Ks(t),h=Ws,u=zs,p=L(n*a),v=L(i*r),$=L(o*u*d),S=L(s*l),M=L((n+i)*(a+r)-p-v),y=L(S-$),b=L(S+$),k=L(v-h*p),A=L(M*y),E=L(b*k),T=L(M*k),P=L(y*b);return new Ue(A,E,P,T)}subtract(t){return this.add(Ks(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return jt;if(gt(t,1n,Ai),t===1n)return this;if(this.equals(_t))return af(t).p;let i=jt,s=_t;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(jt))return{x:0n,y:1n};const s=qh(i,ue);L(i*s)!==1n&&re("invalid inverse");const o=L(t*s),a=L(n*s);return{x:o,y:a}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Ec(n);return i[31]|=t&1n?128:0,i}toHex(){return $c(this.toBytes())}clearCofactor(){return this.multiply(Fi(Oh),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Ai/2n,!1).double();return Ai%2n&&(t=t.add(this)),t.is0()}};q(Ue,"BASE"),q(Ue,"ZERO");let Tt=Ue;const _t=new Tt(Tr,_r,1n,L(Tr*_r)),jt=new Tt(0n,1n,1n,0n);Tt.BASE=_t;Tt.ZERO=jt;const Ec=e=>Sc(xc(gt(e,0n,Co),ra)).reverse(),Tc=e=>Fi("0x"+$c(kc(ct(e)).reverse())),De=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},Gh=e=>{const n=e*e%ue*e%ue,i=De(n,2n)*n%ue,s=De(i,1n)*e%ue,o=De(s,5n)*s%ue,a=De(o,10n)*o%ue,r=De(a,20n)*a%ue,l=De(r,40n)*r%ue,d=De(l,80n)*l%ue,h=De(d,80n)*l%ue,u=De(h,10n)*o%ue;return{pow_p_5_8:De(u,2n)*e%ue,b2:n}},Pr=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Vh=(e,t)=>{const n=L(t*t*t),i=L(n*n*t),s=Gh(e*i).pow_p_5_8;let o=L(e*n*s);const a=L(t*o*o),r=o,l=L(o*Pr),d=a===e,h=a===L(-e),u=a===L(-e*Pr);return d&&(o=r),(h||u)&&(o=l),(L(o)&1n)===1n&&(o=L(-o)),{isValid:d||h,value:o}},Eo=e=>Cc(Tc(e)),la=(...e)=>Mc.sha512Async(Kn(...e)),Qh=(...e)=>jh("sha512")(Kn(...e)),_c=e=>{const t=e.slice(0,Et);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Et,ra),i=Eo(t),s=_t.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},ca=e=>la(ct(e,Et)).then(_c),Jh=e=>_c(Qh(ct(e,Et))),Yh=e=>ca(e).then(t=>t.pointBytes),Xh=e=>la(e.hashable).then(e.finish),Zh=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=Eo(t),a=_t.multiply(o).toBytes();return{hashable:Kn(a,i,n),finish:d=>{const h=Cc(o+Eo(d)*s);return ct(Kn(a,Ec(h)),ra)}}},ef=async(e,t)=>{const n=ct(e),i=await ca(t),s=await la(i.prefix,n);return Xh(Zh(i,s,n))},Mc={sha512Async:async e=>{const t=Kh(),n=Kn(e);return cs(await t.digest("SHA-512",n.buffer))},sha512:void 0},tf=(e=Hh(Et))=>e,nf={getExtendedPublicKeyAsync:ca,getExtendedPublicKey:Jh,randomSecretKey:tf},Ui=8,sf=256,Pc=Math.ceil(sf/Ui)+1,To=2**(Ui-1),of=()=>{const e=[];let t=_t,n=t;for(let i=0;i<Pc;i++){n=t,e.push(n);for(let s=1;s<To;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Ir;const Rr=(e,t)=>{const n=t.negate();return e?n:t},af=e=>{const t=Ir||(Ir=of());let n=jt,i=_t;const s=2**Ui,o=s,a=Fi(s-1),r=Fi(Ui);for(let l=0;l<Pc;l++){let d=Number(e&a);e>>=r,d>To&&(d-=o,e+=1n);const h=l*To,u=h,p=h+Math.abs(d)-1,v=l%2!==0,$=d<0;d===0?i=i.add(Rr(v,t[u])):n=n.add(Rr($,t[p]))}return e!==0n&&re("invalid wnaf"),{p:n,f:i}},Hs="taskmaster-device-identity-v1";function _o(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Ic(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 rf(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Rc(e){const t=await crypto.subtle.digest("SHA-256",e);return rf(new Uint8Array(t))}async function lf(){const e=nf.randomSecretKey(),t=await Yh(e);return{deviceId:await Rc(t),publicKey:_o(t),privateKey:_o(e)}}async function cf(){try{const n=localStorage.getItem(Hs);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 Rc(Ic(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(Hs,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 lf(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Hs,JSON.stringify(t)),e}async function df(e,t){const n=Ic(e),i=new TextEncoder().encode(t),s=await ef(i,n);return _o(s)}const Lc="taskmaster.device.auth.v1";function da(e){return e.trim()}function uf(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 ua(){try{const e=window.localStorage.getItem(Lc);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 Dc(e){try{window.localStorage.setItem(Lc,JSON.stringify(e))}catch{}}function pf(e){const t=ua();if(!t||t.deviceId!==e.deviceId)return null;const n=da(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function hf(e){const t=da(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=ua();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:uf(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Dc(n),s}function ff(e){const t=ua();if(!t||t.deviceId!==e.deviceId)return;const n=da(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Dc(i)}async function pa(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 ha(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 gf(e){return{method:"exec.approvals.get",params:{}}}async function mf(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=gf(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);yf(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function yf(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=lt(t.file??{}))}async function Bc(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 xe(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function $e(e){return e instanceof Error?e.message:String(e)}function Hn(){return{name:"",skillContent:"",references:[],alwaysActive:!1}}async function Pe(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=$e(n)}finally{e.skillsLoading=!1}}}function Nc(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Oc(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 Pe(e),xe(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=$e(i);e.skillsError=s,xe(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Fc(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await Pe(e),xe(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=$e(n);e.skillsError=i,xe(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Uc(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 Pe(e),xe(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=$e(s);e.skillsError=o,xe(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}async function Wc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});n&&(e.skillDetail=n,e.skillDetailTab="SKILL.md")}catch(n){e.skillsError=$e(n)}}function zc(e){e.skillDetail=null,e.skillDetailTab=""}function Kc(e,t){e.skillDetailTab=t}async function Hc(e){if(e.skillAddModal=!0,e.skillAddForm=Hn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[],!(!e.client||!e.connected))try{const t=await e.client.request("skills.drafts",{});t&&(e.skillDrafts=t.drafts)}catch{}}function qc(e){e.skillAddModal=!1,e.skillAddForm=Hn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[]}function jc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n})),alwaysActive:!1},e.skillAddFormSource="draft"}async function Gc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n})),alwaysActive:!1},e.skillAddFormSource="installed",await fa(e)}async function fa(e){if(!e.client||!e.connected)return;const t=e.skillAddForm;if(!(!t.name.trim()||!t.skillContent.trim())){e.skillsBusyKey="__add__",e.skillsError=null;try{const n=t.references.filter(s=>s.name.trim()&&s.content.trim()).map(s=>({name:s.name.trim(),content:s.content})),i=t.name.trim();e.skillAddFormSource==="installed"?(await e.client.request("skills.create",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0,alwaysActive:t.alwaysActive}),e.skillAddModal=!1,e.skillAddForm=Hn(),e.skillAddFormSource="draft",e.skillDrafts=[],await Pe(e),xe(e,i,{kind:"success",message:"Skill saved — active on next message"})):(await e.client.request("skills.saveDraft",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Hn(),e.skillAddFormSource="draft",e.skillDrafts=[],xe(e,i,{kind:"success",message:"Draft saved"}))}catch(n){e.skillsError=$e(n)}finally{e.skillsBusyKey=null}}}async function Vc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("skills.deleteDraft",{name:t}),e.skillDrafts=e.skillDrafts.filter(n=>n.name!==t)}catch(n){e.skillsError=$e(n)}}async function Qc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});if(!n)return;e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i})),alwaysActive:n.alwaysActive??!1},e.skillAddFormSource="installed",e.skillAddModal=!0,e.skillDrafts=[]}catch(n){e.skillsError=$e(n)}}function Jc(e,t){const n=e.skillDetail;n&&(e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i})),alwaysActive:n.alwaysActive??!1},e.skillAddFormSource="installed",e.skillEditTab=t&&t!=="SKILL.md"?t:"SKILL.md",e.skillDetail=null,e.skillDetailTab="",e.skillAddModal=!0,e.skillDrafts=[])}function Yc(e,t,n){e.skillAddForm={...e.skillAddForm,references:e.skillAddForm.references.map(i=>i.name===t?{...i,content:n}:i)}}function Xc(e,t){e.skillEditTab=t}async function Zc(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.read",{name:t});if(!i)return;const s=i.references.filter(o=>o.name.trim()&&o.content.trim()).map(o=>({name:o.name.trim(),content:o.content}));await e.client.request("skills.create",{name:t,skillContent:i.content,references:s.length>0?s:void 0,alwaysActive:n}),await Pe(e),xe(e,t,{kind:"success",message:n?"Skill is now always active":"Skill loads on demand"})}catch(i){e.skillsError=$e(i),xe(e,t,{kind:"error",message:$e(i)})}finally{e.skillsBusyKey=null}}}async function ed(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,agents:n}),await Pe(e),xe(e,t,{kind:"success",message:"Agent access updated"})}catch(i){const s=$e(i);e.skillsError=s,xe(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function td(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.delete",{name:t}),await Pe(e)}catch(n){e.skillsError=$e(n)}finally{e.skillsBusyKey=null}}}const vf=Object.freeze(Object.defineProperty({__proto__:null,closeAddSkillModal:qc,closeSkillDetail:zc,deleteDraft:Vc,deleteSkill:td,editDetailSkill:Jc,editSkill:Qc,emptyAddForm:Hn,importDraft:jc,installDraft:Gc,installSkill:Uc,loadSkills:Pe,openAddSkillModal:Hc,saveNewSkill:fa,saveSkillApiKey:Fc,setEditTab:Xc,setSkillDetailTab:Kc,toggleAlwaysActive:Zc,updateFormReference:Yc,updateSkillAgents:ed,updateSkillEdit:Nc,updateSkillEnabled:Oc,viewSkillDetail:Wc},Symbol.toStringTag,{value:"Module"})),nd={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},id=new Map(Object.entries(nd).map(([e,t])=>[t,e]));function ds(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function qn(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 bf(e,t=""){const n=ds(t),i=nd[e];return n?`${n}${i}`:i}function sd(e,t=""){const n=ds(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=qn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":id.get(s)??null}function wf(e){let t=qn(e);if(t.endsWith("/index.html")&&(t=qn(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(id.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function kf(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ga(e){return e==="system"?kf():e}const di=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,xf=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,ui=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},$f=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var d;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,a=s,r=xf();if(!!a.startViewTransition&&!r){let h=.5,u=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")h=di(n.pointerClientX/window.innerWidth),u=di(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(h=di((p.left+p.width/2)/window.innerWidth),u=di((p.top+p.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${h*100}%`),o.style.setProperty("--theme-switch-y",`${u*100}%`),o.classList.add("theme-transition");try{const p=(d=a.startViewTransition)==null?void 0:d.call(a,()=>{t()});p!=null&&p.finished?p.finished.finally(()=>ui(o)):ui(o)}catch{ui(o),t()}return}t(),ui(o)},Sf=2e3;async function Pn(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),o=Array.isArray(s.entries)?s.entries:[],a=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=a?o:[...e.sessionLogsEntries,...o].slice(-Sf),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 od=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:Pn},Symbol.toStringTag,{value:"Module"}));async function ad(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 Af(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function ze(e){return e instanceof Error?e.message:String(e)}let pi=null;function an(e,t){pi&&clearTimeout(pi),e.filesMessage={kind:"success",text:t},pi=setTimeout(()=>{e.filesMessage=null,pi=null},3e3)}async function rn(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=ze(n)}finally{e.filesLoading=!1}}}}async function Cf(e,t,n){e.filesSelectedPaths=new Set([t]),await rd(e,t,n)}async function Ef(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 rd(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Tf(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 ld(e,o,t),i++}catch(a){s=ze(a)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:an(e,`${i} file${i!==1?"s":""} downloaded`)}async function _f(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await Rf(e,t,o,i)}async function rd(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=ze(i)}finally{e.filesPreviewLoading=!1}}}async function ld(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),d=>d.charCodeAt(0)),a=new Blob([o]),r=URL.createObjectURL(a),l=document.createElement("a");l.href=r,l.download=s.name??t.split("/").pop()??"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(r)}catch(i){e.filesMessage={kind:"error",text:ze(i)}}}async function Mf(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const a of n)try{const r=await a.arrayBuffer(),l=btoa(new Uint8Array(r).reduce((h,u)=>h+String.fromCharCode(u),"")),d={path:t,name:a.name,data:l};i&&(d.agentId=i),await e.client.request("files.upload",d),s++}catch(r){o=ze(r)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:an(e,`${s} file${s!==1?"s":""} uploaded`),await rn(e,i)}async function Pf(e,t,n,i){if(!e.client||!e.connected)return;e.filesMessage=null;const s=t==="."?n:`${t}/${n}`;try{const o={path:s};i&&(o.agentId=i),await e.client.request("files.mkdir",o),an(e,`Created ${s}`),await rn(e,i),e.filesExpandedDirs=new Set([...e.filesExpandedDirs,s]),e.filesCurrentDir=s}catch(o){e.filesMessage={kind:"error",text:ze(o)}}}async function If(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),an(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await rn(e,n)}catch(i){e.filesMessage={kind:"error",text:ze(i)}}}}async function Rf(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),an(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await rn(e,i)}catch(s){e.filesMessage={kind:"error",text:ze(s)}}}}async function us(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 Lf(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;an(e,`Re-indexed: ${s} files, ${o} chunks`),await us(e,t)}catch(n){e.filesMessage={kind:"error",text:ze(n)}}finally{e.filesReindexBusy=!1}}}function Df(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n,e.filesCurrentDir=t}async function Bf(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:ze(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function Nf(e){e.filesSearchQuery="",e.filesSearchResults=null}function Of(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{ha(e,{quiet:!0})},5e3))}function Ff(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Wi(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")&&e.logsSubTab!=="session"&&e.logsDate==null&&bt(e,{quiet:!0})},2e3))}function ma(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function zi(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||Pn(e,{quiet:!0,reset:!0})},3e3))}function ya(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function va(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&sa(e)},3e3))}function ba(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Uf(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{ad(e)},3e4))}function Wf(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function zf(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{const t=e;t.filesPage&&us(t,t.filesResolvedAgentId)},3e3))}function Kf(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function at(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,Ip(n),t.theme!==e.theme&&(e.theme=t.theme,ps(e,ga(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function cd(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&at(e,{...e.settings,lastActiveSessionKey:n})}function Hf(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),o=t.get("gatewayUrl");let a=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&at(e,{...e.settings,token:l}),t.delete("token"),a=!0}if(i!=null){const l=i.trim();l&&(e.password=l),t.delete("password"),a=!0}if(s!=null){const l=s.trim();l&&(e.sessionKey=l,at(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(o!=null){const l=o.trim();l&&l!==e.settings.gatewayUrl&&at(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),a=!0}if(!a)return;const r=new URL(window.location.href);r.search=t.toString(),window.history.replaceState({},"",r.toString())}function qf(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?zi(e):Wi(e):(ma(e),ya(e)),t==="debug"?va(e):ba(e),Ki(e),ud(e,t,!1)}function jf(e,t,n){$f({nextTheme:t,applyTheme:()=>{e.theme=t,at(e,{...e.settings,theme:t}),ps(e,ga(t))},context:n,currentTheme:e.theme})}async function Ki(e){if(e.tab==="overview"&&await pd(e),e.tab==="channels"&&await Zf(e),e.tab==="instances"&&await Bc(e),e.tab==="cron"&&await hd(e),e.tab==="skills"&&await Pe(e),e.tab==="nodes"&&(await ha(e),await pa(e),await We(e),await mf(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await sg(e),sn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await dc(e),await We(e)),e.tab==="debug"&&(await sa(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await ae(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>od);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await bt(e,{reset:!0});So(e,!0)}}function Gf(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ds(e):wf(window.location.pathname)}function Vf(e){e.theme=e.settings.theme??"system",ps(e,ga(e.theme))}function ps(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Qf(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"&&ps(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Jf(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 Yf(e,t){if(typeof window>"u")return;const n=sd(window.location.pathname,e.basePath)??"chat";dd(e,n),ud(e,n,t)}function Xf(e){var s;if(typeof window>"u")return;const t=sd(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,at(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),dd(e,t)}function dd(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?zi(e):Wi(e):(ma(e),ya(e)),t==="debug"?va(e):ba(e),e.connected&&Ki(e)}function ud(e,t,n){if(typeof window>"u")return;const i=qn(bf(t,e.basePath)),s=qn(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 pd(e){await Promise.all([Z(e,!1),Bc(e),lc(e),on(e),sa(e)])}async function Zf(e){await Promise.all([Z(e,!0),dc(e),We(e)])}async function hd(e){await Promise.all([Z(e,!1),on(e),jn(e)])}function fd(e){return e.chatSending||!!e.chatRunId}function eg(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 gd(e){e.connected&&(e.chatMessage="",await ac(e))}function tg(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:ls(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],sn(e))}async function md(e,t,n){var s,o;na(e);const i=await oc(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&&cd(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),sn(e),i&&!e.chatRunId&&yd(e),i}async function yd(e){if(!e.connected||fd(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await md(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function ng(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function ig(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],a=t==null?o:[],r=a.length>0;if(!(!s&&!r)){if(eg(s)){await gd(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[],Lp(e.selectedWorkspace??"",e.sessionKey)),fd(e)){tg(e,s,a);return}await md(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:r?a:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function sg(e){var i;const t=e,n=Math.max((((i=t.chatMessages)==null?void 0:i.length)??0)+10,nn);await Promise.all([Jt(t,{limit:n}),lc(t),Mo(e)]),sn(e,!0)}const og=yd;function ag(e){var s,o,a;const t=Yl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((a=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:a.trim())||"main"}function rg(e,t){const n=ds(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function Mo(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=ag(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=rg(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 I={messageSquare:c`<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:c`<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:c`<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:c`<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:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:c`<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:c`<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:c`<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:c`<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:c`<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:c`<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>`,user:c`<svg viewBox="0 0 24 24"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>`,menu:c`<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:c`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:c`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:c`<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:c`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:c`<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:c`<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:c`<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:c`<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>`,refreshCw:c`<svg viewBox="0 0 24 24"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>`,download:c`<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:c`<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:c`<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:c`<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:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,globeOff:c`<svg viewBox="0 0 24 24"><path d="M21.54 15H17"/><path d="M7 3.34V5a3 3 0 0 0 3 3 2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:c`<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:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:c`<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:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,mic:c`<svg viewBox="0 0 24 24"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,chevronDown:c`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,chevronLeft:c`<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>`,chevronRight:c`<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>`,film:c`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`,wifi:c`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.859a10 10 0 0 1 14 0"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/></svg>`,wifiOff:c`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/><path d="M5 12.859a10 10 0 0 1 5.17-2.69"/><path d="M13.41 10.28a10 10 0 0 1 5.59 2.58"/><path d="M2 8.82a15 15 0 0 1 4.17-2.65"/><path d="M10.66 5c4.01-.36 8.14.9 11.34 3.76"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,power:c`<svg viewBox="0 0 24 24"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"/><line x1="12" x2="12" y1="2" y2="12"/></svg>`,powerOff:c`<svg viewBox="0 0 24 24"><path d="M18.36 6.64A9 9 0 0 1 20.77 15"/><path d="M6.16 6.16a9 9 0 1 0 12.68 12.68"/><path d="M12 2v4"/><path d="m2 2 20 20"/></svg>`},lg=c`<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>`,cg=c`<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>`,dg=c`<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.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg>`;let Lr=!1;function ug(){Lr||(Lr=!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 Rt(e,t){var u;const n=(p,v)=>p===e?c`<span class="sp-page-nav-current">${p}</span>`:c`<a href=${v}>${p}</a>`,i=c`
20
+ `}function cc(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const a=t[o],r=t[o+1];if(typeof a=="number"){if(!Array.isArray(i))return;i[a]==null&&(i[a]=typeof r=="number"?[]:{}),i=i[a]}else{if(typeof i!="object"||i==null)return;const l=i;l[a]==null&&(l[a]=typeof r=="number"?[]:{}),i=l[a]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function We(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});vh(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function dc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});yh(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function yh(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function vh(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?Ct(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=Ct(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=lt(t.config??{}),e.configFormOriginal=lt(t.config??{}),e.configRawOriginal=n)}async function bh(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?Ct(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 We(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function on(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 jn(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),e.accountId&&(t.accountId=e.accountId);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 uc(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=Ni(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 pc(e){if(e.payloadKind==="systemEvent"){const o=e.payloadText.trim();if(!o)throw new Error("System event text required.");return{kind:"systemEvent",text:o}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel);const i=[];e.toAdmins&&i.push("admins");for(const o of e.recipients){const a=o.trim();a&&i.push(a)}i.length>0&&(n.to=i.join(","));const s=Ni(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function wh(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=uc(e.cronForm),i=pc(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:o||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await jn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function kh(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 jn(e),await on(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function xh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null,e.cronRunModalJobId=t.id,e.cronRunModalJobName=t.name||"Untitled",e.cronRunResult=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await Ao(e,t.id)}catch(n){e.cronError=String(n),e.cronRunResult={status:"error",error:String(n)}}finally{e.cronBusy=!1}}}function $h(e,t){e.cronRunModalJobId&&t.jobId===e.cronRunModalJobId&&t.action==="finished"&&(e.cronRunResult={status:t.status??"unknown",durationMs:t.durationMs,summary:t.summary,outputText:t.outputText,error:t.error})}async function Sh(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 jn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}function Ah(e){var n;const t={name:e.name||"",description:e.description||"",agentId:e.agentId||"",enabled:e.enabled,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"",cronTz:"",sessionTarget:e.sessionTarget||"main",wakeMode:e.wakeMode||"next-heartbeat",payloadKind:e.payload.kind,payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};if(e.schedule.kind==="at"){const i=new Date(e.schedule.atMs),s=o=>String(o).padStart(2,"0");t.scheduleAt=`${i.getFullYear()}-${s(i.getMonth()+1)}-${s(i.getDate())}T${s(i.getHours())}:${s(i.getMinutes())}`}else if(e.schedule.kind==="every"){const i=e.schedule.everyMs;i%864e5===0?(t.everyAmount=String(i/864e5),t.everyUnit="days"):i%36e5===0?(t.everyAmount=String(i/36e5),t.everyUnit="hours"):(t.everyAmount=String(i/6e4),t.everyUnit="minutes")}else e.schedule.kind==="cron"&&(t.cronExpr=e.schedule.expr,t.cronTz=e.schedule.tz||"");if(e.payload.kind==="systemEvent")t.payloadText=e.payload.text;else if(e.payload.kind==="agentTurn"){t.payloadText=e.payload.message,t.deliver=e.payload.deliver??!1,t.timeoutSeconds=e.payload.timeoutSeconds?String(e.payload.timeoutSeconds):"";const i=e.payload.channel??e.payload.provider;t.channel=i||"last";const s=e.payload.to||"";if(s){const o=s.split(",").map(a=>a.trim()).filter(Boolean);t.toAdmins=o.some(a=>a.toLowerCase()==="admins"),t.recipients=o.filter(a=>a.toLowerCase()!=="admins")}}return(n=e.isolation)!=null&&n.postToMainPrefix&&(t.postToMainPrefix=e.isolation.postToMainPrefix),t}async function Ch(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=uc(e.cronForm),i=pc(e.cronForm),s={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:e.cronForm.agentId.trim()||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i};if(e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?s.isolation={postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:s.isolation=void 0,!s.name)throw new Error("Name required.");await e.client.request("cron.update",{id:t,patch:s}),await jn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ao(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function Z(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 ia(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 hc(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 fc(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 gc(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=lt(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const a=o.channels;(!a.whatsapp||typeof a.whatsapp!="object")&&(a.whatsapp={});const r=a.whatsapp;(!r.accounts||typeof r.accounts!="object")&&(r.accounts={});const l=r.accounts;if(l[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}l[i]={name:n,provider:"baileys"};const d=s.hash;if(!d){e.whatsappAccountError="Config hash missing; reload and retry.";return}const h=Ct(o);await e.client.request("config.set",{raw:h,baseHash:d}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await Z(e,!0),await ia(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function mc(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=lt(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,a=o==null?void 0:o.accounts;if(!a){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(a).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!a[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete a[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(h=>{const u=h.match;return!u||u.channel!=="whatsapp"?!0:u.accountId!==t}));const l=n.hash;if(!l){e.whatsappAccountError="Config hash missing; reload and retry.";return}const d=Ct(i);await e.client.request("config.set",{raw:d,baseHash:l}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await Z(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const Eh=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:gc,loadChannels:Z,logoutWhatsApp:fc,removeWhatsAppAccount:mc,startWhatsAppLogin:ia,waitWhatsAppLogin:hc},Symbol.toStringTag,{value:"Module"}));async function sa(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 oa="taskmaster-access-session",yc={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function aa(){try{return localStorage.getItem(oa)}catch{return null}}function vc(e){try{localStorage.setItem(oa,e)}catch{}}function Th(){try{localStorage.removeItem(oa)}catch{}}async function Er(e){if(e.client)try{const t=aa(),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 _h(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?(vc(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 Mh(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?(vc(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 Ph(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 Ih(e){const t=aa();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}Th(),e.accessState={...yc,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}const Rh=1e4,Lh=new Set(["trace","debug","info","warn","error","fatal"]);function Dh(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 Bh(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Lh.has(t)?t:null}function bc(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=Bh((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),o=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,a=Dh(o);let r=null;a&&(typeof a.subsystem=="string"?r=a.subsystem:typeof a.module=="string"&&(r=a.module)),!r&&o&&o.length<120&&(r=o);let l=null;return typeof t[1]=="string"?l=t[1]:!a&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:i,level:s,subsystem:r,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function bt(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,date:e.logsDate??void 0,accessToken:aa()??void 0}),o=(Array.isArray(i.lines)?i.lines.filter(r=>typeof r=="string"):[]).map(bc),a=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=a?o:[...e.logsEntries,...o].slice(-Rh),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),Array.isArray(i.availableDates)&&(e.logsAvailableDates=i.availableDates.filter(r=>typeof r=="string")),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const Nh=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:bt,parseLogLine:bc},Symbol.toStringTag,{value:"Module"}));const wc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Ai,Gx:Tr,Gy:_r,a:Ws,d:zs,h:Oh}=wc,Et=32,ra=64,Fh=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},re=(e="")=>{const t=new Error(e);throw Fh(t,re),t},Uh=e=>typeof e=="bigint",Wh=e=>typeof e=="string",zh=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",ct=(e,t,n="")=>{const i=zh(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const a=n&&`"${n}" `,r=o?` of length ${t}`:"",l=i?`length=${s}`:`type=${typeof e}`;re(a+"expected Uint8Array"+r+", got "+l)}return e},cs=e=>new Uint8Array(e),kc=e=>Uint8Array.from(e),xc=(e,t)=>e.toString(16).padStart(t,"0"),$c=e=>Array.from(ct(e)).map(t=>xc(t,2)).join(""),Ge={_0:48,_9:57,A:65,F:70,a:97,f:102},Mr=e=>{if(e>=Ge._0&&e<=Ge._9)return e-Ge._0;if(e>=Ge.A&&e<=Ge.F)return e-(Ge.A-10);if(e>=Ge.a&&e<=Ge.f)return e-(Ge.a-10)},Sc=e=>{const t="hex invalid";if(!Wh(e))return re(t);const n=e.length,i=n/2;if(n%2)return re(t);const s=cs(i);for(let o=0,a=0;o<i;o++,a+=2){const r=Mr(e.charCodeAt(a)),l=Mr(e.charCodeAt(a+1));if(r===void 0||l===void 0)return re(t);s[o]=r*16+l}return s},Ac=()=>globalThis==null?void 0:globalThis.crypto,Kh=()=>{var e;return((e=Ac())==null?void 0:e.subtle)??re("crypto.subtle must be defined, consider polyfill")},Kn=(...e)=>{const t=cs(e.reduce((i,s)=>i+ct(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},Hh=(e=Et)=>Ac().getRandomValues(cs(e)),Fi=BigInt,gt=(e,t,n,i="bad number: out of range")=>Uh(e)&&t<=e&&e<n?e:re(i),L=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Cc=e=>L(e,Ai),qh=(e,t)=>{(e===0n||t<=0n)&&re("no inverse n="+e+" mod="+t);let n=L(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const a=i/n,r=i%n,l=s-o*a;i=n,n=r,s=o,o=l}return i===1n?L(s,t):re("no inverse")},jh=e=>{const t=Mc[e];return typeof t!="function"&&re("hashes."+e+" not set"),t},Ks=e=>e instanceof Tt?e:re("Point expected"),Co=2n**256n,Ue=class Ue{constructor(t,n,i,s){q(this,"X");q(this,"Y");q(this,"Z");q(this,"T");const o=Co;this.X=gt(t,0n,o),this.Y=gt(n,0n,o),this.Z=gt(i,1n,o),this.T=gt(s,0n,o),Object.freeze(this)}static CURVE(){return wc}static fromAffine(t){return new Ue(t.x,t.y,1n,L(t.x*t.y))}static fromBytes(t,n=!1){const i=zs,s=kc(ct(t,Et)),o=t[31];s[31]=o&-129;const a=Tc(s);gt(a,0n,n?Co:ue);const l=L(a*a),d=L(l-1n),h=L(i*l+1n);let{isValid:u,value:p}=Vh(d,h);u||re("bad point: y not sqrt");const v=(p&1n)===1n,$=(o&128)!==0;return!n&&p===0n&&$&&re("bad point: x==0, isLastByteOdd"),$!==v&&(p=L(-p)),new Ue(p,a,1n,L(p*a))}static fromHex(t,n){return Ue.fromBytes(Sc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Ws,n=zs,i=this;if(i.is0())return re("bad point: ZERO");const{X:s,Y:o,Z:a,T:r}=i,l=L(s*s),d=L(o*o),h=L(a*a),u=L(h*h),p=L(l*t),v=L(h*L(p+d)),$=L(u+L(n*L(l*d)));if(v!==$)return re("bad point: equation left != right (1)");const S=L(s*o),M=L(a*r);return S!==M?re("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:a,Z:r}=Ks(t),l=L(n*r),d=L(o*s),h=L(i*r),u=L(a*s);return l===d&&h===u}is0(){return this.equals(jt)}negate(){return new Ue(L(-this.X),this.Y,this.Z,L(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=Ws,o=L(t*t),a=L(n*n),r=L(2n*L(i*i)),l=L(s*o),d=t+n,h=L(L(d*d)-o-a),u=l+a,p=u-r,v=l-a,$=L(h*p),S=L(u*v),M=L(h*v),y=L(p*u);return new Ue($,S,y,M)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:r,Z:l,T:d}=Ks(t),h=Ws,u=zs,p=L(n*a),v=L(i*r),$=L(o*u*d),S=L(s*l),M=L((n+i)*(a+r)-p-v),y=L(S-$),b=L(S+$),k=L(v-h*p),A=L(M*y),E=L(b*k),T=L(M*k),P=L(y*b);return new Ue(A,E,P,T)}subtract(t){return this.add(Ks(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return jt;if(gt(t,1n,Ai),t===1n)return this;if(this.equals(_t))return af(t).p;let i=jt,s=_t;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(jt))return{x:0n,y:1n};const s=qh(i,ue);L(i*s)!==1n&&re("invalid inverse");const o=L(t*s),a=L(n*s);return{x:o,y:a}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Ec(n);return i[31]|=t&1n?128:0,i}toHex(){return $c(this.toBytes())}clearCofactor(){return this.multiply(Fi(Oh),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Ai/2n,!1).double();return Ai%2n&&(t=t.add(this)),t.is0()}};q(Ue,"BASE"),q(Ue,"ZERO");let Tt=Ue;const _t=new Tt(Tr,_r,1n,L(Tr*_r)),jt=new Tt(0n,1n,1n,0n);Tt.BASE=_t;Tt.ZERO=jt;const Ec=e=>Sc(xc(gt(e,0n,Co),ra)).reverse(),Tc=e=>Fi("0x"+$c(kc(ct(e)).reverse())),De=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},Gh=e=>{const n=e*e%ue*e%ue,i=De(n,2n)*n%ue,s=De(i,1n)*e%ue,o=De(s,5n)*s%ue,a=De(o,10n)*o%ue,r=De(a,20n)*a%ue,l=De(r,40n)*r%ue,d=De(l,80n)*l%ue,h=De(d,80n)*l%ue,u=De(h,10n)*o%ue;return{pow_p_5_8:De(u,2n)*e%ue,b2:n}},Pr=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Vh=(e,t)=>{const n=L(t*t*t),i=L(n*n*t),s=Gh(e*i).pow_p_5_8;let o=L(e*n*s);const a=L(t*o*o),r=o,l=L(o*Pr),d=a===e,h=a===L(-e),u=a===L(-e*Pr);return d&&(o=r),(h||u)&&(o=l),(L(o)&1n)===1n&&(o=L(-o)),{isValid:d||h,value:o}},Eo=e=>Cc(Tc(e)),la=(...e)=>Mc.sha512Async(Kn(...e)),Qh=(...e)=>jh("sha512")(Kn(...e)),_c=e=>{const t=e.slice(0,Et);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Et,ra),i=Eo(t),s=_t.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},ca=e=>la(ct(e,Et)).then(_c),Jh=e=>_c(Qh(ct(e,Et))),Yh=e=>ca(e).then(t=>t.pointBytes),Xh=e=>la(e.hashable).then(e.finish),Zh=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=Eo(t),a=_t.multiply(o).toBytes();return{hashable:Kn(a,i,n),finish:d=>{const h=Cc(o+Eo(d)*s);return ct(Kn(a,Ec(h)),ra)}}},ef=async(e,t)=>{const n=ct(e),i=await ca(t),s=await la(i.prefix,n);return Xh(Zh(i,s,n))},Mc={sha512Async:async e=>{const t=Kh(),n=Kn(e);return cs(await t.digest("SHA-512",n.buffer))},sha512:void 0},tf=(e=Hh(Et))=>e,nf={getExtendedPublicKeyAsync:ca,getExtendedPublicKey:Jh,randomSecretKey:tf},Ui=8,sf=256,Pc=Math.ceil(sf/Ui)+1,To=2**(Ui-1),of=()=>{const e=[];let t=_t,n=t;for(let i=0;i<Pc;i++){n=t,e.push(n);for(let s=1;s<To;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Ir;const Rr=(e,t)=>{const n=t.negate();return e?n:t},af=e=>{const t=Ir||(Ir=of());let n=jt,i=_t;const s=2**Ui,o=s,a=Fi(s-1),r=Fi(Ui);for(let l=0;l<Pc;l++){let d=Number(e&a);e>>=r,d>To&&(d-=o,e+=1n);const h=l*To,u=h,p=h+Math.abs(d)-1,v=l%2!==0,$=d<0;d===0?i=i.add(Rr(v,t[u])):n=n.add(Rr($,t[p]))}return e!==0n&&re("invalid wnaf"),{p:n,f:i}},Hs="taskmaster-device-identity-v1";function _o(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Ic(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 rf(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Rc(e){const t=await crypto.subtle.digest("SHA-256",e);return rf(new Uint8Array(t))}async function lf(){const e=nf.randomSecretKey(),t=await Yh(e);return{deviceId:await Rc(t),publicKey:_o(t),privateKey:_o(e)}}async function cf(){try{const n=localStorage.getItem(Hs);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 Rc(Ic(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(Hs,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 lf(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Hs,JSON.stringify(t)),e}async function df(e,t){const n=Ic(e),i=new TextEncoder().encode(t),s=await ef(i,n);return _o(s)}const Lc="taskmaster.device.auth.v1";function da(e){return e.trim()}function uf(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 ua(){try{const e=window.localStorage.getItem(Lc);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 Dc(e){try{window.localStorage.setItem(Lc,JSON.stringify(e))}catch{}}function pf(e){const t=ua();if(!t||t.deviceId!==e.deviceId)return null;const n=da(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function hf(e){const t=da(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=ua();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:uf(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Dc(n),s}function ff(e){const t=ua();if(!t||t.deviceId!==e.deviceId)return;const n=da(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Dc(i)}async function pa(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 ha(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 gf(e){return{method:"exec.approvals.get",params:{}}}async function mf(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=gf(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);yf(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function yf(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=lt(t.file??{}))}async function Bc(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 xe(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function $e(e){return e instanceof Error?e.message:String(e)}function Hn(){return{name:"",skillContent:"",references:[],alwaysActive:!1}}async function Pe(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=$e(n)}finally{e.skillsLoading=!1}}}function Nc(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Oc(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 Pe(e),xe(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=$e(i);e.skillsError=s,xe(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Fc(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await Pe(e),xe(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=$e(n);e.skillsError=i,xe(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Uc(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 Pe(e),xe(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=$e(s);e.skillsError=o,xe(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}async function Wc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});n&&(e.skillDetail=n,e.skillDetailTab="SKILL.md")}catch(n){e.skillsError=$e(n)}}function zc(e){e.skillDetail=null,e.skillDetailTab=""}function Kc(e,t){e.skillDetailTab=t}async function Hc(e){if(e.skillAddModal=!0,e.skillAddForm=Hn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[],!(!e.client||!e.connected))try{const t=await e.client.request("skills.drafts",{});t&&(e.skillDrafts=t.drafts)}catch{}}function qc(e){e.skillAddModal=!1,e.skillAddForm=Hn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[]}function jc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n})),alwaysActive:!1},e.skillAddFormSource="draft"}async function Gc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n})),alwaysActive:!1},e.skillAddFormSource="installed",await fa(e)}async function fa(e){if(!e.client||!e.connected)return;const t=e.skillAddForm;if(!(!t.name.trim()||!t.skillContent.trim())){e.skillsBusyKey="__add__",e.skillsError=null;try{const n=t.references.filter(s=>s.name.trim()&&s.content.trim()).map(s=>({name:s.name.trim(),content:s.content})),i=t.name.trim();e.skillAddFormSource==="installed"?(await e.client.request("skills.create",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0,alwaysActive:t.alwaysActive}),e.skillAddModal=!1,e.skillAddForm=Hn(),e.skillAddFormSource="draft",e.skillDrafts=[],await Pe(e),xe(e,i,{kind:"success",message:"Skill saved — active on next message"})):(await e.client.request("skills.saveDraft",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Hn(),e.skillAddFormSource="draft",e.skillDrafts=[],xe(e,i,{kind:"success",message:"Draft saved"}))}catch(n){e.skillsError=$e(n)}finally{e.skillsBusyKey=null}}}async function Vc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("skills.deleteDraft",{name:t}),e.skillDrafts=e.skillDrafts.filter(n=>n.name!==t)}catch(n){e.skillsError=$e(n)}}async function Qc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});if(!n)return;e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i})),alwaysActive:n.alwaysActive??!1},e.skillAddFormSource="installed",e.skillAddModal=!0,e.skillDrafts=[]}catch(n){e.skillsError=$e(n)}}function Jc(e,t){const n=e.skillDetail;n&&(e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i})),alwaysActive:n.alwaysActive??!1},e.skillAddFormSource="installed",e.skillEditTab=t&&t!=="SKILL.md"?t:"SKILL.md",e.skillDetail=null,e.skillDetailTab="",e.skillAddModal=!0,e.skillDrafts=[])}function Yc(e,t,n){e.skillAddForm={...e.skillAddForm,references:e.skillAddForm.references.map(i=>i.name===t?{...i,content:n}:i)}}function Xc(e,t){e.skillEditTab=t}async function Zc(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.read",{name:t});if(!i)return;const s=i.references.filter(o=>o.name.trim()&&o.content.trim()).map(o=>({name:o.name.trim(),content:o.content}));await e.client.request("skills.create",{name:t,skillContent:i.content,references:s.length>0?s:void 0,alwaysActive:n}),await Pe(e),xe(e,t,{kind:"success",message:n?"Skill is now always active":"Skill loads on demand"})}catch(i){e.skillsError=$e(i),xe(e,t,{kind:"error",message:$e(i)})}finally{e.skillsBusyKey=null}}}async function ed(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,agents:n}),await Pe(e),xe(e,t,{kind:"success",message:"Agent access updated"})}catch(i){const s=$e(i);e.skillsError=s,xe(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function td(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.delete",{name:t}),await Pe(e)}catch(n){e.skillsError=$e(n)}finally{e.skillsBusyKey=null}}}const vf=Object.freeze(Object.defineProperty({__proto__:null,closeAddSkillModal:qc,closeSkillDetail:zc,deleteDraft:Vc,deleteSkill:td,editDetailSkill:Jc,editSkill:Qc,emptyAddForm:Hn,importDraft:jc,installDraft:Gc,installSkill:Uc,loadSkills:Pe,openAddSkillModal:Hc,saveNewSkill:fa,saveSkillApiKey:Fc,setEditTab:Xc,setSkillDetailTab:Kc,toggleAlwaysActive:Zc,updateFormReference:Yc,updateSkillAgents:ed,updateSkillEdit:Nc,updateSkillEnabled:Oc,viewSkillDetail:Wc},Symbol.toStringTag,{value:"Module"})),nd={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},id=new Map(Object.entries(nd).map(([e,t])=>[t,e]));function ds(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function qn(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 bf(e,t=""){const n=ds(t),i=nd[e];return n?`${n}${i}`:i}function sd(e,t=""){const n=ds(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=qn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":id.get(s)??null}function wf(e){let t=qn(e);if(t.endsWith("/index.html")&&(t=qn(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(id.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function kf(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ga(e){return e==="system"?kf():e}const di=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,xf=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,ui=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},$f=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var d;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,a=s,r=xf();if(!!a.startViewTransition&&!r){let h=.5,u=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")h=di(n.pointerClientX/window.innerWidth),u=di(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(h=di((p.left+p.width/2)/window.innerWidth),u=di((p.top+p.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${h*100}%`),o.style.setProperty("--theme-switch-y",`${u*100}%`),o.classList.add("theme-transition");try{const p=(d=a.startViewTransition)==null?void 0:d.call(a,()=>{t()});p!=null&&p.finished?p.finished.finally(()=>ui(o)):ui(o)}catch{ui(o),t()}return}t(),ui(o)},Sf=2e3;async function Pn(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),o=Array.isArray(s.entries)?s.entries:[],a=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=a?o:[...e.sessionLogsEntries,...o].slice(-Sf),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 od=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:Pn},Symbol.toStringTag,{value:"Module"}));async function ad(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 Af(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function ze(e){return e instanceof Error?e.message:String(e)}let pi=null;function an(e,t){pi&&clearTimeout(pi),e.filesMessage={kind:"success",text:t},pi=setTimeout(()=>{e.filesMessage=null,pi=null},3e3)}async function rn(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=ze(n)}finally{e.filesLoading=!1}}}}async function Cf(e,t,n){e.filesSelectedPaths=new Set([t]),await rd(e,t,n)}async function Ef(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 rd(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Tf(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 ld(e,o,t),i++}catch(a){s=ze(a)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:an(e,`${i} file${i!==1?"s":""} downloaded`)}async function _f(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await Rf(e,t,o,i)}async function rd(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=ze(i)}finally{e.filesPreviewLoading=!1}}}async function ld(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),d=>d.charCodeAt(0)),a=new Blob([o]),r=URL.createObjectURL(a),l=document.createElement("a");l.href=r,l.download=s.name??t.split("/").pop()??"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(r)}catch(i){e.filesMessage={kind:"error",text:ze(i)}}}async function Mf(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const a of n)try{const r=await a.arrayBuffer(),l=btoa(new Uint8Array(r).reduce((h,u)=>h+String.fromCharCode(u),"")),d={path:t,name:a.name,data:l};i&&(d.agentId=i),await e.client.request("files.upload",d),s++}catch(r){o=ze(r)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:an(e,`${s} file${s!==1?"s":""} uploaded`),await rn(e,i)}async function Pf(e,t,n,i){if(!e.client||!e.connected)return;e.filesMessage=null;const s=t==="."?n:`${t}/${n}`;try{const o={path:s};i&&(o.agentId=i),await e.client.request("files.mkdir",o),an(e,`Created ${s}`),await rn(e,i),e.filesExpandedDirs=new Set([...e.filesExpandedDirs,s]),e.filesCurrentDir=s}catch(o){e.filesMessage={kind:"error",text:ze(o)}}}async function If(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),an(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await rn(e,n)}catch(i){e.filesMessage={kind:"error",text:ze(i)}}}}async function Rf(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),an(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await rn(e,i)}catch(s){e.filesMessage={kind:"error",text:ze(s)}}}}async function us(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 Lf(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;an(e,`Re-indexed: ${s} files, ${o} chunks`),await us(e,t)}catch(n){e.filesMessage={kind:"error",text:ze(n)}}finally{e.filesReindexBusy=!1}}}function Df(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n,e.filesCurrentDir=t}async function Bf(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:ze(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function Nf(e){e.filesSearchQuery="",e.filesSearchResults=null}function Of(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{ha(e,{quiet:!0})},5e3))}function Ff(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Wi(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")&&e.logsSubTab!=="session"&&e.logsDate==null&&bt(e,{quiet:!0})},2e3))}function ma(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function zi(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||Pn(e,{quiet:!0,reset:!0})},3e3))}function ya(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function va(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&sa(e)},3e3))}function ba(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Uf(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{ad(e)},3e4))}function Wf(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function zf(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{const t=e;t.filesPage&&us(t,t.filesResolvedAgentId)},3e3))}function Kf(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function at(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,Ip(n),t.theme!==e.theme&&(e.theme=t.theme,ps(e,ga(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function cd(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&at(e,{...e.settings,lastActiveSessionKey:n})}function Hf(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),o=t.get("gatewayUrl");let a=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&at(e,{...e.settings,token:l}),t.delete("token"),a=!0}if(i!=null){const l=i.trim();l&&(e.password=l),t.delete("password"),a=!0}if(s!=null){const l=s.trim();l&&(e.sessionKey=l,at(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(o!=null){const l=o.trim();l&&l!==e.settings.gatewayUrl&&at(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),a=!0}if(!a)return;const r=new URL(window.location.href);r.search=t.toString(),window.history.replaceState({},"",r.toString())}function qf(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?zi(e):Wi(e):(ma(e),ya(e)),t==="debug"?va(e):ba(e),Ki(e),ud(e,t,!1)}function jf(e,t,n){$f({nextTheme:t,applyTheme:()=>{e.theme=t,at(e,{...e.settings,theme:t}),ps(e,ga(t))},context:n,currentTheme:e.theme})}async function Ki(e){if(e.tab==="overview"&&await pd(e),e.tab==="channels"&&await Zf(e),e.tab==="instances"&&await Bc(e),e.tab==="cron"&&await hd(e),e.tab==="skills"&&await Pe(e),e.tab==="nodes"&&(await ha(e),await pa(e),await We(e),await mf(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await sg(e),sn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await dc(e),await We(e)),e.tab==="debug"&&(await sa(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await ae(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>od);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await bt(e,{reset:!0});So(e,!0)}}function Gf(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ds(e):wf(window.location.pathname)}function Vf(e){e.theme=e.settings.theme??"system",ps(e,ga(e.theme))}function ps(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Qf(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"&&ps(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Jf(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 Yf(e,t){if(typeof window>"u")return;const n=sd(window.location.pathname,e.basePath)??"chat";dd(e,n),ud(e,n,t)}function Xf(e){var s;if(typeof window>"u")return;const t=sd(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,at(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),dd(e,t)}function dd(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?zi(e):Wi(e):(ma(e),ya(e)),t==="debug"?va(e):ba(e),e.connected&&Ki(e)}function ud(e,t,n){if(typeof window>"u")return;const i=qn(bf(t,e.basePath)),s=qn(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 pd(e){await Promise.all([Z(e,!1),Bc(e),lc(e),on(e),sa(e)])}async function Zf(e){await Promise.all([Z(e,!0),dc(e),We(e)])}async function hd(e){await Promise.all([Z(e,!1),on(e),jn(e)])}function fd(e){return e.chatSending||!!e.chatRunId}function eg(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 gd(e){e.connected&&(e.chatMessage="",await ac(e))}function tg(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:ls(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],sn(e))}async function md(e,t,n){var s,o;na(e);const i=await oc(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&&cd(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),sn(e),i&&!e.chatRunId&&yd(e),i}async function yd(e){if(!e.connected||fd(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await md(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function ng(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function ig(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],a=t==null?o:[],r=a.length>0;if(!(!s&&!r)){if(eg(s)){await gd(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[],Lp(e.selectedWorkspace??"",e.sessionKey)),fd(e)){tg(e,s,a);return}await md(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:r?a:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function sg(e){var i;const t=e,n=Math.max((((i=t.chatMessages)==null?void 0:i.length)??0)+10,nn);await Promise.all([Jt(t,{limit:n}),lc(t),Mo(e)]),sn(e,!0)}const og=yd;function ag(e){var s,o,a;const t=Yl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((a=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:a.trim())||"main"}function rg(e,t){const n=ds(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function Mo(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=ag(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=rg(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 I={messageSquare:c`<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:c`<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:c`<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:c`<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:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:c`<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:c`<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:c`<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:c`<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:c`<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:c`<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>`,user:c`<svg viewBox="0 0 24 24"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>`,menu:c`<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:c`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:c`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:c`<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:c`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:c`<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:c`<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:c`<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:c`<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>`,refreshCw:c`<svg viewBox="0 0 24 24"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>`,download:c`<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:c`<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:c`<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:c`<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:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,globeOff:c`<svg viewBox="0 0 24 24"><path d="M21.54 15H17"/><path d="M7 3.34V5a3 3 0 0 0 3 3 2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:c`<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:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:c`<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:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:c`<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:c`<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:c`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,mic:c`<svg viewBox="0 0 24 24"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,chevronDown:c`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,chevronLeft:c`<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>`,chevronRight:c`<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>`,film:c`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`,wifi:c`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.859a10 10 0 0 1 14 0"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/></svg>`,wifiOff:c`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/><path d="M5 12.859a10 10 0 0 1 5.17-2.69"/><path d="M13.41 10.28a10 10 0 0 1 5.59 2.58"/><path d="M2 8.82a15 15 0 0 1 4.17-2.65"/><path d="M10.66 5c4.01-.36 8.14.9 11.34 3.76"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,power:c`<svg viewBox="0 0 24 24"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"/><line x1="12" x2="12" y1="2" y2="12"/></svg>`,powerOff:c`<svg viewBox="0 0 24 24"><path d="M18.36 6.64A9 9 0 0 1 20.77 15"/><path d="M6.16 6.16a9 9 0 1 0 12.68 12.68"/><path d="M12 2v4"/><path d="m2 2 20 20"/></svg>`},lg=c`<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>`,cg=c`<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>`,dg=c`<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.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg>`;let Lr=!1;function ug(){Lr||(Lr=!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 Rt(e,t){var u;const n=(p,v)=>p===e?c`<span class="sp-page-nav-current">${p}</span>`:c`<a href=${v}>${p}</a>`,i=c`
21
21
  ${n("Setup","/setup")}
22
22
  ${n("Chat","/chat")}
23
23
  ${n("Admins","/admins")}
@@ -4930,5 +4930,5 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
4930
4930
  </div>
4931
4931
  `}const k0={trace:!1,debug:!1,info:!0,warn:!0,error:!0,fatal:!0},x0={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};function $0(e){e.basePath=Gf();const t=Xe();Vl(t.accentColor),Ql(t.backgroundColor);const n=document.querySelector('link[rel="icon"]');if(n&&(n.href=t.iconUrl),window.scrollTo(0,0),Uf(e),e.publicChat){const i=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__,s=(i==null?void 0:i.accountId)??"",o=s?s.charAt(0).toUpperCase()+s.slice(1):"Assistant";document.title=`Chat with ${o}`,Oe(e);return}if(e.setup){document.title=`${t.name} Setup`,Oe(e);return}if(e.filesPage){document.title=`${t.name} Files`,zf(e),Oe(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Oe(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Oe(e);return}if(e.contactsPage){document.title=`${t.name} Contacts`,Oe(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Oe(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Oe(e),zi(e),Wi(e);return}Yf(e,!0),Vf(e),Qf(e),window.addEventListener("popstate",e.popStateHandler),Hf(e),Oe(e),Of(e),e.tab==="logs"&&(e.logsSubTab==="session"?zi(e):Wi(e)),e.tab==="debug"&&va(e)}function S0(e){mh(e)}function A0(e){var t;window.removeEventListener("popstate",e.popStateHandler),Ff(e),ma(e),ya(e),ba(e),Wf(e),Kf(e),Jf(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function C0(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",s=t.has("setupStep")&&e.setupStep==="setup";(n||i||s)&&e.handleAuthStatusCheck&&e.authConnected===null&&!e.authBusy&&e.handleAuthStatusCheck(),e.setupStep==="setup"&&t.has("setupStep")&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(a=>{e.channelsSnapshot=a,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(o=>{e.channelsSnapshot=o,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;sn(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&So(e,t.has("tab")||t.has("logsAutoFollow")),(t.has("sessionLogsEntries")||t.has("sessionLogsAutoFollow"))&&e.sessionLogsAutoFollow&&e.logsAtBottom&&So(e,t.has("sessionLogsAutoFollow"))}}function E0(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 T0(e,t,n){await ia(e,t,n),await Z(e,!0)}async function _0(e,t){await hc(e,t),await Z(e,!0)}async function M0(e,t){await fc(e,t),await Z(e,!0)}async function P0(e,t){await gc(e,t)}async function I0(e,t){await mc(e,t)}async function R0(e){await bh(e),await We(e),await Z(e,!0)}async function L0(e){await We(e),await Z(e,!0)}function D0(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[i,...s]=n.split(":");if(!i||s.length===0)continue;const o=i.trim(),a=s.join(":").trim();o&&a&&(t[o]=a)}return t}function Ou(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 Fu(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function B0(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=E0(n??void 0)}function N0(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function O0(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function F0(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function U0(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Ou(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(Fu(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:D0(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 Z(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function W0(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Ou(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(Fu(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const l=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const o=s.merged??s.imported??null,a=o?{...t.values,...o}:t.values,r=!!(a.banner||a.website||a.nip05||a.lud16);e.nostrProfileFormState={...t,importing:!1,values:a,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:r},s.saved&&await Z(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function z0(e){if(!e.client)return;const t=e.authRefreshTokenInput.trim();if(t){e.authRefreshTokenBusy=!0,e.authRefreshTokenError=null;try{const n=await e.client.request("auth.importRefreshToken",{refreshToken:t});e.authConnected=n.connected,e.authExpiresIn=n.expiresIn??null,e.authMessage=n.message??null,e.authRefreshToken=t,e.authRefreshTokenInput="",e.claudeAuthModalOpen=!1}catch(n){e.authRefreshTokenError=n instanceof Error?n.message:"Failed to import token"}finally{e.authRefreshTokenBusy=!1}}}async function K0(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,e.authRefreshToken=t.refreshToken??null}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to check auth status"}finally{e.authBusy=!1}}}async function H0(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 q0(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 j0(e,t){e.authCodeInput=t}async function G0(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="setup"):(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="setup"):(e.licenseValid=null,e.licenseMessage=n,e.setupStep="license")}finally{e.licenseBusy=!1}}}async function V0(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="setup"},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 Q0(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 J0(e,t){e.licenseKey=t}async function Y0(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 X0(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 Z0=Object.defineProperty,ex=Object.getOwnPropertyDescriptor,g=(e,t,n,i)=>{for(var s=i>1?void 0:i?ex(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Z0(t,n,s),s};const bo=Sp();function tx(){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 nx(){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 ix(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function sx(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function ox(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function ax(){const e=window.location.pathname;return e==="/contacts"||e.endsWith("/contacts")}function rx(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function lx(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let f=class extends Gt{constructor(){super(...arguments),this.settings=Bs(),this.password="",this.tab="chat",this.onboarding=tx(),this.setup=nx(),this.filesPage=ix(),this.browserPage=sx(),this.adminsPage=ox(),this.contactsPage=ax(),this.chatPage=rx(),this.advancedPage=lx(),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=yc,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=bo.name,this.assistantAvatar=bo.avatar,this.assistantAgentId=bo.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatHistoryTotal=0,this.chatHistoryHasMore=!1,this.chatLoadingOlder=!1,this.chatToolMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestions=[],this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatModelCatalog=[],this.chatVerboseLevel=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=`{
4932
4932
  }
4933
- `,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.publicChatGreetingBusy=!1,this.publicChatEmailBusy=!1,this.publicChatSettingsOpen=!1,this.publicChatWidgetModalOpen=!1,this.brandingBusy=!1,this.agentSettingsOpen=!1,this.brandingExpanded=!1,this.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleServeEnableUrl=null,this.tailscaleFunnelEnableUrl=null,this.tailscaleDisableConfirm=!1,this.tailscaleConnectProgress=0,this.tailscaleConnectMessage="",this.tailscaleConnectSuccess=!1,this.wifiStatus=null,this.wifiNetworks=[],this.wifiBusy=!1,this.wifiError=null,this.wifiPassword="",this.wifiSelectedSsid=null,this.networkPort=null,this.networkHostname="",this.networkPortInput="",this.networkHostnameInput="",this.networkModalOpen=!1,this.networkBusy=!1,this.networkError=null,this.networkSuccess=null,this.wifiModalOpen=!1,this.licenseKey="",this.licenseBusy=!1,this.licenseValid=null,this.licenseMessage=null,this.licenseTier=null,this.licenseDeviceId=null,this.licenseStoredKey=null,this.licenseRemoveConfirm=!1,this.authConnected=null,this.authBusy=!1,this.authMessage=null,this.authUrl=null,this.authCodeInput="",this.authExpiresIn=null,this.authRefreshToken=null,this.claudeAuthModalOpen=!1,this.authRefreshTokenInput="",this.authRefreshTokenBusy=!1,this.authRefreshTokenError=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={...x0},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.cronEditJobId=null,this.cronPendingDeleteId=null,this.cronRunModalJobId=null,this.cronRunModalJobName="",this.cronRunResult=null,this.openingHoursLoading=!1,this.openingHoursError=null,this.openingHoursBusy=!1,this.openingHoursForm=Wa(),this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserFullscreen=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesCurrentDir=".",this.filesPendingDeletePath=null,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.embeddingDownloading=!1,this.embeddingPollTimer=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.filesResolvedAgentId=void 0,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillsTypeFilter="all",this.skillsAgentFilter="all",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillDetail=null,this.skillDetailTab="",this.skillAddModal=!1,this.skillAddForm={name:"",skillContent:"",references:[]},this.skillAddFormSource="draft",this.skillEditTab="SKILL.md",this.skillDrafts=[],this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.contactsLoading=!1,this.contactsSaving=!1,this.contactsRecords=[],this.contactsError=null,this.contactsSearchQuery="",this.contactsEditingId=null,this.contactsShowAddForm=!1,this.contactsNewPhone="",this.contactsNewName="",this.contactsDeleteConfirmId=null,this.contactsAddFieldForId=null,this.contactsAddFieldKey="",this.contactsAddFieldValue="",this.imessageEnableConfirm=!1,this.imessageEnabling=!1,this.chatPageTab="chat",this.waConversations=[],this.waSelectedJid=null,this.waMessages=[],this.waGroupInfo=null,this.waLoading=!1,this.waMessagesLoading=!1,this.waSearchQuery="",this.waComposeDraft="",this.waSending=!1,this.waLastError=null,this.infoModalOpen=null,this.remoteAccessQrDataUrl=null,this.publicChatQrDataUrl=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={...k0},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.logsDate=null,this.logsAvailableDates=[],this.logsSubTab="session",this.logsChipsExpanded=!1,this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,tool_call:!0,tool_result:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsChipsExpanded=!1,this.sessionLogsExpandedIds=new Set,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.onLoadOlder=()=>this.handleLoadOlderChat(),this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>Xf(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,this._beforeUnloadHandler=()=>{var t;xo();const e=this.selectedWorkspace??((t=this.publicChatConfig)==null?void 0:t.accountId)??"";e&&Wn(e,this.sessionKey,this.chatMessage)}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),$0(this),window.addEventListener("beforeunload",this._beforeUnloadHandler)}firstUpdated(){S0(this)}disconnectedCallback(){window.removeEventListener("beforeunload",this._beforeUnloadHandler),this.stopEmbeddingPoll(),A0(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){C0(this,e)}connect(){Oe(this)}handleChatScroll(e){ch(this,e)}handleLogsScroll(e){uh(this,e)}handleSessionLogsScroll(e){ph(this,e)}exportLogs(e,t){fh(e,t)}exportSessionLogs(e,t){gh(e,t)}resetToolStream(){na(this)}resetChatScroll(){hh(this)}async loadAssistantIdentity(){await Vo(this)}applySettings(e){at(this,e)}setTab(e){qf(this,e)}setTheme(e,t){jf(this,e,t)}async loadOverview(){await pd(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.accountId=this.selectedWorkspace??void 0,this.cronForm={...this.cronForm,accountId:this.selectedWorkspace??void 0},await hd(this)}async handleAbortChat(){await gd(this)}removeQueuedMessage(e){ng(this,e)}async handleSendChat(e,t){await ig(this,e,t)}async handleWhatsAppStart(e,t){await T0(this,e,t)}async handleWhatsAppWait(e){await _0(this,e)}async handleWhatsAppLogout(e){await M0(this,e)}async handleAddWhatsAppAccount(e){await P0(this,e)}async handleRemoveWhatsAppAccount(e){await I0(this,e)}async handleAccessCheck(){await Er(this)}async handlePinSubmit(e,t){await _h(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await Mh(this,e)}async handleLogout(){await Ih(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 Er(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 G0(this)}async handleLicenseActivate(){await V0(this)}async handleLicenseRemove(){await Q0(this)}handleLicenseKeyChange(e){J0(this,e)}async handleAuthStatusCheck(){await K0(this)}async handleAuthStart(){await H0(this)}async handleAuthSubmitCode(e){await q0(this,e)}handleAuthCodeChange(e){j0(this,e)}handleClaudeAuthModalOpen(){this.claudeAuthModalOpen=!0}handleClaudeAuthModalClose(){this.claudeAuthModalOpen=!1,this.authUrl=null,this.authRefreshTokenInput="",this.authRefreshTokenError=null}async handleImportRefreshToken(){await z0(this)}async handleGatewayHealthCheck(){await Y0(this)}async handleGatewayRestart(){await X0(this)}async handleUpdateCheck(){await Eu(this)}async handleUpdateRun(){await Fk(this)}handleUpdateDismissResult(){zk(this)}handleUninstallConfirm(){this.uninstallConfirm=!0,this.uninstallConfirmText=""}handleUninstallCancel(){this.uninstallConfirm=!1,this.uninstallConfirmText="",this.uninstallError=null}handleUninstallConfirmTextChange(e){this.uninstallConfirmText=e}async handleUninstallRun(){const{runUninstall:e}=await ae(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>Dr);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){ae(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>Dr);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await ad(this)}async clearAudit(){await Af(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,rn(this,t),us(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();ae(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>o0);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.chatSuggestions=[],this.resetChatScroll(),this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}ae(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>Oi);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this).then(()=>{sn(this,!0)})})}async handleLoadOlderChat(){if(this.chatLoadingOlder||!this.chatHistoryHasMore)return;const e=dh(this),{loadOlderChatHistory:t}=await ae(async()=>{const{loadOlderChatHistory:i}=await Promise.resolve().then(()=>Oi);return{loadOlderChatHistory:i}},void 0,import.meta.url);await t(this)&&e&&(await this.updateComplete,e())}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.selectedWorkspace&&this.loadCron(),this.advancedTab==="opening-hours"&&ae(async()=>{const{loadOpeningHours:n}=await Promise.resolve().then(()=>i0);return{loadOpeningHours:n}},void 0,import.meta.url).then(({loadOpeningHours:n})=>{n(this)}),this.advancedTab==="logs"&&(this.logsSubTab==="session"?ae(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>od);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):ae(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>Nh);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&ae(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>vf);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await R0(this)}async handleChannelConfigReload(){await L0(this)}handleNostrProfileEdit(e,t){B0(this,e,t)}handleNostrProfileCancel(){N0(this)}handleNostrProfileFieldChange(e,t){O0(this,e,t)}async handleNostrProfileSave(){await U0(this)}async handleNostrProfileImport(){await W0(this)}handleNostrProfileToggleAdvanced(){F0(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleContactsLoad(){const e=this.selectedWorkspace??void 0;ae(async()=>{const{loadContacts:t}=await Promise.resolve().then(()=>a0);return{loadContacts:t}},void 0,import.meta.url).then(({loadContacts:t})=>{t(this,e)})}handleContactsNewPhoneChange(e){this.contactsNewPhone=e,this.contactsError&&(this.contactsError=null)}handleContactsNewNameChange(e){this.contactsNewName=e,this.contactsError&&(this.contactsError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await ae(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>ki);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await ae(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>ki);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await ae(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>Eh);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const o=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,o),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(o),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await ae(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>ki);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=(e==null?void 0:e.displayName)??(e==null?void 0:e.name)??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await ae(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>ki);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){xo(),this.selectedWorkspace&&Wn(this.selectedWorkspace,this.sessionKey,this.chatMessage),this.selectedWorkspace=e,this.publicChatQrDataUrl=null,localStorage.setItem("taskmaster-selected-workspace",e),Tn(e),wr(e),this.settings=Bs(),this.chatMessage=zn(e,this.settings.sessionKey),this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestions=[],this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.waConversations=[],this.waSelectedJid=null,this.waMessages=[],this.waGroupInfo=null,this.waLastError=null,this.waSearchQuery="",this.waComposeDraft="",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.chatPageTab==="whatsapp"&&!this.waLoading&&this.waConversations.length===0&&this.reloadWhatsAppConversations()):this.advancedPage&&this.handleAdvancedLoad()}async reloadWhatsAppConversations(){if(!(!this.client||!this.connected)){this.waLoading=!0,this.waLastError=null;try{const e=this.getSelectedWorkspaceInfo(),t=e==null?void 0:e.whatsappAccountId,n=await this.client.request("whatsapp.conversations",{accountId:t});this.waConversations=n.conversations}catch(e){this.waLastError=String(e)}finally{this.waLoading=!1}}}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)}Tn(this.selectedWorkspace),wr(this.selectedWorkspace),this.settings=Bs(),this.chatMessage=zn(this.selectedWorkspace,this.settings.sessionKey),this.reloadCurrentPageData()}render(){return c`${v0(this)}${this.auditModalOpen?w0(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):w}`}};g([m()],f.prototype,"settings",2);g([m()],f.prototype,"password",2);g([m()],f.prototype,"tab",2);g([m()],f.prototype,"onboarding",2);g([m()],f.prototype,"setup",2);g([m()],f.prototype,"filesPage",2);g([m()],f.prototype,"browserPage",2);g([m()],f.prototype,"adminsPage",2);g([m()],f.prototype,"contactsPage",2);g([m()],f.prototype,"chatPage",2);g([m()],f.prototype,"advancedPage",2);g([m()],f.prototype,"advancedTab",2);g([m()],f.prototype,"publicChat",2);g([m()],f.prototype,"publicChatConfig",2);g([m()],f.prototype,"publicChatSessionKey",2);g([m()],f.prototype,"publicChatAuthenticated",2);g([m()],f.prototype,"publicChatAuthStep",2);g([m()],f.prototype,"connected",2);g([m()],f.prototype,"accessState",2);g([m()],f.prototype,"theme",2);g([m()],f.prototype,"themeResolved",2);g([m()],f.prototype,"hello",2);g([m()],f.prototype,"lastError",2);g([m()],f.prototype,"eventLog",2);g([m()],f.prototype,"assistantName",2);g([m()],f.prototype,"assistantAvatar",2);g([m()],f.prototype,"assistantAgentId",2);g([m()],f.prototype,"sessionKey",2);g([m()],f.prototype,"chatLoading",2);g([m()],f.prototype,"chatSending",2);g([m()],f.prototype,"chatMessage",2);g([m()],f.prototype,"chatMessages",2);g([m()],f.prototype,"chatHistoryTotal",2);g([m()],f.prototype,"chatHistoryHasMore",2);g([m()],f.prototype,"chatLoadingOlder",2);g([m()],f.prototype,"chatToolMessages",2);g([m()],f.prototype,"chatStream",2);g([m()],f.prototype,"chatInterimText",2);g([m()],f.prototype,"chatSuggestions",2);g([m()],f.prototype,"chatStreamStartedAt",2);g([m()],f.prototype,"chatRunId",2);g([m()],f.prototype,"compactionStatus",2);g([m()],f.prototype,"chatAvatarUrl",2);g([m()],f.prototype,"chatModelCatalog",2);g([m()],f.prototype,"chatVerboseLevel",2);g([m()],f.prototype,"chatQueue",2);g([m()],f.prototype,"chatAttachments",2);g([m()],f.prototype,"sidebarOpen",2);g([m()],f.prototype,"sidebarContent",2);g([m()],f.prototype,"sidebarError",2);g([m()],f.prototype,"splitRatio",2);g([m()],f.prototype,"nodesLoading",2);g([m()],f.prototype,"nodes",2);g([m()],f.prototype,"devicesLoading",2);g([m()],f.prototype,"devicesError",2);g([m()],f.prototype,"devicesList",2);g([m()],f.prototype,"execApprovalsLoading",2);g([m()],f.prototype,"execApprovalsSaving",2);g([m()],f.prototype,"execApprovalsDirty",2);g([m()],f.prototype,"execApprovalsSnapshot",2);g([m()],f.prototype,"execApprovalsForm",2);g([m()],f.prototype,"execApprovalsSelectedAgent",2);g([m()],f.prototype,"execApprovalsTarget",2);g([m()],f.prototype,"execApprovalsTargetNodeId",2);g([m()],f.prototype,"execApprovalQueue",2);g([m()],f.prototype,"execApprovalBusy",2);g([m()],f.prototype,"execApprovalError",2);g([m()],f.prototype,"configLoading",2);g([m()],f.prototype,"configRaw",2);g([m()],f.prototype,"configRawOriginal",2);g([m()],f.prototype,"configValid",2);g([m()],f.prototype,"configIssues",2);g([m()],f.prototype,"configSaving",2);g([m()],f.prototype,"configApplying",2);g([m()],f.prototype,"updateRunning",2);g([m()],f.prototype,"applySessionKey",2);g([m()],f.prototype,"configSnapshot",2);g([m()],f.prototype,"configSchema",2);g([m()],f.prototype,"configSchemaVersion",2);g([m()],f.prototype,"configSchemaLoading",2);g([m()],f.prototype,"configUiHints",2);g([m()],f.prototype,"configForm",2);g([m()],f.prototype,"configFormOriginal",2);g([m()],f.prototype,"configFormDirty",2);g([m()],f.prototype,"configFormMode",2);g([m()],f.prototype,"configSearchQuery",2);g([m()],f.prototype,"configActiveSection",2);g([m()],f.prototype,"configActiveSubsection",2);g([m()],f.prototype,"channelsLoading",2);g([m()],f.prototype,"channelsSnapshot",2);g([m()],f.prototype,"channelsError",2);g([m()],f.prototype,"channelsLastSuccess",2);g([m()],f.prototype,"whatsappLoginMessage",2);g([m()],f.prototype,"whatsappLoginQrDataUrl",2);g([m()],f.prototype,"whatsappLoginConnected",2);g([m()],f.prototype,"whatsappBusy",2);g([m()],f.prototype,"whatsappActiveQrAccountId",2);g([m()],f.prototype,"whatsappPairedPhone",2);g([m()],f.prototype,"addingWhatsAppAccount",2);g([m()],f.prototype,"newWhatsAppAccountName",2);g([m()],f.prototype,"whatsappAccountError",2);g([m()],f.prototype,"whatsappAccountSaving",2);g([m()],f.prototype,"whatsappSettingsOpen",2);g([m()],f.prototype,"publicChatToggleBusy",2);g([m()],f.prototype,"publicChatGreetingBusy",2);g([m()],f.prototype,"publicChatEmailBusy",2);g([m()],f.prototype,"publicChatSettingsOpen",2);g([m()],f.prototype,"publicChatWidgetModalOpen",2);g([m()],f.prototype,"brandingBusy",2);g([m()],f.prototype,"agentSettingsOpen",2);g([m()],f.prototype,"brandingExpanded",2);g([m()],f.prototype,"tailscaleStatus",2);g([m()],f.prototype,"tailscaleBusy",2);g([m()],f.prototype,"tailscaleAuthUrl",2);g([m()],f.prototype,"tailscaleError",2);g([m()],f.prototype,"tailscaleServeEnableUrl",2);g([m()],f.prototype,"tailscaleFunnelEnableUrl",2);g([m()],f.prototype,"tailscaleDisableConfirm",2);g([m()],f.prototype,"tailscaleConnectProgress",2);g([m()],f.prototype,"tailscaleConnectMessage",2);g([m()],f.prototype,"tailscaleConnectSuccess",2);g([m()],f.prototype,"wifiStatus",2);g([m()],f.prototype,"wifiNetworks",2);g([m()],f.prototype,"wifiBusy",2);g([m()],f.prototype,"wifiError",2);g([m()],f.prototype,"wifiPassword",2);g([m()],f.prototype,"wifiSelectedSsid",2);g([m()],f.prototype,"networkPort",2);g([m()],f.prototype,"networkHostname",2);g([m()],f.prototype,"networkPortInput",2);g([m()],f.prototype,"networkHostnameInput",2);g([m()],f.prototype,"networkModalOpen",2);g([m()],f.prototype,"networkBusy",2);g([m()],f.prototype,"networkError",2);g([m()],f.prototype,"networkSuccess",2);g([m()],f.prototype,"wifiModalOpen",2);g([m()],f.prototype,"licenseKey",2);g([m()],f.prototype,"licenseBusy",2);g([m()],f.prototype,"licenseValid",2);g([m()],f.prototype,"licenseMessage",2);g([m()],f.prototype,"licenseTier",2);g([m()],f.prototype,"licenseDeviceId",2);g([m()],f.prototype,"licenseStoredKey",2);g([m()],f.prototype,"licenseRemoveConfirm",2);g([m()],f.prototype,"authConnected",2);g([m()],f.prototype,"authBusy",2);g([m()],f.prototype,"authMessage",2);g([m()],f.prototype,"authUrl",2);g([m()],f.prototype,"authCodeInput",2);g([m()],f.prototype,"authExpiresIn",2);g([m()],f.prototype,"authRefreshToken",2);g([m()],f.prototype,"claudeAuthModalOpen",2);g([m()],f.prototype,"authRefreshTokenInput",2);g([m()],f.prototype,"authRefreshTokenBusy",2);g([m()],f.prototype,"authRefreshTokenError",2);g([m()],f.prototype,"setupStep",2);g([m()],f.prototype,"gatewayHealthy",2);g([m()],f.prototype,"gatewayHealthLoading",2);g([m()],f.prototype,"gatewayHealthMessage",2);g([m()],f.prototype,"gatewayRestartBusy",2);g([m()],f.prototype,"updateAvailable",2);g([m()],f.prototype,"currentVersion",2);g([m()],f.prototype,"latestVersion",2);g([m()],f.prototype,"updateChecking",2);g([m()],f.prototype,"updateMessage",2);g([m()],f.prototype,"updateProgressSteps",2);g([m()],f.prototype,"updateLastResult",2);g([m()],f.prototype,"uninstallConfirm",2);g([m()],f.prototype,"uninstallBusy",2);g([m()],f.prototype,"uninstallDone",2);g([m()],f.prototype,"uninstallError",2);g([m()],f.prototype,"uninstallConfirmText",2);g([m()],f.prototype,"nostrProfileFormState",2);g([m()],f.prototype,"nostrProfileAccountId",2);g([m()],f.prototype,"presenceLoading",2);g([m()],f.prototype,"presenceEntries",2);g([m()],f.prototype,"presenceError",2);g([m()],f.prototype,"presenceStatus",2);g([m()],f.prototype,"agentsLoading",2);g([m()],f.prototype,"agentsList",2);g([m()],f.prototype,"agentsError",2);g([m()],f.prototype,"sessionsLoading",2);g([m()],f.prototype,"sessionsResult",2);g([m()],f.prototype,"sessionsError",2);g([m()],f.prototype,"cronLoading",2);g([m()],f.prototype,"cronJobs",2);g([m()],f.prototype,"cronStatus",2);g([m()],f.prototype,"cronError",2);g([m()],f.prototype,"cronForm",2);g([m()],f.prototype,"cronRunsJobId",2);g([m()],f.prototype,"cronRuns",2);g([m()],f.prototype,"cronBusy",2);g([m()],f.prototype,"cronNewEventModal",2);g([m()],f.prototype,"cronDetailJobId",2);g([m()],f.prototype,"cronEditJobId",2);g([m()],f.prototype,"cronPendingDeleteId",2);g([m()],f.prototype,"cronRunModalJobId",2);g([m()],f.prototype,"cronRunModalJobName",2);g([m()],f.prototype,"cronRunResult",2);g([m()],f.prototype,"openingHoursLoading",2);g([m()],f.prototype,"openingHoursError",2);g([m()],f.prototype,"openingHoursBusy",2);g([m()],f.prototype,"openingHoursForm",2);g([m()],f.prototype,"browserScreencastActive",2);g([m()],f.prototype,"browserScreencastFrame",2);g([m()],f.prototype,"browserScreencastMetadata",2);g([m()],f.prototype,"browserHandoffPending",2);g([m()],f.prototype,"browserHandoffReason",2);g([m()],f.prototype,"browserHandoffId",2);g([m()],f.prototype,"browserInputMode",2);g([m()],f.prototype,"browserFullscreen",2);g([m()],f.prototype,"browserLoading",2);g([m()],f.prototype,"browserError",2);g([m()],f.prototype,"filesLoading",2);g([m()],f.prototype,"filesTree",2);g([m()],f.prototype,"filesRoot",2);g([m()],f.prototype,"filesError",2);g([m()],f.prototype,"filesSelectedPath",2);g([m()],f.prototype,"filesSelectedPaths",2);g([m()],f.prototype,"filesPreviewContent",2);g([m()],f.prototype,"filesPreviewLoading",2);g([m()],f.prototype,"filesPreviewBinary",2);g([m()],f.prototype,"filesPreviewSize",2);g([m()],f.prototype,"filesExpandedDirs",2);g([m()],f.prototype,"filesCurrentDir",2);g([m()],f.prototype,"filesPendingDeletePath",2);g([m()],f.prototype,"filesMessage",2);g([m()],f.prototype,"filesUploadBusy",2);g([m()],f.prototype,"filesReindexBusy",2);g([m()],f.prototype,"filesMemoryStatus",2);g([m()],f.prototype,"embeddingDownloading",2);g([m()],f.prototype,"filesSearchQuery",2);g([m()],f.prototype,"filesSearchResults",2);g([m()],f.prototype,"filesSearchLoading",2);g([m()],f.prototype,"filesSearchAgentId",2);g([m()],f.prototype,"auditEntries",2);g([m()],f.prototype,"auditLoading",2);g([m()],f.prototype,"auditModalOpen",2);g([m()],f.prototype,"skillsLoading",2);g([m()],f.prototype,"skillsReport",2);g([m()],f.prototype,"skillsError",2);g([m()],f.prototype,"skillsFilter",2);g([m()],f.prototype,"skillsTypeFilter",2);g([m()],f.prototype,"skillsAgentFilter",2);g([m()],f.prototype,"skillEdits",2);g([m()],f.prototype,"skillsBusyKey",2);g([m()],f.prototype,"skillMessages",2);g([m()],f.prototype,"skillDetail",2);g([m()],f.prototype,"skillDetailTab",2);g([m()],f.prototype,"skillAddModal",2);g([m()],f.prototype,"skillAddForm",2);g([m()],f.prototype,"skillAddFormSource",2);g([m()],f.prototype,"skillEditTab",2);g([m()],f.prototype,"skillDrafts",2);g([m()],f.prototype,"adminsLoading",2);g([m()],f.prototype,"adminPhones",2);g([m()],f.prototype,"adminsError",2);g([m()],f.prototype,"adminsSaving",2);g([m()],f.prototype,"adminsNewPhone",2);g([m()],f.prototype,"contactsLoading",2);g([m()],f.prototype,"contactsSaving",2);g([m()],f.prototype,"contactsRecords",2);g([m()],f.prototype,"contactsError",2);g([m()],f.prototype,"contactsSearchQuery",2);g([m()],f.prototype,"contactsEditingId",2);g([m()],f.prototype,"contactsShowAddForm",2);g([m()],f.prototype,"contactsNewPhone",2);g([m()],f.prototype,"contactsNewName",2);g([m()],f.prototype,"contactsDeleteConfirmId",2);g([m()],f.prototype,"contactsAddFieldForId",2);g([m()],f.prototype,"contactsAddFieldKey",2);g([m()],f.prototype,"contactsAddFieldValue",2);g([m()],f.prototype,"imessageEnableConfirm",2);g([m()],f.prototype,"imessageEnabling",2);g([m()],f.prototype,"chatPageTab",2);g([m()],f.prototype,"waConversations",2);g([m()],f.prototype,"waSelectedJid",2);g([m()],f.prototype,"waMessages",2);g([m()],f.prototype,"waGroupInfo",2);g([m()],f.prototype,"waLoading",2);g([m()],f.prototype,"waMessagesLoading",2);g([m()],f.prototype,"waSearchQuery",2);g([m()],f.prototype,"waComposeDraft",2);g([m()],f.prototype,"waSending",2);g([m()],f.prototype,"waLastError",2);g([m()],f.prototype,"infoModalOpen",2);g([m()],f.prototype,"remoteAccessQrDataUrl",2);g([m()],f.prototype,"publicChatQrDataUrl",2);g([m()],f.prototype,"workspaces",2);g([m()],f.prototype,"workspacesLoading",2);g([m()],f.prototype,"workspacesError",2);g([m()],f.prototype,"selectedWorkspace",2);g([m()],f.prototype,"addingWorkspace",2);g([m()],f.prototype,"newWorkspaceName",2);g([m()],f.prototype,"newWorkspacePath",2);g([m()],f.prototype,"newWorkspacePin",2);g([m()],f.prototype,"accountPinModalOpen",2);g([m()],f.prototype,"accountPinBusy",2);g([m()],f.prototype,"accountPinError",2);g([m()],f.prototype,"accountPinSuccess",2);g([m()],f.prototype,"apiKeyProviders",2);g([m()],f.prototype,"apiKeyModalOpen",2);g([m()],f.prototype,"apiKeyBusy",2);g([m()],f.prototype,"apiKeyError",2);g([m()],f.prototype,"apiKeySuccess",2);g([m()],f.prototype,"apiKeySavingProvider",2);g([m()],f.prototype,"authApiKeyMode",2);g([m()],f.prototype,"authApiKeyInput",2);g([m()],f.prototype,"authApiKeyBusy",2);g([m()],f.prototype,"authApiKeyError",2);g([m()],f.prototype,"pinChanging",2);g([m()],f.prototype,"pinChangeBusy",2);g([m()],f.prototype,"pinChangeError",2);g([m()],f.prototype,"loginChangePinMode",2);g([m()],f.prototype,"changePinBusy",2);g([m()],f.prototype,"changePinError",2);g([m()],f.prototype,"changePinSuccess",2);g([m()],f.prototype,"workspaceSaving",2);g([m()],f.prototype,"workspaceRemoveConfirm",2);g([m()],f.prototype,"renamingWorkspace",2);g([m()],f.prototype,"renameWorkspaceName",2);g([m()],f.prototype,"debugLoading",2);g([m()],f.prototype,"debugStatus",2);g([m()],f.prototype,"debugHealth",2);g([m()],f.prototype,"debugModels",2);g([m()],f.prototype,"debugHeartbeat",2);g([m()],f.prototype,"debugCallMethod",2);g([m()],f.prototype,"debugCallParams",2);g([m()],f.prototype,"debugCallResult",2);g([m()],f.prototype,"debugCallError",2);g([m()],f.prototype,"logsLoading",2);g([m()],f.prototype,"logsError",2);g([m()],f.prototype,"logsFile",2);g([m()],f.prototype,"logsEntries",2);g([m()],f.prototype,"logsFilterText",2);g([m()],f.prototype,"logsLevelFilters",2);g([m()],f.prototype,"logsAutoFollow",2);g([m()],f.prototype,"logsTruncated",2);g([m()],f.prototype,"logsCursor",2);g([m()],f.prototype,"logsLastFetchAt",2);g([m()],f.prototype,"logsLimit",2);g([m()],f.prototype,"logsMaxBytes",2);g([m()],f.prototype,"logsAtBottom",2);g([m()],f.prototype,"logsDate",2);g([m()],f.prototype,"logsAvailableDates",2);g([m()],f.prototype,"logsSubTab",2);g([m()],f.prototype,"logsChipsExpanded",2);g([m()],f.prototype,"sessionLogsLoading",2);g([m()],f.prototype,"sessionLogsError",2);g([m()],f.prototype,"sessionLogsEntries",2);g([m()],f.prototype,"sessionLogsFilterText",2);g([m()],f.prototype,"sessionLogsTypeFilters",2);g([m()],f.prototype,"sessionLogsAgentFilters",2);g([m()],f.prototype,"sessionLogsAgents",2);g([m()],f.prototype,"sessionLogsAutoFollow",2);g([m()],f.prototype,"sessionLogsChipsExpanded",2);g([m()],f.prototype,"sessionLogsCursors",2);g([m()],f.prototype,"sessionLogsLastFetchAt",2);g([m()],f.prototype,"sessionLogsAtBottom",2);g([m()],f.prototype,"chatUserNearBottom",2);f=g([jl("taskmaster-app")],f);
4934
- //# sourceMappingURL=index-B1bLQjxV.js.map
4933
+ `,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.publicChatGreetingBusy=!1,this.publicChatEmailBusy=!1,this.publicChatSettingsOpen=!1,this.publicChatWidgetModalOpen=!1,this.brandingBusy=!1,this.agentSettingsOpen=!1,this.brandingExpanded=!1,this.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleServeEnableUrl=null,this.tailscaleFunnelEnableUrl=null,this.tailscaleDisableConfirm=!1,this.tailscaleConnectProgress=0,this.tailscaleConnectMessage="",this.tailscaleConnectSuccess=!1,this.wifiStatus=null,this.wifiNetworks=[],this.wifiBusy=!1,this.wifiError=null,this.wifiPassword="",this.wifiSelectedSsid=null,this.networkPort=null,this.networkHostname="",this.networkPortInput="",this.networkHostnameInput="",this.networkModalOpen=!1,this.networkBusy=!1,this.networkError=null,this.networkSuccess=null,this.wifiModalOpen=!1,this.licenseKey="",this.licenseBusy=!1,this.licenseValid=null,this.licenseMessage=null,this.licenseTier=null,this.licenseDeviceId=null,this.licenseStoredKey=null,this.licenseRemoveConfirm=!1,this.authConnected=null,this.authBusy=!1,this.authMessage=null,this.authUrl=null,this.authCodeInput="",this.authExpiresIn=null,this.authRefreshToken=null,this.claudeAuthModalOpen=!1,this.authRefreshTokenInput="",this.authRefreshTokenBusy=!1,this.authRefreshTokenError=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={...x0},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.cronEditJobId=null,this.cronPendingDeleteId=null,this.cronRunModalJobId=null,this.cronRunModalJobName="",this.cronRunResult=null,this.openingHoursLoading=!1,this.openingHoursError=null,this.openingHoursBusy=!1,this.openingHoursForm=Wa(),this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserFullscreen=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesCurrentDir=".",this.filesPendingDeletePath=null,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.embeddingDownloading=!1,this.embeddingPollTimer=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.filesResolvedAgentId=void 0,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillsTypeFilter="all",this.skillsAgentFilter="all",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillDetail=null,this.skillDetailTab="",this.skillAddModal=!1,this.skillAddForm={name:"",skillContent:"",references:[]},this.skillAddFormSource="draft",this.skillEditTab="SKILL.md",this.skillDrafts=[],this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.contactsLoading=!1,this.contactsSaving=!1,this.contactsRecords=[],this.contactsError=null,this.contactsSearchQuery="",this.contactsEditingId=null,this.contactsShowAddForm=!1,this.contactsNewPhone="",this.contactsNewName="",this.contactsDeleteConfirmId=null,this.contactsAddFieldForId=null,this.contactsAddFieldKey="",this.contactsAddFieldValue="",this.imessageEnableConfirm=!1,this.imessageEnabling=!1,this.chatPageTab="chat",this.waConversations=[],this.waSelectedJid=null,this.waMessages=[],this.waGroupInfo=null,this.waLoading=!1,this.waMessagesLoading=!1,this.waSearchQuery="",this.waComposeDraft="",this.waSending=!1,this.waLastError=null,this.infoModalOpen=null,this.remoteAccessQrDataUrl=null,this.publicChatQrDataUrl=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={...k0},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=5e3,this.logsMaxBytes=2e6,this.logsAtBottom=!0,this.logsDate=null,this.logsAvailableDates=[],this.logsSubTab="session",this.logsChipsExpanded=!1,this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,tool_call:!0,tool_result:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsChipsExpanded=!1,this.sessionLogsExpandedIds=new Set,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.onLoadOlder=()=>this.handleLoadOlderChat(),this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>Xf(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,this._beforeUnloadHandler=()=>{var t;xo();const e=this.selectedWorkspace??((t=this.publicChatConfig)==null?void 0:t.accountId)??"";e&&Wn(e,this.sessionKey,this.chatMessage)}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),$0(this),window.addEventListener("beforeunload",this._beforeUnloadHandler)}firstUpdated(){S0(this)}disconnectedCallback(){window.removeEventListener("beforeunload",this._beforeUnloadHandler),this.stopEmbeddingPoll(),A0(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){C0(this,e)}connect(){Oe(this)}handleChatScroll(e){ch(this,e)}handleLogsScroll(e){uh(this,e)}handleSessionLogsScroll(e){ph(this,e)}exportLogs(e,t){fh(e,t)}exportSessionLogs(e,t){gh(e,t)}resetToolStream(){na(this)}resetChatScroll(){hh(this)}async loadAssistantIdentity(){await Vo(this)}applySettings(e){at(this,e)}setTab(e){qf(this,e)}setTheme(e,t){jf(this,e,t)}async loadOverview(){await pd(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.accountId=this.selectedWorkspace??void 0,this.cronForm={...this.cronForm,accountId:this.selectedWorkspace??void 0},await hd(this)}async handleAbortChat(){await gd(this)}removeQueuedMessage(e){ng(this,e)}async handleSendChat(e,t){await ig(this,e,t)}async handleWhatsAppStart(e,t){await T0(this,e,t)}async handleWhatsAppWait(e){await _0(this,e)}async handleWhatsAppLogout(e){await M0(this,e)}async handleAddWhatsAppAccount(e){await P0(this,e)}async handleRemoveWhatsAppAccount(e){await I0(this,e)}async handleAccessCheck(){await Er(this)}async handlePinSubmit(e,t){await _h(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await Mh(this,e)}async handleLogout(){await Ih(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 Er(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 G0(this)}async handleLicenseActivate(){await V0(this)}async handleLicenseRemove(){await Q0(this)}handleLicenseKeyChange(e){J0(this,e)}async handleAuthStatusCheck(){await K0(this)}async handleAuthStart(){await H0(this)}async handleAuthSubmitCode(e){await q0(this,e)}handleAuthCodeChange(e){j0(this,e)}handleClaudeAuthModalOpen(){this.claudeAuthModalOpen=!0}handleClaudeAuthModalClose(){this.claudeAuthModalOpen=!1,this.authUrl=null,this.authRefreshTokenInput="",this.authRefreshTokenError=null}async handleImportRefreshToken(){await z0(this)}async handleGatewayHealthCheck(){await Y0(this)}async handleGatewayRestart(){await X0(this)}async handleUpdateCheck(){await Eu(this)}async handleUpdateRun(){await Fk(this)}handleUpdateDismissResult(){zk(this)}handleUninstallConfirm(){this.uninstallConfirm=!0,this.uninstallConfirmText=""}handleUninstallCancel(){this.uninstallConfirm=!1,this.uninstallConfirmText="",this.uninstallError=null}handleUninstallConfirmTextChange(e){this.uninstallConfirmText=e}async handleUninstallRun(){const{runUninstall:e}=await ae(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>Dr);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){ae(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>Dr);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await ad(this)}async clearAudit(){await Af(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,rn(this,t),us(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();ae(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>o0);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.chatSuggestions=[],this.resetChatScroll(),this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}ae(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>Oi);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this).then(()=>{sn(this,!0)})})}async handleLoadOlderChat(){if(this.chatLoadingOlder||!this.chatHistoryHasMore)return;const e=dh(this),{loadOlderChatHistory:t}=await ae(async()=>{const{loadOlderChatHistory:i}=await Promise.resolve().then(()=>Oi);return{loadOlderChatHistory:i}},void 0,import.meta.url);await t(this)&&e&&(await this.updateComplete,e())}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.selectedWorkspace&&this.loadCron(),this.advancedTab==="opening-hours"&&ae(async()=>{const{loadOpeningHours:n}=await Promise.resolve().then(()=>i0);return{loadOpeningHours:n}},void 0,import.meta.url).then(({loadOpeningHours:n})=>{n(this)}),this.advancedTab==="logs"&&(this.logsSubTab==="session"?ae(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>od);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):ae(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>Nh);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&ae(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>vf);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await R0(this)}async handleChannelConfigReload(){await L0(this)}handleNostrProfileEdit(e,t){B0(this,e,t)}handleNostrProfileCancel(){N0(this)}handleNostrProfileFieldChange(e,t){O0(this,e,t)}async handleNostrProfileSave(){await U0(this)}async handleNostrProfileImport(){await W0(this)}handleNostrProfileToggleAdvanced(){F0(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleContactsLoad(){const e=this.selectedWorkspace??void 0;ae(async()=>{const{loadContacts:t}=await Promise.resolve().then(()=>a0);return{loadContacts:t}},void 0,import.meta.url).then(({loadContacts:t})=>{t(this,e)})}handleContactsNewPhoneChange(e){this.contactsNewPhone=e,this.contactsError&&(this.contactsError=null)}handleContactsNewNameChange(e){this.contactsNewName=e,this.contactsError&&(this.contactsError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await ae(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>ki);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await ae(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>ki);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await ae(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>Eh);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const o=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,o),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(o),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await ae(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>ki);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=(e==null?void 0:e.displayName)??(e==null?void 0:e.name)??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await ae(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>ki);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){xo(),this.selectedWorkspace&&Wn(this.selectedWorkspace,this.sessionKey,this.chatMessage),this.selectedWorkspace=e,this.publicChatQrDataUrl=null,localStorage.setItem("taskmaster-selected-workspace",e),Tn(e),wr(e),this.settings=Bs(),this.chatMessage=zn(e,this.settings.sessionKey),this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestions=[],this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.waConversations=[],this.waSelectedJid=null,this.waMessages=[],this.waGroupInfo=null,this.waLastError=null,this.waSearchQuery="",this.waComposeDraft="",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.chatPageTab==="whatsapp"&&!this.waLoading&&this.waConversations.length===0&&this.reloadWhatsAppConversations()):this.advancedPage&&this.handleAdvancedLoad()}async reloadWhatsAppConversations(){if(!(!this.client||!this.connected)){this.waLoading=!0,this.waLastError=null;try{const e=this.getSelectedWorkspaceInfo(),t=e==null?void 0:e.whatsappAccountId,n=await this.client.request("whatsapp.conversations",{accountId:t});this.waConversations=n.conversations}catch(e){this.waLastError=String(e)}finally{this.waLoading=!1}}}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)}Tn(this.selectedWorkspace),wr(this.selectedWorkspace),this.settings=Bs(),this.chatMessage=zn(this.selectedWorkspace,this.settings.sessionKey),this.reloadCurrentPageData()}render(){return c`${v0(this)}${this.auditModalOpen?w0(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):w}`}};g([m()],f.prototype,"settings",2);g([m()],f.prototype,"password",2);g([m()],f.prototype,"tab",2);g([m()],f.prototype,"onboarding",2);g([m()],f.prototype,"setup",2);g([m()],f.prototype,"filesPage",2);g([m()],f.prototype,"browserPage",2);g([m()],f.prototype,"adminsPage",2);g([m()],f.prototype,"contactsPage",2);g([m()],f.prototype,"chatPage",2);g([m()],f.prototype,"advancedPage",2);g([m()],f.prototype,"advancedTab",2);g([m()],f.prototype,"publicChat",2);g([m()],f.prototype,"publicChatConfig",2);g([m()],f.prototype,"publicChatSessionKey",2);g([m()],f.prototype,"publicChatAuthenticated",2);g([m()],f.prototype,"publicChatAuthStep",2);g([m()],f.prototype,"connected",2);g([m()],f.prototype,"accessState",2);g([m()],f.prototype,"theme",2);g([m()],f.prototype,"themeResolved",2);g([m()],f.prototype,"hello",2);g([m()],f.prototype,"lastError",2);g([m()],f.prototype,"eventLog",2);g([m()],f.prototype,"assistantName",2);g([m()],f.prototype,"assistantAvatar",2);g([m()],f.prototype,"assistantAgentId",2);g([m()],f.prototype,"sessionKey",2);g([m()],f.prototype,"chatLoading",2);g([m()],f.prototype,"chatSending",2);g([m()],f.prototype,"chatMessage",2);g([m()],f.prototype,"chatMessages",2);g([m()],f.prototype,"chatHistoryTotal",2);g([m()],f.prototype,"chatHistoryHasMore",2);g([m()],f.prototype,"chatLoadingOlder",2);g([m()],f.prototype,"chatToolMessages",2);g([m()],f.prototype,"chatStream",2);g([m()],f.prototype,"chatInterimText",2);g([m()],f.prototype,"chatSuggestions",2);g([m()],f.prototype,"chatStreamStartedAt",2);g([m()],f.prototype,"chatRunId",2);g([m()],f.prototype,"compactionStatus",2);g([m()],f.prototype,"chatAvatarUrl",2);g([m()],f.prototype,"chatModelCatalog",2);g([m()],f.prototype,"chatVerboseLevel",2);g([m()],f.prototype,"chatQueue",2);g([m()],f.prototype,"chatAttachments",2);g([m()],f.prototype,"sidebarOpen",2);g([m()],f.prototype,"sidebarContent",2);g([m()],f.prototype,"sidebarError",2);g([m()],f.prototype,"splitRatio",2);g([m()],f.prototype,"nodesLoading",2);g([m()],f.prototype,"nodes",2);g([m()],f.prototype,"devicesLoading",2);g([m()],f.prototype,"devicesError",2);g([m()],f.prototype,"devicesList",2);g([m()],f.prototype,"execApprovalsLoading",2);g([m()],f.prototype,"execApprovalsSaving",2);g([m()],f.prototype,"execApprovalsDirty",2);g([m()],f.prototype,"execApprovalsSnapshot",2);g([m()],f.prototype,"execApprovalsForm",2);g([m()],f.prototype,"execApprovalsSelectedAgent",2);g([m()],f.prototype,"execApprovalsTarget",2);g([m()],f.prototype,"execApprovalsTargetNodeId",2);g([m()],f.prototype,"execApprovalQueue",2);g([m()],f.prototype,"execApprovalBusy",2);g([m()],f.prototype,"execApprovalError",2);g([m()],f.prototype,"configLoading",2);g([m()],f.prototype,"configRaw",2);g([m()],f.prototype,"configRawOriginal",2);g([m()],f.prototype,"configValid",2);g([m()],f.prototype,"configIssues",2);g([m()],f.prototype,"configSaving",2);g([m()],f.prototype,"configApplying",2);g([m()],f.prototype,"updateRunning",2);g([m()],f.prototype,"applySessionKey",2);g([m()],f.prototype,"configSnapshot",2);g([m()],f.prototype,"configSchema",2);g([m()],f.prototype,"configSchemaVersion",2);g([m()],f.prototype,"configSchemaLoading",2);g([m()],f.prototype,"configUiHints",2);g([m()],f.prototype,"configForm",2);g([m()],f.prototype,"configFormOriginal",2);g([m()],f.prototype,"configFormDirty",2);g([m()],f.prototype,"configFormMode",2);g([m()],f.prototype,"configSearchQuery",2);g([m()],f.prototype,"configActiveSection",2);g([m()],f.prototype,"configActiveSubsection",2);g([m()],f.prototype,"channelsLoading",2);g([m()],f.prototype,"channelsSnapshot",2);g([m()],f.prototype,"channelsError",2);g([m()],f.prototype,"channelsLastSuccess",2);g([m()],f.prototype,"whatsappLoginMessage",2);g([m()],f.prototype,"whatsappLoginQrDataUrl",2);g([m()],f.prototype,"whatsappLoginConnected",2);g([m()],f.prototype,"whatsappBusy",2);g([m()],f.prototype,"whatsappActiveQrAccountId",2);g([m()],f.prototype,"whatsappPairedPhone",2);g([m()],f.prototype,"addingWhatsAppAccount",2);g([m()],f.prototype,"newWhatsAppAccountName",2);g([m()],f.prototype,"whatsappAccountError",2);g([m()],f.prototype,"whatsappAccountSaving",2);g([m()],f.prototype,"whatsappSettingsOpen",2);g([m()],f.prototype,"publicChatToggleBusy",2);g([m()],f.prototype,"publicChatGreetingBusy",2);g([m()],f.prototype,"publicChatEmailBusy",2);g([m()],f.prototype,"publicChatSettingsOpen",2);g([m()],f.prototype,"publicChatWidgetModalOpen",2);g([m()],f.prototype,"brandingBusy",2);g([m()],f.prototype,"agentSettingsOpen",2);g([m()],f.prototype,"brandingExpanded",2);g([m()],f.prototype,"tailscaleStatus",2);g([m()],f.prototype,"tailscaleBusy",2);g([m()],f.prototype,"tailscaleAuthUrl",2);g([m()],f.prototype,"tailscaleError",2);g([m()],f.prototype,"tailscaleServeEnableUrl",2);g([m()],f.prototype,"tailscaleFunnelEnableUrl",2);g([m()],f.prototype,"tailscaleDisableConfirm",2);g([m()],f.prototype,"tailscaleConnectProgress",2);g([m()],f.prototype,"tailscaleConnectMessage",2);g([m()],f.prototype,"tailscaleConnectSuccess",2);g([m()],f.prototype,"wifiStatus",2);g([m()],f.prototype,"wifiNetworks",2);g([m()],f.prototype,"wifiBusy",2);g([m()],f.prototype,"wifiError",2);g([m()],f.prototype,"wifiPassword",2);g([m()],f.prototype,"wifiSelectedSsid",2);g([m()],f.prototype,"networkPort",2);g([m()],f.prototype,"networkHostname",2);g([m()],f.prototype,"networkPortInput",2);g([m()],f.prototype,"networkHostnameInput",2);g([m()],f.prototype,"networkModalOpen",2);g([m()],f.prototype,"networkBusy",2);g([m()],f.prototype,"networkError",2);g([m()],f.prototype,"networkSuccess",2);g([m()],f.prototype,"wifiModalOpen",2);g([m()],f.prototype,"licenseKey",2);g([m()],f.prototype,"licenseBusy",2);g([m()],f.prototype,"licenseValid",2);g([m()],f.prototype,"licenseMessage",2);g([m()],f.prototype,"licenseTier",2);g([m()],f.prototype,"licenseDeviceId",2);g([m()],f.prototype,"licenseStoredKey",2);g([m()],f.prototype,"licenseRemoveConfirm",2);g([m()],f.prototype,"authConnected",2);g([m()],f.prototype,"authBusy",2);g([m()],f.prototype,"authMessage",2);g([m()],f.prototype,"authUrl",2);g([m()],f.prototype,"authCodeInput",2);g([m()],f.prototype,"authExpiresIn",2);g([m()],f.prototype,"authRefreshToken",2);g([m()],f.prototype,"claudeAuthModalOpen",2);g([m()],f.prototype,"authRefreshTokenInput",2);g([m()],f.prototype,"authRefreshTokenBusy",2);g([m()],f.prototype,"authRefreshTokenError",2);g([m()],f.prototype,"setupStep",2);g([m()],f.prototype,"gatewayHealthy",2);g([m()],f.prototype,"gatewayHealthLoading",2);g([m()],f.prototype,"gatewayHealthMessage",2);g([m()],f.prototype,"gatewayRestartBusy",2);g([m()],f.prototype,"updateAvailable",2);g([m()],f.prototype,"currentVersion",2);g([m()],f.prototype,"latestVersion",2);g([m()],f.prototype,"updateChecking",2);g([m()],f.prototype,"updateMessage",2);g([m()],f.prototype,"updateProgressSteps",2);g([m()],f.prototype,"updateLastResult",2);g([m()],f.prototype,"uninstallConfirm",2);g([m()],f.prototype,"uninstallBusy",2);g([m()],f.prototype,"uninstallDone",2);g([m()],f.prototype,"uninstallError",2);g([m()],f.prototype,"uninstallConfirmText",2);g([m()],f.prototype,"nostrProfileFormState",2);g([m()],f.prototype,"nostrProfileAccountId",2);g([m()],f.prototype,"presenceLoading",2);g([m()],f.prototype,"presenceEntries",2);g([m()],f.prototype,"presenceError",2);g([m()],f.prototype,"presenceStatus",2);g([m()],f.prototype,"agentsLoading",2);g([m()],f.prototype,"agentsList",2);g([m()],f.prototype,"agentsError",2);g([m()],f.prototype,"sessionsLoading",2);g([m()],f.prototype,"sessionsResult",2);g([m()],f.prototype,"sessionsError",2);g([m()],f.prototype,"cronLoading",2);g([m()],f.prototype,"cronJobs",2);g([m()],f.prototype,"cronStatus",2);g([m()],f.prototype,"cronError",2);g([m()],f.prototype,"cronForm",2);g([m()],f.prototype,"cronRunsJobId",2);g([m()],f.prototype,"cronRuns",2);g([m()],f.prototype,"cronBusy",2);g([m()],f.prototype,"cronNewEventModal",2);g([m()],f.prototype,"cronDetailJobId",2);g([m()],f.prototype,"cronEditJobId",2);g([m()],f.prototype,"cronPendingDeleteId",2);g([m()],f.prototype,"cronRunModalJobId",2);g([m()],f.prototype,"cronRunModalJobName",2);g([m()],f.prototype,"cronRunResult",2);g([m()],f.prototype,"openingHoursLoading",2);g([m()],f.prototype,"openingHoursError",2);g([m()],f.prototype,"openingHoursBusy",2);g([m()],f.prototype,"openingHoursForm",2);g([m()],f.prototype,"browserScreencastActive",2);g([m()],f.prototype,"browserScreencastFrame",2);g([m()],f.prototype,"browserScreencastMetadata",2);g([m()],f.prototype,"browserHandoffPending",2);g([m()],f.prototype,"browserHandoffReason",2);g([m()],f.prototype,"browserHandoffId",2);g([m()],f.prototype,"browserInputMode",2);g([m()],f.prototype,"browserFullscreen",2);g([m()],f.prototype,"browserLoading",2);g([m()],f.prototype,"browserError",2);g([m()],f.prototype,"filesLoading",2);g([m()],f.prototype,"filesTree",2);g([m()],f.prototype,"filesRoot",2);g([m()],f.prototype,"filesError",2);g([m()],f.prototype,"filesSelectedPath",2);g([m()],f.prototype,"filesSelectedPaths",2);g([m()],f.prototype,"filesPreviewContent",2);g([m()],f.prototype,"filesPreviewLoading",2);g([m()],f.prototype,"filesPreviewBinary",2);g([m()],f.prototype,"filesPreviewSize",2);g([m()],f.prototype,"filesExpandedDirs",2);g([m()],f.prototype,"filesCurrentDir",2);g([m()],f.prototype,"filesPendingDeletePath",2);g([m()],f.prototype,"filesMessage",2);g([m()],f.prototype,"filesUploadBusy",2);g([m()],f.prototype,"filesReindexBusy",2);g([m()],f.prototype,"filesMemoryStatus",2);g([m()],f.prototype,"embeddingDownloading",2);g([m()],f.prototype,"filesSearchQuery",2);g([m()],f.prototype,"filesSearchResults",2);g([m()],f.prototype,"filesSearchLoading",2);g([m()],f.prototype,"filesSearchAgentId",2);g([m()],f.prototype,"auditEntries",2);g([m()],f.prototype,"auditLoading",2);g([m()],f.prototype,"auditModalOpen",2);g([m()],f.prototype,"skillsLoading",2);g([m()],f.prototype,"skillsReport",2);g([m()],f.prototype,"skillsError",2);g([m()],f.prototype,"skillsFilter",2);g([m()],f.prototype,"skillsTypeFilter",2);g([m()],f.prototype,"skillsAgentFilter",2);g([m()],f.prototype,"skillEdits",2);g([m()],f.prototype,"skillsBusyKey",2);g([m()],f.prototype,"skillMessages",2);g([m()],f.prototype,"skillDetail",2);g([m()],f.prototype,"skillDetailTab",2);g([m()],f.prototype,"skillAddModal",2);g([m()],f.prototype,"skillAddForm",2);g([m()],f.prototype,"skillAddFormSource",2);g([m()],f.prototype,"skillEditTab",2);g([m()],f.prototype,"skillDrafts",2);g([m()],f.prototype,"adminsLoading",2);g([m()],f.prototype,"adminPhones",2);g([m()],f.prototype,"adminsError",2);g([m()],f.prototype,"adminsSaving",2);g([m()],f.prototype,"adminsNewPhone",2);g([m()],f.prototype,"contactsLoading",2);g([m()],f.prototype,"contactsSaving",2);g([m()],f.prototype,"contactsRecords",2);g([m()],f.prototype,"contactsError",2);g([m()],f.prototype,"contactsSearchQuery",2);g([m()],f.prototype,"contactsEditingId",2);g([m()],f.prototype,"contactsShowAddForm",2);g([m()],f.prototype,"contactsNewPhone",2);g([m()],f.prototype,"contactsNewName",2);g([m()],f.prototype,"contactsDeleteConfirmId",2);g([m()],f.prototype,"contactsAddFieldForId",2);g([m()],f.prototype,"contactsAddFieldKey",2);g([m()],f.prototype,"contactsAddFieldValue",2);g([m()],f.prototype,"imessageEnableConfirm",2);g([m()],f.prototype,"imessageEnabling",2);g([m()],f.prototype,"chatPageTab",2);g([m()],f.prototype,"waConversations",2);g([m()],f.prototype,"waSelectedJid",2);g([m()],f.prototype,"waMessages",2);g([m()],f.prototype,"waGroupInfo",2);g([m()],f.prototype,"waLoading",2);g([m()],f.prototype,"waMessagesLoading",2);g([m()],f.prototype,"waSearchQuery",2);g([m()],f.prototype,"waComposeDraft",2);g([m()],f.prototype,"waSending",2);g([m()],f.prototype,"waLastError",2);g([m()],f.prototype,"infoModalOpen",2);g([m()],f.prototype,"remoteAccessQrDataUrl",2);g([m()],f.prototype,"publicChatQrDataUrl",2);g([m()],f.prototype,"workspaces",2);g([m()],f.prototype,"workspacesLoading",2);g([m()],f.prototype,"workspacesError",2);g([m()],f.prototype,"selectedWorkspace",2);g([m()],f.prototype,"addingWorkspace",2);g([m()],f.prototype,"newWorkspaceName",2);g([m()],f.prototype,"newWorkspacePath",2);g([m()],f.prototype,"newWorkspacePin",2);g([m()],f.prototype,"accountPinModalOpen",2);g([m()],f.prototype,"accountPinBusy",2);g([m()],f.prototype,"accountPinError",2);g([m()],f.prototype,"accountPinSuccess",2);g([m()],f.prototype,"apiKeyProviders",2);g([m()],f.prototype,"apiKeyModalOpen",2);g([m()],f.prototype,"apiKeyBusy",2);g([m()],f.prototype,"apiKeyError",2);g([m()],f.prototype,"apiKeySuccess",2);g([m()],f.prototype,"apiKeySavingProvider",2);g([m()],f.prototype,"authApiKeyMode",2);g([m()],f.prototype,"authApiKeyInput",2);g([m()],f.prototype,"authApiKeyBusy",2);g([m()],f.prototype,"authApiKeyError",2);g([m()],f.prototype,"pinChanging",2);g([m()],f.prototype,"pinChangeBusy",2);g([m()],f.prototype,"pinChangeError",2);g([m()],f.prototype,"loginChangePinMode",2);g([m()],f.prototype,"changePinBusy",2);g([m()],f.prototype,"changePinError",2);g([m()],f.prototype,"changePinSuccess",2);g([m()],f.prototype,"workspaceSaving",2);g([m()],f.prototype,"workspaceRemoveConfirm",2);g([m()],f.prototype,"renamingWorkspace",2);g([m()],f.prototype,"renameWorkspaceName",2);g([m()],f.prototype,"debugLoading",2);g([m()],f.prototype,"debugStatus",2);g([m()],f.prototype,"debugHealth",2);g([m()],f.prototype,"debugModels",2);g([m()],f.prototype,"debugHeartbeat",2);g([m()],f.prototype,"debugCallMethod",2);g([m()],f.prototype,"debugCallParams",2);g([m()],f.prototype,"debugCallResult",2);g([m()],f.prototype,"debugCallError",2);g([m()],f.prototype,"logsLoading",2);g([m()],f.prototype,"logsError",2);g([m()],f.prototype,"logsFile",2);g([m()],f.prototype,"logsEntries",2);g([m()],f.prototype,"logsFilterText",2);g([m()],f.prototype,"logsLevelFilters",2);g([m()],f.prototype,"logsAutoFollow",2);g([m()],f.prototype,"logsTruncated",2);g([m()],f.prototype,"logsCursor",2);g([m()],f.prototype,"logsLastFetchAt",2);g([m()],f.prototype,"logsLimit",2);g([m()],f.prototype,"logsMaxBytes",2);g([m()],f.prototype,"logsAtBottom",2);g([m()],f.prototype,"logsDate",2);g([m()],f.prototype,"logsAvailableDates",2);g([m()],f.prototype,"logsSubTab",2);g([m()],f.prototype,"logsChipsExpanded",2);g([m()],f.prototype,"sessionLogsLoading",2);g([m()],f.prototype,"sessionLogsError",2);g([m()],f.prototype,"sessionLogsEntries",2);g([m()],f.prototype,"sessionLogsFilterText",2);g([m()],f.prototype,"sessionLogsTypeFilters",2);g([m()],f.prototype,"sessionLogsAgentFilters",2);g([m()],f.prototype,"sessionLogsAgents",2);g([m()],f.prototype,"sessionLogsAutoFollow",2);g([m()],f.prototype,"sessionLogsChipsExpanded",2);g([m()],f.prototype,"sessionLogsCursors",2);g([m()],f.prototype,"sessionLogsLastFetchAt",2);g([m()],f.prototype,"sessionLogsAtBottom",2);g([m()],f.prototype,"chatUserNearBottom",2);f=g([jl("taskmaster-app")],f);
4934
+ //# sourceMappingURL=index-C1r0QazL.js.map