@rubytech/taskmaster 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/pi-embedded-runner/compact.js +6 -0
- package/dist/agents/pi-embedded-runner/run/attempt.js +6 -0
- package/dist/agents/pi-embedded-runner/system-prompt.js +1 -0
- package/dist/agents/pi-tools.js +1 -0
- package/dist/agents/skills/workspace.js +40 -3
- package/dist/agents/system-prompt.js +19 -1
- package/dist/agents/taskmaster-tools.js +6 -0
- package/dist/agents/tool-display.json +5 -0
- package/dist/agents/tools/skill-read-tool.js +75 -0
- package/dist/agents/workspace.js +2 -2
- package/dist/auto-reply/reply/get-reply-run.js +1 -2
- package/dist/build-info.json +3 -3
- package/dist/cli/gateway-cli/dev.js +1 -1
- package/dist/cli/provision-seed.js +1 -0
- package/dist/control-ui/assets/{index-Dcwiyz6o.js → index-DKEqjln4.js} +36 -50
- package/dist/control-ui/assets/index-DKEqjln4.js.map +1 -0
- package/dist/control-ui/assets/{index-DE-53MKi.css → index-QrR3OWrg.css} +1 -1
- package/dist/control-ui/index.html +2 -2
- package/package.json +1 -1
- package/taskmaster-docs/USER-GUIDE.md +40 -11
- package/templates/customer/agents/admin/TOOLS.md +36 -0
- package/dist/control-ui/assets/index-Dcwiyz6o.js.map +0 -1
|
@@ -15,7 +15,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
15
15
|
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`taskmaster-logs-${t}-${o}.log`,i.click(),URL.revokeObjectURL(s)}function Yu(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
16
16
|
`)}
|
|
17
17
|
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`taskmaster-session-logs-${t}-${o}.log`,i.click(),URL.revokeObjectURL(s)}function Xu(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}function Oe(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Ve(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
18
|
-
`}function Oa(e,t,n){if(t.length===0)return;let s=e;for(let o=0;o<t.length-1;o+=1){const r=t[o],l=t[o+1];if(typeof r=="number"){if(!Array.isArray(s))return;s[r]==null&&(s[r]=typeof l=="number"?[]:{}),s=s[r]}else{if(typeof s!="object"||s==null)return;const a=s;a[r]==null&&(a[r]=typeof l=="number"?[]:{}),s=a[r]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}async function we(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Ju(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function Da(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});Zu(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function Zu(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Ju(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?Ve(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=Ve(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=Oe(t.config??{}),e.configFormOriginal=Oe(t.config??{}),e.configRawOriginal=n)}async function ed(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?Ve(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await we(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function en(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 ss(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t={includeDisabled:!0};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(t.agentIds=e.workspaceAgentIds);const n=await e.client.request("cron.list",t);e.cronJobs=Array.isArray(n.jobs)?n.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function td(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=Wn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function nd(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=Wn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function sd(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=td(e.cronForm),n=nd(e.cronForm),s=e.cronForm.agentId.trim(),i=e.cronForm.accountId?.trim(),o={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!o.name)throw new Error("Name required.");await e.client.request("cron.add",o),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await ss(e),await en(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function id(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 ss(e),await en(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function od(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await ai(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function rd(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 ss(e),await en(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ai(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function j(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function Wi(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const s=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=s.message??null,e.whatsappLoginQrDataUrl=s.qrDataUrl??null,e.whatsappLoginConnected=null}catch(s){e.whatsappLoginMessage=String(s),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Ba(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 Fa(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 Ua(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!s){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const o=Oe(i.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const r=o.channels;(!r.whatsapp||typeof r.whatsapp!="object")&&(r.whatsapp={});const l=r.whatsapp;(!l.accounts||typeof l.accounts!="object")&&(l.accounts={});const a=l.accounts;if(a[s]){e.whatsappAccountError=`Account "${s}" already exists.`;return}a[s]={name:n,provider:"baileys"};const c=i.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const u=Ve(o);await e.client.request("config.set",{raw:u,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await j(e,!0),await Wi(e,!0,s)}catch(i){e.whatsappAccountError=String(i)}finally{e.whatsappAccountSaving=!1}}async function Wa(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 s=Oe(n.config??{}),r=s.channels?.whatsapp?.accounts;if(!r){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(r).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!r[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete r[t],Array.isArray(s.bindings)&&(s.bindings=s.bindings.filter(u=>{const p=u.match;return!p||p.channel!=="whatsapp"?!0:p.accountId!==t}));const a=n.hash;if(!a){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=Ve(s);await e.client.request("config.set",{raw:c,baseHash:a}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await j(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const ad=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:Ua,loadChannels:j,logoutWhatsApp:Fa,removeWhatsAppAccount:Wa,startWhatsAppLogin:Wi,waitWhatsAppLogin:Ba},Symbol.toStringTag,{value:"Module"}));async function Ki(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const o=s;e.debugModels=Array.isArray(o?.models)?o?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const ld=2e3,cd=new Set(["trace","debug","info","warn","error","fatal"]);function ud(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 dd(e){if(typeof e!="string")return null;const t=e.toLowerCase();return cd.has(t)?t:null}function pd(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=dd(n?.logLevelName??n?.level),o=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,r=ud(o);let l=null;r&&(typeof r.subsystem=="string"?l=r.subsystem:typeof r.module=="string"&&(l=r.module)),!l&&o&&o.length<120&&(l=o);let a=null;return typeof t[1]=="string"?a=t[1]:!r&&typeof t[0]=="string"?a=t[0]:typeof t.message=="string"&&(a=t.message),{raw:e,time:s,level:i,subsystem:l,message:a??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ht(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),o=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(pd),r=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-ld),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}const Ka={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ee,n:Pn,Gx:ar,Gy:lr,a:Rs,d:Is,h:hd}=Ka,Qe=32,ji=64,fd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},Q=(e="")=>{const t=new Error(e);throw fd(t,Q),t},gd=e=>typeof e=="bigint",md=e=>typeof e=="string",yd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Be=(e,t,n="")=>{const s=yd(e),i=e?.length,o=t!==void 0;if(!s||o&&i!==t){const r=n&&`"${n}" `,l=o?` of length ${t}`:"",a=s?`length=${i}`:`type=${typeof e}`;Q(r+"expected Uint8Array"+l+", got "+a)}return e},is=e=>new Uint8Array(e),ja=e=>Uint8Array.from(e),za=(e,t)=>e.toString(16).padStart(t,"0"),Ha=e=>Array.from(Be(e)).map(t=>za(t,2)).join(""),xe={_0:48,_9:57,A:65,F:70,a:97,f:102},cr=e=>{if(e>=xe._0&&e<=xe._9)return e-xe._0;if(e>=xe.A&&e<=xe.F)return e-(xe.A-10);if(e>=xe.a&&e<=xe.f)return e-(xe.a-10)},qa=e=>{const t="hex invalid";if(!md(e))return Q(t);const n=e.length,s=n/2;if(n%2)return Q(t);const i=is(s);for(let o=0,r=0;o<s;o++,r+=2){const l=cr(e.charCodeAt(r)),a=cr(e.charCodeAt(r+1));if(l===void 0||a===void 0)return Q(t);i[o]=l*16+a}return i},Ga=()=>globalThis?.crypto,vd=()=>Ga()?.subtle??Q("crypto.subtle must be defined, consider polyfill"),Xt=(...e)=>{const t=is(e.reduce((s,i)=>s+Be(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},bd=(e=Qe)=>Ga().getRandomValues(is(e)),jn=BigInt,ze=(e,t,n,s="bad number: out of range")=>gd(e)&&t<=e&&e<n?e:Q(s),$=(e,t=ee)=>{const n=e%t;return n>=0n?n:t+n},Va=e=>$(e,Pn),wd=(e,t)=>{(e===0n||t<=0n)&&Q("no inverse n="+e+" mod="+t);let n=$(e,t),s=t,i=0n,o=1n;for(;n!==0n;){const r=s/n,l=s%n,a=i-o*r;s=n,n=l,i=o,o=a}return s===1n?$(i,t):Q("no inverse")},kd=e=>{const t=Za[e];return typeof t!="function"&&Q("hashes."+e+" not set"),t},Ns=e=>e instanceof le?e:Q("Point expected"),li=2n**256n;class le{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const o=li;this.X=ze(t,0n,o),this.Y=ze(n,0n,o),this.Z=ze(s,1n,o),this.T=ze(i,0n,o),Object.freeze(this)}static CURVE(){return Ka}static fromAffine(t){return new le(t.x,t.y,1n,$(t.x*t.y))}static fromBytes(t,n=!1){const s=Is,i=ja(Be(t,Qe)),o=t[31];i[31]=o&-129;const r=Ya(i);ze(r,0n,n?li:ee);const a=$(r*r),c=$(a-1n),u=$(s*a+1n);let{isValid:p,value:m}=Ad(c,u);p||Q("bad point: y not sqrt");const v=(m&1n)===1n,w=(o&128)!==0;return!n&&m===0n&&w&&Q("bad point: x==0, isLastByteOdd"),w!==v&&(m=$(-m)),new le(m,r,1n,$(m*r))}static fromHex(t,n){return le.fromBytes(qa(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Rs,n=Is,s=this;if(s.is0())return Q("bad point: ZERO");const{X:i,Y:o,Z:r,T:l}=s,a=$(i*i),c=$(o*o),u=$(r*r),p=$(u*u),m=$(a*t),v=$(u*$(m+c)),w=$(p+$(n*$(a*c)));if(v!==w)return Q("bad point: equation left != right (1)");const x=$(i*o),_=$(r*l);return x!==_?Q("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:o,Y:r,Z:l}=Ns(t),a=$(n*l),c=$(o*i),u=$(s*l),p=$(r*i);return a===c&&u===p}is0(){return this.equals(ft)}negate(){return new le($(-this.X),this.Y,this.Z,$(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Rs,o=$(t*t),r=$(n*n),l=$(2n*$(s*s)),a=$(i*o),c=t+n,u=$($(c*c)-o-r),p=a+r,m=p-l,v=a-r,w=$(u*m),x=$(p*v),_=$(u*v),z=$(m*p);return new le(w,x,z,_)}add(t){const{X:n,Y:s,Z:i,T:o}=this,{X:r,Y:l,Z:a,T:c}=Ns(t),u=Rs,p=Is,m=$(n*r),v=$(s*l),w=$(o*p*c),x=$(i*a),_=$((n+s)*(r+l)-m-v),z=$(x-w),C=$(x+w),P=$(v-u*m),I=$(_*z),B=$(C*P),de=$(_*P),it=$(z*C);return new le(I,B,it,de)}subtract(t){return this.add(Ns(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return ft;if(ze(t,1n,Pn),t===1n)return this;if(this.equals(Ye))return Id(t).p;let s=ft,i=Ye;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?s=s.add(o):n&&(i=i.add(o));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(ft))return{x:0n,y:1n};const i=wd(s,ee);$(s*i)!==1n&&Q("invalid inverse");const o=$(t*i),r=$(n*i);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Qa(n);return s[31]|=t&1n?128:0,s}toHex(){return Ha(this.toBytes())}clearCofactor(){return this.multiply(jn(hd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Pn/2n,!1).double();return Pn%2n&&(t=t.add(this)),t.is0()}}const Ye=new le(ar,lr,1n,$(ar*lr)),ft=new le(0n,1n,1n,0n);le.BASE=Ye;le.ZERO=ft;const Qa=e=>qa(za(ze(e,0n,li),ji)).reverse(),Ya=e=>jn("0x"+Ha(ja(Be(e)).reverse())),ye=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ee;return n},Sd=e=>{const n=e*e%ee*e%ee,s=ye(n,2n)*n%ee,i=ye(s,1n)*e%ee,o=ye(i,5n)*i%ee,r=ye(o,10n)*o%ee,l=ye(r,20n)*r%ee,a=ye(l,40n)*l%ee,c=ye(a,80n)*a%ee,u=ye(c,80n)*a%ee,p=ye(u,10n)*o%ee;return{pow_p_5_8:ye(p,2n)*e%ee,b2:n}},ur=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Ad=(e,t)=>{const n=$(t*t*t),s=$(n*n*t),i=Sd(e*s).pow_p_5_8;let o=$(e*n*i);const r=$(t*o*o),l=o,a=$(o*ur),c=r===e,u=r===$(-e),p=r===$(-e*ur);return c&&(o=l),(u||p)&&(o=a),($(o)&1n)===1n&&(o=$(-o)),{isValid:c||u,value:o}},ci=e=>Va(Ya(e)),zi=(...e)=>Za.sha512Async(Xt(...e)),xd=(...e)=>kd("sha512")(Xt(...e)),Xa=e=>{const t=e.slice(0,Qe);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Qe,ji),s=ci(t),i=Ye.multiply(s),o=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:o}},Hi=e=>zi(Be(e,Qe)).then(Xa),$d=e=>Xa(xd(Be(e,Qe))),Ed=e=>Hi(e).then(t=>t.pointBytes),Td=e=>zi(e.hashable).then(e.finish),Cd=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,o=ci(t),r=Ye.multiply(o).toBytes();return{hashable:Xt(r,s,n),finish:c=>{const u=Va(o+ci(c)*i);return Be(Xt(r,Qa(u)),ji)}}},_d=async(e,t)=>{const n=Be(e),s=await Hi(t),i=await zi(s.prefix,n);return Td(Cd(s,i,n))},Za={sha512Async:async e=>{const t=vd(),n=Xt(e);return is(await t.digest("SHA-512",n.buffer))},sha512:void 0},Md=(e=bd(Qe))=>e,Ld={getExtendedPublicKeyAsync:Hi,getExtendedPublicKey:$d,randomSecretKey:Md},zn=8,Pd=256,Ja=Math.ceil(Pd/zn)+1,ui=2**(zn-1),Rd=()=>{const e=[];let t=Ye,n=t;for(let s=0;s<Ja;s++){n=t,e.push(n);for(let i=1;i<ui;i++)n=n.add(t),e.push(n);t=n.double()}return e};let dr;const pr=(e,t)=>{const n=t.negate();return e?n:t},Id=e=>{const t=dr||(dr=Rd());let n=ft,s=Ye;const i=2**zn,o=i,r=jn(i-1),l=jn(zn);for(let a=0;a<Ja;a++){let c=Number(e&r);e>>=l,c>ui&&(c-=o,e+=1n);const u=a*ui,p=u,m=u+Math.abs(c)-1,v=a%2!==0,w=c<0;c===0?s=s.add(pr(v,t[p])):n=n.add(pr(w,t[m]))}return e!==0n&&Q("invalid wnaf"),{p:n,f:s}},Os="taskmaster-device-identity-v1";function di(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function el(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let o=0;o<s.length;o+=1)i[o]=s.charCodeAt(o);return i}function Nd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function tl(e){const t=await crypto.subtle.digest("SHA-256",e);return Nd(new Uint8Array(t))}async function Od(){const e=Ld.randomSecretKey(),t=await Ed(e);return{deviceId:await tl(t),publicKey:di(t),privateKey:di(e)}}async function Dd(){try{const n=localStorage.getItem(Os);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await tl(el(s.publicKey));if(i!==s.deviceId){const o={...s,deviceId:i};return localStorage.setItem(Os,JSON.stringify(o)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Od(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Os,JSON.stringify(t)),e}async function Bd(e,t){const n=el(e),s=new TextEncoder().encode(t),i=await _d(s,n);return di(i)}const nl="taskmaster.device.auth.v1";function qi(e){return e.trim()}function Fd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].sort()}function Gi(){try{const e=window.localStorage.getItem(nl);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 sl(e){try{window.localStorage.setItem(nl,JSON.stringify(e))}catch{}}function Ud(e){const t=Gi();if(!t||t.deviceId!==e.deviceId)return null;const n=qi(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Wd(e){const t=qi(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Gi();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:Fd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,sl(n),i}function Kd(e){const t=Gi();if(!t||t.deviceId!==e.deviceId)return;const n=qi(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],sl(s)}async function Vi(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Qi(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function jd(e){return{method:"exec.approvals.get",params:{}}}async function zd(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=jd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);Hd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Hd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=Oe(t.file??{}))}async function il(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 vt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function os(e){return e instanceof Error?e.message:String(e)}async function bt(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=os(n)}finally{e.skillsLoading=!1}}}function qd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Gd(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 bt(e),vt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=os(s);e.skillsError=i,vt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Vd(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 bt(e),vt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=os(n);e.skillsError=s,vt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Qd(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await bt(e),vt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const o=os(i);e.skillsError=o,vt(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const ol={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},rl=new Map(Object.entries(ol).map(([e,t])=>[t,e]));function rs(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Zt(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 Yd(e,t=""){const n=rs(t),s=ol[e];return n?`${n}${s}`:s}function al(e,t=""){const n=rs(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=Zt(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":rl.get(i)??null}function Xd(e){let t=Zt(e);if(t.endsWith("/index.html")&&(t=Zt(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(rl.has(i)){const o=n.slice(0,s);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function Zd(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Yi(e){return e==="system"?Zd():e}const bn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Jd=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,wn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ep=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const o=i.documentElement,r=i,l=Jd();if(!!r.startViewTransition&&!l){let c=.5,u=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")c=bn(n.pointerClientX/window.innerWidth),u=bn(n.pointerClientY/window.innerHeight);else if(n?.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(c=bn((p.left+p.width/2)/window.innerWidth),u=bn((p.top+p.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${c*100}%`),o.style.setProperty("--theme-switch-y",`${u*100}%`),o.classList.add("theme-transition");try{const p=r.startViewTransition?.(()=>{t()});p?.finished?p.finished.finally(()=>wn(o)):wn(o)}catch{wn(o),t()}return}t(),wn(o)},tp=2e3;async function qt(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!t?.quiet)){t?.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const s=await e.client.request("sessions.transcript",{cursors:t?.reset?void 0:e.sessionLogsCursors,limit:200,maxBytesPerFile:5e4}),i=Array.isArray(s.entries)?s.entries:[],o=!!(t?.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=o?i:[...e.sessionLogsEntries,...i].slice(-tp),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?.quiet||(e.sessionLogsLoading=!1)}}}const np=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:qt},Symbol.toStringTag,{value:"Module"}));function sp(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Qi(e,{quiet:!0})},5e3))}function ip(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Xi(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ht(e,{quiet:!0})},2e3))}function Zi(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Ji(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{e.tab!=="logs"||e.logsSubTab!=="session"||qt(e,{quiet:!0})},2e3))}function eo(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function to(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Ki(e)},3e3))}function no(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Ie(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,gu(n),t.theme!==e.theme&&(e.theme=t.theme,as(e,Yi(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function ll(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Ie(e,{...e.settings,lastActiveSessionKey:n})}function op(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),o=t.get("gatewayUrl");let r=!1;if(n!=null){const a=n.trim();a&&a!==e.settings.token&&Ie(e,{...e.settings,token:a}),t.delete("token"),r=!0}if(s!=null){const a=s.trim();a&&(e.password=a),t.delete("password"),r=!0}if(i!=null){const a=i.trim();a&&(e.sessionKey=a,Ie(e,{...e.settings,sessionKey:a,lastActiveSessionKey:a}))}if(o!=null){const a=o.trim();a&&a!==e.settings.gatewayUrl&&Ie(e,{...e.settings,gatewayUrl:a}),t.delete("gatewayUrl"),r=!0}if(!r)return;const l=new URL(window.location.href);l.search=t.toString(),window.history.replaceState({},"",l.toString())}function rp(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Ji(e):Xi(e):(Zi(e),eo(e)),t==="debug"?to(e):no(e),so(e),ul(e,t,!1)}function ap(e,t,n){ep({nextTheme:t,applyTheme:()=>{e.theme=t,Ie(e,{...e.settings,theme:t}),as(e,Yi(t))},context:n,currentTheme:e.theme})}async function so(e){if(e.tab==="overview"&&await dl(e),e.tab==="channels"&&await fp(e),e.tab==="instances"&&await il(e),e.tab==="cron"&&await io(e),e.tab==="skills"&&await bt(e),e.tab==="nodes"&&(await Qi(e),await Vi(e),await we(e),await zd(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await bp(e),Jt(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await Da(e),await we(e)),e.tab==="debug"&&(await Ki(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await $e(async()=>{const{loadSessionLogs:s}=await Promise.resolve().then(()=>np);return{loadSessionLogs:s}},void 0,import.meta.url);await n(e,{reset:!0})}else await Ht(e,{reset:!0});Na(e,!0)}}function lp(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?rs(e):Xd(window.location.pathname)}function cp(e){e.theme=e.settings.theme??"system",as(e,Yi(e.theme))}function as(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function up(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"&&as(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function dp(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 pp(e,t){if(typeof window>"u")return;const n=al(window.location.pathname,e.basePath)??"chat";cl(e,n),ul(e,n,t)}function hp(e){if(typeof window>"u")return;const t=al(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Ie(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),cl(e,t)}function cl(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Ji(e):Xi(e):(Zi(e),eo(e)),t==="debug"?to(e):no(e),e.connected&&so(e)}function ul(e,t,n){if(typeof window>"u")return;const s=Zt(Yd(t,e.basePath)),i=Zt(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),i!==s&&(o.pathname=s),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}async function dl(e){await Promise.all([j(e,!1),il(e),Fi(e),en(e),Ki(e)])}async function fp(e){await Promise.all([j(e,!0),Da(e),we(e)])}async function io(e){await Promise.all([j(e,!1),en(e),ss(e)])}function pl(e){return e.chatSending||!!e.chatRunId}function gp(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 hl(e){e.connected&&(e.chatMessage="",await Ra(e))}function mp(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Bi(),text:s,createdAt:Date.now(),attachments:i?n?.map(o=>({...o})):void 0}],Jt(e))}async function fl(e,t,n){Ui(e);const s=await Pa(e,t,n?.attachments);return!s&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!s&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),s&&ll(e,e.sessionKey),s&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),s&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),Jt(e),s&&!e.chatRunId&&gl(e),s}async function gl(e){if(!e.connected||pl(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await fl(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function yp(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function vp(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],l=r.length>0;if(!(!i&&!l)){if(gp(i)){await hl(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),pl(e)){mp(e,i,r);return}await fl(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&n?.restoreDraft)})}}async function bp(e){await Promise.all([Ce(e),Fi(e),pi(e)]),Jt(e,!0)}const wp=gl;function kp(e){const t=xa(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Sp(e,t){const n=rs(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function pi(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=kp(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Sp(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),o=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const N={messageSquare:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:d`<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:d`<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:d`<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:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>`,menu:d`<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:d`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:d`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:d`<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:d`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:d`<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:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,download:d`<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:d`<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:d`<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:d`<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:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,image:d`<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:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,chevronDown:d`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:d`<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>`},Ap="Taskmaster",xp="/taskmaster-icon.png",ml="#00d4ff";let kn=null;function De(){return kn||(kn={name:window.__TASKMASTER_BRAND_NAME__||Ap,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||xp,accentColor:window.__TASKMASTER_ACCENT_COLOR__||ml},kn)}function $p(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);return t?`${parseInt(t[1],16)}, ${parseInt(t[2],16)}, ${parseInt(t[3],16)}`:null}function Ep(e){if(e===ml)return;const t=$p(e);if(!t)return;const n=document.documentElement;n.style.setProperty("--accent",e),n.style.setProperty("--accent-hover",e),n.style.setProperty("--accent-muted",e),n.style.setProperty("--primary",e),n.style.setProperty("--ring",e),n.style.setProperty("--accent-subtle",`rgba(${t}, 0.15)`),n.style.setProperty("--accent-glow",`rgba(${t}, 0.25)`),n.style.setProperty("--tasker-orange",e),n.style.setProperty("--tasker-orange-hover",e),n.style.setProperty("--tasker-orange-glow",`rgba(${t}, 0.25)`)}const Tp=d`<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>`;let hr=!1;function Cp(){hr||(hr=!0,document.addEventListener("click",e=>{const t=document.getElementById("nav-burger-toggle");!t?.checked||t.closest(".setup-header")?.contains(e.target)||(t.checked=!1)}))}function et(e,t){const n=(a,c)=>a===e?d`<span class="sp-page-nav-current">${a}</span>`:d`<a href=${c}>${a}</a>`,s=d`
|
|
18
|
+
`}function Oa(e,t,n){if(t.length===0)return;let s=e;for(let o=0;o<t.length-1;o+=1){const r=t[o],l=t[o+1];if(typeof r=="number"){if(!Array.isArray(s))return;s[r]==null&&(s[r]=typeof l=="number"?[]:{}),s=s[r]}else{if(typeof s!="object"||s==null)return;const a=s;a[r]==null&&(a[r]=typeof l=="number"?[]:{}),s=a[r]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}async function we(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Ju(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function Da(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});Zu(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function Zu(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Ju(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?Ve(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=Ve(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=Oe(t.config??{}),e.configFormOriginal=Oe(t.config??{}),e.configRawOriginal=n)}async function ed(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?Ve(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await we(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function en(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 ss(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t={includeDisabled:!0};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(t.agentIds=e.workspaceAgentIds);const n=await e.client.request("cron.list",t);e.cronJobs=Array.isArray(n.jobs)?n.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function td(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=Wn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function nd(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=Wn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function sd(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=td(e.cronForm),n=nd(e.cronForm),s=e.cronForm.agentId.trim(),i=e.cronForm.accountId?.trim(),o={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!o.name)throw new Error("Name required.");await e.client.request("cron.add",o),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await ss(e),await en(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function id(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 ss(e),await en(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function od(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await ai(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function rd(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 ss(e),await en(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ai(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function j(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function Wi(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const s=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=s.message??null,e.whatsappLoginQrDataUrl=s.qrDataUrl??null,e.whatsappLoginConnected=null}catch(s){e.whatsappLoginMessage=String(s),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Ba(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 Fa(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 Ua(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!s){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const o=Oe(i.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const r=o.channels;(!r.whatsapp||typeof r.whatsapp!="object")&&(r.whatsapp={});const l=r.whatsapp;(!l.accounts||typeof l.accounts!="object")&&(l.accounts={});const a=l.accounts;if(a[s]){e.whatsappAccountError=`Account "${s}" already exists.`;return}a[s]={name:n,provider:"baileys"};const c=i.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const u=Ve(o);await e.client.request("config.set",{raw:u,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await j(e,!0),await Wi(e,!0,s)}catch(i){e.whatsappAccountError=String(i)}finally{e.whatsappAccountSaving=!1}}async function Wa(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 s=Oe(n.config??{}),r=s.channels?.whatsapp?.accounts;if(!r){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(r).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!r[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete r[t],Array.isArray(s.bindings)&&(s.bindings=s.bindings.filter(u=>{const p=u.match;return!p||p.channel!=="whatsapp"?!0:p.accountId!==t}));const a=n.hash;if(!a){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=Ve(s);await e.client.request("config.set",{raw:c,baseHash:a}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await j(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const ad=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:Ua,loadChannels:j,logoutWhatsApp:Fa,removeWhatsAppAccount:Wa,startWhatsAppLogin:Wi,waitWhatsAppLogin:Ba},Symbol.toStringTag,{value:"Module"}));async function Ki(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const o=s;e.debugModels=Array.isArray(o?.models)?o?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const ld=2e3,cd=new Set(["trace","debug","info","warn","error","fatal"]);function ud(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 dd(e){if(typeof e!="string")return null;const t=e.toLowerCase();return cd.has(t)?t:null}function pd(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=dd(n?.logLevelName??n?.level),o=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,r=ud(o);let l=null;r&&(typeof r.subsystem=="string"?l=r.subsystem:typeof r.module=="string"&&(l=r.module)),!l&&o&&o.length<120&&(l=o);let a=null;return typeof t[1]=="string"?a=t[1]:!r&&typeof t[0]=="string"?a=t[0]:typeof t.message=="string"&&(a=t.message),{raw:e,time:s,level:i,subsystem:l,message:a??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ht(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),o=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(pd),r=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-ld),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}const Ka={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ee,n:Pn,Gx:ar,Gy:lr,a:Rs,d:Is,h:hd}=Ka,Qe=32,ji=64,fd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},Q=(e="")=>{const t=new Error(e);throw fd(t,Q),t},gd=e=>typeof e=="bigint",md=e=>typeof e=="string",yd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Be=(e,t,n="")=>{const s=yd(e),i=e?.length,o=t!==void 0;if(!s||o&&i!==t){const r=n&&`"${n}" `,l=o?` of length ${t}`:"",a=s?`length=${i}`:`type=${typeof e}`;Q(r+"expected Uint8Array"+l+", got "+a)}return e},is=e=>new Uint8Array(e),ja=e=>Uint8Array.from(e),za=(e,t)=>e.toString(16).padStart(t,"0"),Ha=e=>Array.from(Be(e)).map(t=>za(t,2)).join(""),xe={_0:48,_9:57,A:65,F:70,a:97,f:102},cr=e=>{if(e>=xe._0&&e<=xe._9)return e-xe._0;if(e>=xe.A&&e<=xe.F)return e-(xe.A-10);if(e>=xe.a&&e<=xe.f)return e-(xe.a-10)},qa=e=>{const t="hex invalid";if(!md(e))return Q(t);const n=e.length,s=n/2;if(n%2)return Q(t);const i=is(s);for(let o=0,r=0;o<s;o++,r+=2){const l=cr(e.charCodeAt(r)),a=cr(e.charCodeAt(r+1));if(l===void 0||a===void 0)return Q(t);i[o]=l*16+a}return i},Ga=()=>globalThis?.crypto,vd=()=>Ga()?.subtle??Q("crypto.subtle must be defined, consider polyfill"),Xt=(...e)=>{const t=is(e.reduce((s,i)=>s+Be(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},bd=(e=Qe)=>Ga().getRandomValues(is(e)),jn=BigInt,ze=(e,t,n,s="bad number: out of range")=>gd(e)&&t<=e&&e<n?e:Q(s),$=(e,t=ee)=>{const n=e%t;return n>=0n?n:t+n},Va=e=>$(e,Pn),wd=(e,t)=>{(e===0n||t<=0n)&&Q("no inverse n="+e+" mod="+t);let n=$(e,t),s=t,i=0n,o=1n;for(;n!==0n;){const r=s/n,l=s%n,a=i-o*r;s=n,n=l,i=o,o=a}return s===1n?$(i,t):Q("no inverse")},kd=e=>{const t=Za[e];return typeof t!="function"&&Q("hashes."+e+" not set"),t},Ns=e=>e instanceof ae?e:Q("Point expected"),li=2n**256n;class ae{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const o=li;this.X=ze(t,0n,o),this.Y=ze(n,0n,o),this.Z=ze(s,1n,o),this.T=ze(i,0n,o),Object.freeze(this)}static CURVE(){return Ka}static fromAffine(t){return new ae(t.x,t.y,1n,$(t.x*t.y))}static fromBytes(t,n=!1){const s=Is,i=ja(Be(t,Qe)),o=t[31];i[31]=o&-129;const r=Ya(i);ze(r,0n,n?li:ee);const a=$(r*r),c=$(a-1n),u=$(s*a+1n);let{isValid:p,value:m}=Ad(c,u);p||Q("bad point: y not sqrt");const v=(m&1n)===1n,w=(o&128)!==0;return!n&&m===0n&&w&&Q("bad point: x==0, isLastByteOdd"),w!==v&&(m=$(-m)),new ae(m,r,1n,$(m*r))}static fromHex(t,n){return ae.fromBytes(qa(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Rs,n=Is,s=this;if(s.is0())return Q("bad point: ZERO");const{X:i,Y:o,Z:r,T:l}=s,a=$(i*i),c=$(o*o),u=$(r*r),p=$(u*u),m=$(a*t),v=$(u*$(m+c)),w=$(p+$(n*$(a*c)));if(v!==w)return Q("bad point: equation left != right (1)");const x=$(i*o),_=$(r*l);return x!==_?Q("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:o,Y:r,Z:l}=Ns(t),a=$(n*l),c=$(o*i),u=$(s*l),p=$(r*i);return a===c&&u===p}is0(){return this.equals(ft)}negate(){return new ae($(-this.X),this.Y,this.Z,$(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Rs,o=$(t*t),r=$(n*n),l=$(2n*$(s*s)),a=$(i*o),c=t+n,u=$($(c*c)-o-r),p=a+r,m=p-l,v=a-r,w=$(u*m),x=$(p*v),_=$(u*v),z=$(m*p);return new ae(w,x,z,_)}add(t){const{X:n,Y:s,Z:i,T:o}=this,{X:r,Y:l,Z:a,T:c}=Ns(t),u=Rs,p=Is,m=$(n*r),v=$(s*l),w=$(o*p*c),x=$(i*a),_=$((n+s)*(r+l)-m-v),z=$(x-w),C=$(x+w),P=$(v-u*m),I=$(_*z),B=$(C*P),ue=$(_*P),it=$(z*C);return new ae(I,B,it,ue)}subtract(t){return this.add(Ns(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return ft;if(ze(t,1n,Pn),t===1n)return this;if(this.equals(Ye))return Id(t).p;let s=ft,i=Ye;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?s=s.add(o):n&&(i=i.add(o));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(ft))return{x:0n,y:1n};const i=wd(s,ee);$(s*i)!==1n&&Q("invalid inverse");const o=$(t*i),r=$(n*i);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Qa(n);return s[31]|=t&1n?128:0,s}toHex(){return Ha(this.toBytes())}clearCofactor(){return this.multiply(jn(hd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Pn/2n,!1).double();return Pn%2n&&(t=t.add(this)),t.is0()}}const Ye=new ae(ar,lr,1n,$(ar*lr)),ft=new ae(0n,1n,1n,0n);ae.BASE=Ye;ae.ZERO=ft;const Qa=e=>qa(za(ze(e,0n,li),ji)).reverse(),Ya=e=>jn("0x"+Ha(ja(Be(e)).reverse())),ye=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ee;return n},Sd=e=>{const n=e*e%ee*e%ee,s=ye(n,2n)*n%ee,i=ye(s,1n)*e%ee,o=ye(i,5n)*i%ee,r=ye(o,10n)*o%ee,l=ye(r,20n)*r%ee,a=ye(l,40n)*l%ee,c=ye(a,80n)*a%ee,u=ye(c,80n)*a%ee,p=ye(u,10n)*o%ee;return{pow_p_5_8:ye(p,2n)*e%ee,b2:n}},ur=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Ad=(e,t)=>{const n=$(t*t*t),s=$(n*n*t),i=Sd(e*s).pow_p_5_8;let o=$(e*n*i);const r=$(t*o*o),l=o,a=$(o*ur),c=r===e,u=r===$(-e),p=r===$(-e*ur);return c&&(o=l),(u||p)&&(o=a),($(o)&1n)===1n&&(o=$(-o)),{isValid:c||u,value:o}},ci=e=>Va(Ya(e)),zi=(...e)=>Za.sha512Async(Xt(...e)),xd=(...e)=>kd("sha512")(Xt(...e)),Xa=e=>{const t=e.slice(0,Qe);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Qe,ji),s=ci(t),i=Ye.multiply(s),o=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:o}},Hi=e=>zi(Be(e,Qe)).then(Xa),$d=e=>Xa(xd(Be(e,Qe))),Ed=e=>Hi(e).then(t=>t.pointBytes),Td=e=>zi(e.hashable).then(e.finish),Cd=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,o=ci(t),r=Ye.multiply(o).toBytes();return{hashable:Xt(r,s,n),finish:c=>{const u=Va(o+ci(c)*i);return Be(Xt(r,Qa(u)),ji)}}},_d=async(e,t)=>{const n=Be(e),s=await Hi(t),i=await zi(s.prefix,n);return Td(Cd(s,i,n))},Za={sha512Async:async e=>{const t=vd(),n=Xt(e);return is(await t.digest("SHA-512",n.buffer))},sha512:void 0},Md=(e=bd(Qe))=>e,Ld={getExtendedPublicKeyAsync:Hi,getExtendedPublicKey:$d,randomSecretKey:Md},zn=8,Pd=256,Ja=Math.ceil(Pd/zn)+1,ui=2**(zn-1),Rd=()=>{const e=[];let t=Ye,n=t;for(let s=0;s<Ja;s++){n=t,e.push(n);for(let i=1;i<ui;i++)n=n.add(t),e.push(n);t=n.double()}return e};let dr;const pr=(e,t)=>{const n=t.negate();return e?n:t},Id=e=>{const t=dr||(dr=Rd());let n=ft,s=Ye;const i=2**zn,o=i,r=jn(i-1),l=jn(zn);for(let a=0;a<Ja;a++){let c=Number(e&r);e>>=l,c>ui&&(c-=o,e+=1n);const u=a*ui,p=u,m=u+Math.abs(c)-1,v=a%2!==0,w=c<0;c===0?s=s.add(pr(v,t[p])):n=n.add(pr(w,t[m]))}return e!==0n&&Q("invalid wnaf"),{p:n,f:s}},Os="taskmaster-device-identity-v1";function di(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function el(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let o=0;o<s.length;o+=1)i[o]=s.charCodeAt(o);return i}function Nd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function tl(e){const t=await crypto.subtle.digest("SHA-256",e);return Nd(new Uint8Array(t))}async function Od(){const e=Ld.randomSecretKey(),t=await Ed(e);return{deviceId:await tl(t),publicKey:di(t),privateKey:di(e)}}async function Dd(){try{const n=localStorage.getItem(Os);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await tl(el(s.publicKey));if(i!==s.deviceId){const o={...s,deviceId:i};return localStorage.setItem(Os,JSON.stringify(o)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Od(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Os,JSON.stringify(t)),e}async function Bd(e,t){const n=el(e),s=new TextEncoder().encode(t),i=await _d(s,n);return di(i)}const nl="taskmaster.device.auth.v1";function qi(e){return e.trim()}function Fd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].sort()}function Gi(){try{const e=window.localStorage.getItem(nl);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 sl(e){try{window.localStorage.setItem(nl,JSON.stringify(e))}catch{}}function Ud(e){const t=Gi();if(!t||t.deviceId!==e.deviceId)return null;const n=qi(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Wd(e){const t=qi(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Gi();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:Fd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,sl(n),i}function Kd(e){const t=Gi();if(!t||t.deviceId!==e.deviceId)return;const n=qi(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],sl(s)}async function Vi(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Qi(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function jd(e){return{method:"exec.approvals.get",params:{}}}async function zd(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=jd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);Hd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Hd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=Oe(t.file??{}))}async function il(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 vt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function os(e){return e instanceof Error?e.message:String(e)}async function bt(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=os(n)}finally{e.skillsLoading=!1}}}function qd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Gd(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 bt(e),vt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=os(s);e.skillsError=i,vt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Vd(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 bt(e),vt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=os(n);e.skillsError=s,vt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Qd(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await bt(e),vt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const o=os(i);e.skillsError=o,vt(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const ol={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},rl=new Map(Object.entries(ol).map(([e,t])=>[t,e]));function rs(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Zt(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 Yd(e,t=""){const n=rs(t),s=ol[e];return n?`${n}${s}`:s}function al(e,t=""){const n=rs(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=Zt(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":rl.get(i)??null}function Xd(e){let t=Zt(e);if(t.endsWith("/index.html")&&(t=Zt(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(rl.has(i)){const o=n.slice(0,s);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function Zd(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Yi(e){return e==="system"?Zd():e}const bn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Jd=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,wn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ep=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const o=i.documentElement,r=i,l=Jd();if(!!r.startViewTransition&&!l){let c=.5,u=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")c=bn(n.pointerClientX/window.innerWidth),u=bn(n.pointerClientY/window.innerHeight);else if(n?.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(c=bn((p.left+p.width/2)/window.innerWidth),u=bn((p.top+p.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${c*100}%`),o.style.setProperty("--theme-switch-y",`${u*100}%`),o.classList.add("theme-transition");try{const p=r.startViewTransition?.(()=>{t()});p?.finished?p.finished.finally(()=>wn(o)):wn(o)}catch{wn(o),t()}return}t(),wn(o)},tp=2e3;async function qt(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!t?.quiet)){t?.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const s=await e.client.request("sessions.transcript",{cursors:t?.reset?void 0:e.sessionLogsCursors,limit:200,maxBytesPerFile:5e4}),i=Array.isArray(s.entries)?s.entries:[],o=!!(t?.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=o?i:[...e.sessionLogsEntries,...i].slice(-tp),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?.quiet||(e.sessionLogsLoading=!1)}}}const np=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:qt},Symbol.toStringTag,{value:"Module"}));function sp(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Qi(e,{quiet:!0})},5e3))}function ip(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Xi(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ht(e,{quiet:!0})},2e3))}function Zi(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Ji(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{e.tab!=="logs"||e.logsSubTab!=="session"||qt(e,{quiet:!0})},2e3))}function eo(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function to(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Ki(e)},3e3))}function no(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Ie(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,gu(n),t.theme!==e.theme&&(e.theme=t.theme,as(e,Yi(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function ll(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Ie(e,{...e.settings,lastActiveSessionKey:n})}function op(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),o=t.get("gatewayUrl");let r=!1;if(n!=null){const a=n.trim();a&&a!==e.settings.token&&Ie(e,{...e.settings,token:a}),t.delete("token"),r=!0}if(s!=null){const a=s.trim();a&&(e.password=a),t.delete("password"),r=!0}if(i!=null){const a=i.trim();a&&(e.sessionKey=a,Ie(e,{...e.settings,sessionKey:a,lastActiveSessionKey:a}))}if(o!=null){const a=o.trim();a&&a!==e.settings.gatewayUrl&&Ie(e,{...e.settings,gatewayUrl:a}),t.delete("gatewayUrl"),r=!0}if(!r)return;const l=new URL(window.location.href);l.search=t.toString(),window.history.replaceState({},"",l.toString())}function rp(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Ji(e):Xi(e):(Zi(e),eo(e)),t==="debug"?to(e):no(e),so(e),ul(e,t,!1)}function ap(e,t,n){ep({nextTheme:t,applyTheme:()=>{e.theme=t,Ie(e,{...e.settings,theme:t}),as(e,Yi(t))},context:n,currentTheme:e.theme})}async function so(e){if(e.tab==="overview"&&await dl(e),e.tab==="channels"&&await fp(e),e.tab==="instances"&&await il(e),e.tab==="cron"&&await io(e),e.tab==="skills"&&await bt(e),e.tab==="nodes"&&(await Qi(e),await Vi(e),await we(e),await zd(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await bp(e),Jt(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await Da(e),await we(e)),e.tab==="debug"&&(await Ki(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await $e(async()=>{const{loadSessionLogs:s}=await Promise.resolve().then(()=>np);return{loadSessionLogs:s}},void 0,import.meta.url);await n(e,{reset:!0})}else await Ht(e,{reset:!0});Na(e,!0)}}function lp(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?rs(e):Xd(window.location.pathname)}function cp(e){e.theme=e.settings.theme??"system",as(e,Yi(e.theme))}function as(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function up(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"&&as(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function dp(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 pp(e,t){if(typeof window>"u")return;const n=al(window.location.pathname,e.basePath)??"chat";cl(e,n),ul(e,n,t)}function hp(e){if(typeof window>"u")return;const t=al(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Ie(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),cl(e,t)}function cl(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Ji(e):Xi(e):(Zi(e),eo(e)),t==="debug"?to(e):no(e),e.connected&&so(e)}function ul(e,t,n){if(typeof window>"u")return;const s=Zt(Yd(t,e.basePath)),i=Zt(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),i!==s&&(o.pathname=s),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}async function dl(e){await Promise.all([j(e,!1),il(e),Fi(e),en(e),Ki(e)])}async function fp(e){await Promise.all([j(e,!0),Da(e),we(e)])}async function io(e){await Promise.all([j(e,!1),en(e),ss(e)])}function pl(e){return e.chatSending||!!e.chatRunId}function gp(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 hl(e){e.connected&&(e.chatMessage="",await Ra(e))}function mp(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Bi(),text:s,createdAt:Date.now(),attachments:i?n?.map(o=>({...o})):void 0}],Jt(e))}async function fl(e,t,n){Ui(e);const s=await Pa(e,t,n?.attachments);return!s&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!s&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),s&&ll(e,e.sessionKey),s&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),s&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),Jt(e),s&&!e.chatRunId&&gl(e),s}async function gl(e){if(!e.connected||pl(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await fl(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function yp(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function vp(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],l=r.length>0;if(!(!i&&!l)){if(gp(i)){await hl(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),pl(e)){mp(e,i,r);return}await fl(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&n?.restoreDraft)})}}async function bp(e){await Promise.all([Ce(e),Fi(e),pi(e)]),Jt(e,!0)}const wp=gl;function kp(e){const t=xa(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Sp(e,t){const n=rs(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function pi(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=kp(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Sp(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),o=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const N={messageSquare:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:d`<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:d`<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:d`<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:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>`,menu:d`<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:d`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:d`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:d`<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:d`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:d`<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:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,download:d`<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:d`<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:d`<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:d`<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:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,image:d`<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:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:d`<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:d`<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:d`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,chevronDown:d`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:d`<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>`},Ap="Taskmaster",xp="/taskmaster-icon.png",ml="#00d4ff";let kn=null;function De(){return kn||(kn={name:window.__TASKMASTER_BRAND_NAME__||Ap,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||xp,accentColor:window.__TASKMASTER_ACCENT_COLOR__||ml},kn)}function $p(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);return t?`${parseInt(t[1],16)}, ${parseInt(t[2],16)}, ${parseInt(t[3],16)}`:null}function Ep(e){if(e===ml)return;const t=$p(e);if(!t)return;const n=document.documentElement;n.style.setProperty("--accent",e),n.style.setProperty("--accent-hover",e),n.style.setProperty("--accent-muted",e),n.style.setProperty("--primary",e),n.style.setProperty("--ring",e),n.style.setProperty("--accent-subtle",`rgba(${t}, 0.15)`),n.style.setProperty("--accent-glow",`rgba(${t}, 0.25)`),n.style.setProperty("--tasker-orange",e),n.style.setProperty("--tasker-orange-hover",e),n.style.setProperty("--tasker-orange-glow",`rgba(${t}, 0.25)`)}const Tp=d`<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>`;let hr=!1;function Cp(){hr||(hr=!0,document.addEventListener("click",e=>{const t=document.getElementById("nav-burger-toggle");!t?.checked||t.closest(".setup-header")?.contains(e.target)||(t.checked=!1)}))}function et(e,t){const n=(a,c)=>a===e?d`<span class="sp-page-nav-current">${a}</span>`:d`<a href=${c}>${a}</a>`,s=d`
|
|
19
19
|
${n("Setup","/setup")}
|
|
20
20
|
${n("Chat","/chat")}
|
|
21
21
|
${n("Admins","/admins")}
|
|
@@ -261,7 +261,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
261
261
|
<p>Connecting to gateway...</p>
|
|
262
262
|
</div>
|
|
263
263
|
</div>
|
|
264
|
-
`}function
|
|
264
|
+
`}function le(e){return d`
|
|
265
265
|
<span
|
|
266
266
|
class="setup-status-light"
|
|
267
267
|
style="background: ${{good:"#22c55e",bad:"#ef4444",partial:"#eab308",unknown:"#6b7280"}[e]}"
|
|
@@ -293,7 +293,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
293
293
|
</button>
|
|
294
294
|
</div>
|
|
295
295
|
</div>
|
|
296
|
-
`}function
|
|
296
|
+
`}function fe(e){const t=[{id:"license",label:"1. Activate License"},{id:"auth",label:"2. Connect Claude"},{id:"whatsapp",label:"3. Link WhatsApp"}],n=["license","auth","whatsapp","complete"],s=n.indexOf(e);return d`
|
|
297
297
|
<div class="setup-steps">
|
|
298
298
|
${t.map(i=>{const o=n.indexOf(i.id),r=e===i.id,l=s>o;return d`
|
|
299
299
|
<div
|
|
@@ -307,9 +307,9 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
307
307
|
`}function fr(e){const{licenseKey:t,licenseBusy:n,licenseValid:s,licenseMessage:i,licenseDeviceId:o,onLicenseKeyChange:r,onLicenseActivate:l}=e;return s===!0?d`
|
|
308
308
|
<div class="setup-container">
|
|
309
309
|
<div class="setup-card setup-success">
|
|
310
|
-
${
|
|
310
|
+
${fe("license")}
|
|
311
311
|
<div class="setup-status-row">
|
|
312
|
-
${
|
|
312
|
+
${le("good")}
|
|
313
313
|
<span>License Activated</span>
|
|
314
314
|
</div>
|
|
315
315
|
<p>${i??"Your license is active."}</p>
|
|
@@ -318,7 +318,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
318
318
|
`:n&&!t?d`
|
|
319
319
|
<div class="setup-container">
|
|
320
320
|
<div class="setup-card">
|
|
321
|
-
${
|
|
321
|
+
${fe("license")}
|
|
322
322
|
<div class="setup-spinner"></div>
|
|
323
323
|
<p>Checking license...</p>
|
|
324
324
|
</div>
|
|
@@ -326,7 +326,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
326
326
|
`:d`
|
|
327
327
|
<div class="setup-container">
|
|
328
328
|
<div class="setup-card">
|
|
329
|
-
${
|
|
329
|
+
${fe("license")}
|
|
330
330
|
<h1>Activate License</h1>
|
|
331
331
|
<p>Enter your license key to get started.</p>
|
|
332
332
|
${o?d`
|
|
@@ -363,7 +363,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
363
363
|
</div>
|
|
364
364
|
${s===!1&&i?d`
|
|
365
365
|
<div class="setup-status-row" style="margin-top: 12px;">
|
|
366
|
-
${
|
|
366
|
+
${le("bad")}
|
|
367
367
|
<span class="setup-error">${i}</span>
|
|
368
368
|
</div>
|
|
369
369
|
`:b}
|
|
@@ -378,9 +378,9 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
378
378
|
`}function Dp(e){const{authConnected:t,authBusy:n,authMessage:s,authUrl:i,authCodeInput:o,authExpiresIn:r,onStartAuth:l,onSubmitAuthCode:a,onAuthCodeChange:c,onSkipToWhatsApp:u}=e;return t===!0?d`
|
|
379
379
|
<div class="setup-container">
|
|
380
380
|
<div class="setup-card setup-success">
|
|
381
|
-
${
|
|
381
|
+
${fe("auth")}
|
|
382
382
|
<div class="setup-status-row">
|
|
383
|
-
${
|
|
383
|
+
${le("good")}
|
|
384
384
|
<span>Claude Connected</span>
|
|
385
385
|
</div>
|
|
386
386
|
<p>
|
|
@@ -397,7 +397,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
397
397
|
`:n&&!i?d`
|
|
398
398
|
<div class="setup-container">
|
|
399
399
|
<div class="setup-card">
|
|
400
|
-
${
|
|
400
|
+
${fe("auth")}
|
|
401
401
|
<div class="setup-spinner"></div>
|
|
402
402
|
<p>Starting Claude connection...</p>
|
|
403
403
|
</div>
|
|
@@ -405,7 +405,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
405
405
|
`:i?d`
|
|
406
406
|
<div class="setup-container">
|
|
407
407
|
<div class="setup-card">
|
|
408
|
-
${
|
|
408
|
+
${fe("auth")}
|
|
409
409
|
<h1>Connect to Claude</h1>
|
|
410
410
|
<p>Click the button below to sign in with your Claude Pro account.</p>
|
|
411
411
|
<a
|
|
@@ -443,24 +443,10 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
443
443
|
</p>
|
|
444
444
|
</div>
|
|
445
445
|
</div>
|
|
446
|
-
`:t===!1&&s?d`
|
|
447
|
-
<div class="setup-container">
|
|
448
|
-
<div class="setup-card">
|
|
449
|
-
${ce("auth")}
|
|
450
|
-
<div class="setup-status-row">
|
|
451
|
-
${ae("bad")}
|
|
452
|
-
<span>Connection Failed</span>
|
|
453
|
-
</div>
|
|
454
|
-
<p class="setup-error">${s}</p>
|
|
455
|
-
<button class="setup-button primary" @click=${l}>
|
|
456
|
-
Try Again
|
|
457
|
-
</button>
|
|
458
|
-
</div>
|
|
459
|
-
</div>
|
|
460
446
|
`:e.authApiKeyMode?d`
|
|
461
447
|
<div class="setup-container">
|
|
462
448
|
<div class="setup-card">
|
|
463
|
-
${
|
|
449
|
+
${fe("auth")}
|
|
464
450
|
<h1>Enter API Key</h1>
|
|
465
451
|
<p>Paste your Anthropic API key below.</p>
|
|
466
452
|
<div class="setup-code-input">
|
|
@@ -496,12 +482,12 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
496
482
|
`:d`
|
|
497
483
|
<div class="setup-container">
|
|
498
484
|
<div class="setup-card">
|
|
499
|
-
${
|
|
485
|
+
${fe("auth")}
|
|
500
486
|
<h1>Connect to Claude</h1>
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
487
|
+
${t===!1&&s?d`<p class="setup-error">${s}</p>`:d`<p>
|
|
488
|
+
First, let's connect your Claude Pro subscription.<br />
|
|
489
|
+
This powers your AI assistant.
|
|
490
|
+
</p>`}
|
|
505
491
|
<button class="setup-button primary" @click=${l}>
|
|
506
492
|
Connect to Claude →
|
|
507
493
|
</button>
|
|
@@ -562,7 +548,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
562
548
|
</div>
|
|
563
549
|
`}function mr(e){return d`
|
|
564
550
|
<div class="setup-status-item">
|
|
565
|
-
${
|
|
551
|
+
${le(e.gatewayHealthy===!1?"bad":"good")}
|
|
566
552
|
<div class="setup-status-info">
|
|
567
553
|
<strong>Gateway</strong>
|
|
568
554
|
<span>${e.gatewayHealthMessage||"Running"}</span>
|
|
@@ -579,7 +565,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
579
565
|
</div>
|
|
580
566
|
`}function yr(e){const t=e.authConnected===!0;return d`
|
|
581
567
|
<div class="setup-status-item">
|
|
582
|
-
${
|
|
568
|
+
${le(t?"good":"bad")}
|
|
583
569
|
<div class="setup-status-info">
|
|
584
570
|
<strong>Claude</strong>
|
|
585
571
|
<span>
|
|
@@ -608,7 +594,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
608
594
|
</div>
|
|
609
595
|
`}function vr(e){return d`
|
|
610
596
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
611
|
-
${
|
|
597
|
+
${le("good")}
|
|
612
598
|
<div class="setup-status-info">
|
|
613
599
|
<strong>License</strong>
|
|
614
600
|
<span>Active</span>
|
|
@@ -648,7 +634,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
648
634
|
</div>
|
|
649
635
|
`}function br(e){const t=At(e);if(!t)return b;const n=oo(t,e),s=n?.running&&n?.connected,i=n?.linked&&!s,o=!!n,r=s?"good":i?"partial":o?"bad":"unknown",l=s?"Connected":i?"Linked, not connected":o?n?.lastError||"Not connected":"Not paired",a=!n?.provider||n?.provider==="baileys",c=t.whatsappAccountId??(t.isDefault&&e.whatsappAccounts.length===1?e.whatsappAccounts[0]?.accountId:void 0),u=c!=null&&e.whatsappActiveQrAccountId===c;return d`
|
|
650
636
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
651
|
-
${
|
|
637
|
+
${le(r)}
|
|
652
638
|
<div class="setup-status-info">
|
|
653
639
|
<div style="display: flex; align-items: center; gap: 4px;">
|
|
654
640
|
<strong>WhatsApp</strong>
|
|
@@ -794,7 +780,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
794
780
|
</div>
|
|
795
781
|
`}function ro(e){const t=At(e),n=e.imessageOwnerWorkspace,s=!!(t&&n===t.name),i=!!(n&&t&&n!==t.name);return{selectedWs:t,ownerWs:n,thisWsOwns:s,anotherWsOwns:i}}function wr(e){const{ownerWs:t,thisWsOwns:n,anotherWsOwns:s}=ro(e);let i,o;return s?(i="partial",o=`Connected to ${t}`):n&&e.imessageConnected?(i="good",o="Connected"):n&&e.imessageRunning?(i="partial",o="Running, not connected"):n?(i="bad",o="Not running"):e.imessageConfigured?(i="unknown",o="Not connected"):(i="bad",o="Not configured"),d`
|
|
796
782
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
797
|
-
${
|
|
783
|
+
${le(i)}
|
|
798
784
|
<div class="setup-status-info">
|
|
799
785
|
<strong>iMessage</strong>
|
|
800
786
|
<span>${o}</span>
|
|
@@ -889,7 +875,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
889
875
|
`}function kr(e){if(!e.isMaster)return b;const t=e.apiKeyProviders,n=t.filter(i=>i.hasKey).length,s=t.length;return d`
|
|
890
876
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
891
877
|
<div class="setup-status-item">
|
|
892
|
-
${
|
|
878
|
+
${le(n>0?"good":"bad")}
|
|
893
879
|
<div class="setup-status-info">
|
|
894
880
|
<strong>API Keys</strong>
|
|
895
881
|
<span>${n} of ${s} configured</span>
|
|
@@ -951,7 +937,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
951
937
|
</div>
|
|
952
938
|
`}function Sr(e){const t=e.updateAvailable===null?"unknown":e.updateAvailable?"partial":"good",n=e.updateAvailable&&e.latestVersion?`v${e.currentVersion} → v${e.latestVersion}`:e.currentVersion?`v${e.currentVersion}`:"Unknown",s=e.updateChecking||e.updateRunning;return d`
|
|
953
939
|
<div class="setup-status-item">
|
|
954
|
-
${
|
|
940
|
+
${le(t)}
|
|
955
941
|
<div class="setup-status-info">
|
|
956
942
|
<strong>Software</strong>
|
|
957
943
|
<span>${n}</span>
|
|
@@ -979,7 +965,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
979
965
|
</div>
|
|
980
966
|
`}function zp(e){const t=e.accountHasPin;return d`
|
|
981
967
|
<div class="setup-status-item">
|
|
982
|
-
${
|
|
968
|
+
${le(t?"good":"bad")}
|
|
983
969
|
<div class="setup-status-info">
|
|
984
970
|
<strong>Account PIN</strong>
|
|
985
971
|
<span>${t?"Set":"Not set"}</span>
|
|
@@ -1205,9 +1191,9 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
1205
1191
|
`:o?i===!1&&n&&!t?d`
|
|
1206
1192
|
<div class="setup-container">
|
|
1207
1193
|
<div class="setup-card">
|
|
1208
|
-
${
|
|
1194
|
+
${fe("whatsapp")}
|
|
1209
1195
|
<div class="setup-status-row">
|
|
1210
|
-
${
|
|
1196
|
+
${le("bad")}
|
|
1211
1197
|
<span>Connection Failed</span>
|
|
1212
1198
|
</div>
|
|
1213
1199
|
<p class="setup-error">${n}</p>
|
|
@@ -1223,7 +1209,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
1223
1209
|
`:d`
|
|
1224
1210
|
<div class="setup-container">
|
|
1225
1211
|
<div class="setup-card">
|
|
1226
|
-
${
|
|
1212
|
+
${fe("whatsapp")}
|
|
1227
1213
|
${n?d`<p class="setup-error">${n}</p>`:d`<div class="setup-spinner"></div>
|
|
1228
1214
|
<p>Preparing...</p>`}
|
|
1229
1215
|
</div>
|
|
@@ -1231,7 +1217,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
1231
1217
|
`:d`
|
|
1232
1218
|
<div class="setup-container">
|
|
1233
1219
|
<div class="setup-card">
|
|
1234
|
-
${
|
|
1220
|
+
${fe("whatsapp")}
|
|
1235
1221
|
<div class="setup-spinner"></div>
|
|
1236
1222
|
<p>Checking connection status...</p>
|
|
1237
1223
|
<button
|
|
@@ -1493,7 +1479,7 @@ ${s}`:c.join(", ");a.push({type:"text",text:v})}else s&&a.push({type:"text",text
|
|
|
1493
1479
|
</div>
|
|
1494
1480
|
</div>
|
|
1495
1481
|
</div>
|
|
1496
|
-
`}const wl={CHILD:2},kl=e=>(...t)=>({_$litDirective$:e,values:t});let Sl=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:eh}=su,$r=e=>e,Er=()=>document.createComment(""),Mt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=s.insertBefore(Er(),i),r=s.insertBefore(Er(),i);n=new eh(o,r,e,e.options)}else{const o=n._$AB.nextSibling,r=n._$AM,l=r!==e;if(l){let a;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(a=e._$AU)!==r._$AU&&n._$AP(a)}if(o!==i||l){let a=n._$AA;for(;a!==o;){const c=$r(a).nextSibling;$r(s).insertBefore(a,i),a=c}}}return n},je=(e,t,n=e)=>(e._$AI(t,n),e),th={},nh=(e,t=th)=>e._$AH=t,sh=e=>e._$AH,Ds=e=>{e._$AR(),e._$AA.remove()};const Tr=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},ih=kl(class extends Sl{constructor(e){if(super(e),e.type!==wl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],o=[];let r=0;for(const l of e)i[r]=s?s(l,r):r,o[r]=n(l,r),r++;return{values:o,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=sh(e),{values:o,keys:r}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=r,o;const l=this.ut??=[],a=[];let c,u,p=0,m=i.length-1,v=0,w=o.length-1;for(;p<=m&&v<=w;)if(i[p]===null)p++;else if(i[m]===null)m--;else if(l[p]===r[v])a[v]=je(i[p],o[v]),p++,v++;else if(l[m]===r[w])a[w]=je(i[m],o[w]),m--,w--;else if(l[p]===r[w])a[w]=je(i[p],o[w]),Mt(e,a[w+1],i[p]),p++,w--;else if(l[m]===r[v])a[v]=je(i[m],o[v]),Mt(e,i[p],i[m]),m--,v++;else if(c===void 0&&(c=Tr(r,v,w),u=Tr(l,p,m)),c.has(l[p]))if(c.has(l[m])){const x=u.get(r[v]),_=x!==void 0?i[x]:null;if(_===null){const z=Mt(e,i[p]);je(z,o[v]),a[v]=z}else a[v]=je(_,o[v]),Mt(e,i[p],_),i[x]=null;v++}else Ds(i[m]),m--;else Ds(i[p]),p++;for(;v<=w;){const x=Mt(e,a[w+1]);je(x,o[v]),a[v++]=x}for(;p<=m;){const x=i[p++];x!==null&&Ds(x)}return this.ut=r,nh(e,a),Ne}});class hi extends Sl{constructor(t){if(super(t),this.it=b,t.type!==wl.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===b||t==null)return this._t=void 0,this.it=t;if(t===Ne)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}hi.directiveName="unsafeHTML",hi.resultType=1;const fi=kl(hi);const{entries:Al,setPrototypeOf:Cr,isFrozen:oh,getPrototypeOf:rh,getOwnPropertyDescriptor:ah}=Object;let{freeze:ie,seal:ue,create:gi}=Object,{apply:mi,construct:yi}=typeof Reflect<"u"&&Reflect;ie||(ie=function(t){return t});ue||(ue=function(t){return t});mi||(mi=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;o<s;o++)i[o-2]=arguments[o];return t.apply(n,i)});yi||(yi=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Sn=oe(Array.prototype.forEach),lh=oe(Array.prototype.lastIndexOf),_r=oe(Array.prototype.pop),Lt=oe(Array.prototype.push),ch=oe(Array.prototype.splice),Rn=oe(String.prototype.toLowerCase),Bs=oe(String.prototype.toString),Fs=oe(String.prototype.match),Pt=oe(String.prototype.replace),uh=oe(String.prototype.indexOf),dh=oe(String.prototype.trim),pe=oe(Object.prototype.hasOwnProperty),ne=oe(RegExp.prototype.test),Rt=ph(TypeError);function oe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return mi(e,t,s)}}function ph(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return yi(e,n)}}function R(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rn;Cr&&Cr(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const o=n(i);o!==i&&(oh(t)||(t[s]=o),i=o)}e[i]=!0}return e}function hh(e){for(let t=0;t<e.length;t++)pe(e,t)||(e[t]=null);return e}function be(e){const t=gi(null);for(const[n,s]of Al(e))pe(e,n)&&(Array.isArray(s)?t[n]=hh(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=be(s):t[n]=s);return t}function It(e,t){for(;e!==null;){const s=ah(e,t);if(s){if(s.get)return oe(s.get);if(typeof s.value=="function")return oe(s.value)}e=rh(e)}function n(){return null}return n}const Mr=ie(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Us=ie(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ws=ie(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),fh=ie(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ks=ie(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),gh=ie(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Lr=ie(["#text"]),Pr=ie(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),js=ie(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Rr=ie(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),An=ie(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),mh=ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),yh=ue(/<%[\w\W]*|[\w\W]*%>/gm),vh=ue(/\$\{[\w\W]*/gm),bh=ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),wh=ue(/^aria-[\-\w]+$/),xl=ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kh=ue(/^(?:\w+script|data):/i),Sh=ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$l=ue(/^html$/i),Ah=ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ir=Object.freeze({__proto__:null,ARIA_ATTR:wh,ATTR_WHITESPACE:Sh,CUSTOM_ELEMENT:Ah,DATA_ATTR:bh,DOCTYPE_NAME:$l,ERB_EXPR:yh,IS_ALLOWED_URI:xl,IS_SCRIPT_OR_DATA:kh,MUSTACHE_EXPR:mh,TMPLIT_EXPR:vh});const Nt={element:1,text:3,progressingInstruction:7,comment:8,document:9},xh=function(){return typeof window>"u"?null:window},$h=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const o="dompurify"+(s?"#"+s:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Nr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function El(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xh();const t=T=>El(T);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Nt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:l,Element:a,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:v}=e,w=a.prototype,x=It(w,"cloneNode"),_=It(w,"remove"),z=It(w,"nextSibling"),C=It(w,"childNodes"),P=It(w,"parentNode");if(typeof r=="function"){const T=n.createElement("template");T.content&&T.content.ownerDocument&&(n=T.content.ownerDocument)}let I,B="";const{implementation:de,createNodeIterator:it,createDocumentFragment:hs,getElementsByTagName:fs}=n,{importNode:on}=s;let Y=Nr();t.isSupported=typeof Al=="function"&&typeof P=="function"&&de&&de.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$t,ERB_EXPR:ot,TMPLIT_EXPR:Fe,DATA_ATTR:gs,ARIA_ATTR:ms,IS_SCRIPT_OR_DATA:ys,ATTR_WHITESPACE:rn,CUSTOM_ELEMENT:vs}=Ir;let{IS_ALLOWED_URI:an}=Ir,H=null;const ln=R({},[...Mr,...Us,...Ws,...Ks,...Lr]);let q=null;const cn=R({},[...Pr,...js,...Rr,...An]);let W=Object.seal(gi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ue=null,Et=null;const Me=Object.seal(gi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let un=!0,k=!0,A=!1,M=!0,L=!1,K=!0,F=!1,te=!1,Le=!1,rt=!1,dn=!1,pn=!1,$o=!0,Eo=!1;const Tc="user-content-";let bs=!0,Tt=!1,at={},ge=null;const ws=R({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let To=null;const Co=R({},["audio","video","img","source","image","track"]);let ks=null;const _o=R({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),hn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",ke="http://www.w3.org/1999/xhtml";let lt=ke,Ss=!1,As=null;const Cc=R({},[hn,fn,ke],Bs);let gn=R({},["mi","mo","mn","ms","mtext"]),mn=R({},["annotation-xml"]);const _c=R({},["title","style","font","a","script"]);let Ct=null;const Mc=["application/xhtml+xml","text/html"],Lc="text/html";let V=null,ct=null;const Pc=n.createElement("form"),Mo=function(y){return y instanceof RegExp||y instanceof Function},xs=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ct&&ct===y)){if((!y||typeof y!="object")&&(y={}),y=be(y),Ct=Mc.indexOf(y.PARSER_MEDIA_TYPE)===-1?Lc:y.PARSER_MEDIA_TYPE,V=Ct==="application/xhtml+xml"?Bs:Rn,H=pe(y,"ALLOWED_TAGS")?R({},y.ALLOWED_TAGS,V):ln,q=pe(y,"ALLOWED_ATTR")?R({},y.ALLOWED_ATTR,V):cn,As=pe(y,"ALLOWED_NAMESPACES")?R({},y.ALLOWED_NAMESPACES,Bs):Cc,ks=pe(y,"ADD_URI_SAFE_ATTR")?R(be(_o),y.ADD_URI_SAFE_ATTR,V):_o,To=pe(y,"ADD_DATA_URI_TAGS")?R(be(Co),y.ADD_DATA_URI_TAGS,V):Co,ge=pe(y,"FORBID_CONTENTS")?R({},y.FORBID_CONTENTS,V):ws,Ue=pe(y,"FORBID_TAGS")?R({},y.FORBID_TAGS,V):be({}),Et=pe(y,"FORBID_ATTR")?R({},y.FORBID_ATTR,V):be({}),at=pe(y,"USE_PROFILES")?y.USE_PROFILES:!1,un=y.ALLOW_ARIA_ATTR!==!1,k=y.ALLOW_DATA_ATTR!==!1,A=y.ALLOW_UNKNOWN_PROTOCOLS||!1,M=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,L=y.SAFE_FOR_TEMPLATES||!1,K=y.SAFE_FOR_XML!==!1,F=y.WHOLE_DOCUMENT||!1,rt=y.RETURN_DOM||!1,dn=y.RETURN_DOM_FRAGMENT||!1,pn=y.RETURN_TRUSTED_TYPE||!1,Le=y.FORCE_BODY||!1,$o=y.SANITIZE_DOM!==!1,Eo=y.SANITIZE_NAMED_PROPS||!1,bs=y.KEEP_CONTENT!==!1,Tt=y.IN_PLACE||!1,an=y.ALLOWED_URI_REGEXP||xl,lt=y.NAMESPACE||ke,gn=y.MATHML_TEXT_INTEGRATION_POINTS||gn,mn=y.HTML_INTEGRATION_POINTS||mn,W=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&Mo(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&Mo(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),L&&(k=!1),dn&&(rt=!0),at&&(H=R({},Lr),q=[],at.html===!0&&(R(H,Mr),R(q,Pr)),at.svg===!0&&(R(H,Us),R(q,js),R(q,An)),at.svgFilters===!0&&(R(H,Ws),R(q,js),R(q,An)),at.mathMl===!0&&(R(H,Ks),R(q,Rr),R(q,An))),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?Me.tagCheck=y.ADD_TAGS:(H===ln&&(H=be(H)),R(H,y.ADD_TAGS,V))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?Me.attributeCheck=y.ADD_ATTR:(q===cn&&(q=be(q)),R(q,y.ADD_ATTR,V))),y.ADD_URI_SAFE_ATTR&&R(ks,y.ADD_URI_SAFE_ATTR,V),y.FORBID_CONTENTS&&(ge===ws&&(ge=be(ge)),R(ge,y.FORBID_CONTENTS,V)),y.ADD_FORBID_CONTENTS&&(ge===ws&&(ge=be(ge)),R(ge,y.ADD_FORBID_CONTENTS,V)),bs&&(H["#text"]=!0),F&&R(H,["html","head","body"]),H.table&&(R(H,["tbody"]),delete Ue.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Rt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Rt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=y.TRUSTED_TYPES_POLICY,B=I.createHTML("")}else I===void 0&&(I=$h(v,i)),I!==null&&typeof B=="string"&&(B=I.createHTML(""));ie&&ie(y),ct=y}},Lo=R({},[...Us,...Ws,...fh]),Po=R({},[...Ks,...gh]),Rc=function(y){let S=P(y);(!S||!S.tagName)&&(S={namespaceURI:lt,tagName:"template"});const E=Rn(y.tagName),U=Rn(S.tagName);return As[y.namespaceURI]?y.namespaceURI===fn?S.namespaceURI===ke?E==="svg":S.namespaceURI===hn?E==="svg"&&(U==="annotation-xml"||gn[U]):!!Lo[E]:y.namespaceURI===hn?S.namespaceURI===ke?E==="math":S.namespaceURI===fn?E==="math"&&mn[U]:!!Po[E]:y.namespaceURI===ke?S.namespaceURI===fn&&!mn[U]||S.namespaceURI===hn&&!gn[U]?!1:!Po[E]&&(_c[E]||!Lo[E]):!!(Ct==="application/xhtml+xml"&&As[y.namespaceURI]):!1},me=function(y){Lt(t.removed,{element:y});try{P(y).removeChild(y)}catch{_(y)}},We=function(y,S){try{Lt(t.removed,{attribute:S.getAttributeNode(y),from:S})}catch{Lt(t.removed,{attribute:null,from:S})}if(S.removeAttribute(y),y==="is")if(rt||dn)try{me(S)}catch{}else try{S.setAttribute(y,"")}catch{}},Ro=function(y){let S=null,E=null;if(Le)y="<remove></remove>"+y;else{const G=Fs(y,/^[\r\n\t ]+/);E=G&&G[0]}Ct==="application/xhtml+xml"&<===ke&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const U=I?I.createHTML(y):y;if(lt===ke)try{S=new m().parseFromString(U,Ct)}catch{}if(!S||!S.documentElement){S=de.createDocument(lt,"template",null);try{S.documentElement.innerHTML=Ss?B:U}catch{}}const Z=S.body||S.documentElement;return y&&E&&Z.insertBefore(n.createTextNode(E),Z.childNodes[0]||null),lt===ke?fs.call(S,F?"html":"body")[0]:F?S.documentElement:Z},Io=function(y){return it.call(y.ownerDocument||y,y,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},$s=function(y){return y instanceof p&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof u)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},No=function(y){return typeof l=="function"&&y instanceof l};function Se(T,y,S){Sn(T,E=>{E.call(t,y,S,ct)})}const Oo=function(y){let S=null;if(Se(Y.beforeSanitizeElements,y,null),$s(y))return me(y),!0;const E=V(y.nodeName);if(Se(Y.uponSanitizeElement,y,{tagName:E,allowedTags:H}),K&&y.hasChildNodes()&&!No(y.firstElementChild)&&ne(/<[/\w!]/g,y.innerHTML)&&ne(/<[/\w!]/g,y.textContent)||y.nodeType===Nt.progressingInstruction||K&&y.nodeType===Nt.comment&&ne(/<[/\w]/g,y.data))return me(y),!0;if(!(Me.tagCheck instanceof Function&&Me.tagCheck(E))&&(!H[E]||Ue[E])){if(!Ue[E]&&Bo(E)&&(W.tagNameCheck instanceof RegExp&&ne(W.tagNameCheck,E)||W.tagNameCheck instanceof Function&&W.tagNameCheck(E)))return!1;if(bs&&!ge[E]){const U=P(y)||y.parentNode,Z=C(y)||y.childNodes;if(Z&&U){const G=Z.length;for(let re=G-1;re>=0;--re){const Ae=x(Z[re],!0);Ae.__removalCount=(y.__removalCount||0)+1,U.insertBefore(Ae,z(y))}}}return me(y),!0}return y instanceof a&&!Rc(y)||(E==="noscript"||E==="noembed"||E==="noframes")&&ne(/<\/no(script|embed|frames)/i,y.innerHTML)?(me(y),!0):(L&&y.nodeType===Nt.text&&(S=y.textContent,Sn([$t,ot,Fe],U=>{S=Pt(S,U," ")}),y.textContent!==S&&(Lt(t.removed,{element:y.cloneNode()}),y.textContent=S)),Se(Y.afterSanitizeElements,y,null),!1)},Do=function(y,S,E){if($o&&(S==="id"||S==="name")&&(E in n||E in Pc))return!1;if(!(k&&!Et[S]&&ne(gs,S))){if(!(un&&ne(ms,S))){if(!(Me.attributeCheck instanceof Function&&Me.attributeCheck(S,y))){if(!q[S]||Et[S]){if(!(Bo(y)&&(W.tagNameCheck instanceof RegExp&&ne(W.tagNameCheck,y)||W.tagNameCheck instanceof Function&&W.tagNameCheck(y))&&(W.attributeNameCheck instanceof RegExp&&ne(W.attributeNameCheck,S)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(S,y))||S==="is"&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&ne(W.tagNameCheck,E)||W.tagNameCheck instanceof Function&&W.tagNameCheck(E))))return!1}else if(!ks[S]){if(!ne(an,Pt(E,rn,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&y!=="script"&&uh(E,"data:")===0&&To[y])){if(!(A&&!ne(ys,Pt(E,rn,"")))){if(E)return!1}}}}}}}return!0},Bo=function(y){return y!=="annotation-xml"&&Fs(y,vs)},Fo=function(y){Se(Y.beforeSanitizeAttributes,y,null);const{attributes:S}=y;if(!S||$s(y))return;const E={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let U=S.length;for(;U--;){const Z=S[U],{name:G,namespaceURI:re,value:Ae}=Z,ut=V(G),Es=Ae;let X=G==="value"?Es:dh(Es);if(E.attrName=ut,E.attrValue=X,E.keepAttr=!0,E.forceKeepAttr=void 0,Se(Y.uponSanitizeAttribute,y,E),X=E.attrValue,Eo&&(ut==="id"||ut==="name")&&(We(G,y),X=Tc+X),K&&ne(/((--!?|])>)|<\/(style|title|textarea)/i,X)){We(G,y);continue}if(ut==="attributename"&&Fs(X,"href")){We(G,y);continue}if(E.forceKeepAttr)continue;if(!E.keepAttr){We(G,y);continue}if(!M&&ne(/\/>/i,X)){We(G,y);continue}L&&Sn([$t,ot,Fe],Wo=>{X=Pt(X,Wo," ")});const Uo=V(y.nodeName);if(!Do(Uo,ut,X)){We(G,y);continue}if(I&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!re)switch(v.getAttributeType(Uo,ut)){case"TrustedHTML":{X=I.createHTML(X);break}case"TrustedScriptURL":{X=I.createScriptURL(X);break}}if(X!==Es)try{re?y.setAttributeNS(re,G,X):y.setAttribute(G,X),$s(y)?me(y):_r(t.removed)}catch{We(G,y)}}Se(Y.afterSanitizeAttributes,y,null)},Ic=function T(y){let S=null;const E=Io(y);for(Se(Y.beforeSanitizeShadowDOM,y,null);S=E.nextNode();)Se(Y.uponSanitizeShadowNode,S,null),Oo(S),Fo(S),S.content instanceof o&&T(S.content);Se(Y.afterSanitizeShadowDOM,y,null)};return t.sanitize=function(T){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,E=null,U=null,Z=null;if(Ss=!T,Ss&&(T="<!-->"),typeof T!="string"&&!No(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw Rt("dirty is not a string, aborting")}else throw Rt("toString is not a function");if(!t.isSupported)return T;if(te||xs(y),t.removed=[],typeof T=="string"&&(Tt=!1),Tt){if(T.nodeName){const Ae=V(T.nodeName);if(!H[Ae]||Ue[Ae])throw Rt("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof l)S=Ro("<!---->"),E=S.ownerDocument.importNode(T,!0),E.nodeType===Nt.element&&E.nodeName==="BODY"||E.nodeName==="HTML"?S=E:S.appendChild(E);else{if(!rt&&!L&&!F&&T.indexOf("<")===-1)return I&&pn?I.createHTML(T):T;if(S=Ro(T),!S)return rt?null:pn?B:""}S&&Le&&me(S.firstChild);const G=Io(Tt?T:S);for(;U=G.nextNode();)Oo(U),Fo(U),U.content instanceof o&&Ic(U.content);if(Tt)return T;if(rt){if(dn)for(Z=hs.call(S.ownerDocument);S.firstChild;)Z.appendChild(S.firstChild);else Z=S;return(q.shadowroot||q.shadowrootmode)&&(Z=on.call(s,Z,!0)),Z}let re=F?S.outerHTML:S.innerHTML;return F&&H["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&ne($l,S.ownerDocument.doctype.name)&&(re="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
|
|
1482
|
+
`}const wl={CHILD:2},kl=e=>(...t)=>({_$litDirective$:e,values:t});let Sl=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:eh}=su,$r=e=>e,Er=()=>document.createComment(""),Mt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=s.insertBefore(Er(),i),r=s.insertBefore(Er(),i);n=new eh(o,r,e,e.options)}else{const o=n._$AB.nextSibling,r=n._$AM,l=r!==e;if(l){let a;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(a=e._$AU)!==r._$AU&&n._$AP(a)}if(o!==i||l){let a=n._$AA;for(;a!==o;){const c=$r(a).nextSibling;$r(s).insertBefore(a,i),a=c}}}return n},je=(e,t,n=e)=>(e._$AI(t,n),e),th={},nh=(e,t=th)=>e._$AH=t,sh=e=>e._$AH,Ds=e=>{e._$AR(),e._$AA.remove()};const Tr=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},ih=kl(class extends Sl{constructor(e){if(super(e),e.type!==wl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],o=[];let r=0;for(const l of e)i[r]=s?s(l,r):r,o[r]=n(l,r),r++;return{values:o,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=sh(e),{values:o,keys:r}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=r,o;const l=this.ut??=[],a=[];let c,u,p=0,m=i.length-1,v=0,w=o.length-1;for(;p<=m&&v<=w;)if(i[p]===null)p++;else if(i[m]===null)m--;else if(l[p]===r[v])a[v]=je(i[p],o[v]),p++,v++;else if(l[m]===r[w])a[w]=je(i[m],o[w]),m--,w--;else if(l[p]===r[w])a[w]=je(i[p],o[w]),Mt(e,a[w+1],i[p]),p++,w--;else if(l[m]===r[v])a[v]=je(i[m],o[v]),Mt(e,i[p],i[m]),m--,v++;else if(c===void 0&&(c=Tr(r,v,w),u=Tr(l,p,m)),c.has(l[p]))if(c.has(l[m])){const x=u.get(r[v]),_=x!==void 0?i[x]:null;if(_===null){const z=Mt(e,i[p]);je(z,o[v]),a[v]=z}else a[v]=je(_,o[v]),Mt(e,i[p],_),i[x]=null;v++}else Ds(i[m]),m--;else Ds(i[p]),p++;for(;v<=w;){const x=Mt(e,a[w+1]);je(x,o[v]),a[v++]=x}for(;p<=m;){const x=i[p++];x!==null&&Ds(x)}return this.ut=r,nh(e,a),Ne}});class hi extends Sl{constructor(t){if(super(t),this.it=b,t.type!==wl.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===b||t==null)return this._t=void 0,this.it=t;if(t===Ne)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}hi.directiveName="unsafeHTML",hi.resultType=1;const fi=kl(hi);const{entries:Al,setPrototypeOf:Cr,isFrozen:oh,getPrototypeOf:rh,getOwnPropertyDescriptor:ah}=Object;let{freeze:ie,seal:ce,create:gi}=Object,{apply:mi,construct:yi}=typeof Reflect<"u"&&Reflect;ie||(ie=function(t){return t});ce||(ce=function(t){return t});mi||(mi=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;o<s;o++)i[o-2]=arguments[o];return t.apply(n,i)});yi||(yi=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Sn=oe(Array.prototype.forEach),lh=oe(Array.prototype.lastIndexOf),_r=oe(Array.prototype.pop),Lt=oe(Array.prototype.push),ch=oe(Array.prototype.splice),Rn=oe(String.prototype.toLowerCase),Bs=oe(String.prototype.toString),Fs=oe(String.prototype.match),Pt=oe(String.prototype.replace),uh=oe(String.prototype.indexOf),dh=oe(String.prototype.trim),de=oe(Object.prototype.hasOwnProperty),ne=oe(RegExp.prototype.test),Rt=ph(TypeError);function oe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return mi(e,t,s)}}function ph(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return yi(e,n)}}function R(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rn;Cr&&Cr(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const o=n(i);o!==i&&(oh(t)||(t[s]=o),i=o)}e[i]=!0}return e}function hh(e){for(let t=0;t<e.length;t++)de(e,t)||(e[t]=null);return e}function be(e){const t=gi(null);for(const[n,s]of Al(e))de(e,n)&&(Array.isArray(s)?t[n]=hh(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=be(s):t[n]=s);return t}function It(e,t){for(;e!==null;){const s=ah(e,t);if(s){if(s.get)return oe(s.get);if(typeof s.value=="function")return oe(s.value)}e=rh(e)}function n(){return null}return n}const Mr=ie(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Us=ie(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ws=ie(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),fh=ie(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ks=ie(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),gh=ie(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Lr=ie(["#text"]),Pr=ie(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),js=ie(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Rr=ie(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),An=ie(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),mh=ce(/\{\{[\w\W]*|[\w\W]*\}\}/gm),yh=ce(/<%[\w\W]*|[\w\W]*%>/gm),vh=ce(/\$\{[\w\W]*/gm),bh=ce(/^data-[\-\w.\u00B7-\uFFFF]+$/),wh=ce(/^aria-[\-\w]+$/),xl=ce(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kh=ce(/^(?:\w+script|data):/i),Sh=ce(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$l=ce(/^html$/i),Ah=ce(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ir=Object.freeze({__proto__:null,ARIA_ATTR:wh,ATTR_WHITESPACE:Sh,CUSTOM_ELEMENT:Ah,DATA_ATTR:bh,DOCTYPE_NAME:$l,ERB_EXPR:yh,IS_ALLOWED_URI:xl,IS_SCRIPT_OR_DATA:kh,MUSTACHE_EXPR:mh,TMPLIT_EXPR:vh});const Nt={element:1,text:3,progressingInstruction:7,comment:8,document:9},xh=function(){return typeof window>"u"?null:window},$h=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const o="dompurify"+(s?"#"+s:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Nr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function El(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xh();const t=T=>El(T);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Nt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:l,Element:a,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:v}=e,w=a.prototype,x=It(w,"cloneNode"),_=It(w,"remove"),z=It(w,"nextSibling"),C=It(w,"childNodes"),P=It(w,"parentNode");if(typeof r=="function"){const T=n.createElement("template");T.content&&T.content.ownerDocument&&(n=T.content.ownerDocument)}let I,B="";const{implementation:ue,createNodeIterator:it,createDocumentFragment:hs,getElementsByTagName:fs}=n,{importNode:on}=s;let Y=Nr();t.isSupported=typeof Al=="function"&&typeof P=="function"&&ue&&ue.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$t,ERB_EXPR:ot,TMPLIT_EXPR:Fe,DATA_ATTR:gs,ARIA_ATTR:ms,IS_SCRIPT_OR_DATA:ys,ATTR_WHITESPACE:rn,CUSTOM_ELEMENT:vs}=Ir;let{IS_ALLOWED_URI:an}=Ir,H=null;const ln=R({},[...Mr,...Us,...Ws,...Ks,...Lr]);let q=null;const cn=R({},[...Pr,...js,...Rr,...An]);let W=Object.seal(gi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ue=null,Et=null;const Me=Object.seal(gi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let un=!0,k=!0,A=!1,M=!0,L=!1,K=!0,F=!1,te=!1,Le=!1,rt=!1,dn=!1,pn=!1,$o=!0,Eo=!1;const Tc="user-content-";let bs=!0,Tt=!1,at={},ge=null;const ws=R({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let To=null;const Co=R({},["audio","video","img","source","image","track"]);let ks=null;const _o=R({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),hn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",ke="http://www.w3.org/1999/xhtml";let lt=ke,Ss=!1,As=null;const Cc=R({},[hn,fn,ke],Bs);let gn=R({},["mi","mo","mn","ms","mtext"]),mn=R({},["annotation-xml"]);const _c=R({},["title","style","font","a","script"]);let Ct=null;const Mc=["application/xhtml+xml","text/html"],Lc="text/html";let V=null,ct=null;const Pc=n.createElement("form"),Mo=function(y){return y instanceof RegExp||y instanceof Function},xs=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ct&&ct===y)){if((!y||typeof y!="object")&&(y={}),y=be(y),Ct=Mc.indexOf(y.PARSER_MEDIA_TYPE)===-1?Lc:y.PARSER_MEDIA_TYPE,V=Ct==="application/xhtml+xml"?Bs:Rn,H=de(y,"ALLOWED_TAGS")?R({},y.ALLOWED_TAGS,V):ln,q=de(y,"ALLOWED_ATTR")?R({},y.ALLOWED_ATTR,V):cn,As=de(y,"ALLOWED_NAMESPACES")?R({},y.ALLOWED_NAMESPACES,Bs):Cc,ks=de(y,"ADD_URI_SAFE_ATTR")?R(be(_o),y.ADD_URI_SAFE_ATTR,V):_o,To=de(y,"ADD_DATA_URI_TAGS")?R(be(Co),y.ADD_DATA_URI_TAGS,V):Co,ge=de(y,"FORBID_CONTENTS")?R({},y.FORBID_CONTENTS,V):ws,Ue=de(y,"FORBID_TAGS")?R({},y.FORBID_TAGS,V):be({}),Et=de(y,"FORBID_ATTR")?R({},y.FORBID_ATTR,V):be({}),at=de(y,"USE_PROFILES")?y.USE_PROFILES:!1,un=y.ALLOW_ARIA_ATTR!==!1,k=y.ALLOW_DATA_ATTR!==!1,A=y.ALLOW_UNKNOWN_PROTOCOLS||!1,M=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,L=y.SAFE_FOR_TEMPLATES||!1,K=y.SAFE_FOR_XML!==!1,F=y.WHOLE_DOCUMENT||!1,rt=y.RETURN_DOM||!1,dn=y.RETURN_DOM_FRAGMENT||!1,pn=y.RETURN_TRUSTED_TYPE||!1,Le=y.FORCE_BODY||!1,$o=y.SANITIZE_DOM!==!1,Eo=y.SANITIZE_NAMED_PROPS||!1,bs=y.KEEP_CONTENT!==!1,Tt=y.IN_PLACE||!1,an=y.ALLOWED_URI_REGEXP||xl,lt=y.NAMESPACE||ke,gn=y.MATHML_TEXT_INTEGRATION_POINTS||gn,mn=y.HTML_INTEGRATION_POINTS||mn,W=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&Mo(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&Mo(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),L&&(k=!1),dn&&(rt=!0),at&&(H=R({},Lr),q=[],at.html===!0&&(R(H,Mr),R(q,Pr)),at.svg===!0&&(R(H,Us),R(q,js),R(q,An)),at.svgFilters===!0&&(R(H,Ws),R(q,js),R(q,An)),at.mathMl===!0&&(R(H,Ks),R(q,Rr),R(q,An))),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?Me.tagCheck=y.ADD_TAGS:(H===ln&&(H=be(H)),R(H,y.ADD_TAGS,V))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?Me.attributeCheck=y.ADD_ATTR:(q===cn&&(q=be(q)),R(q,y.ADD_ATTR,V))),y.ADD_URI_SAFE_ATTR&&R(ks,y.ADD_URI_SAFE_ATTR,V),y.FORBID_CONTENTS&&(ge===ws&&(ge=be(ge)),R(ge,y.FORBID_CONTENTS,V)),y.ADD_FORBID_CONTENTS&&(ge===ws&&(ge=be(ge)),R(ge,y.ADD_FORBID_CONTENTS,V)),bs&&(H["#text"]=!0),F&&R(H,["html","head","body"]),H.table&&(R(H,["tbody"]),delete Ue.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Rt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Rt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=y.TRUSTED_TYPES_POLICY,B=I.createHTML("")}else I===void 0&&(I=$h(v,i)),I!==null&&typeof B=="string"&&(B=I.createHTML(""));ie&&ie(y),ct=y}},Lo=R({},[...Us,...Ws,...fh]),Po=R({},[...Ks,...gh]),Rc=function(y){let S=P(y);(!S||!S.tagName)&&(S={namespaceURI:lt,tagName:"template"});const E=Rn(y.tagName),U=Rn(S.tagName);return As[y.namespaceURI]?y.namespaceURI===fn?S.namespaceURI===ke?E==="svg":S.namespaceURI===hn?E==="svg"&&(U==="annotation-xml"||gn[U]):!!Lo[E]:y.namespaceURI===hn?S.namespaceURI===ke?E==="math":S.namespaceURI===fn?E==="math"&&mn[U]:!!Po[E]:y.namespaceURI===ke?S.namespaceURI===fn&&!mn[U]||S.namespaceURI===hn&&!gn[U]?!1:!Po[E]&&(_c[E]||!Lo[E]):!!(Ct==="application/xhtml+xml"&&As[y.namespaceURI]):!1},me=function(y){Lt(t.removed,{element:y});try{P(y).removeChild(y)}catch{_(y)}},We=function(y,S){try{Lt(t.removed,{attribute:S.getAttributeNode(y),from:S})}catch{Lt(t.removed,{attribute:null,from:S})}if(S.removeAttribute(y),y==="is")if(rt||dn)try{me(S)}catch{}else try{S.setAttribute(y,"")}catch{}},Ro=function(y){let S=null,E=null;if(Le)y="<remove></remove>"+y;else{const G=Fs(y,/^[\r\n\t ]+/);E=G&&G[0]}Ct==="application/xhtml+xml"&<===ke&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const U=I?I.createHTML(y):y;if(lt===ke)try{S=new m().parseFromString(U,Ct)}catch{}if(!S||!S.documentElement){S=ue.createDocument(lt,"template",null);try{S.documentElement.innerHTML=Ss?B:U}catch{}}const Z=S.body||S.documentElement;return y&&E&&Z.insertBefore(n.createTextNode(E),Z.childNodes[0]||null),lt===ke?fs.call(S,F?"html":"body")[0]:F?S.documentElement:Z},Io=function(y){return it.call(y.ownerDocument||y,y,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},$s=function(y){return y instanceof p&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof u)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},No=function(y){return typeof l=="function"&&y instanceof l};function Se(T,y,S){Sn(T,E=>{E.call(t,y,S,ct)})}const Oo=function(y){let S=null;if(Se(Y.beforeSanitizeElements,y,null),$s(y))return me(y),!0;const E=V(y.nodeName);if(Se(Y.uponSanitizeElement,y,{tagName:E,allowedTags:H}),K&&y.hasChildNodes()&&!No(y.firstElementChild)&&ne(/<[/\w!]/g,y.innerHTML)&&ne(/<[/\w!]/g,y.textContent)||y.nodeType===Nt.progressingInstruction||K&&y.nodeType===Nt.comment&&ne(/<[/\w]/g,y.data))return me(y),!0;if(!(Me.tagCheck instanceof Function&&Me.tagCheck(E))&&(!H[E]||Ue[E])){if(!Ue[E]&&Bo(E)&&(W.tagNameCheck instanceof RegExp&&ne(W.tagNameCheck,E)||W.tagNameCheck instanceof Function&&W.tagNameCheck(E)))return!1;if(bs&&!ge[E]){const U=P(y)||y.parentNode,Z=C(y)||y.childNodes;if(Z&&U){const G=Z.length;for(let re=G-1;re>=0;--re){const Ae=x(Z[re],!0);Ae.__removalCount=(y.__removalCount||0)+1,U.insertBefore(Ae,z(y))}}}return me(y),!0}return y instanceof a&&!Rc(y)||(E==="noscript"||E==="noembed"||E==="noframes")&&ne(/<\/no(script|embed|frames)/i,y.innerHTML)?(me(y),!0):(L&&y.nodeType===Nt.text&&(S=y.textContent,Sn([$t,ot,Fe],U=>{S=Pt(S,U," ")}),y.textContent!==S&&(Lt(t.removed,{element:y.cloneNode()}),y.textContent=S)),Se(Y.afterSanitizeElements,y,null),!1)},Do=function(y,S,E){if($o&&(S==="id"||S==="name")&&(E in n||E in Pc))return!1;if(!(k&&!Et[S]&&ne(gs,S))){if(!(un&&ne(ms,S))){if(!(Me.attributeCheck instanceof Function&&Me.attributeCheck(S,y))){if(!q[S]||Et[S]){if(!(Bo(y)&&(W.tagNameCheck instanceof RegExp&&ne(W.tagNameCheck,y)||W.tagNameCheck instanceof Function&&W.tagNameCheck(y))&&(W.attributeNameCheck instanceof RegExp&&ne(W.attributeNameCheck,S)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(S,y))||S==="is"&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&ne(W.tagNameCheck,E)||W.tagNameCheck instanceof Function&&W.tagNameCheck(E))))return!1}else if(!ks[S]){if(!ne(an,Pt(E,rn,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&y!=="script"&&uh(E,"data:")===0&&To[y])){if(!(A&&!ne(ys,Pt(E,rn,"")))){if(E)return!1}}}}}}}return!0},Bo=function(y){return y!=="annotation-xml"&&Fs(y,vs)},Fo=function(y){Se(Y.beforeSanitizeAttributes,y,null);const{attributes:S}=y;if(!S||$s(y))return;const E={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let U=S.length;for(;U--;){const Z=S[U],{name:G,namespaceURI:re,value:Ae}=Z,ut=V(G),Es=Ae;let X=G==="value"?Es:dh(Es);if(E.attrName=ut,E.attrValue=X,E.keepAttr=!0,E.forceKeepAttr=void 0,Se(Y.uponSanitizeAttribute,y,E),X=E.attrValue,Eo&&(ut==="id"||ut==="name")&&(We(G,y),X=Tc+X),K&&ne(/((--!?|])>)|<\/(style|title|textarea)/i,X)){We(G,y);continue}if(ut==="attributename"&&Fs(X,"href")){We(G,y);continue}if(E.forceKeepAttr)continue;if(!E.keepAttr){We(G,y);continue}if(!M&&ne(/\/>/i,X)){We(G,y);continue}L&&Sn([$t,ot,Fe],Wo=>{X=Pt(X,Wo," ")});const Uo=V(y.nodeName);if(!Do(Uo,ut,X)){We(G,y);continue}if(I&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!re)switch(v.getAttributeType(Uo,ut)){case"TrustedHTML":{X=I.createHTML(X);break}case"TrustedScriptURL":{X=I.createScriptURL(X);break}}if(X!==Es)try{re?y.setAttributeNS(re,G,X):y.setAttribute(G,X),$s(y)?me(y):_r(t.removed)}catch{We(G,y)}}Se(Y.afterSanitizeAttributes,y,null)},Ic=function T(y){let S=null;const E=Io(y);for(Se(Y.beforeSanitizeShadowDOM,y,null);S=E.nextNode();)Se(Y.uponSanitizeShadowNode,S,null),Oo(S),Fo(S),S.content instanceof o&&T(S.content);Se(Y.afterSanitizeShadowDOM,y,null)};return t.sanitize=function(T){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,E=null,U=null,Z=null;if(Ss=!T,Ss&&(T="<!-->"),typeof T!="string"&&!No(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw Rt("dirty is not a string, aborting")}else throw Rt("toString is not a function");if(!t.isSupported)return T;if(te||xs(y),t.removed=[],typeof T=="string"&&(Tt=!1),Tt){if(T.nodeName){const Ae=V(T.nodeName);if(!H[Ae]||Ue[Ae])throw Rt("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof l)S=Ro("<!---->"),E=S.ownerDocument.importNode(T,!0),E.nodeType===Nt.element&&E.nodeName==="BODY"||E.nodeName==="HTML"?S=E:S.appendChild(E);else{if(!rt&&!L&&!F&&T.indexOf("<")===-1)return I&&pn?I.createHTML(T):T;if(S=Ro(T),!S)return rt?null:pn?B:""}S&&Le&&me(S.firstChild);const G=Io(Tt?T:S);for(;U=G.nextNode();)Oo(U),Fo(U),U.content instanceof o&&Ic(U.content);if(Tt)return T;if(rt){if(dn)for(Z=hs.call(S.ownerDocument);S.firstChild;)Z.appendChild(S.firstChild);else Z=S;return(q.shadowroot||q.shadowrootmode)&&(Z=on.call(s,Z,!0)),Z}let re=F?S.outerHTML:S.innerHTML;return F&&H["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&ne($l,S.ownerDocument.doctype.name)&&(re="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
|
|
1497
1483
|
`+re),L&&Sn([$t,ot,Fe],Ae=>{re=Pt(re,Ae," ")}),I&&pn?I.createHTML(re):re},t.setConfig=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xs(T),te=!0},t.clearConfig=function(){ct=null,te=!1},t.isValidAttribute=function(T,y,S){ct||xs({});const E=V(T),U=V(y);return Do(E,U,S)},t.addHook=function(T,y){typeof y=="function"&&Lt(Y[T],y)},t.removeHook=function(T,y){if(y!==void 0){const S=lh(Y[T],y);return S===-1?void 0:ch(Y[T],S,1)[0]}return _r(Y[T])},t.removeHooks=function(T){Y[T]=[]},t.removeAllHooks=function(){Y=Nr()},t}var vi=El();function ao(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var tt=ao();function Tl(e){tt=e}var Gt={exec:()=>null};function O(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(se.caret,"$1"),n=n.replace(i,r),s},getRegex:()=>new RegExp(n,t)};return s}var Eh=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),se={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Th=/^(?:[ \t]*(?:\n|$))+/,Ch=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_h=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,tn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Mh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lo=/(?:[*+-]|\d{1,9}[.)])/,Cl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_l=O(Cl).replace(/bull/g,lo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Lh=O(Cl).replace(/bull/g,lo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),co=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ph=/^[^\n]+/,uo=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Rh=O(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",uo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ih=O(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,lo).getRegex(),ls="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",po=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Nh=O("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",po).replace("tag",ls).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ml=O(co).replace("hr",tn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ls).getRegex(),Oh=O(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ml).getRegex(),ho={blockquote:Oh,code:Ch,def:Rh,fences:_h,heading:Mh,hr:tn,html:Nh,lheading:_l,list:Ih,newline:Th,paragraph:Ml,table:Gt,text:Ph},Or=O("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ls).getRegex(),Dh={...ho,lheading:Lh,table:Or,paragraph:O(co).replace("hr",tn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Or).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ls).getRegex()},Bh={...ho,html:O(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",po).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Gt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:O(co).replace("hr",tn).replace("heading",` *#{1,6} *[^
|
|
1498
1484
|
]`).replace("lheading",_l).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Fh=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Uh=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ll=/^( {2,}|\\)\n(?!\s*$)/,Wh=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,cs=/[\p{P}\p{S}]/u,fo=/[\s\p{P}\p{S}]/u,Pl=/[^\s\p{P}\p{S}]/u,Kh=O(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,fo).getRegex(),Rl=/(?!~)[\p{P}\p{S}]/u,jh=/(?!~)[\s\p{P}\p{S}]/u,zh=/(?:[^\s\p{P}\p{S}]|~)/u,Hh=O(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Eh?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Il=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qh=O(Il,"u").replace(/punct/g,cs).getRegex(),Gh=O(Il,"u").replace(/punct/g,Rl).getRegex(),Nl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Vh=O(Nl,"gu").replace(/notPunctSpace/g,Pl).replace(/punctSpace/g,fo).replace(/punct/g,cs).getRegex(),Qh=O(Nl,"gu").replace(/notPunctSpace/g,zh).replace(/punctSpace/g,jh).replace(/punct/g,Rl).getRegex(),Yh=O("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Pl).replace(/punctSpace/g,fo).replace(/punct/g,cs).getRegex(),Xh=O(/\\(punct)/,"gu").replace(/punct/g,cs).getRegex(),Zh=O(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Jh=O(po).replace("(?:-->|$)","-->").getRegex(),ef=O("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Jh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,tf=O(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",qn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ol=O(/^!?\[(label)\]\[(ref)\]/).replace("label",qn).replace("ref",uo).getRegex(),Dl=O(/^!?\[(ref)\](?:\[\])?/).replace("ref",uo).getRegex(),nf=O("reflink|nolink(?!\\()","g").replace("reflink",Ol).replace("nolink",Dl).getRegex(),Dr=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,go={_backpedal:Gt,anyPunctuation:Xh,autolink:Zh,blockSkip:Hh,br:Ll,code:Uh,del:Gt,emStrongLDelim:qh,emStrongRDelimAst:Vh,emStrongRDelimUnd:Yh,escape:Fh,link:tf,nolink:Dl,punctuation:Kh,reflink:Ol,reflinkSearch:nf,tag:ef,text:Wh,url:Gt},sf={...go,link:O(/^!?\[(label)\]\((.*?)\)/).replace("label",qn).getRegex(),reflink:O(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qn).getRegex()},bi={...go,emStrongRDelimAst:Qh,emStrongLDelim:Gh,url:O(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Dr).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:O(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Dr).getRegex()},of={...bi,br:O(Ll).replace("{2,}","*").getRegex(),text:O(bi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},xn={normal:ho,gfm:Dh,pedantic:Bh},Ot={normal:go,gfm:bi,breaks:of,pedantic:sf},rf={"&":"&","<":"<",">":">",'"':""","'":"'"},Br=e=>rf[e];function Ee(e,t){if(t){if(se.escapeTest.test(e))return e.replace(se.escapeReplace,Br)}else if(se.escapeTestNoEncode.test(e))return e.replace(se.escapeReplaceNoEncode,Br);return e}function Fr(e){try{e=encodeURI(e).replace(se.percentDecode,"%")}catch{return null}return e}function Ur(e,t){let n=e.replace(se.findPipe,(o,r,l)=>{let a=!1,c=r;for(;--c>=0&&l[c]==="\\";)a=!a;return a?"|":" |"}),s=n.split(se.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(se.slashPipe,"|");return s}function Dt(e,t,n){let s=e.length;if(s===0)return"";let i=0;for(;i<s&&e.charAt(s-i-1)===t;)i++;return e.slice(0,s-i)}function af(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function Wr(e,t,n,s,i){let o=t.href,r=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:r,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,a}function lf(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
|
|
1499
1485
|
`).map(o=>{let r=o.match(n.other.beginningSpace);if(r===null)return o;let[l]=r;return l.length>=i.length?o.slice(i.length):o}).join(`
|
|
@@ -1519,7 +1505,7 @@ ${u}`:u;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
1519
1505
|
`+m}!v&&!m.trim()&&(v=!0),c+=I+`
|
|
1520
1506
|
`,e=e.substring(I.length+1),p=B.slice(w)}}i.loose||(r?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(r=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),i.raw+=c}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let a of i.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=u.checked,i.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=u.raw+a.tokens[0].raw,a.tokens[0].text=u.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(u)):a.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):a.tokens.unshift(u)}}if(!i.loose){let c=a.tokens.filter(p=>p.type==="space"),u=c.length>0&&c.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=u}}if(i.loose)for(let a of i.items){a.loose=!0;for(let c of a.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ur(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
1521
1507
|
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let r of s)this.rules.other.tableAlignRight.test(r)?o.align.push("right"):this.rules.other.tableAlignCenter.test(r)?o.align.push("center"):this.rules.other.tableAlignLeft.test(r)?o.align.push("left"):o.align.push(null);for(let r=0;r<n.length;r++)o.header.push({text:n[r],tokens:this.lexer.inline(n[r]),header:!0,align:o.align[r]});for(let r of i)o.rows.push(Ur(r,o.header.length).map((l,a)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[a]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
1522
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Dt(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=af(t[2],"()");if(o===-2)return;if(o>-1){let r=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],i=o[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Wr(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Wr(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,o,r,l=i,a=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+i);(s=c.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){l+=r;continue}else if((s[5]||s[6])&&i%3&&!((i+r)%3)){a+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+a);let u=[...s[0]][0].length,p=e.slice(0,i+s.index+u+r);if(Math.min(i,r)%2){let v=p.slice(1,-1);return{type:"em",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}let m=p.slice(2,-2);return{type:"strong",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},
|
|
1508
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Dt(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=af(t[2],"()");if(o===-2)return;if(o>-1){let r=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],i=o[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Wr(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Wr(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,o,r,l=i,a=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+i);(s=c.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){l+=r;continue}else if((s[5]||s[6])&&i%3&&!((i+r)%3)){a+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+a);let u=[...s[0]][0].length,p=e.slice(0,i+s.index+u+r);if(Math.min(i,r)%2){let v=p.slice(1,-1);return{type:"em",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}let m=p.slice(2,-2);return{type:"strong",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},pe=class wi{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||tt,this.options.tokenizer=this.options.tokenizer||new Gn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:se,block:xn.normal,inline:Ot.normal};this.options.pedantic?(n.block=xn.pedantic,n.inline=Ot.pedantic):this.options.gfm&&(n.block=xn.gfm,this.options.breaks?n.inline=Ot.breaks:n.inline=Ot.gfm),this.tokenizer.rules=n}static get rules(){return{block:xn,inline:Ot}}static lex(t,n){return new wi(n).lex(t)}static lexInline(t,n){return new wi(n).inlineTokens(t)}lex(t){t=t.replace(se.carriageReturn,`
|
|
1523
1509
|
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(se.tabCharGlobal," ").replace(se.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(r=>(i=r.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let r=n.at(-1);i.raw.length===1&&r!==void 0?r.raw+=`
|
|
1524
1510
|
`:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let r=n.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(`
|
|
1525
1511
|
`)?"":`
|
|
@@ -1551,8 +1537,8 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1551
1537
|
`}tablerow({text:e}){return`<tr>
|
|
1552
1538
|
${e}</tr>
|
|
1553
1539
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
1554
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ee(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=Fr(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+Ee(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Fr(e);if(i===null)return Ee(n);e=i;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${Ee(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ee(e.text)}},mo=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},
|
|
1555
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Ee(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},Xe=new cf;function D(e,t){return Xe.parse(e,t)}D.options=D.setOptions=function(e){return Xe.setOptions(e),D.defaults=Xe.defaults,Tl(D.defaults),D};D.getDefaults=ao;D.defaults=tt;D.use=function(...e){return Xe.use(...e),D.defaults=Xe.defaults,Tl(D.defaults),D};D.walkTokens=function(e,t){return Xe.walkTokens(e,t)};D.parseInline=Xe.parseInline;D.Parser=
|
|
1540
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ee(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=Fr(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+Ee(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Fr(e);if(i===null)return Ee(n);e=i;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${Ee(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ee(e.text)}},mo=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},he=class ki{options;renderer;textRenderer;constructor(t){this.options=t||tt,this.options.renderer=this.options.renderer||new Vn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mo}static parse(t,n){return new ki(n).parse(t)}static parseInline(t,n){return new ki(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let r=i,l=this.options.extensions.renderers[r.type].call({parser:this},r);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(r.type)){n+=l||"";continue}}let o=i;switch(o.type){case"space":{n+=this.renderer.space(o);break}case"hr":{n+=this.renderer.hr(o);break}case"heading":{n+=this.renderer.heading(o);break}case"code":{n+=this.renderer.code(o);break}case"table":{n+=this.renderer.table(o);break}case"blockquote":{n+=this.renderer.blockquote(o);break}case"list":{n+=this.renderer.list(o);break}case"checkbox":{n+=this.renderer.checkbox(o);break}case"html":{n+=this.renderer.html(o);break}case"def":{n+=this.renderer.def(o);break}case"paragraph":{n+=this.renderer.paragraph(o);break}case"text":{n+=this.renderer.text(o);break}default:{let r='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let o=t[i];if(this.options.extensions?.renderers?.[o.type]){let l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){s+=l||"";continue}}let r=o;switch(r.type){case"escape":{s+=n.text(r);break}case"html":{s+=n.html(r);break}case"link":{s+=n.link(r);break}case"image":{s+=n.image(r);break}case"checkbox":{s+=n.checkbox(r);break}case"strong":{s+=n.strong(r);break}case"em":{s+=n.em(r);break}case"codespan":{s+=n.codespan(r);break}case"br":{s+=n.br(r);break}case"del":{s+=n.del(r);break}case"text":{s+=n.text(r);break}default:{let l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},Ut=class{options;block;constructor(e){this.options=e||tt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?pe.lex:pe.lexInline}provideParser(){return this.block?he.parse:he.parseInline}},cf=class{defaults=ao();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=he;Renderer=Vn;TextRenderer=mo;Lexer=pe;Tokenizer=Gn;Hooks=Ut;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let o of i.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of i.rows)for(let r of o)n=n.concat(this.walkTokens(r.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(o=>{let r=i[o].flat(1/0);n=n.concat(this.walkTokens(r,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=t.renderers[i.name];o?t.renderers[i.name]=function(...r){let l=i.renderer.apply(this,r);return l===!1&&(l=o.apply(this,r)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[i.level];o?o.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new Vn(this.defaults);for(let o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let r=o,l=n.renderer[r],a=i[r];i[r]=(...c)=>{let u=l.apply(i,c);return u===!1&&(u=a.apply(i,c)),u||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Gn(this.defaults);for(let o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let r=o,l=n.tokenizer[r],a=i[r];i[r]=(...c)=>{let u=l.apply(i,c);return u===!1&&(u=a.apply(i,c)),u}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Ut;for(let o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let r=o,l=n.hooks[r],a=i[r];Ut.passThroughHooks.has(o)?i[r]=c=>{if(this.defaults.async&&Ut.passThroughHooksRespectAsync.has(o))return(async()=>{let p=await l.call(i,c);return a.call(i,p)})();let u=l.call(i,c);return a.call(i,u)}:i[r]=(...c)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(i,c);return p===!1&&(p=await a.apply(i,c)),p})();let u=l.apply(i,c);return u===!1&&(u=a.apply(i,c)),u}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,o=n.walkTokens;s.walkTokens=function(r){let l=[];return l.push(o.call(this,r)),i&&(l=l.concat(i.call(this,r))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return pe.lex(e,t??this.defaults)}parser(e,t){return he.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let r=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?pe.lex:pe.lexInline)(r,i),a=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser():e?he.parse:he.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let r=(i.hooks?i.hooks.provideLexer():e?pe.lex:pe.lexInline)(t,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?he.parse:he.parseInline)(r,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(r){return o(r)}}}onError(e,t){return n=>{if(n.message+=`
|
|
1541
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Ee(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},Xe=new cf;function D(e,t){return Xe.parse(e,t)}D.options=D.setOptions=function(e){return Xe.setOptions(e),D.defaults=Xe.defaults,Tl(D.defaults),D};D.getDefaults=ao;D.defaults=tt;D.use=function(...e){return Xe.use(...e),D.defaults=Xe.defaults,Tl(D.defaults),D};D.walkTokens=function(e,t){return Xe.walkTokens(e,t)};D.parseInline=Xe.parseInline;D.Parser=he;D.parser=he.parse;D.Renderer=Vn;D.TextRenderer=mo;D.Lexer=pe;D.lexer=pe.lex;D.Tokenizer=Gn;D.Hooks=Ut;D.parse=D;D.options;D.setOptions;D.use;D.walkTokens;D.parseInline;he.parse;pe.lex;D.setOptions({gfm:!0,breaks:!0,mangle:!1});const Kr=["a","b","blockquote","br","code","del","em","h1","h2","h3","h4","hr","i","li","ol","p","pre","strong","table","tbody","td","th","thead","tr","ul"],jr=["class","href","rel","target","title","start"];let zr=!1;const uf=14e4,df=4e4,pf=200,zs=5e4,qe=new Map;function hf(e){const t=qe.get(e);return t===void 0?null:(qe.delete(e),qe.set(e,t),t)}function Hr(e,t){if(qe.set(e,t),qe.size<=pf)return;const n=qe.keys().next().value;n&&qe.delete(n)}function ff(){zr||(zr=!0,vi.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function Si(e){const t=e.trim();if(!t)return"";if(ff(),t.length<=zs){const r=hf(t);if(r!==null)return r}const n=Ta(t,uf),s=n.truncated?`
|
|
1556
1542
|
|
|
1557
1543
|
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>df){const l=`<pre class="code-block">${gf(`${n.text}${s}`)}</pre>`,a=vi.sanitize(l,{ALLOWED_TAGS:Kr,ALLOWED_ATTR:jr});return t.length<=zs&&Hr(t,a),a}const i=D.parse(`${n.text}${s}`),o=vi.sanitize(i,{ALLOWED_TAGS:Kr,ALLOWED_ATTR:jr});return t.length<=zs&&Hr(t,o),o}function gf(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const mf=1500,yf=2e3,Bl="Copy as markdown",vf="Copied",bf="Copy failed";async function wf(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}}function $n(e,t){e.title=t,e.setAttribute("aria-label",t)}function kf(e){const t=e.label??Bl;return d`
|
|
1558
1544
|
<button
|
|
@@ -1656,7 +1642,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
|
|
|
1656
1642
|
`;us([ts({type:Number})],wt.prototype,"splitRatio",2);us([ts({type:Number})],wt.prototype,"minRatio",2);us([ts({type:Number})],wt.prototype,"maxRatio",2);wt=us([Sa("resizable-divider")],wt);function En(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function Hs(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const Nf=1,Of=1,nt="emoji",kt="keyvalue",yo="favorites",Df="tokens",Ul="tokens",Bf="unicode",Wl="count",Ff="group",Uf="order",Kl="group-order",Ai="eTag",Qn="url",qr="skinTone",xt="readonly",vo="readwrite",jl="skinUnicodes",Wf="skinUnicodes",Kf="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",jf="en";function zf(e,t){const n=new Set,s=[];for(const i of e){const o=t(i);n.has(o)||(n.add(o),s.push(i))}return s}function Gr(e){return zf(e,t=>t.unicode)}function Hf(e){function t(n,s,i){const o=s?e.createObjectStore(n,{keyPath:s}):e.createObjectStore(n);if(i)for(const[r,[l,a]]of Object.entries(i))o.createIndex(r,l,{multiEntry:a});return o}t(kt),t(nt,Bf,{[Ul]:[Df,!0],[Kl]:[[Ff,Uf]],[jl]:[Wf,!0]}),t(yo,void 0,{[Wl]:[""]})}const xi={},In={},Yn={};function zl(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function qf(e){const t=await new Promise((n,s)=>{const i=indexedDB.open(e,Nf);xi[e]=i,i.onupgradeneeded=o=>{o.oldVersion<Of&&Hf(i.result)},zl(n,s,i)});return t.onclose=()=>bo(e),t}function Gf(e){return In[e]||(In[e]=qf(e)),In[e]}function _e(e,t,n,s){return new Promise((i,o)=>{const r=e.transaction(t,n,{durability:"relaxed"}),l=typeof t=="string"?r.objectStore(t):t.map(c=>r.objectStore(c));let a;s(l,r,c=>{a=c}),r.oncomplete=()=>i(a),r.onerror=()=>o(r.error)})}function bo(e){const t=xi[e],n=t&&t.result;if(n){n.close();const s=Yn[e];if(s)for(const i of s)i()}delete xi[e],delete In[e],delete Yn[e]}function Vf(e){return new Promise((t,n)=>{bo(e);const s=indexedDB.deleteDatabase(e);zl(t,n,s)})}function Qf(e,t){let n=Yn[e];n||(n=Yn[e]=[]),n.push(t)}const Yf=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function mt(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||Yf.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const Xf=2;function Hl(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=Xf)}function Zf(e){return e.map(({annotation:n,emoticon:s,group:i,order:o,shortcodes:r,skins:l,tags:a,emoji:c,version:u})=>{const p=[...new Set(Hl([...(r||[]).map(mt).flat(),...(a||[]).map(mt).flat(),...mt(n),s]))].sort(),m={annotation:n,group:i,order:o,tags:a,tokens:p,unicode:c,version:u};if(s&&(m.emoticon=s),r&&(m.shortcodes=r),l){m.skinTones=[],m.skinUnicodes=[],m.skinVersions=[];for(const{tone:v,emoji:w,version:x}of l)m.skinTones.push(v),m.skinUnicodes.push(w),m.skinVersions.push(x)}return m})}function ql(e,t,n,s){e[t](n).onsuccess=i=>s&&s(i.target.result)}function Ze(e,t,n){ql(e,"get",t,n)}function Gl(e,t,n){ql(e,"getAll",t,n)}function wo(e){e.commit&&e.commit()}function Jf(e,t){let n=e[0];for(let s=1;s<e.length;s++){const i=e[s];t(n)>t(i)&&(n=i)}return n}function Vl(e,t){const n=Jf(e,i=>i.length),s=[];for(const i of n)e.some(o=>o.findIndex(r=>t(r)===t(i))===-1)||s.push(i);return s}async function eg(e){return!await ko(e,kt,Qn)}async function tg(e,t,n){const[s,i]=await Promise.all([Ai,Qn].map(o=>ko(e,kt,o)));return s===n&&i===t}async function ng(e,t){return _e(e,nt,xt,(s,i,o)=>{let r;const l=()=>{s.getAll(r&&IDBKeyRange.lowerBound(r,!0),50).onsuccess=a=>{const c=a.target.result;for(const u of c)if(r=u.unicode,t(u))return o(u);if(c.length<50)return o();l()}};l()})}async function Ql(e,t,n,s){{const i=Zf(t);await _e(e,[nt,kt],vo,([o,r],l)=>{let a,c,u=0;function p(){++u===2&&m()}function m(){if(!(a===s&&c===n)){o.clear();for(const v of i)o.put(v);r.put(s,Ai),r.put(n,Qn),wo(l)}}Ze(r,Ai,v=>{a=v,p()}),Ze(r,Qn,v=>{c=v,p()})})}}async function sg(e,t){return _e(e,nt,xt,(n,s,i)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Gl(n.index(Kl),o,i)})}async function Yl(e,t){const n=Hl(mt(t));return n.length?_e(e,nt,xt,(s,i,o)=>{const r=[],l=()=>{r.length===n.length&&a()},a=()=>{const c=Vl(r,u=>u.unicode);o(c.sort((u,p)=>u.order<p.order?-1:1))};for(let c=0;c<n.length;c++){const u=n[c],p=c===n.length-1?IDBKeyRange.bound(u,u+"",!1,!0):IDBKeyRange.only(u);Gl(s.index(Ul),p,m=>{r.push(m),l()})}}):[]}async function ig(e,t){const n=await Yl(e,t);return n.length?n.filter(s=>(s.shortcodes||[]).map(o=>o.toLowerCase()).includes(t.toLowerCase()))[0]||null:await ng(e,i=>(i.shortcodes||[]).includes(t.toLowerCase()))||null}async function og(e,t){return _e(e,nt,xt,(n,s,i)=>Ze(n,t,o=>{if(o)return i(o);Ze(n.index(jl),t,r=>i(r||null))}))}function ko(e,t,n){return _e(e,t,xt,(s,i,o)=>Ze(s,n,o))}function rg(e,t,n,s){return _e(e,t,vo,(i,o)=>{i.put(s,n),wo(o)})}function ag(e,t){return _e(e,yo,vo,(n,s)=>Ze(n,t,i=>{n.put((i||0)+1,t),wo(s)}))}function lg(e,t,n){return n===0?[]:_e(e,[yo,nt],xt,([s,i],o,r)=>{const l=[];s.index(Wl).openCursor(void 0,"prev").onsuccess=a=>{const c=a.target.result;if(!c)return r(l);function u(v){if(l.push(v),l.length===n)return r(l);c.continue()}const p=c.primaryKey,m=t.byName(p);if(m)return u(m);Ze(i,p,v=>{if(v)return u(v);c.continue()})}})}const Tn="";function cg(e,t){const n=new Map;for(const i of e){const o=t(i);for(const r of o){let l=n;for(let c=0;c<r.length;c++){const u=r.charAt(c);let p=l.get(u);p||(p=new Map,l.set(u,p)),l=p}let a=l.get(Tn);a||(a=[],l.set(Tn,a)),a.push(i)}}return(i,o)=>{let r=n;for(let c=0;c<i.length;c++){const u=i.charAt(c),p=r.get(u);if(p)r=p;else return[]}if(o)return r.get(Tn)||[];const l=[],a=[r];for(;a.length;){const u=[...a.shift().entries()].sort((p,m)=>p[0]<m[0]?-1:1);for(const[p,m]of u)p===Tn?l.push(...m):a.push(m)}return l}}const ug=["name","url"];function dg(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||ug.some(s=>!(s in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function Vr(e){dg(e);const t=(m,v)=>m.name.toLowerCase()<v.name.toLowerCase()?-1:1,n=e.sort(t),i=cg(e,m=>{const v=new Set;if(m.shortcodes)for(const w of m.shortcodes)for(const x of mt(w))v.add(x);return v}),o=m=>i(m,!0),r=m=>i(m,!1),l=m=>{const v=mt(m),w=v.map((x,_)=>(_<v.length-1?o:r)(x));return Vl(w,x=>x.name).sort(t)},a=new Map,c=new Map;for(const m of e){c.set(m.name.toLowerCase(),m);for(const v of m.shortcodes||[])a.set(v.toLowerCase(),m)}return{all:n,search:l,byShortcode:m=>a.get(m.toLowerCase()),byName:m=>c.get(m.toLowerCase())}}const pg=typeof wrappedJSObject<"u";function Bt(e){if(!e)return e;if(pg&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function Xl(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const hg=["annotation","emoji","group","order","version"];function fg(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||hg.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function Zl(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function gg(e){const t=await fetch(e,{method:"HEAD"});Zl(t,e);const n=t.headers.get("etag");return Xl(n),n}async function $i(e){const t=await fetch(e);Zl(t,e);const n=t.headers.get("etag");Xl(n);const s=await t.json();return fg(s),[n,s]}function mg(e){for(var t="",n=new Uint8Array(e),s=n.byteLength,i=-1;++i<s;)t+=String.fromCharCode(n[i]);return t}function yg(e){for(var t=e.length,n=new ArrayBuffer(t),s=new Uint8Array(n),i=-1;++i<t;)s[i]=e.charCodeAt(i);return n}async function Jl(e){const t=JSON.stringify(e);let n=yg(t);const s=await crypto.subtle.digest("SHA-1",n),i=mg(s);return btoa(i)}async function vg(e,t){let n,s=await gg(t);if(!s){const i=await $i(t);s=i[0],n=i[1],s||(s=await Jl(n))}await tg(e,t,s)||(n||(n=(await $i(t))[1]),await Ql(e,n,t,s))}async function bg(e,t){let[n,s]=await $i(t);n||(n=await Jl(s)),await Ql(e,s,t,n)}async function wg(e,t){try{await vg(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class kg{constructor({dataSource:t=Kf,locale:n=jf,customEmoji:s=[]}={}){this.dataSource=t,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=Vr(s),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await Gf(this._dbName);Qf(this._dbName,this._clear);const n=this.dataSource;await eg(t)?await bg(t,n):this._lazyUpdate=wg(t,n)}async ready(){const t=async()=>(this._ready||(this._ready=this._init()),this._ready);await t(),this._db||await t()}async getEmojiByGroup(t){return Hs(t),await this.ready(),Gr(await sg(this._db,t)).map(Bt)}async getEmojiBySearchQuery(t){En(t),await this.ready();const n=this._custom.search(t),s=Gr(await Yl(this._db,t)).map(Bt);return[...n,...s]}async getEmojiByShortcode(t){En(t),await this.ready();const n=this._custom.byShortcode(t);return n||Bt(await ig(this._db,t))}async getEmojiByUnicodeOrName(t){En(t),await this.ready();const n=this._custom.byName(t);return n||Bt(await og(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await ko(this._db,kt,qr)||0}async setPreferredSkinTone(t){return Hs(t),await this.ready(),rg(this._db,kt,qr,t)}async incrementFavoriteEmojiCount(t){return En(t),await this.ready(),ag(this._db,t)}async getTopFavoriteEmoji(t){return Hs(t),await this.ready(),(await lg(this._db,this._custom,t)).map(Bt)}set customEmoji(t){this._custom=Vr(t)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await bo(this._dbName)}async delete(){await this._shutdown(),await Vf(this._dbName)}}const Ei=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([e,t,n])=>({id:e,emoji:t,name:n})),qs=Ei.slice(1),Sg=2,Qr=6,ec=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function Yr(e){return e.unicode.includes("")}const Ag={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},xg=1e3,$g="🖐️",Eg=8,Tg=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],tc='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Cg=(e,t)=>e<t?-1:e>t?1:0,Xr=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const s=n.getContext("2d",{willReadFrequently:!0});return s.textBaseline="top",s.font=`100px ${tc}`,s.fillStyle=t,s.scale(.01,.01),s.fillText(e,0,0),s.getImageData(0,0,1,1).data},_g=(e,t)=>{const n=[...e].join(","),s=[...t].join(",");return n===s&&!n.startsWith("0,0,0,")};function Mg(e){const t=Xr(e,"#000"),n=Xr(e,"#fff");return t&&n&&_g(t,n)}function Lg(){const e=Object.entries(Ag);try{for(const[t,n]of e)if(Mg(t))return n}catch{}return e[0][1]}let Gs;const Vs=()=>(Gs||(Gs=new Promise(e=>ec(()=>e(Lg())))),Gs),Ti=new Map,Pg="️",Rg="\uD83C",Ig="",Ng=127995,Og=57339;function Dg(e,t){if(t===0)return e;const n=e.indexOf(Ig);return n!==-1?e.substring(0,n)+String.fromCodePoint(Ng+t-1)+e.substring(n):(e.endsWith(Pg)&&(e=e.substring(0,e.length-1)),e+Rg+String.fromCodePoint(Og+t-1))}function ve(e){e.preventDefault(),e.stopPropagation()}function Qs(e,t,n){return t+=e?-1:1,t<0?t=n.length-1:t>=n.length&&(t=0),t}function nc(e,t){const n=new Set,s=[];for(const i of e){const o=t(i);n.has(o)||(n.add(o),s.push(i))}return s}function Bg(e,t){const n=s=>{const i={};for(const o of s)typeof o.tone=="number"&&o.version<=t&&(i[o.tone]=o.unicode);return i};return e.map(({unicode:s,skins:i,shortcodes:o,url:r,name:l,category:a,annotation:c})=>({unicode:s,name:l,shortcodes:o,url:r,category:a,annotation:c,id:s||l,skins:i&&n(i)}))}const Nn=requestAnimationFrame;let Fg=typeof ResizeObserver=="function";function Ug(e,t,n){let s;Fg?(s=new ResizeObserver(n),s.observe(e)):Nn(n),t.addEventListener("abort",()=>{s&&s.disconnect()})}function Zr(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let Ys;function Wg(e,t,n){let s=!0,i=!1;for(const o of e){const r=n(o);if(!r)continue;const l=Zr(r);l===0&&(i=!0),typeof Ys>"u"&&(Ys=Zr(t));const a=l/1.8<Ys;Ti.set(o.unicode,a),a||(s=!1)}return i&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
1657
1643
|
This is likely due to using \`display:none\` which is unsupported.
|
|
1658
1644
|
If this is a Jest/Vitest environment, you can ignore this warning.
|
|
1659
|
-
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),s}function Kg(e){return nc(e,t=>t)}function jg(e){e&&(e.scrollTop=0)}function Vt(e,t,n){let s=e.get(t);return s||(s=n(),e.set(t,s)),s}function Jr(e){return""+e}function zg(e){const t=document.createElement("template");return t.innerHTML=e,t}const Hg=new WeakMap,qg=new WeakMap,Gg=Symbol("un-keyed"),Vg="replaceChildren"in Element.prototype;function Qg(e,t){Vg?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function Yg(e,t){let n=e.firstChild,s=0;for(;n;){if(t[s]!==n)return!0;n=n.nextSibling,s++}return s!==t.length}function Xg(e,t){const{targetNode:n}=t;let{targetParentNode:s}=t,i=!1;s?i=Yg(s,e):(i=!0,t.targetNode=void 0,t.targetParentNode=s=n.parentNode),i&&Qg(s,e)}function Zg(e,t){for(const n of t){const{targetNode:s,currentExpression:i,binding:{expressionIndex:o,attributeName:r,attributeValuePre:l,attributeValuePost:a}}=n,c=e[o];if(i!==c)if(n.currentExpression=c,r)if(c===null)s.removeAttribute(r);else{const u=l+Jr(c)+a;s.setAttribute(r,u)}else{let u;Array.isArray(c)?Xg(c,n):c instanceof Element?(u=c,s.replaceWith(u)):s.nodeValue=Jr(c),u&&(n.targetNode=u)}}}function Jg(e){let t="",n=!1,s=!1,i=-1;const o=new Map,r=[];let l=0;for(let c=0,u=e.length;c<u;c++){const p=e[c];if(t+=p.slice(l),c===u-1)break;for(let C=0;C<p.length;C++)switch(p.charAt(C)){case"<":{p.charAt(C+1)==="/"?r.pop():(n=!0,r.push(++i));break}case">":{n=!1,s=!1;break}case"=":{s=!0;break}}const m=r[r.length-1],v=Vt(o,m,()=>[]);let w,x,_;if(s){const C=/(\S+)="?([^"=]*)$/.exec(p);w=C[1],x=C[2];const P=/^([^">]*)("?)/.exec(e[c+1]);_=P[1],t=t.slice(0,-1*C[0].length),l=P[0].length}else l=0;const z={attributeName:w,attributeValuePre:x,attributeValuePost:_,expressionIndex:c};v.push(z),!n&&!s&&(t+=" ")}return{template:zg(t),elementsToBindings:o}}function ea(e,t,n){for(let s=0;s<e.length;s++){const i=e[s],o=i.attributeName?t:t.firstChild,r={binding:i,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(r)}}function em(e,t){const n=[];let s;if(t.size===1&&(s=t.get(0)))ea(s,e,n);else{const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,r=-1;do{const l=t.get(++r);l&&ea(l,o,n)}while(o=i.nextNode())}return n}function tm(e){const{template:t,elementsToBindings:n}=Vt(Hg,e,()=>Jg(e)),s=t.cloneNode(!0).content.firstElementChild,i=em(s,n);return function(r){return Zg(r,i),s}}function nm(e){const t=Vt(qg,e,()=>new Map);let n=Gg;function s(o,...r){const l=Vt(t,o,()=>new Map);return Vt(l,n,()=>tm(o))(r)}function i(o,r,l){return o.map((a,c)=>{const u=n;n=l(a);try{return r(a,c)}finally{n=u}})}return{map:i,html:s}}function sm(e,t,n,s,i,o,r,l,a){const{labelWithSkin:c,titleForEmoji:u,unicodeWithSkin:p}=n,{html:m,map:v}=nm(t);function w(C,P,I){return v(C,(B,de)=>m`<button role="${P?"option":"menuitem"}" aria-selected="${P?de===t.activeSearchItem:null}" aria-label="${c(B,t.currentSkinTone)}" title="${u(B)}" class="${"emoji"+(P&&de===t.activeSearchItem?" active":"")+(B.unicode?"":" custom-emoji")}" id="${`${I}-${B.id}`}" style="${B.unicode?null:`--custom-emoji-background: url(${JSON.stringify(B.url)})`}">${B.unicode?p(B,t.currentSkinTone):""}</button>`,B=>`${I}-${B.id}`)}const _=m`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(t.searchMode&&t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?`emo-${t.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${v(t.skinTones,(C,P)=>m`<div id="skintone-${P}" class="emoji ${P===t.activeSkinTone?"active":""}" aria-selected="${P===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[P]}" aria-label="${t.i18n.skinTones[P]}">${C}</div>`,C=>C)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${v(t.groups,C=>m`<button role="tab" class="nav-button" aria-controls="tab-${C.id}" aria-label="${t.i18n.categories[C.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===C.id}" title="${t.i18n.categories[C.name]}" data-group-id="${C.id}"><div class="nav-emoji emoji">${C.emoji}</div></button>`,C=>C.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${v(t.currentEmojisWithCategories,(C,P)=>m`<div><div id="menu-label-${P}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:C.category?C.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${P!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(C.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${P}" id="${t.searchMode?"search-results":null}">${w(C.emojis,t.searchMode,"emo")}</div></div>`,C=>C.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${w(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,z=(C,P)=>{for(const I of e.querySelectorAll(`[${C}]`))P(I,I.getAttribute(C))};if(a){e.appendChild(_);for(const C of["click","focusout","input","keydown","keyup"])z(`data-on-${C}`,(P,I)=>{P.addEventListener(C,s[I])});z("data-ref",(C,P)=>{o[P]=C}),r.addEventListener("abort",()=>{e.removeChild(_)})}z("data-action",(C,P)=>{let I=l.get(P);I||l.set(P,I=new WeakSet),I.has(C)||(I.add(C),i[P](C))})}const Xn=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function im(e){let t=!1,n;const s=new Map,i=new Set;let o;const r=()=>{if(t)return;const c=[...i];i.clear();try{for(const u of c)u()}finally{o=!1,i.size&&(o=!0,Xn(r))}},l=new Proxy({},{get(c,u){if(n){let p=s.get(u);p||(p=new Set,s.set(u,p)),p.add(n)}return c[u]},set(c,u,p){if(c[u]!==p){c[u]=p;const m=s.get(u);if(m){for(const v of m)i.add(v);o||(o=!0,Xn(r))}}return!0}}),a=c=>{const u=()=>{const p=n;n=u;try{return c()}finally{n=p}};return u()};return e.addEventListener("abort",()=>{t=!0}),{state:l,createEffect:a}}function Xs(e,t,n){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(!n(e[s],t[s]))return!1;return!0}const ta=new WeakMap;function om(e,t,n){{const s=e.closest(".tabpanel");let i=ta.get(s);i||(i=new IntersectionObserver(n,{root:s,rootMargin:"50% 0px 50% 0px",threshold:0}),ta.set(s,i),t.addEventListener("abort",()=>{i.disconnect()})),i.observe(e)}}const Zs=[],{assign:Cn}=Object;function rm(e,t){const n={},s=new AbortController,i=s.signal,{state:o,createEffect:r}=im(i),l=new Map;Cn(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),Cn(o,t),Cn(o,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Eg,isRtl:!1,currentGroupIndex:0,groups:qs,databaseLoaded:!1,activeSearchItemId:void 0}),r(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const a=k=>{e.getElementById(k).focus()},c=k=>e.getElementById(`emo-${k.id}`),u=(k,A)=>{n.rootElement.dispatchEvent(new CustomEvent(k,{detail:A,bubbles:!0,composed:!0}))},p=(k,A)=>k.id===A.id,m=(k,A)=>{const{category:M,emojis:L}=k,{category:K,emojis:F}=A;return M!==K?!1:Xs(L,F,p)},v=k=>{Xs(o.currentEmojis,k,p)||(o.currentEmojis=k)},w=k=>{o.searchMode!==k&&(o.searchMode=k)},x=k=>{Xs(o.currentEmojisWithCategories,k,m)||(o.currentEmojisWithCategories=k)},_=(k,A)=>A&&k.skins&&k.skins[A]||k.unicode,P={labelWithSkin:(k,A)=>Kg([k.name||_(k,A),k.annotation,...k.shortcodes||Zs].filter(Boolean)).join(", "),titleForEmoji:k=>k.annotation||(k.shortcodes||Zs).join(", "),unicodeWithSkin:_},I={onClickSkinToneButton:W,onEmojiClick:ln,onNavClick:rn,onNavKeydown:vs,onSearchKeydown:ys,onSkinToneOptionsClick:cn,onSkinToneOptionsFocusOut:Me,onSkinToneOptionsKeydown:Ue,onSkinToneOptionsKeyup:Et,onSearchInput:un},B={calculateEmojiGridStyle:hs,updateOnIntersection:fs};let de=!0;r(()=>{sm(e,o,P,I,B,n,i,l,de),de=!1}),o.emojiVersion||Vs().then(k=>{k||(o.message=o.i18n.emojiUnsupportedMessage)}),r(()=>{async function k(){let A=!1;const M=setTimeout(()=>{A=!0,o.message=o.i18n.loadingMessage},xg);try{await o.database.ready(),o.databaseLoaded=!0}catch(L){console.error(L),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(M),A&&(A=!1,o.message="")}}o.database&&k()}),r(()=>{o.pickerStyle=`
|
|
1645
|
+
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),s}function Kg(e){return nc(e,t=>t)}function jg(e){e&&(e.scrollTop=0)}function Vt(e,t,n){let s=e.get(t);return s||(s=n(),e.set(t,s)),s}function Jr(e){return""+e}function zg(e){const t=document.createElement("template");return t.innerHTML=e,t}const Hg=new WeakMap,qg=new WeakMap,Gg=Symbol("un-keyed"),Vg="replaceChildren"in Element.prototype;function Qg(e,t){Vg?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function Yg(e,t){let n=e.firstChild,s=0;for(;n;){if(t[s]!==n)return!0;n=n.nextSibling,s++}return s!==t.length}function Xg(e,t){const{targetNode:n}=t;let{targetParentNode:s}=t,i=!1;s?i=Yg(s,e):(i=!0,t.targetNode=void 0,t.targetParentNode=s=n.parentNode),i&&Qg(s,e)}function Zg(e,t){for(const n of t){const{targetNode:s,currentExpression:i,binding:{expressionIndex:o,attributeName:r,attributeValuePre:l,attributeValuePost:a}}=n,c=e[o];if(i!==c)if(n.currentExpression=c,r)if(c===null)s.removeAttribute(r);else{const u=l+Jr(c)+a;s.setAttribute(r,u)}else{let u;Array.isArray(c)?Xg(c,n):c instanceof Element?(u=c,s.replaceWith(u)):s.nodeValue=Jr(c),u&&(n.targetNode=u)}}}function Jg(e){let t="",n=!1,s=!1,i=-1;const o=new Map,r=[];let l=0;for(let c=0,u=e.length;c<u;c++){const p=e[c];if(t+=p.slice(l),c===u-1)break;for(let C=0;C<p.length;C++)switch(p.charAt(C)){case"<":{p.charAt(C+1)==="/"?r.pop():(n=!0,r.push(++i));break}case">":{n=!1,s=!1;break}case"=":{s=!0;break}}const m=r[r.length-1],v=Vt(o,m,()=>[]);let w,x,_;if(s){const C=/(\S+)="?([^"=]*)$/.exec(p);w=C[1],x=C[2];const P=/^([^">]*)("?)/.exec(e[c+1]);_=P[1],t=t.slice(0,-1*C[0].length),l=P[0].length}else l=0;const z={attributeName:w,attributeValuePre:x,attributeValuePost:_,expressionIndex:c};v.push(z),!n&&!s&&(t+=" ")}return{template:zg(t),elementsToBindings:o}}function ea(e,t,n){for(let s=0;s<e.length;s++){const i=e[s],o=i.attributeName?t:t.firstChild,r={binding:i,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(r)}}function em(e,t){const n=[];let s;if(t.size===1&&(s=t.get(0)))ea(s,e,n);else{const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,r=-1;do{const l=t.get(++r);l&&ea(l,o,n)}while(o=i.nextNode())}return n}function tm(e){const{template:t,elementsToBindings:n}=Vt(Hg,e,()=>Jg(e)),s=t.cloneNode(!0).content.firstElementChild,i=em(s,n);return function(r){return Zg(r,i),s}}function nm(e){const t=Vt(qg,e,()=>new Map);let n=Gg;function s(o,...r){const l=Vt(t,o,()=>new Map);return Vt(l,n,()=>tm(o))(r)}function i(o,r,l){return o.map((a,c)=>{const u=n;n=l(a);try{return r(a,c)}finally{n=u}})}return{map:i,html:s}}function sm(e,t,n,s,i,o,r,l,a){const{labelWithSkin:c,titleForEmoji:u,unicodeWithSkin:p}=n,{html:m,map:v}=nm(t);function w(C,P,I){return v(C,(B,ue)=>m`<button role="${P?"option":"menuitem"}" aria-selected="${P?ue===t.activeSearchItem:null}" aria-label="${c(B,t.currentSkinTone)}" title="${u(B)}" class="${"emoji"+(P&&ue===t.activeSearchItem?" active":"")+(B.unicode?"":" custom-emoji")}" id="${`${I}-${B.id}`}" style="${B.unicode?null:`--custom-emoji-background: url(${JSON.stringify(B.url)})`}">${B.unicode?p(B,t.currentSkinTone):""}</button>`,B=>`${I}-${B.id}`)}const _=m`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(t.searchMode&&t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?`emo-${t.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${v(t.skinTones,(C,P)=>m`<div id="skintone-${P}" class="emoji ${P===t.activeSkinTone?"active":""}" aria-selected="${P===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[P]}" aria-label="${t.i18n.skinTones[P]}">${C}</div>`,C=>C)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${v(t.groups,C=>m`<button role="tab" class="nav-button" aria-controls="tab-${C.id}" aria-label="${t.i18n.categories[C.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===C.id}" title="${t.i18n.categories[C.name]}" data-group-id="${C.id}"><div class="nav-emoji emoji">${C.emoji}</div></button>`,C=>C.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${v(t.currentEmojisWithCategories,(C,P)=>m`<div><div id="menu-label-${P}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:C.category?C.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${P!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(C.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${P}" id="${t.searchMode?"search-results":null}">${w(C.emojis,t.searchMode,"emo")}</div></div>`,C=>C.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${w(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,z=(C,P)=>{for(const I of e.querySelectorAll(`[${C}]`))P(I,I.getAttribute(C))};if(a){e.appendChild(_);for(const C of["click","focusout","input","keydown","keyup"])z(`data-on-${C}`,(P,I)=>{P.addEventListener(C,s[I])});z("data-ref",(C,P)=>{o[P]=C}),r.addEventListener("abort",()=>{e.removeChild(_)})}z("data-action",(C,P)=>{let I=l.get(P);I||l.set(P,I=new WeakSet),I.has(C)||(I.add(C),i[P](C))})}const Xn=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function im(e){let t=!1,n;const s=new Map,i=new Set;let o;const r=()=>{if(t)return;const c=[...i];i.clear();try{for(const u of c)u()}finally{o=!1,i.size&&(o=!0,Xn(r))}},l=new Proxy({},{get(c,u){if(n){let p=s.get(u);p||(p=new Set,s.set(u,p)),p.add(n)}return c[u]},set(c,u,p){if(c[u]!==p){c[u]=p;const m=s.get(u);if(m){for(const v of m)i.add(v);o||(o=!0,Xn(r))}}return!0}}),a=c=>{const u=()=>{const p=n;n=u;try{return c()}finally{n=p}};return u()};return e.addEventListener("abort",()=>{t=!0}),{state:l,createEffect:a}}function Xs(e,t,n){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(!n(e[s],t[s]))return!1;return!0}const ta=new WeakMap;function om(e,t,n){{const s=e.closest(".tabpanel");let i=ta.get(s);i||(i=new IntersectionObserver(n,{root:s,rootMargin:"50% 0px 50% 0px",threshold:0}),ta.set(s,i),t.addEventListener("abort",()=>{i.disconnect()})),i.observe(e)}}const Zs=[],{assign:Cn}=Object;function rm(e,t){const n={},s=new AbortController,i=s.signal,{state:o,createEffect:r}=im(i),l=new Map;Cn(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),Cn(o,t),Cn(o,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Eg,isRtl:!1,currentGroupIndex:0,groups:qs,databaseLoaded:!1,activeSearchItemId:void 0}),r(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const a=k=>{e.getElementById(k).focus()},c=k=>e.getElementById(`emo-${k.id}`),u=(k,A)=>{n.rootElement.dispatchEvent(new CustomEvent(k,{detail:A,bubbles:!0,composed:!0}))},p=(k,A)=>k.id===A.id,m=(k,A)=>{const{category:M,emojis:L}=k,{category:K,emojis:F}=A;return M!==K?!1:Xs(L,F,p)},v=k=>{Xs(o.currentEmojis,k,p)||(o.currentEmojis=k)},w=k=>{o.searchMode!==k&&(o.searchMode=k)},x=k=>{Xs(o.currentEmojisWithCategories,k,m)||(o.currentEmojisWithCategories=k)},_=(k,A)=>A&&k.skins&&k.skins[A]||k.unicode,P={labelWithSkin:(k,A)=>Kg([k.name||_(k,A),k.annotation,...k.shortcodes||Zs].filter(Boolean)).join(", "),titleForEmoji:k=>k.annotation||(k.shortcodes||Zs).join(", "),unicodeWithSkin:_},I={onClickSkinToneButton:W,onEmojiClick:ln,onNavClick:rn,onNavKeydown:vs,onSearchKeydown:ys,onSkinToneOptionsClick:cn,onSkinToneOptionsFocusOut:Me,onSkinToneOptionsKeydown:Ue,onSkinToneOptionsKeyup:Et,onSearchInput:un},B={calculateEmojiGridStyle:hs,updateOnIntersection:fs};let ue=!0;r(()=>{sm(e,o,P,I,B,n,i,l,ue),ue=!1}),o.emojiVersion||Vs().then(k=>{k||(o.message=o.i18n.emojiUnsupportedMessage)}),r(()=>{async function k(){let A=!1;const M=setTimeout(()=>{A=!0,o.message=o.i18n.loadingMessage},xg);try{await o.database.ready(),o.databaseLoaded=!0}catch(L){console.error(L),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(M),A&&(A=!1,o.message="")}}o.database&&k()}),r(()=>{o.pickerStyle=`
|
|
1660
1646
|
--num-groups: ${o.groups.length};
|
|
1661
1647
|
--indicator-opacity: ${o.searchMode?0:1};
|
|
1662
1648
|
--num-skintones: ${Qr};`}),r(()=>{o.customEmoji&&o.database&&it()}),r(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==Ei&&(o.groups=Ei):o.groups!==qs&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=qs)}),r(()=>{async function k(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}k()}),r(()=>{o.skinTones=Array(Qr).fill().map((k,A)=>Dg(o.skinToneEmoji,A))}),r(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),r(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),r(()=>{async function k(){const{database:A}=o,M=(await Promise.all(Tg.map(L=>A.getEmojiByUnicodeOrName(L)))).filter(Boolean);o.defaultFavoriteEmojis=M}o.databaseLoaded&&k()});function it(){const{customEmoji:k,database:A}=o,M=k||Zs;A.customEmoji!==M&&(A.customEmoji=M)}r(()=>{async function k(){it();const{database:A,defaultFavoriteEmojis:M,numColumns:L}=o,K=await A.getTopFavoriteEmoji(L),F=await Fe(nc([...K,...M],te=>te.unicode||te.name).slice(0,L));o.currentFavorites=F}o.databaseLoaded&&o.defaultFavoriteEmojis&&k()});function hs(k){Ug(k,i,()=>{{const A=getComputedStyle(n.rootElement),M=parseInt(A.getPropertyValue("--num-columns"),10),L=A.getPropertyValue("direction")==="rtl";o.numColumns=M,o.isRtl=L}})}function fs(k){om(k,i,A=>{for(const{target:M,isIntersecting:L}of A)M.classList.toggle("onscreen",L)})}r(()=>{async function k(){const{searchText:A,currentGroup:M,databaseLoaded:L,customEmoji:K}=o;if(!L)o.currentEmojis=[],o.searchMode=!1;else if(A.length>=Sg){const F=await ms(A);o.searchText===A&&(v(F),w(!0))}else{const{id:F}=M;if(F!==-1||K&&K.length){const te=await gs(F);o.currentGroup.id===F&&(v(te),w(!1))}}}k()});const on=()=>{Nn(()=>jg(n.tabpanelElement))};r(()=>{const{currentEmojis:k,emojiVersion:A}=o,M=k.filter(L=>L.unicode).filter(L=>Yr(L)&&!Ti.has(L.unicode));if(!A&&M.length)v(k),Nn(()=>Y(M));else{const L=A?k:k.filter($t);v(L),on()}});function Y(k){Wg(k,n.baselineEmoji,c)?on():o.currentEmojis=[...o.currentEmojis]}function $t(k){return!k.unicode||!Yr(k)||Ti.get(k.unicode)}async function ot(k){const A=o.emojiVersion||await Vs();return k.filter(({version:M})=>!M||M<=A)}async function Fe(k){return Bg(k,o.emojiVersion||await Vs())}async function gs(k){const A=k===-1?o.customEmoji:await o.database.getEmojiByGroup(k);return Fe(await ot(A))}async function ms(k){return Fe(await ot(await o.database.getEmojiBySearchQuery(k)))}r(()=>{}),r(()=>{function k(){const{searchMode:M,currentEmojis:L}=o;if(M)return[{category:"",emojis:L}];const K=new Map;for(const F of L){const te=F.category||"";let Le=K.get(te);Le||(Le=[],K.set(te,Le)),Le.push(F)}return[...K.entries()].map(([F,te])=>({category:F,emojis:te})).sort((F,te)=>o.customCategorySorting(F.category,te.category))}const A=k();x(A)}),r(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),r(()=>{const{rawSearchText:k}=o;ec(()=>{o.searchText=(k||"").trim(),o.activeSearchItem=-1})});function ys(k){if(!o.searchMode||!o.currentEmojis.length)return;const A=M=>{ve(k),o.activeSearchItem=Qs(M,o.activeSearchItem,o.currentEmojis)};switch(k.key){case"ArrowDown":return A(!1);case"ArrowUp":return A(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return ve(k),H(o.currentEmojis[o.activeSearchItem].id)}}function rn(k){const{target:A}=k,M=A.closest(".nav-button");if(!M)return;const L=parseInt(M.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(K=>K.id===L)}function vs(k){const{target:A,key:M}=k,L=K=>{K&&(ve(k),K.focus())};switch(M){case"ArrowLeft":return L(A.previousElementSibling);case"ArrowRight":return L(A.nextElementSibling);case"Home":return L(A.parentElement.firstElementChild);case"End":return L(A.parentElement.lastElementChild)}}async function an(k){const A=await o.database.getEmojiByUnicodeOrName(k),M=[...o.currentEmojis,...o.currentFavorites].find(K=>K.id===k),L=M.unicode&&_(M,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(k),{emoji:A,skinTone:o.currentSkinTone,...L&&{unicode:L},...M.name&&{name:M.name}}}async function H(k){const A=an(k);u("emoji-click-sync",A),u("emoji-click",await A)}function ln(k){const{target:A}=k;if(!A.classList.contains("emoji"))return;ve(k);const M=A.id.substring(4);H(M)}function q(k){o.currentSkinTone=k,o.skinTonePickerExpanded=!1,a("skintone-button"),u("skin-tone-change",{skinTone:k}),o.database.setPreferredSkinTone(k)}function cn(k){const{target:{id:A}}=k,M=A&&A.match(/^skintone-(\d)/);if(!M)return;ve(k);const L=parseInt(M[1],10);q(L)}function W(k){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&(ve(k),Nn(()=>a("skintone-list")))}r(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function Ue(k){if(!o.skinTonePickerExpanded)return;const A=async M=>{ve(k),o.activeSkinTone=M};switch(k.key){case"ArrowUp":return A(Qs(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return A(Qs(!1,o.activeSkinTone,o.skinTones));case"Home":return A(0);case"End":return A(o.skinTones.length-1);case"Enter":return ve(k),q(o.activeSkinTone);case"Escape":return ve(k),o.skinTonePickerExpanded=!1,a("skintone-button")}}function Et(k){if(o.skinTonePickerExpanded&&k.key===" ")return ve(k),q(o.activeSkinTone)}async function Me(k){const{relatedTarget:A}=k;(!A||A.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function un(k){o.rawSearchText=k.target.value}return{$set(k){Cn(o,k)},$destroy(){s.abort()}}}const am="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",lm="en";var cm={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading…",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}},um=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const sc=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],dm=`:host{--emoji-font-family:${tc}}`;class So extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=um+dm,this.shadowRoot.appendChild(n),this._ctx={locale:lm,dataSource:am,skinToneEmoji:$g,customCategorySorting:Cg,customEmoji:null,i18n:cm,emojiVersion:null,...t};for(const s of sc)s!=="database"&&Object.prototype.hasOwnProperty.call(this,s)&&(this._ctx[s]=this[s],delete this[s]);this._dbFlush()}connectedCallback(){na(this),this._cmp||(this._cmp=rm(this.shadowRoot,this._ctx))}disconnectedCallback(){na(this),Xn(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,s){this._set(t.replace(/-([a-z])/g,(i,o)=>o.toUpperCase()),t==="emoji-version"?parseFloat(s):s)}_set(t,n){this._ctx[t]=n,this._cmp&&this._cmp.$set({[t]:n}),["locale","dataSource"].includes(t)&&this._dbFlush()}_dbCreate(){const{locale:t,dataSource:n,database:s}=this._ctx;(!s||s.locale!==t||s.dataSource!==n)&&this._set("database",new kg({locale:t,dataSource:n}))}_dbFlush(){Xn(()=>this._dbCreate())}}const ic={};for(const e of sc)ic[e]={get(){return e==="database"&&this._dbCreate(),this._ctx[e]},set(t){if(e==="database")throw new Error("database is read-only");this._set(e,t)}};Object.defineProperties(So.prototype,ic);function na(e){e instanceof So||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",So);function pm(e){e.style.height="0";const t=Math.max(e.scrollHeight,44);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>e.offsetHeight?"auto":"hidden"}function sa(e){e.style.height="44px",e.style.overflowY="hidden"}const hm=5e3;function fm(e){return e?e.active?d`
|
|
@@ -2711,4 +2697,4 @@ ${r.text}`:l.join(", "):r.text;t.push({kind:"message",key:`queue:${r.id}`,messag
|
|
|
2711
2697
|
`}const Ao="taskmaster-access-session",cc={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function uc(){try{return localStorage.getItem(Ao)}catch{return null}}function dc(e){try{localStorage.setItem(Ao,e)}catch{}}function dy(){try{localStorage.removeItem(Ao)}catch{}}async function da(e){if(e.client)try{const t=uc(),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 py(e,t,n){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const s=await e.client.request("access.verify",{account:t,pin:n});s.ok&&s.token?(dc(s.token),e.accessState={...e.accessState,authenticated:!0,workspace:s.workspace??null,master:s.master??!1,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:s.message??"Incorrect PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to verify PIN"}}}}async function hy(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?(dc(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 fy(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 gy(e){const t=uc();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}dy(),e.accessState={...cc,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}async function _i(e){return(await e.request("apikeys.list")).providers??[]}async function pa(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function my(e,t){await e.request("apikeys.remove",{provider:t})}class yy{constructor(){this.canvas=null,this.ctx=null,this.img=new Image,this.pendingFrame=null,this.rafId=null,this.deviceWidth=1280,this.deviceHeight=720,this.lastMouseMoveAt=0,this.MOUSE_THROTTLE_MS=30}attach(t){this.canvas=t,this.ctx=t.getContext("2d")}detach(){this.rafId!=null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas=null,this.ctx=null,this.pendingFrame=null}updateFrame(t,n){n?.deviceWidth&&(this.deviceWidth=n.deviceWidth),n?.deviceHeight&&(this.deviceHeight=n.deviceHeight),this.pendingFrame=t,this.rafId==null&&(this.rafId=requestAnimationFrame(()=>this.renderFrame()))}renderFrame(){this.rafId=null;const t=this.pendingFrame;!t||!this.canvas||!this.ctx||(this.pendingFrame=null,this.img.onload=()=>{!this.canvas||!this.ctx||((this.canvas.width!==this.img.width||this.canvas.height!==this.img.height)&&(this.canvas.width=this.img.width,this.canvas.height=this.img.height),this.ctx.drawImage(this.img,0,0))},this.img.src=`data:image/jpeg;base64,${t}`)}translateCoordinates(t,n){if(!this.canvas)return{x:t,y:n};const s=this.canvas.getBoundingClientRect(),i=this.canvas.width/s.width,o=this.canvas.height/s.height,r=this.deviceWidth/this.canvas.width,l=this.deviceHeight/this.canvas.height;return{x:Math.round(t*i*r),y:Math.round(n*o*l)}}shouldThrottleMouseMove(){const t=performance.now();return t-this.lastMouseMoveAt<this.MOUSE_THROTTLE_MS?!0:(this.lastMouseMoveAt=t,!1)}getDeviceDimensions(){return{width:this.deviceWidth,height:this.deviceHeight}}}let Js=null;function On(){return Js||(Js=new yy),Js}function xo(e){return e instanceof Error?e.message:String(e)}async function vy(e){if(!(!e.client||!e.connected)){e.browserLoading=!0,e.browserError=null;try{(await e.client.request("browser.screencast.start",{quality:60,maxWidth:1280,maxHeight:720}))?.ok&&(e.browserScreencastActive=!0)}catch(t){e.browserError=xo(t)}finally{e.browserLoading=!1}}}async function by(e){if(!(!e.client||!e.connected)){e.browserLoading=!0;try{await e.client.request("browser.screencast.stop",{}),e.browserScreencastActive=!1,e.browserScreencastFrame=null,e.browserScreencastMetadata=null}catch(t){e.browserError=xo(t)}finally{e.browserLoading=!1}}}async function ei(e,t,n,s,i){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"mouse",action:t,x:n,y:s,button:i??"left",clickCount:t==="mousePressed"?1:0})}catch{}}async function ti(e,t,n,s){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"key",action:t,key:n,...s?.text?{text:s.text}:{},...s?.code?{code:s.code}:{},...s?.modifiers?{modifiers:s.modifiers}:{}})}catch{}}async function wy(e){if(!(!e.client||!e.connected))try{await e.client.request("browser.handoff.complete",{}),e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}catch(t){e.browserError=xo(t)}}function ky(e){e.browserInputMode=!e.browserInputMode}function Sy(e,t){if(!t?.data)return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,On().updateFrame(t.data,t.metadata)}function Ay(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function xy(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}function st(e){return e instanceof Error?e.message:String(e)}let _n=null;function ds(e,t){_n&&clearTimeout(_n),e.filesMessage={kind:"success",text:t},_n=setTimeout(()=>{e.filesMessage=null,_n=null},3e3)}async function nn(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 s=await e.client.request("files.tree",n);s?.tree&&(e.filesTree=s.tree,e.filesRoot=s.root??"")}catch(n){e.filesError=st(n)}finally{e.filesLoading=!1}}}}async function $y(e,t,n){e.filesSelectedPaths=new Set([t]),await pc(e,t,n)}async function Ey(e,t,n){const s=new Set(e.filesSelectedPaths);if(s.has(t)?s.delete(t):s.add(t),e.filesSelectedPaths=s,s.size===1){const i=[...s][0];await pc(e,i,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Ty(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let s=0,i="";for(const o of n)try{await hc(e,o,t),s++}catch(r){i=st(r)}i?e.filesMessage={kind:"error",text:`${s} downloaded, error: ${i}`}:ds(e,`${s} file${s!==1?"s":""} downloaded`)}async function Cy(e,t,n,s){const i=t.split("/").pop()??t,o=n==="."?i:`${n}/${i}`;o!==t&&await fc(e,t,o,s)}async function pc(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 s={path:t};n&&(s.agentId=n);const i=await e.client.request("files.read",s);e.filesPreviewContent=i?.content??null,e.filesPreviewBinary=i?.binary??!1,e.filesPreviewSize=i?.size??null}catch(s){e.filesError=st(s)}finally{e.filesPreviewLoading=!1}}}async function hc(e,t,n){if(!(!e.client||!e.connected))try{const s={path:t};n&&(s.agentId=n);const i=await e.client.request("files.download",s);if(!i?.base64){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const o=Uint8Array.from(atob(i.base64),c=>c.charCodeAt(0)),r=new Blob([o]),l=URL.createObjectURL(r),a=document.createElement("a");a.href=l,a.download=i.name??t.split("/").pop()??"download",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(l)}catch(s){e.filesMessage={kind:"error",text:st(s)}}}async function _y(e,t,n,s){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let i=0,o="";for(const r of n)try{const l=await r.arrayBuffer(),a=btoa(new Uint8Array(l).reduce((u,p)=>u+String.fromCharCode(p),"")),c={path:t,name:r.name,data:a};s&&(c.agentId=s),await e.client.request("files.upload",c),i++}catch(l){o=st(l)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:i>0?`${i} uploaded, error: ${o}`:o}:ds(e,`${i} file${i!==1?"s":""} uploaded`),await nn(e,s)}async function My(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={path:t};n&&(s.agentId=n),await e.client.request("files.delete",s),ds(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await nn(e,n)}catch(s){e.filesMessage={kind:"error",text:st(s)}}}}async function fc(e,t,n,s){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={from:t,to:n};s&&(i.agentId=s),await e.client.request("files.move",i),ds(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await nn(e,s)}catch(i){e.filesMessage={kind:"error",text:st(i)}}}}function Ly(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n}function Py(e,t="admin"){if(!e)return[];const n=e.bindings;if(!Array.isArray(n))return[];const s=[];for(const i of n){if(!i||typeof i!="object"||i.agentId!==t)continue;const o=i.match;if(!o||typeof o!="object"||(o.channel??"").toLowerCase()!=="whatsapp")continue;const l=o.peer;if(!l||typeof l!="object"||l.kind!=="dm")continue;const a=l.id??"";a&&s.push({phone:a,paired:i.meta?.paired===!0})}return s.sort((i,o)=>i.paired&&!o.paired?-1:!i.paired&&o.paired?1:0),s}function gc(e,t,n="admin",s){const i=new Map,o=new Map;for(const a of e){if(!a||typeof a!="object"||a.agentId!==n)continue;const c=a.match;if(!c||typeof c!="object"||(c.channel??"").toLowerCase()!=="whatsapp")continue;const p=c.peer;if(!p||typeof p!="object"||p.kind!=="dm")continue;const m=p.id??"";m&&(a.meta&&i.set(m,a.meta),c.accountId&&o.set(m,c.accountId))}const r=e.filter(a=>{if(!a||typeof a!="object"||a.agentId!==n)return!0;const c=a.match;if(!c||typeof c!="object"||(c.channel??"").toLowerCase()!=="whatsapp")return!0;const p=c.peer;return!p||typeof p!="object"?!0:p.kind!=="dm"}),l=t.map(a=>{const c=s??o.get(a.phone),u={channel:"whatsapp",peer:{kind:"dm",id:a.phone}};c&&(u.accountId=c);const p={agentId:n,match:u},m=i.get(a.phone);return m?p.meta=m:a.paired&&(p.meta={paired:!0}),p});return[...r,...l]}async function ps(e,t){if(!e.client||!e.connected)return;if(!t){e.adminPhones=[];return}if(e.adminsLoading)return;e.adminsLoading=!0,e.adminsError=null;const n=t;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const i=s.config;e.configForm=Oe(i??{}),e.adminPhones=Py(i,n),e.configFormDirty=!1}catch(s){e.adminsError=String(s)}finally{e.adminsLoading=!1}}async function mc(e,t,n,s){if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const i=n;let o=t.trim();if(!o){e.adminsError="Phone number is required";return}if(o.startsWith("+")||(o="+"+o),!/^\+[1-9]\d{6,14}$/.test(o)){e.adminsError="Invalid phone number format. Use E.164 format (e.g., +14155552671)";return}if(e.adminPhones.some(r=>r.phone===o)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const r=Oe(e.configForm??e.configSnapshot?.config??{}),l=r.bindings??[],a=[...e.adminPhones,{phone:o}],c=gc(l,a,i,s);Oa(r,["bindings"],c);const u=e.configSnapshot?.hash;if(!u){e.adminsError="Config hash missing; reload and retry.";return}const p=Ve(r);await e.client.request("config.set",{raw:p,baseHash:u}),await ps(e,n)}catch(r){e.adminsError=String(r)}finally{e.adminsSaving=!1}}async function yc(e,t,n,s){if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const i=n;if(e.adminPhones.find(r=>r.phone===t)?.paired){e.adminsError="Cannot remove the paired phone. Unlink WhatsApp first.";return}e.adminsSaving=!0,e.adminsError=null;try{const r=Oe(e.configForm??e.configSnapshot?.config??{}),l=r.bindings??[],a=e.adminPhones.filter(m=>m.phone!==t),c=gc(l,a,i,s);Oa(r,["bindings"],c);const u=e.configSnapshot?.hash;if(!u){e.adminsError="Config hash missing; reload and retry.";return}const p=Ve(r);await e.client.request("config.set",{raw:p,baseHash:u}),await ps(e,n)}catch(r){e.adminsError=String(r)}finally{e.adminsSaving=!1}}const Ry=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:mc,loadAdmins:ps,removeAdmin:yc},Symbol.toStringTag,{value:"Module"}));async function Je(e,t){if(!(!e.client||!e.connected)){if(!t){e.customersRecords=[];return}if(!e.customersLoading){e.customersLoading=!0,e.customersError=null;try{const n=e.customersSearchQuery.trim(),s=n?await e.client.request("records.search",{query:n,workspace:t}):await e.client.request("records.list",{workspace:t});e.customersRecords=s.records??[]}catch(n){e.customersError=String(n)}finally{e.customersLoading=!1}}}}async function vc(e,t,n,s){if(!e.client||!e.connected||e.customersSaving)return;let i=t.trim();const o=n.trim();if(!i){e.customersError="Phone number is required";return}if(!o){e.customersError="Name is required";return}if(i.startsWith("+")||(i="+"+i),!/^\+[1-9]\d{6,14}$/.test(i)){e.customersError="Invalid phone number format. Use E.164 (e.g. +447490553305)";return}e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.set",{id:i,name:o,fields:{},workspace:s}),e.customersShowAddForm=!1,e.customersNewPhone="",e.customersNewName="",await Je(e,s)}catch(r){e.customersError=String(r)}finally{e.customersSaving=!1}}async function bc(e,t,n){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.delete",{id:t}),e.customersEditingId===t&&(e.customersEditingId=null),await Je(e,n)}catch(s){e.customersError=String(s)}finally{e.customersSaving=!1}}}async function wc(e,t,n,s,i){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.setField",{id:t,key:n,value:s}),await Je(e,i)}catch(o){e.customersError=String(o)}finally{e.customersSaving=!1}}}async function kc(e,t,n,s){if(!(!e.client||!e.connected)&&!e.customersSaving){e.customersSaving=!0,e.customersError=null;try{await e.client.request("records.deleteField",{id:t,key:n}),await Je(e,s)}catch(i){e.customersError=String(i)}finally{e.customersSaving=!1}}}const Iy=Object.freeze(Object.defineProperty({__proto__:null,addCustomer:vc,deleteCustomer:bc,deleteCustomerField:kc,loadCustomers:Je,setCustomerField:wc},Symbol.toStringTag,{value:"Module"}));function Ft(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout()}}function Ny(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),onAddAccount:()=>{e.addingWorkspace=!0},hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout()}}function Oy(e){const t=J(e);return t?t.agents.find(s=>s.id.endsWith("-admin")||s.id==="admin")?.id:void 0}function Dy(e){return J(e)?.whatsappAccountId??void 0}function By(e){const t=J(e);if(t)return t.agents[0]?.id}function Fy(e){return e.selectedWorkspace??void 0}function J(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const Uy=/^data:/i,Wy=/^https?:\/\//i;function Ky(e){const t=e.agentsList?.agents??[],s=xa(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",o=t.find(l=>l.id===s)?.identity,r=o?.avatarUrl??o?.avatar;if(r)return Uy.test(r)||Wy.test(r)?r:o?.avatarUrl}function jy(e){if(!e)return null;const t=e.channelAccounts?.whatsapp;if(!t||t.length===0)return null;const n=t[0];return{running:n.running??!1,connected:n.connected??!1,linked:n.linked??!1,lastError:n.lastError}}function zy(e){if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=e.channelAccounts?.imessage;if(!t||t.length===0)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const n=t[0],s=n.running??!1,i=n.probe,o=i!=null?i.ok===!0:s;return{configured:n.configured??!1,running:s,connected:o,lastError:n.lastError??null,selfChatMode:n.mode==="self-chat"||!!n.selfChatMode,dmPolicy:n.dmPolicy??null,cliPath:n.cliPath??null}}function Hy(e){const t=e.configSnapshot?.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const s=n.find(r=>r.match?.channel==="imessage"&&r.meta?.imessageOwner);if(!s)return null;const i=s.agentId;for(const r of e.workspaces)if(r.agents.some(l=>l.id===i))return r.name;if(i==="admin"||i==="public")return e.workspaces.find(l=>l.isDefault)?.name??null;const o=i.replace(/-(admin|public)$/,"");return o!==i?e.workspaces.find(l=>l.name===o)?.name??null:null}function qy(e){if(e.connected&&e.accessState.checked){const{accessState:t}=e;if(t.hasPins&&!t.authenticated)return ua({show:!0,isFirstTime:!1,accounts:t.accounts,error:t.error,busy:t.busy,onSubmit:(n,s)=>{s!=null&&e.handlePinSubmit(n,s)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(n,s,i)=>e.handleChangePin(n,s,i)});if(!t.hasMasterPin&&!t.authenticated&&e.setup)return ua({show:!0,isFirstTime:!0,accounts:[],error:t.error,busy:t.busy,onSubmit:n=>e.handleSetMasterPin(n)});if(!t.hasMasterPin&&!t.authenticated&&!e.setup)return window.location.href="/setup",b}if(e.setup){const t=jy(e.channelsSnapshot),n=e.channelsSnapshot?.channelAccounts?.whatsapp??[],s=zy(e.channelsSnapshot),i=Hy(e);return Gp({connected:e.connected,assistantName:e.assistantName,currentStep:e.setupStep,licenseKey:e.licenseKey,licenseBusy:e.licenseBusy,licenseValid:e.licenseValid,licenseMessage:e.licenseMessage,licenseTier:e.licenseTier,licenseDeviceId:e.licenseDeviceId,licenseStoredKey:e.licenseStoredKey,onLicenseKeyChange:o=>e.handleLicenseKeyChange(o),onLicenseActivate:()=>e.handleLicenseActivate(),onLicenseRemove:async()=>{await e.handleLicenseRemove(),e.licenseRemoveConfirm=!1},licenseRemoveConfirm:e.licenseRemoveConfirm,onLicenseRemoveConfirm:()=>{e.licenseRemoveConfirm=!0},onLicenseRemoveCancel:()=>{e.licenseRemoveConfirm=!1},authConnected:e.authConnected,authBusy:e.authBusy,authMessage:e.authMessage,authUrl:e.authUrl,authCodeInput:e.authCodeInput,authExpiresIn:e.authExpiresIn,whatsappBusy:e.whatsappBusy,whatsappLoginMessage:e.whatsappLoginMessage,whatsappLoginQrDataUrl:e.whatsappLoginQrDataUrl,whatsappLoginConnected:e.whatsappLoginConnected,whatsappChannelStatus:t,whatsappAccounts:n,whatsappActiveQrAccountId:e.whatsappActiveQrAccountId,whatsappAccountSaving:e.whatsappAccountSaving,gatewayHealthy:e.gatewayHealthy,gatewayHealthLoading:e.gatewayHealthLoading,gatewayHealthMessage:e.gatewayHealthMessage,gatewayRestartBusy:e.gatewayRestartBusy,updateAvailable:e.updateAvailable,currentVersion:e.currentVersion,latestVersion:e.latestVersion,updateChecking:e.updateChecking,updateRunning:e.updateRunning,updateMessage:e.updateMessage,onUpdateCheck:()=>e.handleUpdateCheck(),onUpdateRun:()=>e.handleUpdateRun(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:o=>e.handleAuthSubmitCode(o),onAuthCodeChange:o=>e.handleAuthCodeChange(o),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async o=>{await e.handleWhatsAppStart(!0,o),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(o),await j(e,!0),e.requestUpdate())},onWhatsAppReset:async o=>{await e.handleWhatsAppLogout(o),await e.handleWhatsAppStart(!0,o),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(o),await j(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await j(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),j(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:o=>e.handleRemoveWhatsAppAccount(o),workspaces:e.workspaces,workspacesLoading:e.workspacesLoading,workspacesError:e.workspacesError,addingWorkspace:e.addingWorkspace,newWorkspaceName:e.newWorkspaceName,newWorkspacePath:e.newWorkspacePath,workspaceSaving:e.workspaceSaving,workspaceRemoveConfirm:e.workspaceRemoveConfirm,newWorkspacePin:e.newWorkspacePin,onSetNewWorkspacePin:o=>{e.newWorkspacePin=o},onWorkspaceCreate:async(o,r)=>{const l=e.newWorkspacePin;await e.handleWorkspaceCreate(o,r),l.match(/^\d{4,6}$/)&&(await fy(e,o,l),e.newWorkspacePin="")},onWorkspaceRemove:o=>e.handleWorkspaceRemove(o),onSetAddingWorkspace:o=>{e.addingWorkspace=o},onSetNewWorkspaceName:o=>{e.newWorkspaceName=o},onSetNewWorkspacePath:o=>{e.newWorkspacePath=o},onSetWorkspaceRemoveConfirm:o=>{e.workspaceRemoveConfirm=o},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(o,r)=>e.handleWorkspaceRename(o,r),whatsappDmPolicy:(()=>{const r=J(e)?.whatsappAccountId;return(r?n.find(a=>a.accountId===r):n[0])?.dmPolicy??null})(),onWhatsAppDmToggle:async()=>{const r=J(e)?.whatsappAccountId,l=r?n.find(p=>p.accountId===r):n[0];if(!l)return;const c=l.dmPolicy!=null&&l.dmPolicy!=="disabled"?"disabled":"open",u=c==="open"?{dmPolicy:c,allowFrom:["*"]}:{dmPolicy:c};try{const p=await e.client.request("config.get"),x=(p.config?.channels?.whatsapp?.accounts??{})[l.accountId]?{channels:{whatsapp:{accounts:{[l.accountId]:u}}}}:{channels:{whatsapp:u}};await e.client.request("config.patch",{raw:JSON.stringify(x),baseHash:p.hash,note:`WhatsApp DM policy → ${c}`,skipRestart:!0}),await j(e,!1)}catch(p){console.error("DM toggle failed:",p)}},whatsappModel:(()=>{const o=J(e);if(!o)return null;const r=o.agents.find(p=>p.id.endsWith("-public")||p.id==="public");if(!r)return null;const a=e.configSnapshot?.config?.agents?.list;if(!Array.isArray(a))return null;const c=a.find(p=>p.id===r.id);return c?.model&&(typeof c.model=="string"?c.model:c.model.primary)?.trim()||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async o=>{const r=J(e);if(!r)return;const l=r.agents.find(a=>a.id.endsWith("-public")||a.id==="public");if(l)try{const a=await e.client.request("config.get"),u=a.config?.agents??{},p=Array.isArray(u.list)?[...u.list]:[],m=p.findIndex(w=>w.id===l.id);if(o)m>=0?p[m]={...p[m],model:o}:p.push({id:l.id,model:o});else if(m>=0){const{model:w,...x}=p[m];Object.keys(x).length<=1?p.splice(m,1):p[m]=x}const v=p.length>0?{agents:{list:p}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(v),baseHash:a.hash,note:`Public agent model → ${o||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(a){console.error("Model change failed:",a)}},whatsappThinkingLevel:(()=>{const o=J(e);if(!o)return null;const r=o.agents.find(u=>u.id.endsWith("-public")||u.id==="public");if(!r)return null;const a=e.configSnapshot?.config?.agents?.list;return Array.isArray(a)&&a.find(u=>u.id===r.id)?.thinkingLevel?.trim()||null})(),onWhatsAppThinkingChange:async o=>{const r=J(e);if(!r)return;const l=r.agents.find(a=>a.id.endsWith("-public")||a.id==="public");if(l)try{const a=await e.client.request("config.get"),u=a.config?.agents??{},p=Array.isArray(u.list)?[...u.list]:[],m=p.findIndex(x=>x.id===l.id),v=o==="off"?void 0:o;if(v)m>=0?p[m]={...p[m],thinkingLevel:v}:p.push({id:l.id,thinkingLevel:v});else if(m>=0){const{thinkingLevel:x,..._}=p[m];Object.keys(_).length<=1?p.splice(m,1):p[m]=_}const w=p.length>0?{agents:{list:p}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(w),baseHash:a.hash,note:`Public agent thinking → ${v||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(a){console.error("Thinking change failed:",a)}},whatsappGroupPolicy:(()=>{const r=e.configSnapshot?.config?.channels?.whatsapp,a=J(e)?.whatsappAccountId,c=r?.accounts??{};return(a?c[a]:void 0)?.groupPolicy??r?.groupPolicy??"allowlist"})(),whatsappGroupRequireMention:(()=>{const r=e.configSnapshot?.config?.channels?.whatsapp,a=J(e)?.whatsappAccountId,c=r?.accounts??{};return((a?c[a]:void 0)?.groups??r?.groups??{})["*"]?.requireMention!==!1})(),onWhatsAppGroupToggle:async()=>{const r=J(e)?.whatsappAccountId;try{const l=await e.client.request("config.get"),c=l.config?.channels?.whatsapp??{},u=c.accounts??{},p=r?u[r]:void 0,m=p?.groupPolicy??c.groupPolicy??"allowlist",v=m==="disabled"||m==="allowlist",w=v?"open":"disabled",x=v?{"*":{}}:void 0,_={groupPolicy:w};x&&(_.groups=x);const z=p?{channels:{whatsapp:{accounts:{[r]:_}}}}:{channels:{whatsapp:_}};await e.client.request("config.patch",{raw:JSON.stringify(z),baseHash:l.hash,note:`WhatsApp groups → ${w}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(l){console.error("Group toggle failed:",l)}},onWhatsAppGroupMentionChange:async o=>{const l=J(e)?.whatsappAccountId;try{const a=await e.client.request("config.get"),p=(a.config?.channels?.whatsapp??{}).accounts??{},m=l?p[l]:void 0,v={"*":{requireMention:o}},w=m?{channels:{whatsapp:{accounts:{[l]:{groups:v}}}}}:{channels:{whatsapp:{groups:v}}};await e.client.request("config.patch",{raw:JSON.stringify(w),baseHash:a.hash,note:`WhatsApp group mention → ${o?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(a){console.error("Group mention change failed:",a)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:s.configured,imessageRunning:s.running,imessageConnected:s.connected,imessageLastError:s.lastError,imessageSelfChatMode:s.selfChatMode,imessageCliPath:s.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:i,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const o=await e.client.request("config.get"),l=o.config?.bindings??[],a=J(e),u=a?.agents.find(w=>w.id.endsWith("-admin")||w.id==="admin")?.id??"admin",p=l.filter(w=>w.match?.channel!=="imessage"),m=[{agentId:u,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],v=[...p,...m];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:v}),baseHash:o.hash,note:"Enable iMessage (self-chat) for "+(a?.name??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([j(e,!0),we(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await j(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const o=await e.client.request("config.get"),a=(o.config?.bindings??[]).filter(c=>c.match?.channel!=="imessage");await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:a}),baseHash:o.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([j(e,!0),we(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const o=await e.client.request("config.get"),l=o.config?.bindings??[],a=J(e),u=a?.agents.find(v=>v.id.endsWith("-admin")||v.id==="admin")?.id??"admin",p=l.filter(v=>v.match?.channel!=="imessage"),m=[{agentId:u,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:[...p,...m]}),baseHash:o.hash,note:"Reassign iMessage to "+(a?.name??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([j(e,!0),we(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:o=>{e.infoModalOpen=o},onInfoModalClose:()=>{e.infoModalOpen=null},isMaster:e.accessState.master,apiKeyProviders:e.apiKeyProviders,apiKeyModalOpen:e.apiKeyModalOpen,apiKeyBusy:e.apiKeyBusy,apiKeyError:e.apiKeyError,apiKeySuccess:e.apiKeySuccess,onApiKeyModalOpen:()=>{e.apiKeyModalOpen=!0,e.apiKeyError=null,e.apiKeySuccess=null},onApiKeyModalClose:()=>{e.apiKeyModalOpen=!1,e.apiKeyError=null,e.apiKeySuccess=null},onApiKeySave:async(o,r)=>{e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await pa(e.client,o,r),e.apiKeySuccess=`${o} key saved`;try{e.apiKeyProviders=await _i(e.client)}catch{}o==="anthropic"&&await e.handleAuthStatusCheck()}catch(l){e.apiKeyError=l instanceof Error?l.message:"Failed to save key"}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async o=>{e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await my(e.client,o),e.apiKeySuccess=`${o} key removed`;try{e.apiKeyProviders=await _i(e.client)}catch{}}catch(r){e.apiKeyError=r instanceof Error?r.message:"Failed to remove key"}finally{e.apiKeyBusy=!1}},authApiKeyMode:e.authApiKeyMode,authApiKeyInput:e.authApiKeyInput,authApiKeyBusy:e.authApiKeyBusy,authApiKeyError:e.authApiKeyError,onAuthApiKeyToggle:()=>{e.authApiKeyMode=!e.authApiKeyMode,e.authApiKeyError=null},onAuthApiKeyChange:o=>{e.authApiKeyInput=o},onAuthApiKeySubmit:async()=>{const o=e.authApiKeyInput.trim();if(o){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await pa(e.client,"anthropic",o),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(r){e.authApiKeyError=r instanceof Error?r.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{const o=e.selectedWorkspace??e.workspaces[0]?.name;return o?e.accessState.accounts.some(r=>r.id===o):!1})(),accountPinModalOpen:e.accountPinModalOpen,accountPinBusy:e.accountPinBusy,accountPinError:e.accountPinError,accountPinSuccess:e.accountPinSuccess,onAccountPinModalOpen:()=>{e.accountPinModalOpen=!0,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinModalClose:()=>{e.accountPinModalOpen=!1,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinSave:(o,r)=>{const l=e.selectedWorkspace??e.workspaces[0]?.name;l&&e.handleAccountPinSave(l,o,r)},wsProps:Ny(e)})}if(e.filesPage){const t=By(e);return Np({connected:e.connected,wsProps:Ft(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,message:e.filesMessage,uploadBusy:e.filesUploadBusy,onRefresh:()=>nn(e,t),onSelectFile:n=>$y(e,n,t),onToggleSelectFile:n=>Ey(e,n,t),onToggleDir:n=>Ly(e,n),onUpload:(n,s)=>_y(e,n,s,t),onDownload:n=>hc(e,n,t),onBulkDownload:()=>Ty(e,t),onDelete:n=>My(e,n,t),onMove:(n,s)=>fc(e,n,s,t),onMoveToDir:(n,s)=>Cy(e,n,s,t)})}if(e.browserPage)return Mp({connected:e.connected,active:e.browserScreencastActive,loading:e.browserLoading,error:e.browserError,inputMode:e.browserInputMode,handoffPending:e.browserHandoffPending,handoffReason:e.browserHandoffReason,onStart:()=>vy(e),onStop:()=>by(e),onToggleInput:()=>ky(e),onCompleteHandoff:()=>wy(e),onCanvasMouseDown:t=>{const s=t.target.getBoundingClientRect(),o=On().translateCoordinates(t.clientX-s.left,t.clientY-s.top);ei(e,"mousePressed",o.x,o.y,t.button===2?"right":t.button===1?"middle":"left")},onCanvasMouseUp:t=>{const s=t.target.getBoundingClientRect(),o=On().translateCoordinates(t.clientX-s.left,t.clientY-s.top);ei(e,"mouseReleased",o.x,o.y)},onCanvasMouseMove:t=>{const n=On();if(n.shouldThrottleMouseMove())return;const i=t.target.getBoundingClientRect(),o=n.translateCoordinates(t.clientX-i.left,t.clientY-i.top);ei(e,"mouseMoved",o.x,o.y)},onCanvasKeyDown:t=>{let n=0;t.altKey&&(n|=1),t.ctrlKey&&(n|=2),t.metaKey&&(n|=4),t.shiftKey&&(n|=8),ti(e,"keyDown",t.key,{code:t.code,modifiers:n||void 0}),t.key.length===1&&ti(e,"char",t.key,{text:t.key})},onCanvasKeyUp:t=>{ti(e,"keyUp",t.key,{code:t.code})}});if(e.adminsPage){const t=Oy(e),n=Dy(e);return Qp({connected:e.connected,wsProps:Ft(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>ps(e,t),onAdd:s=>{mc(e,s,t,n).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:s=>yc(e,s,t,n),onNewPhoneChange:s=>e.handleAdminsNewPhoneChange(s)})}if(e.customersPage){const t=Fy(e);return Jp({connected:e.connected,wsProps:Ft(e),loading:e.customersLoading,saving:e.customersSaving,records:e.customersRecords,error:e.customersError,searchQuery:e.customersSearchQuery,editingId:e.customersEditingId,showAddForm:e.customersShowAddForm,newRecordPhone:e.customersNewPhone,newRecordName:e.customersNewName,onSearch:n=>e.customersSearchQuery=n,onSearchSubmit:()=>Je(e,t),onAdd:(n,s)=>vc(e,n,s,t),onDelete:n=>bc(e,n,t),onSetField:(n,s,i)=>wc(e,n,s,i,t),onDeleteField:(n,s)=>kc(e,n,s,t),onToggleExpand:n=>{e.customersEditingId=e.customersEditingId===n?null:n},onShowAddForm:()=>e.customersShowAddForm=!0,onCancelAddForm:()=>{e.customersShowAddForm=!1,e.customersNewPhone="",e.customersNewName=""},onNewRecordPhoneChange:n=>e.handleCustomersNewPhoneChange(n),onNewRecordNameChange:n=>e.handleCustomersNewNameChange(n),onRefresh:()=>Je(e,t)})}if(e.chatPage){const t=e.connected?null:"Disconnected from gateway.",n=Ky(e),s=e.chatAvatarUrl??n??null;return Nm({connected:e.connected,wsProps:Ft(e),sessionKey:e.sessionKey,onSessionKeyChange:i=>{e.sessionKey=i,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:i,lastActiveSessionKey:i}),e.loadAssistantIdentity(),Ce(e),pi(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:i=>{vn(e,e.sessionKey,{model:i}).then(()=>{Ce(e)})},onThinkingLevelChange:i=>{vn(e,e.sessionKey,{thinkingLevel:i==="off"?null:i}).then(()=>{Ce(e)})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,onVerboseChange:i=>{vn(e,e.sessionKey,{verboseLevel:i==="off"?null:i}).then(()=>{Ce(e)})},onFillerChange:i=>{vn(e,e.sessionKey,{fillerEnabled:i}).then(()=>{Ce(e)})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:s,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,disabledReason:t,error:e.lastError,sessions:e.sessionsResult,focusMode:!1,onRefresh:()=>(e.resetToolStream(),Promise.all([Ce(e),pi(e)])),onToggleFocusMode:()=>{},onChatScroll:i=>e.handleChatScroll(i),nearBottom:e.chatUserNearBottom,onDraftChange:i=>e.chatMessage=i,attachments:e.chatAttachments,onAttachmentsChange:i=>e.chatAttachments=i,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:i=>e.removeQueuedMessage(i),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:i=>e.handleOpenSidebar(i),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:i=>e.handleSplitRatioChange(i),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?uy({connected:e.connected,wsProps:Ft(e),activeTab:e.advancedTab,onTabChange:t=>{e.advancedTab=t,t==="cron"&&e.loadCron(),t==="skills"&&bt(e,{clearMessages:!0}),t==="logs"&&(e.logsSubTab==="session"?qt(e,{reset:!0}):Ht(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(t=>t.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],agentIds:J(e)?.agents?.map(n=>n.id)??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1},detailJobId:e.cronDetailJobId,onDetailOpen:t=>{e.cronDetailJobId=t.id,ai(e,t.id)},onDetailClose:()=>{e.cronDetailJobId=null},onFormChange:t=>e.cronForm={...e.cronForm,...t},onRefresh:()=>e.loadCron(),onAdd:()=>{sd(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(t,n)=>id(e,t,n),onRun:t=>od(e,t),onRemove:t=>rd(e,t),onLoadRuns:t=>ai(e,t)},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:t=>e.skillsFilter=t,onRefresh:()=>bt(e,{clearMessages:!0}),onToggle:(t,n)=>Gd(e,t,n),onEdit:(t,n)=>qd(e,t,n),onSaveKey:t=>Vd(e,t),onInstall:(t,n,s)=>Qd(e,t,n,s)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:t=>{e.logsSubTab=t,t==="session"?qt(e,{reset:!0}):Ht(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,onFilterTextChange:t=>e.sessionLogsFilterText=t,onTypeToggle:(t,n)=>{const s=e;s.sessionLogsTypeFilters={...s.sessionLogsTypeFilters,[t]:n}},onAgentToggle:(t,n)=>{const s=e;s.sessionLogsAgentFilters={...s.sessionLogsAgentFilters,[t]:n}},onToggleAutoFollow:t=>e.sessionLogsAutoFollow=t,onRefresh:()=>{qt(e,{reset:!0})},onExport:(t,n)=>e.exportSessionLogs(t,n),onScroll:t=>e.handleSessionLogsScroll(t)},loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:t=>e.logsFilterText=t,onLevelToggle:(t,n)=>{e.logsLevelFilters={...e.logsLevelFilters,[t]:n}},onToggleAutoFollow:t=>e.logsAutoFollow=t,onRefresh:()=>Ht(e,{reset:!0}),onExport:(t,n)=>e.exportSessionLogs(t,n),onScroll:t=>e.handleLogsScroll(t)}}):(window.location.replace("/chat"),d``)}const Gy={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Vy={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};async function Qy(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}async function sn(e){if(!(!e.client||!e.connected)&&!e.workspacesLoading){e.workspacesLoading=!0,e.workspacesError=null;try{const t=await e.client.request("workspaces.list",{});e.workspaces=t.workspaces}catch(t){e.workspacesError=String(t)}finally{e.workspacesLoading=!1}}}async function Yy(e,t){if(!e.client||!e.connected||e.workspaceSaving)return;const n=t.name.trim();if(!n){e.workspacesError="Account name is required.";return}e.workspaceSaving=!0,e.workspacesError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const i=s.hash;if(!i){e.workspacesError="Config hash missing; reload and retry.";return}const o={name:n,baseHash:i,whatsappAccountName:n};t.workspacePath?.trim()&&(o.workspaceDir=t.workspacePath.trim());const r=await e.client.request("workspaces.create",o);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await sn(e),t.onCreated?.(r)}catch(s){e.workspacesError=String(s)}finally{e.workspaceSaving=!1}}async function Xy(e,t){if(!(!e.client||!e.connected)&&!e.workspaceSaving){e.workspaceSaving=!0,e.workspacesError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const s=n.hash;if(!s){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.remove",{name:t,baseHash:s}),e.workspaceRemoveConfirm=null,await sn(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function Zy(e,t,n){if(!(!e.client||!e.connected)){e.workspacesError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const i=s.hash;if(!i){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.rename",{name:t,displayName:n,baseHash:i}),await sn(e)}catch(s){e.workspacesError=String(s)}}}const Mn=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:Yy,loadWorkspaces:sn,removeWorkspace:Xy,renameWorkspace:Zy},Symbol.toStringTag,{value:"Module"})),Sc={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"taskmaster-control-ui",SETUP_UI:"setup-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"taskmaster-macos",IOS_APP:"taskmaster-ios",ANDROID_APP:"taskmaster-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"taskmaster-probe"},ha=Sc,Mi={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(Sc));new Set(Object.values(Mi));function Jy(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const ev=4008;class tv{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,o=!1,r=this.opts.token;if(t){i=await Dd();const u=Ud({deviceId:i.deviceId,role:s})?.token;r=u??this.opts.token,o=!!(u&&this.opts.token)}const l=r||this.opts.password?{token:r,password:this.opts.password}:void 0;let a;if(t&&i){const u=Date.now(),p=this.connectNonce??void 0,m=Jy({deviceId:i.deviceId,clientId:this.opts.clientName??ha.CONTROL_UI,clientMode:this.opts.mode??Mi.WEBCHAT,role:s,scopes:n,signedAtMs:u,token:r??null,nonce:p}),v=await Bd(i.privateKey,m);a={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:u,nonce:p}}const c={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??ha.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Mi.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:a,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",c).then(u=>{u?.auth?.deviceToken&&i&&Wd({deviceId:i.deviceId,role:u.auth.role??s,token:u.auth.deviceToken,scopes:u.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(u)}).catch(()=>{o&&i&&Kd({deviceId:i.deviceId,role:s}),this.ws?.close(ev,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const r=i.payload,l=r&&typeof r.nonce=="string"?r.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const o=typeof i.seq=="number"?i.seq:null;o!==null&&(this.lastSeq!==null&&o>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:o}),this.lastSeq=o);try{this.opts.onEvent?.(i)}catch(r){console.error("[gateway] event handler error:",r)}return}if(s.type==="res"){const i=n,o=this.pending.get(i.id);if(!o)return;this.pending.delete(i.id),i.ok?o.resolve(i.payload):o.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Bi(),i={type:"req",id:s,method:t,params:n},o=new Promise((r,l)=>{this.pending.set(s,{resolve:a=>r(a),reject:l})});return this.ws.send(JSON.stringify(i)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Li(e){return typeof e=="object"&&e!==null}function nv(e){if(!Li(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Li(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!o?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:o}}function sv(e){if(!Li(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function Ac(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function iv(e,t){const n=Ac(e).filter(s=>s.id!==t.id);return n.push(t),n}function fa(e,t){return Ac(e).filter(n=>n.id!==t)}async function xc(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const o=oi(i);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}function ni(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",o=t.defaultAgentId?.trim();return n==="main"||n===i||o&&(n===`agent:${o}:main`||n===`agent:${o}:${i}`)?s:n}function ov(e,t){if(!t?.mainSessionKey)return;const n=ni(e.sessionKey,t),s=ni(e.settings.sessionKey,t),i=ni(e.settings.lastActiveSessionKey,t),o=n||s||e.sessionKey,r={...e.settings,sessionKey:s||o,lastActiveSessionKey:i||o},l=r.sessionKey!==e.settings.sessionKey||r.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),l&&Ie(e,r)}function Te(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=e.setup||e.filesPage||e.browserPage?"setup-ui":"taskmaster-control-ui";e.client?.stop(),e.client=new tv({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:t,mode:"webchat",onHello:n=>{e.connected=!0,e.lastError=null,e.hello=n,lv(e,n),e.handleAccessCheck(),xc(e),Qy(e),(e.chatPage||e.setup)&&cv(e),Qi(e,{quiet:!0}),Vi(e,{quiet:!0}),sn(e).then(()=>{e.initWorkspaceSelection()}),e.setup&&(we(e),uv(e)),so(e)},onClose:({code:n,reason:s})=>{e.connected=!1,n!==1012&&(e.lastError=`disconnected (${n}): ${s||"no reason"}`)},onEvent:n=>rv(e,n),onGap:({expected:n,received:s})=>{e.lastError=`event gap detected (expected seq ${n}, got ${s}); refresh recommended`}}),e.client.start()}function rv(e,t){try{av(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function av(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;zu(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&ll(e,n.sessionKey);const s=Ia(e,n);(s==="final"||s==="error"||s==="aborted")&&(Ui(e),wp(e)),s==="final"&&Ce(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&io(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Vi(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=nv(t.payload);if(n){e.execApprovalQueue=iv(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=fa(e.execApprovalQueue,n.id)},s)}return}if(t.event==="browser.screencast.frame"){Sy(e,t.payload);return}if(t.event==="browser.handoff"){Ay(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){xy(e);return}if(t.event==="exec.approval.resolved"){const n=sv(t.payload);n&&(e.execApprovalQueue=fa(e.execApprovalQueue,n.id))}}function lv(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&ov(e,n.sessionDefaults)}async function cv(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("models.list",{});Array.isArray(t?.models)&&(e.chatModelCatalog=t.models)}catch{}}async function uv(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await _i(e.client)}catch{}}function dv(e){e.basePath=lp();const t=De();if(Ep(t.accentColor),window.scrollTo(0,0),e.setup){document.title=`${t.name} Setup`,Te(e);return}if(e.filesPage){document.title=`${t.name} Files`,Te(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Te(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Te(e);return}if(e.customersPage){document.title=`${t.name} Customers`,Te(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Te(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Te(e);return}pp(e,!0),cp(e),up(e),window.addEventListener("popstate",e.popStateHandler),op(e),Te(e),sp(e),e.tab==="logs"&&(e.logsSubTab==="session"?Ji(e):Xi(e)),e.tab==="debug"&&to(e)}function pv(e){Xu(e)}function hv(e){window.removeEventListener("popstate",e.popStateHandler),ip(e),Zi(e),eo(e),no(e),dp(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function fv(e,t){if(e.filesPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleFilesLoad&&e.handleFilesLoad(),e.adminsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdminsLoad&&e.handleAdminsLoad(),e.customersPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleCustomersLoad&&e.handleCustomersLoad(),e.chatPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleChatLoad&&e.handleChatLoad(),e.advancedPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdvancedLoad&&e.handleAdvancedLoad(),e.setup&&e.connected){const n=t.has("connected")&&t.get("connected")===!1;n&&e.handleLicenseStatusCheck&&e.licenseValid===null&&!e.licenseBusy&&e.handleLicenseStatusCheck(),n&&e.handleUpdateCheck&&e.handleUpdateCheck();const s=t.has("setupStep")&&e.setupStep==="auth";(n||s)&&e.setupStep==="auth"&&(e.authConnected===!0?e.setupStep="whatsapp":e.handleAuthStatusCheck&&e.authConnected===null&&!e.authBusy&&e.handleAuthStatusCheck()),e.setupStep==="whatsapp"&&t.has("setupStep")&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(o=>{e.channelsSnapshot=o,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1})),t.has("whatsappLoginConnected")&&e.whatsappLoginConnected===!0&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(i=>{e.channelsSnapshot=i,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"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;Jt(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&Na(e,t.has("tab")||t.has("logsAutoFollow"))}function gv(e){const t={name:e?.name??"",displayName:e?.displayName??"",about:e?.about??"",picture:e?.picture??"",banner:e?.banner??"",website:e?.website??"",nip05:e?.nip05??"",lud16:e?.lud16??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e?.banner||e?.website||e?.nip05||e?.lud16)}}async function mv(e,t,n){await Wi(e,t,n),await j(e,!0)}async function yv(e,t){await Ba(e,t),await j(e,!0)}async function vv(e,t){await Fa(e,t),await j(e,!0)}async function bv(e,t){await Ua(e,t)}async function wv(e,t){await Wa(e,t)}async function kv(e){await ed(e),await we(e),await j(e,!0)}async function Sv(e){await we(e),await j(e,!0)}function Av(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const o=s.trim(),r=i.join(":").trim();o&&r&&(t[o]=r)}return t}function $c(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function Ec(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function xv(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=gv(n??void 0)}function $v(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Ev(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Tv(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Cv(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=$c(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(Ec(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const o=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Av(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await j(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function _v(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=$c(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(Ec(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:a,success:null};return}const o=i.merged??i.imported??null,r=o?{...t.values,...o}:t.values,l=!!(r.banner||r.website||r.nip05||r.lud16);e.nostrProfileFormState={...t,importing:!1,values:r,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await j(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}async function Mv(e){if(e.client){e.authBusy=!0,e.authMessage=null;try{const t=await e.client.request("auth.status",{});e.authConnected=t.connected,e.authExpiresIn=t.expiresIn??null,e.authMessage=t.message??null,t.connected&&(e.setupStep="whatsapp")}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to check auth status"}finally{e.authBusy=!1}}}async function Lv(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 Pv(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="",setTimeout(()=>{e.setupStep="whatsapp"},1500)):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 Rv(e,t){e.authCodeInput=t}function Iv(e){e.setupStep="whatsapp"}async function Nv(e){if(e.client){e.licenseBusy=!0,e.licenseMessage=null;try{const t=await e.client.request("license.status",{});e.licenseDeviceId=t.deviceId??null,e.licenseStoredKey=t.key??null,t.licensed?(e.licenseValid=!0,e.licenseTier=t.tier??null,e.setupStep="auth"):(e.licenseValid=null,e.setupStep="license")}catch(t){const n=t instanceof Error?t.message:String(t);n.includes("unknown method")?(e.licenseValid=!0,e.setupStep="auth"):(e.licenseValid=null,e.licenseMessage=n,e.setupStep="license")}finally{e.licenseBusy=!1}}}async function Ov(e){if(e.client&&e.licenseKey.trim()){e.licenseBusy=!0,e.licenseMessage=null,e.licenseValid=null;try{const t=await e.client.request("license.activate",{key:e.licenseKey.trim()});t.valid?(e.licenseValid=!0,e.licenseMessage=t.message??"License activated",e.licenseTier=t.tier??null,setTimeout(()=>{e.setupStep="auth"},1500)):(e.licenseValid=!1,e.licenseMessage=t.message??"Invalid license key")}catch(t){e.licenseValid=!1,e.licenseMessage=t instanceof Error?t.message:"Activation failed"}finally{e.licenseBusy=!1}}}async function Dv(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 Bv(e,t){e.licenseKey=t}async function Fv(e){if(!(!e.client||!e.connected)&&!e.gatewayHealthLoading){e.gatewayHealthLoading=!0,e.requestUpdate?.();try{const t=await e.client.request("health",{probe:!0});e.gatewayHealthy=t.ok===!0,e.gatewayHealthMessage=t.ok?`Healthy${t.durationMs?` (${t.durationMs}ms)`:""}`:"Unhealthy"}catch(t){e.gatewayHealthy=!1,e.gatewayHealthMessage=`Error: ${String(t)}`}finally{e.gatewayHealthLoading=!1,e.requestUpdate?.()}}}async function Uv(e){if(!(!e.client||e.gatewayRestartBusy)){e.gatewayRestartBusy=!0,e.gatewayHealthMessage="Restarting...",e.requestUpdate?.();try{const t=await e.client.request("gateway.restart",{reason:"Manual restart from setup page",delayMs:1e3});if(t.ok&&t.restart?.ok)e.gatewayHealthMessage="Restarting...",setTimeout(()=>{window.location.reload()},3e3);else throw new Error("Restart not scheduled")}catch(t){e.gatewayHealthMessage=`Restart failed: ${String(t)}`,e.gatewayRestartBusy=!1,e.requestUpdate?.()}}}async function Wv(e){if(!(!e.client||!e.connected)&&!e.updateChecking){e.updateChecking=!0,e.updateMessage=null,e.requestUpdate?.();try{const t=await e.client.request("update.status",{});e.currentVersion=t.current,e.latestVersion=t.latest,e.updateAvailable=t.updateAvailable,e.updateMessage=t.updateAvailable?`v${t.latest} available`:"Up to date"}catch(t){e.updateMessage=`Check failed: ${String(t)}`,e.updateAvailable=null}finally{e.updateChecking=!1,e.requestUpdate?.()}}}async function Kv(e){if(!(!e.client||e.updateRunning)){e.updateRunning=!0,e.updateMessage="Updating...",e.requestUpdate?.();try{const t=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(t.ok&&t.result.status==="ok")e.updateMessage="Updated — restarting...",e.requestUpdate?.(),setTimeout(()=>{window.location.reload()},5e3);else throw new Error(t.result.reason||"Update failed")}catch(t){e.updateMessage=`Update failed: ${String(t)}`,e.updateRunning=!1,e.requestUpdate?.()}}}var jv=Object.defineProperty,zv=Object.getOwnPropertyDescriptor,f=(e,t,n,s)=>{for(var i=s>1?void 0:s?zv(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(i=(s?r(t,n,i):r(i))||i);return s&&i&&jv(t,n,i),i};const si=pu();function Hv(){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 qv(){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 s=n.trim().toLowerCase();return s==="1"||s==="true"||s==="yes"||s==="on"}function Gv(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function Vv(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function Qv(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function Yv(){const e=window.location.pathname;return e==="/customers"||e.endsWith("/customers")}function Xv(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function Zv(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let h=class extends gt{constructor(){super(...arguments),this.settings=Cs(),this.password="",this.tab="chat",this.onboarding=Hv(),this.setup=qv(),this.filesPage=Gv(),this.browserPage=Vv(),this.adminsPage=Qv(),this.customersPage=Yv(),this.chatPage=Xv(),this.advancedPage=Zv(),this.advancedTab="cron",this.connected=!1,this.accessState=cc,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=si.name,this.assistantAvatar=si.avatar,this.assistantAgentId=si.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatModelProvider=null,this.chatModel=null,this.chatModelCatalog=[],this.chatVerboseLevel=null,this.chatFillerEnabled=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.configLoading=!1,this.configRaw=`{
|
|
2712
2698
|
}
|
|
2713
2699
|
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.whatsappActiveQrAccountId=null,this.whatsappPairedPhone=null,this.addingWhatsAppAccount=!1,this.newWhatsAppAccountName="",this.whatsappAccountError=null,this.whatsappAccountSaving=!1,this.whatsappSettingsOpen=!1,this.licenseKey="",this.licenseBusy=!1,this.licenseValid=null,this.licenseMessage=null,this.licenseTier=null,this.licenseDeviceId=null,this.licenseStoredKey=null,this.licenseRemoveConfirm=!1,this.authConnected=null,this.authBusy=!1,this.authMessage=null,this.authUrl=null,this.authCodeInput="",this.authExpiresIn=null,this.setupStep="license",this.gatewayHealthy=null,this.gatewayHealthLoading=!1,this.gatewayHealthMessage=null,this.gatewayRestartBusy=!1,this.updateAvailable=null,this.currentVersion=null,this.latestVersion=null,this.updateChecking=!1,this.updateMessage=null,this.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={...Vy},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesMessage=null,this.filesUploadBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.customersLoading=!1,this.customersSaving=!1,this.customersRecords=[],this.customersError=null,this.customersSearchQuery="",this.customersEditingId=null,this.customersShowAddForm=!1,this.customersNewPhone="",this.customersNewName="",this.imessageEnableConfirm=!1,this.imessageEnabling=!1,this.infoModalOpen=null,this.workspaces=[],this.workspacesLoading=!1,this.workspacesError=null,this.selectedWorkspace=null,this.addingWorkspace=!1,this.newWorkspaceName="",this.newWorkspacePath="",this.newWorkspacePin="",this.accountPinModalOpen=!1,this.accountPinBusy=!1,this.accountPinError=null,this.accountPinSuccess=null,this.apiKeyProviders=[],this.apiKeyModalOpen=!1,this.apiKeyBusy=!1,this.apiKeyError=null,this.apiKeySuccess=null,this.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={...Gy},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.logsSubTab="session",this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>hp(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),dv(this)}firstUpdated(){pv(this)}disconnectedCallback(){hv(this),super.disconnectedCallback()}updated(e){fv(this,e)}connect(){Te(this)}handleChatScroll(e){Hu(this,e)}handleLogsScroll(e){qu(this,e)}handleSessionLogsScroll(e){Gu(this,e)}exportLogs(e,t){Qu(e,t)}exportSessionLogs(e,t){Yu(e,t)}resetToolStream(){Ui(this)}resetChatScroll(){Vu(this)}async loadAssistantIdentity(){await xc(this)}applySettings(e){Ie(this,e)}setTab(e){rp(this,e)}setTheme(e,t){ap(this,e,t)}async loadOverview(){await dl(this)}async loadCron(){const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=e?.agents?.map(t=>t.id)??void 0,this.cronForm={...this.cronForm,accountId:e?.whatsappAccountId??void 0},await io(this)}async handleAbortChat(){await hl(this)}removeQueuedMessage(e){yp(this,e)}async handleSendChat(e,t){await vp(this,e,t)}async handleWhatsAppStart(e,t){await mv(this,e,t)}async handleWhatsAppWait(e){await yv(this,e)}async handleWhatsAppLogout(e){await vv(this,e)}async handleAddWhatsAppAccount(e){await bv(this,e)}async handleRemoveWhatsAppAccount(e){await wv(this,e)}async handleAccessCheck(){await da(this)}async handlePinSubmit(e,t){await py(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await hy(this,e)}async handleLogout(){await gy(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 s=await this.client.request("access.verify",{account:e,pin:t});if(!s.ok){this.changePinError=s.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 s=await this.client.request("access.verify",{account:e,pin:t});if(!s.ok){this.accountPinError=s.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 da(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 Nv(this)}async handleLicenseActivate(){await Ov(this)}async handleLicenseRemove(){await Dv(this)}handleLicenseKeyChange(e){Bv(this,e)}async handleAuthStatusCheck(){await Mv(this)}async handleAuthStart(){await Lv(this)}async handleAuthSubmitCode(e){await Pv(this,e)}handleAuthCodeChange(e){Rv(this,e)}handleSkipToWhatsApp(){Iv(this)}async handleGatewayHealthCheck(){await Fv(this)}async handleGatewayRestart(){await Uv(this)}async handleUpdateCheck(){await Wv(this)}async handleUpdateRun(){await Kv(this)}handleFilesLoad(){const e=this.resolveFilesAgentId();nn(this,e)}handleAdminsLoad(){const e=this.resolveAdminAgentId();$e(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>Ry);return{loadAdmins:t}},void 0,import.meta.url).then(({loadAdmins:t})=>{t(this,e)})}resolveAdminAgentId(){const e=this.getSelectedWorkspaceInfo();return e?e.agents.find(n=>n.id.endsWith("-admin")||n.id==="admin")?.id:void 0}resolveFilesAgentId(){const e=this.getSelectedWorkspaceInfo();if(e)return e.agents[0]?.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.chatRunId=null,this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}$e(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>Iu);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this)})}handleAdvancedLoad(){this.loadCron()}async handleChannelConfigSave(){await kv(this)}async handleChannelConfigReload(){await Sv(this)}handleNostrProfileEdit(e,t){xv(this,e,t)}handleNostrProfileCancel(){$v(this)}handleNostrProfileFieldChange(e,t){Ev(this,e,t)}async handleNostrProfileSave(){await Cv(this)}async handleNostrProfileImport(){await _v(this)}handleNostrProfileToggleAdvanced(){Tv(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleCustomersLoad(){const e=this.selectedWorkspace??void 0;$e(async()=>{const{loadCustomers:t}=await Promise.resolve().then(()=>Iy);return{loadCustomers:t}},void 0,import.meta.url).then(({loadCustomers:t})=>{t(this,e)})}handleCustomersNewPhoneChange(e){this.customersNewPhone=e,this.customersError&&(this.customersError=null)}handleCustomersNewNameChange(e){this.customersNewName=e,this.customersError&&(this.customersError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await $e(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>Mn);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await $e(async()=>{const{createWorkspace:i}=await Promise.resolve().then(()=>Mn);return{createWorkspace:i}},void 0,import.meta.url),{loadChannels:s}=await $e(async()=>{const{loadChannels:i}=await Promise.resolve().then(()=>ad);return{loadChannels:i}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:i=>{if(!i.whatsappAccountId)return;const o=i.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await s(this,!0),await this.handleWhatsAppStart(!0,o),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(o),await s(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await $e(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>Mn);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=e?.displayName??e?.name??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await $e(async()=>{const{renameWorkspace:s}=await Promise.resolve().then(()=>Mn);return{renameWorkspace:s}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),tr(e),this.settings=Cs(),this.chatMessage="",this.chatAttachments=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.reloadCurrentPageData()}getSelectedWorkspaceInfo(){return this.selectedWorkspace?this.workspaces.find(e=>e.name===this.selectedWorkspace)??null:null}reloadCurrentPageData(){this.adminsPage?this.handleAdminsLoad():this.customersPage?this.handleCustomersLoad():this.filesPage?this.handleFilesLoad():this.chatPage?this.handleChatLoad():this.advancedPage&&this.handleAdvancedLoad()}initWorkspaceSelection(){if(this.workspaces.length===0)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(s=>s.isDefault)??this.workspaces[0];this.selectedWorkspace=n.name,localStorage.setItem("taskmaster-selected-workspace",n.name)}tr(this.selectedWorkspace),this.settings=Cs(),this.reloadCurrentPageData()}render(){return qy(this)}};f([g()],h.prototype,"settings",2);f([g()],h.prototype,"password",2);f([g()],h.prototype,"tab",2);f([g()],h.prototype,"onboarding",2);f([g()],h.prototype,"setup",2);f([g()],h.prototype,"filesPage",2);f([g()],h.prototype,"browserPage",2);f([g()],h.prototype,"adminsPage",2);f([g()],h.prototype,"customersPage",2);f([g()],h.prototype,"chatPage",2);f([g()],h.prototype,"advancedPage",2);f([g()],h.prototype,"advancedTab",2);f([g()],h.prototype,"connected",2);f([g()],h.prototype,"accessState",2);f([g()],h.prototype,"theme",2);f([g()],h.prototype,"themeResolved",2);f([g()],h.prototype,"hello",2);f([g()],h.prototype,"lastError",2);f([g()],h.prototype,"eventLog",2);f([g()],h.prototype,"assistantName",2);f([g()],h.prototype,"assistantAvatar",2);f([g()],h.prototype,"assistantAgentId",2);f([g()],h.prototype,"sessionKey",2);f([g()],h.prototype,"chatLoading",2);f([g()],h.prototype,"chatSending",2);f([g()],h.prototype,"chatMessage",2);f([g()],h.prototype,"chatMessages",2);f([g()],h.prototype,"chatToolMessages",2);f([g()],h.prototype,"chatStream",2);f([g()],h.prototype,"chatStreamStartedAt",2);f([g()],h.prototype,"chatRunId",2);f([g()],h.prototype,"compactionStatus",2);f([g()],h.prototype,"chatAvatarUrl",2);f([g()],h.prototype,"chatThinkingLevel",2);f([g()],h.prototype,"chatModelProvider",2);f([g()],h.prototype,"chatModel",2);f([g()],h.prototype,"chatModelCatalog",2);f([g()],h.prototype,"chatVerboseLevel",2);f([g()],h.prototype,"chatFillerEnabled",2);f([g()],h.prototype,"chatQueue",2);f([g()],h.prototype,"chatAttachments",2);f([g()],h.prototype,"sidebarOpen",2);f([g()],h.prototype,"sidebarContent",2);f([g()],h.prototype,"sidebarError",2);f([g()],h.prototype,"splitRatio",2);f([g()],h.prototype,"nodesLoading",2);f([g()],h.prototype,"nodes",2);f([g()],h.prototype,"devicesLoading",2);f([g()],h.prototype,"devicesError",2);f([g()],h.prototype,"devicesList",2);f([g()],h.prototype,"execApprovalsLoading",2);f([g()],h.prototype,"execApprovalsSaving",2);f([g()],h.prototype,"execApprovalsDirty",2);f([g()],h.prototype,"execApprovalsSnapshot",2);f([g()],h.prototype,"execApprovalsForm",2);f([g()],h.prototype,"execApprovalsSelectedAgent",2);f([g()],h.prototype,"execApprovalsTarget",2);f([g()],h.prototype,"execApprovalsTargetNodeId",2);f([g()],h.prototype,"execApprovalQueue",2);f([g()],h.prototype,"execApprovalBusy",2);f([g()],h.prototype,"execApprovalError",2);f([g()],h.prototype,"configLoading",2);f([g()],h.prototype,"configRaw",2);f([g()],h.prototype,"configRawOriginal",2);f([g()],h.prototype,"configValid",2);f([g()],h.prototype,"configIssues",2);f([g()],h.prototype,"configSaving",2);f([g()],h.prototype,"configApplying",2);f([g()],h.prototype,"updateRunning",2);f([g()],h.prototype,"applySessionKey",2);f([g()],h.prototype,"configSnapshot",2);f([g()],h.prototype,"configSchema",2);f([g()],h.prototype,"configSchemaVersion",2);f([g()],h.prototype,"configSchemaLoading",2);f([g()],h.prototype,"configUiHints",2);f([g()],h.prototype,"configForm",2);f([g()],h.prototype,"configFormOriginal",2);f([g()],h.prototype,"configFormDirty",2);f([g()],h.prototype,"configFormMode",2);f([g()],h.prototype,"configSearchQuery",2);f([g()],h.prototype,"configActiveSection",2);f([g()],h.prototype,"configActiveSubsection",2);f([g()],h.prototype,"channelsLoading",2);f([g()],h.prototype,"channelsSnapshot",2);f([g()],h.prototype,"channelsError",2);f([g()],h.prototype,"channelsLastSuccess",2);f([g()],h.prototype,"whatsappLoginMessage",2);f([g()],h.prototype,"whatsappLoginQrDataUrl",2);f([g()],h.prototype,"whatsappLoginConnected",2);f([g()],h.prototype,"whatsappBusy",2);f([g()],h.prototype,"whatsappActiveQrAccountId",2);f([g()],h.prototype,"whatsappPairedPhone",2);f([g()],h.prototype,"addingWhatsAppAccount",2);f([g()],h.prototype,"newWhatsAppAccountName",2);f([g()],h.prototype,"whatsappAccountError",2);f([g()],h.prototype,"whatsappAccountSaving",2);f([g()],h.prototype,"whatsappSettingsOpen",2);f([g()],h.prototype,"licenseKey",2);f([g()],h.prototype,"licenseBusy",2);f([g()],h.prototype,"licenseValid",2);f([g()],h.prototype,"licenseMessage",2);f([g()],h.prototype,"licenseTier",2);f([g()],h.prototype,"licenseDeviceId",2);f([g()],h.prototype,"licenseStoredKey",2);f([g()],h.prototype,"licenseRemoveConfirm",2);f([g()],h.prototype,"authConnected",2);f([g()],h.prototype,"authBusy",2);f([g()],h.prototype,"authMessage",2);f([g()],h.prototype,"authUrl",2);f([g()],h.prototype,"authCodeInput",2);f([g()],h.prototype,"authExpiresIn",2);f([g()],h.prototype,"setupStep",2);f([g()],h.prototype,"gatewayHealthy",2);f([g()],h.prototype,"gatewayHealthLoading",2);f([g()],h.prototype,"gatewayHealthMessage",2);f([g()],h.prototype,"gatewayRestartBusy",2);f([g()],h.prototype,"updateAvailable",2);f([g()],h.prototype,"currentVersion",2);f([g()],h.prototype,"latestVersion",2);f([g()],h.prototype,"updateChecking",2);f([g()],h.prototype,"updateMessage",2);f([g()],h.prototype,"nostrProfileFormState",2);f([g()],h.prototype,"nostrProfileAccountId",2);f([g()],h.prototype,"presenceLoading",2);f([g()],h.prototype,"presenceEntries",2);f([g()],h.prototype,"presenceError",2);f([g()],h.prototype,"presenceStatus",2);f([g()],h.prototype,"agentsLoading",2);f([g()],h.prototype,"agentsList",2);f([g()],h.prototype,"agentsError",2);f([g()],h.prototype,"sessionsLoading",2);f([g()],h.prototype,"sessionsResult",2);f([g()],h.prototype,"sessionsError",2);f([g()],h.prototype,"cronLoading",2);f([g()],h.prototype,"cronJobs",2);f([g()],h.prototype,"cronStatus",2);f([g()],h.prototype,"cronError",2);f([g()],h.prototype,"cronForm",2);f([g()],h.prototype,"cronRunsJobId",2);f([g()],h.prototype,"cronRuns",2);f([g()],h.prototype,"cronBusy",2);f([g()],h.prototype,"cronNewEventModal",2);f([g()],h.prototype,"cronDetailJobId",2);f([g()],h.prototype,"browserScreencastActive",2);f([g()],h.prototype,"browserScreencastFrame",2);f([g()],h.prototype,"browserScreencastMetadata",2);f([g()],h.prototype,"browserHandoffPending",2);f([g()],h.prototype,"browserHandoffReason",2);f([g()],h.prototype,"browserHandoffId",2);f([g()],h.prototype,"browserInputMode",2);f([g()],h.prototype,"browserLoading",2);f([g()],h.prototype,"browserError",2);f([g()],h.prototype,"filesLoading",2);f([g()],h.prototype,"filesTree",2);f([g()],h.prototype,"filesRoot",2);f([g()],h.prototype,"filesError",2);f([g()],h.prototype,"filesSelectedPath",2);f([g()],h.prototype,"filesSelectedPaths",2);f([g()],h.prototype,"filesPreviewContent",2);f([g()],h.prototype,"filesPreviewLoading",2);f([g()],h.prototype,"filesPreviewBinary",2);f([g()],h.prototype,"filesPreviewSize",2);f([g()],h.prototype,"filesExpandedDirs",2);f([g()],h.prototype,"filesMessage",2);f([g()],h.prototype,"filesUploadBusy",2);f([g()],h.prototype,"skillsLoading",2);f([g()],h.prototype,"skillsReport",2);f([g()],h.prototype,"skillsError",2);f([g()],h.prototype,"skillsFilter",2);f([g()],h.prototype,"skillEdits",2);f([g()],h.prototype,"skillsBusyKey",2);f([g()],h.prototype,"skillMessages",2);f([g()],h.prototype,"adminsLoading",2);f([g()],h.prototype,"adminPhones",2);f([g()],h.prototype,"adminsError",2);f([g()],h.prototype,"adminsSaving",2);f([g()],h.prototype,"adminsNewPhone",2);f([g()],h.prototype,"customersLoading",2);f([g()],h.prototype,"customersSaving",2);f([g()],h.prototype,"customersRecords",2);f([g()],h.prototype,"customersError",2);f([g()],h.prototype,"customersSearchQuery",2);f([g()],h.prototype,"customersEditingId",2);f([g()],h.prototype,"customersShowAddForm",2);f([g()],h.prototype,"customersNewPhone",2);f([g()],h.prototype,"customersNewName",2);f([g()],h.prototype,"imessageEnableConfirm",2);f([g()],h.prototype,"imessageEnabling",2);f([g()],h.prototype,"infoModalOpen",2);f([g()],h.prototype,"workspaces",2);f([g()],h.prototype,"workspacesLoading",2);f([g()],h.prototype,"workspacesError",2);f([g()],h.prototype,"selectedWorkspace",2);f([g()],h.prototype,"addingWorkspace",2);f([g()],h.prototype,"newWorkspaceName",2);f([g()],h.prototype,"newWorkspacePath",2);f([g()],h.prototype,"newWorkspacePin",2);f([g()],h.prototype,"accountPinModalOpen",2);f([g()],h.prototype,"accountPinBusy",2);f([g()],h.prototype,"accountPinError",2);f([g()],h.prototype,"accountPinSuccess",2);f([g()],h.prototype,"apiKeyProviders",2);f([g()],h.prototype,"apiKeyModalOpen",2);f([g()],h.prototype,"apiKeyBusy",2);f([g()],h.prototype,"apiKeyError",2);f([g()],h.prototype,"apiKeySuccess",2);f([g()],h.prototype,"authApiKeyMode",2);f([g()],h.prototype,"authApiKeyInput",2);f([g()],h.prototype,"authApiKeyBusy",2);f([g()],h.prototype,"authApiKeyError",2);f([g()],h.prototype,"pinChanging",2);f([g()],h.prototype,"pinChangeBusy",2);f([g()],h.prototype,"pinChangeError",2);f([g()],h.prototype,"loginChangePinMode",2);f([g()],h.prototype,"changePinBusy",2);f([g()],h.prototype,"changePinError",2);f([g()],h.prototype,"changePinSuccess",2);f([g()],h.prototype,"workspaceSaving",2);f([g()],h.prototype,"workspaceRemoveConfirm",2);f([g()],h.prototype,"renamingWorkspace",2);f([g()],h.prototype,"renameWorkspaceName",2);f([g()],h.prototype,"debugLoading",2);f([g()],h.prototype,"debugStatus",2);f([g()],h.prototype,"debugHealth",2);f([g()],h.prototype,"debugModels",2);f([g()],h.prototype,"debugHeartbeat",2);f([g()],h.prototype,"debugCallMethod",2);f([g()],h.prototype,"debugCallParams",2);f([g()],h.prototype,"debugCallResult",2);f([g()],h.prototype,"debugCallError",2);f([g()],h.prototype,"logsLoading",2);f([g()],h.prototype,"logsError",2);f([g()],h.prototype,"logsFile",2);f([g()],h.prototype,"logsEntries",2);f([g()],h.prototype,"logsFilterText",2);f([g()],h.prototype,"logsLevelFilters",2);f([g()],h.prototype,"logsAutoFollow",2);f([g()],h.prototype,"logsTruncated",2);f([g()],h.prototype,"logsCursor",2);f([g()],h.prototype,"logsLastFetchAt",2);f([g()],h.prototype,"logsLimit",2);f([g()],h.prototype,"logsMaxBytes",2);f([g()],h.prototype,"logsAtBottom",2);f([g()],h.prototype,"logsSubTab",2);f([g()],h.prototype,"sessionLogsLoading",2);f([g()],h.prototype,"sessionLogsError",2);f([g()],h.prototype,"sessionLogsEntries",2);f([g()],h.prototype,"sessionLogsFilterText",2);f([g()],h.prototype,"sessionLogsTypeFilters",2);f([g()],h.prototype,"sessionLogsAgentFilters",2);f([g()],h.prototype,"sessionLogsAgents",2);f([g()],h.prototype,"sessionLogsAutoFollow",2);f([g()],h.prototype,"sessionLogsCursors",2);f([g()],h.prototype,"sessionLogsLastFetchAt",2);f([g()],h.prototype,"sessionLogsAtBottom",2);f([g()],h.prototype,"chatUserNearBottom",2);h=f([Sa("taskmaster-app")],h);
|
|
2714
|
-
//# sourceMappingURL=index-
|
|
2700
|
+
//# sourceMappingURL=index-DKEqjln4.js.map
|