@maudecode/cove 2026.2.14 → 2026.2.19
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/assets/400-BMkBL_OY.css +1 -0
- package/dist/assets/400-Bigd7ufU.css +1 -0
- package/dist/assets/400-DIm2vEr-.css +1 -0
- package/dist/assets/400-QlzHorXL.css +1 -0
- package/dist/assets/400-WFOKBYV6.css +1 -0
- package/dist/assets/400-lAWKXRoJ.css +1 -0
- package/dist/assets/500-C9oGlv8Y.css +1 -0
- package/dist/assets/500-CQUBMBhA.css +1 -0
- package/dist/assets/500-CRBx2u7m.css +1 -0
- package/dist/assets/500-DnnFFs0Q.css +1 -0
- package/dist/assets/500-QKfiiXYO.css +1 -0
- package/dist/assets/600-B7Ikl3KO.css +1 -0
- package/dist/assets/600-BRVR-SPy.css +1 -0
- package/dist/assets/600-BmBzHULK.css +1 -0
- package/dist/assets/600-C2ZgMpi4.css +1 -0
- package/dist/assets/600-D8Jk2OB9.css +1 -0
- package/dist/assets/CanvasPanel-9jVF_oa3.js +12 -0
- package/dist/assets/fira-code-cyrillic-400-normal-UC0NFL4U.woff2 +0 -0
- package/dist/assets/fira-code-cyrillic-400-normal-dc1q3VD7.woff +0 -0
- package/dist/assets/fira-code-cyrillic-500-normal-Bu7VCL72.woff +0 -0
- package/dist/assets/fira-code-cyrillic-500-normal-CX35h3Mg.woff2 +0 -0
- package/dist/assets/fira-code-cyrillic-600-normal-BD56RyRT.woff +0 -0
- package/dist/assets/fira-code-cyrillic-600-normal-CPRdbepc.woff2 +0 -0
- package/dist/assets/fira-code-cyrillic-ext-400-normal-Buh61xzB.woff +0 -0
- package/dist/assets/fira-code-cyrillic-ext-400-normal-txZ9Fk_1.woff2 +0 -0
- package/dist/assets/fira-code-cyrillic-ext-500-normal-CYRspHgm.woff2 +0 -0
- package/dist/assets/fira-code-cyrillic-ext-500-normal-CwtLmSFD.woff +0 -0
- package/dist/assets/fira-code-cyrillic-ext-600-normal-B9wE0zmr.woff2 +0 -0
- package/dist/assets/fira-code-cyrillic-ext-600-normal-DldcyWhZ.woff +0 -0
- package/dist/assets/fira-code-greek-400-normal-B2Gh_Y8s.woff2 +0 -0
- package/dist/assets/fira-code-greek-400-normal-DobhaxvF.woff +0 -0
- package/dist/assets/fira-code-greek-500-normal-CVO0IRNt.woff2 +0 -0
- package/dist/assets/fira-code-greek-500-normal-DEXIWiey.woff +0 -0
- package/dist/assets/fira-code-greek-600-normal-D_h3X2X5.woff +0 -0
- package/dist/assets/fira-code-greek-600-normal-Dxp52_By.woff2 +0 -0
- package/dist/assets/fira-code-greek-ext-400-normal-DR7mBgIM.woff2 +0 -0
- package/dist/assets/fira-code-greek-ext-400-normal-DSPUheWg.woff +0 -0
- package/dist/assets/fira-code-greek-ext-500-normal-BO3iq16n.woff2 +0 -0
- package/dist/assets/fira-code-greek-ext-500-normal-CMiNLXER.woff +0 -0
- package/dist/assets/fira-code-greek-ext-600-normal-C-cQDoOk.woff +0 -0
- package/dist/assets/fira-code-greek-ext-600-normal-DtBpFRLc.woff2 +0 -0
- package/dist/assets/fira-code-latin-400-normal-C-QZfXAs.woff +0 -0
- package/dist/assets/fira-code-latin-400-normal-DGosTW8U.woff2 +0 -0
- package/dist/assets/fira-code-latin-500-normal-B6gioGu8.woff2 +0 -0
- package/dist/assets/fira-code-latin-500-normal-aMLC2AMm.woff +0 -0
- package/dist/assets/fira-code-latin-600-normal-BmSSHshu.woff +0 -0
- package/dist/assets/fira-code-latin-600-normal-CvYZpPHg.woff2 +0 -0
- package/dist/assets/fira-code-latin-ext-400-normal-DG73JjOf.woff +0 -0
- package/dist/assets/fira-code-latin-ext-400-normal-KSMg0QLl.woff2 +0 -0
- package/dist/assets/fira-code-latin-ext-500-normal-CaANqXjI.woff +0 -0
- package/dist/assets/fira-code-latin-ext-500-normal-Crd9e_oI.woff2 +0 -0
- package/dist/assets/fira-code-latin-ext-600-normal-0PFQL1eg.woff +0 -0
- package/dist/assets/fira-code-latin-ext-600-normal-Cb7jxoAi.woff2 +0 -0
- package/dist/assets/fira-code-symbols2-400-normal-_QEZCEwe.woff +0 -0
- package/dist/assets/fira-code-symbols2-500-normal-DwsgbIjQ.woff +0 -0
- package/dist/assets/fira-code-symbols2-600-normal-Dvq6IQE5.woff +0 -0
- package/dist/assets/index-B65R3RNc.css +1 -0
- package/dist/assets/index-DV5K3JO8.js +448 -0
- package/dist/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/dist/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dist/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dist/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dist/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/dist/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dist/assets/source-code-pro-cyrillic-400-normal-BxAVGXSA.woff +0 -0
- package/dist/assets/source-code-pro-cyrillic-400-normal-zAQh90eX.woff2 +0 -0
- package/dist/assets/source-code-pro-cyrillic-500-normal-B11lr0U2.woff +0 -0
- package/dist/assets/source-code-pro-cyrillic-500-normal-ByWPmmoj.woff2 +0 -0
- package/dist/assets/source-code-pro-cyrillic-600-normal-BNz7v_mr.woff2 +0 -0
- package/dist/assets/source-code-pro-cyrillic-600-normal-DUFre9N-.woff +0 -0
- package/dist/assets/source-code-pro-cyrillic-ext-400-normal-BlBdefdy.woff +0 -0
- package/dist/assets/source-code-pro-cyrillic-ext-400-normal-DMj7z5uw.woff2 +0 -0
- package/dist/assets/source-code-pro-cyrillic-ext-500-normal-Czknif28.woff +0 -0
- package/dist/assets/source-code-pro-cyrillic-ext-500-normal-tqeAES4j.woff2 +0 -0
- package/dist/assets/source-code-pro-cyrillic-ext-600-normal-Bk2yO1tA.woff2 +0 -0
- package/dist/assets/source-code-pro-cyrillic-ext-600-normal-Dlnx0AYk.woff +0 -0
- package/dist/assets/source-code-pro-greek-400-normal-D-pDoyqc.woff +0 -0
- package/dist/assets/source-code-pro-greek-400-normal-loYmywBR.woff2 +0 -0
- package/dist/assets/source-code-pro-greek-500-normal-C6-i8gwR.woff2 +0 -0
- package/dist/assets/source-code-pro-greek-500-normal-TDi6g5fW.woff +0 -0
- package/dist/assets/source-code-pro-greek-600-normal-D1ll-qYC.woff2 +0 -0
- package/dist/assets/source-code-pro-greek-600-normal-lDQpIXR8.woff +0 -0
- package/dist/assets/source-code-pro-latin-400-normal-Bf_aQirX.woff +0 -0
- package/dist/assets/source-code-pro-latin-400-normal-DEXWLoHG.woff2 +0 -0
- package/dist/assets/source-code-pro-latin-500-normal-DrRT_DWv.woff2 +0 -0
- package/dist/assets/source-code-pro-latin-500-normal-FgltuOLy.woff +0 -0
- package/dist/assets/source-code-pro-latin-600-normal-B5rj6vMs.woff +0 -0
- package/dist/assets/source-code-pro-latin-600-normal-DVVSlvOB.woff2 +0 -0
- package/dist/assets/source-code-pro-latin-ext-400-normal-C8wU-ygL.woff2 +0 -0
- package/dist/assets/source-code-pro-latin-ext-400-normal-GB-6ZST1.woff +0 -0
- package/dist/assets/source-code-pro-latin-ext-500-normal-BCopTyd8.woff +0 -0
- package/dist/assets/source-code-pro-latin-ext-500-normal-DcnsLkKi.woff2 +0 -0
- package/dist/assets/source-code-pro-latin-ext-600-normal-CdOS3fMr.woff +0 -0
- package/dist/assets/source-code-pro-latin-ext-600-normal-kg67jYQv.woff2 +0 -0
- package/dist/assets/source-code-pro-vietnamese-400-normal-CSQ0MR64.woff +0 -0
- package/dist/assets/source-code-pro-vietnamese-400-normal-Cp62Zi-a.woff2 +0 -0
- package/dist/assets/source-code-pro-vietnamese-500-normal-9qef99rm.woff2 +0 -0
- package/dist/assets/source-code-pro-vietnamese-500-normal-Di6EYwJE.woff +0 -0
- package/dist/assets/source-code-pro-vietnamese-600-normal-BG1XwByG.woff +0 -0
- package/dist/assets/source-code-pro-vietnamese-600-normal-CWDSnRUT.woff2 +0 -0
- package/dist/index.html +2 -2
- package/package.json +13 -10
- package/dist/assets/CanvasPanel-DUKhqntE.js +0 -12
- package/dist/assets/index-2y7QFkAm.css +0 -1
- package/dist/assets/index-Ds-rRJgB.js +0 -433
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function r(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();var ds,V,Vv,Jv,Nr,ip,Yv,Xv,Zv,kh,id,cd,Qv,Fl={},eg=[],My=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,hs=Array.isArray;function yn(e,t){for(var r in t)e[r]=t[r];return e}function Sh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Qt(e,t,r){var a,o,l,i={};for(l in t)l=="key"?a=t[l]:l=="ref"?o=t[l]:i[l]=t[l];if(arguments.length>2&&(i.children=arguments.length>3?ds.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(l in e.defaultProps)i[l]===void 0&&(i[l]=e.defaultProps[l]);return sl(e,i,a,o,null)}function sl(e,t,r,a,o){var l={type:e,props:t,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Vv,__i:-1,__u:0};return o==null&&V.vnode!=null&&V.vnode(l),l}function j(e){return e.children}function Ct(e,t){this.props=e,this.context=t}function Va(e,t){if(t==null)return e.__?Va(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Va(e):null}function tg(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return tg(e)}}function ud(e){(!e.__d&&(e.__d=!0)&&Nr.push(e)&&!ji.__r++||ip!=V.debounceRendering)&&((ip=V.debounceRendering)||Yv)(ji)}function ji(){for(var e,t,r,a,o,l,i,c=1;Nr.length;)Nr.length>c&&Nr.sort(Xv),e=Nr.shift(),c=Nr.length,e.__d&&(r=void 0,a=void 0,o=(a=(t=e).__v).__e,l=[],i=[],t.__P&&((r=yn({},a)).__v=a.__v+1,V.vnode&&V.vnode(r),_h(t.__P,r,a,t.__n,t.__P.namespaceURI,32&a.__u?[o]:null,l,o??Va(a),!!(32&a.__u),i),r.__v=a.__v,r.__.__k[r.__i]=r,ag(l,r,i),a.__e=a.__=null,r.__e!=o&&tg(r)));ji.__r=0}function ng(e,t,r,a,o,l,i,c,d,u,h){var f,p,v,w,k,T,y,g=a&&a.__k||eg,b=t.length;for(d=$y(r,t,g,d,b),f=0;f<b;f++)(v=r.__k[f])!=null&&(p=v.__i==-1?Fl:g[v.__i]||Fl,v.__i=f,T=_h(e,v,p,o,l,i,c,d,u,h),w=v.__e,v.ref&&p.ref!=v.ref&&(p.ref&&Ch(p.ref,null,v),h.push(v.ref,v.__c||w,v)),k==null&&w!=null&&(k=w),(y=!!(4&v.__u))||p.__k===v.__k?d=rg(v,d,e,y):typeof v.type=="function"&&T!==void 0?d=T:w&&(d=w.nextSibling),v.__u&=-7);return r.__e=k,d}function $y(e,t,r,a,o){var l,i,c,d,u,h=r.length,f=h,p=0;for(e.__k=new Array(o),l=0;l<o;l++)(i=t[l])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[l]=sl(null,i,null,null,null):hs(i)?i=e.__k[l]=sl(j,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[l]=sl(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[l]=i,d=l+p,i.__=e,i.__b=e.__b+1,c=null,(u=i.__i=Ly(i,r,d,f))!=-1&&(f--,(c=r[u])&&(c.__u|=2)),c==null||c.__v==null?(u==-1&&(o>h?p--:o<h&&p++),typeof i.type!="function"&&(i.__u|=4)):u!=d&&(u==d-1?p--:u==d+1?p++:(u>d?p--:p++,i.__u|=4))):e.__k[l]=null;if(f)for(l=0;l<h;l++)(c=r[l])!=null&&(2&c.__u)==0&&(c.__e==a&&(a=Va(c)),lg(c,c));return a}function rg(e,t,r,a){var o,l;if(typeof e.type=="function"){for(o=e.__k,l=0;o&&l<o.length;l++)o[l]&&(o[l].__=e,t=rg(o[l],t,r,a));return t}e.__e!=t&&(a&&(t&&e.type&&!t.parentNode&&(t=Va(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function na(e,t){return t=t||[],e==null||typeof e=="boolean"||(hs(e)?e.some(function(r){na(r,t)}):t.push(e)),t}function Ly(e,t,r,a){var o,l,i,c=e.key,d=e.type,u=t[r],h=u!=null&&(2&u.__u)==0;if(u===null&&c==null||h&&c==u.key&&d==u.type)return r;if(a>(h?1:0)){for(o=r-1,l=r+1;o>=0||l<t.length;)if((u=t[i=o>=0?o--:l++])!=null&&(2&u.__u)==0&&c==u.key&&d==u.type)return i}return-1}function cp(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||My.test(t)?r:r+"px"}function zs(e,t,r,a,o){var l,i;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof a=="string"&&(e.style.cssText=a=""),a)for(t in a)r&&t in r||cp(e.style,t,"");if(r)for(t in r)a&&r[t]==a[t]||cp(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")l=t!=(t=t.replace(Zv,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+l]=r,r?a?r.u=a.u:(r.u=kh,e.addEventListener(t,l?cd:id,l)):e.removeEventListener(t,l?cd:id,l);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function up(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=kh++;else if(t.t<r.u)return;return r(V.event?V.event(t):t)}}}function _h(e,t,r,a,o,l,i,c,d,u){var h,f,p,v,w,k,T,y,g,b,C,x,_,E,$,I,F,L=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(d=!!(32&r.__u),l=[c=t.__e=r.__e]),(h=V.__b)&&h(t);e:if(typeof L=="function")try{if(y=t.props,g="prototype"in L&&L.prototype.render,b=(h=L.contextType)&&a[h.__c],C=h?b?b.props.value:h.__:a,r.__c?T=(f=t.__c=r.__c).__=f.__E:(g?t.__c=f=new L(y,C):(t.__c=f=new Ct(y,C),f.constructor=L,f.render=Py),b&&b.sub(f),f.state||(f.state={}),f.__n=a,p=f.__d=!0,f.__h=[],f._sb=[]),g&&f.__s==null&&(f.__s=f.state),g&&L.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=yn({},f.__s)),yn(f.__s,L.getDerivedStateFromProps(y,f.__s))),v=f.props,w=f.state,f.__v=t,p)g&&L.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),g&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(g&&L.getDerivedStateFromProps==null&&y!==v&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,C),t.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(y,f.__s,C)===!1){for(t.__v!=r.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(Y){Y&&(Y.__=t)}),x=0;x<f._sb.length;x++)f.__h.push(f._sb[x]);f._sb=[],f.__h.length&&i.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,C),g&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(v,w,k)})}if(f.context=C,f.props=y,f.__P=e,f.__e=!1,_=V.__r,E=0,g){for(f.state=f.__s,f.__d=!1,_&&_(t),h=f.render(f.props,f.state,f.context),$=0;$<f._sb.length;$++)f.__h.push(f._sb[$]);f._sb=[]}else do f.__d=!1,_&&_(t),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++E<25);f.state=f.__s,f.getChildContext!=null&&(a=yn(yn({},a),f.getChildContext())),g&&!p&&f.getSnapshotBeforeUpdate!=null&&(k=f.getSnapshotBeforeUpdate(v,w)),I=h,h!=null&&h.type===j&&h.key==null&&(I=og(h.props.children)),c=ng(e,hs(I)?I:[I],t,r,a,o,l,i,c,d,u),f.base=t.__e,t.__u&=-161,f.__h.length&&i.push(f),T&&(f.__E=f.__=null)}catch(Y){if(t.__v=null,d||l!=null)if(Y.then){for(t.__u|=d?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;l[l.indexOf(c)]=null,t.__e=c}else{for(F=l.length;F--;)Sh(l[F]);dd(t)}else t.__e=r.__e,t.__k=r.__k,Y.then||dd(t);V.__e(Y,t,r)}else l==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):c=t.__e=Dy(r.__e,t,r,a,o,l,i,d,u);return(h=V.diffed)&&h(t),128&t.__u?void 0:c}function dd(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(dd)}function ag(e,t,r){for(var a=0;a<r.length;a++)Ch(r[a],r[++a],r[++a]);V.__c&&V.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(l){l.call(o)})}catch(l){V.__e(l,o.__v)}})}function og(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:hs(e)?e.map(og):yn({},e)}function Dy(e,t,r,a,o,l,i,c,d){var u,h,f,p,v,w,k,T=r.props||Fl,y=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),l!=null){for(u=0;u<l.length;u++)if((v=l[u])&&"setAttribute"in v==!!g&&(g?v.localName==g:v.nodeType==3)){e=v,l[u]=null;break}}if(e==null){if(g==null)return document.createTextNode(y);e=document.createElementNS(o,g,y.is&&y),c&&(V.__m&&V.__m(t,l),c=!1),l=null}if(g==null)T===y||c&&e.data==y||(e.data=y);else{if(l=l&&ds.call(e.childNodes),!c&&l!=null)for(T={},u=0;u<e.attributes.length;u++)T[(v=e.attributes[u]).name]=v.value;for(u in T)if(v=T[u],u!="children"){if(u=="dangerouslySetInnerHTML")f=v;else if(!(u in y)){if(u=="value"&&"defaultValue"in y||u=="checked"&&"defaultChecked"in y)continue;zs(e,u,null,v,o)}}for(u in y)v=y[u],u=="children"?p=v:u=="dangerouslySetInnerHTML"?h=v:u=="value"?w=v:u=="checked"?k=v:c&&typeof v!="function"||T[u]===v||zs(e,u,v,T[u],o);if(h)c||f&&(h.__html==f.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(f&&(e.innerHTML=""),ng(t.type=="template"?e.content:e,hs(p)?p:[p],t,r,a,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,l,i,l?l[0]:r.__k&&Va(r,0),c,d),l!=null)for(u=l.length;u--;)Sh(l[u]);c||(u="value",g=="progress"&&w==null?e.removeAttribute("value"):w!=null&&(w!==e[u]||g=="progress"&&!w||g=="option"&&w!=T[u])&&zs(e,u,w,T[u],o),u="checked",k!=null&&k!=e[u]&&zs(e,u,k,T[u],o))}return e}function Ch(e,t,r){try{if(typeof e=="function"){var a=typeof e.__u=="function";a&&e.__u(),a&&t==null||(e.__u=e(t))}else e.current=t}catch(o){V.__e(o,r)}}function lg(e,t,r){var a,o;if(V.unmount&&V.unmount(e),(a=e.ref)&&(a.current&&a.current!=e.__e||Ch(a,null,t)),(a=e.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(l){V.__e(l,t)}a.base=a.__P=null}if(a=e.__k)for(o=0;o<a.length;o++)a[o]&&lg(a[o],t,r||typeof e.type!="function");r||Sh(e.__e),e.__c=e.__=e.__e=void 0}function Py(e,t,r){return this.constructor(e,r)}function hd(e,t,r){var a,o,l,i;t==document&&(t=document.documentElement),V.__&&V.__(e,t),o=(a=!1)?null:t.__k,l=[],i=[],_h(t,e=t.__k=Qt(j,null,[e]),o||Fl,Fl,t.namespaceURI,o?null:t.firstChild?ds.call(t.childNodes):null,l,o?o.__e:t.firstChild,a,i),ag(l,e,i)}function Oy(e,t,r){var a,o,l,i,c=yn({},e.props);for(l in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),t)l=="key"?a=t[l]:l=="ref"?o=t[l]:c[l]=t[l]===void 0&&i!=null?i[l]:t[l];return arguments.length>2&&(c.children=arguments.length>3?ds.call(arguments,2):r),sl(e.type,c,a||e.key,o||e.ref,null)}function sg(e){function t(r){var a,o;return this.getChildContext||(a=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){a=null},this.shouldComponentUpdate=function(l){this.props.value!=l.value&&a.forEach(function(i){i.__e=!0,ud(i)})},this.sub=function(l){a.add(l);var i=l.componentWillUnmount;l.componentWillUnmount=function(){a&&a.delete(l),i&&i.call(l)}}),r.children}return t.__c="__cC"+Qv++,t.__=e,t.Provider=t.__l=(t.Consumer=function(r,a){return r.children(a)}).contextType=t,t}ds=eg.slice,V={__e:function(e,t,r,a){for(var o,l,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((l=o.constructor)&&l.getDerivedStateFromError!=null&&(o.setState(l.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,a||{}),i=o.__d),i)return o.__E=o}catch(c){e=c}throw e}},Vv=0,Jv=function(e){return e!=null&&e.constructor===void 0},Ct.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=yn({},this.state),typeof e=="function"&&(e=e(yn({},r),this.props)),e&&yn(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),ud(this))},Ct.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ud(this))},Ct.prototype.render=j,Nr=[],Yv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xv=function(e,t){return e.__v.__b-t.__v.__b},ji.__r=0,Zv=/(PointerCapture)$|Capture$/i,kh=0,id=up(!1),cd=up(!0),Qv=0;var Ny=0;function n(e,t,r,a,o,l){t||(t={});var i,c,d=t;if("ref"in d)for(c in d={},t)c=="ref"?i=t[c]:d[c]=t[c];var u={type:e,props:d,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ny,__i:-1,__u:0,__source:o,__self:l};if(typeof e=="function"&&(i=e.defaultProps))for(c in i)d[c]===void 0&&(d[c]=i[c]);return V.vnode&&V.vnode(u),u}const Fy="modulepreload",zy=function(e){return"/"+e},dp={},Bi=function(t,r,a){let o=Promise.resolve();if(r&&r.length>0){let d=function(u){return Promise.all(u.map(h=>Promise.resolve(h).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");o=d(r.map(u=>{if(u=zy(u),u in dp)return;dp[u]=!0;const h=u.endsWith(".css"),f=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=h?"stylesheet":Fy,h||(p.as="script"),p.crossOrigin="",p.href=u,c&&p.setAttribute("nonce",c),document.head.appendChild(p),h)return new Promise((v,w)=>{p.addEventListener("load",v),p.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${u}`)))})}))}function l(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return o.then(i=>{for(const c of i||[])c.status==="rejected"&&l(c.reason);return t().catch(l)})};var ra,fe,Su,hp,zl=0,ig=[],ye=V,fp=ye.__b,pp=ye.__r,mp=ye.diffed,vp=ye.__c,gp=ye.unmount,bp=ye.__;function fs(e,t){ye.__h&&ye.__h(fe,e,zl||t),zl=0;var r=fe.__H||(fe.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function U(e){return zl=1,Uy(dg,e)}function Uy(e,t,r){var a=fs(ra++,2);if(a.t=e,!a.__c&&(a.__=[r?r(t):dg(void 0,t),function(c){var d=a.__N?a.__N[0]:a.__[0],u=a.t(d,c);d!==u&&(a.__N=[u,a.__[1]],a.__c.setState({}))}],a.__c=fe,!fe.__f)){var o=function(c,d,u){if(!a.__c.__H)return!0;var h=a.__c.__H.__.filter(function(p){return!!p.__c});if(h.every(function(p){return!p.__N}))return!l||l.call(this,c,d,u);var f=a.__c.props!==c;return h.forEach(function(p){if(p.__N){var v=p.__[0];p.__=p.__N,p.__N=void 0,v!==p.__[0]&&(f=!0)}}),l&&l.call(this,c,d,u)||f};fe.__f=!0;var l=fe.shouldComponentUpdate,i=fe.componentWillUpdate;fe.componentWillUpdate=function(c,d,u){if(this.__e){var h=l;l=void 0,o(c,d,u),l=h}i&&i.call(this,c,d,u)},fe.shouldComponentUpdate=o}return a.__N||a.__}function R(e,t){var r=fs(ra++,3);!ye.__s&&Eh(r.__H,t)&&(r.__=e,r.u=t,fe.__H.__h.push(r))}function cg(e,t){var r=fs(ra++,4);!ye.__s&&Eh(r.__H,t)&&(r.__=e,r.u=t,fe.__h.push(r))}function B(e){return zl=5,we(function(){return{current:e}},[])}function we(e,t){var r=fs(ra++,7);return Eh(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function ee(e,t){return zl=8,we(function(){return e},t)}function ug(e){var t=fe.context[e.__c],r=fs(ra++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(fe)),t.props.value):e.__}function jy(){for(var e;e=ig.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(mi),e.__H.__h.forEach(fd),e.__H.__h=[]}catch(t){e.__H.__h=[],ye.__e(t,e.__v)}}ye.__b=function(e){fe=null,fp&&fp(e)},ye.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),bp&&bp(e,t)},ye.__r=function(e){pp&&pp(e),ra=0;var t=(fe=e.__c).__H;t&&(Su===fe?(t.__h=[],fe.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(mi),t.__h.forEach(fd),t.__h=[],ra=0)),Su=fe},ye.diffed=function(e){mp&&mp(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ig.push(t)!==1&&hp===ye.requestAnimationFrame||((hp=ye.requestAnimationFrame)||By)(jy)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Su=fe=null},ye.__c=function(e,t){t.some(function(r){try{r.__h.forEach(mi),r.__h=r.__h.filter(function(a){return!a.__||fd(a)})}catch(a){t.some(function(o){o.__h&&(o.__h=[])}),t=[],ye.__e(a,r.__v)}}),vp&&vp(e,t)},ye.unmount=function(e){gp&&gp(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(a){try{mi(a)}catch(o){t=o}}),r.__H=void 0,t&&ye.__e(t,r.__v))};var xp=typeof requestAnimationFrame=="function";function By(e){var t,r=function(){clearTimeout(a),xp&&cancelAnimationFrame(t),setTimeout(e)},a=setTimeout(r,35);xp&&(t=requestAnimationFrame(r))}function mi(e){var t=fe,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),fe=t}function fd(e){var t=fe;e.__c=e.__(),fe=t}function Eh(e,t){return!e||e.length!==t.length||t.some(function(r,a){return r!==e[a]})}function dg(e,t){return typeof t=="function"?t(e):t}var Hy=Symbol.for("preact-signals");function $c(){if(ur>1)ur--;else{for(var e,t=!1;il!==void 0;){var r=il;for(il=void 0,pd++;r!==void 0;){var a=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&pg(r))try{r.c()}catch(o){t||(e=o,t=!0)}r=a}}if(pd=0,ur--,t)throw e}}function Lc(e){if(ur>0)return e();ur++;try{return e()}finally{$c()}}var le=void 0;function hg(e){var t=le;le=void 0;try{return e()}finally{le=t}}var il=void 0,ur=0,pd=0,Hi=0;function fg(e){if(le!==void 0){var t=e.n;if(t===void 0||t.t!==le)return t={i:0,S:e,p:le.s,n:void 0,t:le,e:void 0,x:void 0,r:t},le.s!==void 0&&(le.s.n=t),le.s=t,e.n=t,32&le.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=le.s,t.n=void 0,le.s.n=t,le.s=t),t}}function He(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}He.prototype.brand=Hy;He.prototype.h=function(){return!0};He.prototype.S=function(e){var t=this,r=this.t;r!==e&&e.e===void 0&&(e.x=r,this.t=e,r!==void 0?r.e=e:hg(function(){var a;(a=t.W)==null||a.call(t)}))};He.prototype.U=function(e){var t=this;if(this.t!==void 0){var r=e.e,a=e.x;r!==void 0&&(r.x=a,e.e=void 0),a!==void 0&&(a.e=r,e.x=void 0),e===this.t&&(this.t=a,a===void 0&&hg(function(){var o;(o=t.Z)==null||o.call(t)}))}};He.prototype.subscribe=function(e){var t=this;return $e(function(){var r=t.value,a=le;le=void 0;try{e(r)}finally{le=a}},{name:"sub"})};He.prototype.valueOf=function(){return this.value};He.prototype.toString=function(){return this.value+""};He.prototype.toJSON=function(){return this.value};He.prototype.peek=function(){var e=le;le=void 0;try{return this.value}finally{le=e}};Object.defineProperty(He.prototype,"value",{get:function(){var e=fg(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(pd>100)throw new Error("Cycle detected");this.v=e,this.i++,Hi++,ur++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{$c()}}}});function m(e,t){return new He(e,t)}function pg(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function mg(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function vg(e){for(var t=e.s,r=void 0;t!==void 0;){var a=t.p;t.i===-1?(t.S.U(t),a!==void 0&&(a.n=t.n),t.n!==void 0&&(t.n.p=a)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=a}e.s=r}function fa(e,t){He.call(this,void 0),this.x=e,this.s=void 0,this.g=Hi-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}fa.prototype=new He;fa.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Hi))return!0;if(this.g=Hi,this.f|=1,this.i>0&&!pg(this))return this.f&=-2,!0;var e=le;try{mg(this),le=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return le=e,vg(this),this.f&=-2,!0};fa.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}He.prototype.S.call(this,e)};fa.prototype.U=function(e){if(this.t!==void 0&&(He.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};fa.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(fa.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=fg(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function q(e,t){return new fa(e,t)}function gg(e){var t=e.u;if(e.u=void 0,typeof t=="function"){ur++;var r=le;le=void 0;try{t()}catch(a){throw e.f&=-2,e.f|=8,Th(e),a}finally{le=r,$c()}}}function Th(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,gg(e)}function Wy(e){if(le!==this)throw new Error("Out-of-order effect");vg(this),le=e,this.f&=-2,8&this.f&&Th(this),$c()}function wo(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}wo.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};wo.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,gg(this),mg(this),ur++;var e=le;return le=this,Wy.bind(this,e)};wo.prototype.N=function(){2&this.f||(this.f|=2,this.o=il,il=this)};wo.prototype.d=function(){this.f|=8,1&this.f||Th(this)};wo.prototype.dispose=function(){this.d()};function $e(e,t){var r=new wo(e,t);try{r.c()}catch(o){throw r.d(),o}var a=r.d.bind(r);return a[Symbol.dispose]=a,a}var Ah,Dc,_u,Ky=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,bg=[],xg=[];$e(function(){Ah=this.N})();function ko(e,t){V[e]=t.bind(null,V[e]||function(){})}function Wi(e){_u&&_u(),_u=e&&e.S()}function yg(e){var t=this,r=e.data,a=ne(r);a.value=r;var o=we(function(){for(var c=t,d=t.__v;d=d.__;)if(d.__c){d.__c.__$f|=4;break}var u=q(function(){var v=a.value.value;return v===0?0:v===!0?"":v||""}),h=q(function(){return!Array.isArray(u.value)&&!Jv(u.value)}),f=$e(function(){if(this.N=wg,h.value){var v=u.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=v)}}),p=t.__$u.d;return t.__$u.d=function(){f(),p.call(this)},[h,u]},[]),l=o[0],i=o[1];return l.value?i.peek():i.value}yg.displayName="ReactiveTextNode";Object.defineProperties(He.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:yg},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});ko("__b",function(e,t){if(typeof t.type=="string"){var r,a=t.props;for(var o in a)if(o!=="children"){var l=a[o];l instanceof He&&(r||(t.__np=r={}),r[o]=l,a[o]=l.peek())}}e(t)});ko("__r",function(e,t){if(t.type!==j){Wi();var r,a=t.__c;a&&(a.__$f&=-2,(r=a.__$u)===void 0&&(a.__$u=r=(function(o,l){var i;return $e(function(){i=this},{name:l}),i.c=o,i})(function(){var o;Ky&&((o=r.y)==null||o.call(r)),a.__$f|=1,a.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Dc=a,Wi(r)}e(t)});ko("__e",function(e,t,r,a){Wi(),Dc=void 0,e(t,r,a)});ko("diffed",function(e,t){Wi(),Dc=void 0;var r;if(typeof t.type=="string"&&(r=t.__e)){var a=t.__np,o=t.props;if(a){var l=r.U;if(l)for(var i in l){var c=l[i];c!==void 0&&!(i in a)&&(c.d(),l[i]=void 0)}else l={},r.U=l;for(var d in a){var u=l[d],h=a[d];u===void 0?(u=qy(r,d,h,o),l[d]=u):u.o(h,o)}}}e(t)});function qy(e,t,r,a){var o=t in e&&e.ownerSVGElement===void 0,l=m(r);return{o:function(i,c){l.value=i,a=c},d:$e(function(){this.N=wg;var i=l.value.value;a[t]!==i&&(a[t]=i,o?e[t]=i:i!=null&&(i!==!1||t[4]==="-")?e.setAttribute(t,i):e.removeAttribute(t))})}}ko("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var a=r.U;if(a){r.U=void 0;for(var o in a){var l=a[o];l&&l.d()}}}}else{var i=t.__c;if(i){var c=i.__$u;c&&(i.__$u=void 0,c.d())}}e(t)});ko("__h",function(e,t,r,a){(a<3||a===9)&&(t.__$f|=2),e(t,r,a)});Ct.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var r=this.__$u,a=r&&r.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var l=2&this.__$f;if(!(a||l||4&this.__$f)||1&this.__$f)return!0}else if(!(a||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function ne(e,t){return we(function(){return m(e,t)},[])}function Pc(e,t){var r=B(e);return r.current=e,Dc.__$f|=4,we(function(){return q(function(){return r.current()},t)},[])}var Gy=typeof requestAnimationFrame>"u"?setTimeout:function(e){var t=function(){clearTimeout(r),cancelAnimationFrame(a),e()},r=setTimeout(t,35),a=requestAnimationFrame(t)},Vy=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Jy(){Lc(function(){for(var e;e=bg.shift();)Ah.call(e)})}function Yy(){bg.push(this)===1&&(V.requestAnimationFrame||Gy)(Jy)}function Xy(){Lc(function(){for(var e;e=xg.shift();)Ah.call(e)})}function wg(){xg.push(this)===1&&(V.requestAnimationFrame||Vy)(Xy)}function md(e,t){var r=B(e);r.current=e,R(function(){return $e(function(){return this.N=Yy,r.current()},t)},[])}var Zy={};function Xo(e,t){for(var r in t)e[r]=t[r];return e}function vd(e,t,r){var a,o=/(?:\?([^#]*))?(#.*)?$/,l=e.match(o),i={};if(l&&l[1])for(var c=l[1].split("&"),d=0;d<c.length;d++){var u=c[d].split("=");i[decodeURIComponent(u[0])]=decodeURIComponent(u.slice(1).join("="))}e=gd(e.replace(o,"")),t=gd(t||"");for(var h=Math.max(e.length,t.length),f=0;f<h;f++)if(t[f]&&t[f].charAt(0)===":"){var p=t[f].replace(/(^:|[+*?]+$)/g,""),v=(t[f].match(/[+*?]+$/)||Zy)[0]||"",w=~v.indexOf("+"),k=~v.indexOf("*"),T=e[f]||"";if(!T&&!k&&(v.indexOf("?")<0||w)){a=!1;break}if(i[p]=decodeURIComponent(T),w||k){i[p]=e.slice(f).map(decodeURIComponent).join("/");break}}else if(t[f]!==e[f]){a=!1;break}return(r.default===!0||a!==!1)&&i}function Qy(e,t){return e.rank<t.rank?1:e.rank>t.rank?-1:e.index-t.index}function e0(e,t){return e.index=t,e.rank=(function(r){return r.props.default?0:gd(r.props.path).map(t0).join("")})(e),e.props}function gd(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function t0(e){return e.charAt(0)==":"?1+"*+?".indexOf(e.charAt(e.length-1))||4:5}var n0={},Vr=[],cl=[],yt=null,Ih={url:Oc()},kg=sg(Ih);function r0(){var e=ug(kg);if(e===Ih){var t=U()[1];R(function(){return cl.push(t),function(){return cl.splice(cl.indexOf(t),1)}},[])}return[e,Le]}function Oc(){var e;return""+((e=yt&&yt.location?yt.location:yt&&yt.getCurrentLocation?yt.getCurrentLocation():typeof location<"u"?location:n0).pathname||"")+(e.search||"")}function Le(e,t){return t===void 0&&(t=!1),typeof e!="string"&&e.url&&(t=e.replace,e=e.url),(function(r){for(var a=Vr.length;a--;)if(Vr[a].canRoute(r))return!0;return!1})(e)&&(function(r,a){a===void 0&&(a="push"),yt&&yt[a]?yt[a](r):typeof history<"u"&&history[a+"State"]&&history[a+"State"](null,null,r)})(e,t?"replace":"push"),Sg(e)}function Sg(e){for(var t=!1,r=0;r<Vr.length;r++)Vr[r].routeTo(e)&&(t=!0);return t}function a0(e){if(e&&e.getAttribute){var t=e.getAttribute("href"),r=e.getAttribute("target");if(t&&t.match(/^\//g)&&(!r||r.match(/^_?self$/i)))return Le(t)}}function o0(e){return e.stopImmediatePropagation&&e.stopImmediatePropagation(),e.stopPropagation&&e.stopPropagation(),e.preventDefault(),!1}function _g(e){if(!(e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||e.button)){var t=e.target;do if(t.localName==="a"&&t.getAttribute("href")){if(t.hasAttribute("data-native")||t.hasAttribute("native"))return;if(a0(t))return o0(e)}while(t=t.parentNode)}}var yp=!1;function Cg(e){e.history&&(yt=e.history),this.state={url:e.url||Oc()}}Xo(Cg.prototype=new Ct,{shouldComponentUpdate:function(e){return e.static!==!0||e.url!==this.props.url||e.onChange!==this.props.onChange},canRoute:function(e){var t=na(this.props.children);return this.g(t,e)!==void 0},routeTo:function(e){this.setState({url:e});var t=this.canRoute(e);return this.p||this.forceUpdate(),t},componentWillMount:function(){this.p=!0},componentDidMount:function(){var e=this;yp||(yp=!0,yt||addEventListener("popstate",function(){Sg(Oc())}),addEventListener("click",_g)),Vr.push(this),yt&&(this.u=yt.listen(function(t){var r=t.location||t;e.routeTo(""+(r.pathname||"")+(r.search||""))})),this.p=!1},componentWillUnmount:function(){typeof this.u=="function"&&this.u(),Vr.splice(Vr.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(e,t){e=e.filter(e0).sort(Qy);for(var r=0;r<e.length;r++){var a=e[r],o=vd(t,a.props.path,a.props);if(o)return[a,o]}},render:function(e,t){var r,a,o=e.onChange,l=t.url,i=this.c,c=this.g(na(e.children),l);if(c&&(a=Oy(c[0],Xo(Xo({url:l,matches:r=c[1]},r),{key:void 0,ref:void 0}))),l!==(i&&i.url)){Xo(Ih,i=this.c={url:l,previous:i&&i.url,current:a,path:a?a.props.path:null,matches:r}),i.router=this,i.active=a?[a]:[];for(var d=cl.length;d--;)cl[d]({});typeof o=="function"&&o(i)}return Qt(kg.Provider,{value:i},a)}});var l0=function(e){return Qt("a",Xo({onClick:_g},e))};const wp={selected:"system",lightTheme:"light",darkTheme:"dark"},s0={id:"light",name:"Light",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#ffffff","--color-bg-secondary":"#f1f5f9","--color-bg-tertiary":"#e2e8f0","--color-bg-surface":"#f8fafc","--color-bg-elevated":"#ffffff","--color-bg-hover":"#f1f5f9","--color-bg-active":"#e2e8f0","--color-text-primary":"#0f172a","--color-text-secondary":"#475569","--color-text-tertiary":"#64748b","--color-text-muted":"#94a3b8","--color-text-inverse":"#f8fafc","--color-accent":"#e11d48","--color-accent-hover":"#be123c","--color-accent-active":"#9f1239","--color-accent-muted":"#ffe4e6","--color-accent-text":"#ffffff","--color-success":"#16a34a","--color-success-muted":"#dcfce7","--color-warning":"#d97706","--color-warning-muted":"#fef3c7","--color-error":"#dc2626","--color-error-muted":"#fee2e2","--color-info":"#0284c7","--color-info-muted":"#e0f2fe","--color-border":"#e2e8f0","--color-border-hover":"#cbd5e1","--color-border-focus":"#e11d48","--shadow-sm":"0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.12), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#a0a1a7","--color-syntax-string":"#50a14f","--color-syntax-keyword":"#a626a4","--color-syntax-function":"#4078f2","--color-syntax-number":"#986801","--color-syntax-operator":"#0184bc","--color-syntax-variable":"#e45649","--color-syntax-punctuation":"#383a42","--color-syntax-property":"#e45649","--color-syntax-tag":"#e45649","--color-syntax-class":"#c18401"}},i0={id:"dark",name:"Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#0f0f12","--color-bg-secondary":"#0a0a0c","--color-bg-tertiary":"#161619","--color-bg-surface":"#1a1a1f","--color-bg-elevated":"#222228","--color-bg-hover":"#2a2a32","--color-bg-active":"#363640","--color-text-primary":"#f4f4f5","--color-text-secondary":"#a1a1aa","--color-text-tertiary":"#71717a","--color-text-muted":"#52525b","--color-text-inverse":"#09090b","--color-accent":"#f97066","--color-accent-hover":"#ef5a50","--color-accent-active":"#dc4840","--color-accent-muted":"#5c2320","--color-accent-text":"#ffffff","--color-success":"#22c55e","--color-success-muted":"#14532d","--color-warning":"#f59e0b","--color-warning-muted":"#451a03","--color-error":"#f43f5e","--color-error-muted":"#4c0519","--color-info":"#38bdf8","--color-info-muted":"#0c4a6e","--color-border":"#252530","--color-border-hover":"#3f3f4a","--color-border-focus":"#f97066","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#5c6370","--color-syntax-string":"#98c379","--color-syntax-keyword":"#c678dd","--color-syntax-function":"#61afef","--color-syntax-number":"#d19a66","--color-syntax-operator":"#56b6c2","--color-syntax-variable":"#e06c75","--color-syntax-punctuation":"#abb2bf","--color-syntax-property":"#e06c75","--color-syntax-tag":"#e06c75","--color-syntax-class":"#e5c07b"}},c0={id:"dracula",name:"Dracula",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#282a36","--color-bg-secondary":"#1e1f29","--color-bg-tertiary":"#191a23","--color-bg-surface":"#343746","--color-bg-elevated":"#44475a","--color-bg-hover":"#3c3f52","--color-bg-active":"#44475a","--color-text-primary":"#f8f8f2","--color-text-secondary":"#e6e6e0","--color-text-tertiary":"#bfbfb8","--color-text-muted":"#6272a4","--color-text-inverse":"#282a36","--color-accent":"#bd93f9","--color-accent-hover":"#caa9fa","--color-accent-active":"#a67bf5","--color-accent-muted":"#3d3560","--color-accent-text":"#282a36","--color-success":"#50fa7b","--color-success-muted":"#1f3528","--color-warning":"#f1fa8c","--color-warning-muted":"#35351f","--color-error":"#ff5555","--color-error-muted":"#402020","--color-info":"#8be9fd","--color-info-muted":"#1f3538","--color-border":"#44475a","--color-border-hover":"#565970","--color-border-focus":"#bd93f9","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#6272a4","--color-syntax-string":"#f1fa8c","--color-syntax-keyword":"#ff79c6","--color-syntax-function":"#50fa7b","--color-syntax-number":"#bd93f9","--color-syntax-operator":"#ff79c6","--color-syntax-variable":"#f8f8f2","--color-syntax-punctuation":"#f8f8f2","--color-syntax-property":"#66d9ef","--color-syntax-tag":"#ff79c6","--color-syntax-class":"#8be9fd"}},u0={id:"catppuccin-mocha",name:"Catppuccin Mocha",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#1e1e2e","--color-bg-secondary":"#11111b","--color-bg-tertiary":"#181825","--color-bg-surface":"#313244","--color-bg-elevated":"#45475a","--color-bg-hover":"#313244","--color-bg-active":"#45475a","--color-text-primary":"#cdd6f4","--color-text-secondary":"#bac2de","--color-text-tertiary":"#a6adc8","--color-text-muted":"#6c7086","--color-text-inverse":"#1e1e2e","--color-accent":"#f5c2e7","--color-accent-hover":"#f5e0dc","--color-accent-active":"#cba6f7","--color-accent-muted":"#3d2d40","--color-accent-text":"#1e1e2e","--color-success":"#a6e3a1","--color-success-muted":"#243028","--color-warning":"#f9e2af","--color-warning-muted":"#382f20","--color-error":"#f38ba8","--color-error-muted":"#3d2430","--color-info":"#89dceb","--color-info-muted":"#203035","--color-border":"#45475a","--color-border-hover":"#585b70","--color-border-focus":"#f5c2e7","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.35)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.45), 0 2px 4px -2px rgb(0 0 0 / 0.45)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.55), 0 4px 6px -4px rgb(0 0 0 / 0.55)","--color-syntax-comment":"#6c7086","--color-syntax-string":"#a6e3a1","--color-syntax-keyword":"#cba6f7","--color-syntax-function":"#89b4fa","--color-syntax-number":"#fab387","--color-syntax-operator":"#89dceb","--color-syntax-variable":"#f38ba8","--color-syntax-punctuation":"#cdd6f4","--color-syntax-property":"#f5c2e7","--color-syntax-tag":"#cba6f7","--color-syntax-class":"#f9e2af"}},d0={id:"catppuccin-latte",name:"Catppuccin Latte",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#eff1f5","--color-bg-secondary":"#dce0e8","--color-bg-tertiary":"#e6e9ef","--color-bg-surface":"#ffffff","--color-bg-elevated":"#ffffff","--color-bg-hover":"#e6e9ef","--color-bg-active":"#ccd0da","--color-text-primary":"#4c4f69","--color-text-secondary":"#5c5f77","--color-text-tertiary":"#6c6f85","--color-text-muted":"#9ca0b0","--color-text-inverse":"#eff1f5","--color-accent":"#ea76cb","--color-accent-hover":"#d65db1","--color-accent-active":"#8839ef","--color-accent-muted":"#f5e0f0","--color-accent-text":"#ffffff","--color-success":"#40a02b","--color-success-muted":"#d8f0d0","--color-warning":"#df8e1d","--color-warning-muted":"#f9ecd0","--color-error":"#d20f39","--color-error-muted":"#f9d5dd","--color-info":"#04a5e5","--color-info-muted":"#d0f0f9","--color-border":"#ccd0da","--color-border-hover":"#bcc0cc","--color-border-focus":"#ea76cb","--shadow-sm":"0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08)","--color-syntax-comment":"#9ca0b0","--color-syntax-string":"#40a02b","--color-syntax-keyword":"#8839ef","--color-syntax-function":"#1e66f5","--color-syntax-number":"#fe640b","--color-syntax-operator":"#04a5e5","--color-syntax-variable":"#d20f39","--color-syntax-punctuation":"#4c4f69","--color-syntax-property":"#ea76cb","--color-syntax-tag":"#8839ef","--color-syntax-class":"#df8e1d"}},h0={id:"nord",name:"Nord",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#2e3440","--color-bg-secondary":"#242933","--color-bg-tertiary":"#1f232b","--color-bg-surface":"#3b4252","--color-bg-elevated":"#434c5e","--color-bg-hover":"#3b4252","--color-bg-active":"#4c566a","--color-text-primary":"#eceff4","--color-text-secondary":"#e5e9f0","--color-text-tertiary":"#d8dee9","--color-text-muted":"#616e88","--color-text-inverse":"#2e3440","--color-accent":"#8fbcbb","--color-accent-hover":"#88c0d0","--color-accent-active":"#81a1c1","--color-accent-muted":"#304048","--color-accent-text":"#2e3440","--color-success":"#a3be8c","--color-success-muted":"#2e3d2e","--color-warning":"#ebcb8b","--color-warning-muted":"#3d3828","--color-error":"#bf616a","--color-error-muted":"#3d2830","--color-info":"#81a1c1","--color-info-muted":"#283040","--color-border":"#3b4252","--color-border-hover":"#4c566a","--color-border-focus":"#8fbcbb","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.3)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5)","--color-syntax-comment":"#616e88","--color-syntax-string":"#a3be8c","--color-syntax-keyword":"#81a1c1","--color-syntax-function":"#88c0d0","--color-syntax-number":"#b48ead","--color-syntax-operator":"#81a1c1","--color-syntax-variable":"#d8dee9","--color-syntax-punctuation":"#eceff4","--color-syntax-property":"#8fbcbb","--color-syntax-tag":"#81a1c1","--color-syntax-class":"#8fbcbb"}},f0={id:"gruvbox-dark",name:"Gruvbox Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#282828","--color-bg-secondary":"#1d2021","--color-bg-tertiary":"#32302f","--color-bg-surface":"#3c3836","--color-bg-elevated":"#504945","--color-bg-hover":"#504945","--color-bg-active":"#665c54","--color-text-primary":"#ebdbb2","--color-text-secondary":"#d5c4a1","--color-text-tertiary":"#bdae93","--color-text-muted":"#928374","--color-text-inverse":"#282828","--color-accent":"#fe8019","--color-accent-hover":"#d65d0e","--color-accent-active":"#af3a03","--color-accent-muted":"#4a3526","--color-accent-text":"#282828","--color-success":"#b8bb26","--color-success-muted":"#3d4220","--color-warning":"#fabd2f","--color-warning-muted":"#4a4020","--color-error":"#fb4934","--color-error-muted":"#4a2520","--color-info":"#83a598","--color-info-muted":"#2a3a38","--color-border":"#504945","--color-border-hover":"#665c54","--color-border-focus":"#fe8019","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#928374","--color-syntax-string":"#b8bb26","--color-syntax-keyword":"#fb4934","--color-syntax-function":"#b8bb26","--color-syntax-number":"#d3869b","--color-syntax-operator":"#fe8019","--color-syntax-variable":"#83a598","--color-syntax-punctuation":"#ebdbb2","--color-syntax-property":"#8ec07c","--color-syntax-tag":"#fb4934","--color-syntax-class":"#fabd2f"}},p0={id:"gruvbox-light",name:"Gruvbox Light",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#fbf1c7","--color-bg-secondary":"#f2e5bc","--color-bg-tertiary":"#ebdbb2","--color-bg-surface":"#f9f5d7","--color-bg-elevated":"#ffffff","--color-bg-hover":"#ebdbb2","--color-bg-active":"#d5c4a1","--color-text-primary":"#3c3836","--color-text-secondary":"#504945","--color-text-tertiary":"#665c54","--color-text-muted":"#928374","--color-text-inverse":"#fbf1c7","--color-accent":"#d65d0e","--color-accent-hover":"#af3a03","--color-accent-active":"#8f3000","--color-accent-muted":"#f0d8c0","--color-accent-text":"#fbf1c7","--color-success":"#79740e","--color-success-muted":"#e8ecc8","--color-warning":"#b57614","--color-warning-muted":"#f5e6c8","--color-error":"#9d0006","--color-error-muted":"#f5d0c8","--color-info":"#076678","--color-info-muted":"#c8e8f0","--color-border":"#d5c4a1","--color-border-hover":"#bdae93","--color-border-focus":"#d65d0e","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#928374","--color-syntax-string":"#79740e","--color-syntax-keyword":"#9d0006","--color-syntax-function":"#79740e","--color-syntax-number":"#8f3f71","--color-syntax-operator":"#af3a03","--color-syntax-variable":"#076678","--color-syntax-punctuation":"#3c3836","--color-syntax-property":"#427b58","--color-syntax-tag":"#9d0006","--color-syntax-class":"#b57614"}},m0={id:"solarized-dark",name:"Solarized Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#002b36","--color-bg-secondary":"#00212b","--color-bg-tertiary":"#073642","--color-bg-surface":"#073642","--color-bg-elevated":"#094552","--color-bg-hover":"#094552","--color-bg-active":"#0a5565","--color-text-primary":"#839496","--color-text-secondary":"#93a1a1","--color-text-tertiary":"#657b83","--color-text-muted":"#586e75","--color-text-inverse":"#002b36","--color-accent":"#268bd2","--color-accent-hover":"#1a7cc4","--color-accent-active":"#1569a8","--color-accent-muted":"#0a3a52","--color-accent-text":"#fdf6e3","--color-success":"#859900","--color-success-muted":"#2a3a20","--color-warning":"#b58900","--color-warning-muted":"#3a3520","--color-error":"#dc322f","--color-error-muted":"#3a2020","--color-info":"#2aa198","--color-info-muted":"#1a3a38","--color-border":"#073642","--color-border-hover":"#094552","--color-border-focus":"#268bd2","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#586e75","--color-syntax-string":"#2aa198","--color-syntax-keyword":"#859900","--color-syntax-function":"#268bd2","--color-syntax-number":"#d33682","--color-syntax-operator":"#859900","--color-syntax-variable":"#b58900","--color-syntax-punctuation":"#839496","--color-syntax-property":"#268bd2","--color-syntax-tag":"#cb4b16","--color-syntax-class":"#cb4b16"}},v0={id:"solarized-light",name:"Solarized Light",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#fdf6e3","--color-bg-secondary":"#eee8d5","--color-bg-tertiary":"#e8e2cf","--color-bg-surface":"#ffffff","--color-bg-elevated":"#ffffff","--color-bg-hover":"#eee8d5","--color-bg-active":"#e0dac8","--color-text-primary":"#657b83","--color-text-secondary":"#586e75","--color-text-tertiary":"#839496","--color-text-muted":"#93a1a1","--color-text-inverse":"#fdf6e3","--color-accent":"#268bd2","--color-accent-hover":"#1a7cc4","--color-accent-active":"#1569a8","--color-accent-muted":"#d0e8f5","--color-accent-text":"#fdf6e3","--color-success":"#859900","--color-success-muted":"#e8f0c8","--color-warning":"#b58900","--color-warning-muted":"#f5ecc8","--color-error":"#dc322f","--color-error-muted":"#f5d0d0","--color-info":"#2aa198","--color-info-muted":"#c8f0ec","--color-border":"#eee8d5","--color-border-hover":"#ddd8c5","--color-border-focus":"#268bd2","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#93a1a1","--color-syntax-string":"#2aa198","--color-syntax-keyword":"#859900","--color-syntax-function":"#268bd2","--color-syntax-number":"#d33682","--color-syntax-operator":"#859900","--color-syntax-variable":"#b58900","--color-syntax-punctuation":"#657b83","--color-syntax-property":"#268bd2","--color-syntax-tag":"#cb4b16","--color-syntax-class":"#cb4b16"}},g0={id:"one-dark",name:"One Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#282c34","--color-bg-secondary":"#21252b","--color-bg-tertiary":"#2c313a","--color-bg-surface":"#3a3f4b","--color-bg-elevated":"#3e4451","--color-bg-hover":"#3a3f4b","--color-bg-active":"#4b5263","--color-text-primary":"#abb2bf","--color-text-secondary":"#9da5b4","--color-text-tertiary":"#7f848e","--color-text-muted":"#5c6370","--color-text-inverse":"#282c34","--color-accent":"#61afef","--color-accent-hover":"#528bcc","--color-accent-active":"#4678a8","--color-accent-muted":"#2a3a48","--color-accent-text":"#282c34","--color-success":"#98c379","--color-success-muted":"#2a3a28","--color-warning":"#e5c07b","--color-warning-muted":"#3a3828","--color-error":"#e06c75","--color-error-muted":"#3a2828","--color-info":"#56b6c2","--color-info-muted":"#203a3a","--color-border":"#3a3f4b","--color-border-hover":"#4b5263","--color-border-focus":"#61afef","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#5c6370","--color-syntax-string":"#98c379","--color-syntax-keyword":"#c678dd","--color-syntax-function":"#61afef","--color-syntax-number":"#d19a66","--color-syntax-operator":"#56b6c2","--color-syntax-variable":"#e06c75","--color-syntax-punctuation":"#abb2bf","--color-syntax-property":"#e06c75","--color-syntax-tag":"#e06c75","--color-syntax-class":"#e5c07b"}},b0={id:"tokyo-night",name:"Tokyo Night",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#1a1b26","--color-bg-secondary":"#16161e","--color-bg-tertiary":"#1f2335","--color-bg-surface":"#24283b","--color-bg-elevated":"#292e42","--color-bg-hover":"#292e42","--color-bg-active":"#33384d","--color-text-primary":"#c0caf5","--color-text-secondary":"#a9b1d6","--color-text-tertiary":"#787c99","--color-text-muted":"#565f89","--color-text-inverse":"#1a1b26","--color-accent":"#bb9af7","--color-accent-hover":"#9d7cd8","--color-accent-active":"#7c5dc0","--color-accent-muted":"#3d3560","--color-accent-text":"#1a1b26","--color-success":"#9ece6a","--color-success-muted":"#2a3a25","--color-warning":"#e0af68","--color-warning-muted":"#3a3525","--color-error":"#f7768e","--color-error-muted":"#3a2530","--color-info":"#7dcfff","--color-info-muted":"#1a3545","--color-border":"#292e42","--color-border-hover":"#3b4261","--color-border-focus":"#bb9af7","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#565f89","--color-syntax-string":"#9ece6a","--color-syntax-keyword":"#bb9af7","--color-syntax-function":"#7aa2f7","--color-syntax-number":"#ff9e64","--color-syntax-operator":"#89ddff","--color-syntax-variable":"#c0caf5","--color-syntax-punctuation":"#c0caf5","--color-syntax-property":"#73daca","--color-syntax-tag":"#f7768e","--color-syntax-class":"#e0af68"}},x0={id:"tokyo-night-day",name:"Tokyo Night Day",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#e1e2e7","--color-bg-secondary":"#d5d6db","--color-bg-tertiary":"#c8c9ce","--color-bg-surface":"#ffffff","--color-bg-elevated":"#ffffff","--color-bg-hover":"#d5d6db","--color-bg-active":"#c8c9ce","--color-text-primary":"#3760bf","--color-text-secondary":"#4c6bc0","--color-text-tertiary":"#6172b0","--color-text-muted":"#8990b3","--color-text-inverse":"#e1e2e7","--color-accent":"#9854f1","--color-accent-hover":"#7847c4","--color-accent-active":"#5d38a0","--color-accent-muted":"#e8dff8","--color-accent-text":"#ffffff","--color-success":"#587539","--color-success-muted":"#e0f0d0","--color-warning":"#8c6c3e","--color-warning-muted":"#f5ecd0","--color-error":"#f52a65","--color-error-muted":"#fdd8e0","--color-info":"#007197","--color-info-muted":"#d0f0f8","--color-border":"#c8c9ce","--color-border-hover":"#b8b9be","--color-border-focus":"#9854f1","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#8990b3","--color-syntax-string":"#587539","--color-syntax-keyword":"#9854f1","--color-syntax-function":"#2e7de9","--color-syntax-number":"#b15c00","--color-syntax-operator":"#006a83","--color-syntax-variable":"#3760bf","--color-syntax-punctuation":"#3760bf","--color-syntax-property":"#118c74","--color-syntax-tag":"#f52a65","--color-syntax-class":"#8c6c3e"}},y0={id:"rose-pine",name:"Rosé Pine",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#191724","--color-bg-secondary":"#1f1d2e","--color-bg-tertiary":"#21202e","--color-bg-surface":"#26233a","--color-bg-elevated":"#2a283e","--color-bg-hover":"#2a283e","--color-bg-active":"#393552","--color-text-primary":"#e0def4","--color-text-secondary":"#c4a7e7","--color-text-tertiary":"#908caa","--color-text-muted":"#6e6a86","--color-text-inverse":"#191724","--color-accent":"#ebbcba","--color-accent-hover":"#d4a5a5","--color-accent-active":"#c09090","--color-accent-muted":"#3a3040","--color-accent-text":"#191724","--color-success":"#9ccfd8","--color-success-muted":"#253540","--color-warning":"#f6c177","--color-warning-muted":"#3a3528","--color-error":"#eb6f92","--color-error-muted":"#3a2535","--color-info":"#31748f","--color-info-muted":"#1a2a35","--color-border":"#26233a","--color-border-hover":"#393552","--color-border-focus":"#ebbcba","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#6e6a86","--color-syntax-string":"#f6c177","--color-syntax-keyword":"#31748f","--color-syntax-function":"#ebbcba","--color-syntax-number":"#eb6f92","--color-syntax-operator":"#9ccfd8","--color-syntax-variable":"#e0def4","--color-syntax-punctuation":"#908caa","--color-syntax-property":"#c4a7e7","--color-syntax-tag":"#eb6f92","--color-syntax-class":"#9ccfd8"}},w0={id:"rose-pine-moon",name:"Rosé Pine Moon",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#232136","--color-bg-secondary":"#2a273f","--color-bg-tertiary":"#2d2a45","--color-bg-surface":"#393552","--color-bg-elevated":"#3e3a58","--color-bg-hover":"#3e3a58","--color-bg-active":"#44415a","--color-text-primary":"#e0def4","--color-text-secondary":"#c4a7e7","--color-text-tertiary":"#908caa","--color-text-muted":"#6e6a86","--color-text-inverse":"#232136","--color-accent":"#ea9a97","--color-accent-hover":"#d48580","--color-accent-active":"#c07570","--color-accent-muted":"#3a3040","--color-accent-text":"#232136","--color-success":"#9ccfd8","--color-success-muted":"#2a3540","--color-warning":"#f6c177","--color-warning-muted":"#3a3528","--color-error":"#eb6f92","--color-error-muted":"#3a2535","--color-info":"#3e8fb0","--color-info-muted":"#1a2a38","--color-border":"#393552","--color-border-hover":"#44415a","--color-border-focus":"#ea9a97","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#6e6a86","--color-syntax-string":"#f6c177","--color-syntax-keyword":"#3e8fb0","--color-syntax-function":"#ea9a97","--color-syntax-number":"#eb6f92","--color-syntax-operator":"#9ccfd8","--color-syntax-variable":"#e0def4","--color-syntax-punctuation":"#908caa","--color-syntax-property":"#c4a7e7","--color-syntax-tag":"#eb6f92","--color-syntax-class":"#9ccfd8"}},k0={id:"rose-pine-dawn",name:"Rosé Pine Dawn",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#faf4ed","--color-bg-secondary":"#f2e9e1","--color-bg-tertiary":"#e4dfde","--color-bg-surface":"#fffaf3","--color-bg-elevated":"#ffffff","--color-bg-hover":"#f2e9e1","--color-bg-active":"#e4dfde","--color-text-primary":"#575279","--color-text-secondary":"#797593","--color-text-tertiary":"#9893a5","--color-text-muted":"#b4b0c3","--color-text-inverse":"#faf4ed","--color-accent":"#d7827e","--color-accent-hover":"#c46865","--color-accent-active":"#b05550","--color-accent-muted":"#fae8e8","--color-accent-text":"#faf4ed","--color-success":"#56949f","--color-success-muted":"#e0f0f0","--color-warning":"#ea9d34","--color-warning-muted":"#faf0d8","--color-error":"#b4637a","--color-error-muted":"#f8e0e8","--color-info":"#286983","--color-info-muted":"#d8f0f8","--color-border":"#e4dfde","--color-border-hover":"#d5d0ce","--color-border-focus":"#d7827e","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#9893a5","--color-syntax-string":"#ea9d34","--color-syntax-keyword":"#286983","--color-syntax-function":"#d7827e","--color-syntax-number":"#b4637a","--color-syntax-operator":"#56949f","--color-syntax-variable":"#575279","--color-syntax-punctuation":"#797593","--color-syntax-property":"#907aa9","--color-syntax-tag":"#b4637a","--color-syntax-class":"#56949f"}},S0={id:"github-dark",name:"GitHub Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#0d1117","--color-bg-secondary":"#010409","--color-bg-tertiary":"#161b22","--color-bg-surface":"#21262d","--color-bg-elevated":"#30363d","--color-bg-hover":"#21262d","--color-bg-active":"#30363d","--color-text-primary":"#e6edf3","--color-text-secondary":"#c9d1d9","--color-text-tertiary":"#8b949e","--color-text-muted":"#6e7681","--color-text-inverse":"#0d1117","--color-accent":"#58a6ff","--color-accent-hover":"#388bfd","--color-accent-active":"#1f6feb","--color-accent-muted":"#1a3050","--color-accent-text":"#ffffff","--color-success":"#3fb950","--color-success-muted":"#1a3020","--color-warning":"#d29922","--color-warning-muted":"#3a3020","--color-error":"#f85149","--color-error-muted":"#3a2020","--color-info":"#58a6ff","--color-info-muted":"#1a3050","--color-border":"#30363d","--color-border-hover":"#484f58","--color-border-focus":"#58a6ff","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#8b949e","--color-syntax-string":"#a5d6ff","--color-syntax-keyword":"#ff7b72","--color-syntax-function":"#d2a8ff","--color-syntax-number":"#79c0ff","--color-syntax-operator":"#ff7b72","--color-syntax-variable":"#ffa657","--color-syntax-punctuation":"#c9d1d9","--color-syntax-property":"#7ee787","--color-syntax-tag":"#7ee787","--color-syntax-class":"#ffa657"}},_0={id:"github-light",name:"GitHub Light",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#ffffff","--color-bg-secondary":"#f6f8fa","--color-bg-tertiary":"#eaeef2","--color-bg-surface":"#ffffff","--color-bg-elevated":"#ffffff","--color-bg-hover":"#f3f4f6","--color-bg-active":"#eaeef2","--color-text-primary":"#1f2328","--color-text-secondary":"#424a53","--color-text-tertiary":"#656d76","--color-text-muted":"#8c959f","--color-text-inverse":"#ffffff","--color-accent":"#0969da","--color-accent-hover":"#0860ca","--color-accent-active":"#0550ae","--color-accent-muted":"#ddf4ff","--color-accent-text":"#ffffff","--color-success":"#1a7f37","--color-success-muted":"#dafbe1","--color-warning":"#9a6700","--color-warning-muted":"#fff8c5","--color-error":"#cf222e","--color-error-muted":"#ffebe9","--color-info":"#0969da","--color-info-muted":"#ddf4ff","--color-border":"#d0d7de","--color-border-hover":"#afb8c1","--color-border-focus":"#0969da","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#6e7781","--color-syntax-string":"#0a3069","--color-syntax-keyword":"#cf222e","--color-syntax-function":"#8250df","--color-syntax-number":"#0550ae","--color-syntax-operator":"#cf222e","--color-syntax-variable":"#953800","--color-syntax-punctuation":"#1f2328","--color-syntax-property":"#116329","--color-syntax-tag":"#116329","--color-syntax-class":"#953800"}},C0={id:"github-dimmed",name:"GitHub Dimmed",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#22272e","--color-bg-secondary":"#1c2128","--color-bg-tertiary":"#2d333b","--color-bg-surface":"#373e47","--color-bg-elevated":"#444c56","--color-bg-hover":"#2d333b","--color-bg-active":"#373e47","--color-text-primary":"#adbac7","--color-text-secondary":"#909dab","--color-text-tertiary":"#768390","--color-text-muted":"#636e7b","--color-text-inverse":"#22272e","--color-accent":"#539bf5","--color-accent-hover":"#4184e4","--color-accent-active":"#316dca","--color-accent-muted":"#1a3050","--color-accent-text":"#ffffff","--color-success":"#57ab5a","--color-success-muted":"#1a3020","--color-warning":"#c69026","--color-warning-muted":"#3a3020","--color-error":"#e5534b","--color-error-muted":"#3a2020","--color-info":"#539bf5","--color-info-muted":"#1a3050","--color-border":"#444c56","--color-border-hover":"#545d68","--color-border-focus":"#539bf5","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#768390","--color-syntax-string":"#96d0ff","--color-syntax-keyword":"#f47067","--color-syntax-function":"#dcbdfb","--color-syntax-number":"#6cb6ff","--color-syntax-operator":"#f47067","--color-syntax-variable":"#f69d50","--color-syntax-punctuation":"#adbac7","--color-syntax-property":"#8ddb8c","--color-syntax-tag":"#8ddb8c","--color-syntax-class":"#f69d50"}},E0={id:"monokai",name:"Monokai",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#272822","--color-bg-secondary":"#1e1f1c","--color-bg-tertiary":"#2d2e27","--color-bg-surface":"#3e3d32","--color-bg-elevated":"#49483e","--color-bg-hover":"#3e3d32","--color-bg-active":"#49483e","--color-text-primary":"#f8f8f2","--color-text-secondary":"#e6e6e0","--color-text-tertiary":"#b8b8b0","--color-text-muted":"#75715e","--color-text-inverse":"#272822","--color-accent":"#f92672","--color-accent-hover":"#e01f65","--color-accent-active":"#c01a58","--color-accent-muted":"#402030","--color-accent-text":"#ffffff","--color-success":"#a6e22e","--color-success-muted":"#2a3a20","--color-warning":"#e6db74","--color-warning-muted":"#3a3a25","--color-error":"#f92672","--color-error-muted":"#402030","--color-info":"#66d9ef","--color-info-muted":"#203540","--color-border":"#49483e","--color-border-hover":"#5a5950","--color-border-focus":"#f92672","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#75715e","--color-syntax-string":"#e6db74","--color-syntax-keyword":"#f92672","--color-syntax-function":"#a6e22e","--color-syntax-number":"#ae81ff","--color-syntax-operator":"#f92672","--color-syntax-variable":"#f8f8f2","--color-syntax-punctuation":"#f8f8f2","--color-syntax-property":"#66d9ef","--color-syntax-tag":"#f92672","--color-syntax-class":"#a6e22e"}},Eg=[s0,i0,c0,g0,E0,b0,h0,u0,d0,y0,w0,k0,f0,p0,m0,v0,S0,_0,C0,x0],T0=new Map(Eg.map(e=>[e.id,e]));function Us(e,t=[]){return T0.get(e)??t.find(r=>r.id===e)}const Rh="cove:",kp=1;function xe(e){try{const t=localStorage.getItem(Rh+e);return t===null?null:JSON.parse(t)}catch{return null}}function Se(e,t){try{localStorage.setItem(Rh+e,JSON.stringify(t))}catch{}}function Ki(e){localStorage.removeItem(Rh+e)}const Mh="cove:session-auth";function Nc(){const e=xe("auth");return e?(e.credential&&($h({...e,credential:void 0}),Lh(e.credential)),e):null}function $h(e){const t={url:e.url,authMode:e.authMode,rememberMe:e.rememberMe};Se("auth",t),e.credential&&(e.rememberMe?(Se("credential",e.credential),Tg()):(Lh(e.credential),Ki("credential")))}function A0(){Ki("auth"),Ki("credential"),Tg()}function Lh(e){try{sessionStorage.setItem(Mh,JSON.stringify({credential:e}))}catch{}}function Dh(){try{const e=xe("credential");if(e)return e;const t=sessionStorage.getItem(Mh);return t&&JSON.parse(t).credential||null}catch{return null}}function Tg(){try{sessionStorage.removeItem(Mh)}catch{}}function I0(){return xe("hasCompletedOnboarding")??!1}function Sp(){Se("hasCompletedOnboarding",!0)}function R0(e){Se("pendingTour",e)}function M0(){const e=xe("pendingTour")??!1;return e&&Ki("pendingTour"),e}const Fc={timeFormat:"relative",fontSize:"md",fontFamily:"geist",sidebarWidth:280};function $0(){return xe("time-format")??Fc.timeFormat}function L0(e){Se("time-format",e)}function D0(){return xe("font-size")??Fc.fontSize}function P0(e){Se("font-size",e)}function O0(){return xe("font-family")??Fc.fontFamily}function N0(e){Se("font-family",e)}function F0(){const e=xe("locale");return e||((navigator.language||"en").startsWith("en"),"en")}function z0(){return xe("theme-preference")}function U0(e){Se("theme-preference",e)}function j0(){return xe("sidebarWidth")??Fc.sidebarWidth}function B0(e){Se("sidebarWidth",e)}function H0(){const e=xe("messages-session"),t=xe("messages-cache");return e&&t?{sessionKey:e,messages:t}:null}function W0(e,t){Se("messages-session",e),Se("messages-cache",t)}function K0(){return xe("sessions-cache")}function q0(e){Se("sessions-cache",e)}function G0(){return xe("usage-cache")}function V0(e){Se("usage-cache",e)}function J0(){return xe("sessions-usage-cache")}function Y0(e){Se("sessions-usage-cache",e)}function X0(){const e=xe("model-favorites");return new Set(e??[])}function Z0(e){Se("model-favorites",[...e])}function Q0(){return xe("custom-themes")??[]}function e1(e,t){Se("theme-cache",{id:e,css:t})}const t1={useDefaults:!0,defaultAgentId:"main"};function n1(){return xe("new-chat-settings")??t1}function r1(e){Se("new-chat-settings",e)}function a1(){return xe("app-mode")??"single"}function o1(e){Se("app-mode",e)}function l1(){return xe("canvas-node-enabled")??!1}function s1(e){Se("canvas-node-enabled",e)}function i1(){return xe("heartbeat-seen-count")??0}function c1(e){Se("heartbeat-seen-count",e)}function u1(){(xe("schemaVersion")??0)<kp&&Se("schemaVersion",kp)}const ft=m(h1()),Ag=m(Q0()),d1=q(()=>{const e=ft.value,t=Ag.value;if(e.selected==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?e.darkTheme:e.lightTheme;return Us(a,t)??Us("dark",t)}return Us(e.selected,t)??Us("dark",t)});function h1(){const e=z0();return e?{...wp,...e}:wp}function f1(e){const t=document.documentElement;for(const[r,a]of Object.entries(e))t.style.setProperty(r,a)}function p1(e){e1(e.id,JSON.stringify({id:e.id,appearance:e.appearance,colors:e.colors}))}function m1(e){f1(e.colors),p1(e);const t=document.querySelector('meta[name="theme-color"]');t&&t.setAttribute("content",e.colors["--color-bg-primary"]??(e.appearance==="dark"?"#0a0a0b":"#ffffff")),document.documentElement.setAttribute("data-appearance",e.appearance)}function ul(e){ft.value={...ft.value,selected:e}}function v1(e){ft.value={...ft.value,lightTheme:e}}function g1(e){ft.value={...ft.value,darkTheme:e}}function bd(){return[...Eg,...Ag.value]}function b1(){$e(()=>{const t=d1.value;m1(t)}),$e(()=>{U0(ft.value)}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{ft.value.selected==="system"&&(ft.value={...ft.value})})}const x1={tagline:"A cozy home for your AI assistant"},y1={welcome:"Welcome to Cove",welcomeSubtitle:"Your beautiful interface for OpenClaw",feature1Title:"Real-time Chat",feature1Desc:"Stream responses with tool calls and rich formatting",feature2Title:"Secure Connection",feature2Desc:"Connect to your own OpenClaw gateway with token or password auth",feature3Title:"Full Control",feature3Desc:"Manage sessions, cron jobs, skills, and more",getStarted:"Get Started",skipToLogin:"Skip to manual login",urlSubtitle:"Enter your OpenClaw gateway WebSocket URL",urlError:"URL must start with ws:// or wss://",troubleshootTitle:"Tips:",troubleshoot1:"Local gateway: ws://localhost:8080",troubleshoot2:"Remote gateway: wss://your-server.com:8080",troubleshoot3:"Check that your gateway is running",probeError:"Could not connect to gateway",authTitle:"Authentication",authSubtitle:"Enter your credentials to connect",authMethod:"Auth Method",rememberMeDesc:"Save credentials for automatic reconnection",connectingDesc:"Establishing secure connection to your gateway",success:"Connected!",successDesc:"You're all set. Time to start chatting with your assistant.",startChatting:"Start Chatting",failed:"Connection Failed",failedHints:"Common fixes:",hint1:"Verify the gateway URL is correct",hint2:"Check that the gateway is running",hint3:"Ensure your credentials are valid",hint4:"Try refreshing if using HTTPS with self-signed certs",showFeatureTour:"Show feature tour",modeTitle:"How would you like to use Cove?",modeSingle:"Single chat",modeSingleDesc:"One focused conversation",modeMulti:"Multi-chat (Beta)",modeMultiDesc:"Multiple conversations",canvasDesc:"Let the agent push images and content to your browser"},w1={skipTour:"Skip tour",steps:{sessions:{title:"Your Conversations",content:"All your chat sessions live here. Create new ones, rename them, or filter by type. Each session maintains its own context."},chatInput:{title:"Chat Input",content:"Type your message here. Press Enter to send, Shift+Enter for a new line. You can also drag & drop files or paste images."},modelPicker:{title:"Model Selection",content:"Switch between different AI models per session. Each model has different capabilities and response styles."},settings:{content:"Customize your experience with 12+ themes, font sizes, time formats, and more. Preferences are saved automatically."},canvasPairing:{title:"Approve Your Device",content:"Your browser needs to be approved as a canvas device. Click the approve button to allow your agent to push content here."},canvasButton:{content:"Your agent can push images, diagrams, and content directly here. Click to open the canvas panel."}}},k1={send:"Send",queue:"Queue",stop:"Stop",rename:"Rename",cancel:"Cancel",close:"Close",clear:"Clear",save:"Save",saved:"Saved",creating:"Creating...",new:"New",delete:"Delete",deleting:"Deleting...",copy:"Copy",copied:"Copied!",retry:"Retry",refresh:"Refresh",connect:"Connect",confirm:"Confirm",back:"Back",continue:"Continue",next:"Next",previous:"Previous",done:"Done",more:"More",showMore:"Show More",showLess:"Show Less",remove:"Remove",view:"View"},S1={noData:"No data",tryAgain:"Try again",success:"Success",dryRun:"Dry run",enabled:"Enabled",disabled:"Disabled",dark:"Dark",light:"Light",total:"Total",sessions:"Sessions",error:"Error",skills:"Skills",workspace:"Workspace",output:"Output",overview:"Overview",agents:"Agents",tokens:"Tokens",lastActive:"Last Active",noResultsHint:"Try adjusting your search or filters.",clearFilters:"Clear Filters",model:"Model",name:"Name",files:"Files",tools:"Tools",cove:"Cove",connectToGateway:"Connect to Gateway",connecting:"Connecting...",enableCanvas:"Enable Canvas",settings:"Settings",canvas:"Canvas",saving:"Saving...",create:"Create",edit:"Edit",newChat:"New Chat",logout:"Logout",search:"Search",download:"Download",loading:"Loading...",noItems:"No items",deleteThisSession:"Delete this session?",gatewayUrl:"Gateway URL",password:"Password",token:"Token",approved:"Approved",url:"URL",imageViewer:"Image viewer",healthy:"Healthy",usage:"Usage",channels:"Channels",instances:"Instances",cronJobs:"Cron Jobs",debug:"Debug",logs:"Logs",docs:"Docs",devices:"Devices",agent:"Agent",assistant:"Assistant",thinking:"Thinking",all:"All",main:"Main",isolated:"Isolated",channel:"Channel",default:"Default",sessionDetails:"Session Details",off:"Off",medium:"Medium",session:"Session",gateway:"Gateway",defaultAgent:"Default Agent",enable:"Enable",disable:"Disable",pending:"Pending",nextRun:"Next Run",schedule:"Schedule",version:"Version",host:"Host",commit:"Commit",uptime:"Uptime",platform:"Platform",clear:"Clear",paused:"Paused",input:"Input",configured:"Configured",result:"Result",searchSkills:"Search skills...",alwaysActive:"Always active",eligible:"Eligible",missingReqs:"Missing Reqs",createAgent:"Create Agent",deleteAgent:"Delete Agent",operators:"Operators",nodes:"Nodes",totalCost:"Total Cost"},_1={placeholder:"Type a command...",noMatches:"No matches",noCommands:"No commands found",categories:{chat:"Chat",session:"Session",model:"Model",cron:"Cron",gateway:"Gateway",settings:"Settings"},hints:{navigate:"↑↓ navigate",select:"↵ select",close:"esc close",back:"esc back"},commands:{chat:{abort:"Abort response",clear:"Clear chat",search:"Search in chat",export:"Export as Markdown",copyLast:"Copy last response"},session:{switch:"Switch session",delete:"Delete current session",copyKey:"Copy session key"},model:{change:"Change model"},cron:{run:"Run cron job",toggle:"Toggle cron job"},gateway:{restart:"Restart gateway"},settings:{theme:"Change theme",systemTheme:"System (auto)"}},confirm:{restartGateway:"Restart the gateway? Connection will drop briefly."}},C1={gatewayUrlPlaceholder:"ws://localhost:8080",passwordPlaceholder:"Enter password",tokenPlaceholder:"Enter token",rememberMe:"Remember me"},E1={generic:"Something went wrong",unknown:"An unknown error occurred",required:"This field is required",invalid:"Invalid value",errorPage:{title:"Well, that wasn't supposed to happen",subtitle:"Something got tangled up. Give it another shot?",details:"Technical details"}},T1={approvalNeeded:"Exec Approval Needed",expiresIn:"Expires in {time}",expired:"Expired",denied:"Denied",allowOnce:"Allow Once",allowAlways:"Always Allow",deny:"Deny"},A1={expand:"Expand output",lines:"{count} lines",moreLines:"⋯ {count} more lines (click to expand)",collapse:"⋯ collapse",emptyResponse:"Empty response",noTabsOpen:"No tabs open",messageSent:"Message sent",broadcastSent:"Broadcast sent",noChannels:"No channels found",channelCount:"{count} channel",channelCountPlural:"{count} channels",noResults:"No results found",messageCount:"{count} messages",noEvents:"No events found",noEmojis:"No custom emojis",emojiCount:"{count} emoji",emojiCountPlural:"{count} emojis",noScheduledEvents:"No scheduled events",eventCount:"{count} event",eventCountPlural:"{count} events",noPinnedMessages:"No pinned messages",pinnedCount:"{count} pinned message",pinnedCountPlural:"{count} pinned messages",showAll:"Show all",fieldChannel:"Channel",fieldTo:"To",fieldVia:"Via",fieldMedia:"Media",fieldId:"ID",fieldJoined:"Joined",fieldRoles:"Roles",noText:"(no text)",unnamed:"(unnamed)"},I1={lineCount:"{count} lines",searchQuery:"Search query",memoryPath:"Memory path",imagePath:"Image path",prompt:"Prompt",inputImage:"Input image",expandImage:"Click to expand image",expandedImage:"Expanded image",readingFile:"Reading file",writingFile:"Writing file",runningCommand:"Running command",editingFile:"Editing file",browserAction:"Browser action",cronAction:"Cron action",sessionStatus:"Session status",messageAction:"Message action"},R1={showRaw:"Show raw",showFormatted:"Show formatted"},M1={remaining:"{percent}% remaining",currentSession:"Current session"},$1={disconnected:"Disconnected",connecting:"Connecting",reconnecting:"Reconnecting"},L1={disconnected:"Connection lost. Messages will be sent when reconnected.",reconnecting:"Reconnecting to gateway...",reconnectingAttempt:"Reconnecting... (attempt {count})",messageFailedStatus:"Failed",messageSending:"Sending",messageQueued:"Queued",messagesQueued:"{count} message queued"},D1={chat:"Chat",config:"Config",github:"GitHub",githubOpenClaw:"OpenClaw GitHub",discord:"Discord",settings:"Cove Settings",sections:{control:"Control",resources:"Resources"}},P1={agentDescription:"Choose which assistant to chat with",rememberChoice:"Remember this choice",rememberChoiceDescription:"Skip this dialog next time and use these defaults",create:"Create Chat"},O1={placeholder:"Message (Enter to send, Shift+Enter for new line)",placeholderMobile:"Message...",thinking:"Thinking...",queuedMessages:"Queued ({count})",editQueuedMessage:"Edit Queued Message",images:"Images",addImage:"Add Image",noImages:"No images attached",imageCount:"{count} image",scrollToBottom:"Scroll to bottom",search:"Search messages",searchPlaceholder:"Search in conversation...",match:"match",matches:"matches",emptyState:{title:"Start a conversation",titleWithName:"Chat with {name}",description:"Send a message to begin chatting with your assistant",hint:"Quick tips:",newSession:"New session"},thinkingBlock:{thoughtFor:"Thought for ~{duration}",second:"{count} second",second_plural:"{count} seconds",expandLabel:"Expand thinking",collapseLabel:"Collapse thinking"},heartbeats:"{count} heartbeat",heartbeatsTitle:"Heartbeats",noHeartbeats:"No heartbeats yet",compacting:"Compacting…",conversationCompacted:"Conversation compacted",compactionLabel:"Compacted",cronJobCompleted:"Cron job completed",dateFrom:"From",dateTo:"To",attachImage:"Attach image",dropFiles:"Drop files here",copyMarkdown:"Copy markdown"},N1={pinned:"Pinned",today:"Today",yesterday:"Yesterday",thisWeek:"This Week",older:"Older",noSessions:"No sessions yet",noResults:"No sessions match your search",rename:"Rename Session",label:"Session Label",labelPlaceholder:"Enter a name for this session",delete:"Delete Session",deleteConfirm:'Are you sure you want to delete "{name}"?',deleteWarning:"This action cannot be undone. All messages in this session will be permanently deleted.",searchPlaceholder:"Search...",filterSessions:"Filter sessions",showCron:"Show cron sessions",admin:{description:"Manage active sessions, configure overrides, and monitor usage.",label:"Label",labelPlaceholder:"Give this session a memorable name",labelHelp:"A friendly name to help identify this session in lists.",editLabel:"Edit label",overrides:"Session Overrides",contextUsed:"Context Used",verbose:"Verbose",reasoning:"Reasoning",openInChat:"Open in Chat",emptyTitle:"No Sessions",emptyDescription:"Sessions will appear here once you start chatting.",noResults:"No Matching Sessions",searchPlaceholder:"Search sessions...",count:"{count} session",filteredCount:"Showing {filtered} of {total} sessions",kinds:{cron:"Cron"},levels:{inherit:"Inherit",low:"Low",high:"High"}}},F1={addFavorite:"Add to favorites",removeFavorite:"Remove from favorites"},z1={description:"Customize your Cove experience",appearance:{title:"Appearance",useSystemTheme:"Follow system appearance",useSystemThemeDescription:"Automatically switch between light and dark themes",lightTheme:"Light Theme",darkTheme:"Dark Theme",fontSize:"Font Size",fontSizeDescription:"Adjust text size throughout the app",fontSizeSm:"Small",fontSizeLg:"Large",fontFamily:"Font Family",fontFamilyDescription:"Choose your preferred typeface",fontSystem:"System",fontGeist:"Geist",fontInter:"Inter",fontMono:"JetBrains Mono",fontDyslexic:"OpenDyslexic"},about:{title:"About"},device:{enabledDescription:"Register as a node so the agent can push content to this browser",name:"Display Name",nameDescription:"Custom name shown in node list"},preferences:{timeFormat:"Time Display",timeFormatDescription:"How timestamps are shown",timeRelative:"Relative (2 hours ago)",timeAbsolute:"Absolute (3:45 PM)"},appMode:{title:"Interface",multiChat:"Multi-chat mode (Beta)",multiChatDescription:"Show session sidebar with multiple conversations"},newChat:{useDefaults:"Always use defaults",useDefaultsDescription:"Skip the agent picker when creating new chats",defaultAgentDescription:"Which agent to use for new chats"},data:{resetDefaults:"Reset to Defaults"}},U1={description:"Schedule and manage automated tasks.",actions:{list:"List jobs",add:"Add job",update:"Update job",remove:"Remove job",run:"Run job",runs:"Run history",status:"Scheduler status",wake:"Wake scheduler"},noJobs:"No cron jobs configured",jobCount:"{count} jobs",jobTriggered:"Job triggered",jobRemoved:"Job removed",createJob:"Create Job",editJob:"Edit Job",confirmDelete:"Delete this job?",runNow:"Run Now",announces:"Announces results",running:"Running",lastOk:"Last OK",lastFailed:"Last Failed",lastRun:"Last Run",lastDuration:"Last Duration",recentRuns:"Recent Runs",noRuns:"No runs recorded yet.",searchPlaceholder:"Search jobs...",emptyTitle:"No Cron Jobs",emptyDescription:"Create a job to schedule automated tasks.",noResults:"No Matching Jobs",count:"{count} job",filteredCount:"Showing {filtered} of {total} jobs",stats:{nextWake:"Next Wake"},columns:{job:"Job",schedule:"Schedule",target:"Target",status:"Status"},scheduleKind:{cron:"Cron Expression",every:"Interval",at:"One-time"},sessionTarget:{main:"Main Session",isolated:"Isolated Session"},wakeMode:{nextHeartbeat:"Next Heartbeat",now:"Immediate"},form:{namePlaceholder:"My Job",description:"Description",descriptionPlaceholder:"What does this job do?",descriptionHint:"Optional description for this job.",timezonePlaceholder:"Timezone (e.g., America/New_York)",cronPlaceholder:"*/5 * * * *",intervalPlaceholder:"Interval in milliseconds",sessionTarget:"Session Target",sessionTargetHint:"Main injects into the main session. Isolated runs in a separate session.",wakeMode:"Wake Mode",wakeModeHint:"When the job triggers after scheduling.",payload:"Payload",payloadHintMain:"Text injected as a system event into the main session.",payloadHintIsolated:"Runs as an agent turn in an isolated session.",systemEventPlaceholder:"Text to inject as system event",agentMessagePlaceholder:"Message to send to the agent",modelPlaceholder:"Model override (optional)",announceResults:"Announce Results",announceResultsHint:"Send job results back to your chat when complete."},validation:{nameRequired:"Name is required",cronRequired:"Cron expression is required",cronInvalid:"Invalid cron expression",intervalMin:"Interval must be at least 1 second",atFuture:"Time must be in the future",payloadRequired:"Payload text is required"}},j1={subtitle:"Connection diagnostics and event logging.",connection:"Connection",server:"Server",client:"Client",paths:"Paths",eventLog:"Event Log",state:"State",sessionKey:"Session Key",reconnectAttempts:"Reconnect Attempts",connectedAt:"Connected At",tickInterval:"Tick Interval",configPath:"Config Path",stateDir:"State Directory",appVersion:"App Version",userAgent:"User Agent",presenceCount:"Connected Clients",recording:"Recording",noEvents:"No events recorded",noEventsHint:"Events will appear here as they occur.",snapshots:"Snapshots",health:"Health",noData:"No data — click Refresh",recentSession:"Recent Session",heartbeatAgents:"Heartbeat Agents",showRawJson:"Show raw JSON",used:"Used",unhealthy:"Unhealthy",linked:"Linked",on:"On",ok:"OK",clickToExpand:"click to expand",noPayload:"no payload",viewEventDetails:"View {{event}} event details",manualRpc:"Manual RPC",manualRpcDesc:"Send a raw gateway method with JSON params.",method:"Method",params:"Params",paramsJson:"Params (JSON)",addParam:"Add",noParams:"No params — click Add to add one",formMode:"Form",jsonMode:"JSON",call:"Call"},B1={serverInfo:"Server Information",capabilities:"Capabilities",capabilitiesCount:"{count} methods"},H1={description:"Gateway log viewer with live tailing.",searchPlaceholder:"Search logs...",live:"Live",info:"Info",warnings:"Warn",noLogs:"No logs available",noLogsHint:"Logs will appear here when the gateway writes them.",noMatches:"No logs match your filter",fetchError:"Failed to fetch logs",expandLine:"Expand log details",filterByLevel:"Filter by {level} level",viewLogDetails:"View log details",logDetails:"Log Details",message:"Message",rawLine:"Raw",fields:"fields"},W1={description:"Messaging platform integrations and status.",emptyTitle:"No Channels",emptyDescription:"No channel plugins are available.",learnMore:"Learn how to set up channels",count:"{count} channel",configure:"Configure",probe:"Health Check",probing:"Checking...",logoutTitle:"Logout from Channel",logoutConfirm:"Are you sure you want to log out of {channel}?",logoutWarning:"You may need to re-authenticate (QR code, token, etc.) to reconnect.",logoutSuccess:"Logged out of {channel}",stats:{active:"Active (24h)",errors:"Errors"},status:{connected:"Connected",notConfigured:"Not Configured"}},K1={description:"Connected clients and services.",emptyTitle:"No Instances",emptyDescription:"No connected clients or services found.",count:"{count} instance",idleSeconds:"{count}s",idleMinutes:"{count}m",idleHours:"{count}h",stats:{gateways:"Gateways",clients:"Clients"},columns:{instance:"Instance",mode:"Mode",lastSeen:"Last Seen",idle:"Idle"}},q1={description:"Browse and manage assistant skills.",emptyTitle:"No Skills",emptyDescription:"No skills are available in this workspace.",noResults:"No Matching Skills",count:"{count} skill",filteredCount:"Showing {filtered} of {total} skills",enabledSuccess:"Enabled {name}",disabledSuccess:"Disabled {name}",installDeps:"Install Dependencies",installTitle:"Install Dependencies for {name}",installDescription:"Choose an installation method to install the required dependencies.",installSuccess:"Successfully installed dependencies for {name}",installFailed:"Failed to install dependencies",providesBins:"Provides",skillKey:"Skill Key",location:"Location",homepage:"Homepage",missingRequirements:"Missing requirements",blockedByAllowlist:"Blocked by allowlist",primaryEnv:"Primary env var",managedDir:"Managed skills",status:{blocked:"Blocked"},source:{bundled:"Bundled",managed:"Installed",extra:"Extra"},filters:{allSources:"All Sources"},clawhub:{searchPlaceholder:"Search ClawHub skills...",install:"Install",installing:"Installing...",noDescription:"No description available",changelog:"Changelog",updated:"Updated",noResults:"No Skills Found",tryDifferentSearch:"Try a different search term.",notYetSupported:"ClawHub installation coming soon! Install manually: openclaw skills install {slug}",trending:"Trending",sortLabel:"Sort by",sortPopular:"Popular",sortTrending:"Trending",sortStars:"Most Starred",sortRecent:"Newest",by:"by",installs:"active"}},G1={description:"Manage agent configuration and workspace files.",overview:{identityEmoji:"Emoji",avatar:"Avatar",avatarPlaceholder:"avatar.jpg or https://...",namePlaceholder:"Agent name",workspacePlaceholder:"/path/to/workspace",modelPlaceholder:"anthropic/claude-sonnet-4-20250514",editHint:"Avatar: relative path, URL, or data URI. Model: leave empty to keep current."},files:{totalTokens:"~{count} tokens injected per run",loadError:"Failed to load workspace files",loadFileError:"Failed to load file",saveError:"Failed to save file",saved:"File saved",missing:"Missing",view:"View",unsaved:"Unsaved",unsavedWarning:"You have unsaved changes. Are you sure you want to leave?",backToList:"Back to Files",emptyFile:"This file is empty.",editPlaceholder:"Enter file content...",memoryHint:{title:"About Memory Files",line1:"Files in the memory/ folder are not editable here.",line2:"Use the chat to update memory/*.md files."},meta:{agents:"Agent behavior and workspace rules",soul:"Persona and communication style",tools:"Tool usage notes and conventions",identity:"Agent identity (name, email, accounts)",user:"User profile and preferences",heartbeat:"Heartbeat checklist and reminders",bootstrap:"First-run ritual (deleted after completion)",memory:"Durable facts, preferences, and context",unknown:"Configuration file"}},tools:{profile:"Profile",profiles:{full:"Full — All tools enabled",coding:"Coding — Files, exec, web",messaging:"Messaging — Messages, sessions",minimal:"Minimal — Read-only basics"},sections:{runtime:"Runtime",web:"Web",memory:"Memory",automation:"Automation"},toolDescriptions:{read:"Read file contents",write:"Create or overwrite files",edit:"Make precise edits",exec:"Run shell commands",process:"Manage background processes",webSearch:"Search the web",webFetch:"Fetch web content",browser:"Control web browser",memorySearch:"Semantic search",memoryGet:"Read memory files",sessionsList:"List sessions",sessionsSend:"Send to session",sessionsSpawn:"Spawn sub-agent",message:"Send messages",cron:"Schedule tasks",gateway:"Gateway control",nodes:"Node devices"},enabled:"{count} enabled"},skills:{title:"Agent Skill Access",noSkills:"No eligible skills available",noSearchResults:"No skills match your search",usingAllowlist:"Using allowlist: {allowed} of {total} skills",usingAll:"Using all {count} eligible skills",useAll:"Use All Skills",useAllHint:"= agent can use any eligible skill (no allowlist).",selectAll:"Select All",selectNone:"Select None",selectSpecific:"Select specific skills",selectSpecificHint:"= agent can only use checked skills.",globalHint:"To globally enable/disable skills, visit the",page:"page",details:"Details"},create:{nameHint:"Used as the agent ID (lowercase, no spaces)",namePlaceholder:"my-agent",workspacePlaceholder:"~/agents/my-agent",emoji:"Emoji (optional)",emojiPlaceholder:"🤖",requiredFields:"Name and workspace are required",success:"Agent created"},delete:{warning:"This action cannot be undone",warningDescription:"Deleting this agent will permanently remove its configuration from OpenClaw. Make sure you have backups if needed.",willDelete:"This will permanently delete:",willDeleteConfig:"Agent configuration from openclaw.json",willDeleteBindings:"Any channel bindings for this agent",willDeleteSessions:"Session associations (session data is preserved)",includeFiles:"Also delete workspace files",includeFilesDescription:"Permanently delete all files in {path}",confirmPrompt:'Type "{id}" to confirm deletion:',confirmMismatch:"Please type the agent ID to confirm deletion",success:"Agent deleted"}},V1={description:"Manage paired devices and authentication tokens.",emptyTitle:"No Devices",emptyDescription:"No devices have been paired yet.",noResults:"No matching devices",count:"{count} device",filteredCount:"Showing {filtered} of {total}",searchPlaceholder:"Search devices...",pendingRequests:"Pending Pairing Requests",approve:"Approve",reject:"Reject",approveSuccess:"Device approved",rejectSuccess:"Device rejected",repair:"Repair",deviceId:"Device ID",clientId:"Client ID",scopes:"Scopes",tokens:"Auth Tokens",noTokens:"No tokens",tokenActive:"Active",tokenRevoked:"Revoked",rotateToken:"Rotate token",tokenManagement:"Token Management",tokenManagementDesc:"Manage authentication tokens for {name}.",tokenCreated:"Created",tokenRotatedAt:"Rotated",rotate:"Rotate",revoke:"Revoke",tokenRotated:"Token rotated and copied to clipboard",tokenCopied:"New token copied to clipboard",toggleDetails:"Toggle details for {name}",filters:{allRoles:"All Roles"}},J1={description:"Token usage and cost analytics",loadError:"Failed to load usage data",gateway:{unknown:"Unknown host"},summary:{title:"Token Usage",period:"Last {days} days",cache:"Cache Tokens",cacheRead:"Cache Read",cacheWrite:"Cache Write",unavailable:"Usage data not available"},daily:{title:"Daily Activity"},agents:{sessions:"sessions"},sessions:{noData:"No session usage data available",cost:"Cost",showing:"Showing {from}–{to} of {total}",viewDetails:"View details for {name}"},detail:{contextWeight:"Context Weight",system:"System Prompt",other:"Other",tabs:{timeline:"Timeline",messages:"Messages"},noTimeline:"No timeline data available for this session",noMessages:"No message logs available for this session",cumulativeTokens:"Cumulative Tokens",requests:"Requests",totalTokens:"Total Tokens",role:{user:"User",tool:"Tool"},tokenCount:"{count} tokens"}},Y1={minutesAgo:"{count} minute ago",compact:{now:"now",minutes:"{count}m",hours:"{count}h",days:"{count}d",weeks:"{count}w",months:"{count}mo",years:"{count}y"}},X1={close:"Close canvas",minimize:"Minimize",maximize:"Maximize",openUrlInNewTab:"Open URL in new tab",openCanvasTab:"Pop out to canvas tab",iframeTitle:"Canvas content",imageAlt:"Canvas image",noContent:"No content to display",noContentHint:"The assistant can push content here."},Z1={sidebarToggle:"Toggle sidebar",loading:"Loading",expandSection:"Expand section",collapseSection:"Collapse section"},Q1={title:"Configuration",description:"Manage OpenClaw settings",searchPlaceholder:"Search settings...",save:"Save Changes",reset:"Reset",unsavedChanges:"You have unsaved changes",saveSuccess:"Configuration saved. Gateway will restart.",noFields:"No settings found",noResults:"No matching settings",selectSection:"Select a section to configure",general:"General",noSettingsAtLevel:"No settings available at this level.",schemaNotFound:"Schema not found for path: {path}",validation:{invalidFormat:"Invalid format",mustBeString:"Must be a string",mustBeNumber:"Must be a number",mustBeInteger:"Must be an integer",mustBeBoolean:"Must be true or false",mustBeArray:"Must be an array",mustBeObject:"Must be an object",invalidOption:"Invalid option",minLength:"Must be at least {min} characters",maxLength:"Must be at most {max} characters",minimum:"Must be at least {min}",maximum:"Must be at most {max}",minItems:"Must have at least {min} items",maxItems:"Must have at most {max} items"},field:{showPassword:"Show password",hidePassword:"Hide password",addItem:"Add item",removeItem:"Remove item",dragToReorder:"Drag to reorder",moveUp:"Move up",moveDown:"Move down",invalidJson:"Invalid JSON"}},ew={app:x1,onboarding:y1,tour:w1,actions:k1,common:S1,commandPalette:_1,auth:C1,errors:E1,exec:T1,toolOutput:A1,toolInput:I1,toolBlock:R1,sessionStatus:M1,status:$1,connection:L1,nav:D1,newChatModal:P1,chat:O1,sessions:N1,models:F1,settings:z1,cron:U1,debug:j1,overview:B1,logs:H1,channels:W1,instances:K1,skills:q1,agents:G1,devices:V1,usage:J1,time:Y1,canvas:X1,accessibility:Z1,config:Q1},No={en:ew};function tw(e){if(No[e])return No[e];const t=e.split("-")[0];return No[t]?No[t]:No.en}const aa=m($0()),Ja=m(D0()),Ya=m(O0()),nt=m(n1()),Tn=m(a1()),Je=m(l1()),ps=q(()=>Tn.value==="multi"),Ul=q(()=>Tn.value==="single");$e(()=>L0(aa.value));$e(()=>P0(Ja.value));$e(()=>N0(Ya.value));$e(()=>r1(nt.value));$e(()=>o1(Tn.value));$e(()=>s1(Je.value));typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key==="cove:canvas-node-enabled"){const t=e.newValue==="true";Je.value!==t&&(Je.value=t,Bi(()=>Promise.resolve().then(()=>Lx),void 0).then(r=>{t?r.startNodeConnection():r.stopNodeConnection()}))}});$e(()=>{document.documentElement.dataset.fontSize=Ja.value});$e(()=>{const e={geist:'"Geist Sans", ui-sans-serif, system-ui, sans-serif',inter:'"Inter", ui-sans-serif, system-ui, sans-serif',system:'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',dyslexic:'"OpenDyslexic", ui-sans-serif, system-ui, sans-serif',mono:'"JetBrains Mono", ui-monospace, monospace'};document.documentElement.style.setProperty("--font-family-override",e[Ya.value])});const Ig=[{value:"sm",labelKey:"settings.appearance.fontSizeSm"},{value:"md",labelKey:"common.medium"},{value:"lg",labelKey:"settings.appearance.fontSizeLg"}],Rg=[{value:"system",labelKey:"settings.appearance.fontSystem"},{value:"geist",labelKey:"settings.appearance.fontGeist"},{value:"inter",labelKey:"settings.appearance.fontInter"},{value:"mono",labelKey:"settings.appearance.fontMono"},{value:"dyslexic",labelKey:"settings.appearance.fontDyslexic"}],Mg=[{value:"relative",labelKey:"settings.preferences.timeRelative"},{value:"local",labelKey:"settings.preferences.timeAbsolute"}];function $g(){Ja.value="md",Ya.value="geist",aa.value="relative",nt.value={useDefaults:!0,defaultAgentId:"main"},Tn.value="single"}const nw=Object.freeze(Object.defineProperty({__proto__:null,FONT_FAMILY_OPTIONS:Rg,FONT_SIZE_OPTIONS:Ig,TIME_FORMAT_OPTIONS:Mg,appMode:Tn,canvasNodeEnabled:Je,fontFamily:Ya,fontSize:Ja,isMultiChatMode:ps,isSingleChatMode:Ul,newChatSettings:nt,resetToDefaults:$g,timeFormat:aa},Symbol.toStringTag,{value:"Module"})),_p={debug:0,info:1,warn:2,error:3,off:4};function rw(){return"off"}const aw=rw();function js(e){return _p[e]>=_p[aw]}function Bs(e,t){return`[${e}] ${t}`}function Gn(e){return{debug:(t,...r)=>{js("debug")&&(console.debug(Bs(e,t),...r),r.length,void 0)},info:(t,...r)=>{js("info")&&(console.info(Bs(e,t),...r),r.length,void 0)},warn:(t,...r)=>{js("warn")&&(console.warn(Bs(e,t),...r),r.length,void 0)},error:(t,...r)=>{js("error")&&(console.error(Bs(e,t),...r),r.length,void 0)}}}const A={gateway:Gn("gateway"),auth:Gn("auth"),chat:Gn("chat"),exec:Gn("exec"),i18n:Gn("i18n"),node:Gn("node"),ui:Gn("ui"),usage:Gn("usage")},gr=m(F0()),Cp=m(tw(gr.value)),Ep=q(()=>["ar","he","fa","ur"].includes(gr.value.split("-")[0]));function ow(){document.documentElement.dir=Ep.value?"rtl":"ltr",document.documentElement.lang=gr.value,$e(()=>{document.documentElement.dir=Ep.value?"rtl":"ltr",document.documentElement.lang=gr.value})}function Tp(e,t){return t.split(".").reduce((r,a)=>{if(r&&typeof r=="object"&&a in r)return r[a]},e)}function s(e,t){let r=Tp(Cp.value,e);if(t?.count!==void 0&&typeof t.count=="number"){const o=t.count===1?e:`${e}_plural`,l=Tp(Cp.value,o);l!==void 0&&(r=l)}return typeof r!="string"?(A.i18n.warn(`Missing translation: ${e}`),e):t?r.replace(/\{(\w+)\}/g,(a,o)=>t[o]?.toString()??`{${o}}`):r}function Lg(e,t="short"){const r=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(gr.value,{timeStyle:t}).format(r)}function Ap(e){const t=typeof e=="number"?new Date(e):e,r=Date.now(),a=t.getTime()-r,o=Math.round(a/1e3),l=Math.round(o/60),i=Math.round(l/60),c=Math.round(i/24),d=Math.round(c/7),u=Math.round(c/30),h=Math.round(c/365),f=new Intl.RelativeTimeFormat(gr.value,{numeric:"auto"});return Math.abs(o)<60?f.format(o,"second"):Math.abs(l)<60?f.format(l,"minute"):Math.abs(i)<24?f.format(i,"hour"):Math.abs(c)<7?f.format(c,"day"):Math.abs(d)<4?f.format(d,"week"):Math.abs(u)<12?f.format(u,"month"):f.format(h,"year")}function re(e,t){return t?.relative?Ap(e):aa.value==="local"?Lg(e,"short"):Ap(e)}function lw(e){const t=typeof e=="number"?new Date(e):e,r=Date.now(),a=Math.abs(t.getTime()-r),o=Math.round(a/1e3),l=Math.round(o/60),i=Math.round(l/60),c=Math.round(i/24),d=Math.round(c/7),u=Math.round(c/30),h=Math.round(c/365);return o<60?s("time.compact.now"):l<60?s("time.compact.minutes",{count:l}):i<24?s("time.compact.hours",{count:i}):c<7?s("time.compact.days",{count:c}):d<4?s("time.compact.weeks",{count:d}):u<12?s("time.compact.months",{count:u}):s("time.compact.years",{count:h})}function qi(e){if(aa.value==="local"){const t=typeof e=="number"?new Date(e):e,r=new Date;return t.getDate()===r.getDate()&&t.getMonth()===r.getMonth()&&t.getFullYear()===r.getFullYear()?Lg(t,"short"):t.getFullYear()===r.getFullYear()?new Intl.DateTimeFormat(gr.value,{month:"short",day:"numeric"}).format(t):new Intl.DateTimeFormat(gr.value,{month:"short",year:"2-digit"}).format(t)}return lw(e)}function xd(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Gi(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}K`:`${Math.round(e/1e3)}K`}const Ip=3,sw=1e3,iw=3e4,cw=1.5,uw=3e4,dw=3e4,Pe=m("disconnected"),P=q(()=>Pe.value==="connected"),hw=m(!0),lr=m(null),Ot=m(null),pt=m(null),Ph=m(null),Ve=m(null),Oh=m([]),Yt=m(0),ms=m(null),So=m(null),fw=m(null),jl=m(null),br=m(null),Dg=m(null),dl=m(null),hl=m(null),vs=m([]),Nh=q(()=>{const e=Dg.value,t=br.value;if(e==null||t==null)return null;const r=Date.now()-t;return e+r});let De=null,Da=null,pw=0,vi=null,Pa=null;const Xa=new Map,yd=new Set,mw=5e3;function Rp(e,t){return new Promise(r=>{if(t?.aborted){r({ok:!1,error:"Aborted"});return}let a=null,o=null,l=!1;const i=()=>{o&&(clearTimeout(o),o=null),a&&(a.onopen=null,a.onmessage=null,a.onerror=null,a.onclose=null,a.close(),a=null)},c=u=>{l||(l=!0,i(),r({ok:!1,error:u}))},d=u=>{l||(l=!0,i(),r({ok:!0,version:u}))};t?.addEventListener("abort",()=>{c("Aborted")}),o=setTimeout(()=>{c("Connection timed out")},mw);try{a=new WebSocket(e),a.onopen=()=>{A.gateway.debug("Probe: WebSocket opened, waiting for challenge...")},a.onmessage=u=>{try{const h=JSON.parse(u.data);h.type==="evt"&&h.event==="connect.challenge"?(A.gateway.debug("Probe: Received connect.challenge, gateway is valid"),d(h.payload?.version)):(A.gateway.debug("Probe: Received unexpected message:",h.type,h.event),d())}catch{c("Invalid response from server")}},a.onerror=u=>{A.gateway.error("Probe WebSocket error:",{url:e,event:u.type}),c("Connection failed")},a.onclose=u=>{u.wasClean||c("Connection closed unexpectedly")}}catch(u){c(u instanceof Error?u.message:"Failed to connect")}})}function gs(e){const t=Yt.value>0;return De&&(t?(De.onclose=null,De.close(),De=null):Za()),Da=e,Pe.value="connecting",hw.value=!1,lr.value=null,t||(Yt.value=0),pt.value=e.url,new Promise((r,a)=>{try{De=new WebSocket(e.url),De.onopen=()=>{Pe.value="authenticating"},De.onmessage=o=>{try{const l=JSON.parse(o.data);if(Pe.value==="authenticating"&&l.type==="event"&&l.event==="connect.challenge"){vw(e).then(i=>{Pe.value="connected",br.value=Date.now(),Ot.value=i.server?.version??null,ms.value=i.server?.commit??null,So.value=i.server?.host??null,Ph.value=i.server?.connId??null,fw.value=i.canvasHostUrl??null,Oh.value=i.features?.methods??[],jl.value=i.policy?.tickIntervalMs??null,vs.value=i.snapshot?.presence??[],Dg.value=i.snapshot?.uptimeMs??null,dl.value=i.snapshot?.configPath??null,hl.value=i.snapshot?.stateDir??null;const c=i.snapshot?.sessionDefaults;c?.mainSessionKey&&(Ve.value=c.mainSessionKey,A.gateway.info("Main session key:",Ve.value)),ww(),r(i)}).catch(i=>{lr.value=i.message,Za(),a(i)});return}bw(l)}catch(l){A.gateway.error(" Failed to parse message:",l)}},De.onerror=o=>{A.gateway.error("WebSocket error:",{url:e.url,readyState:De?.readyState,event:o.type}),lr.value="WebSocket error - check console for details"},De.onclose=o=>{const i=Pe.value==="connected",c=Yt.value>0;Fh(),Pg(new Error("Connection closed")),(i||c)&&Da?.autoReconnect!==!1?kw():Pe.value="disconnected"}}catch(o){Pe.value="disconnected",lr.value=o instanceof Error?o.message:"Failed to connect",a(o)}})}async function vw(e){const t={minProtocol:Ip,maxProtocol:Ip,client:{id:"webchat",displayName:"Cove",version:"2026.2.14",platform:gw(),mode:"webchat"},caps:["tool-events"],role:"operator",scopes:["operator.admin","operator.read","operator.write"],auth:{}};return e.token?t.auth.token=e.token:e.password&&(t.auth.password=e.password),await O("connect",t)}function gw(){const e=navigator.userAgent;return e.includes("Mac")?"macos":e.includes("Windows")?"windows":e.includes("Linux")?"linux":e.includes("iPhone")||e.includes("iPad")?"ios":e.includes("Android")?"android":"web"}function Za(){Da=null,Fh(),Sw(),Pg(new Error("Disconnected")),De&&(De.onclose=null,De.close(),De=null),Pe.value="disconnected",br.value=null,Ot.value=null,ms.value=null,So.value=null,pt.value=null,Ph.value=null,Ve.value=null,Oh.value=[],jl.value=null,vs.value=[]}function O(e,t,r){return new Promise((a,o)=>{if(!De||De.readyState!==WebSocket.OPEN){o(new Error("Not connected"));return}const l=`req_${++pw}`,i=r?.timeout??uw,c={type:"req",id:l,method:e,params:t},d=setTimeout(()=>{Xa.delete(l),o(new Error(`Request timeout: ${e}`))},i);Xa.set(l,{resolve:a,reject:o,timeout:d}),De.send(JSON.stringify(c))})}function bw(e){switch(e.type){case"res":xw(e);break;case"event":yw(e);break;default:A.gateway.warn(" Unknown message type:",e)}}function xw(e){const t=Xa.get(e.id);if(!t){A.gateway.warn(" Received response for unknown request:",e.id);return}Xa.delete(e.id),clearTimeout(t.timeout),e.ok?t.resolve(e.payload):t.reject(new Error(e.error?.message??"Request failed"))}function yw(e){A.gateway.debug("Event received:",e.event);for(const t of yd)try{t(e)}catch(r){A.gateway.error(" Event handler error:",r)}}function Pg(e){for(const[t,r]of Xa)clearTimeout(r.timeout),r.reject(e);Xa.clear()}function zc(e){return yd.add(e),()=>yd.delete(e)}function wd(e,t){return zc(a=>{a.event===e&&t(a.payload)})}let Fo=0;const Mp=3;function ww(){Fh(),Fo=0,vi=setInterval(()=>{De?.readyState===WebSocket.OPEN&&O("health").then(()=>{Fo=0}).catch(e=>{Fo++,A.gateway.warn(`Heartbeat failed (${Fo}/${Mp}):`,e instanceof Error?e.message:String(e)),Fo>=Mp&&A.gateway.error("Too many consecutive heartbeat failures, connection may be unhealthy")})},dw)}function Fh(){vi&&(clearInterval(vi),vi=null)}function kw(){if(!Da||Pa)return;Pe.value="reconnecting",Yt.value++;const e=Math.min(sw*Math.pow(cw,Yt.value-1),iw);A.gateway.info(`[gateway] Reconnecting in ${Math.round(e/1e3)}s (attempt ${Yt.value})`),Pa=setTimeout(async()=>{if(Pa=null,!!Da)try{await gs(Da)}catch{}},e)}function Sw(){Pa&&(clearTimeout(Pa),Pa=null),Yt.value=0}const Zo={state:Pe,isConnected:P,error:lr,version:Ot,commit:ms,host:So,url:pt,connectionId:Ph,mainSessionKey:Ve,capabilities:Oh,tickIntervalMs:jl,connectedAt:br,presence:vs,reconnectAttempt:Yt,connect:gs,disconnect:Za,send:O,subscribe:zc,on:wd},_w=6e4,Cw=200,Ew=100,Tw=5e3,Aw=1e3,Hs=`
|
|
2
|
-
|
|
3
|
-
`,Iw=300,Rw="2026.2.14",Ws={docs:"https://docs.openclaw.ai",github:"https://github.com/MaudeCode/cove",githubOpenClaw:"https://github.com/openclaw/openclaw",discord:"https://discord.com/invite/clawd"},Mw=[/read heartbeat\.md/i,/heartbeat poll/i,/if nothing needs attention.*reply.*heartbeat_ok/i],$w=/^\s*heartbeat_ok\s*$/i,Lw=/^\s*\[cron\]/i;function Dw(e){return e.role!=="user"?!1:Mw.some(t=>t.test(e.content))}function zh(e){return e.role!=="assistant"?!1:$w.test(e.content)}function Pw(e){return e.role!=="assistant"?!1:Lw.test(e.content)}function Og(e){return Dw(e)||zh(e)}const Ow=[/^pre-compaction memory flush/i,/^read heartbeat\.md if it exists/i];function Nw(e){return e.role!=="user"?!1:Ow.some(t=>t.test(e.content))}function Fw(e){let t=e;t=t.replace(/^Conversation info \(untrusted metadata\):\s*```json\s*\{[^}]*\}\s*```\s*/s,"");const r=t.match(/^\[([^\]]+)\]\s*/);if(r){const a=r[1]??"";(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(a)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(a))&&(t=t.slice(r[0].length))}return t.includes("[message_id:")&&(t=t.split(/\r?\n/).filter(a=>!/^\s*\[message_id:\s*[^\]]+\]\s*$/i.test(a)).join(`
|
|
4
|
-
`)),t.trim()}const zw=[/^<summary>/i,/the conversation.*compacted/i,/context was summarized/i];function Uw(e){return e.role!=="user"?!1:zw.some(t=>t.test(e.content))}function fl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Uh(e){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"):!1}function jh(e){return typeof e=="string"&&e.trim().length>0}function Bh(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function jw(e){return e.replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/`(.+?)`/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[(.+?)\]\(.+?\)/g,"$1").replace(/!\[.*?\]\(.+?\)/g,"").replace(/^>\s+/gm,"").replace(/```[\s\S]*?```/g,t=>t.replace(/```\w*\n?/,"").replace(/```$/,"")).trim()}function Ng(e){return/^\d/.test(e)?`v${e}`:e}const Bw=[":discord:",":telegram:",":signal:",":slack:",":whatsapp:",":imessage:"];function oa(e){return e===Ve.value||e==="main"||e.endsWith(":main")}function Hw(e){return Ug(e.key)==="cron"}function Fg(e){return/^agent:[^:]+:chat:[^:]+$/.test(e)}function Ww(e){return Ug(e.key)==="spawn"}function zg(e){const t=e.key.toLowerCase();return Bw.some(r=>t.includes(r))?!0:e.kind==="group"}function Kw(e){const t=e.split(":");return t.length>=2&&t[0]==="agent"?t[1]:null}function Ug(e){const t=e.split(":");return t.length>=3&&t[0]==="agent"?t[2]:null}function jg(e){return e.split("-").map(fl).join(" ")}function $p(e){return e.includes("-")&&e.length>20}function qw(e){if(oa(e.key))return"pinned";const t=e.updatedAt??e.lastActiveAt;if(!t)return"older";const r=new Date,a=new Date(t),o=new Date(r.getFullYear(),r.getMonth(),r.getDate()),l=new Date(o);l.setDate(l.getDate()-1);const i=new Date(o);return i.setDate(i.getDate()-o.getDay()),a>=o?"today":a>=l?"yesterday":a>=i?"thisWeek":"older"}function Gw(e){const t=new Map([["pinned",[]],["today",[]],["yesterday",[]],["thisWeek",[]],["older",[]]]);for(const r of e){const a=qw(r);t.get(a).push(r)}return t}function Vw(e){return e===void 0||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Jr(e){return e.key.includes(":cron:")?"cron":zg(e)?"channel":oa(e.key)?"main":"isolated"}function ae(e){return e instanceof Error?e.message:String(e)}const Et=m(K0()??[]),Cn=m(null),Bl=m(null),Hl=m(""),Bg=m("");let Cu=null;Hl.subscribe(e=>{Cu&&clearTimeout(Cu),Cu=setTimeout(()=>{Bg.value=e},300)});const Wl=m(!1),Jw=m(!0),Lp=m(!1),Hh=m(null),kd=m(null),tt=q(()=>{const e=Cn.value;return!e||e==="main"?Ve.value??"main":e}),Yw=q(()=>Et.value.find(e=>e.key===tt.value)??null);function bs(e){const t=tt.value;return!e||!t||e===t}function Xw(e){return e.displayName?e.displayName:e.label?e.label:e.key}function Zw(e){return zg(e)?"channel":oa(e.key)?"main":"isolated"}const Sd=q(()=>{let e=Et.value;Bl.value&&(e=e.filter(r=>Zw(r)===Bl.value)),Wl.value||(e=e.filter(r=>!Hw(r))),Jw.value||(e=e.filter(r=>!Ww(r)));const t=Bg.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=Xw(r).toLowerCase(),o=(r.channel??"").toLowerCase(),l=(r.model??"").toLowerCase();return a.includes(t)||o.includes(t)||l.includes(t)})),[...e].sort((r,a)=>{const o=oa(r.key),l=oa(a.key);return o&&!l?-1:l&&!o?1:(a.updatedAt??0)-(r.updatedAt??0)})}),Qw=q(()=>Gw(Sd.value));async function Uc(e){Lp.value=!0,kd.value=null;try{const t=await O("sessions.list",{limit:e?.limit??100,...e});Et.value=t.sessions??[],q0(Et.value)}catch(t){throw kd.value=t instanceof Error?t.message:String(t),t}finally{Lp.value=!1}}function Qa(e){Cn.value=e}function e2(e){Bl.value=e}function Dp(e){Hl.value=e}function t2(){Wl.value=!Wl.value}function n2(){Et.value=[],Cn.value=null,kd.value=null}function Wh(e,t){Et.value=Et.value.map(r=>r.key===e?{...r,...t}:r)}function r2(e){Et.value=Et.value.filter(t=>t.key!==e),Cn.value===e&&(Cn.value=null),Hh.value=null}function a2(e){return new Promise(t=>{Hh.value=e,setTimeout(()=>{r2(e),t()},Iw)})}let Kh=null;function o2(){const e=H0();return e?(Kh=e.sessionKey,e.messages):[]}function l2(e,t){W0(e,t),Kh=e}function s2(){return Kh}const Ne=m(o2()),_d=m(!1),Vi=m(null),i2=m("off"),dr=m(!1),Ji=m(void 0),Hr=m(!1),Yi=m(-1),Hg=q(()=>Ne.value.filter(Og)),c2=q(()=>Hg.value.length),wn=m(""),jc=m("");let Eu=null;wn.subscribe(e=>{Eu&&clearTimeout(Eu),Eu=setTimeout(()=>{jc.value=e},300)});const Be=m(!1),Ks=m(null),Oa=m(null),Na=m(null),Wg=q(()=>Oa.value!==null||Na.value!==null);function u2(){Oa.value=null,Na.value=null}const Kg=q(()=>{let e=Ne.value;const t=Oa.value,r=Na.value;(t||r)&&(e=e.filter(o=>{const l=new Date(o.timestamp);if(t&&l<t)return!1;if(r){const i=new Date(r);if(i.setHours(23,59,59,999),l>i)return!1}return!0}));const a=jc.value.trim().toLowerCase();return a&&(e=e.filter(o=>o.content.toLowerCase().includes(a))),e}),d2=q(()=>!jc.value.trim().toLowerCase()&&!Wg.value?0:Kg.value.length),Tt=m([]),qg=q(()=>Tt.value.length>0),ue=m(new Map),qh=m(!1),Pp=m(""),Op=m([]);function Gh(e){for(const t of ue.value.values())if(t.sessionKey===e&&(t.status==="pending"||t.status==="streaming"))return t;return null}function h2(e){const t=Gh(e);return t?{isStreaming:!0,content:t.content,toolCalls:t.toolCalls}:{isStreaming:!1,content:"",toolCalls:[]}}function Bc(){let e=!1;for(const t of ue.value.values())if(t.status==="pending"||t.status==="streaming"){e=!0,Pp.value=t.content,Op.value=t.toolCalls;break}e||(Pp.value="",Op.value=[]),qh.value=e}function Hc(e,t){const r=ue.value.get(e);if(!r)return;const a=new Map(ue.value);a.set(e,{...r,...t}),ue.value=a,Bc()}function Vh(e,t){setTimeout(()=>{const r=new Map(ue.value);r.delete(e),ue.value=r,Bc()},t)}function Jh(e,t,r){Ne.value=Ne.value.map(a=>a.id===e?{...a,status:t,error:r}:a)}function Wc(){Ne.value=[],Vi.value=null}function f2(e){Ne.value=e,Hr.value=!1,Ji.value=void 0,Yi.value=-1}function Xi(e){const t=Ne.value.findIndex(r=>r.id===e.id);if(t>=0){Ne.value=Ne.value.map((r,a)=>a===t?{...r,...e}:r);return}Ne.value=[...Ne.value,e]}function Gg(e){Jh(e,"sending",void 0)}function p2(e){Jh(e,"sent",void 0)}function Np(e,t){Jh(e,"failed",t)}function _o(e,t){const r=new Map(ue.value);r.set(e,{runId:e,sessionKey:t,startedAt:Date.now(),status:"pending",content:"",toolCalls:[]}),ue.value=r,Bc()}function pl(e,t,r=[],a){const o=ue.value.get(e);o&&Hc(e,{status:"streaming",content:t,toolCalls:r,lastBlockStart:a??o.lastBlockStart})}function Zi(e,t){const r=ue.value.get(e),a=t?.content??r?.content??"";Hc(e,{status:"complete",message:t,content:a}),t&&bs(r?.sessionKey)&&(r?.sessionKey==="unknown"&&m2(t)||Xi(t)),Vh(e,Ew)}function m2(e){const t=Ne.value;for(let r=t.length-1;r>=0;r--){const a=t[r];if(a.role==="assistant"){if(Date.now()-a.timestamp>6e4)break;if(e.toolCalls&&a.toolCalls){const o=new Set(e.toolCalls.map(i=>i.id));if(a.toolCalls.some(i=>o.has(i.id))){const i=a.toolCalls.map(d=>{const u=e.toolCalls?.find(h=>h.id===d.id);return u?{...d,status:u.status,result:u.result,completedAt:u.completedAt}:d});let c=a.content;if(e.content&&!a.content.endsWith(e.content)){const d=a.content?`
|
|
5
|
-
|
|
6
|
-
`:"";c=a.content+d+e.content}return Ne.value=t.map(d=>d.id===a.id?{...d,content:c,toolCalls:i}:d),!0}}}}return!1}function Cd(e,t){Hc(e,{status:"error",error:t}),Vh(e,Tw)}function v2(e){Hc(e,{status:"aborted"}),Vh(e,Aw)}function g2(){ue.value=new Map,Bc()}function Fp(e){Tt.value=[...Tt.value,e]}function Vg(e){Tt.value=Tt.value.filter(t=>t.id!==e)}function b2(e,t,r){Tt.value=Tt.value.map(a=>a.id===e?{...a,content:t,images:r}:a)}const Ed=m(new Map);function zp(e){return Ed.value.get(e)||""}function Jg(e,t){const r=new Map(Ed.value);t?r.set(e,t):r.delete(e),Ed.value=r}function x2(e){Jg(e,"")}function Qi(e){if(typeof e=="string")return{text:e,toolCalls:[],images:[]};const t=[],r=[],a=[],o=[];let l=0;for(const c of e)switch(c.type){case"text":{t.push(c.text),l+=c.text.length;break}case"image":{if(c.source?.type==="base64"&&c.source.data)a.push({url:`data:${c.source.media_type};base64,${c.source.data}`,alt:"Image"});else if(c.data){const d=c.data.startsWith("data:")?c.data:`data:${c.mimeType||"image/png"};base64,${c.data}`;a.push({url:d,alt:"Image"})}break}case"tool_use":{r.push({id:c.id,name:c.name,args:c.input,status:"running",startedAt:Date.now(),insertedAtContentLength:l});break}case"toolCall":{r.push({id:c.id,name:c.name,args:c.arguments,status:"pending",insertedAtContentLength:l});break}case"tool_result":{const d=r.find(u=>u.id===c.id);d&&(d.result=c.content,d.status="complete",d.completedAt=Date.now());break}case"thinking":{const d=c.thinking?.trim();d&&o.push(d);break}}const i=o.length>0?o.join(`
|
|
7
|
-
|
|
8
|
-
`):void 0;return{text:t.join(`
|
|
9
|
-
`),toolCalls:r,images:a,thinking:i}}function y2(e,t){const r=Qi(e.content),a=e.role==="toolResult"?"assistant":e.role,o=a==="user"?Fw(r.text):r.text,l={id:t,role:a,content:o,images:r.images.length>0?r.images:void 0,toolCalls:r.toolCalls.length>0?r.toolCalls:void 0,thinking:r.thinking,timestamp:e.timestamp??Date.now(),isStreaming:!1};return e.__openclaw?.kind==="compaction"&&(l.kind="compaction"),l}function w2(e,t){const r=new Map;for(const a of e)r.set(a.id,{...a});for(const a of t){const o=r.get(a.id);o?r.set(a.id,{...o,...a,startedAt:o.startedAt??a.startedAt}):r.set(a.id,a)}return Array.from(r.values())}function Td(e){if(!e||typeof e!="object")return e;if(Array.isArray(e)&&e.length>0){const r=e[0];if(r?.type==="text"&&typeof r.text=="string")return r.text}const t=e;if(Array.isArray(t.content)&&t.content.length>0){const r=t.content[0];if(r?.type==="text"&&typeof r.text=="string")return r.text}return e}const Tu=new Map;function k2(e){const t=new Map;for(const r of e)r.role==="toolResult"&&r.toolCallId&&t.set(r.toolCallId,{content:Td(r.content),isError:r.isError??!1});return t}function S2(e,t){if(e.toolCalls)for(const r of e.toolCalls){const a=t.get(r.id);a&&(r.result=a.content,r.status=a.isError?"error":"complete",r.completedAt=Date.now())}}function _2(e,t){return e.role==="assistant"&&t.role==="assistant"&&Math.abs(t.timestamp-e.timestamp)<_w}function C2(e,t){const r=e.content.length,a=e.content&&t.content?`
|
|
10
|
-
|
|
11
|
-
`:"";if(t.toolCalls&&t.toolCalls.length>0){const o=t.toolCalls.map(l=>({...l,insertedAtContentLength:l.insertedAtContentLength!==void 0?r+a.length+l.insertedAtContentLength:void 0}));e.toolCalls=[...e.toolCalls??[],...o]}t.content&&(e.content=e.content?`${e.content}${a}${t.content}`:t.content),e.timestamp=Math.max(e.timestamp,t.timestamp)}async function Kc(e,t=Cw){const r=Tu.get(e);if(r)return A.chat.debug("History load already in progress for session, waiting:",e),r;const a=E2(e,t);Tu.set(e,a);try{await a}finally{Tu.delete(e)}}async function E2(e,t){_d.value=!0,Vi.value=null;try{const r=await O("chat.history",{sessionKey:e,limit:t}),a=k2(r.messages),o=[];for(let l=0;l<r.messages.length;l++){const i=r.messages[l];if(i.role==="toolResult")continue;const c=y2(i,`hist_${l}_${Date.now()}`);S2(c,a);const d=o[o.length-1];if(d&&_2(d,c)){C2(d,c);continue}o.push(c)}f2(o),l2(e,o),r.thinkingLevel&&(i2.value=r.thinkingLevel)}catch(r){throw Vi.value=r instanceof Error?r.message:String(r),r}finally{_d.value=!1}}function T2(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.runId=="string"&&typeof t.sessionKey=="string"&&typeof t.seq=="number"&&typeof t.state=="string"&&["delta","final","aborted","error"].includes(t.state)}function A2(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.runId=="string"&&typeof t.stream=="string"&&["lifecycle","assistant","tool","error","compaction","thinking"].includes(t.stream)&&typeof t.seq=="number"&&typeof t.ts=="number"}function Yg(e,t,r){if(!e)return{content:t};if(t.startsWith(e))return{content:t};if(r!==void 0&&r>0&&r<=e.length){const o=e.slice(0,r),l=e.slice(r);if(t.startsWith(l))return{content:o+t,lastBlockStart:r};if(l.startsWith(t))return{content:e,lastBlockStart:r};if(t.length<l.length&&!l.includes(t)){const i=e.length+Hs.length;return{content:e+Hs+t,lastBlockStart:i}}return{content:o+t,lastBlockStart:r}}const a=e.length+Hs.length;return{content:e+Hs+t,lastBlockStart:a}}function I2(e,t){const r=e.trim().replace(/\s+/g," ");return r.length<=t?r:r.slice(0,t).trim()+"…"}async function R2(e,t){if(!Fg(e))return;const r=I2(t,50);if(!r){A.chat.debug("autoRenameSession: empty message, skipping");return}try{A.chat.debug("autoRenameSession: renaming",{sessionKey:e,title:r}),await O("sessions.patch",{key:e,label:r}),Wh(e,{label:r}),A.chat.info("autoRenameSession: renamed session",{sessionKey:e,title:r})}catch(a){A.chat.error("autoRenameSession: failed",{sessionKey:e,error:a})}}const M2=["/new","/reset"];function $2(e){const t=e.trim().toLowerCase();return M2.some(r=>t===r||t.startsWith(`${r} `))}let L2=0;function D2(e){if(!e||e.length===0)return;const t=[];for(const r of e)r.type==="image"&&t.push({url:r.content,alt:r.fileName});return t.length>0?t:void 0}function P2(){return`cove_${Date.now()}_${++L2}`}async function Xg(e,t,r){const a=r?.messageId??P2(),o=`user_${a}`,l=r?.messageId!=null,i={id:o,role:"user",content:t,images:D2(r?.attachments),timestamp:Date.now(),isStreaming:!1,status:"sending",sessionKey:e};if(!P.value)return A.chat.info("Not connected, queuing message"),i.status="queued",Fp(i),a;if(qh.value&&!l)return A.chat.info("Currently streaming, queuing message"),i.status="queued",Fp(i),a;l?Gg(o):Xi(i),_o(a,e);try{A.chat.debug("Sending message to session:",e);const c=await O("chat.send",{sessionKey:e,message:t,thinking:r?.thinking,timeoutMs:r?.timeoutMs,idempotencyKey:a,attachments:r?.attachments});if(c.status==="error"){const d=c.summary??"Unknown error";throw Cd(a,d),Np(o,d),new Error(d)}if(p2(o),$2(t)&&(A.chat.info("Reset command detected, clearing messages for session:",e),setTimeout(()=>{Wc(),Kc(e).catch(d=>{A.chat.warn("Failed to reload history after reset:",d)})},100)),!l&&Fg(e)){const d=Et.value.find(h=>h.key===e),u=s("common.newChat");d?.label===u&&R2(e,t).catch(h=>{A.chat.warn("Auto-rename failed:",h instanceof Error?h.message:String(h))})}return a}catch(c){const d=c instanceof Error?c.message:String(c);throw A.chat.error("chat.send failed:",c),Cd(a,d),Np(o,d),c}}async function Yh(e){if(!e.sessionKey){A.chat.warn("Cannot resend message - missing sessionKey:",e.id);return}Vg(e.id),Ne.value.find(a=>a.id===e.id)?Gg(e.id):Xi({...e,status:"sending"});const r=e.id.replace(/^user_/,"");await Xg(e.sessionKey,e.content,{messageId:r})}async function Ad(e){if(qh.value){A.chat.debug("Still streaming, not processing queue");return}const t=Tt.value.find(r=>r.sessionKey===e);if(!t){A.chat.debug("No queued messages for session");return}A.chat.info("Processing next queued message:",t.id);try{await Yh(t)}catch(r){A.chat.error("Failed to send queued message:",r)}}async function O2(e){let t=Tt.value.find(r=>r.id===e);if(t||(t=Ne.value.find(r=>r.id===e&&r.status==="failed")),!t){A.chat.warn("Cannot retry message - not found:",e);return}await Yh(t)}async function N2(){const e=[...Tt.value];if(e.length!==0){A.chat.info(`Processing ${e.length} queued messages`);for(const t of e)try{await Yh(t)}catch(r){A.chat.error("Failed to send queued message:",r)}}}async function Zg(e){await O("chat.abort",{sessionKey:e})}let ml=null,vl=null;const xr=new Set;function F2(){return ml&&vl||(A.chat.info("Subscribing to chat events"),ml=wd("chat",e=>{if(!T2(e)){A.chat.warn("Invalid chat event payload:",e);return}W2(e)}),vl=wd("agent",e=>{if(!A2(e)){A.chat.warn("Invalid agent event payload:",e);return}const t=e;t.stream==="tool"?H2(t):t.stream==="lifecycle"?t.data?.phase==="start"?z2(t):(t.data?.phase==="end"||t.data?.phase==="error")&&U2(t):t.stream==="compaction"?j2(t):t.stream==="assistant"&&B2(t)})),Id}function Id(){ml&&(ml(),ml=null),vl&&(vl(),vl=null),xr.clear()}function z2(e){const{runId:t,sessionKey:r}=e;if(!bs(r)||xr.has(t))return;!ue.value.get(t)&&r&&(A.chat.debug("Creating run on-the-fly for lifecycle start:",t,"session:",r),_o(t,r))}function U2(e){const{runId:t,sessionKey:r}=e;if(!bs(r))return;if(xr.has(t)){xr.delete(t),dr.value&&(A.chat.warn("Clearing stale isCompacting flag via lifecycle end for run:",t),Lc(()=>{dr.value=!1,Hr.value=!0}));return}const a=ue.value.get(t);if(a&&(a.status==="pending"||a.status==="streaming")){A.chat.debug("Completing run via lifecycle end:",t,"phase:",e.data?.phase);const o=!a.content;if(a.content){const l={id:`assistant_${t}`,role:"assistant",content:a.content,toolCalls:a.toolCalls?.length?a.toolCalls:void 0,timestamp:Date.now()};Zi(t,l)}else Zi(t);if(a.sessionKey&&(setTimeout(()=>Ad(a.sessionKey),100),o)){const l=a.sessionKey;setTimeout(()=>{Kc(l).catch(i=>{A.chat.warn("Failed to refresh history after heartbeat:",i)})},500)}}}function j2(e){const t=e.data?.phase;if(A.chat.info("Compaction event:",t,"runId:",e.runId,"isCompacting:",dr.value),e.runId&&xr.add(e.runId),t==="start"){if(e.runId&&ue.value.has(e.runId)){A.chat.debug("Removing ghost run created before compaction registration:",e.runId);const r=new Map(ue.value);r.delete(e.runId),ue.value=r}dr.value=!0}else if(t==="end"){const r=Ne.value.length,a=typeof e.data?.summary=="string"?e.data.summary:void 0;Lc(()=>{dr.value=!1,Ji.value=a,Hr.value=!0,Yi.value=r}),A.chat.info("Compaction ended, divider at index:",r)}}function B2(e){const{runId:t,sessionKey:r,data:a}=e,o=typeof a?.text=="string"?a.text:null;if(!o||xr.has(t)||!bs(r))return;let l=ue.value.get(t);if(!l&&r&&(A.chat.debug("Creating run for assistant stream:",t,"session:",r),_o(t,r),l=ue.value.get(t)),!l)return;const{content:i,lastBlockStart:c}=Yg(l.content,o,l.lastBlockStart);pl(t,i,l.toolCalls,c)}function H2(e){const{runId:t,sessionKey:r,data:a}=e;if(!a||xr.has(t)||!bs(r))return;A.chat.debug("Tool event received",{runId:t,phase:a.phase,toolCallId:a.toolCallId,toolName:a.name});let o=ue.value.get(t);if(!o&&(A.chat.debug("Creating run on-the-fly for tool event:",t,"session:",r),_o(t,r??"unknown"),o=ue.value.get(t),!o))return;const l=a.toolCallId??`tool_${Date.now()}`,i=a.name??"unknown",c=[...o.toolCalls];A.chat.debug("Tool event state before processing",{runId:t,currentContentLen:o.content.length,existingToolCallsCount:c.length,existingToolCallIds:c.map(u=>u.id)});const d=()=>{let u=c.findIndex(h=>h.id===l);return u<0?(A.chat.debug("Creating missing tool call:",l),c.push({id:l,name:i,args:a.args,status:"running",startedAt:Date.now(),insertedAtContentLength:o.content.length,contentSnapshotAtStart:o.content}),u=c.length-1):a.args&&!c[u].args&&(c[u]={...c[u],args:a.args}),u};switch(a.phase){case"start":{if(c.some(u=>u.id===l)){A.chat.debug("Tool start skipped - duplicate",{toolCallId:l});return}setTimeout(()=>{const u=ue.value.get(t);if(!u){A.chat.warn("Tool start deferred - run no longer exists",{runId:t,toolCallId:l});return}const h=[...u.toolCalls];if(h.some(p=>p.id===l)){A.chat.debug("Tool start deferred skipped - duplicate",{toolCallId:l});return}const f={id:l,name:i,args:a.args,status:"running",startedAt:Date.now(),insertedAtContentLength:u.content.length,contentSnapshotAtStart:u.content};A.chat.debug("Tool start processed",{toolCallId:l,toolName:i,insertedAtContentLength:f.insertedAtContentLength,contentSnapshotLen:u.content.length}),h.push(f),pl(t,u.content,h)},0);break}case"update":{const u=d();c[u]={...c[u],result:Td(a.partialResult)},pl(t,o.content,c);break}case"result":{const u=d();c[u]={...c[u],result:Td(a.result),status:a.isError?"error":"complete",completedAt:Date.now()},pl(t,o.content,c);break}}}function W2(e){const{runId:t,state:r,errorMessage:a}=e;if(xr.has(t)){A.chat.debug("Skipping chat event for compaction run:",t,r);return}switch(A.chat.debug("Chat event:",r,t,"session:",e.sessionKey),r){case"delta":K2(e);break;case"final":q2(e);break;case"aborted":v2(t);break;case"error":Cd(t,a??"Unknown error");break}}function K2(e){const{runId:t,sessionKey:r,message:a}=e;if(!a)return;const o=Qi(a.content);let l=ue.value.get(t);if(!l&&(A.chat.debug("Creating run on-the-fly for delta:",t,"session:",r),_o(t,r),l=ue.value.get(t),!l)||o.toolCalls.length===0)return;A.chat.debug("Delta event - processing tool calls only",{runId:t,parsedToolCallsCount:o.toolCalls.length,existingToolCallsCount:l.toolCalls.length});const i=w2(l.toolCalls,o.toolCalls);pl(t,l.content,i,l.lastBlockStart)}function q2(e){const{runId:t,sessionKey:r,message:a}=e;let o=ue.value.get(t);if(A.chat.debug("Final event received",{runId:t,hasExistingRun:!!o,existingContentLen:o?.content?.length,existingToolCallsCount:o?.toolCalls?.length,hasMessage:!!a}),o||(A.chat.debug("Creating run on-the-fly for final:",t,"session:",r),_o(t,r),o=ue.value.get(t)),!o){A.chat.warn("Final event with no run and couldn't create one:",t);return}if(a?.content){const u=Qi(a.content);if(u.text&&zh({role:"assistant",content:u.text})){A.chat.debug("Heartbeat detected, completing run without message:",t),Zi(t),setTimeout(()=>Ad(r),100);return}}let l=o?.content??"",i=[];if(a?.content){const u=Qi(a.content);A.chat.debug("Final message parsed",{runId:t,parsedTextLen:u.text.length,parsedToolCallsCount:u.toolCalls.length,existingContentLen:l.length,willUseFinaContent:u.text.length>=l.length}),u.text.length>=l.length?(l=u.text,i=u.toolCalls):u.text&&(A.chat.debug("Final merging partial text",{existingLen:l.length,parsedLen:u.text.length}),l=Yg(l,u.text,o?.lastBlockStart).content)}A.chat.debug("Final content determined",{runId:t,finalContentLen:l.length,finalContentPreview:l.slice(-200)});const c=o?.toolCalls?.map(u=>{const h={...u};(h.status==="running"||h.status==="pending")&&(h.status="complete",h.completedAt=Date.now());const f=i.find(p=>p.id===u.id);return f?.insertedAtContentLength!==void 0&&(h.insertedAtContentLength=f.insertedAtContentLength),delete h.contentSnapshotAtStart,h}),d={id:`assistant_${t}`,role:"assistant",content:l,toolCalls:c?.length?c:void 0,timestamp:a?.timestamp??Date.now()};Zi(t,d),setTimeout(()=>{Ad(r)},100)}async function Xh(e){F2(),await Kc(e)}function G2(){Id(),Wc()}function V2(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return e;if(e.startsWith("/")){const t=pt.value;if(t)return`${t.replace(/^ws/,"http")}${e}`}return e}const J2="Assistant",Y2="🤖",X2="You",Rd=m(J2),Md=m(Y2),Z2=m(null),Q2=m(X2),ek=m(null),Up=m(!1);async function Zh(e){Up.value=!0;try{const r=await O("agent.identity.get",e?{sessionKey:e}:{});r&&(r.name&&(Rd.value=r.name),r.avatar&&(Md.value=V2(r.avatar)),r.agentId&&(Z2.value=r.agentId),A.ui.info("Loaded assistant identity:",Rd.value,"avatar:",Md.value))}catch(t){A.ui.error("Failed to load assistant identity:",t)}finally{Up.value=!1}}const tk=300*1e3,Qg=m(ak()),jp=m(!1),Bp=m(null);let gi=null;const Qh=q(()=>{const e=Qg.value;return e?e.providers.find(t=>t.provider==="anthropic")??null:null}),nk=q(()=>{const e=Qh.value;return e!==null&&e.windows.length>0&&!e.error}),rk=q(()=>{const e=Qh.value;if(!e||e.windows.length===0)return null;const t=e.windows.find(r=>r.label==="Week");return t||e.windows[0]});function ak(){const e=G0();return e?(A.usage.debug("Loaded cached usage"),e):null}async function Hp(){if(!P.value){A.usage.debug("Skipping usage fetch - not connected");return}jp.value=!0,Bp.value=null;try{const e=await Zo.send("usage.status");Qg.value=e,V0(e),A.usage.debug("Usage fetched:",e)}catch(e){const t=e instanceof Error?e.message:"Failed to fetch usage";Bp.value=t,A.usage.error("Usage fetch failed:",t)}finally{jp.value=!1}}function ef(){eb(),Hp(),gi=setInterval(()=>{Hp()},tk),A.usage.debug("Usage polling started")}function eb(){gi&&(clearInterval(gi),gi=null,A.usage.debug("Usage polling stopped"))}let Wp=!1;P.subscribe(e=>{Wp&&!e&&eb(),Wp=e});const yr=m([]),tb=m(null),Kp=m(!1),qp=m(null),ok=q(()=>{const e=new Map;for(const t of yr.value){const r=t.provider;e.has(r)||e.set(r,[]),e.get(r).push(t)}return e});async function tf(){Kp.value=!0,qp.value=null;try{const[e,t]=await Promise.all([O("models.list",{}),O("status",{}).catch(()=>null)]);yr.value=e.models??[],A.ui.debug("Loaded models:",yr.value.length);const r=t?.sessions?.defaults?.model;r&&(tb.value=r,A.ui.debug("Default model:",r))}catch(e){qp.value=e instanceof Error?e.message:String(e),A.ui.error("Failed to load models:",e)}finally{Kp.value=!1}}function lk(e){return yr.value.find(t=>t.id===e)}function sk(e){const t=lk(e);return t?t.name:e.replace(/^anthropic\//,"").replace(/^openai\//,"").replace(/^claude-/,"").replace(/^gpt-/,"")}const bi=m([]),ec=m("main"),ik=m("main"),Au=m(!1),Gp=m(null),$d=q(()=>bi.value.map(e=>({value:e.id,label:`${e.identity?.emoji||"🤖"} ${e.identity?.name||e.name||e.id}`})));async function nb(){if(Au.value){A.gateway.debug("loadAgents: already loading, skipping");return}Au.value=!0,Gp.value=null;try{A.gateway.debug("loadAgents: fetching from gateway");const e=await O("agents.list",{});if(e&&Array.isArray(e.agents))bi.value=e.agents,ec.value=e.defaultId||"main",ik.value=e.mainKey||"main",A.gateway.info("loadAgents: loaded",{count:e.agents.length,defaultId:e.defaultId,agents:e.agents.map(t=>t.id)});else throw new Error("Invalid response from agents.list")}catch(e){const t=e instanceof Error?e.message:"Failed to load agents";A.gateway.error("loadAgents: error",{error:t}),Gp.value=t,bi.value.length===0&&(bi.value=[{id:"main",identity:{name:"Main",emoji:"🤖"}}],ec.value="main")}finally{Au.value=!1}}const ck=200,uk=480,Wr=288,nf=1024,dk=typeof window<"u"&&window.innerWidth<nf,Dt=m(!dk);function rf(){window.innerWidth<nf&&(Dt.value=!1)}const xi=m(j0()),Iu=m(!1);$e(()=>{B0(xi.value)});const rb=m("/"),Ru=m(!1),Kl=m(!1),hk=20,fk=100,Vp=Wr*.3,pk=75,Qn=m(null),Lt=m(!1);function mk(){R(()=>{const e=()=>window.innerWidth<nf;let t=0,r=0,a=!1,o=!1;const l=d=>{if(!e())return;const u=d.touches[0];t=u.clientX,r=u.clientY;const h=u.clientX>=hk&&u.clientX<=fk;a=h,o=Dt.value,(h||o)&&(Qn.value=o?Wr:0)},i=d=>{if(!e()||!a&&!o)return;const u=d.touches[0],h=u.clientX-t;if(Math.abs(u.clientY-r)>pk&&!Lt.value){Qn.value=null,a=!1;return}if((Math.abs(h)>10||Lt.value)&&(Lt.value=!0,d.preventDefault()),!Lt.value)return;let p;o?p=Wr+h:p=h,p=Math.max(0,Math.min(Wr,p)),Qn.value=p},c=()=>{if(!Lt.value){Qn.value=null,a=!1,o=!1;return}const d=Qn.value??0;o?Dt.value=d>Wr-Vp:Dt.value=d>Vp,Qn.value=null,Lt.value=!1,a=!1,o=!1};return document.addEventListener("touchstart",l,{passive:!0}),document.addEventListener("touchmove",i,{passive:!1}),document.addEventListener("touchend",c,{passive:!0}),document.addEventListener("touchcancel",c,{passive:!0}),()=>{document.removeEventListener("touchstart",l),document.removeEventListener("touchmove",i),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",c)}},[])}function vk({direction:e,onResizeStart:t,onResize:r,onResizeEnd:a,class:o=""}){const l=B(0),i=B(!1),c=B({move:null,up:null});R(()=>()=>{c.current.move&&document.removeEventListener("mousemove",c.current.move),c.current.up&&document.removeEventListener("mouseup",c.current.up),i.current&&(document.body.style.cursor="",document.body.style.userSelect="")},[]);const d=ee(h=>{h.preventDefault(),i.current=!0,l.current=e==="horizontal"?h.clientX:h.clientY,t?.();const f=v=>{if(!i.current)return;const w=e==="horizontal"?v.clientX:v.clientY,k=w-l.current;l.current=w,r(k)},p=()=>{i.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",p),c.current.move=null,c.current.up=null,document.body.style.cursor="",document.body.style.userSelect="",a?.()};c.current.move=f,c.current.up=p,document.addEventListener("mousemove",f),document.addEventListener("mouseup",p),document.body.style.cursor=e==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[e,r,t,a]),u=e==="horizontal";return n("div",{onMouseDown:d,class:`
|
|
12
|
-
${u?"w-1 cursor-col-resize hover:w-1.5":"h-1 cursor-row-resize hover:h-1.5"}
|
|
13
|
-
bg-transparent hover:bg-[var(--color-accent)]/30 active:bg-[var(--color-accent)]/50
|
|
14
|
-
transition-all duration-150 ease-out
|
|
15
|
-
flex-shrink-0
|
|
16
|
-
${o}
|
|
17
|
-
`,role:"separator","aria-orientation":u?"horizontal":"vertical","aria-label":"Resize handle"})}const gk=(...e)=>e.filter((t,r,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===r).join(" ").trim();const Jp=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const bk=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,a)=>a?a.toUpperCase():r.toLowerCase());const Yp=e=>{const t=bk(e);return t.charAt(0).toUpperCase()+t.slice(1)};var xk={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};const yk=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const wk=({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,children:o,iconNode:l,class:i="",...c})=>Qt("svg",{...xk,width:String(t),height:t,stroke:e,"stroke-width":a?Number(r)*24/Number(t):r,class:["lucide",i].join(" "),...!o&&!yk(c)&&{"aria-hidden":"true"},...c},[...l.map(([d,u])=>Qt(d,u)),...na(o)]);const M=(e,t)=>{const r=({class:a="",className:o="",children:l,...i})=>Qt(wk,{...i,iconNode:t,class:gk(`lucide-${Jp(Yp(e))}`,`lucide-${Jp(e)}`,a,o)},l);return r.displayName=Yp(e),r};const hr=M("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const kk=M("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const qc=M("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Gc=M("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const af=M("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);const Sk=M("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);const ab=M("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);const Xp=M("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const _k=M("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);const Ck=M("bug",[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]);const Co=M("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const Ek=M("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);const nn=M("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const ze=M("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const ob=M("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const Ye=M("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const xs=M("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Vc=M("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const Tk=M("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);const Eo=M("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const To=M("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const Ak=M("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const ge=M("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const Ik=M("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const ys=M("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const tc=M("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);const Rk=M("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const Ft=M("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const lb=M("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);const ws=M("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const sb=M("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const of=M("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const en=M("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const Mk=M("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]);const $k=M("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);const Lk=M("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const nc=M("folder",[["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",key:"1kt360"}]]);const Dk=M("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);const Pk=M("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const tn=M("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const ib=M("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);const Zp=M("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);const cb=M("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const ub=M("heart",[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]]);const Fa=M("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const ks=M("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const Jc=M("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);const Ld=M("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);const Ok=M("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);const Nk=M("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);const db=M("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const hb=M("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Qp=M("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const Fk=M("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);const zk=M("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);const Uk=M("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);const fb=M("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]);const An=M("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);const pb=M("monitor-play",[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);const qt=M("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);const em=M("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);const Mu=M("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);const mb=M("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const jk=M("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);const Bk=M("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);const eo=M("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const Hk=M("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);const lf=M("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const wr=M("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const sf=M("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);const rc=M("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);const Wk=M("rectangle-ellipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);const Xe=M("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const Yc=M("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const cf=M("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const tm=M("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);const lt=M("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const vb=M("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);const la=M("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);const uf=M("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);const df=M("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Kk=M("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);const Xc=M("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const qk=M("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);const to=M("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const Zc=M("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);const Gk=M("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const hf=M("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);const nm=M("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const Vk=M("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);const gb=M("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);const At=M("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const Dd=M("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);const Cr=M("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const bb=M("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const sr=M("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);const Jk=M("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);const Yk=M("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);const Xk=M("webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);const xb=M("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const ac=M("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);const yb=M("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);const pa=M("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Rn=M("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function wb(e,t){for(var r in t)e[r]=t[r];return e}function rm(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var a in t)if(a!=="__source"&&e[a]!==t[a])return!0;return!1}function am(e,t){this.props=e,this.context=t}(am.prototype=new Ct).isPureReactComponent=!0,am.prototype.shouldComponentUpdate=function(e,t){return rm(this.props,e)||rm(this.state,t)};var om=V.__b;V.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),om&&om(e)};var Zk=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Ss(e){function t(r){var a=wb({},r);return delete a.ref,e(a,r.ref||null)}return t.$$typeof=Zk,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Qk=V.__e;V.__e=function(e,t,r,a){if(e.then){for(var o,l=t;l=l.__;)if((o=l.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}Qk(e,t,r,a)};var lm=V.unmount;function kb(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(a){typeof a.__c=="function"&&a.__c()}),e.__c.__H=null),(e=wb({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(a){return kb(a,t,r)})),e}function Sb(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(a){return Sb(a,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function $u(){this.__u=0,this.o=null,this.__b=null}function _b(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function qs(){this.i=null,this.l=null}V.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),lm&&lm(e)},($u.prototype=new Ct).__c=function(e,t){var r=t.__c,a=this;a.o==null&&(a.o=[]),a.o.push(r);var o=_b(a.__v),l=!1,i=function(){l||a.__z||(l=!0,r.__R=null,o?o(d):d())};r.__R=i;var c=r.__P;r.__P=null;var d=function(){if(!--a.__u){if(a.state.__a){var u=a.state.__a;a.__v.__k[0]=Sb(u,u.__c.__P,u.__c.__O)}var h;for(a.setState({__a:a.__b=null});h=a.o.pop();)h.__P=c,h.forceUpdate()}};a.__u++||32&t.__u||a.setState({__a:a.__b=a.__v.__k[0]}),e.then(i,i)},$u.prototype.componentWillUnmount=function(){this.o=[]},$u.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),a=this.__v.__k[0].__c;this.__v.__k[0]=kb(this.__b,r,a.__O=a.__P)}this.__b=null}var o=t.__a&&Qt(j,null,e.fallback);return o&&(o.__u&=-33),[Qt(j,null,t.__a?null:e.children),o]};var sm=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};function e4(e){return this.getChildContext=function(){return e.context},e.children}function t4(e){var t=this,r=e.h;if(t.componentWillUnmount=function(){hd(null,t.v),t.v=null,t.h=null},t.h&&t.h!==r&&t.componentWillUnmount(),!t.v){for(var a=t.__v;a!==null&&!a.__m&&a.__!==null;)a=a.__;t.h=r,t.v={nodeType:1,parentNode:r,childNodes:[],__k:{__m:a.__m},contains:function(){return!0},namespaceURI:r.namespaceURI,insertBefore:function(o,l){this.childNodes.push(o),t.h.insertBefore(o,l)},removeChild:function(o){this.childNodes.splice(this.childNodes.indexOf(o)>>>1,1),t.h.removeChild(o)}}}hd(Qt(e4,{context:t.context},e.__v),t.v)}function Qc(e,t){var r=Qt(t4,{__v:e,h:t});return r.containerInfo=t,r}(qs.prototype=new Ct).__a=function(e){var t=this,r=_b(t.__v),a=t.l.get(e);return a[0]++,function(o){var l=function(){t.props.revealOrder?(a.push(o),sm(t,e,a)):o()};r?r(l):l()}},qs.prototype.render=function(e){this.i=null,this.l=new Map;var t=na(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},qs.prototype.componentDidUpdate=qs.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){sm(e,r,t)})};var n4=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,r4=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,a4=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,o4=/[A-Z0-9]/g,l4=typeof document<"u",s4=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};Ct.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ct.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var im=V.event;function i4(){}function c4(){return this.cancelBubble}function u4(){return this.defaultPrevented}V.event=function(e){return im&&(e=im(e)),e.persist=i4,e.isPropagationStopped=c4,e.isDefaultPrevented=u4,e.nativeEvent=e};var d4={enumerable:!1,configurable:!0,get:function(){return this.class}},cm=V.vnode;V.vnode=function(e){typeof e.type=="string"&&(function(t){var r=t.props,a=t.type,o={},l=a.indexOf("-")===-1;for(var i in r){var c=r[i];if(!(i==="value"&&"defaultValue"in r&&c==null||l4&&i==="children"&&a==="noscript"||i==="class"||i==="className")){var d=i.toLowerCase();i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&c===!0?c="":d==="translate"&&c==="no"?c=!1:d[0]==="o"&&d[1]==="n"?d==="ondoubleclick"?i="ondblclick":d!=="onchange"||a!=="input"&&a!=="textarea"||s4(r.type)?d==="onfocus"?i="onfocusin":d==="onblur"?i="onfocusout":a4.test(i)&&(i=d):d=i="oninput":l&&r4.test(i)?i=i.replace(o4,"-$&").toLowerCase():c===null&&(c=void 0),d==="oninput"&&o[i=d]&&(i="oninputCapture"),o[i]=c}}a=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=na(r.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),a=="select"&&o.defaultValue!=null&&(o.value=na(r.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",d4)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o})(e),e.$$typeof=n4,cm&&cm(e)};var um=V.__r;V.__r=function(e){um&&um(e),e.__c};var dm=V.diffed;V.diffed=function(e){dm&&dm(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value)};const h4={xs:{container:"w-3 h-3",thickness:"2px"},sm:{container:"w-4 h-4",thickness:"2px"},md:{container:"w-6 h-6",thickness:"3px"},lg:{container:"w-8 h-8",thickness:"3px"}};function te({size:e="md",label:t,class:r}){const a=h4[e];return n("span",{class:`cove-spinner ${a.container} ${r||""}`,style:{"--spinner-thickness":a.thickness},role:"status","aria-label":t||s("accessibility.loading"),children:n("span",{class:"sr-only",children:t||s("accessibility.loading")})})}const Cb=sg(null);function hm({children:e}){const[t,r]=U(null),[a,o]=U(!1),l=B(null),i=B(null);R(()=>()=>{l.current&&cancelAnimationFrame(l.current),i.current&&clearTimeout(i.current)},[]);const c=ee(h=>{i.current&&(clearTimeout(i.current),i.current=null),o(!0),l.current=requestAnimationFrame(()=>{r({...h,isVisible:!0}),l.current=null})},[]),d=ee(()=>{l.current&&(cancelAnimationFrame(l.current),l.current=null),r(h=>h?{...h,isVisible:!1}:null),i.current=window.setTimeout(()=>{o(!1),r(null),i.current=null},150)},[]),u=ee(h=>{r(f=>f?{...f,triggerRect:h}:null)},[]);return R(()=>{if(!a)return;const h=f=>{f.key==="Escape"&&d()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[a,d]),n(Cb.Provider,{value:{show:c,hide:d,update:u},children:[e,a&&Qc(n(f4,{state:t}),document.body)]})}function f4({state:e}){const t=B(null),[r,a]=U("top"),[o,l]=U({top:0,left:0});if(R(()=>{if(!e?.triggerRect||!t.current)return;const u=t.current.getBoundingClientRect(),{adjustedPlacement:h,pos:f}=p4(e.triggerRect,u,e.placement);a(h),l(f)},[e?.triggerRect,e?.placement,e?.content]),!e?.triggerRect)return null;const{content:i,isVisible:c}=e;return n("div",{ref:t,role:"tooltip",class:`
|
|
18
|
-
fixed z-[9999] pointer-events-none
|
|
19
|
-
transition-opacity duration-150
|
|
20
|
-
${c?"opacity-100":"opacity-0"}
|
|
21
|
-
`,style:{top:`${o.top}px`,left:`${o.left}px`},children:[n("div",{class:`
|
|
22
|
-
px-2.5 py-1.5 text-xs font-medium
|
|
23
|
-
bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)]
|
|
24
|
-
rounded-lg shadow-lg
|
|
25
|
-
border border-[var(--color-border)]
|
|
26
|
-
whitespace-nowrap
|
|
27
|
-
`,children:i}),n("div",{class:`
|
|
28
|
-
absolute w-0 h-0 border-[6px]
|
|
29
|
-
${m4(r)}
|
|
30
|
-
`})]})}function p4(e,t,r){const l={width:window.innerWidth,height:window.innerHeight},i={top:e.top,bottom:l.height-e.bottom,left:e.left,right:l.width-e.right},c={top:i.top>=t.height+8+8,bottom:i.bottom>=t.height+8+8,left:i.left>=t.width+8+8,right:i.right>=t.width+8+8};let d=r;r==="top"&&!c.top?d=c.bottom?"bottom":c.left?"left":c.right?"right":"bottom":r==="bottom"&&!c.bottom?d=c.top?"top":c.left?"left":c.right?"right":"top":r==="left"&&!c.left?d=c.right?"right":c.top?"top":c.bottom?"bottom":"right":r==="right"&&!c.right&&(d=c.left?"left":c.top?"top":c.bottom?"bottom":"left");let u,h;switch(d){case"top":u=e.top-t.height-8,h=e.left+e.width/2-t.width/2;break;case"bottom":u=e.bottom+8,h=e.left+e.width/2-t.width/2;break;case"left":u=e.top+e.height/2-t.height/2,h=e.left-t.width-8;break;case"right":u=e.top+e.height/2-t.height/2,h=e.right+8;break}return h=Math.max(8,Math.min(h,l.width-t.width-8)),u=Math.max(8,Math.min(u,l.height-t.height-8)),{adjustedPlacement:d,pos:{top:u,left:h}}}function m4(e){switch(e){case"top":return"top-full left-1/2 -translate-x-1/2 border-t-[var(--color-bg-elevated)] border-x-transparent border-b-transparent";case"bottom":return"bottom-full left-1/2 -translate-x-1/2 border-b-[var(--color-bg-elevated)] border-x-transparent border-t-transparent";case"left":return"left-full top-1/2 -translate-y-1/2 border-l-[var(--color-bg-elevated)] border-y-transparent border-r-transparent";case"right":return"right-full top-1/2 -translate-y-1/2 border-r-[var(--color-bg-elevated)] border-y-transparent border-l-transparent"}}const v4=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0;function Ao({content:e,placement:t="top",delay:r=300,children:a,class:o,disabled:l=!1}){const i=ug(Cb),c=B(null),d=B(null),u=l||v4(),h=ee(()=>{u||!i||(c.current=window.setTimeout(()=>{if(d.current){const p=d.current.getBoundingClientRect();i.show({content:e,placement:t,triggerRect:p})}},r))},[i,e,t,r,u]),f=ee(()=>{c.current&&(clearTimeout(c.current),c.current=null),i?.hide()},[i]);return R(()=>()=>{c.current&&clearTimeout(c.current)},[]),i?n("div",{ref:d,class:`inline-flex ${o||""}`,onMouseEnter:h,onMouseLeave:f,onFocus:h,onBlur:f,children:a}):n("div",{class:`inline-flex ${o||""}`,children:a})}const g4={sm:{button:"p-1.5",icon:"w-4 h-4"},md:{button:"p-2",icon:"w-5 h-5"},lg:{button:"p-3",icon:"w-6 h-6"}},b4={default:`
|
|
31
|
-
text-[var(--color-text-secondary)]
|
|
32
|
-
hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
|
|
33
|
-
focus-visible:ring-[var(--color-accent)]
|
|
34
|
-
`,ghost:`
|
|
35
|
-
text-[var(--color-text-muted)]
|
|
36
|
-
hover:bg-[var(--color-bg-primary)] hover:text-[var(--color-text-secondary)]
|
|
37
|
-
focus-visible:ring-[var(--color-accent)]
|
|
38
|
-
`,danger:`
|
|
39
|
-
text-[var(--color-text-secondary)]
|
|
40
|
-
hover:bg-[var(--color-error)]/10 hover:text-[var(--color-error)]
|
|
41
|
-
focus-visible:ring-[var(--color-error)]
|
|
42
|
-
`},K=Ss(({icon:e,label:t,size:r="md",variant:a="default",loading:o=!1,disabled:l,showTooltip:i=!0,tooltipPlacement:c="top",class:d,...u},h)=>{const f=l||o,p=g4[r],v=n("button",{ref:h,type:"button",disabled:f,"aria-label":t,class:`
|
|
43
|
-
inline-flex items-center justify-center cursor-pointer
|
|
44
|
-
rounded-md transition-all duration-200 ease-out
|
|
45
|
-
hover:scale-105 active:scale-95
|
|
46
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
|
|
47
|
-
disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:active:scale-100
|
|
48
|
-
${p.button}
|
|
49
|
-
${b4[a]}
|
|
50
|
-
${d||""}
|
|
51
|
-
`,...u,children:o?n(te,{size:"sm"}):n("span",{class:`${p.icon} flex items-center justify-center [&>svg]:w-full [&>svg]:h-full`,"aria-hidden":"true",children:e})});return i&&t?n(Ao,{content:t,placement:c,delay:400,children:v}):v});K.displayName="IconButton";const x4={default:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)]",success:"bg-[var(--color-success)]/15 text-[var(--color-success)]",warning:"bg-[var(--color-warning)]/15 text-[var(--color-warning)]",error:"bg-[var(--color-error)]/15 text-[var(--color-error)]",info:"bg-[var(--color-accent)]/15 text-[var(--color-accent)]"},y4={default:"bg-[var(--color-text-muted)]",success:"bg-[var(--color-success)]",warning:"bg-[var(--color-warning)]",error:"bg-[var(--color-error)]",info:"bg-[var(--color-accent)]"},w4={sm:"px-1.5 py-0.5 text-xs",md:"px-2 py-1 text-xs"};function X({variant:e="default",size:t="md",dot:r=!1,children:a,class:o}){return n("span",{class:`
|
|
52
|
-
inline-flex items-center gap-1.5
|
|
53
|
-
font-medium rounded-full
|
|
54
|
-
${x4[e]}
|
|
55
|
-
${w4[t]}
|
|
56
|
-
${o||""}
|
|
57
|
-
`,children:[r&&n("span",{class:`w-1.5 h-1.5 rounded-full ${y4[e]}`,"aria-hidden":"true"}),a]})}function Io(e,t,r=!0){R(()=>{if(!r)return;const a=o=>{const l=Array.isArray(e)?e:[e],i=o.target;l.some(d=>d.current?.contains(i))||t()};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t,r])}function Eb(){const e=c2.value,[t,r]=U(!1),[a,o]=U(i1),l=B(null),i=B(null),c=Math.floor(e/2),d=Math.max(0,c-a),u=ee(()=>{o(c),c1(c),r(!1)},[c]);Io([i,l],u,t);const f=Hg.value.filter(zh).slice(-10).reverse();return n("div",{class:"relative inline-block",ref:i,children:[n(K,{icon:n(ub,{class:"w-4 h-4"}),label:s("chat.heartbeats",{count:e}),onClick:()=>t?u():r(!0),variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),d>0&&n(X,{variant:"default",class:"absolute -top-1.5 -right-1.5 min-w-[1.25rem] h-5 text-xs px-1 pointer-events-none",children:d}),t&&n("div",{ref:l,class:"absolute top-full left-0 mt-1 z-50 min-w-[240px] max-h-[300px] overflow-y-auto rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] shadow-lg",children:[n("div",{class:"px-3 py-2 border-b border-[var(--color-border)]",children:n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:s("chat.heartbeatsTitle")})}),n("div",{class:"py-1",children:f.length===0?n("div",{class:"px-3 py-4 text-sm text-[var(--color-text-muted)] text-center",children:s("chat.noHeartbeats")}):f.map(p=>n("div",{class:"px-3 py-2 flex items-center gap-2 text-sm hover:bg-[var(--color-bg-hover)]",children:[n("span",{class:"text-[var(--color-success)]",children:"✓"}),n("span",{class:"text-[var(--color-text-muted)]",children:re(p.timestamp)})]},p.id))})]})]})}const k4={sm:"w-6 h-6 rounded",md:"w-8 h-8 rounded-lg",lg:"w-20 h-20 rounded-2xl",xl:"w-24 h-24 rounded-2xl shadow-lg"};function eu({size:e="md",class:t="",animated:r=!1}){const a=k4[e];return n("img",{src:"/cove-icon.png",alt:"Cove",class:`${a} ${r?"group-hover:scale-110 transition-transform":""} ${t}`.trim()})}function ma({class:e}){return n(pa,{class:e||"w-5 h-5","aria-hidden":"true"})}function Tb({class:e}){return n(wr,{class:e||"w-4 h-4","aria-hidden":"true"})}function S4({class:e}){return n(Uk,{class:e||"w-5 h-5","aria-hidden":"true"})}function _4({class:e}){return n(df,{class:e||"w-5 h-5","aria-hidden":"true"})}function Ab({class:e}){return n(pb,{class:e||"w-5 h-5","aria-hidden":"true"})}function C4({class:e}){return n(zk,{class:e||"w-5 h-5","aria-hidden":"true"})}function Ro({class:e,open:t}){return n(ze,{class:`${e||"w-4 h-4"} transition-transform ${t?"rotate-180":""}`,"aria-hidden":"true"})}function E4({class:e}){return n(kk,{class:e||"w-5 h-5","aria-hidden":"true"})}function T4({class:e}){return n(ws,{class:e||"w-3 h-3","aria-hidden":"true"})}function A4({class:e}){return n(vb,{class:e||"w-5 h-5","aria-hidden":"true"})}function I4({class:e}){return n(Gk,{class:e||"w-5 h-5",fill:"currentColor","aria-hidden":"true"})}function R4({class:e}){return n(lb,{class:e||"w-5 h-5","aria-hidden":"true"})}function Ib({class:e}){return n(eo,{class:e||"w-5 h-5","aria-hidden":"true"})}function Rb({class:e}){return n(At,{class:e||"w-5 h-5","aria-hidden":"true"})}function M4({class:e}){return n(Dk,{class:e||"w-5 h-5","aria-hidden":"true"})}function $4({class:e}){return n(Hk,{class:e||"w-5 h-5","aria-hidden":"true"})}function ff({class:e}){return n(lt,{class:e||"w-5 h-5","aria-hidden":"true"})}function L4({class:e}){return n(nn,{class:e||"w-5 h-5","aria-hidden":"true"})}function D4({class:e}){return n(Fa,{class:e||"w-5 h-5","aria-hidden":"true"})}function Mb(e){return e>=90?"critical":e>=80?"high":e>=50?"medium":"low"}function P4(){const[e,t]=U(!1),r=B(null);if(!nk.value)return null;Io(r,()=>t(!1),e);const a=Qh.value,o=rk.value;if(!a||!o)return null;const l=Mb(o.usedPercent),i=`${a.displayName} Usage`;return n("div",{ref:r,class:"relative",children:[n(Ao,{content:i,placement:"bottom",disabled:e,children:n("button",{type:"button",onClick:()=>t(!e),class:"flex items-center gap-2 px-2 py-1 rounded-md cursor-pointer hover:bg-[var(--color-bg-surface)] transition-colors","aria-expanded":e,"aria-label":`Anthropic usage: ${Math.round(o.usedPercent)}% ${o.label}`,children:[n("div",{class:"w-16 h-1.5 bg-[var(--color-border)] rounded-full overflow-hidden",children:n("div",{class:`h-full rounded-full transition-all ${$b(l)}`,style:{width:`${Math.min(100,o.usedPercent)}%`}})}),n("span",{class:`text-xs font-medium ${Lb(l)}`,children:[Math.round(o.usedPercent),"%"]}),n("span",{class:"text-xs text-[var(--color-text-muted)] hidden sm:inline",children:o.label})]})}),e&&n("div",{class:"absolute right-0 top-full mt-2 w-64 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50 p-3",children:[n("div",{class:"flex items-center justify-between mb-3",children:[n("span",{class:"text-sm font-medium",children:a.displayName}),a.plan&&n("span",{class:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-2 py-0.5 rounded",children:a.plan})]}),n("div",{class:"space-y-3",children:a.windows.map(c=>n(O4,{window:c},c.label))})]})]})}function O4({window:e}){const t=Mb(e.usedPercent),r=e.resetAt?N4(e.resetAt):null;return n("div",{children:[n("div",{class:"flex items-center justify-between mb-1",children:[n("span",{class:"text-xs text-[var(--color-text-secondary)]",children:e.label}),n("span",{class:`text-xs font-medium ${Lb(t)}`,children:[Math.round(e.usedPercent),"%"]})]}),n("div",{class:"w-full h-2 bg-[var(--color-border)] rounded-full overflow-hidden",children:n("div",{class:`h-full rounded-full transition-all ${$b(t)}`,style:{width:`${Math.min(100,e.usedPercent)}%`}})}),r&&n("div",{class:"text-[10px] text-[var(--color-text-muted)] mt-1",children:["Resets ",r]})]})}function $b(e){switch(e){case"critical":return"bg-[var(--color-error)]";case"high":return"bg-[var(--color-warning)]";case"medium":return"bg-[var(--color-warning)]";default:return"bg-[var(--color-success)]"}}function Lb(e){switch(e){case"critical":return"text-[var(--color-error)]";case"high":return"text-[var(--color-warning)]";default:return"text-[var(--color-text-secondary)]"}}function N4(e){const t=Date.now(),r=e-t;if(r<0)return"soon";const a=Math.floor(r/(1e3*60*60)),o=Math.floor(r%(1e3*60*60)/(1e3*60));return a>24?`in ${Math.floor(a/24)}d`:a>0?`in ${a}h ${o}m`:`in ${o}m`}function F4(){return n("header",{class:"h-14 flex-shrink-0 bg-[var(--color-bg-secondary)]",children:n("div",{class:"h-full px-4 flex items-center justify-between",children:[n("div",{class:"flex items-center gap-3",children:[n("div",{class:"lg:hidden",children:n(K,{icon:Dt.value?n(ma,{}):n(S4,{}),label:s("accessibility.sidebarToggle"),onClick:()=>Dt.value=!Dt.value,variant:"ghost",size:"md"})}),n("a",{href:"/",class:"hidden sm:flex items-center gap-2.5 font-semibold text-lg group no-underline",children:[n(eu,{size:"md",animated:!0}),n("span",{class:"bg-gradient-to-r from-[var(--color-accent)] to-[color-mix(in_oklch,var(--color-accent),var(--color-text-primary)_40%)] bg-clip-text text-transparent",children:s("common.cove")})]})]}),n("div",{class:"flex items-center gap-4",children:[(()=>{const e=z4(Pe.value);return n("div",{class:"flex items-center gap-2 text-sm animate-[fade-in_150ms_ease-out_100ms_forwards] opacity-0",children:[n("span",{class:`w-2 h-2 rounded-full ${e.dot}`,"aria-hidden":"true"}),n("span",{class:`hidden sm:inline ${e.text}`,children:[s(e.label),P.value&&Ot.value&&Ot.value!=="dev"&&n("span",{class:"text-[var(--color-text-muted)]",children:[" v",Ot.value]})]})]})})(),n("div",{class:"sm:hidden flex items-center gap-1",children:[n(Eb,{}),Je.value&&n("div",{"data-tour":"canvas",children:n(K,{icon:n(Ab,{}),label:s("common.canvas"),onClick:()=>Kl.value=!Kl.value,variant:"ghost",size:"md"})}),n(K,{icon:n(ff,{}),label:s("chat.search"),onClick:()=>Be.value=!0,variant:"ghost",size:"md"})]}),n(P4,{}),n("div",{"data-tour":"settings",children:n(K,{icon:n(_4,{}),label:s("nav.settings"),onClick:()=>{const e=Oc()==="/settings";Le(e?rb.value:"/settings")},variant:"ghost",size:"md"})})]})]})})}const fm={connected:{dot:"bg-[var(--color-success)]",text:"text-[var(--color-success)]",label:"common.healthy"},connecting:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.connecting"},authenticating:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.connecting"},reconnecting:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.reconnecting"},error:{dot:"bg-[var(--color-error)]",text:"text-[var(--color-error)]",label:"common.error"},disconnected:{dot:"bg-[var(--color-text-muted)]",text:"text-[var(--color-text-muted)]",label:"status.disconnected"}};function z4(e){return fm[e]??fm.disconnected}const U4={primary:`
|
|
58
|
-
bg-[var(--color-accent)] text-white
|
|
59
|
-
hover:opacity-90
|
|
60
|
-
focus-visible:ring-[var(--color-accent)]
|
|
61
|
-
`,secondary:`
|
|
62
|
-
bg-[var(--color-bg-surface)] text-[var(--color-text-primary)]
|
|
63
|
-
border border-[var(--color-border)]
|
|
64
|
-
hover:bg-[var(--color-bg-secondary)]
|
|
65
|
-
focus-visible:ring-[var(--color-accent)]
|
|
66
|
-
`,ghost:`
|
|
67
|
-
bg-transparent text-[var(--color-text-secondary)]
|
|
68
|
-
hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
|
|
69
|
-
focus-visible:ring-[var(--color-accent)]
|
|
70
|
-
`,danger:`
|
|
71
|
-
bg-[var(--color-error)] text-white
|
|
72
|
-
hover:opacity-90
|
|
73
|
-
focus-visible:ring-[var(--color-error)]
|
|
74
|
-
`},j4={sm:"px-3 py-1.5 text-xs gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-6 py-3 text-base gap-2.5"},N=Ss(({type:e="button",variant:t="primary",size:r="md",loading:a=!1,icon:o,iconRight:l,fullWidth:i=!1,disabled:c,children:d,class:u,...h},f)=>n("button",{ref:f,type:e,disabled:c||a,class:`
|
|
75
|
-
inline-flex items-center justify-center
|
|
76
|
-
font-medium rounded-xl
|
|
77
|
-
transition-all duration-200 ease-out
|
|
78
|
-
shadow-soft-sm hover:shadow-soft
|
|
79
|
-
active:scale-[0.97] active:shadow-none
|
|
80
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
|
|
81
|
-
disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none disabled:active:scale-100 disabled:grayscale disabled:hover:opacity-40
|
|
82
|
-
${U4[t]}
|
|
83
|
-
${j4[r]}
|
|
84
|
-
${i?"w-full":""}
|
|
85
|
-
${u||""}
|
|
86
|
-
`,...h,children:[a?n(te,{size:r==="lg"?"md":"sm"}):o?n("span",{class:"flex-shrink-0","aria-hidden":"true",children:o}):null,d&&n("span",{children:d}),l&&!a&&n("span",{class:"flex-shrink-0","aria-hidden":"true",children:l})]}));N.displayName="Button";const Lu=['a[href]:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"]):not([disabled])'].join(", ");function B4(e,t={}){const{enabled:r=!0,autoFocus:a=!0,returnFocusTo:o}=t,l=B(null);R(()=>{if(!r||!e.current)return;if(l.current=document.activeElement,a){const u=e.current.querySelectorAll(Lu)[0];u&&requestAnimationFrame(()=>{u.focus()})}function i(d){if(d.key!=="Tab"||!e.current)return;const u=e.current.querySelectorAll(Lu);if(u.length===0)return;const h=u[0],f=u[u.length-1];if(d.shiftKey&&document.activeElement===h){d.preventDefault(),f.focus();return}if(!d.shiftKey&&document.activeElement===f){d.preventDefault(),h.focus();return}e.current.contains(document.activeElement)||(d.preventDefault(),h.focus())}function c(d){if(!e.current)return;const u=d.target;if(!e.current.contains(u)){const h=e.current.querySelectorAll(Lu);h.length>0&&h[0].focus()}}return document.addEventListener("keydown",i),document.addEventListener("focusin",c),()=>{document.removeEventListener("keydown",i),document.removeEventListener("focusin",c);const d=o?.current??l.current;d&&typeof d.focus=="function"&&d.focus()}},[r,a,e,o])}const Du=250,H4=80,W4={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl",full:"sm:max-w-4xl"};function We({open:e,onClose:t,title:r,size:a="md",hideCloseButton:o=!1,closeOnBackdrop:l=!0,closeOnEscape:i=!0,children:c,footer:d}){const u=B(null),h=B(null),[f,p]=U(e),v=B(!1),w=B(null),k=ee(()=>{if(v.current)return;v.current=!0;const x=u.current,_=h.current;x&&(x.style.transition=`transform ${Du}ms ease-out`,x.style.transform="translateY(100%)"),_&&(_.style.transition=`opacity ${Du}ms ease-out`,_.style.opacity="0"),setTimeout(()=>{p(!1),v.current=!1,t()},Du)},[t]);R(()=>{e?(p(!0),v.current=!1):f&&!v.current&&k()},[e,f,k]),R(()=>{e&&u.current&&requestAnimationFrame(()=>{u.current&&(u.current.style.transform="",u.current.style.transition=""),h.current&&(h.current.style.opacity="",h.current.style.transition="")})},[e]),B4(u,{enabled:e&&!v.current,autoFocus:!1});const T=ee(x=>{x.key==="Escape"&&i&&!v.current&&k()},[i,k]),y=ee(x=>{w.current=x.touches[0].clientY,u.current&&(u.current.style.transition="none")},[]),g=ee(x=>{if(w.current===null)return;const E=x.touches[0].clientY-w.current;if(E>0&&(u.current&&(u.current.style.transform=`translateY(${E}px)`),h.current)){const $=Math.max(0,1-E/300);h.current.style.opacity=String($)}},[]),b=ee(()=>{if(w.current===null)return;const x=u.current;if(x){const E=x.style.transform.match(/translateY\((\d+)px\)/);(E?parseInt(E[1],10):0)>H4?k():(x.style.transition="transform 150ms ease-out",x.style.transform="translateY(0)",h.current&&(h.current.style.transition="opacity 150ms ease-out",h.current.style.opacity="1"))}w.current=null},[k]);return R(()=>{if(f)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[f]),R(()=>{if(f)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f,T]),f?Qc(n("div",{class:"fixed inset-0 z-50 flex items-end sm:items-center justify-center sm:p-4",role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,children:[n("div",{ref:h,class:"absolute inset-0 bg-black/40 backdrop-blur-md animate-fade-in",onClick:()=>{l&&!v.current&&k()},"aria-hidden":"true"}),n("div",{ref:u,tabIndex:-1,class:`
|
|
87
|
-
relative w-full ${W4[a]}
|
|
88
|
-
bg-[var(--color-bg-surface)]
|
|
89
|
-
border border-[var(--color-border)]
|
|
90
|
-
max-h-[85vh] sm:max-h-[90vh] flex flex-col
|
|
91
|
-
focus:outline-none shadow-soft-xl
|
|
92
|
-
rounded-t-xl border-b-0 sm:rounded-xl sm:border-b
|
|
93
|
-
animate-slide-up-full sm:animate-scale-in
|
|
94
|
-
`,children:[n("div",{class:"sm:hidden flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing",onTouchStart:y,onTouchMove:g,onTouchEnd:b,"aria-hidden":"true",children:n("div",{class:"w-10 h-1 rounded-full bg-[var(--color-text-muted)]/40"})}),r&&n("div",{class:"flex items-center justify-between px-4 sm:px-6 py-2 sm:py-4 border-b border-[var(--color-border)]",children:[n("h2",{id:"modal-title",class:"text-base sm:text-lg font-semibold text-[var(--color-text-primary)] truncate pr-2",children:r}),!o&&n(K,{icon:n(ma,{}),label:s("actions.close"),variant:"ghost",size:"sm",onClick:k,class:"hidden sm:flex flex-shrink-0"})]}),n("div",{class:"flex-1 overflow-y-auto px-4 sm:px-6 py-3 sm:py-4",children:c}),d&&n("div",{class:"px-4 sm:px-6 py-3 sm:py-4 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] sm:rounded-b-xl",children:d})]})]}),document.body):null}const K4={sm:"px-2.5 py-1.5 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"},Z=Ss(({size:e="md",error:t,leftElement:r,rightElement:a,fullWidth:o=!1,disabled:l,class:i,...c},d)=>{const u=!!t;return n("div",{class:`${o?"w-full":""}`,children:[n("div",{class:"relative",children:[r&&n("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[var(--color-text-muted)]",children:r}),n("input",{ref:d,disabled:l,class:`
|
|
95
|
-
block rounded-xl
|
|
96
|
-
bg-[var(--color-bg-primary)]
|
|
97
|
-
border transition-all duration-200 ease-out
|
|
98
|
-
shadow-soft-sm focus:shadow-soft
|
|
99
|
-
placeholder:text-[var(--color-text-muted)]
|
|
100
|
-
focus:outline-none focus:ring-2 focus:ring-offset-0
|
|
101
|
-
disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
|
|
102
|
-
${u?"border-[var(--color-error)] focus:ring-[var(--color-error)]":"border-[var(--color-border)] focus:ring-[var(--color-accent)] focus:border-transparent"}
|
|
103
|
-
${K4[e]}
|
|
104
|
-
${r?"pl-10":""}
|
|
105
|
-
${a?"pr-10":""}
|
|
106
|
-
${o?"w-full":""}
|
|
107
|
-
${i||""}
|
|
108
|
-
`,"aria-invalid":u,"aria-describedby":u?`${c.id}-error`:void 0,...c}),a&&n("div",{class:"absolute inset-y-0 right-0 flex items-center pr-3 text-[var(--color-text-muted)]",children:a})]}),typeof t=="string"&&t&&n("p",{id:`${c.id}-error`,class:"mt-1 text-xs text-[var(--color-error)]",role:"alert",children:t})]})});Z.displayName="Input";function Oe({label:e,htmlFor:t,error:r,hint:a,required:o,children:l,class:i}){return n("div",{class:i,children:[e&&n("label",{htmlFor:t,class:"block text-sm font-medium text-[var(--color-text-secondary)] mb-1.5",children:[e,o&&n("span",{class:"text-[var(--color-error)] ml-0.5",children:"*"})]}),l,a&&!r&&n("p",{class:"mt-1 text-xs text-[var(--color-text-muted)]",children:a}),r&&n("p",{class:"mt-1 text-xs text-[var(--color-error)]",children:r})]})}function oc(e){if(e.displayName)return e.displayName;if(e.label)return e.label;const t=e.key.split(":");if(t.length>=3&&t[0]==="agent"){const r=t[2];return r==="main"?jg(t[1]):fl(r)}if(t.length>=2){const r=t[t.length-1];if($p(r)){const a=t[t.length-2];if(a&&!$p(a))return fl(a)}return fl(r)}return e.key}function q4(e){if(!e.kind||e.kind==="main")return null;switch(e.kind){case"isolated":return{label:"Isolated",color:"text-[var(--color-warning)]"};case"channel":return{label:e.channel||"Channel",color:"text-[var(--color-accent)]"};default:return null}}function G4(e){const t=e.channel??e.lastChannel;return!t||t==="webchat"?null:fl(t)}function pm({session:e,isActive:t=!1,isMain:r=!1,onClick:a,onRename:o,onDelete:l}){const[i,c]=U(!1),[d,u]=U(!1),h=B(null),f=B(null);Io(h,()=>c(!1),i);const p=()=>{if(!i&&f.current){const _=f.current.getBoundingClientRect();let E=f.current.parentElement;for(;E&&getComputedStyle(E).overflowY!=="auto";)E=E.parentElement;const I=(E?E.getBoundingClientRect().bottom:window.innerHeight)-_.bottom;u(I<100)}c(!i)},v=q4(e),w=G4(e),k=Vw(e.totalTokens??e.contextTokens),T=e.updatedAt||e.lastActiveAt,y=Kw(e.key),g=y?jg(y):null,b=Hh.value===e.key,x=!!Gh(e.key);return n("div",{class:`relative group transition-all duration-300 ${b?"opacity-0 scale-95 -translate-x-2":""}`,children:[n("button",{type:"button",onClick:a,class:`
|
|
109
|
-
w-full text-left px-3 py-2.5 rounded-xl text-sm
|
|
110
|
-
flex items-start gap-2.5 transition-all duration-200 ease-out
|
|
111
|
-
${x?"ai-glow":""}
|
|
112
|
-
${t?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] shadow-soft-sm":"hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-primary)]"}
|
|
113
|
-
`,children:[x?n(te,{size:"xs",class:"flex-shrink-0 mt-0.5 text-[var(--color-accent)]"}):r?n($4,{class:`w-3.5 h-3.5 flex-shrink-0 mt-1 ${t?"text-[var(--color-accent)]":"text-[var(--color-text-muted)]"}`}):n("span",{class:`w-2 h-2 rounded-full flex-shrink-0 mt-1.5 ${t?"bg-[var(--color-accent)]":"bg-[var(--color-text-muted)]"}`,"aria-hidden":"true"}),n("span",{class:"flex-1 min-w-0",children:[n("span",{class:"flex items-center gap-2",children:[n("span",{class:"truncate font-medium",children:oc(e)}),v&&n("span",{class:`text-[10px] font-medium ${v.color}`,children:v.label})]}),n("span",{class:"flex items-center gap-1.5 text-xs text-[var(--color-text-muted)] mt-0.5 overflow-hidden",children:[g&&n("span",{class:"truncate flex-shrink",children:g}),w&&n(j,{children:[g&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"truncate flex-shrink text-[var(--color-accent)]/70",children:w})]}),k&&n(j,{children:[(g||w)&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"flex-shrink-0",title:`${e.totalTokens??e.contextTokens} tokens`,children:k})]}),n("span",{class:"flex-1 min-w-0"}),T&&n("span",{class:"whitespace-nowrap flex-shrink-0",children:qi(new Date(T))})]})]})]}),(o||l)&&n("div",{ref:h,class:"absolute right-2 top-2",children:[n("button",{ref:f,type:"button",onClick:_=>{_.stopPropagation(),p()},class:`p-1 rounded-lg transition-all duration-150
|
|
114
|
-
${i?"bg-[var(--color-bg-secondary)] text-[var(--color-text-primary)]":"opacity-0 group-hover:opacity-100 hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)]"}`,"aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":i,children:n(R4,{class:"w-4 h-4"})}),i&&n("div",{role:"menu","aria-label":"Session actions",class:`absolute right-0 w-36 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50 py-1 ${d?"bottom-full mb-1":"top-full mt-1"}`,children:[o&&n("button",{type:"button",role:"menuitem",onClick:_=>{_.stopPropagation(),c(!1),o(e)},class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)] transition-colors",children:[n(Ib,{class:"w-4 h-4"}),s("actions.rename")]}),l&&n("button",{type:"button",role:"menuitem",onClick:_=>{_.stopPropagation(),c(!1),l(e)},class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-error)] hover:bg-[var(--color-error)]/10 transition-colors",children:[n(Rb,{class:"w-4 h-4"}),s("actions.delete")]})]})]})]})}function V4({session:e,onClose:t,onRename:r}){const[a,o]=U(""),[l,i]=U(!1),c=B(null);R(()=>{e&&(o(oc(e)),setTimeout(()=>c.current?.select(),100))},[e]);const d=async f=>{if(f.preventDefault(),!(!e||!a.trim())){i(!0);try{await r(e,a.trim()),t()}finally{i(!1)}}};if(!e)return null;const u=oc(e),h=a.trim()!==u;return n(We,{open:!!e,onClose:t,title:s("sessions.rename"),children:n("form",{onSubmit:d,children:[n(Oe,{label:s("sessions.label"),htmlFor:"session-label",children:n(Z,{ref:c,id:"session-label",type:"text",value:a,onInput:f=>o(f.target.value),placeholder:s("sessions.labelPlaceholder"),fullWidth:!0})}),n("div",{class:"flex justify-end gap-2 mt-4",children:[n(N,{variant:"ghost",onClick:t,disabled:l,children:s("actions.cancel")}),n(N,{type:"submit",variant:"primary",loading:l,disabled:!a.trim()||!h,children:s("actions.save")})]})]})})}function J4({session:e,onClose:t,onDelete:r}){const[a,o]=U(!1),l=async()=>{if(e){o(!0);try{t(),await new Promise(i=>setTimeout(i,100)),await r(e)}catch{}finally{o(!1)}}};return e?n(We,{open:!!e,onClose:t,title:s("sessions.delete"),children:[n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:s("sessions.deleteConfirm",{name:oc(e)})}),n("p",{class:"text-xs text-[var(--color-text-muted)] mb-4",children:s("sessions.deleteWarning")}),n("div",{class:"flex justify-end gap-2",children:[n(N,{variant:"ghost",onClick:t,disabled:a,children:s("actions.cancel")}),n(N,{variant:"danger",onClick:l,loading:a,children:s("actions.delete")})]})]}):null}const Y4={sm:{trigger:"px-3 py-2.5 text-sm sm:px-2.5 sm:py-1.5 sm:text-xs",menu:"text-sm sm:text-xs",option:"px-3 py-2.5 sm:px-2.5 sm:py-1.5"},md:{trigger:"px-4 py-3 text-base sm:px-3 sm:py-2 sm:text-sm",menu:"text-base sm:text-sm",option:"px-4 py-3 sm:px-3 sm:py-2"},lg:{trigger:"px-4 py-3 text-base",menu:"text-base",option:"px-4 py-3"}};function Me({value:e,options:t,onChange:r,size:a="md",placeholder:o="Select...","aria-label":l,class:i,className:c,disabled:d=!1,align:u="left",width:h}){const f=i||c,[p,v]=U(!1),[w,k]=U(-1),[T,y]=U(void 0),g=B(null),b=B(null),C=B(null),x=Y4[a],E=t.find(L=>L.value===e)?.label??o;cg(()=>{!h&&C.current&&y(C.current.offsetWidth)},[t,h]);const $=ee(()=>{v(!1),k(-1)},[]),I=ee(L=>{r(L),$(),g.current?.focus()},[r,$]);Io([g,b],$,p);const F=ee(L=>{if(!p){(L.key==="Enter"||L.key===" "||L.key==="ArrowDown")&&(L.preventDefault(),v(!0),k(0));return}switch(L.key){case"Escape":L.preventDefault(),$(),g.current?.focus();break;case"ArrowDown":L.preventDefault(),k(Y=>Math.min(Y+1,t.length-1));break;case"ArrowUp":L.preventDefault(),k(Y=>Math.max(Y-1,0));break;case"Enter":case" ":L.preventDefault(),w>=0&&!t[w]?.disabled&&I(t[w].value);break;case"Tab":$();break}},[p,t,w,$,I]);return n("div",{class:`relative ${f??"inline-block"}`,children:[n("div",{ref:C,"aria-hidden":"true",class:`
|
|
115
|
-
invisible absolute flex items-center gap-2
|
|
116
|
-
${x.trigger}
|
|
117
|
-
`,children:[n("span",{children:t.reduce((L,Y)=>Y.label.length>L.length?Y.label:L,o)}),n(ze,{class:"w-4 h-4 flex-shrink-0"})]}),n("button",{ref:g,type:"button",onClick:()=>!d&&v(!p),onKeyDown:F,disabled:d,"aria-label":l,"aria-haspopup":"listbox","aria-expanded":p,style:h?{width:h}:T&&!f?.includes("w-full")?{minWidth:`${T}px`}:void 0,class:`
|
|
118
|
-
flex items-center justify-between gap-2 rounded-md cursor-pointer
|
|
119
|
-
bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]
|
|
120
|
-
border border-[var(--color-border)] transition-all duration-200 ease-out
|
|
121
|
-
shadow-soft-sm hover:shadow-soft focus:shadow-soft
|
|
122
|
-
focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-0 focus:border-transparent
|
|
123
|
-
disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
|
|
124
|
-
${f?.includes("w-full")?"w-full":""}
|
|
125
|
-
${x.trigger}
|
|
126
|
-
`,children:[n("span",{class:"truncate",children:E}),n(ze,{class:`w-4 h-4 flex-shrink-0 text-[var(--color-text-muted)] transition-transform ${p?"rotate-180":""}`})]}),p&&g.current&&n("div",{ref:b,role:"listbox","aria-label":l,style:{position:"fixed",top:`${g.current.getBoundingClientRect().bottom+4}px`,minWidth:`${g.current.offsetWidth}px`,...u==="right"?{right:`${window.innerWidth-g.current.getBoundingClientRect().right}px`}:{left:`${g.current.getBoundingClientRect().left}px`}},class:`
|
|
127
|
-
z-[100] inline-flex flex-col
|
|
128
|
-
rounded-lg border border-[var(--color-border)]
|
|
129
|
-
bg-[var(--color-bg-primary)] shadow-lg
|
|
130
|
-
overflow-hidden
|
|
131
|
-
${x.menu}
|
|
132
|
-
`,children:t.map((L,Y)=>n("button",{type:"button",role:"option","aria-selected":L.value===e,disabled:L.disabled,onClick:()=>!L.disabled&&I(L.value),onMouseEnter:()=>k(Y),class:`
|
|
133
|
-
text-left whitespace-nowrap transition-colors
|
|
134
|
-
${x.option}
|
|
135
|
-
${L.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}
|
|
136
|
-
${L.value===e?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}
|
|
137
|
-
${w===Y&&!L.disabled?"bg-[var(--color-bg-tertiary)]":""}
|
|
138
|
-
${L.disabled?"":"hover:bg-[var(--color-bg-tertiary)]"}
|
|
139
|
-
`,children:L.label},L.value))})]})}function Db({checked:e,onChange:t,label:r,description:a,disabled:o=!1,class:l=""}){return n("label",{class:`flex items-start gap-3 ${o?"opacity-50 cursor-not-allowed":"cursor-pointer"} ${l}`,children:[n("input",{type:"checkbox",checked:e,onChange:i=>t(i.target.checked),disabled:o,class:"sr-only peer"}),n("div",{class:`
|
|
140
|
-
flex-shrink-0 w-5 h-5 rounded border-2 transition-colors
|
|
141
|
-
flex items-center justify-center
|
|
142
|
-
peer-focus-visible:ring-2 peer-focus-visible:ring-[var(--color-accent)] peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-[var(--color-bg-primary)]
|
|
143
|
-
${e?"bg-[var(--color-accent)] border-[var(--color-accent)]":"bg-[var(--color-bg-primary)] border-[var(--color-border)] hover:border-[var(--color-accent)]"}
|
|
144
|
-
`,"aria-hidden":"true",children:e&&n(L4,{class:"w-3 h-3 text-white"})}),(r||a)&&n("div",{class:"flex-1 min-w-0",children:[r&&n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:r}),a&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:a})]})]})}function X4({open:e,onClose:t,onCreate:r}){const[a,o]=U(nt.value.defaultAgentId||ec.value),[l,i]=U(!1),c=()=>{l&&(nt.value={...nt.value,defaultAgentId:a,useDefaults:!0}),r(a),t()},d=()=>{o(nt.value.defaultAgentId||ec.value),i(!1),t()};return $d.value.length===0?null:n(We,{open:e,onClose:d,title:s("common.newChat"),children:n("div",{class:"space-y-6",children:[n("div",{children:[n("label",{class:"block text-sm font-medium text-[var(--color-text-primary)] mb-2",children:s("common.agent")}),n(Me,{value:a,onChange:o,options:$d.value,class:"w-full"}),n("p",{class:"mt-1.5 text-xs text-[var(--color-text-muted)]",children:s("newChatModal.agentDescription")})]}),n(Db,{checked:l,onChange:i,label:s("newChatModal.rememberChoice"),description:s("newChatModal.rememberChoiceDescription")}),n("div",{class:"flex justify-end gap-3 pt-2",children:[n(N,{variant:"secondary",onClick:d,children:s("actions.cancel")}),n(N,{variant:"primary",onClick:c,children:s("newChatModal.create")})]})]})})}const Z4={sm:{track:"w-10 h-5 sm:w-8 sm:h-4",thumb:"w-4 h-4 sm:w-3 sm:h-3",translate:"translate-x-5 sm:translate-x-4"},md:{track:"w-12 h-6 sm:w-10 sm:h-5",thumb:"w-5 h-5 sm:w-4 sm:h-4",translate:"translate-x-6 sm:translate-x-5"},lg:{track:"w-12 h-6",thumb:"w-5 h-5",translate:"translate-x-6"}},Ue=Ss(({checked:e,onChange:t,size:r="md",label:a,description:o,disabled:l,class:i,id:c,...d},u)=>{const h=Z4[r],f=c?`${c}-label`:void 0,p=c?`${c}-desc`:void 0;return n("div",{class:`flex items-start justify-between gap-3 ${i||""}`,children:[(a||o)&&n("div",{class:"flex flex-col",children:[a&&n("span",{id:f,class:"text-sm font-medium text-[var(--color-text-primary)]",children:a}),o&&n("span",{id:p,class:"text-xs text-[var(--color-text-muted)]",children:o})]}),n("button",{ref:u,type:"button",role:"switch","aria-checked":e,"aria-labelledby":f,"aria-describedby":p,disabled:l,onClick:()=>t(!e),class:`
|
|
145
|
-
relative inline-flex flex-shrink-0 items-center
|
|
146
|
-
rounded-full transition-colors
|
|
147
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-2
|
|
148
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
149
|
-
${h.track}
|
|
150
|
-
${e?"bg-[var(--color-accent)]":"bg-[var(--color-border)]"}
|
|
151
|
-
`,...d,children:n("span",{"aria-hidden":"true",class:`
|
|
152
|
-
inline-block rounded-full bg-white shadow-sm
|
|
153
|
-
transform transition-transform
|
|
154
|
-
${h.thumb}
|
|
155
|
-
${e?h.translate:"translate-x-0.5"}
|
|
156
|
-
`})})]})});Ue.displayName="Toggle";const Q4={xs:"px-2 py-0.5 text-[10px]",sm:"px-2.5 py-1 text-xs",md:"px-3 py-1.5 text-sm"};function e3({selected:e=!1,size:t="sm",onClick:r,disabled:a=!1,children:o,class:l}){return n("button",{type:"button",onClick:r,disabled:a,class:`
|
|
157
|
-
inline-flex items-center justify-center
|
|
158
|
-
font-medium rounded-md transition-colors
|
|
159
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-1
|
|
160
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
161
|
-
${Q4[t]}
|
|
162
|
-
${e?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-primary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-secondary)]"}
|
|
163
|
-
${l||""}
|
|
164
|
-
`,children:o})}function t3(){const[e,t]=U(!1),r=B(null),a=Hl.value.trim()!=="",o=Bl.value!==null,l=a||o||Wl.value;R(()=>{l&&t(!0)},[l]),R(()=>{e&&r.current&&r.current.focus()},[e]);const i=[{value:null,label:s("common.all")},{value:"main",label:s("common.main")},{value:"isolated",label:s("common.isolated")},{value:"channel",label:s("common.channel")}];return n("div",{class:"px-2 py-1.5",children:[n("div",{class:"flex items-center justify-between",children:[n("h3",{class:"text-xs font-semibold text-[var(--color-accent)] uppercase tracking-wider",children:s("common.sessions")}),n("button",{type:"button",onClick:()=>t(!e),class:`p-1 rounded transition-colors ${l?"text-[var(--color-accent)] bg-[var(--color-accent)]/10":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,"aria-label":s("sessions.filterSessions"),children:n(M4,{class:"w-3.5 h-3.5"})})]}),e&&n("div",{class:"mt-2 space-y-2",children:[n("div",{class:"relative",children:[n(ff,{class:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-[var(--color-text-muted)]"}),n("input",{ref:r,type:"text",value:Hl.value,onInput:c=>Dp(c.target.value),onKeyDown:c=>{c.key==="Escape"&&!l&&t(!1)},placeholder:s("sessions.searchPlaceholder"),class:`w-full pl-7 pr-7 py-1.5 text-xs rounded-md
|
|
165
|
-
bg-[var(--color-bg-primary)] border border-[var(--color-border)]
|
|
166
|
-
text-[var(--color-text-primary)] placeholder-[var(--color-text-muted)]
|
|
167
|
-
focus:outline-none focus:border-[var(--color-accent)]/50`}),a&&n("button",{type:"button",onClick:()=>Dp(""),class:`absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded
|
|
168
|
-
text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]`,children:n(ma,{class:"w-3 h-3"})})]}),n("div",{class:"flex flex-wrap gap-1",children:i.map(c=>n(e3,{size:"xs",selected:Bl.value===c.value,onClick:()=>e2(c.value),children:c.label},c.value??"all"))}),n(Ue,{size:"sm",checked:Wl.value,onChange:t2,label:s("sessions.showCron")})]})]})}function mm(e){Le(`/chat/${encodeURIComponent(e)}`),rf()}const n3={pinned:"sessions.pinned",today:"sessions.today",yesterday:"sessions.yesterday",thisWeek:"sessions.thisWeek",older:"sessions.older"},r3=["pinned","today","yesterday","thisWeek","older"];function a3({onRename:e,onDelete:t}){const r=Qw.value,a=Sd.value.length>0,o=jh(Hl.value);return a?o?n("ul",{class:"space-y-0.5",children:Sd.value.map(l=>n("li",{children:n(pm,{session:l,isActive:tt.value===l.key&&Bn.value.startsWith("/chat"),isMain:oa(l.key),onClick:()=>mm(l.key),onRename:e,onDelete:t})},l.key))}):n("div",{class:"space-y-3",children:r3.map(l=>{const i=r.get(l);return!i||i.length===0?null:n("div",{children:[l!=="pinned"&&n("h4",{class:"text-[10px] font-semibold text-[var(--color-text-muted)] uppercase tracking-wider px-2 py-1",children:s(n3[l])}),n("ul",{class:"space-y-0.5",children:i.map(d=>n("li",{children:n(pm,{session:d,isActive:tt.value===d.key&&Bn.value.startsWith("/chat"),isMain:oa(d.key),onClick:()=>mm(d.key),onRename:e,onDelete:t})},d.key))})]},l)})}):n("p",{class:"text-sm text-[var(--color-text-muted)] px-2 py-4",children:s(o?"sessions.noResults":"sessions.noSessions")})}const Ze="w-5 h-5",o3=()=>n(Nk,{class:Ze,"aria-hidden":"true"}),l3=()=>n(Ek,{class:Ze,"aria-hidden":"true"}),s3=()=>n(db,{class:Ze,"aria-hidden":"true"}),i3=()=>n(ac,{class:Ze,"aria-hidden":"true"}),c3=()=>n(Ld,{class:Ze,"aria-hidden":"true"}),u3=()=>n(ge,{class:Ze,"aria-hidden":"true"}),d3=()=>n(Rn,{class:Ze,"aria-hidden":"true"}),h3=()=>n(ab,{class:Ze,"aria-hidden":"true"}),f3=()=>n(to,{class:Ze,"aria-hidden":"true"}),p3=()=>n(df,{class:Ze,"aria-hidden":"true"}),m3=()=>n(qk,{class:Ze,"aria-hidden":"true"}),v3=()=>n(en,{class:Ze,"aria-hidden":"true"}),g3=()=>n(Sk,{class:Ze,"aria-hidden":"true"}),vm=()=>n(Pk,{class:Ze,"aria-hidden":"true"}),b3=()=>n(fb,{class:Ze,"aria-hidden":"true"}),x3=()=>n(jk,{class:Ze,"aria-hidden":"true"}),y3=[{titleKey:"nav.sections.control",items:[{id:"overview",labelKey:"common.overview",icon:o3,requiresConnection:!0},{id:"usage",labelKey:"common.usage",icon:l3,requiresConnection:!0},{id:"channels",labelKey:"common.channels",icon:s3,requiresConnection:!0},{id:"instances",labelKey:"common.instances",icon:i3,requiresConnection:!0},{id:"sessions",labelKey:"common.sessions",icon:c3,requiresConnection:!0},{id:"cron",labelKey:"common.cronJobs",icon:u3,requiresConnection:!0}]},{titleKey:"common.agent",items:[{id:"skills",labelKey:"common.skills",icon:d3,requiresConnection:!0},{id:"agents",labelKey:"common.agents",icon:h3,requiresConnection:!0},{id:"devices",labelKey:"common.devices",icon:f3,requiresConnection:!0}]},{titleKey:"common.settings",items:[{id:"settings",labelKey:"nav.settings",icon:x3},{id:"config",labelKey:"nav.config",icon:p3,requiresConnection:!0},{id:"debug",labelKey:"common.debug",icon:m3,requiresConnection:!0},{id:"logs",labelKey:"common.logs",icon:v3,requiresConnection:!0}]},{titleKey:"nav.sections.resources",items:[{id:"docs",labelKey:"common.docs",icon:g3,external:Ws.docs},{id:"github",labelKey:"nav.github",icon:vm,external:Ws.github},{id:"github-openclaw",labelKey:"nav.githubOpenClaw",icon:vm,external:Ws.githubOpenClaw},{id:"discord",labelKey:"nav.discord",icon:b3,external:Ws.discord}]}],Pb="cove:nav-sections";function Ob(e){try{const t=`${Pb}-${e}`,r=localStorage.getItem(t);return r?JSON.parse(r):{}}catch{return{}}}function w3(e,t,r){try{const a=`${Pb}-${e}`,o=Ob(e);o[t]=r,localStorage.setItem(a,JSON.stringify(o))}catch{}}function k3({item:e}){const t=`/${e.id}`,r=Pc(()=>!e.external&&(Bn.value===t||e.id==="chat"&&Bn.value.startsWith("/chat"))),a=e.icon;return e.external?n("a",{href:e.external,target:"_blank",rel:"noopener noreferrer",class:"w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm transition-all duration-200 ease-out hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-secondary)]",children:[n("span",{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true",children:n(a,{})}),s(e.labelKey),n(T4,{class:"w-3 h-3 ml-auto text-[var(--color-text-muted)]"})]}):n("button",{type:"button",onClick:()=>{Le(t),rf()},class:`
|
|
169
|
-
w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm
|
|
170
|
-
transition-all duration-200 ease-out
|
|
171
|
-
${r.value?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] shadow-soft-sm":"hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-secondary)]"}
|
|
172
|
-
`,children:[n("span",{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true",children:n(a,{})}),s(e.labelKey)]})}function S3({section:e,mode:t,defaultOpen:r=!1}){const o=Ob(t)[e.titleKey]??r,l=ne(o),i=e.items;return i.length===0?null:n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",onClick:()=>{const d=!l.value;l.value=d,w3(t,e.titleKey,d)},"aria-expanded":l.value,"aria-controls":`nav-section-${e.titleKey}`,class:"w-full flex items-center justify-between px-4 py-2.5 text-xs font-semibold uppercase tracking-wider hover:bg-[var(--color-bg-hover)] transition-colors text-[var(--color-text-tertiary)] hover:text-[var(--color-accent)]",children:[n("span",{children:s(e.titleKey)}),n(Ro,{open:l.value})]}),l.value&&n("ul",{id:`nav-section-${e.titleKey}`,class:"px-3 pb-2 space-y-0.5",role:"list",children:i.map(d=>n("li",{children:n(k3,{item:d})},d.id))})]})}function Nb({expanded:e=!1}){const t=e?"single":"multi";return n("div",{class:e?"border-t border-[var(--color-border)]":"border-t border-[var(--color-border)] max-h-[50%] overflow-y-auto",children:y3.map(r=>n(S3,{section:r,mode:t,defaultOpen:e},`${t}-${r.titleKey}`))})}const Bn=m(window.location.pathname);function _3({isStreaming:e}){const t=Bn.value==="/"||Bn.value.startsWith("/chat");return n("button",{type:"button",onClick:()=>{Le("/chat"),rf()},class:`w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm transition-all duration-200 ease-out ${t?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] shadow-soft-sm":"hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-secondary)]"} ${e?"ai-glow":""}`,children:[e?n(te,{size:"xs",class:"flex-shrink-0 text-[var(--color-accent)]"}):n("span",{class:"w-5 h-5 flex-shrink-0",children:"💬"}),s("nav.chat")]})}function C3(){const[e,t]=U(null),[r,a]=U(null),o=async(d,u)=>{try{await O("sessions.patch",{key:d.key,label:u}),Wh(d.key,{label:u})}catch(h){throw A.ui.error("Failed to rename session:",h),h}},l=async d=>{try{await O("sessions.delete",{key:d.key}),await a2(d.key),Cn.value===d.key&&Le("/chat")}catch(u){throw A.ui.error("Failed to delete session:",u),u}},i=()=>{nt.value.useDefaults?c(nt.value.defaultAgentId):Ru.value=!0},c=async d=>{const u=crypto.randomUUID(),h=`agent:${d}:chat:${u}`;try{await O("sessions.patch",{key:h,label:s("common.newChat")}),await Uc(),Le(`/chat/${encodeURIComponent(h)}`)}catch(f){A.ui.error("Failed to create new chat:",f)}};return n("div",{class:"h-full flex flex-col",children:[ps.value?n(j,{children:[n("div",{class:"p-3",children:n(N,{variant:"primary",disabled:!P.value,onClick:i,fullWidth:!0,icon:n(Tb,{}),children:s("common.newChat")})}),n("div",{class:"flex-1 overflow-y-auto px-3 pb-3","data-tour":"sessions",children:[n(t3,{}),n(a3,{onRename:t,onDelete:a})]}),n(Nb,{})]}):n(E3,{}),n(V4,{session:e,onClose:()=>t(null),onRename:o}),n(J4,{session:r,onClose:()=>a(null),onDelete:l}),n(X4,{open:Ru.value,onClose:()=>Ru.value=!1,onCreate:c})]})}function E3(){ue.value;const e=Ve.value,t=e?!!Gh(e):!1;return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"px-3 py-2",children:n(_3,{isStreaming:t})}),n(Nb,{expanded:!0})]})}const Fb="cove:canvasPanel";function T3(){try{const e=localStorage.getItem(Fb);if(e){const t=JSON.parse(e),r=window.innerWidth-100,a=window.innerHeight-50;return(t.x>r||t.x<0)&&(t.x=100),(t.y>a||t.y<0)&&(t.y=100),t.width>window.innerWidth&&(t.width=400),t.height>window.innerHeight&&(t.height=350),t}}catch{}return null}const _s=T3(),Ra=m(_s?.dockPosition??"floating"),Pd=m(_s?.x??100),Od=m(_s?.y??100),za=m(_s?.width??400),lc=m(_s?.height??350),zb=m(!1),fI=m("floating"),pI=m(!1);$e(()=>{const e={dockPosition:Ra.value,x:Pd.value,y:Od.value,width:za.value,height:lc.value};localStorage.setItem(Fb,JSON.stringify(e))});const mI=280,vI=200,gI=.5,bI=.6,xI=40,A3=44,I3=56,yI=1024,wI=q(()=>{if(zb.value)return{width:"auto",height:`${A3}px`,left:`${Pd.value}px`,top:`${Od.value}px`,borderRadius:"9999px"};switch(Ra.value){case"left":return{left:"0",top:"0",width:`${za.value}px`,height:"100%",borderRadius:"0 12px 12px 0"};case"right":return{right:"0",top:"0",width:`${za.value}px`,height:"100%",borderRadius:"12px 0 0 12px"};case"top":return{left:"0",top:`${I3}px`,width:"100%",height:`${lc.value}px`,borderRadius:"0 0 12px 12px"};default:return{left:`${Pd.value}px`,top:`${Od.value}px`,width:`${za.value}px`,height:`${lc.value}px`,borderRadius:"12px"}}});function kI(e){if("touches"in e){const t=e.touches[0]||e.changedTouches[0];return{x:t.clientX,y:t.clientY}}return{x:e.clientX,y:e.clientY}}function R3({children:e}){mk();const t=Kl.value&&!zb.value&&Ra.value!=="floating",r={};t&&(Ra.value==="left"?r.paddingLeft=`${za.value}px`:Ra.value==="right"?r.paddingRight=`${za.value}px`:Ra.value==="top"&&(r.paddingTop=`${lc.value}px`));const a=o=>{const l=Math.max(ck,Math.min(uk,xi.value+o));xi.value=l};return n("div",{class:"h-screen flex flex-col bg-[var(--color-bg-secondary)] text-[var(--color-text-primary)]",children:[n("a",{href:"#main-content",class:"sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-50 focus:px-4 focus:py-2 focus:bg-[var(--color-accent)] focus:text-white focus:rounded-xl",children:"Skip to content"}),n(F4,{}),n("div",{class:"flex-1 flex overflow-hidden",style:r,children:[(Dt.value||Lt.value)&&n("div",{class:"fixed inset-0 bg-black z-40 lg:hidden",style:{opacity:Lt.value?(Qn.value??0)/Wr*.5:.5,transition:Lt.value?"none":"opacity 200ms ease-out"},onClick:()=>Dt.value=!1,"aria-hidden":"true"}),n("aside",{style:{"--sidebar-width":`${xi.value}px`,transform:Lt.value?`translateX(${(Qn.value??0)-Wr}px)`:void 0},class:`
|
|
173
|
-
fixed inset-y-0 left-0 z-50 w-72 p-2 pr-0 pt-16
|
|
174
|
-
lg:bg-[var(--color-bg-secondary)]
|
|
175
|
-
${Lt.value?"":"transition-transform duration-200 ease-out"}
|
|
176
|
-
${!Lt.value&&(Dt.value?"translate-x-0":"-translate-x-full")}
|
|
177
|
-
lg:relative lg:inset-auto lg:z-auto lg:pt-2 lg:translate-x-0
|
|
178
|
-
lg:w-[var(--sidebar-width)]
|
|
179
|
-
${!Dt.value&&"lg:w-0 lg:p-0"}
|
|
180
|
-
${Iu.value?"lg:transition-none":""}
|
|
181
|
-
`,children:n("div",{class:"h-full rounded-xl bg-[var(--color-bg-surface)] border border-[var(--color-border)] shadow-soft-sm overflow-hidden",children:n(C3,{})})}),Dt.value&&n("div",{class:"hidden lg:flex items-center py-2",children:n(vk,{direction:"horizontal",onResizeStart:()=>Iu.value=!0,onResize:a,onResizeEnd:()=>Iu.value=!1,class:"h-[calc(100%-4rem)] rounded-full"})}),n("main",{id:"main-content",class:"flex-1 flex flex-col overflow-hidden p-2 lg:pl-0",children:n("div",{class:"h-full rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)] shadow-soft overflow-hidden flex flex-col",children:e})})]})]})}const no=m([]);let M3=0;function Gs(e,t="info",r=5e3){const a=`toast-${++M3}`;return no.value=[...no.value,{id:a,type:t,message:e,duration:r}].slice(-5),a}function $3(e){no.value=no.value.filter(t=>t.id!==e)}const J={success:(e,t)=>Gs(e,"success",t),error:(e,t)=>Gs(e,"error",t),warning:(e,t)=>Gs(e,"warning",t),info:(e,t)=>Gs(e,"info",t)},L3={success:{bg:"bg-[var(--color-success)]/10",icon:"text-[var(--color-success)]",border:"border-[var(--color-success)]/20"},error:{bg:"bg-[var(--color-error)]/10",icon:"text-[var(--color-error)]",border:"border-[var(--color-error)]/20"},warning:{bg:"bg-[var(--color-warning)]/10",icon:"text-[var(--color-warning)]",border:"border-[var(--color-warning)]/20"},info:{bg:"bg-[var(--color-accent)]/10",icon:"text-[var(--color-accent)]",border:"border-[var(--color-accent)]/20"}};function D3({id:e,type:t,message:r,duration:a=5e3,onDismiss:o}){const l=L3[t];return R(()=>{if(a<=0)return;const i=setTimeout(()=>{o(e)},a);return()=>clearTimeout(i)},[e,a,o]),n("div",{role:"alert","aria-live":"polite",class:`
|
|
182
|
-
flex items-start gap-3 p-4
|
|
183
|
-
rounded-xl border shadow-soft-lg
|
|
184
|
-
backdrop-blur-sm
|
|
185
|
-
${l.bg} ${l.border}
|
|
186
|
-
animate-slide-in
|
|
187
|
-
`,children:[n("span",{class:`flex-shrink-0 ${l.icon}`,"aria-hidden":"true",children:n(N3,{type:t})}),n("p",{class:"flex-1 text-sm text-[var(--color-text-primary)]",children:r}),n(K,{icon:n(ma,{class:"w-4 h-4"}),label:s("actions.close"),variant:"ghost",size:"sm",onClick:()=>o(e)})]})}const P3={"top-right":"top-4 right-4","top-left":"top-4 left-4","bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","bottom-center":"bottom-4 left-1/2 -translate-x-1/2"};function O3({position:e="top-right"}){return no.value.length===0?null:n("div",{class:`fixed z-50 flex flex-col gap-2 w-full max-w-sm ${P3[e]}`,"aria-label":"Notifications",children:no.value.map(t=>n(D3,{...t,onDismiss:$3},t.id))})}function N3({type:e}){const t="w-5 h-5";switch(e){case"success":return n(nn,{class:t,"aria-hidden":"true"});case"error":return n(pa,{class:t,"aria-hidden":"true"});case"warning":return n(Cr,{class:t,"aria-hidden":"true"});default:return n(ks,{class:t,"aria-hidden":"true"})}}class gm extends Ct{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){this.setState({errorInfo:r}),this.props.onError?.(t,r),A.ui.error("ErrorBoundary caught error:",t),A.ui.error("Component stack:",r.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry?.()};render(){return this.state.hasError?this.props.fallback?this.props.fallback:n(F3,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.handleRetry}):this.props.children}}function F3({error:e,errorInfo:t,onRetry:r}){return n("div",{class:"flex-1 flex items-center justify-center p-8",role:"alert","aria-live":"assertive",children:n("div",{class:"max-w-md w-full text-center",children:[n("div",{class:"text-5xl mb-4",children:"⚠️"}),n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)] mb-2",children:s("errors.generic")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:e?.message||s("errors.unknown")}),n(N,{onClick:r,variant:"primary",children:s("actions.retry")}),!1]})})}const kn=m([]),ql=m(new Map),z3=300*1e3,Nd=new Map;function U3(){const e=Date.now(),t=[];for(const[r,a]of Nd)e-a>z3&&t.push(r);if(t.length>0){const r=new Map(ql.value);for(const a of t)r.delete(a),Nd.delete(a);ql.value=r,A.exec.debug(`Pruned ${t.length} old resolved approval(s)`)}}const sc=m(!1),ic=m(null);function j3(e){const t={request:e,expiresAtMs:e.expiresAtMs,receivedAt:Date.now()};kn.value=[...kn.value,t],A.exec.info(`Exec approval queued: ${e.command} (${kn.value.length} pending)`)}function B3(e){kn.value=kn.value.filter(t=>t.request.requestId!==e)}function H3(){const e=Date.now(),t=kn.value.length;kn.value=kn.value.filter(a=>a.expiresAtMs>e);const r=t-kn.value.length;r>0&&A.exec.info(`Pruned ${r} expired exec approval(s)`)}async function W3(e,t){sc.value=!0,ic.value=null;try{await O("exec.approval.resolve",{id:e,decision:t}),B3(e);const r=new Map(ql.value);r.set(e,t),ql.value=r,Nd.set(e,Date.now()),U3(),A.exec.info(`Exec ${t} (direct): id=${e}`)}catch(r){const a=r instanceof Error?r.message:"Failed to send decision";throw ic.value=a,A.exec.error(`Exec approval error: ${a}`),r}finally{sc.value=!1}}let yi=null,wi=null;function K3(){Ub(),yi=zc(e=>{if(e.event==="exec.approval.requested"&&e.payload){const t=e.payload,r={requestId:t.id,command:t.request.command,cwd:t.request.cwd??void 0,host:t.request.host??void 0,security:t.request.security??void 0,ask:t.request.ask??void 0,agentId:t.request.agentId??void 0,resolvedPath:t.request.resolvedPath??void 0,sessionKey:t.request.sessionKey??void 0,expiresAtMs:t.expiresAtMs};r.expiresAtMs>Date.now()?j3(r):A.exec.debug("Ignoring already-expired approval request")}}),wi=setInterval(H3,1e3),A.exec.info("Exec approval system initialized")}function Ub(){yi&&(yi(),yi=null),wi&&(clearInterval(wi),wi=null),kn.value=[],sc.value=!1,ic.value=null}let bm=!1;P.subscribe(e=>{bm&&!e&&Ub(),bm=e});const Qo=new Map;let xm=!1;function q3(){xm||(xm=!0,window.addEventListener("popstate",()=>{const e=new URLSearchParams(window.location.search);for(const[t,r]of Qo)r.signal.value=e.get(t)}))}function ym(e,t){const r=new URL(window.location.href);t===null||t===""?r.searchParams.delete(e):r.searchParams.set(e,t),window.history.replaceState({},"",r.toString())}function de(e,t={}){const{defaultValue:r=null,ready:a=!0}=t;q3();const o=we(()=>m(!1),[e]),l=we(()=>{const c=Qo.get(e);if(c)return c.refCount++,c.signal;const u=new URLSearchParams(window.location.search).get(e)??r,h=m(u);return Qo.set(e,{signal:h,refCount:1}),h},[e]);R(()=>()=>{const c=Qo.get(e);c&&(c.refCount--,c.refCount<=0&&Qo.delete(e))},[e]),R(()=>{a&&!o.value&&(o.value=!0)},[a]),R(()=>{if(!a)return;const d=new URLSearchParams(window.location.search).get(e);l.value!==d&&ym(e,l.value)},[e,l.value,a]);const i=we(()=>c=>{l.value=c,ym(e,c)},[e,l]);return[l,i,o]}function kr(){window.history.pushState({},"",window.location.href)}function Gl(e,t={}){const{parse:r=h=>h,serialize:a=String,...o}=t,[l,i,c]=de(e,o),d=we(()=>{const h=l.value?l.value.split(",").map(r).filter(Boolean):[];return m(new Set(h))},[e]);R(()=>{const h=l.value?l.value.split(",").map(r).filter(Boolean):[];d.value=new Set(h)},[l.value]);const u=we(()=>h=>{d.value=h;const f=Array.from(h).map(a);i(f.length>0?f.join(","):null)},[i]);return[d,u,c]}function va(e,t){R(()=>{t(e.value||null)},[e.value])}function Fe(e,t,r){R(()=>{e.value&&(t.value=r(e.value))},[])}function En(e,t,r){R(()=>{t(e.value===r?null:e.value)},[e.value])}var wm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pu={exports:{}},km;function V3(){return km||(km=1,(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var r=(function(a){var o=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,i={},c={manual:a.Prism&&a.Prism.manual,disableWorkerMessageHandler:a.Prism&&a.Prism.disableWorkerMessageHandler,util:{encode:function g(b){return b instanceof d?new d(b.type,g(b.content),b.alias):Array.isArray(b)?b.map(g):b.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(g){return Object.prototype.toString.call(g).slice(8,-1)},objId:function(g){return g.__id||Object.defineProperty(g,"__id",{value:++l}),g.__id},clone:function g(b,C){C=C||{};var x,_;switch(c.util.type(b)){case"Object":if(_=c.util.objId(b),C[_])return C[_];x={},C[_]=x;for(var E in b)b.hasOwnProperty(E)&&(x[E]=g(b[E],C));return x;case"Array":return _=c.util.objId(b),C[_]?C[_]:(x=[],C[_]=x,b.forEach(function($,I){x[I]=g($,C)}),x);default:return b}},getLanguage:function(g){for(;g;){var b=o.exec(g.className);if(b)return b[1].toLowerCase();g=g.parentElement}return"none"},setLanguage:function(g,b){g.className=g.className.replace(RegExp(o,"gi"),""),g.classList.add("language-"+b)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(x){var g=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(x.stack)||[])[1];if(g){var b=document.getElementsByTagName("script");for(var C in b)if(b[C].src==g)return b[C]}return null}},isActive:function(g,b,C){for(var x="no-"+b;g;){var _=g.classList;if(_.contains(b))return!0;if(_.contains(x))return!1;g=g.parentElement}return!!C}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(g,b){var C=c.util.clone(c.languages[g]);for(var x in b)C[x]=b[x];return C},insertBefore:function(g,b,C,x){x=x||c.languages;var _=x[g],E={};for(var $ in _)if(_.hasOwnProperty($)){if($==b)for(var I in C)C.hasOwnProperty(I)&&(E[I]=C[I]);C.hasOwnProperty($)||(E[$]=_[$])}var F=x[g];return x[g]=E,c.languages.DFS(c.languages,function(L,Y){Y===F&&L!=g&&(this[L]=E)}),E},DFS:function g(b,C,x,_){_=_||{};var E=c.util.objId;for(var $ in b)if(b.hasOwnProperty($)){C.call(b,$,b[$],x||$);var I=b[$],F=c.util.type(I);F==="Object"&&!_[E(I)]?(_[E(I)]=!0,g(I,C,null,_)):F==="Array"&&!_[E(I)]&&(_[E(I)]=!0,g(I,C,$,_))}}},plugins:{},highlightAll:function(g,b){c.highlightAllUnder(document,g,b)},highlightAllUnder:function(g,b,C){var x={callback:C,container:g,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",x),x.elements=Array.prototype.slice.apply(x.container.querySelectorAll(x.selector)),c.hooks.run("before-all-elements-highlight",x);for(var _=0,E;E=x.elements[_++];)c.highlightElement(E,b===!0,x.callback)},highlightElement:function(g,b,C){var x=c.util.getLanguage(g),_=c.languages[x];c.util.setLanguage(g,x);var E=g.parentElement;E&&E.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(E,x);var $=g.textContent,I={element:g,language:x,grammar:_,code:$};function F(Y){I.highlightedCode=Y,c.hooks.run("before-insert",I),I.element.innerHTML=I.highlightedCode,c.hooks.run("after-highlight",I),c.hooks.run("complete",I),C&&C.call(I.element)}if(c.hooks.run("before-sanity-check",I),E=I.element.parentElement,E&&E.nodeName.toLowerCase()==="pre"&&!E.hasAttribute("tabindex")&&E.setAttribute("tabindex","0"),!I.code){c.hooks.run("complete",I),C&&C.call(I.element);return}if(c.hooks.run("before-highlight",I),!I.grammar){F(c.util.encode(I.code));return}if(b&&a.Worker){var L=new Worker(c.filename);L.onmessage=function(Y){F(Y.data)},L.postMessage(JSON.stringify({language:I.language,code:I.code,immediateClose:!0}))}else F(c.highlight(I.code,I.grammar,I.language))},highlight:function(g,b,C){var x={code:g,grammar:b,language:C};if(c.hooks.run("before-tokenize",x),!x.grammar)throw new Error('The language "'+x.language+'" has no grammar.');return x.tokens=c.tokenize(x.code,x.grammar),c.hooks.run("after-tokenize",x),d.stringify(c.util.encode(x.tokens),x.language)},tokenize:function(g,b){var C=b.rest;if(C){for(var x in C)b[x]=C[x];delete b.rest}var _=new f;return p(_,_.head,g),h(g,_,b,_.head,0),w(_)},hooks:{all:{},add:function(g,b){var C=c.hooks.all;C[g]=C[g]||[],C[g].push(b)},run:function(g,b){var C=c.hooks.all[g];if(!(!C||!C.length))for(var x=0,_;_=C[x++];)_(b)}},Token:d};a.Prism=c;function d(g,b,C,x){this.type=g,this.content=b,this.alias=C,this.length=(x||"").length|0}d.stringify=function g(b,C){if(typeof b=="string")return b;if(Array.isArray(b)){var x="";return b.forEach(function(F){x+=g(F,C)}),x}var _={type:b.type,content:g(b.content,C),tag:"span",classes:["token",b.type],attributes:{},language:C},E=b.alias;E&&(Array.isArray(E)?Array.prototype.push.apply(_.classes,E):_.classes.push(E)),c.hooks.run("wrap",_);var $="";for(var I in _.attributes)$+=" "+I+'="'+(_.attributes[I]||"").replace(/"/g,""")+'"';return"<"+_.tag+' class="'+_.classes.join(" ")+'"'+$+">"+_.content+"</"+_.tag+">"};function u(g,b,C,x){g.lastIndex=b;var _=g.exec(C);if(_&&x&&_[1]){var E=_[1].length;_.index+=E,_[0]=_[0].slice(E)}return _}function h(g,b,C,x,_,E){for(var $ in C)if(!(!C.hasOwnProperty($)||!C[$])){var I=C[$];I=Array.isArray(I)?I:[I];for(var F=0;F<I.length;++F){if(E&&E.cause==$+","+F)return;var L=I[F],Y=L.inside,ct=!!L.lookbehind,pe=!!L.greedy,Tr=L.alias;if(pe&&!L.pattern.global){var Wn=L.pattern.toString().match(/[imsuy]*$/)[0];L.pattern=RegExp(L.pattern.source,Wn+"g")}for(var Kn=L.pattern||L,be=x.next,W=_;be!==b.tail&&!(E&&W>=E.reach);W+=be.value.length,be=be.next){var ie=be.value;if(b.length>g.length)return;if(!(ie instanceof d)){var me=1,ut;if(pe){if(ut=u(Kn,W,g,ct),!ut||ut.index>=g.length)break;var an=ut.index,Ae=ut.index+ut[0].length,Bt=W;for(Bt+=be.value.length;an>=Bt;)be=be.next,Bt+=be.value.length;if(Bt-=be.value.length,W=Bt,be.value instanceof d)continue;for(var ce=be;ce!==b.tail&&(Bt<Ae||typeof ce.value=="string");ce=ce.next)me++,Bt+=ce.value.length;me--,ie=g.slice(W,Bt),ut.index-=W}else if(ut=u(Kn,0,ie,ct),!ut)continue;var an=ut.index,qn=ut[0],on=ie.slice(0,an),Do=ie.slice(an+qn.length),Ar=W+ie.length;E&&Ar>E.reach&&(E.reach=Ar);var Ir=be.prev;on&&(Ir=p(b,Ir,on),W+=on.length),v(b,Ir,me);var Ms=new d($,Y?c.tokenize(qn,Y):qn,Tr,qn);if(be=p(b,Ir,Ms),Do&&p(b,be,Do),me>1){var ln={cause:$+","+F,reach:Ar};h(g,b,C,be.prev,W,ln),E&&ln.reach>E.reach&&(E.reach=ln.reach)}}}}}}function f(){var g={value:null,prev:null,next:null},b={value:null,prev:g,next:null};g.next=b,this.head=g,this.tail=b,this.length=0}function p(g,b,C){var x=b.next,_={value:C,prev:b,next:x};return b.next=_,x.prev=_,g.length++,_}function v(g,b,C){for(var x=b.next,_=0;_<C&&x!==g.tail;_++)x=x.next;b.next=x,x.prev=b,g.length-=_}function w(g){for(var b=[],C=g.head.next;C!==g.tail;)b.push(C.value),C=C.next;return b}if(!a.document)return a.addEventListener&&(c.disableWorkerMessageHandler||a.addEventListener("message",function(g){var b=JSON.parse(g.data),C=b.language,x=b.code,_=b.immediateClose;a.postMessage(c.highlight(x,c.languages[C],C)),_&&a.close()},!1)),c;var k=c.util.currentScript();k&&(c.filename=k.src,k.hasAttribute("data-manual")&&(c.manual=!0));function T(){c.manual||c.highlightAll()}if(!c.manual){var y=document.readyState;y==="loading"||y==="interactive"&&k&&k.defer?document.addEventListener("DOMContentLoaded",T):window.requestAnimationFrame?window.requestAnimationFrame(T):window.setTimeout(T,16)}return c})(t);e.exports&&(e.exports=r),typeof wm<"u"&&(wm.Prism=r),r.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",function(a){a.type==="entity"&&(a.attributes.title=a.content.replace(/&/,"&"))}),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(o,l){var i={};i["language-"+l]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[l]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};c["language-"+l]={pattern:/[\s\S]+/,inside:r.languages[l]};var d={};d[o]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return o}),"i"),lookbehind:!0,greedy:!0,inside:c},r.languages.insertBefore("markup","cdata",d)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(a,o){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+a+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[o,"language-"+o],inside:r.languages[o]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,(function(a){var o=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;a.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+o.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+o.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+o.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+o.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:o,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},a.languages.css.atrule.inside.rest=a.languages.css;var l=a.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))})(r),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,(function(){if(typeof r>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var a="Loading…",o=function(k,T){return"✖ Error "+k+" while fetching file: "+T},l="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},c="data-src-status",d="loading",u="loaded",h="failed",f="pre[data-src]:not(["+c+'="'+u+'"]):not(['+c+'="'+d+'"])';function p(k,T,y){var g=new XMLHttpRequest;g.open("GET",k,!0),g.onreadystatechange=function(){g.readyState==4&&(g.status<400&&g.responseText?T(g.responseText):g.status>=400?y(o(g.status,g.statusText)):y(l))},g.send(null)}function v(k){var T=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(k||"");if(T){var y=Number(T[1]),g=T[2],b=T[3];return g?b?[y,Number(b)]:[y,void 0]:[y,y]}}r.hooks.add("before-highlightall",function(k){k.selector+=", "+f}),r.hooks.add("before-sanity-check",function(k){var T=k.element;if(T.matches(f)){k.code="",T.setAttribute(c,d);var y=T.appendChild(document.createElement("CODE"));y.textContent=a;var g=T.getAttribute("data-src"),b=k.language;if(b==="none"){var C=(/\.(\w+)$/.exec(g)||[,"none"])[1];b=i[C]||C}r.util.setLanguage(y,b),r.util.setLanguage(T,b);var x=r.plugins.autoloader;x&&x.loadLanguages(b),p(g,function(_){T.setAttribute(c,u);var E=v(T.getAttribute("data-range"));if(E){var $=_.split(/\r\n?|\n/g),I=E[0],F=E[1]==null?$.length:E[1];I<0&&(I+=$.length),I=Math.max(0,Math.min(I-1,$.length)),F<0&&(F+=$.length),F=Math.max(0,Math.min(F,$.length)),_=$.slice(I,F).join(`
|
|
188
|
-
`),T.hasAttribute("data-start")||T.setAttribute("data-start",String(I+1))}y.textContent=_,r.highlightElement(y)},function(_){T.setAttribute(c,h),y.textContent=_})}}),r.plugins.fileHighlight={highlight:function(T){for(var y=(T||document).querySelectorAll(f),g=0,b;b=y[g++];)r.highlightElement(b)}};var w=!1;r.fileHighlight=function(){w||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),w=!0),r.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(Pu)),Pu.exports}var J3=V3();const Xt=G3(J3);var Sm={},_m;function Y3(){return _m||(_m=1,(function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism)),Sm}Y3();Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(e){var t=e.util.clone(e.languages.javascript),r=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,a=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function l(d,u){return d=d.replace(/<S>/g,function(){return r}).replace(/<BRACES>/g,function(){return a}).replace(/<SPREAD>/g,function(){return o}),RegExp(d,u)}o=l(o).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=l(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:l(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:l(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(d){return d?typeof d=="string"?d:typeof d.content=="string"?d.content:d.content.map(i).join(""):""},c=function(d){for(var u=[],h=0;h<d.length;h++){var f=d[h],p=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?u.length>0&&u[u.length-1].tagName===i(f.content[0].content[1])&&u.pop():f.content[f.content.length-1].content==="/>"||u.push({tagName:i(f.content[0].content[1]),openedBraces:0}):u.length>0&&f.type==="punctuation"&&f.content==="{"?u[u.length-1].openedBraces++:u.length>0&&u[u.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?u[u.length-1].openedBraces--:p=!0),(p||typeof f=="string")&&u.length>0&&u[u.length-1].openedBraces===0){var v=i(f);h<d.length-1&&(typeof d[h+1]=="string"||d[h+1].type==="plain-text")&&(v+=i(d[h+1]),d.splice(h+1,1)),h>0&&(typeof d[h-1]=="string"||d[h-1].type==="plain-text")&&(v=i(d[h-1])+v,d.splice(h-1,1),h--),d[h]=new e.Token("plain-text",v,null,v)}f.content&&typeof f.content!="string"&&c(f.content)}};e.hooks.add("after-tokenize",function(d){d.language!=="jsx"&&d.language!=="tsx"||c(d.tokens)})})(Prism);(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var r=e.languages.tsx.tag;r.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+r.pattern.source+")",r.pattern.flags),r.lookbehind=!0})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:r,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=e.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],l=a.variable[1].inside,i=0;i<o.length;i++)l[o[i]]=e.languages.bash[o[i]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);var Cm={},Em;function X3(){return Em||(Em=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),Cm}X3();var Tm={},Am;function Z3(){return Am||(Am=1,(function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,r=0;r<2;r++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string})(Prism)),Tm}Z3();Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];(function(e){var t=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+r.source+")?)",o=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),l=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(c,d){d=(d||"").replace(/m/g,"")+"m";var u=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return a}).replace(/<<value>>/g,function(){return c});return RegExp(u,d)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return a}).replace(/<<key>>/g,function(){return"(?:"+o+"|"+l+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(l),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);(function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(h){return h=h.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),l=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+l+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+l+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+l+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(f){h!==f&&(e.languages.markdown[h].inside.content.inside[f]=e.languages.markdown[f])})}),e.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function f(p){if(!(!p||typeof p=="string"))for(var v=0,w=p.length;v<w;v++){var k=p[v];if(k.type!=="code"){f(k.content);continue}var T=k.content[1],y=k.content[3];if(T&&y&&T.type==="code-language"&&y.type==="code-block"&&typeof T.content=="string"){var g=T.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");g=(/[a-z][\w-]*/i.exec(g)||[""])[0].toLowerCase();var b="language-"+g;y.alias?typeof y.alias=="string"?y.alias=[y.alias,b]:y.alias.push(b):y.alias=[b]}}}f(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var f="",p=0,v=h.classes.length;p<v;p++){var w=h.classes[p],k=/language-(.+)/.exec(w);if(k){f=k[1];break}}var T=e.languages[f];if(T)h.content=e.highlight(u(h.content),T,f);else if(f&&f!=="none"&&e.plugins.autoloader){var y="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=y,e.plugins.autoloader.loadLanguages(f,function(){var g=document.getElementById(y);g&&(g.innerHTML=e.highlight(g.textContent,e.languages[f],f))})}}});var i=RegExp(e.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},d=String.fromCodePoint||String.fromCharCode;function u(h){var f=h.replace(i,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,v){if(v=v.toLowerCase(),v[0]==="#"){var w;return v[1]==="x"?w=parseInt(v.slice(2),16):w=Number(v.slice(1)),d(w)}else{var k=c[v];return k||p}}),f}e.languages.md=e.languages.markdown})(Prism);(function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach(function(r){var a=t[r],o=[];/^\w+$/.test(r)||o.push(/\w+/.exec(r)[0]),r==="diff"&&o.push("bold"),e.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r
|
|
189
|
-
?|
|
|
190
|
-
|(?![\\s\\S])))+`,"m"),alias:o,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})})(Prism);(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(e){var t=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function r(a){return a.replace(/__/g,function(){return t})}e.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(r(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(r(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(Prism);const{entries:jb,setPrototypeOf:Im,isFrozen:Q3,getPrototypeOf:eS,getOwnPropertyDescriptor:tS}=Object;let{freeze:st,seal:zt,create:Fd}=Object,{apply:zd,construct:Ud}=typeof Reflect<"u"&&Reflect;st||(st=function(t){return t});zt||(zt=function(t){return t});zd||(zd=function(t,r){for(var a=arguments.length,o=new Array(a>2?a-2:0),l=2;l<a;l++)o[l-2]=arguments[l];return t.apply(r,o)});Ud||(Ud=function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return new t(...a)});const Vs=it(Array.prototype.forEach),nS=it(Array.prototype.lastIndexOf),Rm=it(Array.prototype.pop),zo=it(Array.prototype.push),rS=it(Array.prototype.splice),ki=it(String.prototype.toLowerCase),Ou=it(String.prototype.toString),Nu=it(String.prototype.match),Uo=it(String.prototype.replace),aS=it(String.prototype.indexOf),oS=it(String.prototype.trim),Ht=it(Object.prototype.hasOwnProperty),Qe=it(RegExp.prototype.test),jo=lS(TypeError);function it(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return zd(e,t,a)}}function lS(e){return function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return Ud(e,r)}}function Q(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ki;Im&&Im(e,null);let a=t.length;for(;a--;){let o=t[a];if(typeof o=="string"){const l=r(o);l!==o&&(Q3(t)||(t[a]=l),o=l)}e[o]=!0}return e}function sS(e){for(let t=0;t<e.length;t++)Ht(e,t)||(e[t]=null);return e}function dn(e){const t=Fd(null);for(const[r,a]of jb(e))Ht(e,r)&&(Array.isArray(a)?t[r]=sS(a):a&&typeof a=="object"&&a.constructor===Object?t[r]=dn(a):t[r]=a);return t}function Bo(e,t){for(;e!==null;){const a=tS(e,t);if(a){if(a.get)return it(a.get);if(typeof a.value=="function")return it(a.value)}e=eS(e)}function r(){return null}return r}const Mm=st(["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"]),Fu=st(["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"]),zu=st(["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"]),iS=st(["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"]),Uu=st(["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"]),cS=st(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),$m=st(["#text"]),Lm=st(["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"]),ju=st(["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"]),Dm=st(["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"]),Js=st(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),uS=zt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),dS=zt(/<%[\w\W]*|[\w\W]*%>/gm),hS=zt(/\$\{[\w\W]*/gm),fS=zt(/^data-[\-\w.\u00B7-\uFFFF]+$/),pS=zt(/^aria-[\-\w]+$/),Bb=zt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mS=zt(/^(?:\w+script|data):/i),vS=zt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Hb=zt(/^html$/i),gS=zt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Pm=Object.freeze({__proto__:null,ARIA_ATTR:pS,ATTR_WHITESPACE:vS,CUSTOM_ELEMENT:gS,DATA_ATTR:fS,DOCTYPE_NAME:Hb,ERB_EXPR:dS,IS_ALLOWED_URI:Bb,IS_SCRIPT_OR_DATA:mS,MUSTACHE_EXPR:uS,TMPLIT_EXPR:hS});const Ho={element:1,text:3,progressingInstruction:7,comment:8,document:9},bS=function(){return typeof window>"u"?null:window},xS=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(a=r.getAttribute(o));const l="dompurify"+(a?"#"+a:"");try{return t.createPolicy(l,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},Om=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Wb(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bS();const t=H=>Wb(H);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ho.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const a=r,o=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:i,Node:c,Element:d,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:v}=e,w=d.prototype,k=Bo(w,"cloneNode"),T=Bo(w,"remove"),y=Bo(w,"nextSibling"),g=Bo(w,"childNodes"),b=Bo(w,"parentNode");if(typeof i=="function"){const H=r.createElement("template");H.content&&H.content.ownerDocument&&(r=H.content.ownerDocument)}let C,x="";const{implementation:_,createNodeIterator:E,createDocumentFragment:$,getElementsByTagName:I}=r,{importNode:F}=a;let L=Om();t.isSupported=typeof jb=="function"&&typeof b=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:ct,TMPLIT_EXPR:pe,DATA_ATTR:Tr,ARIA_ATTR:Wn,IS_SCRIPT_OR_DATA:Kn,ATTR_WHITESPACE:be,CUSTOM_ELEMENT:W}=Pm;let{IS_ALLOWED_URI:ie}=Pm,me=null;const ut=Q({},[...Mm,...Fu,...zu,...Uu,...$m]);let Ae=null;const Bt=Q({},[...Lm,...ju,...Dm,...Js]);let ce=Object.seal(Fd(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}})),an=null,qn=null;const on=Object.seal(Fd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Do=!0,Ar=!0,Ir=!1,Ms=!0,ln=!1,$s=!0,Rr=!1,fu=!1,pu=!1,ya=!1,Ls=!1,Ds=!1,Kf=!0,qf=!1;const Sy="user-content-";let mu=!0,Po=!1,wa={},sn=null;const vu=Q({},["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 Gf=null;const Vf=Q({},["audio","video","img","source","image","track"]);let gu=null;const Jf=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ps="http://www.w3.org/1998/Math/MathML",Os="http://www.w3.org/2000/svg",Mn="http://www.w3.org/1999/xhtml";let ka=Mn,bu=!1,xu=null;const _y=Q({},[Ps,Os,Mn],Ou);let Ns=Q({},["mi","mo","mn","ms","mtext"]),Fs=Q({},["annotation-xml"]);const Cy=Q({},["title","style","font","a","script"]);let Oo=null;const Ey=["application/xhtml+xml","text/html"],Ty="text/html";let Ie=null,Sa=null;const Ay=r.createElement("form"),Yf=function(S){return S instanceof RegExp||S instanceof Function},yu=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Sa&&Sa===S)){if((!S||typeof S!="object")&&(S={}),S=dn(S),Oo=Ey.indexOf(S.PARSER_MEDIA_TYPE)===-1?Ty:S.PARSER_MEDIA_TYPE,Ie=Oo==="application/xhtml+xml"?Ou:ki,me=Ht(S,"ALLOWED_TAGS")?Q({},S.ALLOWED_TAGS,Ie):ut,Ae=Ht(S,"ALLOWED_ATTR")?Q({},S.ALLOWED_ATTR,Ie):Bt,xu=Ht(S,"ALLOWED_NAMESPACES")?Q({},S.ALLOWED_NAMESPACES,Ou):_y,gu=Ht(S,"ADD_URI_SAFE_ATTR")?Q(dn(Jf),S.ADD_URI_SAFE_ATTR,Ie):Jf,Gf=Ht(S,"ADD_DATA_URI_TAGS")?Q(dn(Vf),S.ADD_DATA_URI_TAGS,Ie):Vf,sn=Ht(S,"FORBID_CONTENTS")?Q({},S.FORBID_CONTENTS,Ie):vu,an=Ht(S,"FORBID_TAGS")?Q({},S.FORBID_TAGS,Ie):dn({}),qn=Ht(S,"FORBID_ATTR")?Q({},S.FORBID_ATTR,Ie):dn({}),wa=Ht(S,"USE_PROFILES")?S.USE_PROFILES:!1,Do=S.ALLOW_ARIA_ATTR!==!1,Ar=S.ALLOW_DATA_ATTR!==!1,Ir=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Ms=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ln=S.SAFE_FOR_TEMPLATES||!1,$s=S.SAFE_FOR_XML!==!1,Rr=S.WHOLE_DOCUMENT||!1,ya=S.RETURN_DOM||!1,Ls=S.RETURN_DOM_FRAGMENT||!1,Ds=S.RETURN_TRUSTED_TYPE||!1,pu=S.FORCE_BODY||!1,Kf=S.SANITIZE_DOM!==!1,qf=S.SANITIZE_NAMED_PROPS||!1,mu=S.KEEP_CONTENT!==!1,Po=S.IN_PLACE||!1,ie=S.ALLOWED_URI_REGEXP||Bb,ka=S.NAMESPACE||Mn,Ns=S.MATHML_TEXT_INTEGRATION_POINTS||Ns,Fs=S.HTML_INTEGRATION_POINTS||Fs,ce=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&Yf(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&Yf(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ln&&(Ar=!1),Ls&&(ya=!0),wa&&(me=Q({},$m),Ae=[],wa.html===!0&&(Q(me,Mm),Q(Ae,Lm)),wa.svg===!0&&(Q(me,Fu),Q(Ae,ju),Q(Ae,Js)),wa.svgFilters===!0&&(Q(me,zu),Q(Ae,ju),Q(Ae,Js)),wa.mathMl===!0&&(Q(me,Uu),Q(Ae,Dm),Q(Ae,Js))),S.ADD_TAGS&&(typeof S.ADD_TAGS=="function"?on.tagCheck=S.ADD_TAGS:(me===ut&&(me=dn(me)),Q(me,S.ADD_TAGS,Ie))),S.ADD_ATTR&&(typeof S.ADD_ATTR=="function"?on.attributeCheck=S.ADD_ATTR:(Ae===Bt&&(Ae=dn(Ae)),Q(Ae,S.ADD_ATTR,Ie))),S.ADD_URI_SAFE_ATTR&&Q(gu,S.ADD_URI_SAFE_ATTR,Ie),S.FORBID_CONTENTS&&(sn===vu&&(sn=dn(sn)),Q(sn,S.FORBID_CONTENTS,Ie)),S.ADD_FORBID_CONTENTS&&(sn===vu&&(sn=dn(sn)),Q(sn,S.ADD_FORBID_CONTENTS,Ie)),mu&&(me["#text"]=!0),Rr&&Q(me,["html","head","body"]),me.table&&(Q(me,["tbody"]),delete an.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw jo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw jo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=S.TRUSTED_TYPES_POLICY,x=C.createHTML("")}else C===void 0&&(C=xS(v,o)),C!==null&&typeof x=="string"&&(x=C.createHTML(""));st&&st(S),Sa=S}},Xf=Q({},[...Fu,...zu,...iS]),Zf=Q({},[...Uu,...cS]),Iy=function(S){let D=b(S);(!D||!D.tagName)&&(D={namespaceURI:ka,tagName:"template"});const z=ki(S.tagName),he=ki(D.tagName);return xu[S.namespaceURI]?S.namespaceURI===Os?D.namespaceURI===Mn?z==="svg":D.namespaceURI===Ps?z==="svg"&&(he==="annotation-xml"||Ns[he]):!!Xf[z]:S.namespaceURI===Ps?D.namespaceURI===Mn?z==="math":D.namespaceURI===Os?z==="math"&&Fs[he]:!!Zf[z]:S.namespaceURI===Mn?D.namespaceURI===Os&&!Fs[he]||D.namespaceURI===Ps&&!Ns[he]?!1:!Zf[z]&&(Cy[z]||!Xf[z]):!!(Oo==="application/xhtml+xml"&&xu[S.namespaceURI]):!1},cn=function(S){zo(t.removed,{element:S});try{b(S).removeChild(S)}catch{T(S)}},Mr=function(S,D){try{zo(t.removed,{attribute:D.getAttributeNode(S),from:D})}catch{zo(t.removed,{attribute:null,from:D})}if(D.removeAttribute(S),S==="is")if(ya||Ls)try{cn(D)}catch{}else try{D.setAttribute(S,"")}catch{}},Qf=function(S){let D=null,z=null;if(pu)S="<remove></remove>"+S;else{const _e=Nu(S,/^[\r\n\t ]+/);z=_e&&_e[0]}Oo==="application/xhtml+xml"&&ka===Mn&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const he=C?C.createHTML(S):S;if(ka===Mn)try{D=new p().parseFromString(he,Oo)}catch{}if(!D||!D.documentElement){D=_.createDocument(ka,"template",null);try{D.documentElement.innerHTML=bu?x:he}catch{}}const Ke=D.body||D.documentElement;return S&&z&&Ke.insertBefore(r.createTextNode(z),Ke.childNodes[0]||null),ka===Mn?I.call(D,Rr?"html":"body")[0]:Rr?D.documentElement:Ke},ep=function(S){return E.call(S.ownerDocument||S,S,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},wu=function(S){return S instanceof f&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof h)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},tp=function(S){return typeof c=="function"&&S instanceof c};function $n(H,S,D){Vs(H,z=>{z.call(t,S,D,Sa)})}const np=function(S){let D=null;if($n(L.beforeSanitizeElements,S,null),wu(S))return cn(S),!0;const z=Ie(S.nodeName);if($n(L.uponSanitizeElement,S,{tagName:z,allowedTags:me}),$s&&S.hasChildNodes()&&!tp(S.firstElementChild)&&Qe(/<[/\w!]/g,S.innerHTML)&&Qe(/<[/\w!]/g,S.textContent)||S.nodeType===Ho.progressingInstruction||$s&&S.nodeType===Ho.comment&&Qe(/<[/\w]/g,S.data))return cn(S),!0;if(!(on.tagCheck instanceof Function&&on.tagCheck(z))&&(!me[z]||an[z])){if(!an[z]&&ap(z)&&(ce.tagNameCheck instanceof RegExp&&Qe(ce.tagNameCheck,z)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(z)))return!1;if(mu&&!sn[z]){const he=b(S)||S.parentNode,Ke=g(S)||S.childNodes;if(Ke&&he){const _e=Ke.length;for(let dt=_e-1;dt>=0;--dt){const Ln=k(Ke[dt],!0);Ln.__removalCount=(S.__removalCount||0)+1,he.insertBefore(Ln,y(S))}}}return cn(S),!0}return S instanceof d&&!Iy(S)||(z==="noscript"||z==="noembed"||z==="noframes")&&Qe(/<\/no(script|embed|frames)/i,S.innerHTML)?(cn(S),!0):(ln&&S.nodeType===Ho.text&&(D=S.textContent,Vs([Y,ct,pe],he=>{D=Uo(D,he," ")}),S.textContent!==D&&(zo(t.removed,{element:S.cloneNode()}),S.textContent=D)),$n(L.afterSanitizeElements,S,null),!1)},rp=function(S,D,z){if(Kf&&(D==="id"||D==="name")&&(z in r||z in Ay))return!1;if(!(Ar&&!qn[D]&&Qe(Tr,D))){if(!(Do&&Qe(Wn,D))){if(!(on.attributeCheck instanceof Function&&on.attributeCheck(D,S))){if(!Ae[D]||qn[D]){if(!(ap(S)&&(ce.tagNameCheck instanceof RegExp&&Qe(ce.tagNameCheck,S)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(S))&&(ce.attributeNameCheck instanceof RegExp&&Qe(ce.attributeNameCheck,D)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(D,S))||D==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Qe(ce.tagNameCheck,z)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(z))))return!1}else if(!gu[D]){if(!Qe(ie,Uo(z,be,""))){if(!((D==="src"||D==="xlink:href"||D==="href")&&S!=="script"&&aS(z,"data:")===0&&Gf[S])){if(!(Ir&&!Qe(Kn,Uo(z,be,"")))){if(z)return!1}}}}}}}return!0},ap=function(S){return S!=="annotation-xml"&&Nu(S,W)},op=function(S){$n(L.beforeSanitizeAttributes,S,null);const{attributes:D}=S;if(!D||wu(S))return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ae,forceKeepAttr:void 0};let he=D.length;for(;he--;){const Ke=D[he],{name:_e,namespaceURI:dt,value:Ln}=Ke,_a=Ie(_e),ku=Ln;let je=_e==="value"?ku:oS(ku);if(z.attrName=_a,z.attrValue=je,z.keepAttr=!0,z.forceKeepAttr=void 0,$n(L.uponSanitizeAttribute,S,z),je=z.attrValue,qf&&(_a==="id"||_a==="name")&&(Mr(_e,S),je=Sy+je),$s&&Qe(/((--!?|])>)|<\/(style|title|textarea)/i,je)){Mr(_e,S);continue}if(_a==="attributename"&&Nu(je,"href")){Mr(_e,S);continue}if(z.forceKeepAttr)continue;if(!z.keepAttr){Mr(_e,S);continue}if(!Ms&&Qe(/\/>/i,je)){Mr(_e,S);continue}ln&&Vs([Y,ct,pe],sp=>{je=Uo(je,sp," ")});const lp=Ie(S.nodeName);if(!rp(lp,_a,je)){Mr(_e,S);continue}if(C&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!dt)switch(v.getAttributeType(lp,_a)){case"TrustedHTML":{je=C.createHTML(je);break}case"TrustedScriptURL":{je=C.createScriptURL(je);break}}if(je!==ku)try{dt?S.setAttributeNS(dt,_e,je):S.setAttribute(_e,je),wu(S)?cn(S):Rm(t.removed)}catch{Mr(_e,S)}}$n(L.afterSanitizeAttributes,S,null)},Ry=function H(S){let D=null;const z=ep(S);for($n(L.beforeSanitizeShadowDOM,S,null);D=z.nextNode();)$n(L.uponSanitizeShadowNode,D,null),np(D),op(D),D.content instanceof l&&H(D.content);$n(L.afterSanitizeShadowDOM,S,null)};return t.sanitize=function(H){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},D=null,z=null,he=null,Ke=null;if(bu=!H,bu&&(H="<!-->"),typeof H!="string"&&!tp(H))if(typeof H.toString=="function"){if(H=H.toString(),typeof H!="string")throw jo("dirty is not a string, aborting")}else throw jo("toString is not a function");if(!t.isSupported)return H;if(fu||yu(S),t.removed=[],typeof H=="string"&&(Po=!1),Po){if(H.nodeName){const Ln=Ie(H.nodeName);if(!me[Ln]||an[Ln])throw jo("root node is forbidden and cannot be sanitized in-place")}}else if(H instanceof c)D=Qf("<!---->"),z=D.ownerDocument.importNode(H,!0),z.nodeType===Ho.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?D=z:D.appendChild(z);else{if(!ya&&!ln&&!Rr&&H.indexOf("<")===-1)return C&&Ds?C.createHTML(H):H;if(D=Qf(H),!D)return ya?null:Ds?x:""}D&&pu&&cn(D.firstChild);const _e=ep(Po?H:D);for(;he=_e.nextNode();)np(he),op(he),he.content instanceof l&&Ry(he.content);if(Po)return H;if(ya){if(Ls)for(Ke=$.call(D.ownerDocument);D.firstChild;)Ke.appendChild(D.firstChild);else Ke=D;return(Ae.shadowroot||Ae.shadowrootmode)&&(Ke=F.call(a,Ke,!0)),Ke}let dt=Rr?D.outerHTML:D.innerHTML;return Rr&&me["!doctype"]&&D.ownerDocument&&D.ownerDocument.doctype&&D.ownerDocument.doctype.name&&Qe(Hb,D.ownerDocument.doctype.name)&&(dt="<!DOCTYPE "+D.ownerDocument.doctype.name+`>
|
|
191
|
-
`+dt),ln&&Vs([Y,ct,pe],Ln=>{dt=Uo(dt,Ln," ")}),C&&Ds?C.createHTML(dt):dt},t.setConfig=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};yu(H),fu=!0},t.clearConfig=function(){Sa=null,fu=!1},t.isValidAttribute=function(H,S,D){Sa||yu({});const z=Ie(H),he=Ie(S);return rp(z,he,D)},t.addHook=function(H,S){typeof S=="function"&&zo(L[H],S)},t.removeHook=function(H,S){if(S!==void 0){const D=nS(L[H],S);return D===-1?void 0:rS(L[H],D,1)[0]}return Rm(L[H])},t.removeHooks=function(H){L[H]=[]},t.removeAllHooks=function(){L=Om()},t}var Kb=Wb();const yS={ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","p","br","hr","ul","ol","li","dl","dt","dd","strong","em","b","i","u","s","strike","del","ins","sub","sup","small","mark","abbr","code","pre","kbd","samp","var","blockquote","q","cite","a","img","figure","figcaption","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","div","span","details","summary"],ALLOWED_ATTR:["href","src","alt","title","class","id","name","target","rel","width","height","colspan","rowspan","scope","start","type","open","aria-label","aria-hidden","aria-describedby","role","tabindex","data-line","data-language"],ADD_ATTR:["target","rel"],FORBID_TAGS:["script","style","iframe","object","embed","form","input","button"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"],ALLOW_DATA_ATTR:!1,ADD_DATA_URI_TAGS:["img"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|data):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i};function wS(e){return Kb.sanitize(e,{...yS,RETURN_TRUSTED_TYPE:!1})}function cc(e){return Kb.sanitize(e,{ALLOWED_TAGS:["span","code","pre","br"],ALLOWED_ATTR:["class"],FORBID_TAGS:["script","style"],FORBID_ATTR:["onerror","onload","onclick"],RETURN_TRUSTED_TYPE:!1})}const kS={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",json:"json",py:"python",rs:"rust",go:"go",yaml:"yaml",yml:"yaml",md:"markdown",css:"css",sql:"sql",toml:"toml",sh:"bash",bash:"bash",zsh:"bash",diff:"diff",patch:"diff"};function SS(e){const t=e.split(".").pop()?.toLowerCase();return t&&kS[t]||null}function qb(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t),"json"}catch{}return t.startsWith("#!/")?t.includes("python")?"python":t.includes("node")?"javascript":(t.includes("bash")||t.includes("/sh"),"bash"):/^[\w-]+:\s/m.test(t)&&!t.includes("{")?"yaml":t.startsWith("diff ")||t.startsWith("---")&&t.includes("+++")?"diff":null}function _S({open:e,onClose:t,content:r,title:a,language:o}){const l=B(null),[i,c]=U(!1),d=we(()=>{const p=o||qb(r);if(!p||!Xt.languages[p])return null;try{const v=Xt.highlight(r,Xt.languages[p],p);return cc(v)}catch{return null}},[r,o]),u=ee(p=>{p.key==="Escape"&&t()},[t]);R(()=>{if(e)return document.body.style.overflow="hidden",document.addEventListener("keydown",u),()=>{document.body.style.overflow="",document.removeEventListener("keydown",u)}},[e,u]),R(()=>{e&&l.current&&l.current.focus()},[e]);const h=async()=>{await navigator.clipboard.writeText(r),c(!0),setTimeout(()=>c(!1),2e3)};if(!e)return null;const f=r.split(`
|
|
192
|
-
`);return Qc(n("div",{class:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 md:p-10",role:"dialog","aria-modal":"true","aria-labelledby":"output-modal-title",children:[n("div",{class:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t,"aria-hidden":"true"}),n("div",{ref:l,tabIndex:-1,class:"relative w-full h-full max-w-[95vw] max-h-[90vh] flex flex-col bg-[var(--color-bg-primary)] border border-[var(--color-border)] rounded-lg shadow-2xl focus:outline-none overflow-hidden",children:[n("div",{class:"flex items-center justify-between px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[n("h2",{id:"output-modal-title",class:"text-sm font-medium text-[var(--color-text-primary)]",children:[a,n("span",{class:"ml-2 text-xs text-[var(--color-text-muted)]",children:s("toolOutput.lines",{count:f.length})})]}),n("div",{class:"flex items-center gap-2",children:[n("button",{type:"button",onClick:h,class:"text-xs px-2 py-1 rounded bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] transition-colors",children:s(i?"actions.copied":"actions.copy")}),n(K,{icon:n(ma,{}),label:s("actions.close"),variant:"ghost",size:"sm",onClick:t})]})]}),n("div",{class:"flex-1 overflow-auto bg-[var(--color-bg-tertiary)]",children:d?n("pre",{class:"text-xs font-mono leading-relaxed p-4 whitespace-pre-wrap break-words",dangerouslySetInnerHTML:{__html:d}}):n("pre",{class:"text-xs font-mono leading-relaxed p-4 text-[var(--color-text-primary)] whitespace-pre-wrap break-words",children:r})})]})]}),document.body)}function ke({content:e,maxLines:t=30,error:r=!1,filePath:a}){const o=B(null),[l,i]=U(!1),[c,d]=U(!1),u=()=>{i(!1),requestAnimationFrame(()=>{o.current?.scrollIntoView({behavior:"smooth",block:"nearest"})})},h=typeof e=="object"&&e!==null,f=h?JSON.stringify(e,null,2):String(e),p=f.split(`
|
|
193
|
-
`),v=p.length>t,w=l||!v?f:p.slice(0,t).join(`
|
|
194
|
-
`),k=h?"json":(a?SS(a):null)||qb(f),T=we(()=>{if(r||!k||!Xt.languages[k])return null;try{const b=Xt.highlight(w,Xt.languages[k],k);return cc(b)}catch{return null}},[w,k,r]),y=`text-xs p-2 rounded-md overflow-x-auto font-mono leading-relaxed whitespace-pre-wrap ${r?"bg-[var(--color-error)]/10 text-[var(--color-error)]":"bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]"}`,g="block w-full text-left text-xs py-1 px-2 bg-[var(--color-bg-secondary)] rounded-b-md border-t border-[var(--color-border)] transition-colors";return n(j,{children:[n("div",{ref:o,class:"relative group",children:[(v||p.length>10)&&n(K,{icon:n(C4,{}),label:s("toolOutput.expand"),variant:"ghost",size:"sm",showTooltip:!1,onClick:()=>d(!0),class:"!absolute top-2 right-2 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity z-10 bg-[var(--color-bg-surface)]/90 hover:bg-[var(--color-bg-secondary)]"}),T?n("pre",{class:`${y} ${l?"":"max-h-[300px]"}`,dangerouslySetInnerHTML:{__html:T}}):n("pre",{class:`${y} ${l?"":"max-h-[300px]"}`,children:w}),v&&!l&&n("button",{type:"button",onClick:()=>i(!0),class:`${g} text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]`,children:s("toolOutput.moreLines",{count:p.length-t})}),v&&l&&n("button",{type:"button",onClick:u,class:`${g} text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]`,children:s("toolOutput.collapse")})]}),n(_S,{open:c,onClose:()=>d(!1),content:f,title:s("common.output"),language:k||void 0})]})}function Ut({children:e,mono:t=!0,inline:r=!1,class:a=""}){return n("div",{class:`text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)] ${t?"font-mono":""} ${r?"flex items-center gap-2":""} ${a}`.trim(),children:e})}function rt({children:e,title:t}){return n("span",{class:"text-[10px] text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded",title:t,children:e})}function bt({children:e,class:t=""}){return n("div",{class:`text-xs text-[var(--color-text-muted)] italic p-2 ${t}`.trim(),children:e})}function $r({children:e,header:t,success:r=!0}){return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[r&&n("span",{class:"text-[var(--color-success)]",children:"✓"}),t]}),e]})}function Nm({children:e}){return n("div",{class:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[var(--color-text-muted)]",children:e})}function Lr({label:e,children:t,mono:r=!1,small:a=!1}){const o=["text-[var(--color-text-primary)]",r?"font-mono":"",a?"text-[10px]":""].filter(Boolean).join(" ");return n(j,{children:[n("span",{children:[e,":"]}),n("span",{class:o,children:t})]})}function Er(e){if(typeof e=="object"&&e!==null)return e;if(typeof e=="string")try{return JSON.parse(e)}catch{return null}return null}function Gb(e){const t=Er(e);return t&&t.status==="error"&&typeof t.error=="string"?{status:"error",error:t.error,tool:t.tool}:null}function CS({result:e}){const r=Er(e)?.results;if(!r||!Array.isArray(r)||r.length===0)return n(ke,{content:e,maxLines:20});const a=o=>o?o.replace(/\n?<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Web Search\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").replace(/<\/?strong>/g,"").trim():"";return n("div",{class:"space-y-2",children:r.map((o,l)=>n("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",class:"block text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1 border border-transparent hover:border-[var(--color-accent)]/50 transition-colors cursor-pointer no-underline",children:[n("div",{class:"font-medium text-[var(--color-text-primary)]",children:a(o.title)}),n("div",{class:"text-[var(--color-accent)] truncate",children:o.url}),o.description&&n("div",{class:"text-[var(--color-text-muted)]",children:a(o.description)})]},l))})}function ES({args:e}){const t=e.url;return n(Ut,{children:[n("span",{class:"sr-only",children:[s("common.url"),": "]}),"🌐 ",t]})}function TS({result:e}){const t=Er(e);if(!t?.text)return n(ke,{content:e,maxLines:20});const r=t.text.replace(/\n?<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Web Fetch\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").trim();return n("div",{class:"space-y-2",children:[n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] font-mono text-[var(--color-text-muted)]",children:[t.url," ",t.status&&`(${t.status})`]}),n(ke,{content:r,maxLines:30,filePath:"content.md"})]})}function AS({args:e}){const t=e.path,r=e.from,a=e.lines,o=r&&a?`${r}-${r+a-1}`:r?`${r}+`:void 0;return n(Ut,{inline:!0,children:[n("span",{class:"sr-only",children:[s("toolInput.memoryPath"),": "]}),n("span",{children:["📄 ",t,o&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",o]})]}),a&&n(rt,{children:s("toolOutput.lines",{count:a})})]})}function IS({result:e}){const r=Er(e)?.results;return!r||!Array.isArray(r)||r.length===0?n(ke,{content:e,maxLines:20}):n("div",{class:"space-y-3",children:r.map((a,o)=>n("div",{class:"space-y-1",children:[n("div",{class:"flex items-center justify-between text-xs px-1",children:[n("div",{class:"font-mono text-[var(--color-accent)]",children:[a.path,a.startLine&&a.endLine&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",a.startLine,"-",a.endLine]})]}),a.score!==void 0&&n("div",{class:"text-[var(--color-text-muted)]",children:[(a.score*100).toFixed(0),"%"]})]}),a.snippet&&n(ke,{content:a.snippet.replace(/\nSource:.*$/,"").trim(),filePath:a.path,maxLines:10})]},o))})}function RS({result:e}){const t=Er(e);return t?.text?n(ke,{content:t.text,filePath:t.path,maxLines:30}):n(ke,{content:e,maxLines:20})}function pf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ga=pf();function Vb(e){ga=e}var gl={exec:()=>null};function oe(e,t=""){let r=typeof e=="string"?e:e.source,a={replace:(o,l)=>{let i=typeof l=="string"?l:l.source;return i=i.replace(ot.caret,"$1"),r=r.replace(o,i),a},getRegex:()=>new RegExp(r,t)};return a}var MS=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ot={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")},$S=/^(?:[ \t]*(?:\n|$))+/,LS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,DS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Cs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,PS=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,mf=/(?:[*+-]|\d{1,9}[.)])/,Jb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yb=oe(Jb).replace(/bull/g,mf).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(),OS=oe(Jb).replace(/bull/g,mf).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(),vf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,NS=/^[^\n]+/,gf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,FS=oe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",gf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),zS=oe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mf).getRegex(),tu="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",bf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,US=oe("^ {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",bf).replace("tag",tu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xb=oe(vf).replace("hr",Cs).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",tu).getRegex(),jS=oe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Xb).getRegex(),xf={blockquote:jS,code:LS,def:FS,fences:DS,heading:PS,hr:Cs,html:US,lheading:Yb,list:zS,newline:$S,paragraph:Xb,table:gl,text:NS},Fm=oe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Cs).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",tu).getRegex(),BS={...xf,lheading:OS,table:Fm,paragraph:oe(vf).replace("hr",Cs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Fm).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",tu).getRegex()},HS={...xf,html:oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",bf).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:gl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:oe(vf).replace("hr",Cs).replace("heading",` *#{1,6} *[^
|
|
195
|
-
]`).replace("lheading",Yb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},WS=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,KS=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Zb=/^( {2,}|\\)\n(?!\s*$)/,qS=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,nu=/[\p{P}\p{S}]/u,yf=/[\s\p{P}\p{S}]/u,Qb=/[^\s\p{P}\p{S}]/u,GS=oe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,yf).getRegex(),ex=/(?!~)[\p{P}\p{S}]/u,VS=/(?!~)[\s\p{P}\p{S}]/u,JS=/(?:[^\s\p{P}\p{S}]|~)/u,YS=oe(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",MS?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),tx=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,XS=oe(tx,"u").replace(/punct/g,nu).getRegex(),ZS=oe(tx,"u").replace(/punct/g,ex).getRegex(),nx="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",QS=oe(nx,"gu").replace(/notPunctSpace/g,Qb).replace(/punctSpace/g,yf).replace(/punct/g,nu).getRegex(),e_=oe(nx,"gu").replace(/notPunctSpace/g,JS).replace(/punctSpace/g,VS).replace(/punct/g,ex).getRegex(),t_=oe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Qb).replace(/punctSpace/g,yf).replace(/punct/g,nu).getRegex(),n_=oe(/\\(punct)/,"gu").replace(/punct/g,nu).getRegex(),r_=oe(/^<(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(),a_=oe(bf).replace("(?:-->|$)","-->").getRegex(),o_=oe("^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",a_).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),uc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,l_=oe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",uc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),rx=oe(/^!?\[(label)\]\[(ref)\]/).replace("label",uc).replace("ref",gf).getRegex(),ax=oe(/^!?\[(ref)\](?:\[\])?/).replace("ref",gf).getRegex(),s_=oe("reflink|nolink(?!\\()","g").replace("reflink",rx).replace("nolink",ax).getRegex(),zm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,wf={_backpedal:gl,anyPunctuation:n_,autolink:r_,blockSkip:YS,br:Zb,code:KS,del:gl,emStrongLDelim:XS,emStrongRDelimAst:QS,emStrongRDelimUnd:t_,escape:WS,link:l_,nolink:ax,punctuation:GS,reflink:rx,reflinkSearch:s_,tag:o_,text:qS,url:gl},i_={...wf,link:oe(/^!?\[(label)\]\((.*?)\)/).replace("label",uc).getRegex(),reflink:oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",uc).getRegex()},jd={...wf,emStrongRDelimAst:e_,emStrongLDelim:ZS,url:oe(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",zm).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:oe(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",zm).getRegex()},c_={...jd,br:oe(Zb).replace("{2,}","*").getRegex(),text:oe(jd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ys={normal:xf,gfm:BS,pedantic:HS},Wo={normal:wf,gfm:jd,breaks:c_,pedantic:i_},u_={"&":"&","<":"<",">":">",'"':""","'":"'"},Um=e=>u_[e];function Pn(e,t){if(t){if(ot.escapeTest.test(e))return e.replace(ot.escapeReplace,Um)}else if(ot.escapeTestNoEncode.test(e))return e.replace(ot.escapeReplaceNoEncode,Um);return e}function jm(e){try{e=encodeURI(e).replace(ot.percentDecode,"%")}catch{return null}return e}function Bm(e,t){let r=e.replace(ot.findPipe,(l,i,c)=>{let d=!1,u=i;for(;--u>=0&&c[u]==="\\";)d=!d;return d?"|":" |"}),a=r.split(ot.splitPipe),o=0;if(a[0].trim()||a.shift(),a.length>0&&!a.at(-1)?.trim()&&a.pop(),t)if(a.length>t)a.splice(t);else for(;a.length<t;)a.push("");for(;o<a.length;o++)a[o]=a[o].trim().replace(ot.slashPipe,"|");return a}function Ko(e,t,r){let a=e.length;if(a===0)return"";let o=0;for(;o<a&&e.charAt(a-o-1)===t;)o++;return e.slice(0,a-o)}function d_(e,t){if(e.indexOf(t[1])===-1)return-1;let r=0;for(let a=0;a<e.length;a++)if(e[a]==="\\")a++;else if(e[a]===t[0])r++;else if(e[a]===t[1]&&(r--,r<0))return a;return r>0?-2:-1}function Hm(e,t,r,a,o){let l=t.href,i=t.title||null,c=e[1].replace(o.other.outputLinkReplace,"$1");a.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:l,title:i,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}function h_(e,t,r){let a=e.match(r.other.indentCodeCompensation);if(a===null)return t;let o=a[1];return t.split(`
|
|
196
|
-
`).map(l=>{let i=l.match(r.other.beginningSpace);if(i===null)return l;let[c]=i;return c.length>=o.length?l.slice(o.length):l}).join(`
|
|
197
|
-
`)}var dc=class{options;rules;lexer;constructor(e){this.options=e||ga}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Ko(r,`
|
|
198
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],a=h_(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:a}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let a=Ko(r,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(r=a.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Ko(t[0],`
|
|
199
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Ko(t[0],`
|
|
200
|
-
`).split(`
|
|
201
|
-
`),a="",o="",l=[];for(;r.length>0;){let i=!1,c=[],d;for(d=0;d<r.length;d++)if(this.rules.other.blockquoteStart.test(r[d]))c.push(r[d]),i=!0;else if(!i)c.push(r[d]);else break;r=r.slice(d);let u=c.join(`
|
|
202
|
-
`),h=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
203
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
204
|
-
${u}`:u,o=o?`${o}
|
|
205
|
-
${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,l,!0),this.lexer.state.top=f,r.length===0)break;let p=l.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let v=p,w=v.raw+`
|
|
206
|
-
`+r.join(`
|
|
207
|
-
`),k=this.blockquote(w);l[l.length-1]=k,a=a.substring(0,a.length-v.raw.length)+k.raw,o=o.substring(0,o.length-v.text.length)+k.text;break}else if(p?.type==="list"){let v=p,w=v.raw+`
|
|
208
|
-
`+r.join(`
|
|
209
|
-
`),k=this.list(w);l[l.length-1]=k,a=a.substring(0,a.length-p.raw.length)+k.raw,o=o.substring(0,o.length-v.raw.length)+k.raw,r=w.substring(l.at(-1).raw.length).split(`
|
|
210
|
-
`);continue}}return{type:"blockquote",raw:a,tokens:l,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),a=r.length>1,o={type:"list",raw:"",ordered:a,start:a?+r.slice(0,-1):"",loose:!1,items:[]};r=a?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=a?r:"[*+-]");let l=this.rules.other.listItemRegex(r),i=!1;for(;e;){let d=!1,u="",h="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let f=t[2].split(`
|
|
211
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),p=e.split(`
|
|
212
|
-
`,1)[0],v=!f.trim(),w=0;if(this.options.pedantic?(w=2,h=f.trimStart()):v?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=f.slice(w),w+=t[1].length),v&&this.rules.other.blankLine.test(p)&&(u+=p+`
|
|
213
|
-
`,e=e.substring(p.length+1),d=!0),!d){let k=this.rules.other.nextBulletRegex(w),T=this.rules.other.hrRegex(w),y=this.rules.other.fencesBeginRegex(w),g=this.rules.other.headingBeginRegex(w),b=this.rules.other.htmlBeginRegex(w);for(;e;){let C=e.split(`
|
|
214
|
-
`,1)[0],x;if(p=C,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),x=p):x=p.replace(this.rules.other.tabCharGlobal," "),y.test(p)||g.test(p)||b.test(p)||k.test(p)||T.test(p))break;if(x.search(this.rules.other.nonSpaceChar)>=w||!p.trim())h+=`
|
|
215
|
-
`+x.slice(w);else{if(v||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(f)||g.test(f)||T.test(f))break;h+=`
|
|
216
|
-
`+p}!v&&!p.trim()&&(v=!0),u+=C+`
|
|
217
|
-
`,e=e.substring(C.length+1),f=x.slice(w)}}o.loose||(i?o.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(i=!0)),o.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=u}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){if(this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]),d.task){if(d.text=d.text.replace(this.rules.other.listReplaceTask,""),d.tokens[0]?.type==="text"||d.tokens[0]?.type==="paragraph"){d.tokens[0].raw=d.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),d.tokens[0].text=d.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(d.raw);if(u){let h={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};d.checked=h.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=h.raw+d.tokens[0].raw,d.tokens[0].text=h.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(h)):d.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):d.tokens.unshift(h)}}if(!o.loose){let u=d.tokens.filter(f=>f.type==="space"),h=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=h}}if(o.loose)for(let d of o.items){d.loose=!0;for(let u of d.tokens)u.type==="text"&&(u.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:a,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=Bm(t[1]),a=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
218
|
-
`):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===a.length){for(let i of a)this.rules.other.tableAlignRight.test(i)?l.align.push("right"):this.rules.other.tableAlignCenter.test(i)?l.align.push("center"):this.rules.other.tableAlignLeft.test(i)?l.align.push("left"):l.align.push(null);for(let i=0;i<r.length;i++)l.header.push({text:r[i],tokens:this.lexer.inline(r[i]),header:!0,align:l.align[i]});for(let i of o)l.rows.push(Bm(i,l.header.length).map((c,d)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:l.align[d]})));return l}}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 r=t[1].charAt(t[1].length-1)===`
|
|
219
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}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 r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let l=Ko(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{let l=d_(t[2],"()");if(l===-2)return;if(l>-1){let i=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let a=t[2],o="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a=a.slice(1):a=a.slice(1,-1)),Hm(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let a=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[a.toLowerCase()];if(!o){let l=r[0].charAt(0);return{type:"text",raw:l,text:l}}return Hm(r,o,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let a=this.rules.inline.emStrongLDelim.exec(e);if(!(!a||a[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[2])||!r||this.rules.inline.punctuation.exec(r))){let o=[...a[0]].length-1,l,i,c=o,d=0,u=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(a=u.exec(t))!=null;){if(l=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!l)continue;if(i=[...l].length,a[3]||a[4]){c+=i;continue}else if((a[5]||a[6])&&o%3&&!((o+i)%3)){d+=i;continue}if(c-=i,c>0)continue;i=Math.min(i,i+c+d);let h=[...a[0]][0].length,f=e.slice(0,o+a.index+h+i);if(Math.min(o,i)%2){let v=f.slice(1,-1);return{type:"em",raw:f,text:v,tokens:this.lexer.inlineTokens(v)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),a=this.rules.other.nonSpaceChar.test(r),o=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return a&&o&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}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 r,a;return t[2]==="@"?(r=t[1],a="mailto:"+r):(r=t[1],a=r),{type:"link",raw:t[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,a;if(t[2]==="@")r=t[0],a="mailto:"+r;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);r=t[0],t[1]==="www."?a="http://"+t[0]:a=t[0]}return{type:"link",raw:t[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},Wt=class Bd{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ga,this.options.tokenizer=this.options.tokenizer||new dc,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 r={other:ot,block:Ys.normal,inline:Wo.normal};this.options.pedantic?(r.block=Ys.pedantic,r.inline=Wo.pedantic):this.options.gfm&&(r.block=Ys.gfm,this.options.breaks?r.inline=Wo.breaks:r.inline=Wo.gfm),this.tokenizer.rules=r}static get rules(){return{block:Ys,inline:Wo}}static lex(t,r){return new Bd(r).lex(t)}static lexInline(t,r){return new Bd(r).inlineTokens(t)}lex(t){t=t.replace(ot.carriageReturn,`
|
|
220
|
-
`),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let a=this.inlineQueue[r];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],a=!1){for(this.options.pedantic&&(t=t.replace(ot.tabCharGlobal," ").replace(ot.spaceLine,""));t;){let o;if(this.options.extensions?.block?.some(i=>(o=i.call({lexer:this},t,r))?(t=t.substring(o.raw.length),r.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let i=r.at(-1);o.raw.length===1&&i!==void 0?i.raw+=`
|
|
221
|
-
`:r.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let i=r.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
222
|
-
`)?"":`
|
|
223
|
-
`)+o.raw,i.text+=`
|
|
224
|
-
`+o.text,this.inlineQueue.at(-1).src=i.text):r.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length);let i=r.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
225
|
-
`)?"":`
|
|
226
|
-
`)+o.raw,i.text+=`
|
|
227
|
-
`+o.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},r.push(o));continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),r.push(o);continue}let l=t;if(this.options.extensions?.startBlock){let i=1/0,c=t.slice(1),d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},c),typeof d=="number"&&d>=0&&(i=Math.min(i,d))}),i<1/0&&i>=0&&(l=t.substring(0,i+1))}if(this.state.top&&(o=this.tokenizer.paragraph(l))){let i=r.at(-1);a&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
|
|
228
|
-
`)?"":`
|
|
229
|
-
`)+o.raw,i.text+=`
|
|
230
|
-
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):r.push(o),a=l.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);let i=r.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
231
|
-
`)?"":`
|
|
232
|
-
`)+o.raw,i.text+=`
|
|
233
|
-
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):r.push(o);continue}if(t){let i="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let a=t,o=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)l=o[2]?o[2].length:0,a=a.slice(0,o.index+l)+"["+"a".repeat(o[0].length-l-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);a=this.options.hooks?.emStrongMask?.call({lexer:this},a)??a;let i=!1,c="";for(;t;){i||(c=""),i=!1;let d;if(this.options.extensions?.inline?.some(h=>(d=h.call({lexer:this},t,r))?(t=t.substring(d.raw.length),r.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let h=r.at(-1);d.type==="text"&&h?.type==="text"?(h.raw+=d.raw,h.text+=d.text):r.push(d);continue}if(d=this.tokenizer.emStrong(t,a,c)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.del(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),r.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),r.push(d);continue}let u=t;if(this.options.extensions?.startInline){let h=1/0,f=t.slice(1),p;this.options.extensions.startInline.forEach(v=>{p=v.call({lexer:this},f),typeof p=="number"&&p>=0&&(h=Math.min(h,p))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(d=this.tokenizer.inlineText(u)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(c=d.raw.slice(-1)),i=!0;let h=r.at(-1);h?.type==="text"?(h.raw+=d.raw,h.text+=d.text):r.push(d);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},hc=class{options;parser;constructor(e){this.options=e||ga}space(e){return""}code({text:e,lang:t,escaped:r}){let a=(t||"").match(ot.notSpaceStart)?.[0],o=e.replace(ot.endingNewline,"")+`
|
|
234
|
-
`;return a?'<pre><code class="language-'+Pn(a)+'">'+(r?o:Pn(o,!0))+`</code></pre>
|
|
235
|
-
`:"<pre><code>"+(r?o:Pn(o,!0))+`</code></pre>
|
|
236
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
237
|
-
${this.parser.parse(e)}</blockquote>
|
|
238
|
-
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
239
|
-
`}hr(e){return`<hr>
|
|
240
|
-
`}list(e){let t=e.ordered,r=e.start,a="";for(let i=0;i<e.items.length;i++){let c=e.items[i];a+=this.listitem(c)}let o=t?"ol":"ul",l=t&&r!==1?' start="'+r+'"':"";return"<"+o+l+`>
|
|
241
|
-
`+a+"</"+o+`>
|
|
242
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
243
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
244
|
-
`}table(e){let t="",r="";for(let o=0;o<e.header.length;o++)r+=this.tablecell(e.header[o]);t+=this.tablerow({text:r});let a="";for(let o=0;o<e.rows.length;o++){let l=e.rows[o];r="";for(let i=0;i<l.length;i++)r+=this.tablecell(l[i]);a+=this.tablerow({text:r})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
245
|
-
<thead>
|
|
246
|
-
`+t+`</thead>
|
|
247
|
-
`+a+`</table>
|
|
248
|
-
`}tablerow({text:e}){return`<tr>
|
|
249
|
-
${e}</tr>
|
|
250
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
|
|
251
|
-
`}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>${Pn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let a=this.parser.parseInline(r),o=jm(e);if(o===null)return a;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+Pn(t)+'"'),l+=">"+a+"</a>",l}image({href:e,title:t,text:r,tokens:a}){a&&(r=this.parser.parseInline(a,this.parser.textRenderer));let o=jm(e);if(o===null)return Pn(r);e=o;let l=`<img src="${e}" alt="${r}"`;return t&&(l+=` title="${Pn(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Pn(e.text)}},kf=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}},Kt=class Hd{options;renderer;textRenderer;constructor(t){this.options=t||ga,this.options.renderer=this.options.renderer||new hc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kf}static parse(t,r){return new Hd(r).parse(t)}static parseInline(t,r){return new Hd(r).parseInline(t)}parse(t){let r="";for(let a=0;a<t.length;a++){let o=t[a];if(this.options.extensions?.renderers?.[o.type]){let i=o,c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){r+=c||"";continue}}let l=o;switch(l.type){case"space":{r+=this.renderer.space(l);break}case"hr":{r+=this.renderer.hr(l);break}case"heading":{r+=this.renderer.heading(l);break}case"code":{r+=this.renderer.code(l);break}case"table":{r+=this.renderer.table(l);break}case"blockquote":{r+=this.renderer.blockquote(l);break}case"list":{r+=this.renderer.list(l);break}case"checkbox":{r+=this.renderer.checkbox(l);break}case"html":{r+=this.renderer.html(l);break}case"def":{r+=this.renderer.def(l);break}case"paragraph":{r+=this.renderer.paragraph(l);break}case"text":{r+=this.renderer.text(l);break}default:{let i='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return r}parseInline(t,r=this.renderer){let a="";for(let o=0;o<t.length;o++){let l=t[o];if(this.options.extensions?.renderers?.[l.type]){let c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){a+=c||"";continue}}let i=l;switch(i.type){case"escape":{a+=r.text(i);break}case"html":{a+=r.html(i);break}case"link":{a+=r.link(i);break}case"image":{a+=r.image(i);break}case"checkbox":{a+=r.checkbox(i);break}case"strong":{a+=r.strong(i);break}case"em":{a+=r.em(i);break}case"codespan":{a+=r.codespan(i);break}case"br":{a+=r.br(i);break}case"del":{a+=r.del(i);break}case"text":{a+=r.text(i);break}default:{let c='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return a}},el=class{options;block;constructor(e){this.options=e||ga}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?Wt.lex:Wt.lexInline}provideParser(){return this.block?Kt.parse:Kt.parseInline}},ox=class{defaults=pf();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Kt;Renderer=hc;TextRenderer=kf;Lexer=Wt;Tokenizer=dc;Hooks=el;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let a of e)switch(r=r.concat(t.call(this,a)),a.type){case"table":{let o=a;for(let l of o.header)r=r.concat(this.walkTokens(l.tokens,t));for(let l of o.rows)for(let i of l)r=r.concat(this.walkTokens(i.tokens,t));break}case"list":{let o=a;r=r.concat(this.walkTokens(o.items,t));break}default:{let o=a;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let i=o[l].flat(1/0);r=r.concat(this.walkTokens(i,t))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let a={...r};if(a.async=this.defaults.async||a.async||!1,r.extensions&&(r.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let l=t.renderers[o.name];l?t.renderers[o.name]=function(...i){let c=o.renderer.apply(this,i);return c===!1&&(c=l.apply(this,i)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),a.extensions=t),r.renderer){let o=this.defaults.renderer||new hc(this.defaults);for(let l in r.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let i=l,c=r.renderer[i],d=o[i];o[i]=(...u)=>{let h=c.apply(o,u);return h===!1&&(h=d.apply(o,u)),h||""}}a.renderer=o}if(r.tokenizer){let o=this.defaults.tokenizer||new dc(this.defaults);for(let l in r.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let i=l,c=r.tokenizer[i],d=o[i];o[i]=(...u)=>{let h=c.apply(o,u);return h===!1&&(h=d.apply(o,u)),h}}a.tokenizer=o}if(r.hooks){let o=this.defaults.hooks||new el;for(let l in r.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let i=l,c=r.hooks[i],d=o[i];el.passThroughHooks.has(l)?o[i]=u=>{if(this.defaults.async&&el.passThroughHooksRespectAsync.has(l))return(async()=>{let f=await c.call(o,u);return d.call(o,f)})();let h=c.call(o,u);return d.call(o,h)}:o[i]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await c.apply(o,u);return f===!1&&(f=await d.apply(o,u)),f})();let h=c.apply(o,u);return h===!1&&(h=d.apply(o,u)),h}}a.hooks=o}if(r.walkTokens){let o=this.defaults.walkTokens,l=r.walkTokens;a.walkTokens=function(i){let c=[];return c.push(l.call(this,i)),o&&(c=c.concat(o.call(this,i))),c}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Wt.lex(e,t??this.defaults)}parser(e,t){return Kt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let a={...r},o={...this.defaults,...a},l=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&a.async===!1)return l(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 l(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let i=o.hooks?await o.hooks.preprocess(t):t,c=await(o.hooks?await o.hooks.provideLexer():e?Wt.lex:Wt.lexInline)(i,o),d=o.hooks?await o.hooks.processAllTokens(c):c;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let u=await(o.hooks?await o.hooks.provideParser():e?Kt.parse:Kt.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(u):u})().catch(l);try{o.hooks&&(t=o.hooks.preprocess(t));let i=(o.hooks?o.hooks.provideLexer():e?Wt.lex:Wt.lexInline)(t,o);o.hooks&&(i=o.hooks.processAllTokens(i)),o.walkTokens&&this.walkTokens(i,o.walkTokens);let c=(o.hooks?o.hooks.provideParser():e?Kt.parse:Kt.parseInline)(i,o);return o.hooks&&(c=o.hooks.postprocess(c)),c}catch(i){return l(i)}}}onError(e,t){return r=>{if(r.message+=`
|
|
252
|
-
Please report this to https://github.com/markedjs/marked.`,e){let a="<p>An error occurred:</p><pre>"+Pn(r.message+"",!0)+"</pre>";return t?Promise.resolve(a):a}if(t)return Promise.reject(r);throw r}}},sa=new ox;function se(e,t){return sa.parse(e,t)}se.options=se.setOptions=function(e){return sa.setOptions(e),se.defaults=sa.defaults,Vb(se.defaults),se};se.getDefaults=pf;se.defaults=ga;se.use=function(...e){return sa.use(...e),se.defaults=sa.defaults,Vb(se.defaults),se};se.walkTokens=function(e,t){return sa.walkTokens(e,t)};se.parseInline=sa.parseInline;se.Parser=Kt;se.parser=Kt.parse;se.Renderer=hc;se.TextRenderer=kf;se.Lexer=Wt;se.lexer=Wt.lex;se.Tokenizer=dc;se.Hooks=el;se.parse=se;se.options;se.setOptions;se.use;se.walkTokens;se.parseInline;Kt.parse;Wt.lex;const f_={js:"javascript",ts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",dockerfile:"docker","":"plaintext"};function lx(e){const t=e.toLowerCase().trim();return f_[t]||t}function tl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function p_(e,t){const r=lx(t);if(Xt.languages[r])try{return Xt.highlight(e,Xt.languages[r],r)}catch{}return tl(e)}function m_(){const e=new ox({gfm:!0,breaks:!0});return e.use({renderer:{code(t){const r=t.lang||"",a=t.text,o=p_(a,r);return`<pre class="code-block${r?` language-${lx(r)}`:""}"><code>${o}</code></pre>`},link(t){const r=t.href,a=t.title?` title="${tl(t.title)}"`:"",o=t.text;return r.startsWith("http://")||r.startsWith("https://")?`<a href="${tl(r)}"${a} target="_blank" rel="noopener noreferrer">${o}</a>`:`<a href="${tl(r)}"${a}>${o}</a>`},html(t){return tl(t.text)}}}),e}const v_=m_();function sx(e){return v_.parse(e)}function g_({args:e}){const[t,r]=U(!1),a=e.image,o=e.prompt,l=a?.startsWith("http");return n("div",{class:"space-y-2",children:[l&&n("button",{type:"button",onClick:()=>r(!0),class:"rounded-md overflow-hidden bg-[var(--color-bg-tertiary)] p-2 cursor-pointer hover:bg-[var(--color-bg-secondary)] transition-colors","aria-label":s("toolInput.expandImage"),children:n("img",{src:a,alt:s("toolInput.inputImage"),class:"max-h-[150px] max-w-full rounded object-contain",loading:"lazy"})}),!l&&a&&n(Ut,{children:[n("span",{class:"sr-only",children:[s("toolInput.imagePath"),": "]}),"🖼️ ",a]}),o&&n(Ut,{children:[n("span",{class:"sr-only",children:[s("toolInput.prompt"),": "]}),"💬 ",o]}),t&&l&&n("div",{role:"dialog","aria-modal":"true","aria-label":s("common.imageViewer"),class:"fixed inset-0 z-[9999] bg-black/90 flex items-center justify-center p-4",onClick:()=>r(!1),onKeyDown:i=>i.key==="Escape"&&r(!1),tabIndex:0,children:[n("button",{type:"button",onClick:()=>r(!1),class:"absolute top-4 right-4 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors","aria-label":s("actions.close"),children:"✕"}),n("img",{src:a,alt:s("toolInput.expandedImage"),class:"max-h-[90vh] max-w-[90vw] object-contain rounded-lg",onClick:i=>i.stopPropagation(),onKeyDown:i=>i.stopPropagation()})]})]})}function b_({result:e}){const t=typeof e=="string"?e:String(e),r=we(()=>sx(t),[t]);return n("div",{class:"prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed p-2 rounded-md bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)] [&_strong]:text-[var(--color-text-primary)] [&_em]:text-[var(--color-text-secondary)]",dangerouslySetInnerHTML:{__html:r}})}function x_({args:e}){const t=e.sessionKey,r=e.model;return!t&&!r?n(Ut,{children:[n("span",{class:"sr-only",children:[s("toolInput.sessionStatus"),": "]}),n("span",{children:["📊 ",s("sessionStatus.currentSession")]})]}):n(Ut,{inline:!0,children:[n("span",{class:"sr-only",children:[s("toolInput.sessionStatus"),": "]}),n("span",{children:"📊"}),t&&n(rt,{title:t,children:["🧵 ",y_(t)]}),r&&n(rt,{children:["🧠 ",r]})]})}function y_(e){return e.length<=30?e:e.slice(0,15)+"…"+e.slice(-12)}function w_(e){const t=e.trim().split(`
|
|
253
|
-
`),r=[];for(const a of t){const o=a.match(new RegExp("^(\\p{Emoji}+)\\s*(.+)$","u"));if(o){const l=o[2],i=l.indexOf(":");i>0?r.push({emoji:o[1],label:l.slice(0,i).trim(),value:l.slice(i+1).trim()}):r.push({emoji:o[1],label:"",value:l.trim()})}}return r}function Wm(e){const t=e.match(/(\d+)%/);return t?parseInt(t[1],10):null}function Km({percent:e,color:t,label:r}){const a=t||(e>66?"var(--color-success)":e>33?"var(--color-warning)":"var(--color-error)");return n("div",{class:"flex items-center gap-2 mt-1.5",children:[n("div",{class:"h-2 w-28 bg-[var(--color-bg-secondary)] rounded-full overflow-hidden",role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:n("div",{class:"h-full rounded-full transition-all",style:{width:`${e}%`,backgroundColor:a}})}),r&&n("span",{class:"text-[var(--color-text-muted)] text-xs",children:r})]})}function k_({result:e}){const t=typeof e=="string"?e:String(e),r=w_(t);return r.length===0?n(ke,{content:e,maxLines:20}):n("div",{class:"rounded-md bg-[var(--color-bg-tertiary)] overflow-hidden",children:r.map((a,o)=>{const l=a.label==="Context"?Wm(a.value):null,i=a.label==="Usage"?Wm(a.value):null;return n("div",{class:`flex items-start gap-3 px-3 py-2 text-sm ${o>0?"border-t border-[var(--color-border)]/50":""}`,children:[n("span",{class:"flex-shrink-0 w-6 text-center text-base",children:a.emoji}),a.label&&n("span",{class:"font-medium text-[var(--color-text-muted)] w-20 flex-shrink-0",children:a.label}),n("div",{class:"flex-1 min-w-0",children:[n("span",{class:"text-[var(--color-text-primary)]",children:a.value}),l!==null&&n(Km,{percent:l,color:"var(--color-accent)",label:`${l}%`}),i!==null&&n(Km,{percent:i,label:s("sessionStatus.remaining",{percent:i})})]})]},o)})})}function S_({args:e}){const t=e.action,r=e.profile,a=e.targetUrl??e.url;return n(Ut,{inline:!0,children:[n("span",{class:"sr-only",children:[s("toolInput.browserAction"),": "]}),n("span",{children:["🌐 ",t]}),r&&n(rt,{children:r}),a&&n("span",{class:"text-[var(--color-accent)] truncate",children:a})]})}function __({result:e}){if(typeof e=="string"){const r=e.replace(/<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Browser\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").trim();try{const a=JSON.parse(r);if(a?.tabs)return n(qm,{tabs:a.tabs})}catch{}return r?n(ke,{content:r,maxLines:30}):n(bt,{children:s("toolOutput.emptyResponse")})}const t=Er(e);return t?.tabs?n(qm,{tabs:t.tabs}):n(ke,{content:e,maxLines:20})}function qm({tabs:e}){return e.length===0?n(bt,{children:s("toolOutput.noTabsOpen")}):n("div",{class:"space-y-1",children:e.map((t,r)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-[var(--color-text-muted)]",children:"🌐"}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate",children:t.title||"Untitled"}),t.url&&t.url!=="about:blank"&&n("span",{class:"text-[var(--color-accent)] truncate text-[10px]",children:t.url})]},t.targetId??r))})}var C_=["className","activeClass","activeClassName","path"];function E_(e){var t=e.className,r=e.activeClass,a=e.activeClassName,o=e.path,l=(function(h,f){if(h==null)return{};var p,v,w={},k=Object.keys(h);for(v=0;v<k.length;v++)f.indexOf(p=k[v])>=0||(w[p]=h[p]);return w})(e,C_),i=r0()[0],c=o&&i.path&&vd(i.path,o,{})||vd(i.url,l.href,{}),d=l.class||t||"",u=c&&(r||a)||"";return l.class=d+(d&&u&&" ")+u,Qt(l0,l)}function T_(e){const t=new Date(e),r=a=>String(a).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function A_(e){return new Date(e).getTime()}function Vl(e){switch(e.kind){case"cron":return e.expr+(e.tz?` (${e.tz})`:"");case"every":{const t=e.everyMs;return t>=864e5?`Every ${Math.round(t/864e5)}d`:t>=36e5?`Every ${Math.round(t/36e5)}h`:t>=6e4?`Every ${Math.round(t/6e4)}m`:`Every ${Math.round(t/1e3)}s`}case"at":return`Once at ${re(e.atMs)}`}}function Sf(e){return e.enabled?e.state.runningAtMs?s("cron.running"):e.state.nextRunAtMs?re(e.state.nextRunAtMs,{relative:!0}):"—":"—"}function I_(e){return e.state.lastRunAtMs?re(e.state.lastRunAtMs,{relative:!0}):"—"}function _f(e){return e.enabled?e.state.runningAtMs?{variant:"warning",label:s("cron.running")}:e.state.lastStatus==="error"?{variant:"error",label:s("cron.lastFailed")}:e.state.lastStatus==="ok"?{variant:"success",label:s("cron.lastOk")}:{variant:"default",label:s("common.pending")}:{variant:"default",label:s("common.disabled")}}function R_(e){const t=e.trim().split(/\s+/);if(t.length<5||t.length>6)return!1;const r=/^(\*|(\d+(-\d+)?(,\d+(-\d+)?)*)(\/\d+)?|\*\/\d+)$/;return t.every(a=>r.test(a))}const M_=[{ms:6e4,label:"1m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:216e5,label:"6h"},{ms:864e5,label:"24h"}],$_=[{expr:"*/5 * * * *",label:"Every 5 min"},{expr:"0 * * * *",label:"Hourly"},{expr:"0 8 * * *",label:"8am daily"},{expr:"0 9 * * 1-5",label:"9am weekdays"},{expr:"0 0 * * *",label:"Midnight"},{expr:"0 0 * * 0",label:"Weekly (Sun)"}];function Gm(e){if(!e||typeof e!="object")return"";const t=e;if(t.kind==="at"&&typeof t.at=="string")return`Once at ${re(new Date(t.at).getTime(),{relative:!0})}`;try{return Vl(e)}catch{return String(t.kind||"")}}function L_({args:e}){const t=e.action,r=e.jobId,a=e.job,o=a?.name,l=e.patch,i={list:s("cron.actions.list"),add:s("cron.actions.add"),update:s("cron.actions.update"),remove:s("cron.actions.remove"),run:s("cron.actions.run"),runs:s("cron.actions.runs"),status:s("cron.actions.status"),wake:s("cron.actions.wake")},d={list:"📋",add:"➕",update:"✏️",remove:"🗑️",run:"▶️",runs:"📊",status:"📡",wake:"⏰"}[t]||"⏰",u=i[t]||t;if(t==="add"&&a){const h=a.schedule,f=a.sessionTarget;return n("div",{class:"space-y-1",children:[n(Ut,{inline:!0,children:[n("span",{class:"sr-only",children:[s("toolInput.cronAction"),": "]}),n("span",{children:[d," ",u]}),o&&n(rt,{children:o})]}),n("div",{class:"text-xs text-[var(--color-text-muted)] pl-1 flex flex-wrap gap-x-3",children:[h&&n("span",{children:[h.kind==="cron"&&`🕐 ${h.expr}`,h.kind==="every"&&`🔄 Every ${h.everyMs/1e3}s`,h.kind==="at"&&"📅 One-time"]}),f&&n("span",{children:["→ ",f]})]})]})}return n(Ut,{inline:!0,children:[n("span",{class:"sr-only",children:[s("toolInput.cronAction"),": "]}),n("span",{children:[d," ",u]}),(r||o)&&n(rt,{children:o||r?.slice(0,8)||""}),l&&Object.keys(l).length>0&&n("span",{class:"text-[var(--color-text-muted)]",children:["(",Object.keys(l).join(", "),")"]})]})}function D_({result:e}){const t=Er(e);if(t&&"enabled"in t&&"nextWakeAtMs"in t){const r=t;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:`w-2 h-2 rounded-full ${r.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium",children:r.enabled?s("common.enabled"):s("common.disabled")}),typeof r.jobs=="number"&&n("span",{class:"text-[var(--color-text-muted)]",children:["• ",s("cron.jobCount",{count:r.jobs})]})]}),r.nextWakeAtMs&&n("div",{class:"text-[var(--color-text-muted)]",children:[s("cron.stats.nextWake"),": ",re(r.nextWakeAtMs,{relative:!0})]})]})}if(t&&"entries"in t&&Array.isArray(t.entries)){const r=t.entries.slice(0,5);return r.length===0?n(bt,{children:s("cron.noRuns")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:[s("cron.recentRuns")," (",r.length,")"]}),r.map((a,o)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:`w-2 h-2 rounded-full flex-shrink-0 ${a.status==="ok"?"bg-[var(--color-success)]":a.status==="error"?"bg-[var(--color-error)]":"bg-[var(--color-text-muted)]"}`}),a.runAtMs&&n("span",{class:"text-[var(--color-text-muted)]",children:re(a.runAtMs,{relative:!0})}),a.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:["(",Math.round(a.durationMs/1e3),"s)"]}),a.summary&&n("span",{class:"truncate flex-1 text-[var(--color-text-primary)]",title:a.summary,children:a.summary.split(`
|
|
254
|
-
`)[0].slice(0,60)})]},a.ts??o))]})}if(t&&"jobs"in t&&Array.isArray(t.jobs)){const r=t.jobs;return r.length===0?n(bt,{children:s("cron.noJobs")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:s("cron.jobCount",{count:r.length})}),r.map(a=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:`w-2 h-2 rounded-full flex-shrink-0 ${a.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate flex-1",children:a.name||a.id?.slice(0,8)}),a.schedule&&n("span",{class:"text-[var(--color-text-muted)] font-mono text-[10px]",children:Gm(a.schedule)}),a.state?.nextRunAtMs&&n("span",{class:"text-[var(--color-accent)] text-[10px]",children:re(a.state.nextRunAtMs,{relative:!0})})]},a.id))]})}if(t&&("id"in t||"name"in t)&&!("ok"in t)){const r=t;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:`w-2 h-2 rounded-full ${r.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:r.name||r.id?.slice(0,8)}),n(E_,{href:`/cron?job=${r.id}`,class:"text-[var(--color-accent)] hover:underline ml-auto",children:s("actions.view")})]}),n("div",{class:"grid grid-cols-2 gap-x-4 gap-y-1 text-[var(--color-text-muted)]",children:[r.schedule&&n(j,{children:[n("span",{children:[s("cron.columns.schedule"),":"]}),n("span",{class:"font-mono",children:Gm(r.schedule)})]}),r.sessionTarget&&n(j,{children:[n("span",{children:[s("cron.form.sessionTarget"),":"]}),n("span",{children:r.sessionTarget})]}),r.delivery?.mode&&n(j,{children:[n("span",{children:[s("cron.form.announceResults"),":"]}),n("span",{children:r.delivery.mode==="announce"?"✓":"—"})]}),r.deleteAfterRun&&n(j,{children:[n("span",{children:[s("cron.scheduleKind.at"),":"]}),n("span",{children:"✓"})]})]}),r.state?.nextRunAtMs&&n("div",{class:"text-[var(--color-text-muted)] pt-1 border-t border-[var(--color-border)]",children:[s("cron.stats.nextWake"),": ",re(r.state.nextRunAtMs,{relative:!0})]})]})}if(t&&"ok"in t&&t.ok===!0){const r=t;let a=s("common.success");return r.ran&&(a=s("cron.jobTriggered")),r.removed&&(a=s("cron.jobRemoved")),n(bt,{children:n("span",{class:"text-[var(--color-success)]",children:["✓ ",a]})})}return n(ke,{content:e,maxLines:20})}const Si={telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",irc:"IRC",googlechat:"Google Chat",slack:"Slack",signal:"Signal",imessage:"iMessage",bluebubbles:"BlueBubbles",imsg:"iMessage",gchat:"Google Chat","google-chat":"Google Chat","internet-relay-chat":"IRC"},P_={send:"💬",broadcast:"📢",reply:"↩️",sendWithEffect:"✨",sendAttachment:"📎",unsend:"🗑️",react:"👍",reactions:"😀",read:"👁️",edit:"✏️",delete:"🗑️",pin:"📌",unpin:"📌","list-pins":"📌","thread-create":"🧵","thread-list":"🧵","thread-reply":"🧵",search:"🔍",sticker:"🎨","emoji-list":"😀","emoji-upload":"😀","sticker-upload":"🎨","channel-info":"ℹ️","channel-list":"📋","channel-create":"➕","channel-edit":"✏️","channel-delete":"🗑️","channel-move":"↔️","category-create":"📁","category-edit":"📁","category-delete":"📁",poll:"📊","member-info":"👤","role-info":"🎭",permissions:"🔐","voice-status":"🎤","event-list":"📅","event-create":"📅",renameGroup:"✏️",setGroupIcon:"🖼️",addParticipant:"➕",removeParticipant:"➖",leaveGroup:"🚪"},ix={send:"Send",broadcast:"Broadcast",reply:"Reply",sendWithEffect:"Send with Effect",sendAttachment:"Send Attachment",unsend:"Unsend",react:"React",reactions:"Get Reactions",read:"Mark Read",edit:"Edit",delete:"Delete",pin:"Pin",unpin:"Unpin","list-pins":"List Pins","thread-create":"Create Thread","thread-list":"List Threads","thread-reply":"Reply in Thread",search:"Search",sticker:"Send Sticker","emoji-list":"List Emoji","emoji-upload":"Upload Emoji","sticker-upload":"Upload Sticker","channel-info":"Channel Info","channel-list":"List Channels","channel-create":"Create Channel","channel-edit":"Edit Channel","channel-delete":"Delete Channel","channel-move":"Move Channel","category-create":"Create Category","category-edit":"Edit Category","category-delete":"Delete Category",poll:"Create Poll","member-info":"Member Info","role-info":"Role Info",permissions:"Permissions","voice-status":"Voice Status","event-list":"List Events","event-create":"Create Event",renameGroup:"Rename Group",setGroupIcon:"Set Group Icon",addParticipant:"Add Participant",removeParticipant:"Remove Participant",leaveGroup:"Leave Group"};function O_({args:e}){const t=e.action,r=e.channel,a=P_[t]||"💬",o=ix[t]||t,l=r?Si[r]||r:void 0,i=new Set(["action","channel","dryRun"]),c=Object.entries(e).filter(([d,u])=>!i.has(d)&&u!==void 0&&u!==null);return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("div",{class:"flex items-center gap-2 mb-2",children:[n("span",{class:"sr-only",children:[s("toolInput.messageAction"),": "]}),n("span",{children:[a," ",o]}),l&&n(rt,{children:l}),e.dryRun&&n(rt,{children:s("common.dryRun")})]}),c.length>0&&n("div",{class:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[var(--color-text-muted)]",children:c.map(([d,u])=>n(j,{children:[n("span",{children:[d,":"]},`${d}-label`),n("span",{class:"text-[var(--color-text-primary)] truncate",title:String(u),children:typeof u=="object"?JSON.stringify(u):String(u)},`${d}-value`)]}))})]})}function N_(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function F_(e){return e.startsWith("+")||e.startsWith("user:")||e.startsWith("channel:")?e:e.length>20?e.slice(0,8)+"…"+e.slice(-8):e}function z_({result:e}){let t=e;if(typeof e=="string"){if(!e.trim())return n(bt,{children:s("toolOutput.messageSent")});try{t=JSON.parse(e)}catch{return n(ke,{content:e,maxLines:10})}}const r=Er(t);if(!r)return n(ke,{content:e,maxLines:20});if("results"in r&&Array.isArray(r.results)){const a=r.results,o=a.filter(i=>i.ok).length,l=a.length-o;return n("div",{class:"space-y-1",children:[n(bt,{children:[n("span",{class:"text-[var(--color-success)]",children:["✓ ",s("toolOutput.broadcastSent")]}),n("span",{class:"text-[var(--color-text-muted)]",children:[" ","— ",o,"/",a.length," ",s("common.success").toLowerCase(),l>0&&`, ${l} failed`]})]}),a.slice(0,5).map((i,c)=>n("div",{class:"flex items-center gap-2 text-xs px-2 py-1 rounded bg-[var(--color-bg-tertiary)]",children:[n("span",{class:i.ok?"text-[var(--color-success)]":"text-[var(--color-error)]",children:i.ok?"✓":"✗"}),n("span",{class:"text-[var(--color-text-muted)]",children:i.to}),i.error&&n("span",{class:"text-[var(--color-error)] truncate",children:i.error})]},c)),a.length>5&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-2",children:["+",a.length-5," more"]})]})}if("channels"in r&&Array.isArray(r.channels)){const a=r.channels,o=a.some(d=>"guild_id"in d),l=a.length===1?s("toolOutput.channelCount",{count:a.length}):s("toolOutput.channelCountPlural",{count:a.length}),i={0:{icon:"#",label:"text"},2:{icon:"🔊",label:"voice"},4:{icon:"📁",label:"category"},5:{icon:"📢",label:"announcement"},13:{icon:"🎭",label:"stage"},15:{icon:"💬",label:"forum"}},c=d=>{if(o&&typeof d.type=="number"){const u=i[d.type]||{icon:"•",label:`type ${d.type}`};return{icon:u.icon,typeLabel:u.label}}return{icon:"•",typeLabel:d.type!==void 0?String(d.type):null}};return n($r,{header:n(j,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:l}),o&&n(rt,{children:"Discord"})]}),children:n("details",{open:!0,children:[n("summary",{class:"cursor-pointer text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",children:s("toolOutput.showAll")}),n("div",{class:"mt-2 space-y-0.5 max-h-60 overflow-y-auto font-mono",children:a.map((d,u)=>{const h=c(d);return n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n("span",{class:"w-4 text-center",children:h.icon}),n("span",{class:"text-[var(--color-text-primary)]",children:d.name||s("toolOutput.unnamed")}),h.typeLabel&&n("span",{class:"text-[10px] opacity-50",children:h.typeLabel}),n("span",{class:"ml-auto text-[10px] opacity-30",children:d.id})]},d.id||u)})})]})})}if("member"in r&&typeof r.member=="object"&&r.member!==null){const a=r.member,o=a.nick||a.user?.global_name||a.user?.username||"Unknown",l=a.joined_at?new Date(a.joined_at).toLocaleDateString():null;return n($r,{header:n(j,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["👤 ",o]}),a.user?.username&&a.user.username!==o&&n("span",{class:"text-[var(--color-text-muted)]",children:["@",a.user.username]})]}),children:n(Nm,{children:[a.user?.id&&n(Lr,{label:s("toolOutput.fieldId"),mono:!0,small:!0,children:a.user.id}),l&&n(Lr,{label:s("toolOutput.fieldJoined"),children:l}),a.roles&&a.roles.length>0&&n(Lr,{label:s("toolOutput.fieldRoles"),children:a.roles.length})]})})}if("emojis"in r&&Array.isArray(r.emojis)){const a=r.emojis;if(a.length===0)return n(bt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:s("toolOutput.noEmojis")})});const o=a.length===1?s("toolOutput.emojiCount",{count:a.length}):s("toolOutput.emojiCountPlural",{count:a.length});return n($r,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o}),children:n("div",{class:"flex flex-wrap gap-1 max-h-40 overflow-y-auto",children:a.map((l,i)=>n("span",{class:"text-[var(--color-text-muted)]",title:l.name,children:[":",l.name,":"]},l.id||i))})})}if("events"in r&&Array.isArray(r.events)){const a=r.events;if(a.length===0)return n(bt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:s("toolOutput.noScheduledEvents")})});const o=a.length===1?s("toolOutput.eventCount",{count:a.length}):s("toolOutput.eventCountPlural",{count:a.length});return n($r,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["📅 ",o]}),children:n("div",{class:"space-y-1 max-h-40 overflow-y-auto",children:a.map((l,i)=>n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n("span",{class:"text-[var(--color-text-primary)]",children:l.name||s("toolOutput.unnamed")}),l.scheduled_start_time&&n("span",{class:"text-[10px]",children:new Date(l.scheduled_start_time).toLocaleString()})]},l.id||i))})})}if("pins"in r&&Array.isArray(r.pins)){const a=r.pins;if(a.length===0)return n(bt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:s("toolOutput.noPinnedMessages")})});const o=a.length===1?s("toolOutput.pinnedCount",{count:a.length}):s("toolOutput.pinnedCountPlural",{count:a.length});return n($r,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["📌 ",o]}),children:n("div",{class:"space-y-1 max-h-40 overflow-y-auto",children:a.map((l,i)=>n("div",{class:"text-[var(--color-text-muted)]",children:[l.author?.username&&n("span",{class:"font-medium",children:[l.author.username,": "]}),n("span",{class:"text-[var(--color-text-primary)]",children:l.content?l.content.length>60?l.content.slice(0,60)+"...":l.content:s("toolOutput.noText")})]},l.id||i))})})}if("ok"in r&&r.ok===!0){const{ok:a,action:o,channel:l,dryRun:i,...c}=r,d=Object.keys(c).length>0;return n($r,{header:n(j,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o?ix[o]||o:s("common.success")}),l&&n(rt,{children:Si[l]||l}),i&&n(rt,{children:s("common.dryRun")})]}),children:d&&n("pre",{class:"p-2 bg-[var(--color-bg-secondary)] rounded text-[10px] overflow-x-auto max-h-80 overflow-y-auto",children:JSON.stringify(c,null,2)})})}if("question"in r&&"options"in r){const a=r;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{children:"📊"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:a.question}),a.dryRun&&n(rt,{children:s("common.dryRun")})]}),a.options&&a.options.length>0&&n("div",{class:"space-y-1 pl-5",children:a.options.map((o,l)=>n("div",{class:"text-[var(--color-text-muted)]",children:["• ",o]},l))}),n("div",{class:"text-[var(--color-text-muted)] text-[10px]",children:[a.channel&&(Si[a.channel]||a.channel),a.to&&` → ${F_(a.to)}`]})]})}if("channels"in r&&Array.isArray(r.channels)){const a=r.channels;return a.length===0?n(bt,{children:s("toolOutput.noChannels")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:s("toolOutput.channelCount",{count:a.length})}),a.slice(0,10).map((o,l)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-[var(--color-text-muted)]",children:"#"}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate",children:o.name||o.id}),o.topic&&n("span",{class:"text-[var(--color-text-muted)] truncate text-[10px]",children:o.topic})]},o.id??l)),a.length>10&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:["+",a.length-10," more"]})]})}if("messages"in r&&Array.isArray(r.messages)){const a=r.messages;return a.length===0?n(bt,{children:s("toolOutput.noResults")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:s("toolOutput.messageCount",{count:a.length})}),a.slice(0,5).map((o,l)=>n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[o.author&&n("span",{class:"font-medium text-[var(--color-accent)]",children:[o.author,": "]}),n("span",{class:"text-[var(--color-text-primary)]",children:N_(o.content||"",80)})]},o.id??l)),a.length>5&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:["+",a.length-5," more"]})]})}if("events"in r&&Array.isArray(r.events)){const a=r.events;return a.length===0?n(bt,{children:s("toolOutput.noEvents")}):n("div",{class:"space-y-1",children:a.slice(0,5).map((o,l)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{children:"📅"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o.name}),o.startTime&&n("span",{class:"text-[var(--color-text-muted)] text-[10px]",children:o.startTime})]},o.id??l))})}if("username"in r||"displayName"in r){const a=r;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{children:"👤"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:a.displayName||a.username}),a.username&&a.displayName&&n("span",{class:"text-[var(--color-text-muted)]",children:["@",a.username]})]}),a.roles&&a.roles.length>0&&n("div",{class:"flex flex-wrap gap-1 pl-5",children:[a.roles.slice(0,5).map((o,l)=>n(rt,{children:o},l)),a.roles.length>5&&n("span",{class:"text-[10px] text-[var(--color-text-muted)]",children:["+",a.roles.length-5]})]})]})}if("channel"in r&&"to"in r){const a=r;return n($r,{header:n(j,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:s("toolOutput.messageSent")}),a.dryRun&&n(rt,{children:s("common.dryRun")})]}),children:n(Nm,{children:[n(Lr,{label:s("toolOutput.fieldChannel"),children:a.channel&&(Si[a.channel]||a.channel)}),n(Lr,{label:s("toolOutput.fieldTo"),children:a.to}),a.via&&n(Lr,{label:s("toolOutput.fieldVia"),children:a.via}),a.mediaUrl!==void 0&&n(Lr,{label:s("toolOutput.fieldMedia"),children:a.mediaUrl||"none"})]})})}return n(ke,{content:e,maxLines:20})}function U_({result:e}){return n("div",{class:"text-xs p-3 rounded-md bg-[var(--color-error)]/10 border border-[var(--color-error)]/20",children:[n("div",{class:"font-medium text-[var(--color-error)] mb-1",children:s("common.error")}),n("div",{class:"text-[var(--color-text-primary)] whitespace-pre-wrap",children:e.error})]})}function j_({result:e,error:t,toolName:r,filePath:a}){const o=Gb(e);if(o)return n(U_,{result:o});switch(r){case"web_search":return n(CS,{result:e});case"web_fetch":return n(TS,{result:e});case"memory_search":return n(IS,{result:e});case"memory_get":return n(RS,{result:e});case"image":return n(b_,{result:e});case"session_status":return n(k_,{result:e});case"browser":return n(__,{result:e});case"cron":return n(D_,{result:e});case"message":return n(z_,{result:e});default:return n(ke,{content:e,maxLines:20,error:t,filePath:a})}}function B_({args:e}){const t=e.file_path??e.path,r=e.offset,a=e.limit,o=r&&a?`${r}-${r+a-1}`:r?`${r}+`:void 0;return n(Ut,{inline:!0,children:[n("span",{class:"sr-only",children:[s("toolInput.readingFile"),": "]}),n("span",{children:["📄 ",t,o&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",o]})]}),a&&n(rt,{children:s("toolInput.lineCount",{count:a})})]})}function H_({args:e}){const t=e.file_path??e.path,r=e.content;return n("div",{class:"space-y-2",children:[n(Ut,{children:[n("span",{class:"sr-only",children:[s("toolInput.writingFile"),": "]}),"📄 ",t]}),n(ke,{content:r,filePath:t,maxLines:30})]})}function W_({args:e}){const t=e.command,r=e.workdir||e.cwd,a=r?`# cwd: ${r}
|
|
255
|
-
${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[s("toolInput.runningCommand"),": "]}),n(ke,{content:a,filePath:"command.sh",maxLines:20})]})}function K_(e,t){const r=e.length,a=t.length,o=Array(r+1).fill(null).map(()=>Array(a+1).fill(0));for(let l=1;l<=r;l++)for(let i=1;i<=a;i++)e[l-1]===t[i-1]?o[l][i]=o[l-1][i-1]+1:o[l][i]=Math.max(o[l-1][i],o[l][i-1]);return o}function q_(e,t,r){const a=e.split(`
|
|
256
|
-
`),o=t.split(`
|
|
257
|
-
`),l=r||"file",i=K_(a,o),c=[];let d=a.length,u=o.length;for(;d>0||u>0;)d>0&&u>0&&a[d-1]===o[u-1]?(c.unshift(` ${a[d-1]}`),d--,u--):u>0&&(d===0||i[d][u-1]>=i[d-1][u])?(c.unshift(`+${o[u-1]}`),u--):(c.unshift(`-${a[d-1]}`),d--);return[...[`--- a/${l}`,`+++ b/${l}`,`@@ -1,${a.length} +1,${o.length} @@`],...c].join(`
|
|
258
|
-
`)}function G_({args:e}){const t=e.old_string??e.oldText??"",r=e.new_string??e.newText??"",a=e.file_path??e.path??"";if(!t&&!r)return n(ke,{content:e});const o=q_(t,r,a);return n("div",{children:[n("span",{class:"sr-only",children:[s("toolInput.editingFile"),": "]}),n(ke,{content:o,filePath:"changes.diff",maxLines:40})]})}function V_({args:e}){const t=e.query;return n(Ut,{children:[n("span",{class:"sr-only",children:[s("toolInput.searchQuery"),": "]}),"🔍 ",t]})}const Xn=new Set,J_=100;function Y_(){Xn.clear()}function X_(e){if(!e||typeof e!="object")return!1;const t=e;if(!t.details||typeof t.details!="object")return!1;const r=t.details;return r.status==="approval-pending"&&typeof r.approvalId=="string"}function Z_({toolCall:e}){const t=B(null),r=X_(e.result),a=Xn.has(e.id)||r,o=ne(a),l=()=>{const h=o.value;if(o.value=!o.value,o.value){if(Xn.size>=J_){const f=Xn.values().next().value;f&&Xn.delete(f)}Xn.add(e.id)}else Xn.delete(e.id),h&&t.current&&requestAnimationFrame(()=>{t.current?.scrollIntoView({behavior:"smooth",block:"nearest"})})};R(()=>{r&&!o.value&&(o.value=!0,Xn.add(e.id))},[r,e.id]);const i=e.completedAt&&e.startedAt?e.completedAt-e.startedAt:null,d=e.result!==void 0&&Gb(e.result)!==null?"error":e.status,u=n5(d,r);return n("div",{ref:t,class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("button",{type:"button",onClick:l,class:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--color-bg-secondary)] transition-colors","aria-expanded":o.value,children:[n("span",{class:`text-sm flex-shrink-0 ${u.color}`,children:u.icon}),n("code",{class:"text-xs font-medium text-[var(--color-text-primary)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded",children:e.name}),n("span",{class:"text-xs text-[var(--color-text-muted)] truncate flex-1",children:r5(e)}),i!==null&&n("span",{class:"text-[10px] text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded flex-shrink-0",children:l5(i)}),n(Ro,{class:"w-4 h-4 text-[var(--color-text-muted)] flex-shrink-0",open:o.value})]}),o.value&&n("div",{class:"px-3 py-2 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] space-y-3",children:[e.args&&Object.keys(e.args).length>0&&n(Vm,{label:"Input",raw:e.args,children:n(Q_,{toolCall:e})}),r&&n(e5,{approvalId:e.result.details.approvalId,expiresAtMs:e.result.details.expiresAtMs}),e.result!==void 0&&!r&&n(Vm,{label:"Output",raw:e.result,children:n(j_,{result:e.result,error:e.status==="error",toolName:e.name,filePath:e.args?.path??e.args?.file_path})}),e.status==="error"&&!e.result&&n("div",{class:"text-xs text-[var(--color-error)]",children:"Tool execution failed"})]})]})}function Q_({toolCall:e}){const t=e.name.toLowerCase(),r=e.args;return t==="edit"?n(G_,{args:r}):t==="exec"&&r.command?n(W_,{args:r}):t==="read"?n(B_,{args:r}):t==="write"?n(H_,{args:r}):e.name==="web_search"||e.name==="memory_search"?n(V_,{args:r}):e.name==="web_fetch"?n(ES,{args:r}):e.name==="memory_get"?n(AS,{args:r}):e.name==="image"?n(g_,{args:r}):e.name==="browser"?n(S_,{args:r}):e.name==="cron"?n(L_,{args:r}):e.name==="session_status"?n(x_,{args:r}):e.name==="message"?n(O_,{args:r}):n(ke,{content:r})}function e5({approvalId:e,expiresAtMs:t}){const r=sc.value,a=ic.value,o=ql.value.get(e),[l,i]=U(Math.max(0,t-Date.now())),[c,d]=U(null),u=o??c;R(()=>{const p=()=>{const w=Math.max(0,t-Date.now());i(w)};p();const v=setInterval(p,1e3);return()=>clearInterval(v)},[t]);const h=async p=>{try{await W3(e,p),d(p)}catch{}};if(u){const p=u==="deny";return n("div",{class:`text-xs italic ${p?"text-[var(--color-error)]":"text-[var(--color-success)]"}`,role:"status","aria-live":"polite",children:s(p?"exec.denied":"common.approved")})}return l<=0?n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:s("exec.expired")}):n("div",{class:"space-y-2",role:"region","aria-label":s("exec.approvalNeeded"),"aria-live":"polite",children:[n("div",{class:"flex items-center justify-between",children:[n("span",{class:"text-xs font-medium text-[var(--color-warning)]",children:s("exec.approvalNeeded")}),n("span",{class:"text-[10px] text-[var(--color-text-muted)]","aria-label":s("exec.expiresIn",{time:`${Math.ceil(l/1e3)}s`}),children:[Math.ceil(l/1e3),"s"]})]}),a&&n("div",{class:"text-xs text-[var(--color-error)]",role:"alert",children:a}),n("div",{class:"flex gap-2",children:[n(N,{variant:"primary",size:"sm",onClick:()=>h("allow-once"),disabled:r,children:s("exec.allowOnce")}),n(N,{variant:"secondary",size:"sm",onClick:()=>h("allow-always"),disabled:r,children:s("exec.allowAlways")}),n(N,{variant:"ghost",size:"sm",onClick:()=>h("deny"),disabled:r,children:s("exec.deny")})]})]})}function t5(e){if(typeof e=="string")try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}return JSON.stringify(e,null,2)}function Vm({label:e,children:t,raw:r}){const a=ne(!1);return n("div",{children:[n("div",{class:"flex items-center gap-2 mb-1",children:[n("span",{class:"text-[10px] font-medium text-[var(--color-text-muted)] uppercase tracking-wide",children:e}),r!==void 0&&n("button",{type:"button",onClick:()=>a.value=!a.value,class:"text-[10px] text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-pressed":a.value,children:a.value?s("toolBlock.showFormatted"):s("toolBlock.showRaw")})]}),a.value&&r!==void 0?n(ke,{content:t5(r),filePath:"raw.json",maxLines:30}):t]})}function n5(e,t=!1){if(t)return{icon:"⏳",color:"text-[var(--color-warning)]"};switch(e){case"pending":return{icon:"○",color:"text-[var(--color-text-muted)]"};case"running":return{icon:n(te,{size:"xs",class:"text-[var(--color-accent)]"}),color:""};case"complete":return{icon:"✓",color:"text-[var(--color-success)]"};case"error":return{icon:"✗",color:"text-[var(--color-error)]"};default:return{icon:"○",color:"text-[var(--color-text-muted)]"}}}function r5(e){const t=e.args||{};if(t.path||t.file_path)return a5(String(t.path||t.file_path));if(t.command)return _i(String(t.command),60);if(t.query)return _i(String(t.query),60);if(t.url)return o5(String(t.url));if(t.action)return String(t.action);for(const[r,a]of Object.entries(t))if(typeof a=="string"&&a.length>0&&!r.startsWith("_"))return _i(a,50);return""}function _i(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function a5(e){const t=e.split("/").filter(Boolean);return t.length<=2?e:"…/"+t.slice(-2).join("/")}function o5(e){try{const t=new URL(e),r=t.pathname.length>30?t.pathname.slice(0,30)+"…":t.pathname;return t.hostname+r}catch{return _i(e,50)}}function l5(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),r=Math.floor(e%6e4/1e3);return`${t}m ${r}s`}function fc({size:e="md",colorClass:t}){const r=e==="sm"?"w-1 h-1":"w-1.5 h-1.5",a=t??"bg-[var(--color-accent)]";return n("span",{class:"inline-flex items-end gap-1",children:[n("span",{class:`${r} rounded-full ${a} animate-bounce-dot-1`}),n("span",{class:`${r} rounded-full ${a} animate-bounce-dot-2`}),n("span",{class:`${r} rounded-full ${a} animate-bounce-dot-3`})]})}const s5="bg-[var(--color-warning-muted)] rounded px-0.5";function i5(e,t){if(!t)return;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:i=>{const c=i.parentElement;return c?.closest("pre, code")||c?.tagName==="MARK"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),a=[];let o;for(;o=r.nextNode();)a.push(o);const l=t.toLowerCase();for(const i of a){const c=i.textContent||"",d=c.toLowerCase(),u=[];let h=0,f;for(;(f=d.indexOf(l,h))!==-1;)u.push({start:f,end:f+t.length}),h=f+1;if(u.length===0)continue;const p=document.createDocumentFragment();let v=0;for(const w of u){w.start>v&&p.appendChild(document.createTextNode(c.slice(v,w.start)));const k=document.createElement("mark");k.className=s5,k.textContent=c.slice(w.start,w.end),p.appendChild(k),v=w.end}v<c.length&&p.appendChild(document.createTextNode(c.slice(v))),i.replaceWith(p)}}function Es({content:e,isStreaming:t=!1}){const r=B(null),a=we(()=>{if(!e)return"";const l=sx(e);return wS(l)},[e]),o=jc.value.trim();return R(()=>{if(!r.current)return;const l=r.current.querySelectorAll("pre.code-block");for(const i of l){if(i.querySelector(".copy-button"))return;const c=document.createElement("button");c.className="copy-button",c.textContent=s("actions.copy"),c.setAttribute("type","button"),c.onclick=async()=>{const d=i.querySelector("code")?.textContent||"";try{await navigator.clipboard.writeText(d),c.textContent=s("actions.copied"),setTimeout(()=>{c.textContent=s("actions.copy")},2e3)}catch{const u=document.createElement("textarea");u.value=d,document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u),c.textContent=s("actions.copied"),setTimeout(()=>{c.textContent=s("actions.copy")},2e3)}},i.classList.add("relative"),i.insertBefore(c,i.firstChild)}},[a]),R(()=>{!r.current||!o||(r.current.innerHTML=a,i5(r.current,o))},[a,o]),!e&&t?n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[s("chat.thinking"),n(fc,{})]}):n("div",{ref:r,class:"message-content prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:a}})}const Xs=`
|
|
259
|
-
p-2 rounded-full cursor-pointer
|
|
260
|
-
bg-white/10 text-white hover:bg-white/20
|
|
261
|
-
transition-colors
|
|
262
|
-
`;async function c5(e,t){try{const a=await(await fetch(e)).blob(),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=t,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(o)}catch{window.open(e,"_blank")}}function u5(e,t){try{const a=new URL(e).pathname.split("/").pop();if(a&&/\.(png|jpe?g|gif|webp|svg)$/i.test(a))return a}catch{}return`image-${t+1}.png`}function cx({images:e}){const[t,r]=U(null),a=B(null);if(R(()=>{t!==null&&a.current?.focus()},[t]),e.length===0)return null;const o=(l,i,c)=>{l.stopPropagation(),c5(i,u5(i,c))};return n(j,{children:[n("div",{class:"flex flex-wrap gap-2 mt-2",children:e.map((l,i)=>n("div",{class:"relative group",children:[n("button",{type:"button",onClick:()=>r(i),class:`
|
|
263
|
-
relative rounded-lg overflow-hidden cursor-pointer
|
|
264
|
-
border border-[var(--color-border)]
|
|
265
|
-
hover:border-[var(--color-accent)] hover:shadow-md
|
|
266
|
-
transition-all
|
|
267
|
-
`,children:n("img",{src:l.url,alt:l.alt||`Image ${i+1}`,class:"max-w-[200px] max-h-[200px] object-cover",loading:"lazy"})}),n("button",{type:"button",onClick:c=>o(c,l.url,i),"aria-label":s("common.download"),class:`
|
|
268
|
-
absolute bottom-2 right-2 p-1.5 rounded-lg cursor-pointer
|
|
269
|
-
bg-black/60 text-white
|
|
270
|
-
opacity-0 group-hover:opacity-100
|
|
271
|
-
hover:bg-black/80
|
|
272
|
-
transition-all
|
|
273
|
-
`,children:n(Ft,{class:"w-4 h-4"})})]},i))}),t!==null&&n("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":s("common.imageViewer"),class:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4 outline-none",onClick:()=>r(null),onKeyDown:l=>{l.key==="Escape"&&r(null),l.key==="ArrowLeft"&&r((t-1+e.length)%e.length),l.key==="ArrowRight"&&r((t+1)%e.length)},tabIndex:0,children:[n("div",{class:"absolute top-4 right-4 flex items-center gap-2",children:[n("button",{type:"button",onClick:l=>o(l,e[t].url,t),"aria-label":s("common.download"),class:Xs,children:n(Ft,{class:"w-6 h-6"})}),n("button",{type:"button",onClick:()=>r(null),"aria-label":s("actions.close"),class:Xs,children:n(pa,{class:"w-6 h-6"})})]}),e.length>1&&n(j,{children:[n("button",{type:"button",onClick:l=>{l.stopPropagation(),r((t-1+e.length)%e.length)},"aria-label":s("actions.back"),class:`${Xs} absolute left-4 p-3 text-2xl`,children:"‹"}),n("button",{type:"button",onClick:l=>{l.stopPropagation(),r((t+1)%e.length)},"aria-label":s("actions.next"),class:`${Xs} absolute right-4 p-3 text-2xl`,children:"›"})]}),n("img",{src:e[t].url,alt:e[t].alt||`Image ${t+1}`,class:"max-w-full max-h-full object-contain rounded-lg",onClick:l=>l.stopPropagation(),onKeyDown:l=>l.stopPropagation()}),e.length>1&&n("div",{class:"absolute bottom-4 left-1/2 -translate-x-1/2 px-3 py-1 rounded-full bg-white/10 text-white text-sm",children:[t+1," / ",e.length]})]})]})}const d5=2e3;function Jm({icon:e,label:t,onClick:r}){return n("button",{role:"menuitem",onClick:r,class:`
|
|
274
|
-
w-full px-3 py-2 text-left text-sm
|
|
275
|
-
flex items-center gap-2
|
|
276
|
-
text-[var(--color-text-primary)]
|
|
277
|
-
hover:bg-[var(--color-bg-hover)]
|
|
278
|
-
transition-colors cursor-pointer
|
|
279
|
-
`,children:[e,t]})}function ux({content:e,visible:t=!1}){const[r,a]=U(!1),[o,l]=U(null),i=B(null),c=B(null);R(()=>{if(!r)return;const f=p=>{const v=p.target;i.current&&!i.current.contains(v)&&c.current&&!c.current.contains(v)&&a(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),R(()=>{if(!o)return;const f=setTimeout(()=>l(null),d5);return()=>clearTimeout(f)},[o]);const d=ee(async f=>{const p=f==="formatted"?jw(e):e;await navigator.clipboard.writeText(p),l(f),a(!1)},[e]),u=(f,p)=>o===f?n(nn,{class:"w-4 h-4 text-[var(--color-success)]"}):n(p,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),h=(f,p)=>o===f?s("actions.copied"):p;return n("div",{class:"relative",children:[n("button",{ref:c,onClick:()=>a(!r),"aria-label":s("actions.more"),"aria-expanded":r,"aria-haspopup":"menu",class:`
|
|
280
|
-
p-1 rounded
|
|
281
|
-
text-[var(--color-text-muted)]
|
|
282
|
-
hover:text-[var(--color-text-secondary)]
|
|
283
|
-
hover:bg-[var(--color-bg-hover)]
|
|
284
|
-
transition-all cursor-pointer
|
|
285
|
-
${r||t?"opacity-100":"opacity-0"}
|
|
286
|
-
${r?"bg-[var(--color-bg-hover)]":""}
|
|
287
|
-
`,children:n(lb,{class:"w-4 h-4"})}),r&&n("div",{ref:i,role:"menu",class:`
|
|
288
|
-
absolute right-0 top-full mt-1 z-50
|
|
289
|
-
min-w-[160px] py-1
|
|
290
|
-
bg-[var(--color-bg-surface)]
|
|
291
|
-
border border-[var(--color-border)]
|
|
292
|
-
rounded-lg shadow-lg
|
|
293
|
-
`,children:[n(Jm,{icon:u("formatted",ys),label:h("formatted",s("actions.copy")),onClick:()=>d("formatted")}),n(Jm,{icon:u("raw",en),label:h("raw",s("chat.copyMarkdown")),onClick:()=>d("raw")})]})]})}function h5({message:e,userName:t="You",userAvatar:r}){const a=ne(!1),o=e.status==="queued",l=e.status==="sending",i=e.status==="failed",c=o||l,d=()=>{e.id&&O2(e.id)};return n("div",{class:"group",onMouseEnter:()=>a.value=!0,onMouseLeave:()=>a.value=!1,children:[n("div",{class:"flex items-center gap-2 mb-1.5",children:[Uh(r)?n("img",{src:r,alt:t,class:"w-6 h-6 rounded-full object-cover"}):n("div",{class:"w-6 h-6 rounded-full bg-[var(--color-accent)]/20 flex items-center justify-center text-xs font-medium text-[var(--color-accent)]",children:r||t.charAt(0).toUpperCase()}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:t}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:o?n("span",{class:"flex items-center gap-1 text-[var(--color-warning)]",children:[n(ge,{class:"w-3 h-3","aria-hidden":"true"}),s("connection.messageQueued")]}):l?n("span",{class:"flex items-center gap-1",children:[n(fc,{size:"sm",colorClass:"bg-current"}),s("connection.messageSending")]}):i?n("span",{class:"flex items-center gap-1 text-[var(--color-error)]",children:[n(Vc,{class:"w-3 h-3","aria-hidden":"true"}),s("connection.messageFailedStatus")]}):re(e.timestamp)}),n("div",{class:"flex-1"}),!c&&e.content&&n(ux,{content:e.content,visible:a.value})]}),n("div",{class:`
|
|
294
|
-
rounded-xl px-4 py-3
|
|
295
|
-
${i?"bg-[var(--color-error)]/10 border border-[var(--color-error)]/20":c?"bg-[var(--color-bg-secondary)] border border-[var(--color-border)] opacity-80":"bg-[var(--color-accent)]/10 border border-[var(--color-accent)]/20"}
|
|
296
|
-
`,children:[e.images&&e.images.length>0&&n(cx,{images:e.images}),e.content&&n("div",{class:`text-[var(--color-text-primary)] ${e.images?.length?"mt-2":""}`,children:n(Es,{content:e.content})}),i&&n("div",{class:"mt-2 pt-2 border-t border-[var(--color-error)]/20",children:n("button",{onClick:d,class:`px-3 py-1.5 rounded-lg text-xs font-medium
|
|
297
|
-
bg-[var(--color-error)]/10 text-[var(--color-error)]
|
|
298
|
-
hover:bg-[var(--color-error)]/20
|
|
299
|
-
active:scale-95 transition-all duration-150
|
|
300
|
-
flex items-center gap-1.5`,children:[n(Xe,{class:"w-3 h-3","aria-hidden":"true"}),s("actions.retry")]})})]})]})}function f5({content:e}){const[t,r]=U(!1),a=Math.max(1,Math.round(e.length/500)),o=s(a===1?"chat.thinkingBlock.second":"chat.thinkingBlock.second_plural",{count:a});return n("div",{class:"thinking-block border border-[var(--color-border)] rounded-lg overflow-hidden my-2",children:[n("button",{type:"button",onClick:()=>r(!t),"aria-expanded":t,"aria-label":s(t?"chat.thinkingBlock.collapseLabel":"chat.thinkingBlock.expandLabel"),class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-muted)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[t?n(ze,{class:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}):n(Ye,{class:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}),n(_k,{class:"w-4 h-4 flex-shrink-0 text-[var(--color-text-muted)]","aria-hidden":"true"}),n("span",{class:"font-medium",children:t?s("common.thinking"):s("chat.thinkingBlock.thoughtFor",{duration:o})})]}),t&&n("div",{class:"px-3 pb-3 border-t border-[var(--color-border)] bg-[var(--color-bg-subtle)]",children:n("div",{class:"pt-3 text-sm text-[var(--color-text-secondary)]",children:n(Es,{content:e})})})]})}function p5(e){return/^https?:\/\//i.test(e)}function m5(e){return/^data:/i.test(e)}function v5(e){return e.trim().replace(/^[`"'[{(]+/,"").replace(/[`"'\\})\],]+$/,"")}function g5(e){const t=[],r=[],a=e.split(`
|
|
301
|
-
`),o=[];for(const l of a){const i=l.trim();if(!i.startsWith("MEDIA:")){o.push(l);continue}const c=i.slice(6).trim(),d=v5(c);if(!d){o.push(l);continue}p5(d)||m5(d)?t.push(d):r.push(d)}return{text:o.join(`
|
|
302
|
-
`).trim(),mediaUrls:t,localPaths:r}}function b5(e){return e.map((t,r)=>({url:t,alt:`Image ${r+1}`}))}function x5(e,t){if(!t||t.length===0)return e?[{type:"text",content:e}]:[];A.chat.debug("buildContentBlocks called",{contentLen:e.length,contentPreview:e.slice(0,100),contentEnd:e.slice(-100),toolCallsCount:t.length,toolCallPositions:t.map(l=>({id:l.id.slice(-8),name:l.name,insertedAt:l.insertedAtContentLength}))});const r=[...t].sort((l,i)=>{const c=l.insertedAtContentLength??1/0,d=i.insertedAtContentLength??1/0;return c-d}),a=[];let o=0;for(const l of r){const i=l.insertedAtContentLength;if(!(i===void 0||i===1/0)){if(i>o){const c=e.slice(o,i);c.trim()&&(a.push({type:"text",content:c}),A.chat.debug("buildContentBlocks: added text block",{from:o,to:i,textLen:c.length}))}a.push({type:"tool",toolCall:l}),o=i}}if(o<e.length){const l=e.slice(o);A.chat.debug("buildContentBlocks: checking remaining text",{currentPos:o,contentLen:e.length,remainingLen:l.length,remainingTrimmedLen:l.trim().length,remainingPreview:l.slice(0,100)}),l.trim()&&(a.push({type:"text",content:l}),A.chat.debug("buildContentBlocks: added remaining text block"))}for(const l of r)l.insertedAtContentLength===void 0&&a.push({type:"tool",toolCall:l});return A.chat.debug("buildContentBlocks result",{totalBlocks:a.length,blockTypes:a.map(l=>l.type)}),a}function y5({message:e,assistantName:t="Assistant",assistantAvatar:r,isStreaming:a=!1}){const o=ne(!1),l=g5(e.content),i=b5(l.mediaUrls),c=[...e.images??[],...i],d=x5(l.text,e.toolCalls??[]),u=d.length>0||a||c.length>0||!!e.thinking;return A.chat.debug("AssistantMessage render",{messageId:e.id,contentLen:e.content.length,toolCallsCount:e.toolCalls?.length??0,blocksCount:d.length,imagesCount:c.length,localPaths:l.localPaths,isStreaming:a}),n("div",{class:"group",onMouseEnter:()=>o.value=!0,onMouseLeave:()=>o.value=!1,children:[n("div",{class:"flex items-center gap-2 mb-1.5",children:[Uh(r)?n("img",{src:r,alt:t||"Assistant",class:"w-6 h-6 rounded-full object-cover"}):n("div",{class:"w-6 h-6 rounded-full bg-[var(--color-bg-surface)] border border-[var(--color-border)] flex items-center justify-center text-sm",children:r||"🤖"}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:t}),!a&&e.timestamp&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:re(e.timestamp)}),n("div",{class:"flex-1"}),!a&&e.content&&n(ux,{content:e.content,visible:o.value})]}),n("div",{class:"space-y-3",children:[e.thinking&&n(f5,{content:e.thinking}),d.map((h,f)=>(A.chat.debug("Rendering block",{idx:f,type:h.type,contentLen:h.type==="text"?h.content.length:void 0,toolName:h.type==="tool"?h.toolCall.name:void 0}),h.type==="text"?n("div",{class:"prose prose-sm max-w-none text-[var(--color-text-primary)]",children:n(Es,{content:h.content,isStreaming:!1})},`text-${f}`):n("div",{children:n(Z_,{toolCall:h.toolCall})},h.toolCall.id))),c.length>0&&n(cx,{images:c}),l.localPaths.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:l.localPaths.length===1?`📎 File: ${l.localPaths[0]}`:`📎 ${l.localPaths.length} files attached`}),a&&n("span",{class:"ml-1",children:n(fc,{})}),!u&&a&&n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[s("chat.thinking"),n(fc,{})]})]})]})}function w5({message:e}){return n("div",{class:"flex items-start gap-2 px-4 py-2 bg-[var(--color-bg-secondary)] rounded-xl border border-[var(--color-border)]",children:[n("div",{class:"flex-shrink-0 w-5 h-5 text-[var(--color-text-muted)] mt-0.5",children:n(ks,{class:"w-full h-full","aria-hidden":"true"})}),n("div",{class:"flex-1 text-sm text-[var(--color-text-muted)] italic",children:n(Es,{content:e.content})})]})}function Ym({message:e,isStreaming:t=!1,assistantName:r,assistantAvatar:a,userName:o,userAvatar:l}){switch(e.role){case"user":return n(h5,{message:e,userName:o,userAvatar:l});case"assistant":return n(y5,{message:e,isStreaming:t,assistantName:r,assistantAvatar:a});case"system":return n(w5,{message:e});default:return null}}function k5({messages:e}){const[t,r]=U(!1);if(e.length===0)return null;const o=(e[0]?.content??"").replace(/^\s*\[cron\]\s*/i,"");return n("div",{class:"rounded-lg border overflow-hidden bg-[var(--color-text-muted)]/5 border-[var(--color-border)]",children:[n("button",{type:"button",onClick:()=>r(!t),class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors cursor-pointer","aria-expanded":t,children:[n("span",{children:"⏰"}),n("span",{class:"flex-1 text-left",children:s("chat.cronJobCompleted")}),n(Ro,{open:t,class:"w-4 h-4"})]}),t&&n("div",{class:"border-t border-[var(--color-border)] px-3 py-2",children:n("div",{class:"text-sm text-[var(--color-text-secondary)] whitespace-pre-wrap max-h-[400px] overflow-y-auto",children:o})})]})}function Zs({messages:e,summary:t,active:r}){const[a,o]=U(!1),l=e?.[0],i=t??l?.content,c=!!i&&i.trim().length>0&&i.toLowerCase()!=="compaction",d=l?.timestamp?re(l.timestamp):void 0,u="flex items-center gap-1.5 px-3 py-1 text-xs tracking-wide uppercase rounded-full border";return r?n("div",{class:"my-4",children:n("div",{class:"flex items-center gap-3 select-none",role:"status",children:[n("div",{class:"flex-1 h-px bg-[var(--color-border)]"}),n("span",{class:`${u} border-[var(--color-border)] text-[var(--color-text-muted)]`,children:[n(hb,{class:"w-3 h-3 animate-spin","aria-hidden":"true"}),n("span",{children:s("chat.compacting")})]}),n("div",{class:"flex-1 h-px bg-[var(--color-border)]"})]})}):n("div",{class:"my-4",children:[n("div",{class:"flex items-center gap-3 select-none",role:"separator",children:[n("div",{class:"flex-1 h-px bg-[var(--color-border)]"}),c?n("button",{type:"button",onClick:()=>o(!a),class:`${u} border-[var(--color-border)] text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text-secondary)] hover:border-[var(--color-text-muted)] transition-colors`,"aria-label":s("chat.conversationCompacted"),"aria-expanded":a,title:d,children:[n(tm,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:s("chat.compactionLabel")}),a?n(xs,{class:"w-3 h-3","aria-hidden":"true"}):n(ze,{class:"w-3 h-3","aria-hidden":"true"})]}):n("span",{class:`${u} border-[var(--color-border)] text-[var(--color-text-muted)]`,title:d,children:[n(tm,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:s("chat.compactionLabel")})]}),n("div",{class:"flex-1 h-px bg-[var(--color-border)]"})]}),a&&c&&n("div",{class:"mt-2 mx-8 px-3 py-2 text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg-secondary)] rounded-lg border border-[var(--color-border)] whitespace-pre-wrap max-h-[300px] overflow-y-auto",children:i})]})}const S5=["Su","Mo","Tu","We","Th","Fr","Sa"],_5=["January","February","March","April","May","June","July","August","September","October","November","December"];function C5(e,t){return new Date(e,t+1,0).getDate()}function E5(e,t){return new Date(e,t,1).getDay()}function T5(e){return e?e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function Xm({value:e,onChange:t,placeholder:r="Select date",class:a="",minDate:o,maxDate:l}){const[i,c]=U(!1),[d,u]=U(()=>e??new Date),[h,f]=U(!1),p=B(null);Io(p,()=>c(!1),i);const v=()=>{if(p.current){const I=p.current.getBoundingClientRect();f(I.left+280>window.innerWidth)}c(!i)},w=d.getFullYear(),k=d.getMonth(),T=C5(w,k),y=E5(w,k),g=()=>{u(new Date(w,k-1,1))},b=()=>{u(new Date(w,k+1,1))},C=I=>{t(new Date(w,k,I)),c(!1)},x=I=>e?e.getFullYear()===w&&e.getMonth()===k&&e.getDate()===I:!1,_=I=>{const F=new Date;return F.getFullYear()===w&&F.getMonth()===k&&F.getDate()===I},E=I=>{const F=new Date(w,k,I);if(o){const L=new Date(o.getFullYear(),o.getMonth(),o.getDate());if(F<L)return!0}if(l){const L=new Date(l.getFullYear(),l.getMonth(),l.getDate());if(F>L)return!0}return!1},$=[];for(let I=0;I<y;I++)$.push(null);for(let I=1;I<=T;I++)$.push(I);return n("div",{ref:p,class:`relative ${a}`,children:[n("button",{type:"button",onClick:v,class:`
|
|
303
|
-
flex items-center justify-between gap-2 w-full
|
|
304
|
-
px-2.5 py-1.5 text-sm rounded-lg
|
|
305
|
-
bg-[var(--color-bg-primary)]
|
|
306
|
-
border border-[var(--color-border)]
|
|
307
|
-
${i?"border-[var(--color-accent)]/50":""}
|
|
308
|
-
hover:border-[var(--color-border-hover)]
|
|
309
|
-
transition-colors text-left
|
|
310
|
-
`,children:[n("span",{class:e?"text-[var(--color-text-primary)]":"text-[var(--color-text-muted)]",children:e?T5(e):r}),n(Ro,{open:i,class:"w-3.5 h-3.5 text-[var(--color-text-muted)]"})]}),i&&n("div",{class:`absolute top-full mt-1 z-50 p-3 rounded-lg shadow-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] min-w-[260px] ${h?"right-0":"left-0"}`,children:[n("div",{class:"flex items-center justify-between mb-3",children:[n("button",{type:"button",onClick:g,class:"p-1.5 rounded-md hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] transition-colors",children:n("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2",children:n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 19l-7-7 7-7"})})}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:[_5[k]," ",w]}),n("button",{type:"button",onClick:b,class:"p-1.5 rounded-md hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] transition-colors",children:n("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2",children:n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 5l7 7-7 7"})})})]}),n("div",{class:"grid grid-cols-7 gap-1 mb-1",children:S5.map(I=>n("div",{class:"text-[10px] font-medium text-[var(--color-text-muted)] text-center py-1",children:I},I))}),n("div",{class:"grid grid-cols-7 gap-1",children:$.map((I,F)=>{const L=I!==null&&E(I);return n("div",{class:"aspect-square",children:I!==null&&n("button",{type:"button",onClick:()=>!L&&C(I),disabled:L,class:`
|
|
311
|
-
w-full h-full flex items-center justify-center
|
|
312
|
-
text-sm rounded-md transition-colors
|
|
313
|
-
${L?"text-[var(--color-text-muted)]/40 cursor-not-allowed":x(I)?"bg-[var(--color-accent)] text-[var(--color-accent-text)] font-medium":_(I)?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}
|
|
314
|
-
`,children:I})},F)})}),e&&n("button",{type:"button",onClick:()=>{t(null),c(!1)},class:"w-full mt-2 pt-2 border-t border-[var(--color-border)] text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors",children:"Clear"})]})]})}function A5(){const e=B(null),t=Be.value,r=ee(()=>{Be.value=!1,wn.value="",u2()},[]);R(()=>{Be.value&&e.current&&e.current.focus()},[Be.value]),R(()=>{const i=c=>{(c.metaKey||c.ctrlKey)&&c.key==="f"&&(c.preventDefault(),Be.value=!0),c.key==="Escape"&&Be.value&&r()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[r]);const a=d2.value,l=jh(wn.value)||Wg.value;return n(j,{children:[n("div",{class:`hidden sm:flex absolute top-2 left-2 z-10 items-center gap-2 transition-opacity ${t?"opacity-0 pointer-events-none":"opacity-100"}`,children:[n(K,{icon:n(ff,{}),label:s("chat.search"),onClick:()=>Be.value=!0,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),n(Eb,{}),n("div",{"data-tour":"canvas",class:Je.value?void 0:"hidden",children:n(K,{icon:n(Ab,{}),label:s("common.canvas"),onClick:()=>Kl.value=!Kl.value,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"})})]}),n("div",{class:`absolute top-0 left-0 right-0 z-10 flex items-center gap-3 px-3 py-2 bg-[var(--color-bg-surface)] border-b border-[var(--color-border)] transition-opacity ${t?"opacity-100":"opacity-0 pointer-events-none"}`,children:[n(K,{icon:n(ma,{}),label:s("actions.close"),onClick:r,variant:"ghost",size:"sm",tabIndex:t?0:-1}),n("div",{class:"flex-1 flex items-center gap-2 min-w-[120px]",children:[n("input",{ref:e,type:"text",value:wn.value,onInput:i=>wn.value=i.target.value,placeholder:s("chat.searchPlaceholder"),class:"flex-1 px-2.5 py-1.5 text-sm rounded-lg bg-[var(--color-bg-primary)] border border-[var(--color-border)] text-[var(--color-text-primary)] placeholder:text-[var(--color-text-muted)] focus:outline-none focus:border-[var(--color-accent)]/50 transition-colors",tabIndex:t?0:-1}),l&&n("span",{class:"text-xs text-[var(--color-text-muted)] whitespace-nowrap",children:[a," ",s(a===1?"chat.match":"chat.matches")]})]}),n("div",{class:"hidden sm:flex items-center gap-1.5 flex-shrink-0",children:[n(Xm,{value:Oa.value,onChange:i=>Oa.value=i,placeholder:s("chat.dateFrom"),class:"w-[130px]",maxDate:Na.value}),n("span",{class:"text-[var(--color-text-muted)] text-sm",children:"–"}),n(Xm,{value:Na.value,onChange:i=>Na.value=i,placeholder:s("chat.dateTo"),class:"w-[130px]",minDate:Oa.value})]})]})]})}function I5(e){const t=[],r=new Set;for(let a=0;a<e.length;a++)if(e[a].kind==="compaction")for(let o=Math.max(0,a-2);o<=Math.min(e.length-1,a+2);o++)r.add(o);for(let a=0;a<e.length;a++){const o=e[a];if(!Og(o)&&!Nw(o))if(o.kind==="compaction")t.push({type:"compaction",messages:[o]});else if(Uw(o)){if(r.has(a))continue;t.push({type:"compaction",messages:[o]})}else Pw(o)?t.push({type:"cron",message:o}):t.push({type:"message",message:o})}return t}const Zm=["bg-[var(--color-bg-hover)]","rounded-lg","transition-colors"],R5="cursor-pointer hover:bg-[var(--color-bg-hover)] rounded-lg transition-colors";function M5({messages:e,isLoading:t=!1,error:r=null,streamingContent:a="",streamingToolCalls:o=[],isStreaming:l=!1,assistantName:i,assistantAvatar:c,userName:d,userAvatar:u,queuedCount:h=0}){A.chat.debug("MessageList render",{messagesCount:e.length,streamingContentLen:a.length,streamingToolCallsCount:o.length,isStreaming:l,queuedCount:h});const f=B(null),p=B(null),v=ne(!1),w=B(!0),k=ee((_=!0)=>{requestAnimationFrame(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:_?"smooth":"auto"})})},[]),T=ee(()=>{if(!f.current)return;const{scrollTop:_,scrollHeight:E,clientHeight:$}=f.current,I=E-_-$;v.value=I>100,w.current=I<50},[]),y=o.filter(_=>_.status==="complete"||_.status==="error").length,g=B(null);R(()=>{const _=e[e.length-1],E=_?.role==="user"&&_.id!==g.current;(E||h>0||w.current)&&(E&&(w.current=!0),k(!1)),g.current=_?.id??null},[e.length,a.length,o.length,y,h,k]),R(()=>{k(!1)},[k]),R(()=>{if(!f.current)return;const _=()=>{w.current&&k(!1)},E=f.current;return E.addEventListener("load",_,!0),()=>E.removeEventListener("load",_,!0)},[k]),R(()=>{const _=Ks.value;if(!_||!f.current)return;const E=f.current.querySelector(`[data-message-id="${_}"]`);E&&(E.scrollIntoView({behavior:"smooth",block:"center"}),E.classList.add(...Zm),setTimeout(()=>{E.classList.remove(...Zm)},2e3)),Ks.value=null},[Ks.value]);const b=l?{id:"streaming",role:"assistant",content:a,toolCalls:o.length>0?o:void 0,timestamp:Date.now(),isStreaming:!0}:null,C=we(()=>I5(e),[e]),x=we(()=>{const _=Yi.value;if(_<0||!Hr.value)return-1;for(let E=0;E<C.length;E++){const $=C[E],I=$.type==="message"||$.type==="cron"?$.message:$.type==="compaction"&&$.messages.length>0?$.messages[0]:null;if(I&&e.indexOf(I)>=_)return E}return C.length},[C,Yi.value,Hr.value]);return n("div",{class:"relative flex-1 flex flex-col overflow-hidden",children:[n("div",{class:"relative h-0 overflow-visible z-10",children:n(A5,{})}),n("div",{ref:f,onScroll:T,class:"flex-1 overflow-y-auto",role:"list","aria-label":"Messages",children:n("div",{class:"max-w-5xl mx-auto px-6 py-6 min-h-full flex flex-col",children:[t&&n("div",{class:"flex justify-center py-8",children:n(te,{size:"md",label:s("common.loading")})}),r&&n("div",{class:"flex justify-center py-8",children:n("div",{class:"text-[var(--color-error)] text-center",children:n("p",{children:r})})}),!t&&!r&&e.length===0&&!l&&n("div",{class:"flex-1 flex items-center justify-center py-16",children:n("div",{class:"text-center max-w-md",children:[Uh(c)?n("img",{src:c,alt:i||s("common.assistant"),class:"w-20 h-20 rounded-2xl mx-auto mb-4 opacity-90"}):c?n("div",{class:"text-6xl mx-auto mb-4",role:"img","aria-label":i||s("common.assistant"),children:c}):n(eu,{size:"lg",class:"mx-auto mb-4 opacity-80"}),n("h3",{class:"text-xl font-medium mb-2",children:i?s("chat.emptyState.titleWithName",{name:i}):s("chat.emptyState.title")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:s("chat.emptyState.description")}),n("div",{class:"text-sm text-[var(--color-text-muted)]",children:[n("p",{class:"mb-2",children:s("chat.emptyState.hint")}),n("div",{class:"flex items-center justify-center gap-4 text-xs",children:[n("span",{class:"flex items-center gap-1",children:[n("kbd",{class:"px-1.5 py-0.5 rounded bg-[var(--color-bg-tertiary)] font-mono",children:"⌘"}),n("kbd",{class:"px-1.5 py-0.5 rounded bg-[var(--color-bg-tertiary)] font-mono",children:"F"}),n("span",{class:"ml-1",children:s("common.search")})]}),n("span",{class:"flex items-center gap-1",children:[n("kbd",{class:"px-1.5 py-0.5 rounded bg-[var(--color-bg-tertiary)] font-mono",children:"/new"}),n("span",{class:"ml-1",children:s("chat.emptyState.newSession")})]})]})]})]})}),n("div",{class:"space-y-6",children:[C.map((_,E)=>{const $=!dr.value&&Hr.value&&x===E,I=[];if($&&I.push(n(Zs,{summary:Ji.value},"compaction-ephemeral")),_.type==="compaction")I.push(n(Zs,{messages:_.messages},`compaction-${E}`));else if(_.type==="cron")I.push(n(k5,{messages:[_.message]},`cron-${E}`));else{const F=_.message,L=Be.value?()=>{Ks.value=F.id,wn.value="",Be.value=!1}:void 0;I.push(n("div",{"data-message-id":F.id,onClick:L,onKeyDown:L?Y=>{Y.key==="Enter"&&L()}:void 0,role:Be.value?"button":void 0,tabIndex:Be.value?0:void 0,class:`-mx-2 px-2 py-1 rounded-lg ${Be.value?R5:""}`,children:n(Ym,{message:F,assistantName:i,assistantAvatar:c,userName:d,userAvatar:u})},F.id))}return I}),!dr.value&&Hr.value&&x>=C.length&&n(Zs,{summary:Ji.value}),dr.value&&n(Zs,{active:!0}),b&&n(Ym,{message:b,isStreaming:!0,assistantName:i,assistantAvatar:c})]}),n("div",{ref:p,class:"h-1"})]})}),v.value&&n("div",{class:"absolute bottom-4 right-4",children:n(K,{icon:n(E4,{}),label:s("chat.scrollToBottom"),onClick:()=>{w.current=!0,k(!0)},variant:"default",size:"md",class:"shadow-lg bg-[var(--color-bg-surface)] border border-[var(--color-border)]"})})]})}const $5=["image/png","image/jpeg","image/gif","image/webp"],Qm=10*1024*1024,Wd=3.5*1024*1024,Qs=2e3;function Cf(e){return $5.includes(e)}let L5=0;function ev(){return`attachment_${Date.now()}_${++L5}`}async function dx(e){return new Promise((t,r)=>{const a=new Image,o=document.createElement("canvas"),l=o.getContext("2d");if(!l){r(new Error("Canvas not supported"));return}a.onload=()=>{let{width:i,height:c}=a;if(i>Qs||c>Qs){const w=Math.min(Qs/i,Qs/c);i=Math.round(i*w),c=Math.round(c*w)}o.width=i,o.height=c,l.drawImage(a,0,0,i,c);const d=e.type==="image/png"?"image/png":"image/jpeg";let u=.9,h=o.toDataURL(d,u);if(d==="image/jpeg")for(;h.length>Wd&&u>.1;)u-=.1,h=o.toDataURL(d,u);let f=1;for(;h.length>Wd&&f>.2;)f-=.1,o.width=Math.round(i*f),o.height=Math.round(c*f),l.drawImage(a,0,0,o.width,o.height),h=o.toDataURL(d,d==="image/jpeg"?.8:void 0);const p=h.split(",")[1]||"",v=Math.round(p.length*3/4);URL.revokeObjectURL(a.src),t({content:h,size:v})},a.onerror=()=>{URL.revokeObjectURL(a.src),r(new Error("Failed to load image"))},a.src=URL.createObjectURL(e)})}async function tv(e){if(Cf(e.type)){const{content:r,size:a}=await dx(e);return{id:ev(),type:"image",mimeType:e.type==="image/png"?"image/png":"image/jpeg",fileName:e.name,content:r,size:a,previewUrl:r}}return new Promise((r,a)=>{const o=new FileReader;o.onload=()=>{const l=o.result;r({id:ev(),type:"file",mimeType:e.type||"application/octet-stream",fileName:e.name,content:l,size:e.size})},o.onerror=()=>a(new Error("Failed to read file")),o.readAsDataURL(e)})}function D5(){const e=ne([]),t=ne(!1),r=ne(null);R(()=>()=>{for(const u of e.value)u.previewUrl&&URL.revokeObjectURL(u.previewUrl)},[]);const a=ee(async u=>{const h=Array.from(u);r.value=null,t.value=!0;try{for(const f of h){if(f.size>Qm){r.value=`File "${f.name}" is too large (max 10MB)`;continue}if(!Cf(f.type)&&f.size>Wd){r.value=`File "${f.name}" is too large (max 400KB for non-images)`;continue}try{const p=await tv(f);e.value=[...e.value,p]}catch{r.value=`Failed to read "${f.name}"`}}}finally{t.value=!1}},[]),o=ee(u=>{const h=e.value.find(f=>f.id===u);h?.previewUrl&&URL.revokeObjectURL(h.previewUrl),e.value=e.value.filter(f=>f.id!==u)},[]),l=ee(()=>{for(const u of e.value)u.previewUrl&&URL.revokeObjectURL(u.previewUrl);e.value=[]},[]),i=ee(()=>e.value.map(u=>({type:u.type,mimeType:u.mimeType,fileName:u.fileName,content:u.content})),[]),c=ee(async u=>{const h=u.clipboardData?.items;if(!h)return!1;const f=[];for(const p of h)p.type.startsWith("image/")&&f.push(p);if(f.length===0)return!1;u.preventDefault(),r.value=null,t.value=!0;try{for(const p of f){const v=p.getAsFile();if(v){if(v.size>Qm){r.value="Pasted image is too large (max 10MB)";continue}try{const w=await tv(v);e.value=[...e.value,w]}catch{r.value="Failed to read pasted image"}}}}finally{t.value=!1}return!0},[]),d=ee(()=>{r.value=null},[]);return{attachments:e.value,addFiles:a,removeAttachment:o,clearAttachments:l,getPayloads:i,handlePaste:c,isProcessing:t.value,error:r.value,clearError:d}}function P5(e){if(!e)return null;const t=e.indexOf("/");return t===-1?null:e.substring(0,t)}function O5(e){if(!e)return null;const t=P5(e);return t||(yr.value.find(a=>a.id===e)?.provider??null)}function N5({sessionKey:e,currentModel:t,onModelChange:r}){const[a,o]=U(!1),[l,i]=U(!1),[c,d]=U(()=>X0()),u=B(null);if(Io(u,()=>o(!1),a),yr.value.length===0)return null;const h=t??tb.value??yr.value[0]?.id,f=O5(h),p=f?ok.value.get(f)??[]:[],v=we(()=>[...p.filter((g,b,C)=>C.findIndex(x=>x.id===g.id)===b)].sort((g,b)=>{if(g.id===h)return-1;if(b.id===h)return 1;const C=c.has(g.id),x=c.has(b.id);return C&&!x?-1:!C&&x?1:g.name.localeCompare(b.name)}),[p,h,c]);if(v.length===0)return null;const w=t?sk(t):s("common.default"),k=(y,g)=>{g.preventDefault(),g.stopPropagation();const b=new Set(c);b.has(y)?b.delete(y):b.add(y),d(b),Z0(b)},T=async y=>{if(y===t){o(!1);return}i(!0);try{await O("sessions.patch",{key:e,model:y}),r?.(y),A.ui.debug("Model changed to:",y)}catch(g){A.ui.error("Failed to change model:",g)}finally{i(!1),o(!1)}};return n("div",{ref:u,class:"relative",children:[n("button",{type:"button",onClick:()=>o(!a),disabled:l,class:`flex items-center gap-1 px-2 py-1 rounded-lg text-xs
|
|
315
|
-
text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]
|
|
316
|
-
hover:bg-[var(--color-bg-secondary)] transition-colors
|
|
317
|
-
disabled:opacity-50`,children:[n("span",{class:"max-w-[120px] truncate",children:w}),n(Ro,{class:"w-3 h-3",open:a})]}),a&&n("div",{class:"absolute bottom-full left-0 mb-1 w-56 max-h-64 overflow-y-auto bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50",children:v.map(y=>{const g=c.has(y.id),b=(t??h)===y.id;return n("div",{class:`flex items-center gap-1 px-2 py-2 transition-colors ${b?"text-[var(--color-accent)] bg-[var(--color-accent)]/10":"text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}`,children:[n("button",{type:"button",onClick:C=>k(y.id,C),class:`p-1 -m-1 text-xs transition-colors rounded hover:bg-[var(--color-bg-tertiary)] ${g?"text-[var(--color-warning)]":"text-[var(--color-text-muted)] hover:text-[var(--color-warning)]/70"}`,title:s(g?"models.removeFavorite":"models.addFavorite"),"aria-label":s(g?"models.removeFavorite":"models.addFavorite"),children:g?"★":"☆"}),n("button",{type:"button",onClick:()=>T(y.id),class:"flex-1 text-left text-sm flex items-center gap-2 min-w-0",children:[n("span",{class:"truncate",children:y.name}),y.reasoning&&n("span",{class:"text-[10px] text-[var(--color-warning)] flex-shrink-0",children:"🧠"})]})]},y.id)})})]})}function F5({onCancel:e,onConfirm:t,confirmLabel:r,confirmDisabled:a,cancelLabel:o}){return n("div",{class:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[n(N,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:o||s("actions.cancel")}),n(N,{onClick:t,disabled:a,fullWidth:!0,class:"sm:w-auto",children:r||s("actions.confirm")})]})}function hx({message:e,onCancel:t,onDelete:r,isDeleting:a}){return n("div",{class:"space-y-3",children:[n("p",{class:"text-sm text-[var(--color-error)] text-center sm:text-left",children:e}),n("div",{class:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[n(N,{variant:"ghost",onClick:t,fullWidth:!0,class:"sm:w-auto",children:s("actions.cancel")}),n(N,{variant:"danger",icon:n(At,{class:"w-4 h-4"}),onClick:r,disabled:a,fullWidth:!0,class:"sm:w-auto",children:a?n(te,{size:"sm"}):s("actions.delete")})]})]})}function fx({onCancel:e,onSave:t,isSaving:r,saveDisabled:a,saveLabel:o,isEdit:l,onDeleteClick:i,extraContent:c}){return n("div",{class:"flex flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-3",children:[n("div",{class:"flex items-center justify-between sm:justify-start gap-3",children:[l&&i&&n(N,{size:"sm",variant:"ghost",icon:n(At,{class:"w-4 h-4"}),onClick:i,class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10",children:s("actions.delete")}),c&&n("div",{class:"sm:hidden",children:c})]}),n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-3",children:[c&&n("div",{class:"hidden sm:block",children:c}),n("div",{class:"flex flex-col sm:flex-row gap-2",children:[n(N,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:s("actions.cancel")}),n(N,{onClick:t,disabled:r||a,fullWidth:!0,class:"sm:w-auto",children:r?n(te,{size:"sm"}):o||s("actions.save")})]})]})]})}const z5=100,nv=120;function U5(){const e=Tt.value,[t,r]=U(new Set),[a,o]=U(null),[l,i]=U(""),[c,d]=U([]),u=B(null);if(e.length===0)return null;const h=y=>{r(g=>{const b=new Set(g);return b.has(y)?b.delete(y):b.add(y),b})},f=y=>{o(y),i(y.content),d(y.images??[])},p=()=>{if(!a)return!1;const y=a.content,g=a.images??[];if(l.trim()!==y||c.length!==g.length)return!0;for(let b=0;b<c.length;b++)if(c[b].url!==g[b].url)return!0;return!1},v=()=>{a&&(l.trim()||c.length>0)&&p()&&(b2(a.id,l.trim(),c.length>0?c:void 0),o(null),i(""),d([]))},w=()=>{o(null),i(""),d([])},k=y=>{d(g=>g.filter((b,C)=>C!==y))},T=async y=>{if(!y||y.length===0)return;const g=[];for(const b of Array.from(y))if(Cf(b.type))try{const{content:C}=await dx(b);g.push({url:C,alt:b.name})}catch{}g.length>0&&d(b=>[...b,...g]),u.current&&(u.current.value="")};return n(j,{children:[n("div",{class:"mb-2 space-y-2",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] font-medium",children:s("chat.queuedMessages",{count:e.length})}),n("div",{class:"space-y-1",children:e.map(y=>{const g=y.content.length>z5,b=t.has(y.id),C=y.images&&y.images.length>0;return n("div",{class:"px-3 py-2 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-start gap-2",children:[n("div",{class:"flex-1 min-w-0",children:[n("p",{class:`text-sm text-[var(--color-text-secondary)] break-words ${g&&!b?"line-clamp-1":"whitespace-pre-wrap"}`,children:y.content}),C&&n("div",{class:"mt-1 flex items-center gap-1 text-xs text-[var(--color-text-muted)]",children:[n(D4,{class:"w-3 h-3"}),n("span",{children:s("chat.imageCount",{count:y.images.length})})]})]}),n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n("button",{type:"button",onClick:()=>f(y),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-accent)] transition-colors",title:s("common.edit"),"aria-label":s("common.edit"),children:n(Ib,{class:"w-4 h-4"})}),n("button",{type:"button",onClick:()=>Vg(y.id),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-error)] transition-colors",title:s("actions.remove"),"aria-label":s("actions.remove"),children:n(Rb,{class:"w-4 h-4"})})]})]}),g&&n("button",{type:"button",onClick:()=>h(y.id),class:"mt-1 flex items-center gap-1 text-xs text-[var(--color-accent)] hover:text-[var(--color-accent-hover)] transition-colors",children:[n(Ro,{class:"w-3 h-3",open:b}),s(b?"actions.showLess":"actions.showMore")]})]},y.id)})})]}),n(We,{open:!!a,onClose:w,title:s("chat.editQueuedMessage"),size:"lg",footer:n(F5,{onCancel:w,onConfirm:v,confirmLabel:s("actions.save"),confirmDisabled:!l.trim()&&c.length===0||!p()}),children:n("div",{class:"space-y-4",children:[n("textarea",{value:l,onInput:y=>i(y.target.value),class:"w-full h-48 p-3 rounded-lg bg-[var(--color-bg-primary)] border border-[var(--color-border)] text-[var(--color-text-primary)] text-sm resize-none focus:outline-none focus:border-[var(--color-accent)]",placeholder:s("chat.placeholder")}),n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium text-[var(--color-text-secondary)]",children:s("chat.images")}),n(N,{variant:"ghost",size:"sm",icon:n(Tb,{class:"w-4 h-4"}),onClick:()=>u.current?.click(),children:s("chat.addImage")}),n("input",{ref:u,type:"file",accept:"image/*",multiple:!0,class:"hidden",onChange:y=>T(y.target.files)})]}),c.length>0?n("div",{class:"flex flex-wrap gap-2",children:c.map((y,g)=>n("div",{class:"relative group",children:[n("img",{src:y.url,alt:y.alt||`Image ${g+1}`,class:"rounded-lg object-cover border border-[var(--color-border)]",style:{width:nv,height:nv}}),n("button",{type:"button",onClick:()=>k(g),class:"absolute -top-2 -right-2 p-1 rounded-full bg-[var(--color-error)] text-white opacity-0 group-hover:opacity-100 transition-opacity shadow-sm",title:s("actions.remove"),"aria-label":s("actions.remove"),children:n(ma,{class:"w-3 h-3"})})]},g))}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("chat.noImages")})]})]})})]})}function j5({attachments:e,onRemove:t,isProcessing:r}){return e.length===0&&!r?null:n("div",{class:"flex flex-wrap gap-2 px-4 pb-2 items-center",children:[e.map(a=>n(B5,{attachment:a,onRemove:()=>t(a.id)},a.id)),r&&n("div",{class:`
|
|
318
|
-
w-16 h-16 rounded-lg
|
|
319
|
-
border border-[var(--color-border)]
|
|
320
|
-
bg-[var(--color-bg-secondary)]
|
|
321
|
-
flex items-center justify-center
|
|
322
|
-
`,children:n(te,{size:"sm"})})]})}function B5({attachment:e,onRemove:t}){const r=e.type==="image",a=H5(e.size);return n("div",{class:"relative group",children:[n(Ao,{content:`${e.fileName} (${a})`,placement:"top",children:n("div",{class:`
|
|
323
|
-
relative w-16 h-16 rounded-lg overflow-hidden
|
|
324
|
-
border border-[var(--color-border)]
|
|
325
|
-
bg-[var(--color-bg-secondary)]
|
|
326
|
-
flex items-center justify-center
|
|
327
|
-
`,children:r&&e.previewUrl?n("img",{src:e.previewUrl,alt:e.fileName,class:"w-full h-full object-cover"}):n("div",{class:"flex flex-col items-center gap-1 text-[var(--color-text-muted)]",children:[r?n(Fa,{class:"w-6 h-6"}):n(en,{class:"w-6 h-6"}),n("span",{class:"text-[8px] truncate max-w-[56px] px-1",children:W5(e.fileName)})]})})}),n("button",{type:"button",onClick:t,"aria-label":s("actions.remove"),class:`
|
|
328
|
-
absolute -top-1.5 -right-1.5
|
|
329
|
-
w-5 h-5 rounded-full
|
|
330
|
-
bg-[var(--color-bg-surface)] border border-[var(--color-border)]
|
|
331
|
-
flex items-center justify-center
|
|
332
|
-
opacity-0 group-hover:opacity-100
|
|
333
|
-
hover:bg-[var(--color-error)] hover:border-[var(--color-error)] hover:text-white
|
|
334
|
-
transition-all cursor-pointer
|
|
335
|
-
`,children:n(pa,{class:"w-3 h-3"})})]})}function H5(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function W5(e){return e.split(".").pop()?.toUpperCase()||"FILE"}const rv=160;function K5({onSend:e,onAbort:t,disabled:r=!1,isStreaming:a=!1,placeholder:o,sessionKey:l,currentModel:i,onModelChange:c}){const d=B(null),u=B(null),h=B(null),f=ne(l?zp(l):""),p=ne(!1),{attachments:v,addFiles:w,removeAttachment:k,clearAttachments:T,getPayloads:y,handlePaste:g,isProcessing:b,error:C,clearError:x}=D5(),_=ee(()=>{const W=d.current;if(!W)return;W.style.height="auto";const ie=Math.min(W.scrollHeight,rv);W.style.height=`${ie}px`},[]),E=ee(W=>{const ie=W.target.value;f.value=ie,l&&Jg(l,ie),_()},[_,l]),$=ee(()=>{const W=f.value.trim(),ie=y();!W&&ie.length===0||r||(e(W,ie.length>0?ie:void 0),f.value="",l&&x2(l),T(),d.current&&(d.current.style.height="auto"))},[e,r,y,T,l]),I=ee(W=>{if((W.metaKey||W.ctrlKey)&&W.key==="Enter"){W.preventDefault(),$();return}W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),$())},[$]),F=ee(async W=>{await g(W)},[g]),L=ee(W=>{const ie=W.target;ie.files&&ie.files.length>0&&(w(ie.files),ie.value="")},[w]),Y=ee(W=>{W.preventDefault(),W.stopPropagation(),p.value=!0},[]),ct=ee(W=>{W.preventDefault(),W.stopPropagation(),!(W.relatedTarget&&h.current?.contains(W.relatedTarget))&&(p.value=!1)},[]),pe=ee(W=>{W.preventDefault(),W.stopPropagation()},[]),Tr=ee(async W=>{W.preventDefault(),W.stopPropagation(),p.value=!1;const ie=W.dataTransfer?.files;ie&&ie.length>0&&await w(ie)},[w]);R(()=>{if(d.current?.focus(),l){const W=zp(l);f.value=W,W&&requestAnimationFrame(_)}},[l,_]),R(()=>{if(C){const W=setTimeout(x,5e3);return()=>clearTimeout(W)}},[C,x]);const Wn=jh(f.value),Kn=v.length>0,be=(Wn||Kn)&&!r;return n("div",{class:"pb-3 pt-2",children:n("div",{class:"max-w-5xl mx-auto px-6",children:[n(U5,{}),C&&n("div",{class:"mb-2 px-3 py-2 text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 rounded-lg",children:C}),n("div",{ref:h,"data-tour":"chat-input",onDragEnter:Y,onDragLeave:ct,onDragOver:pe,onDrop:Tr,class:`
|
|
336
|
-
relative flex flex-col bg-[var(--color-bg-surface)] border rounded-xl
|
|
337
|
-
transition-all duration-200
|
|
338
|
-
${p.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/5":"border-[var(--color-border)] focus-within:border-[var(--color-accent)]"}
|
|
339
|
-
`,children:[p.value&&n("div",{class:"absolute inset-0 flex items-center justify-center bg-[var(--color-accent)]/10 rounded-xl z-10 pointer-events-none",children:n("span",{class:"text-sm font-medium text-[var(--color-accent)]",children:s("chat.dropFiles")})}),(Kn||b)&&n("div",{class:"pt-3 px-4",children:n(j5,{attachments:v,onRemove:k,isProcessing:b})}),n("textarea",{ref:d,value:f.value,onInput:E,onKeyDown:I,onPaste:F,disabled:r,placeholder:o||(window.innerWidth<640?s("chat.placeholderMobile"):s("chat.placeholder")),rows:1,class:`
|
|
340
|
-
w-full px-4 pb-1 text-base sm:text-sm rounded-t-xl resize-none
|
|
341
|
-
bg-transparent border-none
|
|
342
|
-
placeholder:text-[var(--color-text-muted)]
|
|
343
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
344
|
-
${Kn?"pt-2":"pt-3"}
|
|
345
|
-
`,style:{minHeight:"44px",maxHeight:`${rv}px`,outline:"none"}}),n("input",{ref:u,type:"file",multiple:!0,accept:"image/*",onChange:L,class:"hidden"}),n("div",{class:"px-2 pb-2 pt-1 flex items-center justify-between",children:[n("div",{class:"flex items-center gap-1",children:[l&&n("div",{"data-tour":"model-picker",children:n(N5,{sessionKey:l,currentModel:i,onModelChange:c})}),n(Ao,{content:s("chat.attachImage"),placement:"top",children:n("button",{type:"button",onClick:()=>u.current?.click(),disabled:r,"aria-label":s("chat.attachImage"),class:`
|
|
346
|
-
p-1.5 rounded-lg cursor-pointer
|
|
347
|
-
text-[var(--color-text-muted)]
|
|
348
|
-
hover:text-[var(--color-text-secondary)]
|
|
349
|
-
hover:bg-[var(--color-bg-hover)]
|
|
350
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
351
|
-
transition-colors
|
|
352
|
-
`,children:n(Fa,{class:"w-4 h-4","aria-hidden":"true"})})})]}),n("div",{class:"flex items-center gap-1.5",children:[a&&n("button",{type:"button",onClick:t,"aria-label":s("actions.stop"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5 cursor-pointer
|
|
353
|
-
bg-[var(--color-error)]/10 text-[var(--color-error)]
|
|
354
|
-
hover:bg-[var(--color-error)]/20
|
|
355
|
-
active:scale-95 transition-all duration-150`,children:[n(I4,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:s("actions.stop")})]}),n("button",{type:"button",onClick:$,disabled:!be,"aria-label":s(a?"actions.queue":"actions.send"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5
|
|
356
|
-
transition-all duration-150 active:scale-95
|
|
357
|
-
${be?"bg-[var(--color-accent)] text-white hover:opacity-90 cursor-pointer":"bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)] cursor-not-allowed"}`,children:[n(A4,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:s(a?"actions.queue":"actions.send")})]})]})]})]})]})})}function q5(){const e=Pe.value;if(e==="connected"||e==="connecting"||e==="authenticating")return null;const t=e==="reconnecting",r=Tt.value.length;return n("div",{class:`
|
|
358
|
-
px-4 py-2 text-sm flex items-center justify-center gap-2
|
|
359
|
-
animate-[fade-in_150ms_ease-out_100ms_forwards] opacity-0
|
|
360
|
-
${t?"bg-[var(--color-warning)]/10 text-[var(--color-warning)]":"bg-[var(--color-error)]/10 text-[var(--color-error)]"}
|
|
361
|
-
`,role:"alert",children:[n("span",{class:"flex-shrink-0",children:t?n(hb,{class:"w-4 h-4 animate-spin","aria-hidden":"true"}):n(Cr,{class:"w-4 h-4","aria-hidden":"true"})}),n("span",{children:t?Yt.value>1?s("connection.reconnectingAttempt",{count:Yt.value}):s("connection.reconnecting"):s("connection.disconnected")}),qg.value&&n("span",{class:"text-xs opacity-75",children:["• ",s("connection.messagesQueued",{count:r})]})]})}function ei({sessionKey:e}){const t=B(null),r=B(!1),[a,o]=de("q");Fe(a,wn,d=>d),R(()=>{a.value&&!Be.value&&(Be.value=!0)},[a.value]),va(wn,o),R(()=>{const d=e?decodeURIComponent(e):null;if(Ul.value&&Ve.value){Cn.value!==Ve.value&&Qa(Ve.value),d&&d!==Ve.value&&Le(`/chat/${encodeURIComponent(Ve.value)}`,!0);return}if(!d&&Ve.value){Le(`/chat/${encodeURIComponent(Ve.value)}`,!0);return}const u=d||"main";u!==Cn.value&&Qa(u)},[e,Ve.value,Ul.value]),R(()=>{const d=tt.value;if(!d||d===t.current)return;t.current=d,s2()!==d&&(Wc(),Y_(),wn.value="",Be.value=!1),Kc(d).catch(()=>{})},[Cn.value]),R(()=>{const d=P.value,u=r.current;r.current=d,!(!d||u)&&(g2(),qg.value&&N2())},[Pe.value]);const l=async(d,u)=>{const h=tt.value;if(h)try{await Xg(h,d,{attachments:u})}catch{}},i=()=>{const d=tt.value;d&&Zg(d)},c=Pc(()=>h2(tt.value));return n("div",{class:"flex-1 flex flex-col overflow-hidden relative",children:[n(q5,{}),n(M5,{messages:Kg.value,isLoading:_d.value,error:Vi.value,streamingContent:c.value.content,streamingToolCalls:c.value.toolCalls,isStreaming:c.value.isStreaming,assistantName:Rd.value,assistantAvatar:Md.value??void 0,userName:Q2.value,userAvatar:ek.value??void 0,queuedCount:Tt.value.length}),n(K5,{onSend:l,onAbort:i,disabled:!1,isStreaming:c.value.isStreaming,sessionKey:tt.value,currentModel:Yw.value?.model,onModelChange:d=>{tt.value&&Wh(tt.value,{model:d})}})]})}const Ef=Ss(({size:e="md",error:t,fullWidth:r,class:a,...o},l)=>{const[i,c]=U(!1);return n(Z,{ref:l,type:i?"text":"password",size:e,error:t,fullWidth:r,rightElement:n("button",{type:"button",onClick:()=>c(!i),class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-label":i?"Hide password":"Show password",tabIndex:-1,children:i?n(sb,{class:"w-4 h-4"}):n(of,{class:"w-4 h-4"})}),class:a,...o})});Ef.displayName="PasswordInput";const G5={default:`
|
|
362
|
-
bg-[var(--color-bg-surface)]
|
|
363
|
-
border border-[var(--color-border)]
|
|
364
|
-
shadow-soft-sm
|
|
365
|
-
transition-shadow duration-200 ease-out
|
|
366
|
-
hover:shadow-soft
|
|
367
|
-
`,elevated:`
|
|
368
|
-
bg-[var(--color-bg-surface)]
|
|
369
|
-
border border-[var(--color-border)]
|
|
370
|
-
shadow-soft-lg
|
|
371
|
-
transition-shadow duration-200 ease-out
|
|
372
|
-
hover:shadow-soft-xl
|
|
373
|
-
`,outlined:`
|
|
374
|
-
bg-transparent
|
|
375
|
-
border border-[var(--color-border)]
|
|
376
|
-
transition-colors duration-200 ease-out
|
|
377
|
-
`},Bu={none:"",sm:"p-3",md:"p-4",lg:"p-6"};function G({variant:e="default",padding:t="md",title:r,subtitle:a,headerActions:o,footer:l,children:i,class:c,...d}){const u=r||a||o;return n("div",{class:`rounded-xl ${G5[e]} ${c||""}`,...d,children:[u&&n("div",{class:`
|
|
378
|
-
flex items-start justify-between gap-4
|
|
379
|
-
${t!=="none"?Bu[t]:"p-4"}
|
|
380
|
-
${i||l?"border-b border-[var(--color-border)]":""}
|
|
381
|
-
`,children:[n("div",{children:[r&&n("h3",{class:"font-medium text-[var(--color-text-primary)]",children:r}),a&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-0.5",children:a})]}),o&&n("div",{class:"flex items-center gap-2",children:o})]}),i&&n("div",{class:Bu[t],children:i}),l&&n("div",{class:`
|
|
382
|
-
${Bu[t]}
|
|
383
|
-
border-t border-[var(--color-border)]
|
|
384
|
-
bg-[var(--color-bg-secondary)]/50
|
|
385
|
-
rounded-b-2xl
|
|
386
|
-
`,children:l})]})}function V5(){const e=ne(""),t=ne(""),r=ne("token"),a=ne(!1),o=ne(!0),l=ne(null),i=h=>{if(!h.trim())return s("errors.required");if(!h.startsWith("ws://")&&!h.startsWith("wss://"))return"URL must start with ws:// or wss://";try{new URL(h)}catch{return s("errors.invalid")}return null},c=async()=>{const h=i(e.value);if(h){l.value=h;return}l.value=null,a.value=!0;try{await gs({url:e.value,token:r.value==="token"?t.value:void 0,password:r.value==="password"?t.value:void 0,autoReconnect:!0}),$h({url:e.value,authMode:r.value,rememberMe:o.value,credential:t.value}),await Uc(),await nb(),await Zh(),Qa("main"),await Xh("main"),ef(),tf()}catch(f){A.auth.error("Connect failed:",f)}finally{a.value=!1}},d=h=>{h.key==="Enter"&&(h.preventDefault(),c())};if(!e.value){const h=Nc();if(h){e.value=h.url,r.value=h.authMode,o.value=h.rememberMe;const f=Dh();f&&(t.value=f)}}const u=[{value:"token",label:s("common.token")},{value:"password",label:s("common.password")}];return n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-8",children:n("div",{class:"w-full max-w-sm mx-auto min-h-full flex flex-col justify-center py-4 sm:py-0",children:[n("div",{class:"text-center mb-4 sm:mb-8",children:[n(eu,{size:"lg",class:"mx-auto mb-2 sm:mb-3 sm:w-16 sm:h-16"}),n("h1",{class:"text-xl sm:text-2xl font-bold",children:s("common.cove")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mt-1",children:s("app.tagline")})]}),n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:s("common.connectToGateway")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(Oe,{label:s("common.gatewayUrl"),htmlFor:"gateway-url",error:l.value||void 0,children:n(Z,{id:"gateway-url",type:"url",value:e.value,onInput:h=>{e.value=h.target.value,l.value=null},onKeyDown:d,placeholder:s("auth.gatewayUrlPlaceholder"),error:l.value||void 0,autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(Oe,{label:"Auth Mode",children:n(Me,{value:r.value,onChange:h=>r.value=h,options:u,"aria-label":"Auth Mode",class:"w-full"})}),n(Oe,{label:r.value==="token"?s("common.token"):s("common.password"),htmlFor:"auth-credential",children:n(Ef,{id:"auth-credential",value:t.value,onInput:h=>t.value=h.target.value,onKeyDown:d,placeholder:r.value==="token"?s("auth.tokenPlaceholder"):s("auth.passwordPlaceholder"),fullWidth:!0})}),n(Ue,{checked:o.value,onChange:h=>o.value=h,label:s("auth.rememberMe"),size:"sm"}),n(N,{variant:"primary",onClick:c,disabled:a.value||!e.value.trim(),loading:a.value,fullWidth:!0,children:a.value?s("common.connecting"):s("actions.connect")}),lr.value&&n("p",{class:"text-sm text-[var(--color-error)] text-center",children:lr.value})]})]})]})})}class ru extends Ct{constructor(t){super(t),this.state={hasError:!1,error:null,detailsOpen:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){const{viewName:a}=this.props;A.ui.error(`ViewErrorBoundary caught error in ${a||"unknown view"}:`,t),A.ui.error("Component stack:",r.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null,detailsOpen:!1}),this.props.onRetry?.()};toggleDetails=()=>{this.setState(t=>({detailsOpen:!t.detailsOpen}))};copyError=()=>{const{error:t}=this.state;if(t){const r=`${t.name}: ${t.message}
|
|
387
|
-
|
|
388
|
-
${t.stack||""}`;navigator.clipboard.writeText(r),J.success(s("actions.copied"))}};render(){if(this.state.hasError){const{error:t,detailsOpen:r}=this.state;return n("div",{class:"flex-1 flex flex-col items-center justify-start p-8 pt-16 overflow-auto",role:"alert",children:n("div",{class:"max-w-lg w-full text-center space-y-6",children:[n("img",{src:"/confused-lobster.png",alt:"",class:"w-80 h-auto mx-auto rounded-xl","aria-hidden":"true"}),n("div",{class:"space-y-2",children:[n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:s("errors.errorPage.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("errors.errorPage.subtitle")})]}),n(N,{onClick:this.handleRetry,variant:"secondary",icon:n(Xe,{class:"w-4 h-4"}),children:s("actions.retry")}),t&&n("div",{class:"text-left",children:[n("button",{type:"button",onClick:this.toggleDetails,class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[r?n(xs,{class:"w-4 h-4"}):n(ze,{class:"w-4 h-4"}),s("errors.errorPage.details")]}),r&&n("div",{class:"mt-2 relative",children:[n("pre",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-xs text-[var(--color-text-muted)] overflow-x-auto max-h-40 overflow-y-auto",children:n("code",{children:[t.name,": ",t.message,t.stack&&`
|
|
389
|
-
|
|
390
|
-
${t.stack}`]})}),n("button",{type:"button",onClick:this.copyError,class:"absolute top-2 right-2 p-1.5 rounded bg-[var(--color-bg-secondary)] hover:bg-[var(--color-bg-hover)] transition-colors",title:s("actions.copy"),children:n(ys,{class:"w-3.5 h-3.5"})})]})]})]})})}return this.props.children}}const J5={"4xl":"max-w-4xl","5xl":"max-w-5xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};function rn({viewName:e,children:t,maxWidth:r="5xl"}){return n(ru,{viewName:e,children:n("div",{class:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6",children:n("div",{class:`${J5[r]} mx-auto space-y-4 sm:space-y-6`,children:t})})})}const Kr=m(null),Ua=m([]),Y5=m(null),Ma=m(null),av=m(!1);async function X5(){if(P.value){av.value=!0;try{try{const e=await O("cron.status");Kr.value={enabled:e.enabled??!1,jobCount:e.jobs??0,nextWakeMs:e.nextWakeAtMs??null}}catch{Kr.value=null}try{const e=await O("channels.status"),t=[],r=e.channelOrder??[];for(const a of r){const o=e.channelAccounts?.[a]??[];for(const l of o)t.push({id:l.accountId,type:a,connected:l.connected??l.running??!1})}Ua.value=t}catch{Ua.value=[]}try{const t=(await O("skills.status")).skills??[];Ma.value={total:t.length,eligible:t.filter(r=>r.eligible).length}}catch{Ma.value=null}Y5.value=null}finally{av.value=!1}}}const Z5=q(()=>{const e=Nh.value;if(e==null)return null;const t=Math.floor(e/1e3),r=Math.floor(t/60),a=Math.floor(r/60),o=Math.floor(a/24);return o>0?`${o}d ${a%24}h`:a>0?`${a}h ${r%60}m`:r>0?`${r}m ${t%60}s`:`${t}s`}),Q5=q(()=>window.location.protocol==="https:"||window.location.hostname==="localhost"),eC=q(()=>pt.value?.startsWith("wss://")??!1),ov=q(()=>Ua.value.filter(e=>e.connected).length),tC=q(()=>{const e=Kr.value?.nextWakeMs;if(!e)return null;const t=Date.now(),r=e-t;return r<0?"now":r<6e4?`${Math.floor(r/1e3)}s`:r<36e5?`${Math.floor(r/6e4)}m`:r<864e5?`${Math.floor(r/36e5)}h`:`${Math.floor(r/864e5)}d`});function Ca({icon:e,label:t,value:r,subtext:a,href:o}){const l=n(j,{children:[n("div",{class:"p-1.5 sm:p-2 rounded-lg bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)]",children:n(e,{class:"w-4 h-4 sm:w-5 sm:h-5"})}),n("div",{class:"min-w-0 flex-1",children:[n("div",{class:"text-base sm:text-lg font-semibold truncate",children:r}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:t}),a&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:a})]})]});return o?n("a",{href:o,class:"flex items-center gap-2 sm:gap-3 p-3 sm:p-4 rounded-lg bg-[var(--color-bg-secondary)] hover:bg-[var(--color-bg-tertiary)] transition-colors no-underline",children:l}):n("div",{class:"flex items-center gap-2 sm:gap-3 p-3 sm:p-4 rounded-lg bg-[var(--color-bg-secondary)]",children:l})}function lv({value:e,label:t}){const[r,a]=U(!1);return n("div",{class:"py-2",children:[n("div",{class:"flex items-center justify-between mb-1",children:[n("span",{class:"text-[var(--color-text-muted)] text-sm",children:t}),n("button",{onClick:async()=>{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)},class:"p-1 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors flex-shrink-0","aria-label":`Copy ${t}`,children:r?n(nn,{class:"w-4 h-4 text-[var(--color-success)]"}):n(ys,{class:"w-4 h-4"})})]}),n("code",{class:"block text-xs sm:text-sm bg-[var(--color-bg-secondary)] px-2 py-1 rounded truncate w-full",children:e})]})}function ti({label:e,value:t}){return t?n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between py-2 gap-0.5 sm:gap-2",children:[n("span",{class:"text-[var(--color-text-muted)] text-sm",children:e}),n("span",{class:"font-medium text-sm sm:text-base",children:t})]}):null}function nC(e){const t=P.value,r=Pe.value;return R(()=>{t&&X5()},[t]),n(rn,{viewName:s("common.overview"),children:[!Q5.value&&n("div",{class:"flex items-start gap-3 p-4 rounded-lg bg-[var(--color-warning)]/10 border border-[var(--color-warning)]/20",children:[n(Cr,{class:"w-5 h-5 text-[var(--color-warning)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("div",{class:"font-medium text-[var(--color-warning)]",children:"Insecure Context"}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mt-1",children:"This page is not served over HTTPS. Some features may be limited."})]})]}),t&&pt.value&&!eC.value&&n("div",{class:"flex items-start gap-3 p-4 rounded-lg bg-[var(--color-warning)]/10 border border-[var(--color-warning)]/20",children:[n(Xc,{class:"w-5 h-5 text-[var(--color-warning)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("div",{class:"font-medium text-[var(--color-warning)]",children:"Insecure WebSocket"}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mt-1",children:["Connected via ",n("code",{class:"bg-[var(--color-bg-secondary)] px-1 rounded",children:"ws://"})," ","instead of ",n("code",{class:"bg-[var(--color-bg-secondary)] px-1 rounded",children:"wss://"}),". Traffic is not encrypted."]})]})]}),n(G,{padding:"md",children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[n("div",{class:"flex items-center gap-3",children:[t?n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(ac,{class:"w-5 h-5 sm:w-6 sm:h-6 text-[var(--color-success)]"})}):n("div",{class:"p-2 rounded-lg bg-[var(--color-error)]/10",children:n(xb,{class:"w-5 h-5 sm:w-6 sm:h-6 text-[var(--color-error)]"})}),n("div",{children:[n("h2",{class:"text-base sm:text-lg font-semibold",children:"Gateway Connection"}),n(X,{variant:t?"success":r==="connecting"?"warning":"error",dot:!0,size:"sm",children:s(r==="connected"?"common.healthy":r==="connecting"||r==="authenticating"?"status.connecting":r==="reconnecting"?"status.reconnecting":"status.disconnected")})]})]}),t&&n(N,{variant:"secondary",size:"sm",onClick:()=>Za(),children:"Disconnect"})]}),t&&pt.value&&n("div",{class:"border-t border-[var(--color-border)] pt-4 mt-4 space-y-1",children:[n(lv,{label:"URL",value:pt.value}),Zo.connectionId.value&&n(lv,{label:"Connection ID",value:Zo.connectionId.value})]})]}),t&&n("div",{class:"grid grid-cols-2 md:grid-cols-3 gap-2 sm:gap-4",children:[n(Ca,{icon:ge,label:"Uptime",value:Z5.value??"—",subtext:br.value?`Since ${re(br.value)}`:void 0,href:"/stats"}),n(Ca,{icon:sr,label:"Instances",value:vs.value.length,subtext:"Connected clients",href:"/instances"}),n(Ca,{icon:An,label:"Sessions",value:Et.value.length,subtext:"Active sessions",href:"/sessions"}),n(Ca,{icon:Rn,label:"Cron",value:Kr.value?.enabled?"Enabled":"Disabled",subtext:Kr.value?.nextWakeMs?`Next wake: ${tC.value}`:Kr.value?.jobCount?`${Kr.value.jobCount} jobs`:void 0,href:"/cron"}),n(Ca,{icon:rc,label:"Channels",value:Ua.value.length>0?ov.value:"—",subtext:Ua.value.length>0?`${ov.value}/${Ua.value.length} connected`:"No channels configured",href:"/channels"}),n(Ca,{icon:Zc,label:"Skills",value:Ma.value?.eligible??"—",subtext:Ma.value?`${Ma.value.eligible}/${Ma.value.total} active`:void 0,href:"/skills"})]}),t&&n(G,{title:s("overview.serverInfo"),padding:"md",children:n("div",{class:"divide-y divide-[var(--color-border)]",children:[n(ti,{label:s("common.version"),value:Ot.value}),n(ti,{label:s("common.commit"),value:ms.value?.substring(0,8)}),n(ti,{label:s("common.host"),value:So.value}),n(ti,{label:s("overview.capabilities"),value:Zo.capabilities.value.length>0?s("overview.capabilitiesCount",{count:Zo.capabilities.value.length}):null})]})})]})}function ve({icon:e,label:t,value:r,active:a,highlight:o,onClick:l,class:i}){const c=!!l,d=n(j,{children:[n("div",{class:`p-1.5 sm:p-2 rounded-lg ${a?"bg-[var(--color-accent)]/20":"bg-[var(--color-bg-tertiary)]"}`,children:n(e,{class:`w-4 h-4 sm:w-5 sm:h-5 ${a?"text-[var(--color-accent)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0",children:[n("div",{class:`text-lg sm:text-2xl font-bold ${o?"text-[var(--color-error)]":""}`,children:r}),n("div",{class:"text-[10px] sm:text-sm text-[var(--color-text-muted)] truncate",children:t})]})]}),u=`
|
|
391
|
-
flex items-center gap-1.5 sm:gap-3 p-2 sm:p-4 rounded-xl text-left transition-all
|
|
392
|
-
${a?"bg-[var(--color-accent)]/10 border-2 border-[var(--color-accent)]":"bg-[var(--color-bg-secondary)] border-2 border-transparent"}
|
|
393
|
-
${c?"hover:bg-[var(--color-bg-tertiary)] cursor-pointer":""}
|
|
394
|
-
${i||""}
|
|
395
|
-
`;return c?n("button",{type:"button",onClick:l,class:u,children:d}):n("div",{class:u,children:d})}function jt({title:e,subtitle:t,actions:r,class:a}){const o=typeof t=="string"?n("p",{class:"text-sm text-[var(--color-text-muted)] mt-1",children:t}):t;return n("div",{class:`space-y-1 ${a??""}`,children:[n("div",{class:"flex items-center justify-between gap-3",children:[n("h1",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:e}),r&&n("div",{class:"flex items-center gap-2 flex-shrink-0",children:r})]}),o]})}const rC={default:"bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)]",success:"bg-[var(--color-success)]/10 text-[var(--color-success)]",warning:"bg-[var(--color-warning)]/10 text-[var(--color-warning)]",error:"bg-[var(--color-error)]/10 text-[var(--color-error)]",info:"bg-[var(--color-info)]/10 text-[var(--color-info)]"};function Mo({icon:e,iconVariant:t="default",title:r,subtitle:a,badges:o,meta:l,actions:i,onClick:c}){const d=n("div",{class:"flex items-start gap-3 w-full",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${rC[t]}`,children:n(e,{class:"w-4 h-4"})}),n("div",{class:"flex-1 min-w-0 w-0",children:[n("div",{class:"flex items-center gap-2 mb-0.5",children:[n("span",{class:"font-medium truncate",children:r}),o]}),a&&n("div",{class:"text-xs text-[var(--color-text-muted)] font-mono truncate mb-2",children:a}),l&&l.length>0&&n("div",{class:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-[var(--color-text-muted)]",children:l.map((u,h)=>n("span",{class:"flex items-center gap-1",title:u.title,children:[u.icon&&n(u.icon,{class:"w-3 h-3"}),u.value]},`${h}-${u.value}`))})]}),i&&n("div",{class:"flex-shrink-0",children:i})]});return c?n("button",{type:"button","aria-label":r,class:"w-full p-3 rounded-lg bg-[var(--color-bg-secondary)] hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors text-left overflow-hidden",onClick:c,children:d}):n("div",{class:"p-3 rounded-lg bg-[var(--color-bg-secondary)] overflow-hidden",children:d})}function aC({job:e,onRun:t,onToggleEnabled:r,isRunning:a}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n(K,{icon:n(lf,{class:"w-4 h-4"}),label:s("cron.runNow"),size:"sm",variant:"ghost",disabled:a,onClick:o=>{o.stopPropagation(),t(e)}}),n(K,{icon:e.enabled?n(To,{class:"w-4 h-4"}):n(Eo,{class:"w-4 h-4"}),label:e.enabled?s("common.disable"):s("common.enable"),size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),r(e)},class:e.enabled?"text-[var(--color-text-muted)]":"text-[var(--color-success)]"})]})}function oC({job:e,onEdit:t}){const r=_f(e),a=e.delivery?.mode==="announce";return n(Mo,{icon:ge,iconVariant:e.enabled?r.variant==="error"?"error":"success":"default",title:e.name,badges:n(j,{children:[a&&n(af,{class:"w-3.5 h-3.5 text-[var(--color-info)]","aria-label":s("cron.announces")}),n(X,{variant:r.variant,size:"sm",children:r.label})]}),meta:[{icon:Co,value:Vl(e.schedule)},{icon:gb,value:Sf(e)}],onClick:()=>t(e)})}function lC({job:e,onEdit:t,onRun:r,onToggleEnabled:a,isRunning:o}){const l=_f(e),i=e.delivery?.mode==="announce";return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>t(e),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(e))},tabIndex:0,"aria-label":s("cron.editJob",{name:e.name}),children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${e.enabled?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(ge,{class:`w-4 h-4 ${e.enabled?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0 flex-1",children:[n("div",{class:"font-medium truncate flex items-center gap-1.5",title:e.name,children:[e.name,i&&n(af,{class:"w-3.5 h-3.5 text-[var(--color-info)] flex-shrink-0","aria-label":s("cron.announces")})]}),e.description&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",title:e.description,children:e.description})]})]})}),n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(Co,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate",title:Vl(e.schedule),children:Vl(e.schedule)})]})}),n("td",{class:"py-3 px-4",children:n(X,{variant:e.sessionTarget==="main"?"success":"default",size:"sm",children:e.sessionTarget})}),n("td",{class:"py-3 px-4 whitespace-nowrap",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(gb,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:Sf(e)})]})}),n("td",{class:"py-3 px-4",children:n(X,{variant:l.variant,size:"sm",children:l.label})}),n("td",{class:"py-3 px-4",children:n(aC,{job:e,onRun:r,onToggleEnabled:a,isRunning:o})})]})}function ro({class:e="",fullWidth:t=!1,rows:r=3,error:a=!1,...o}){return n("textarea",{rows:r,class:`
|
|
396
|
-
px-3 py-2 text-sm rounded-lg resize-y
|
|
397
|
-
bg-[var(--color-bg-primary)]
|
|
398
|
-
text-[var(--color-text-primary)]
|
|
399
|
-
placeholder:text-[var(--color-text-muted)]
|
|
400
|
-
border transition-colors
|
|
401
|
-
focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)]/30 focus:border-[var(--color-accent)]
|
|
402
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
403
|
-
${a?"border-[var(--color-error)] focus:border-[var(--color-error)] focus:ring-[var(--color-error)]/30":"border-[var(--color-border)] hover:border-[var(--color-border-hover)]"}
|
|
404
|
-
${t?"w-full":""}
|
|
405
|
-
${e}
|
|
406
|
-
`,...o})}function sC({label:e,selected:t,onClick:r,title:a,size:o="md"}){return n("button",{type:"button",onClick:r,title:a,class:`
|
|
407
|
-
${o==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm"} rounded-lg border transition-colors
|
|
408
|
-
${t?"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]":"border-[var(--color-border)] hover:border-[var(--color-border-hover)] text-[var(--color-text-muted)]"}
|
|
409
|
-
`,children:e})}function sv({options:e,value:t,onChange:r,size:a="md"}){return n("div",{class:"flex flex-wrap gap-2",children:e.map(o=>n(sC,{label:o.label,selected:t===o.value,onClick:()=>r(o.value),title:String(o.value),size:a},o.value))})}const iC=[{value:"cron",label:s("cron.scheduleKind.cron")},{value:"every",label:s("cron.scheduleKind.every")},{value:"at",label:s("cron.scheduleKind.at")}],cC=[{value:"main",label:s("cron.sessionTarget.main")},{value:"isolated",label:s("cron.sessionTarget.isolated")}],uC=[{value:"next-heartbeat",label:s("cron.wakeMode.nextHeartbeat")},{value:"now",label:s("cron.wakeMode.now")}];function dC({editName:e,editDescription:t,editScheduleKind:r,editScheduleExpr:a,editScheduleTz:o,editScheduleEveryMs:l,editScheduleAtMs:i,editSessionTarget:c,editWakeMode:d,editDeliveryAnnounce:u,editPayloadText:h,editPayloadMessage:f,editPayloadModel:p,formErrors:v}){const w=v.value;return n("div",{class:"space-y-4 sm:space-y-5",children:[n(Oe,{label:s("common.name"),error:w.name,children:n(Z,{value:e.value,onInput:k=>e.value=k.target.value,placeholder:s("cron.form.namePlaceholder"),error:!!w.name,fullWidth:!0})}),n(Oe,{label:s("cron.form.description"),hint:s("cron.form.descriptionHint"),children:n(Z,{value:t.value,onInput:k=>t.value=k.target.value,placeholder:s("cron.form.descriptionPlaceholder"),fullWidth:!0})}),n(Oe,{label:s("common.schedule"),error:w.schedule,children:n("div",{class:"space-y-3",children:[n(Me,{value:r.value,onChange:k=>r.value=k,options:iC}),r.value==="cron"&&n("div",{class:"space-y-3",children:[n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[n(Z,{value:a.value,onInput:k=>a.value=k.target.value,placeholder:s("cron.form.cronPlaceholder"),fullWidth:!0}),n(Z,{value:o.value,onInput:k=>o.value=k.target.value,placeholder:s("cron.form.timezonePlaceholder"),fullWidth:!0})]}),n(sv,{options:$_.map(({expr:k,label:T})=>({value:k,label:T})),value:a.value,onChange:k=>a.value=k,size:"sm"})]}),r.value==="every"&&n("div",{class:"space-y-2",children:[n(sv,{options:M_.map(({ms:k,label:T})=>({value:String(k),label:T})),value:l.value,onChange:k=>l.value=k}),n(Z,{type:"number",value:l.value,onInput:k=>l.value=k.target.value,placeholder:s("cron.form.intervalPlaceholder"),fullWidth:!0})]}),r.value==="at"&&n(Z,{type:"datetime-local",value:T_(Number(i.value)||Date.now()),onInput:k=>{const T=k.target.value;i.value=String(A_(T))},fullWidth:!0})]})}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[n(Oe,{label:s("cron.form.sessionTarget"),hint:s("cron.form.sessionTargetHint"),children:n(Me,{value:c.value,onChange:k=>{c.value=k},options:cC})}),n(Oe,{label:s("cron.form.wakeMode"),hint:s("cron.form.wakeModeHint"),children:n(Me,{value:d.value,onChange:k=>d.value=k,options:uC})})]}),c.value==="isolated"&&n("div",{class:"flex items-center justify-between p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[n("div",{children:[n("div",{class:"text-sm font-medium",children:s("cron.form.announceResults")}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("cron.form.announceResultsHint")})]}),n(Ue,{checked:u.value,onChange:k=>u.value=k,label:s("cron.form.announceResults")})]}),n(Oe,{label:s("cron.form.payload"),error:w.payload,hint:c.value==="main"?s("cron.form.payloadHintMain"):s("cron.form.payloadHintIsolated"),children:c.value==="main"?n(ro,{value:h.value,onInput:k=>h.value=k.target.value,placeholder:s("cron.form.systemEventPlaceholder"),error:!!w.payload,rows:3,fullWidth:!0}):n("div",{class:"space-y-3",children:[n(ro,{value:f.value,onInput:k=>f.value=k.target.value,placeholder:s("cron.form.agentMessagePlaceholder"),error:!!w.payload,rows:3,fullWidth:!0}),n(Z,{value:p.value,onInput:k=>p.value=k.target.value,placeholder:s("cron.form.modelPlaceholder"),fullWidth:!0})]})})]})}function Hu({value:e,label:t}){return n("div",{class:"text-center p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-xl font-bold",children:e}),n("div",{class:"text-sm text-[var(--color-text-muted)]",children:t})]})}function hC({mode:e,job:t,runs:r,isLoadingRuns:a,isDeleting:o,isSaving:l,isRunning:i,hasChanges:c,onClose:d,onSave:u,onDelete:h,onRun:f,onSetDeleting:p,editName:v,editDescription:w,editEnabled:k,editScheduleKind:T,editScheduleExpr:y,editScheduleTz:g,editScheduleEveryMs:b,editScheduleAtMs:C,editSessionTarget:x,editWakeMode:_,editDeliveryAnnounce:E,editPayloadText:$,editPayloadMessage:I,editPayloadModel:F,formErrors:L}){if(!e)return null;const Y=e==="edit",ct=t?_f(t):null;return n(We,{open:!!e,onClose:d,title:Y&&t?t.name:s("cron.createJob"),size:"xl",footer:o?n(hx,{message:s("cron.confirmDelete"),onCancel:()=>p(!1),onDelete:h}):n(fx,{isEdit:Y&&!!t,onDeleteClick:()=>p(!0),onCancel:d,onSave:u,isSaving:l,saveDisabled:!c,saveLabel:s(Y?"actions.save":"common.create"),extraContent:n("div",{class:"flex items-center justify-between sm:justify-start gap-2",children:[n("span",{class:"text-sm text-[var(--color-text-secondary)]",children:k.value?s("common.enabled"):s("common.disabled")}),n(Ue,{checked:k.value,onChange:pe=>k.value=pe})]})}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[Y&&t&&ct&&n(j,{children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-3 p-3 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-center gap-3 flex-1 min-w-0",children:[n("div",{class:`p-2 sm:p-3 rounded-xl flex-shrink-0 ${t.enabled?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(ge,{class:`w-5 h-5 sm:w-6 sm:h-6 ${t.enabled?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0",children:[n("div",{class:"flex flex-wrap items-center gap-1.5 mb-1",children:[n(X,{variant:ct.variant,size:"sm",children:ct.label}),n(X,{variant:t.sessionTarget==="main"?"success":"default",size:"sm",children:t.sessionTarget})]}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] truncate",children:Vl(t.schedule)})]})]}),n(N,{size:"sm",variant:"secondary",icon:n(lf,{class:"w-4 h-4"}),onClick:()=>f(t),disabled:i,fullWidth:!0,class:"sm:w-auto",children:s("cron.runNow")})]}),n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(Hu,{value:Sf(t),label:s("common.nextRun")}),n(Hu,{value:I_(t),label:s("cron.lastRun")}),n(Hu,{value:t.state.lastDurationMs?`${Math.round(t.state.lastDurationMs/1e3)}s`:"—",label:s("cron.lastDuration")})]})]}),n(dC,{editName:v,editDescription:w,editScheduleKind:T,editScheduleExpr:y,editScheduleTz:g,editScheduleEveryMs:b,editScheduleAtMs:C,editSessionTarget:x,editWakeMode:_,editDeliveryAnnounce:E,editPayloadText:$,editPayloadMessage:I,editPayloadModel:F,formErrors:L}),Y&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-3",children:s("cron.recentRuns")}),a?n("div",{class:"flex justify-center py-4",children:n(te,{size:"sm"})}):r.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-4",children:s("cron.noRuns")}):n("div",{class:"space-y-2 max-h-48 overflow-y-auto",children:r.map(pe=>n("div",{class:"flex items-center gap-3 p-2 rounded-lg bg-[var(--color-bg-secondary)] text-sm",children:[pe.status==="ok"?n(Eo,{class:"w-4 h-4 text-[var(--color-success)]"}):pe.status==="error"?n(To,{class:"w-4 h-4 text-[var(--color-error)]"}):n(ge,{class:"w-4 h-4 text-[var(--color-warning)]"}),n("span",{class:"flex-1",children:re(pe.runAtMs)}),pe.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:[Math.round(pe.durationMs/1e3),"s"]}),pe.error&&n("span",{class:"text-[var(--color-error)] truncate max-w-[200px]",title:pe.error,children:pe.error})]},pe.runAtMs))})]})]})})}const Sr=m([]),px=m(null),Kd=m(!1),ia=m(null),mx=m(""),qd=m("all"),au=m(null),_r=m(null),Jl=m([]),Gd=m(!1),vx=m(!1),Vd=m(!1),Jd=m(!1),ca=m(""),ao=m(""),oo=m(!0),Gt=m("cron"),ua=m(""),lo=m(""),so=m(""),io=m(""),co=m("next-heartbeat"),Sn=m("main"),uo=m(!1),ho=m(""),fo=m(""),po=m(""),ou=m({}),fC=q(()=>{let e=Sr.value;qd.value==="enabled"?e=e.filter(r=>r.enabled):qd.value==="disabled"&&(e=e.filter(r=>!r.enabled));const t=mx.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=r.name.toLowerCase(),o=(r.description||"").toLowerCase();return a.includes(t)||o.includes(t)})),[...e].sort((r,a)=>{if(r.enabled!==a.enabled)return r.enabled?-1:1;const o=r.state.nextRunAtMs??1/0,l=a.state.nextRunAtMs??1/0;return o-l})}),pC=q(()=>{const e={total:0,enabled:0,disabled:0};for(const t of Sr.value)e.total++,t.enabled?e.enabled++:e.disabled++;return e});async function pc(){Kd.value=!0,ia.value=null;const[e,t]=await Promise.allSettled([O("cron.status",{}),O("cron.list",{includeDisabled:!0})]);e.status==="fulfilled"&&(px.value=e.value),t.status==="fulfilled"&&(Sr.value=t.value.jobs??[]);const r=[];e.status==="rejected"&&r.push(`Status: ${ae(e.reason)}`),t.status==="rejected"&&r.push(`Jobs: ${ae(t.reason)}`),r.length>0&&(ia.value=r.join("; ")),Kd.value=!1}async function mC(e){Gd.value=!0;try{const t=await O("cron.runs",{jobId:e,limit:20});Jl.value=t.entries??[]}catch{Jl.value=[]}finally{Gd.value=!1}}function vC(e){ca.value=e.name,ao.value=e.description??"",oo.value=e.enabled,Gt.value=e.schedule.kind,e.schedule.kind==="cron"?(ua.value=e.schedule.expr,lo.value=e.schedule.tz??""):e.schedule.kind==="every"?so.value=String(e.schedule.everyMs):e.schedule.kind==="at"&&(io.value=String(e.schedule.atMs)),co.value=e.wakeMode,Sn.value=e.sessionTarget,uo.value=e.delivery?.mode==="announce",e.payload.kind==="systemEvent"?ho.value=e.payload.text:(fo.value=e.payload.message,po.value=e.payload.model??""),ou.value={}}function gC(){ca.value="",ao.value="",oo.value=!0,Gt.value="cron",ua.value="",lo.value="",so.value="",io.value="",co.value="next-heartbeat",Sn.value="main",uo.value=!1,ho.value="",fo.value="",po.value="",ou.value={}}function bC(e,t){e==="edit"&&t?(_r.value=t,vC(t),mC(t.id)):(_r.value=null,gC(),Jl.value=[]),au.value=e}function Tf(){au.value=null,_r.value=null,Jl.value=[],vx.value=!1}function xC(){const e={};if(ca.value.trim()||(e.name=s("cron.validation.nameRequired")),Gt.value==="cron")ua.value.trim()?R_(ua.value)||(e.schedule=s("cron.validation.cronInvalid")):e.schedule=s("cron.validation.cronRequired");else if(Gt.value==="every"){const t=parseInt(so.value,10);(!t||t<1e3)&&(e.schedule=s("cron.validation.intervalMin"))}else if(Gt.value==="at"){const t=parseInt(io.value,10);(!t||t<Date.now())&&(e.schedule=s("cron.validation.atFuture"))}return Sn.value==="main"?ho.value.trim()||(e.payload=s("cron.validation.payloadRequired")):fo.value.trim()||(e.payload=s("cron.validation.payloadRequired")),ou.value=e,Object.keys(e).length===0}function iv(){switch(Gt.value){case"cron":return{kind:"cron",expr:ua.value,...lo.value?{tz:lo.value}:{}};case"every":return{kind:"every",everyMs:parseInt(so.value,10)||6e4};case"at":return{kind:"at",atMs:parseInt(io.value,10)||Date.now()}}}function cv(){return Sn.value==="main"?{kind:"systemEvent",text:ho.value}:{kind:"agentTurn",message:fo.value,...po.value?{model:po.value}:{}}}async function yC(){if(xC()){Vd.value=!0;try{if(au.value==="edit"&&_r.value){const e={name:ca.value,description:ao.value||void 0,enabled:oo.value,schedule:iv(),sessionTarget:Sn.value,wakeMode:co.value,payload:cv(),delivery:{mode:uo.value?"announce":"none"}};await O("cron.update",{jobId:_r.value.id,patch:e})}else{const e={name:ca.value,description:ao.value||void 0,enabled:oo.value,schedule:iv(),sessionTarget:Sn.value,wakeMode:co.value,payload:cv(),delivery:{mode:uo.value?"announce":"none"}};await O("cron.add",{job:e})}await pc(),Tf()}catch(e){ia.value=ae(e)}finally{Vd.value=!1}}}async function wC(){const e=_r.value;if(e)try{await O("cron.remove",{jobId:e.id}),Sr.value=Sr.value.filter(t=>t.id!==e.id),Tf()}catch(t){ia.value=ae(t)}}async function kC(e){Jd.value=!0;try{await O("cron.run",{jobId:e.id,mode:"force"}),await pc()}catch(t){ia.value=ae(t)}finally{Jd.value=!1}}async function SC(e){try{await O("cron.update",{jobId:e.id,patch:{enabled:!e.enabled}}),Sr.value=Sr.value.map(t=>t.id===e.id?{...t,enabled:!t.enabled}:t)}catch(t){ia.value=ae(t)}}function _C(){R(()=>{P.value&&pc()},[P.value]);const e=Pc(()=>{const t=_r.value;if(!t||ca.value!==t.name||ao.value!==(t.description??"")||oo.value!==t.enabled||Gt.value!==t.schedule.kind||co.value!==t.wakeMode||Sn.value!==t.sessionTarget||uo.value!==(t.delivery?.mode==="announce"))return!0;if(t.schedule.kind==="cron"&&Gt.value==="cron"){if(ua.value!==t.schedule.expr||lo.value!==(t.schedule.tz??""))return!0}else if(t.schedule.kind==="every"&&Gt.value==="every"){if(so.value!==String(t.schedule.everyMs))return!0}else if(t.schedule.kind==="at"&&Gt.value==="at"&&io.value!==String(t.schedule.atMs))return!0;if(t.payload.kind==="systemEvent"&&Sn.value==="main"){if(ho.value!==t.payload.text)return!0}else if(t.payload.kind==="agentTurn"&&Sn.value==="isolated"&&(fo.value!==t.payload.message||po.value!==(t.payload.model??"")))return!0;return!1});return{state:{cronJobs:Sr,cronStatus:px,isLoading:Kd,error:ia,searchQuery:mx,statusFilter:qd},modal:{modalMode:au,selectedJob:_r,selectedJobRuns:Jl,isLoadingRuns:Gd,isDeleting:vx,isSaving:Vd,isRunning:Jd},form:{editName:ca,editDescription:ao,editEnabled:oo,editScheduleKind:Gt,editScheduleExpr:ua,editScheduleTz:lo,editScheduleEveryMs:so,editScheduleAtMs:io,editWakeMode:co,editSessionTarget:Sn,editDeliveryAnnounce:uo,editPayloadText:ho,editPayloadMessage:fo,editPayloadModel:po,formErrors:ou},computed:{filteredJobs:fC,jobCounts:pC,hasFormChanges:e},actions:{loadCronJobs:pc,openJobModal:bC,closeModal:Tf,saveOrCreateJob:yC,deleteJob:wC,runJobNow:kC,toggleJobEnabled:SC}}}function CC(e){const{state:t,modal:r,form:a,computed:o,actions:l}=_C(),i=!t.isLoading.value&&t.cronJobs.value.length>0,[c,d]=de("q"),[u,h]=de("filter"),[f,p,v]=de("job",{ready:i});Fe(c,t.searchQuery,y=>y),Fe(u,t.statusFilter,y=>y),va(t.searchQuery,d),En(t.statusFilter,h,"all"),R(()=>{if(i)if(f.value){const y=t.cronJobs.value.find(g=>g.id===f.value);y&&r.selectedJob.value?.id!==y.id&&l.openJobModal("edit",y)}else r.selectedJob.value&&r.modalMode.value==="edit"&&l.closeModal()},[f.value,i]),R(()=>{v.value&&!r.selectedJob.value&&f.value&&p(null)},[r.selectedJob.value,v.value]);const w=(y,g)=>{y==="edit"&&g&&(p(g.id),kr()),l.openJobModal(y,g)},k=()=>{p(null),l.closeModal()},T=o.jobCounts.value;return n(rn,{viewName:s("common.cronJobs"),children:[n(jt,{title:s("common.cronJobs"),subtitle:s("cron.description"),actions:n(j,{children:[P.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(lt,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Z,{type:"text",value:t.searchQuery.value,onInput:y=>t.searchQuery.value=y.target.value,placeholder:s("cron.searchPlaceholder"),"aria-label":s("cron.searchPlaceholder"),class:"pl-10 w-64"})]}),n(N,{icon:n(wr,{class:"w-4 h-4"}),onClick:()=>w("create"),disabled:!P.value,children:[n("span",{class:"hidden sm:inline",children:s("cron.createJob")}),n("span",{class:"sm:hidden",children:s("actions.new")})]}),n(K,{icon:n(Xe,{class:`w-4 h-4 ${t.isLoading.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:l.loadCronJobs,disabled:t.isLoading.value||!P.value,variant:"ghost"})]})}),P.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative sm:hidden",children:[n(lt,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Z,{type:"text",value:t.searchQuery.value,onInput:y=>t.searchQuery.value=y.target.value,placeholder:s("cron.searchPlaceholder"),"aria-label":s("cron.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),P.value&&!t.isLoading.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-4",children:[n(ve,{icon:ge,label:s("common.total"),value:T.total,active:t.statusFilter.value==="all",onClick:()=>t.statusFilter.value="all"}),n(ve,{icon:Eo,label:s("common.enabled"),value:T.enabled,active:t.statusFilter.value==="enabled",onClick:()=>t.statusFilter.value="enabled"}),n(ve,{icon:To,label:s("common.disabled"),value:T.disabled,active:t.statusFilter.value==="disabled",onClick:()=>t.statusFilter.value="disabled"}),n(ve,{icon:Rn,label:s("cron.stats.nextWake"),value:t.cronStatus.value?.nextWakeAtMs?re(t.cronStatus.value.nextWakeAtMs,{relative:!0}):"—"})]}),t.error.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",role:"alert",children:t.error.value}),(t.isLoading.value||!P.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:P.value?void 0:s("status.connecting")})}),P.value&&!t.isLoading.value&&o.filteredJobs.value.length>0&&n(j,{children:[n("div",{class:"md:hidden space-y-2",children:o.filteredJobs.value.map(y=>n(oC,{job:y,onEdit:w.bind(null,"edit")},y.id))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:s("cron.columns.job")}),n("th",{class:"py-3 px-4 font-medium w-40",children:s("common.schedule")}),n("th",{class:"py-3 px-4 font-medium w-24",children:s("cron.columns.target")}),n("th",{class:"py-3 px-4 font-medium w-32",children:s("common.nextRun")}),n("th",{class:"py-3 px-4 font-medium w-24",children:s("cron.columns.status")}),n("th",{class:"py-3 px-4 font-medium w-20"})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:o.filteredJobs.value.map(y=>n(lC,{job:y,onEdit:w.bind(null,"edit"),onRun:l.runJobNow,onToggleEnabled:l.toggleJobEnabled,isRunning:r.isRunning.value},y.id))})]})})]}),P.value&&!t.isLoading.value&&t.cronJobs.value.length===0&&!t.error.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(ge,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:s("cron.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("cron.emptyDescription")}),n(N,{icon:n(wr,{class:"w-4 h-4"}),onClick:()=>w("create"),children:s("cron.createJob")})]})}),P.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&o.filteredJobs.value.length===0&&n(G,{children:n("div",{class:"p-12 text-center",children:[n(lt,{class:"w-10 h-10 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:s("cron.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("common.noResultsHint")}),n(N,{variant:"secondary",size:"sm",onClick:()=>{t.searchQuery.value="",t.statusFilter.value="all"},children:s("common.clearFilters")})]})}),P.value&&!t.isLoading.value&&o.filteredJobs.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:o.filteredJobs.value.length===t.cronJobs.value.length?s("cron.count",{count:t.cronJobs.value.length}):s("cron.filteredCount",{filtered:o.filteredJobs.value.length,total:t.cronJobs.value.length})}),n(hC,{mode:r.modalMode.value,job:r.selectedJob.value,runs:r.selectedJobRuns.value,isLoadingRuns:r.isLoadingRuns.value,isDeleting:r.isDeleting.value,isSaving:r.isSaving.value,isRunning:r.isRunning.value,hasChanges:o.hasFormChanges.value,onClose:k,onSave:l.saveOrCreateJob,onDelete:l.deleteJob,onRun:l.runJobNow,onSetDeleting:y=>r.isDeleting.value=y,editName:a.editName,editDescription:a.editDescription,editEnabled:a.editEnabled,editScheduleKind:a.editScheduleKind,editScheduleExpr:a.editScheduleExpr,editScheduleTz:a.editScheduleTz,editScheduleEveryMs:a.editScheduleEveryMs,editScheduleAtMs:a.editScheduleAtMs,editSessionTarget:a.editSessionTarget,editWakeMode:a.editWakeMode,editDeliveryAnnounce:a.editDeliveryAnnounce,editPayloadText:a.editPayloadText,editPayloadMessage:a.editPayloadMessage,editPayloadModel:a.editPayloadModel,formErrors:a.formErrors})]})}const EC={info:"bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)]",warning:"bg-[var(--color-warning)]/10 text-[var(--color-warning)]",error:"bg-[var(--color-error)]/10 text-[var(--color-error)]",success:"bg-[var(--color-success)]/10 text-[var(--color-success)]"};function Hn({title:e,children:t,items:r,variant:a="info",class:o}){return n("div",{class:`
|
|
410
|
-
p-3 rounded-lg text-xs
|
|
411
|
-
${EC[a]}
|
|
412
|
-
${o||""}
|
|
413
|
-
`,children:[e&&n("p",{class:"font-medium mb-1",children:e}),r?n("ul",{class:"list-disc list-inside space-y-0.5",children:r.map((l,i)=>n("li",{children:l},i))}):t]})}function gx(e){return e.join(".")}function TC(e,t,r){if(t.length===0)return e;const a={...e};let o=a;for(let i=0;i<t.length-1;i++){const c=t[i],d=o[c];d==null||typeof d!="object"?o[c]=typeof t[i+1]=="number"?[]:{}:o[c]=Array.isArray(d)?[...d]:{...d},o=o[c]}const l=t[t.length-1];return r===void 0?delete o[l]:o[l]=r,a}function bx(e,t){if(!e||t.length===0)return e??null;let r=e;for(const a of t){if(!r)return null;typeof a=="number"?r=r.items:r=r.properties?.[a]}return r??null}function AC(e,t){if(t.length===0)return e;let r=e;for(const a of t){if(r==null)return;r=r[a]}return r}function Ts(e){if(!e)return null;if(typeof e.type=="string")return e.type;if(Array.isArray(e.type))return e.type.filter(r=>r!=="null")[0]??null;if(e.const!==void 0)return typeof e.const;if(e.enum&&e.enum.length>0)return typeof e.enum[0];if(e.anyOf||e.oneOf){const r=(e.anyOf??e.oneOf??[]).filter(a=>a.type!=="null"&&!(Array.isArray(a.type)&&a.type.includes("null")));if(r.length===1)return Ts(r[0])}return null}function IC(e){if(e.default!==void 0)return e.default;if(e.const!==void 0)return e.const;switch(Ts(e)){case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";case"array":return[];case"object":return{};default:return}}function RC(e,t){const r=gx(e);if(t[r])return t[r];const a=[r.replace(/\.\d+\./g,".*."),r.replace(/\.\d+\./g,"[]."),r.replace(/\[\d+\]/g,"[*]")];for(const o of a)if(t[o])return t[o]}const MC=new Set(["ui","url","api","id","ip","http","https","ssl","tls","ssh","dns","smtp","imap","json","xml","html","css","jwt","oauth","mfa","2fa","cli","gui","cpu","gpu","ram","ssd","hdd","aws","gcp","ai","ml","llm","pty","tty"]);function da(e){return typeof e=="number"?`#${e+1}`:e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").split(" ").map(t=>{const r=t.toLowerCase();return MC.has(r)?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}).join(" ")}function Ci(e,t){const r=Ts(t);if(e==null)return t.nullable||Array.isArray(t.type)&&t.type.includes("null")||t.default!==void 0,null;switch(r){case"string":if(typeof e!="string")return s("config.validation.mustBeString");if(t.minLength&&e.length<t.minLength)return s("config.validation.minLength",{min:t.minLength});if(t.maxLength&&e.length>t.maxLength)return s("config.validation.maxLength",{max:t.maxLength});if(t.pattern&&!new RegExp(t.pattern).test(e))return s("config.validation.invalidFormat");break;case"number":case"integer":if(typeof e!="number")return s("config.validation.mustBeNumber");if(t.minimum!==void 0&&e<t.minimum)return s("config.validation.minimum",{min:t.minimum});if(t.maximum!==void 0&&e>t.maximum)return s("config.validation.maximum",{max:t.maximum});if(r==="integer"&&!Number.isInteger(e))return s("config.validation.mustBeInteger");break;case"boolean":if(typeof e!="boolean")return s("config.validation.mustBeBoolean");break;case"array":if(!Array.isArray(e))return s("config.validation.mustBeArray");if(t.minItems&&e.length<t.minItems)return s("config.validation.minItems",{min:t.minItems});if(t.maxItems&&e.length>t.maxItems)return s("config.validation.maxItems",{max:t.maxItems});break;case"object":if(typeof e!="object"||Array.isArray(e))return s("config.validation.mustBeObject");break}return t.enum&&!t.enum.includes(e)?s("config.validation.invalidOption"):null}const er=m(!1),wt=m(null),Yl=m(!1),On=m(null),Ea=m({}),Xl=m({}),Vt=m({}),Ei=m(null),xx=m(null),yx=m(!1),$C=m(!0),LC=m(null),Wu=m(""),mo=m({}),Ti=q(()=>JSON.stringify(Xl.value)!==JSON.stringify(Vt.value)),Yd=q(()=>Ti.value&&!Yl.value&&Object.keys(mo.value).length===0);async function uv(){er.value=!0,wt.value=null;try{const[e,t]=await Promise.all([O("config.get",{}),O("config.schema",{})]);On.value=t.schema,Ea.value=t.uiHints,LC.value=t.version,Xl.value=e.config,Vt.value=structuredClone(e.config),Ei.value=e.hash??null,xx.value=e.path??null,yx.value=e.exists,$C.value=e.valid,mo.value={}}catch(e){wt.value=ae(e)}finally{er.value=!1}}function _t(e,t){Vt.value=TC(Vt.value,e,t)}function DC(){Vt.value=structuredClone(Xl.value),mo.value={}}function Ai(e,t){const r={...mo.value};t?r[e]=t:delete r[e],mo.value=r}async function PC(){if(!Yd.value)return!1;if(!Ei.value&&yx.value)return wt.value="Missing base hash. Reload and try again.",!1;Yl.value=!0,wt.value=null;try{const e=wx(Xl.value,Vt.value),t=await O("config.patch",{raw:JSON.stringify(e),baseHash:Ei.value});if(t.ok){Xl.value=t.config,Vt.value=structuredClone(t.config),xx.value=t.path;const r=await O("config.get",{});return Ei.value=r.hash??null,!0}else return wt.value="Failed to save configuration",!1}catch(e){const t=ae(e);return t.includes("hash")||t.includes("changed")?wt.value="Configuration was modified externally. Please reload.":wt.value=t,!1}finally{Yl.value=!1}}function wx(e,t){const r={};for(const a of Object.keys(t)){const o=e[a],l=t[a];JSON.stringify(o)!==JSON.stringify(l)&&(l!==null&&typeof l=="object"&&!Array.isArray(l)&&o!==null&&typeof o=="object"&&!Array.isArray(o)?r[a]=wx(o,l):r[a]=l)}for(const a of Object.keys(e))a in t||(r[a]=null);return r}function OC(e){return e.properties?Object.values(e.properties).some(t=>!Af(t)):!1}function Af(e){return e.type==="array"&&e.items?.properties?!0:e.type==="object"&&e.properties?Object.keys(e.properties).length>=2:!1}function Xd(e,t,r,a=[],o=0){if(!e.properties)return[];const l=[];for(const[i,c]of Object.entries(e.properties)){const d=[...a,i],h=(r[i]??r[d.join(".")]??{}).label??c.title??da(i);if(o>0&&!Af(c))continue;const f={key:i,label:h,path:d,schema:c};if(c.type==="object"&&c.properties){const p=t[i]??{};f.children=Xd(c,p,r,d,o+1),f.children.length===0&&delete f.children}if(c.type==="array"&&c.items?.properties){const p=t[i]??[];f.children=p.map((v,w)=>{const k=v,T=k.identity,y=k.id??k.name??k.label??`#${w+1}`,g=T?.emoji??"";return{key:String(w),label:g?`${g} ${y}`:String(y),path:[...d,w],schema:c.items}})}l.push(f)}return l.sort((i,c)=>{const d=r[i.key]?.order??100,u=r[c.key]?.order??100;return d-u}),l}const If={gateway:tn,agents:ab,channels:rc,tools:yb,commands:Vk,session:sr,cron:ge,skills:Zc,plugins:sf,logging:en,auth:Qp,models:Xp,wizard:Yk,update:Ft,diagnostics:hr,nodeHost:la,audio:Jk,messages:An,bindings:db,ui:Bk,browser:qt,hooks:Xk,web:tn,canvas:Fa,canvasHost:Fa,approvals:Xc,notifications:af,meta:en,env:Zp,nodes:la,broadcast:rc,media:Fa,network:Mu,secrets:Jc,memory:tc,memorySearch:tc,storage:Zp,tls:Qp,remote:Mu,reload:Xe,tailscale:Mu,sandbox:Xp,context:Ld,contextPruning:Ld,compaction:Rn,heartbeat:hr,defaults:uf},kx=Ak;function Sx({item:e,depth:t=0,selectedPath:r,expandedNav:a}){const o=e.path.join("."),l=a.value.has(o),i=r.value.join(".")===o||r.value.join(".").startsWith(o+"."),c=e.children&&e.children.length>0,d=t===0?If[e.key]??kx:void 0,u=()=>{r.value=e.path},h=p=>{p.stopPropagation();const v=new Set(a.value);l?v.delete(o):v.add(o),a.value=v},f=r.value.join(".")===o;return n("div",{children:[n("button",{type:"button",class:`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded-md text-left transition-colors ${f?"bg-[var(--color-accent)] text-white":i?"text-[var(--color-accent)]":"hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]"} ${t>0?"text-[var(--color-text-secondary)]":"font-medium"}`,style:{paddingLeft:`${t*16+8}px`},onClick:u,children:[c?n("button",{type:"button",class:"p-0.5 -ml-1 hover:bg-[var(--color-bg-primary)]/20 rounded",onClick:h,"aria-label":s(l?"accessibility.collapseSection":"accessibility.expandSection"),children:l?n(ze,{class:"w-3.5 h-3.5"}):n(Ye,{class:"w-3.5 h-3.5"})}):n("span",{class:"w-4"}),d&&n(d,{class:"w-4 h-4 flex-shrink-0 opacity-70"}),n("span",{class:"truncate",children:e.label})]}),c&&l&&n("div",{class:"relative ml-2",children:[n("div",{class:"absolute top-0 bottom-1 w-px bg-[var(--color-border)] opacity-50",style:{left:`${(t+1)*16+4}px`}}),e.children.map(p=>n(Sx,{item:p,depth:t+1,selectedPath:r,expandedNav:a},p.key))]})]})}function Un({label:e,description:t,error:r,inline:a,children:o}){return a&&e?n("div",{class:"py-3",children:[n("div",{class:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-8",children:[n("div",{class:"min-w-0 sm:max-w-sm",children:[n("label",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:e}),t&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:t})]}),n("div",{class:"w-full sm:w-auto sm:flex-shrink-0",children:o})]}),r&&n("p",{class:"text-xs text-[var(--color-error)] mt-1",children:r})]}):n("div",{class:"py-3",children:[e&&n("label",{class:"block text-sm font-medium text-[var(--color-text-primary)] mb-1.5",children:e}),t&&n("p",{class:"text-xs text-[var(--color-text-muted)] mb-2 leading-relaxed max-w-lg",children:t}),o,r&&n("p",{class:"text-xs text-[var(--color-error)] mt-1",children:r})]})}function NC({value:e,placeholder:t,onChange:r,wide:a}){const[o,l]=U(!1);return n("div",{class:"relative",children:[n(Z,{type:o?"text":"password",value:e,placeholder:t,onInput:i=>r(i.target.value),class:`pr-10 w-full ${a?"sm:w-72":"sm:w-48"}`}),n("button",{type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",onClick:()=>l(!o),"aria-label":s(o?"config.field.hidePassword":"config.field.showPassword"),children:o?n(sb,{class:"w-4 h-4"}):n(of,{class:"w-4 h-4"})})]})}function _x({value:e,onChange:t}){const[r,a]=U(()=>JSON.stringify(e,null,2)??""),[o,l]=U(null);return n("div",{class:"space-y-1",children:[n(ro,{value:r,onInput:c=>a(c.target.value),onBlur:()=>{try{const c=JSON.parse(r);t(c),l(null)}catch{l(s("config.field.invalidJson"))}},rows:6,class:"font-mono text-sm w-full"}),o&&n("p",{class:"text-xs text-[var(--color-error)]",children:o})]})}function FC({schema:e,value:t,path:r,hints:a,level:o,label:l,help:i,isDetailView:c=!1,skipNavWorthy:d=!1}){const[u,h]=U(o<2||c),f=e.properties??{},p=Object.keys(f).filter(w=>{if(!d)return!0;const k=f[w];return!Af(k)}),v=t??{};return c&&o===0?p.length===0?n("div",{class:"text-sm text-[var(--color-text-muted)] py-4",children:s("config.noSettingsAtLevel")}):n("div",{class:"space-y-2",children:[i&&n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:i}),p.map(w=>n(ja,{schema:f[w],value:v[w],path:[...r,w],hints:a,level:o+1,skipNavWorthy:d},w))]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"md:hidden",children:n("div",{class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("div",{class:"px-4 py-3 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border)]",children:[n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:i})]}),n("div",{class:"px-4 py-2",children:p.map(w=>n(ja,{schema:f[w],value:v[w],path:[...r,w],hints:a,level:o+1,skipNavWorthy:d},w))})]})}),n("div",{class:"hidden md:block",children:[n("button",{type:"button",class:"flex items-center gap-2 py-2 text-left group",onClick:()=>h(!u),"aria-expanded":u,children:[n("span",{class:"text-[var(--color-text-muted)] group-hover:text-[var(--color-text-primary)] transition-colors",children:u?n(ze,{class:"w-4 h-4"}):n(Ye,{class:"w-4 h-4"})}),n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",p.length,")"]})]}),u&&n("div",{class:"ml-6 pl-4 border-l border-[var(--color-border)] mt-1",children:[i&&n("p",{class:"text-xs text-[var(--color-text-muted)] pb-2 leading-relaxed",children:i}),p.map(w=>n(ja,{schema:f[w],value:v[w],path:[...r,w],hints:a,level:o+1,skipNavWorthy:d},w))]})]})]})}function zC({schema:e,value:t,path:r,hints:a,level:o,label:l,help:i}){const[c,d]=U(o<2),u=t??[],h=e.items??{},f=Ts(h),p=()=>{const k=IC(h);_t(r,[...u,k])},v=k=>{const T=u.filter((y,g)=>g!==k);_t(r,T)},w=(k,T)=>{const y=[...u],[g]=y.splice(k,1);y.splice(T,0,g),_t(r,y)};return f==="string"||f==="number"?n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-3",children:[n("div",{children:[n("label",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:i})]}),n(N,{variant:"secondary",size:"sm",icon:wr,onClick:p,fullWidth:!0,class:"sm:w-auto",children:s("config.field.addItem")})]}),n("div",{class:"space-y-2 w-full",children:[u.map((k,T)=>n("div",{class:"flex items-center gap-1 p-2 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[u.length>1&&n("div",{class:"flex flex-col sm:hidden",children:[n("button",{type:"button",class:"p-2 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] disabled:opacity-30",onClick:()=>T>0&&w(T,T-1),disabled:T===0,"aria-label":s("config.field.moveUp"),children:n(xs,{class:"w-4 h-4"})}),n("button",{type:"button",class:"p-2 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] disabled:opacity-30",onClick:()=>T<u.length-1&&w(T,T+1),disabled:T===u.length-1,"aria-label":s("config.field.moveDown"),children:n(ze,{class:"w-4 h-4"})})]}),u.length>1&&n("div",{class:"hidden sm:block p-1 cursor-grab text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",title:s("config.field.dragToReorder"),children:n(ib,{class:"w-4 h-4"})}),n(Z,{type:f==="number"?"number":"text",value:String(k??""),onInput:y=>{const g=y.target.value,b=[...u];b[T]=f==="number"?Number(g):g,_t(r,b)},fullWidth:!0}),n(K,{icon:n(At,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:s("config.field.removeItem"),onClick:()=>v(T),size:"md",variant:"ghost",class:"!p-2.5 sm:!p-1.5 flex-shrink-0"})]},T)),u.length===0&&n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center border border-dashed border-[var(--color-border)] rounded-lg",children:s("common.noItems")})]})]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-3",children:[n("button",{type:"button",class:"flex items-center gap-2 group",onClick:()=>d(!c),"aria-expanded":c,children:[n("span",{class:"text-[var(--color-text-muted)] group-hover:text-[var(--color-text-primary)] transition-colors",children:c?n(ze,{class:"w-4 h-4"}):n(Ye,{class:"w-4 h-4"})}),n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",u.length,")"]})]}),n(N,{variant:"secondary",size:"sm",icon:wr,onClick:p,fullWidth:!0,class:"sm:w-auto",children:s("config.field.addItem")})]}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mb-3 leading-relaxed",children:i}),c&&n("div",{class:"space-y-3",children:u.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center border border-dashed border-[var(--color-border)] rounded-lg",children:s("common.noItems")}):u.map((k,T)=>n(UC,{schema:h,value:k,path:[...r,T],parentPath:r,hints:a,level:o+1,index:T,totalItems:u.length,onRemove:()=>v(T),onReorder:w},T))})]})}function UC({schema:e,value:t,path:r,parentPath:a,hints:o,level:l,index:i,totalItems:c,onRemove:d,onReorder:u}){const[h,f]=U(!1),[p,v]=U(!1),[w,k]=U(!1),T=t??{},y=T.id??T.name??T.label??T.displayName??`#${i+1}`,b=T.identity?.emoji??"",C=I=>{v(!0),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",JSON.stringify({path:a.join("."),index:i}))},x=()=>{v(!1)},_=I=>{I.preventDefault(),I.dataTransfer.dropEffect="move",k(!0)},E=()=>{k(!1)},$=I=>{I.preventDefault(),k(!1);try{const F=JSON.parse(I.dataTransfer.getData("text/plain"));F.path===a.join(".")&&F.index!==i&&u(F.index,i)}catch{}};return n(G,{padding:"none",class:`overflow-hidden transition-all ${p?"opacity-50":""} ${w?"ring-2 ring-[var(--color-accent)]":""}`,draggable:c>1,onDragStart:C,onDragEnd:x,onDragOver:_,onDragLeave:E,onDrop:$,children:[n("div",{class:"flex items-center gap-1 sm:gap-2 px-2 sm:px-3 py-2 sm:py-3 select-none",children:[c>1&&n("div",{class:"flex flex-col sm:hidden",children:[n("button",{type:"button",class:"p-3 -m-1 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] active:bg-[var(--color-bg-hover)] rounded disabled:opacity-30",onClick:()=>i>0&&u(i,i-1),disabled:i===0,"aria-label":s("config.field.moveUp"),children:n(xs,{class:"w-5 h-5"})}),n("button",{type:"button",class:"p-3 -m-1 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] active:bg-[var(--color-bg-hover)] rounded disabled:opacity-30",onClick:()=>i<c-1&&u(i,i+1),disabled:i===c-1,"aria-label":s("config.field.moveDown"),children:n(ze,{class:"w-5 h-5"})})]}),c>1&&n("div",{class:"hidden sm:block p-1 cursor-grab text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] active:cursor-grabbing",title:s("config.field.dragToReorder"),children:n(ib,{class:"w-4 h-4"})}),n("button",{type:"button",class:"flex-1 flex items-center gap-2 text-left group min-h-[44px] sm:min-h-0",onClick:()=>f(!h),"aria-expanded":h,children:[n("span",{class:"text-[var(--color-text-muted)] group-hover:text-[var(--color-text-primary)] transition-colors",children:h?n(ze,{class:"w-4 h-4"}):n(Ye,{class:"w-4 h-4"})}),b&&n("span",{children:b}),n("span",{class:"text-sm font-medium",children:String(y)})]}),n(K,{icon:n(At,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:s("config.field.removeItem"),onClick:d,size:"md",variant:"ghost",class:"!p-2.5 sm:!p-1.5"})]}),h&&n("div",{class:"px-4 pb-4 border-t border-[var(--color-border)]",children:n(ja,{schema:e,value:t,path:r,hints:o,level:l,showLabel:!1,isDetailView:!0})})]})}function jC({schema:e,value:t,path:r,hints:a,level:o,label:l,help:i,showLabel:c}){const u=(e.anyOf??e.oneOf??[]).filter(f=>f.type!=="null"&&!(Array.isArray(f.type)&&f.type.includes("null")));if(u.length===1)return n(ja,{schema:u[0],value:t,path:r,hints:a,level:o,showLabel:c});const h=u.map(f=>f.const??(f.enum?.length===1?f.enum[0]:void 0)).filter(f=>f!==void 0);if(h.length===u.length&&h.length>0){const f=u.map((p,v)=>({value:String(h[v]),label:p.title??da(String(h[v]))}));return n(Un,{label:c!==!1?l:void 0,description:i,inline:c!==!1,children:n(Me,{value:String(t??""),options:f,onChange:p=>_t(r,p),size:"sm",class:"w-full sm:w-auto sm:inline-block"})})}return n(Un,{label:c!==!1?l:void 0,description:i,children:n(_x,{value:t,onChange:f=>_t(r,f)})})}function ja({schema:e,value:t,path:r,hints:a,level:o=0,showLabel:l=!0,isDetailView:i=!1,skipNavWorthy:c=!1}){const d=Ts(e),u=RC(r,a)??{},h=gx(r),f=u.label??e.title??da(r[r.length-1]??""),p=u.help??e.description,v=mo.value[h];if(e.anyOf||e.oneOf)return n(jC,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:p,showLabel:l});switch(d){case"object":return n(FC,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:p,isDetailView:i,skipNavWorthy:c});case"array":return n(zC,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:p});case"boolean":return n(Un,{error:v,children:n(Ue,{checked:!!(t??e.default),onChange:w=>{_t(r,w)},label:l?f:void 0,description:p})});case"number":case"integer":return n(Un,{label:l?f:void 0,description:p,error:v,inline:!0,children:n(Z,{type:"number",value:t==null?"":String(t),placeholder:u.placeholder,onInput:w=>{const k=w.target.value,T=k===""?void 0:Number(k);_t(r,T),Ai(h,Ci(T,e))},min:e.minimum,max:e.maximum,class:"w-full sm:w-24 text-right"})});case"string":return BC({schema:e,value:t,path:r,hint:u,key:h,label:f,help:p,errorMsg:v,showLabel:l});default:return n(Un,{label:l?f:void 0,description:p,error:v,children:n(_x,{value:t,onChange:w=>_t(r,w)})})}}function BC({schema:e,value:t,path:r,hint:a,key:o,label:l,help:i,errorMsg:c,showLabel:d}){if(e.enum)return n(Un,{label:d?l:void 0,description:i,error:c,inline:!0,children:n(Me,{value:String(t??""),options:e.enum.map(p=>({value:String(p),label:da(String(p))})),onChange:p=>_t(r,p),size:"sm",class:"w-full sm:w-auto sm:inline-block"})});if(a.sensitive)return n(Un,{label:d?l:void 0,description:i,error:c,inline:!0,children:n(NC,{value:String(t??""),placeholder:a.placeholder,onChange:p=>{_t(r,p),Ai(o,Ci(p,e))},wide:!0})});if((e.maxLength??0)>200)return n(Un,{label:d?l:void 0,description:i,error:c,children:n(ro,{value:String(t??""),placeholder:a.placeholder,onInput:p=>{const v=p.target.value;_t(r,v),Ai(o,Ci(v,e))},rows:4,class:"w-full"})});const u=e.format==="uri"||e.format==="url",h=o.toLowerCase().includes("path")||o.toLowerCase().includes("dir")||o.toLowerCase().includes("file"),f=u||h?"w-full sm:w-72":"w-full sm:w-48";return n(Un,{label:d?l:void 0,description:i,error:c,inline:!0,children:n(Z,{type:u?"url":"text",value:String(t??""),placeholder:a.placeholder,onInput:p=>{const v=p.target.value;_t(r,v),Ai(o,Ci(v,e))},class:f})})}function dv({selectedPath:e,schema:t,draftConfig:r,uiHints:a,skipNavWorthy:o=!1}){const l=e.value,i=t.value,c=r.value,d=a.value;if(!i||l.length===0)return n("div",{class:"flex-1 flex items-center justify-center text-[var(--color-text-muted)]",children:n("div",{class:"text-center",children:[n(uf,{class:"w-12 h-12 mx-auto mb-4 opacity-50"}),n("p",{children:s("config.selectSection")})]})});const u=bx(i,l),h=AC(c,l);if(!u)return n("div",{class:"flex-1 p-6 text-[var(--color-text-muted)]",children:n("p",{children:s("config.schemaNotFound",{path:l.join(" › ")})})});const f=l.map((b,C)=>{const x=l.slice(0,C+1);return d[x.join(".")]?.label??da(b)}),p=f[f.length-1],v=f.slice(0,-1),w=l.join("."),T=d[w]?.help??u.description,y=String(l[0]),g=If[y];return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"hidden md:block px-4 sm:px-8 pt-4 sm:pt-6 pb-3 sm:pb-4 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:[v.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] mb-1.5",children:v.join(" › ")}),n("div",{class:"flex items-center gap-3",children:[g&&l.length===1&&n(g,{class:"w-6 h-6 text-[var(--color-accent)] opacity-80"}),n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:p})]}),T&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-2 max-w-2xl leading-relaxed",children:T})]}),T&&n("div",{class:"md:hidden px-4 pt-3 pb-2 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:n("p",{class:"text-sm text-[var(--color-text-muted)] leading-relaxed",children:T})}),n("div",{class:"px-4 sm:px-8 py-4 sm:py-6 max-w-4xl",children:n(ja,{schema:u,value:h,path:l,hints:d,level:0,showLabel:!1,isDetailView:!0,skipNavWorthy:o})})]})}function HC({selectedPath:e,uiHints:t,isDirty:r,canSave:a,isSaving:o,onSave:l,onReset:i,onBack:c,showBack:d}){const u=e.value,h=t.value,f=d??u.length>0,p=()=>{if(u.length===0)return s("config.title");const y=u[u.length-1],g=u.join("."),b=h[g];return b?.label?b.label:da(y)},v=()=>u.length<=1?null:u.slice(0,-1).map((g,b)=>{const C=u.slice(0,b+1);return h[C.join(".")]?.label??da(g)}).join(" › "),w=()=>{c?c():u.length>0&&(e.value=u.slice(0,-1))},k=p(),T=v();return n("div",{class:"flex items-center gap-2 px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[f&&n(K,{icon:n(ob,{size:20}),onClick:w,label:s("actions.back"),size:"sm",variant:"ghost",class:"touch-manipulation"}),n("div",{class:"flex-1 min-w-0",children:[T&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:T}),n("h1",{class:"text-lg font-semibold text-[var(--color-text-primary)] truncate",children:k})]}),n("div",{class:"flex items-center gap-1",children:r&&n(j,{children:[n(K,{icon:n(Yc,{size:18}),onClick:i,label:s("config.reset"),size:"sm",variant:"ghost"}),n(K,{icon:n(cf,{size:18}),onClick:l,disabled:!a,label:s(o?"common.saving":"config.save"),size:"sm",variant:"ghost",class:a?"text-[var(--color-accent)]":""})]})})]})}function WC({items:e,selectedPath:t,isTopLevel:r=!1}){const a=o=>{t.value=o.path};return e.length===0?null:n("div",{class:"divide-y divide-[var(--color-border)]",children:e.map(o=>{const l=r?If[o.key]??kx:void 0;return n("button",{type:"button",class:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--color-bg-hover)] active:bg-[var(--color-bg-tertiary)] transition-colors",onClick:()=>a(o),children:[l&&n("div",{class:"w-8 h-8 rounded-lg bg-[var(--color-accent)]/10 flex items-center justify-center flex-shrink-0",children:n(l,{size:18,class:"text-[var(--color-accent)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)] truncate",children:o.label}),n(Ye,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]},o.key)})})}const Cx="cove:config:expandedNav";function Rf(){const t=new URLSearchParams(window.location.search).get("section");return t?t.split(".").map(r=>{const a=Number(r);return Number.isInteger(a)&&a>=0?a:r}):[]}function KC(e){return e.length===0?"":e.join(".")}function qC(){try{const e=localStorage.getItem(Cx);if(e)return new Set(JSON.parse(e))}catch{}return new Set(["gateway","agents","channels"])}const Ce=m(Rf()),mc=m(qC()),Or=m(!1);Ce.subscribe(()=>{Or.value=!1});let Zd=!1;Ce.subscribe(e=>{const t=KC(e),r=new URLSearchParams(window.location.search),a=r.get("section")??"";if(t!==a){Zd=!0,t?r.set("section",t):r.delete("section");const o=r.toString(),l=window.location.pathname+(o?`?${o}`:"")+window.location.hash;history.replaceState(null,"",l),Zd=!1}if(e.length>1){const o=new Set(mc.value);for(let l=1;l<e.length;l++)o.add(e.slice(0,l).join("."));mc.value=o}});typeof window<"u"&&window.addEventListener("popstate",()=>{Zd||(Ce.value=Rf())});mc.subscribe(e=>{try{localStorage.setItem(Cx,JSON.stringify([...e]))}catch{}});function Ex(e,t){if(t.length===0)return null;const[r,...a]=t,o=e.find(l=>l.key===String(r));return o?a.length===0?o:o.children?Ex(o.children,a):null:null}function GC(e,t){if(t.length===0)return{items:e,isTopLevel:!0};const r=Ex(e,t);return r?.children&&r.children.length>0?{items:r.children,isTopLevel:!1}:null}function VC(e){R(()=>{const v=Rf();v.length>0&&(Ce.value=v)},[]),R(()=>{P.value&&!On.value&&uv()},[P.value]),R(()=>{if(!On.value)return;const v=Ce.value,w=window.matchMedia("(max-width: 767px)").matches,T=Xd(On.value,Vt.value,Ea.value)[0]?.path;if(v.length===0){T&&!w&&(Ce.value=T);return}const y=String(v[0]);On.value.properties?.[y]||(w?Ce.value=[]:T&&(Ce.value=T))},[On.value]);const t=async()=>{await PC()?J.success(s("config.saveSuccess")):wt.value&&J.error(wt.value)},r=()=>{DC(),J.success(s("config.reset"))},a=On.value,o=Vt.value,l=Ea.value,i=a?Xd(a,o,l):[],c=Wu.value.toLowerCase().trim(),d=c?i.filter(v=>{const w=v.label.toLowerCase().includes(c),k=v.children?.some(T=>T.label.toLowerCase().includes(c));return w||k}):i,u=GC(i,Ce.value),h=u!==null&&!Or.value,f=bx(a,Ce.value),p=Ce.value.length>0&&u!==null&&u.items.length>0&&f!==null&&OC(f);return n(ru,{viewName:s("config.title"),children:[n("div",{class:"md:hidden flex-1 flex flex-col overflow-hidden",children:[n(HC,{selectedPath:Ce,uiHints:Ea,isDirty:Ti.value,canSave:Yd.value,isSaving:Yl.value,onSave:t,onReset:r,showBack:Ce.value.length>0||Or.value,onBack:()=>{Or.value?Or.value=!1:Ce.value.length>0&&(Ce.value=Ce.value.slice(0,-1))}}),wt.value&&n("div",{class:"px-4 pt-4",children:n(Hn,{variant:"error",children:wt.value})}),er.value&&!a&&n("div",{class:"flex-1 flex items-center justify-center",children:n(te,{size:"lg"})}),!er.value&&a&&n("div",{class:"flex-1 overflow-y-auto bg-[var(--color-bg-surface)]",children:h?n("div",{class:"divide-y divide-[var(--color-border)]",children:[p&&n("button",{type:"button",class:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--color-bg-hover)] active:bg-[var(--color-bg-tertiary)] transition-colors",onClick:()=>{Or.value=!0},children:[u.isTopLevel&&n("div",{class:"w-8 h-8 rounded-lg bg-[var(--color-text-muted)]/10 flex items-center justify-center flex-shrink-0",children:n(uf,{size:18,class:"text-[var(--color-text-muted)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)]",children:s("config.general")}),n(Ye,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]}),n(WC,{items:u.items,selectedPath:Ce,isTopLevel:u.isTopLevel})]}):n(dv,{selectedPath:Ce,schema:On,draftConfig:Vt,uiHints:Ea,skipNavWorthy:Or.value})})]}),n("div",{class:"hidden md:flex md:flex-1 md:overflow-y-auto p-6",children:n("div",{class:"max-w-5xl mx-auto w-full space-y-6",children:[n(jt,{title:s("config.title"),subtitle:s("config.description"),actions:n(j,{children:[Ti.value&&n("span",{class:"text-sm text-[var(--color-warning)]",children:s("config.unsavedChanges")}),n(N,{variant:"secondary",size:"sm",icon:Yc,onClick:r,disabled:!Ti.value,children:s("config.reset")}),n(N,{variant:"primary",size:"sm",icon:cf,onClick:t,disabled:!Yd.value,children:Yl.value?s("common.saving"):s("config.save")}),n(K,{icon:n(Xe,{class:er.value?"animate-spin":""}),onClick:uv,disabled:er.value,label:s("actions.refresh")})]})}),wt.value&&n(Hn,{variant:"error",children:wt.value}),er.value&&!a&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!er.value&&a&&n("div",{class:"flex min-h-[500px] rounded-xl overflow-hidden border border-[var(--color-border)]",children:[n("div",{class:"w-64 flex flex-col bg-[var(--color-bg-tertiary)]",children:[n("div",{class:"p-3",children:n(Z,{type:"text",placeholder:s("config.searchPlaceholder"),value:Wu.value,onInput:v=>{Wu.value=v.target.value},leftElement:n(lt,{class:"w-4 h-4"}),class:"text-sm"})}),n("div",{class:"flex-1 overflow-y-auto p-2",children:d.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] p-2",children:s(c?"config.noResults":"config.noFields")}):d.map(v=>n(Sx,{item:v,selectedPath:Ce,expandedNav:mc},v.key))})]}),n("div",{class:"flex-1 bg-[var(--color-bg-surface)]",children:n(dv,{selectedPath:Ce,schema:On,draftConfig:Vt,uiHints:Ea})})]})]})})]})}function ni({theme:e,isSelected:t,onClick:r,size:a="md"}){const o=e.colors["--color-bg-primary"],l=e.colors["--color-accent"],i=a==="sm"?"w-10 h-10":"w-12 h-12",c=a==="sm"?"w-3 h-3":"w-4 h-4",d=a==="sm"?"w-4 h-4":"w-5 h-5";return n(Ao,{content:e.name,placement:"top",delay:200,children:n("button",{type:"button",onClick:r,class:`
|
|
414
|
-
relative ${i} rounded-xl border-2 transition-all
|
|
415
|
-
hover:scale-105
|
|
416
|
-
focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-2
|
|
417
|
-
${t?"border-[var(--color-accent)] ring-2 ring-[var(--color-accent)]":"border-[var(--color-border)] hover:border-[var(--color-text-muted)]"}
|
|
418
|
-
`,style:{backgroundColor:o},"aria-label":e.name,"aria-pressed":t,children:[n("span",{class:`absolute bottom-1.5 right-1.5 ${c} rounded-full border border-white/30`,style:{backgroundColor:l}}),t&&n("span",{class:"absolute inset-0 flex items-center justify-center",children:n(nn,{class:`${d} text-[var(--color-accent)]`,strokeWidth:3})})]})})}function ri({icon:e,titleKey:t,selectedThemeName:r}){return n("div",{class:"flex items-center gap-2 mb-3",children:[n("span",{class:"text-[var(--color-text-muted)]",children:e}),n("span",{class:"text-sm font-medium text-[var(--color-text-secondary)]",children:s(t)}),r&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:["— ",r]})]})}function JC(){const e=bd(),t=ft.value,r=t.selected==="system",a=e.filter(h=>h.appearance==="light"),o=e.filter(h=>h.appearance==="dark"),l=t.lightTheme,i=t.darkTheme,c=t.selected!=="system"?t.selected:null,d=h=>{if(h)ul("system");else{const f=window.matchMedia("(prefers-color-scheme: dark)").matches;ul(f?i:l)}},u=(h,f)=>{r?f==="light"?v1(h):g1(h):ul(h)};return n("div",{class:"space-y-6",children:[n("div",{class:"flex items-center justify-between p-4 rounded-xl bg-[var(--color-bg-secondary)]",children:[n("div",{class:"flex items-center gap-3",children:[n(qt,{class:"w-5 h-5 text-[var(--color-text-muted)]"}),n("div",{children:[n("p",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:s("settings.appearance.useSystemTheme")}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:s("settings.appearance.useSystemThemeDescription")})]})]}),n(Ue,{checked:r,onChange:d,size:"sm"})]}),r?n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:[n("div",{children:[n(ri,{icon:n(nm,{class:"w-4 h-4"}),titleKey:"settings.appearance.lightTheme",selectedThemeName:a.find(h=>h.id===l)?.name}),n("div",{class:"flex flex-wrap gap-2",children:a.map(h=>n(ni,{theme:h,isSelected:l===h.id,onClick:()=>u(h.id,"light")},h.id))})]}),n("div",{children:[n(ri,{icon:n(em,{class:"w-4 h-4"}),titleKey:"settings.appearance.darkTheme",selectedThemeName:o.find(h=>h.id===i)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(ni,{theme:h,isSelected:i===h.id,onClick:()=>u(h.id,"dark")},h.id))})]})]}):n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:[n("div",{children:[n(ri,{icon:n(nm,{class:"w-4 h-4"}),titleKey:"common.light",selectedThemeName:a.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:a.map(h=>n(ni,{theme:h,isSelected:c===h.id,onClick:()=>u(h.id,"light")},h.id))})]}),n("div",{children:[n(ri,{icon:n(em,{class:"w-4 h-4"}),titleKey:"common.dark",selectedThemeName:o.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(ni,{theme:h,isSelected:c===h.id,onClick:()=>u(h.id,"dark")},h.id))})]})]})]})}function YC(){A0()}function XC(e=!0){G2(),n2(),Za(),e&&YC(),Le("/")}const Tx="cove:device-identity",Qd="cove:device-display-name",vo=m(typeof localStorage<"u"?localStorage.getItem(Qd):null);function ZC(e){e?.trim()?(localStorage.setItem(Qd,e.trim()),vo.value=e.trim()):(localStorage.removeItem(Qd),vo.value=null)}function Ax(e){const t=new Uint8Array(e);let r="";for(let a=0;a<t.length;a++)r+=String.fromCharCode(t[a]);return btoa(r).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}async function Ix(e){const t=await crypto.subtle.exportKey("raw",e),r=await crypto.subtle.digest("SHA-256",t),a=new Uint8Array(r);return Array.from(a).map(o=>o.toString(16).padStart(2,"0")).join("")}async function QC(){const e=await crypto.subtle.generateKey("Ed25519",!0,["sign","verify"]),t=await crypto.subtle.exportKey("raw",e.publicKey),r=Ax(t);return{deviceId:await Ix(e.publicKey),publicKeyBase64Url:r,privateKey:e.privateKey,publicKey:e.publicKey}}async function eE(e){const t=await crypto.subtle.exportKey("jwk",e.privateKey),r=await crypto.subtle.exportKey("jwk",e.publicKey),a={version:1,deviceId:e.deviceId,publicKeyBase64Url:e.publicKeyBase64Url,privateKeyJwk:t,publicKeyJwk:r,createdAtMs:Date.now()};localStorage.setItem(Tx,JSON.stringify(a)),A.node.debug("Stored device identity:",e.deviceId.slice(0,16)+"...")}async function tE(){try{const e=localStorage.getItem(Tx);if(!e)return null;const t=JSON.parse(e);if(t?.version!==1)return null;const r=await crypto.subtle.importKey("jwk",t.privateKeyJwk,"Ed25519",!0,["sign"]),a=await crypto.subtle.importKey("jwk",t.publicKeyJwk,"Ed25519",!0,["verify"]);return await Ix(a)!==t.deviceId?(A.node.warn("Device ID mismatch, regenerating identity"),null):(A.node.debug("Loaded device identity:",t.deviceId.slice(0,16)+"..."),{deviceId:t.deviceId,publicKeyBase64Url:t.publicKeyBase64Url,privateKey:r,publicKey:a})}catch(e){return A.node.warn("Failed to load device identity:",e),null}}let Vn=null;async function lu(){return Vn||(Vn=await tE(),Vn)||(A.node.debug("Generating new device identity"),Vn=await QC(),await eE(Vn)),Vn}function nE(e){const t=e.nonce?"v2":"v1",r=e.scopes.join(","),a=e.token??"",o=[t,e.deviceId,e.clientId,e.clientMode,e.role,r,String(e.signedAtMs),a];return t==="v2"&&o.push(e.nonce??""),o.join("|")}async function rE(e,t){const a=new TextEncoder().encode(t),o=await crypto.subtle.sign("Ed25519",e.privateKey,a);return Ax(o)}async function aE(e){const t=await lu(),r=Date.now(),a=e.scopes??[],o=nE({deviceId:t.deviceId,clientId:e.clientId,clientMode:e.clientMode,role:e.role,scopes:a,signedAtMs:r,token:e.token,nonce:e.nonce}),l=await rE(t,o);return{id:t.deviceId,publicKey:t.publicKeyBase64Url,signature:l,signedAt:r,...e.nonce?{nonce:e.nonce}:{}}}async function oE(){return vo.value?vo.value:`Cove Canvas (${(await lu()).deviceId.slice(0,8)})`}function lE(e){return e?e.startsWith("image/"):!1}function hv(e){if(!e)return!1;const t=e.toLowerCase();return/\.(png|jpg|jpeg|gif|webp|svg|ico|bmp)(\?|$)/.test(t)}function Mf(e,t){let r=e,a=t;if(e.startsWith("data:")){const c=e.match(/^data:([^;]+);base64,(.+)$/);c&&(a=c[1],r=c[2])}let o;try{o=atob(r)}catch{throw new Error("Invalid base64 data")}const l=new Uint8Array(o.length);for(let c=0;c<o.length;c++)l[c]=o.charCodeAt(c);const i=new Blob([l],{type:a});return URL.createObjectURL(i)}const ba=m(!1),go=m("unpaired"),vc=m(null),Ta=m(!1),Yr=m(null),sE=m(null),Xr=m(null),su=m(null),eh=m(!1),Ii=m(null),Ri=m(null),Rx=typeof BroadcastChannel<"u"?new BroadcastChannel("cove:canvas"):null;let gc=null,th=null;function nh(){Rx?.postMessage({type:"canvas-content",url:Yr.value,base64:gc,mimeType:th})}Rx?.addEventListener("message",e=>{if(e.data.type==="canvas-content"){if(e.data.url)Yr.value=e.data.url,Xr.value=null;else if(e.data.base64)try{const t=Mf(e.data.base64,e.data.mimeType||"image/png");Xr.value=t,su.value=e.data.mimeType,Yr.value=null}catch{}}if(e.data.type==="canvas-standalone-status"){const t=eh.value;eh.value=e.data.open,A.node.debug(`Standalone canvas status: ${e.data.open?"open":"closed"}`),e.data.open?(Yr.value||gc)&&nh():t&&(A.node.debug("Standalone closed, re-registering node"),As())}});function iE(){Xr.value&&(URL.revokeObjectURL(Xr.value),Xr.value=null),su.value=null}function cE(e){const t=/^https?:\/\/(127\.0\.0\.1|localhost)(:\d+)?(\/__openclaw__\/canvas)(\/.*)?/i,r=e.match(t);if(!r)return e;const o=`/_canvas${r[4]||"/"}`;return A.node.debug("Transformed canvas URL to proxy:",e,"->",o),o}function fv(e){const t=e.url,r=e.imageBase64,a=e.imageMimeType||"image/png";if(iE(),r)try{const o=Mf(r,a);return Xr.value=o,su.value=a,Yr.value=null,gc=r,th=a,nh(),{type:"base64",detail:a}}catch(o){return A.node.error("Failed to create blob from base64:",o),null}if(t){const o=cE(t);return Yr.value=o,gc=null,th=null,nh(),{type:"url",detail:o}}return null}let Ee=null,Ba=null,fr=null,rh,nl;const uE=15e3,pv=1e4,Zr=new Map;let Mx=0;const dE=3e4;function $x(e,t){return new Promise((r,a)=>{if(!Ee||Ee.readyState!==WebSocket.OPEN){a(new Error("Not connected"));return}const o=String(++Mx),l=setTimeout(()=>{const i=Zr.get(o);i&&(Zr.delete(o),i.reject(new Error("Request timeout")))},dE);Zr.set(o,{resolve:r,reject:a,timeout:l}),Ee.send(JSON.stringify({type:"req",id:o,method:e,params:t}))})}function hE(e){try{const t=JSON.parse(e);if(t.type==="res"&&t.id!=null){const r=Zr.get(String(t.id));r&&(Zr.delete(t.id),clearTimeout(r.timeout),t.ok?r.resolve(t.payload):r.reject(new Error(t.error?.message??"Request failed")));return}if(t.type==="evt"||t.type==="event"){if(t.event==="node.invoke.request"){vE(t.payload);return}fE(t.event,t.payload);return}}catch(t){A.node.error("Failed to parse message:",t)}}function fE(e,t){if(A.node.debug("Event:",e,t),e==="connect.challenge"){const r=t,a=typeof r.nonce=="string"?r.nonce:void 0;A.node.debug("Received connect.challenge with nonce:",a?.slice(0,8)+"..."),pE(a);return}e==="node.pair.resolved"&&(t.status==="approved"?(go.value="paired",A.node.debug("Pairing approved! Reconnecting..."),As()):(go.value="unpaired",A.node.debug("Pairing rejected")))}async function pE(e){try{const t=await lu(),r=await oE();vc.value=t.deviceId;const a=await aE({clientId:"node-host",clientMode:"node",role:"node",scopes:[],token:nl??null,nonce:e}),o={minProtocol:3,maxProtocol:3,role:"node",client:{id:"node-host",displayName:r,mode:"node",version:"1.0.0",platform:navigator.platform?.toLowerCase().includes("mac")?"macos":"web"},device:a,caps:["canvas"],commands:["canvas.present","canvas.hide","canvas.navigate","canvas.eval","canvas.snapshot"]};nl&&(rh==="token"?o.auth={token:nl}:rh==="password"&&(o.auth={password:nl})),A.node.debug("Sending connect request with device:",a.id.slice(0,16)+"...");const l=await $x("connect",o);A.node.debug("Connect result:",l),ba.value=!0,go.value="paired",A.node.info("Node connected as device:",t.deviceId.slice(0,16)+"..."),mE()}catch(t){A.node.error("Connect failed:",t)}}function mE(){fr||(fr=setInterval(async()=>{if(Ee&&Ee.readyState===WebSocket.OPEN)try{await $x("ping",{}),A.node.debug("Keepalive ping successful")}catch{A.node.debug("Keepalive ping failed, reconnecting"),As()}},uE))}async function vE(e){const t=e;let r={};if(t.params&&typeof t.params=="object")r=t.params;else if(t.paramsJSON)try{r=JSON.parse(t.paramsJSON)}catch{A.node.error("Failed to parse paramsJSON:",t.paramsJSON)}A.node.debug("Invoke request:",t.command,"params keys:",Object.keys(r));let a={ok:!0},o;try{switch(t.command){case"canvas.present":{const l=fv(r);Ta.value=!1,Ta.value=!0,l&&A.node.debug(`Canvas presented: ${l.type==="base64"?`(${l.detail})`:l.detail}`);break}case"canvas.hide":{Ta.value=!1,A.node.debug("Canvas hidden");break}case"canvas.navigate":{const l=fv(r);Ta.value=!1,Ta.value=!0,l&&A.node.debug(`Canvas navigated: ${l.type==="base64"?`(${l.detail})`:l.detail}`);break}case"canvas.eval":{const l=r.javaScript;if(A.node.debug("canvas.eval requested:",l?.slice(0,50)),!l){o={code:"INVALID_PARAMS",message:"javaScript parameter required"};break}try{a={result:await new Promise((c,d)=>{Ii.value={js:l,resolve:c,reject:u=>d(new Error(u))},setTimeout(()=>{Ii.value?.js===l&&(Ii.value=null,d(new Error("Canvas eval timeout")))},pv)})}}catch(i){o={code:"EVAL_ERROR",message:String(i)}}break}case"canvas.snapshot":{const l=r.maxWidth||800,i=r.quality||.8,d=(r.outputFormat||"jpeg")==="png"?"png":"jpeg";A.node.debug("canvas.snapshot requested:",{maxWidth:l,quality:i,outputFormat:d});try{a={dataUrl:await new Promise((h,f)=>{Ri.value={maxWidth:l,quality:i,outputFormat:d,resolve:h,reject:p=>f(new Error(p))},setTimeout(()=>{Ri.value&&(Ri.value=null,f(new Error("Canvas snapshot timeout")))},pv)})}}catch(u){o={code:"SNAPSHOT_ERROR",message:String(u)}}break}default:o={code:"UNKNOWN_COMMAND",message:`Unknown command: ${t.command}`}}}catch(l){o={code:"ERROR",message:String(l)}}if(Ee&&Ee.readyState===WebSocket.OPEN){const l={type:"req",id:String(++Mx),method:"node.invoke.result",params:{id:t.id,nodeId:vc.value,ok:!o,payload:o?void 0:a,error:o??void 0}};A.node.debug("Sending invoke result for node:",vc.value?.slice(0,8)),Ee.send(JSON.stringify(l))}}async function $f(){const e=pt.value,t=Nc(),r=Dh();if(A.node.debug("connectNode called"),!e){A.node.debug("No gateway URL, skipping node connection");return}rh=t?.authMode,nl=r??void 0;const a=e.replace(/^http/,"ws");A.node.debug("Connecting to gateway as node"),Ee=new WebSocket(a),Ee.onopen=()=>{A.node.debug("WebSocket connected, waiting for connect.challenge")},Ee.onmessage=o=>{hE(String(o.data))},Ee.onclose=o=>{A.node.debug("WebSocket closed:",o.code,o.reason),ba.value=!1,Ee=null,fr&&(clearInterval(fr),fr=null),Ba||(Ba=setTimeout(()=>{Ba=null,$f()},5e3))},Ee.onerror=()=>{A.node.error("WebSocket error")}}function Lf(){A.node.debug("startNodeConnection called"),pt.value?$f():A.node.debug("No gateway URL, skipping node connection")}function As(){A.node.debug("refreshNodeRegistration called - doing full reconnect"),Ee&&(Ee.close(),Ee=null),ba.value=!1,setTimeout(()=>{$f()},500)}function Df(){Ba&&(clearTimeout(Ba),Ba=null),fr&&(clearInterval(fr),fr=null);for(const[e,t]of Zr)clearTimeout(t.timeout),t.reject(new Error("Connection closed")),Zr.delete(e);Ee&&(Ee.close(),Ee=null),ba.value=!1}const Lx=Object.freeze(Object.defineProperty({__proto__:null,canvasBlobUrl:Xr,canvasContent:sE,canvasContentType:su,canvasUrl:Yr,canvasVisible:Ta,nodeConnected:ba,nodeId:vc,nodePairingStatus:go,pendingCanvasEval:Ii,pendingCanvasSnapshot:Ri,refreshNodeRegistration:As,standaloneCanvasOpen:eh,startNodeConnection:Lf,stopNodeConnection:Df},Symbol.toStringTag,{value:"Module"}));function Ku({titleKey:e,children:t}){return n(G,{children:[n("div",{class:"p-3 sm:p-4 border-b border-[var(--color-border)]",children:n("h2",{class:"text-base sm:text-lg font-semibold text-[var(--color-text-primary)]",children:s(e)})}),n("div",{class:"p-3 sm:p-4",children:t})]})}function tr({labelKey:e,descriptionKey:t,disabled:r,children:a}){return n("div",{class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4 ${r?"opacity-50":""}`,children:[n("div",{class:"flex-1 min-w-0",children:[n("label",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:s(e)}),n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:s(t)})]}),n("div",{class:"flex-shrink-0",children:a})]})}function qu({label:e,value:t,truncate:r}){return n("div",{class:"flex flex-col sm:flex-row sm:justify-between text-sm gap-0.5 sm:gap-2",children:[n("span",{class:"text-[var(--color-text-muted)]",children:e}),n("span",{class:`text-[var(--color-text-primary)] ${r?"truncate max-w-full sm:max-w-[200px]":""}`,children:t})]})}function gE(){const[e,t]=U(""),[r,a]=U(""),[o,l]=U(!1);R(()=>{lu().then(u=>{const h=`Cove Canvas (${u.deviceId.slice(0,8)})`;t(h),a(vo.value??h)})},[]);const i=u=>{Je.value=u,u?Lf():Df()},c=u=>{a(u),l(!0)},d=()=>{if(!o)return;const u=vo.value;let h;!r.trim()||r.trim()===e?(h=null,a(e)):h=r.trim(),ZC(h),l(!1),h!==u&&ba.value&&As()};return n(j,{children:[n(tr,{labelKey:"common.enableCanvas",descriptionKey:"settings.device.enabledDescription",children:n(Ue,{checked:Je.value,onChange:i})}),Je.value&&n(tr,{labelKey:"settings.device.name",descriptionKey:"settings.device.nameDescription",children:n(Z,{value:r,onChange:u=>c(u.target.value),onBlur:d,class:"w-[200px]"})})]})}function bE(e){return n(rn,{viewName:s("nav.settings"),children:[n(jt,{title:s("nav.settings"),subtitle:s("settings.description")}),n(Ku,{titleKey:"settings.appearance.title",children:n("div",{class:"space-y-6",children:[n(JC,{}),n(tr,{labelKey:"settings.appearance.fontSize",descriptionKey:"settings.appearance.fontSizeDescription",children:n(Me,{value:Ja.value,onChange:t=>{Ja.value=t},options:Ig.map(t=>({value:t.value,label:s(t.labelKey)})),size:"sm",width:"180px"})}),n(tr,{labelKey:"settings.appearance.fontFamily",descriptionKey:"settings.appearance.fontFamilyDescription",children:n(Me,{value:Ya.value,onChange:t=>{Ya.value=t},options:Rg.map(t=>({value:t.value,label:s(t.labelKey)})),size:"sm",width:"180px"})})]})}),n(Ku,{titleKey:"settings.appMode.title",children:n("div",{class:"space-y-6",children:[n(tr,{labelKey:"settings.preferences.timeFormat",descriptionKey:"settings.preferences.timeFormatDescription",children:n(Me,{value:aa.value,onChange:t=>{aa.value=t},options:Mg.map(t=>({value:t.value,label:s(t.labelKey)})),size:"sm",width:"180px"})}),n(tr,{labelKey:"settings.appMode.multiChat",descriptionKey:"settings.appMode.multiChatDescription",children:n(Ue,{checked:Tn.value==="multi",onChange:t=>{Tn.value=t?"multi":"single"}})}),ps.value&&n(j,{children:[n(tr,{labelKey:"settings.newChat.useDefaults",descriptionKey:"settings.newChat.useDefaultsDescription",children:n(Ue,{checked:nt.value.useDefaults,onChange:t=>{nt.value={...nt.value,useDefaults:t}}})}),n(tr,{labelKey:"common.defaultAgent",descriptionKey:"settings.newChat.defaultAgentDescription",children:n(Me,{value:nt.value.defaultAgentId,onChange:t=>{nt.value={...nt.value,defaultAgentId:t}},options:$d.value,size:"sm",width:"180px"})})]}),n(gE,{})]})}),n(Ku,{titleKey:"settings.about.title",children:n("div",{class:"space-y-4",children:[n("div",{class:"space-y-3",children:[n(qu,{label:s("common.cove"),value:`v${Rw}`}),Ot.value&&n(qu,{label:s("common.gateway"),value:Ng(Ot.value)}),pt.value&&n(qu,{label:s("common.gatewayUrl"),value:pt.value,truncate:!0})]}),n("div",{class:"border-t border-[var(--color-border)] pt-4 flex flex-wrap justify-end gap-2",children:[n(N,{variant:"secondary",onClick:()=>$g(),children:s("settings.data.resetDefaults")}),P.value&&n(N,{variant:"secondary",onClick:()=>XC(),children:s("common.logout")})]})]})})]})}const Mi=m(null);let xE=0;function yE(){return`json-block-${++xE}`}async function wE(e,t){try{await navigator.clipboard.writeText(e),Mi.value=t,setTimeout(()=>{Mi.value===t&&(Mi.value=null)},2e3)}catch{}}function kE(e){try{const t=Xt.highlight(e,Xt.languages.json,"json");return cc(t)}catch{return cc(e)}}function iu({value:e,maxHeight:t="max-h-48",id:r}){const a=r??yE(),o=Mi.value===a,l=kE(e);return n("div",{class:"relative group",children:[n("pre",{class:`text-xs font-mono bg-[var(--color-bg-tertiary)] p-3 rounded-lg overflow-x-auto ${t}`,dangerouslySetInnerHTML:{__html:l}}),n(K,{icon:o?n(nn,{size:14}):n(ys,{size:14}),size:"sm",variant:"ghost",label:s("actions.copy"),class:"absolute top-2 right-2 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100 transition-opacity",onClick:()=>wE(e,a)})]})}const ah=m(null),oh=m(null),lh=m(!1),qo=m(!1);function ai(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function SE(e){return e==null?"—":`${Math.round(e)}%`}function _E(e){return e==null?"—":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}async function mv(){if(P.value){lh.value=!0;try{const[e,t]=await Promise.all([O("status").catch(()=>null),O("health").catch(()=>null)]);ah.value=e,oh.value=t}catch{}finally{lh.value=!1}}}function oi({label:e,value:t,sub:r}){return n("div",{class:"text-center",role:"group","aria-label":e,children:[n("div",{class:"text-lg font-semibold text-[var(--color-text-primary)]",children:t}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:e}),r&&n("div",{class:"text-xs text-[var(--color-text-muted)] opacity-70",children:r})]})}function CE({name:e,label:t,data:r}){const a=r.linked?"success":r.configured?"warning":"default",o=r.linked?s("debug.linked"):r.configured?s("common.configured"):s("common.off");return n("div",{class:"flex items-center justify-between py-1.5",children:[n("span",{class:"text-sm",children:t||e}),n(X,{variant:a,size:"sm",children:o})]})}function EE(){const e=P.value,t=ah.value,r=oh.value,a=t?.sessions?.recent?.[0];return R(()=>{e&&!ah.value&&!oh.value&&mv()},[e]),n(G,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(Rk,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:s("debug.snapshots")})]}),n(N,{variant:"ghost",size:"sm",onClick:mv,disabled:!e,loading:lh.value,icon:n(Xe,{size:14}),children:s("actions.refresh")})]}),!t&&!r?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-6",children:s("debug.noData")}):n("div",{class:"space-y-5",children:[a&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(hr,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:s("debug.recentSession")}),a.model&&n(X,{variant:"default",size:"sm",children:a.model})]}),n("div",{class:"grid grid-cols-2 sm:grid-cols-4 gap-2 p-3 bg-[var(--color-bg-tertiary)] rounded-lg",children:[n(oi,{label:s("common.input"),value:ai(a.inputTokens)}),n(oi,{label:s("common.output"),value:ai(a.outputTokens)}),n(oi,{label:s("common.total"),value:ai(a.totalTokens)}),n(oi,{label:s("debug.used"),value:SE(a.percentUsed),sub:`of ${ai(a.contextTokens)}`})]})]}),r&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(ub,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:s("debug.health")}),n(X,{variant:r.ok?"success":"error",size:"sm",children:r.ok?s("common.healthy"):s("debug.unhealthy")}),r.durationMs!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",_E(r.durationMs),")"]})]}),r.channels&&Object.keys(r.channels).length>0&&n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg divide-y divide-[var(--color-border)]",children:(r.channelOrder??Object.keys(r.channels)).map(o=>{const l=r.channels?.[o];return l?n(CE,{name:o,label:r.channelLabels?.[o],data:l},o):null})})]}),t?.heartbeat?.agents&&t.heartbeat.agents.length>0&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(Rn,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:s("debug.heartbeatAgents")})]}),n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg space-y-2",children:t.heartbeat.agents.map(o=>n("div",{class:"flex items-center justify-between",children:[n("span",{class:"text-sm font-mono",children:o.agentId}),n("div",{class:"flex items-center gap-2",children:[o.every&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:o.every}),n(X,{variant:o.enabled?"success":"default",size:"sm",children:o.enabled?s("debug.on"):s("common.off")})]})]},o.agentId))})]}),n("button",{type:"button",onClick:()=>{qo.value=!qo.value},"aria-expanded":qo.value,class:"flex items-center gap-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[qo.value?n(ze,{size:12}):n(Ye,{size:12}),s("debug.showRawJson")]}),qo.value&&n(iu,{value:JSON.stringify({status:t,health:r},null,2),id:"snapshots-raw-json"})]})]})}const $i=m("system-presence"),Zl=m("{}"),qr=m(null),sh=m(!1),bc=m(null),Qr=m(!0),In=m([]);let Dx=0;const Px=q(()=>{const e={};for(const t of In.value)t.key.trim()&&(e[t.key.trim()]=t.value);return e});function TE(){if(Qr.value){const t=Px.value;return Object.keys(t).length>0?t:void 0}const e=Zl.value.trim();if(!(!e||e==="{}"))return JSON.parse(e)}function AE(){In.value=[...In.value,{id:`field_${++Dx}`,key:"",value:""}]}function IE(e){In.value=In.value.filter(t=>t.id!==e)}function vv(e,t){In.value=In.value.map(r=>r.id===e?{...r,...t}:r)}function RE(){const e=Px.value;Zl.value=Object.keys(e).length>0?JSON.stringify(e,null,2):"{}"}function ME(){try{const e=JSON.parse(Zl.value||"{}");typeof e=="object"&&e!==null&&!Array.isArray(e)&&(In.value=Object.entries(e).map(([t,r])=>({id:`field_${++Dx}`,key:t,value:typeof r=="string"?r:JSON.stringify(r)})))}catch{}}function $E(){Qr.value?RE():ME(),Qr.value=!Qr.value}async function LE(){if(P.value){sh.value=!0,bc.value=null,qr.value=null;try{const e=TE(),t=await O($i.value,e);qr.value={ok:!0,data:t}}catch(e){bc.value=e instanceof Error?e.message:"RPC call failed",qr.value={ok:!1,data:null}}finally{sh.value=!1}}}function DE(){const e=P.value;return n(G,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(vb,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:s("debug.manualRpc")})]}),n(N,{variant:"ghost",size:"sm",onClick:$E,icon:Qr.value?n(Ik,{size:14}):n(Wk,{size:14}),children:Qr.value?s("debug.jsonMode"):s("debug.formMode")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:s("debug.manualRpcDesc")}),n("div",{class:"space-y-4",children:[n("div",{children:[n("label",{htmlFor:"rpc-method",class:"block text-sm font-medium mb-1",children:s("debug.method")}),n(Z,{id:"rpc-method",value:$i.value,onInput:t=>{$i.value=t.target.value},placeholder:"e.g., system-presence, status, health",class:"font-mono",fullWidth:!0})]}),Qr.value?n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:s("debug.params")}),n(N,{variant:"ghost",size:"sm",onClick:AE,icon:n(wr,{size:14}),children:s("debug.addParam")})]}),In.value.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] py-3 text-center",children:s("debug.noParams")}):n("div",{class:"space-y-2",children:In.value.map(t=>n("div",{class:"flex items-center gap-2",children:[n(Z,{value:t.key,onInput:r=>vv(t.id,{key:r.target.value}),placeholder:"key",class:"font-mono flex-1"}),n(Z,{value:t.value,onInput:r=>vv(t.id,{value:r.target.value}),placeholder:"value",class:"font-mono flex-1"}),n(K,{icon:n(At,{size:14}),size:"sm",variant:"ghost",label:s("actions.delete"),onClick:()=>IE(t.id)})]},t.id))})]}):n("div",{children:[n("label",{htmlFor:"rpc-params",class:"block text-sm font-medium mb-1",children:s("debug.paramsJson")}),n(ro,{id:"rpc-params",value:Zl.value,onInput:t=>{Zl.value=t.target.value},placeholder:"{}",rows:4,class:"font-mono text-sm",fullWidth:!0})]}),n(N,{variant:"secondary",onClick:LE,disabled:!e||!$i.value.trim(),loading:sh.value,icon:n(lf,{size:14}),children:s("debug.call")}),bc.value&&n("div",{class:"text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 p-3 rounded-lg",children:bc.value}),qr.value&&n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:s("common.result")}),n(X,{variant:qr.value.ok?"success":"error",children:qr.value.ok?s("debug.ok"):s("common.error")})]}),n(iu,{value:Bh(qr.value.data),maxHeight:"max-h-64",id:"rpc-result"})]})]})]})}const vn=m([]),PE=m(100),Li=m(!1);let OE=0;const Di=m(null),nr=m(new Set),hn=m(null),Ox=m(0),NE=q(()=>{Ox.value;const e=Nh.value;if(e==null)return"—";const t=Math.floor(e/1e3),r=Math.floor(t/60),a=Math.floor(r/60),o=Math.floor(a/24);return o>0?`${o}d ${a%24}h ${r%60}m`:a>0?`${a}h ${r%60}m`:r>0?`${r}m ${t%60}s`:`${t}s`}),FE=q(()=>{switch(Pe.value){case"connected":return"success";case"connecting":case"authenticating":case"reconnecting":return"warning";default:return"error"}});function zE(e,t){if(Li.value)return;const r={id:++OE,timestamp:Date.now(),event:e,payload:t};vn.value=[r,...vn.value].slice(0,PE.value)}function UE(){vn.value=[]}function jE(e){const t=new Set(nr.value);t.has(e)?t.delete(e):(t.add(e),kr()),nr.value=t}async function BE(e,t){try{await navigator.clipboard.writeText(e),Di.value=t,setTimeout(()=>{Di.value===t&&(Di.value=null)},2e3)}catch{}}function qe({icon:e,label:t,value:r,copyable:a,mono:o}){const l=r??"—",i=`${t}-${l}`,c=Di.value===i;return n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between py-2 gap-1 sm:gap-2 border-b border-[var(--color-border)] last:border-0",children:[n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n(e,{size:16,class:"flex-shrink-0"}),n("span",{class:"text-sm",children:t})]}),n("div",{class:"flex items-center gap-2 pl-6 sm:pl-0",children:[n("span",{class:`${o?"font-mono text-sm":""} break-all`,children:l}),a&&r&&n(K,{icon:c?n(nn,{size:14}):n(ys,{size:14}),size:"sm",variant:"ghost",label:s("actions.copy"),onClick:()=>BE(r,i),class:"flex-shrink-0"})]})]})}function HE({entry:e}){const t=e.payload!=null&&Object.keys(e.payload).length>0;return n("button",{type:"button",class:"w-full flex items-center justify-between gap-3 p-3 text-left bg-[var(--color-bg-secondary)] rounded-lg hover:bg-[var(--color-bg-hover)] transition-colors",onClick:()=>{hn.value=e},"aria-label":s("debug.viewEventDetails",{event:e.event}),children:[n("div",{class:"min-w-0",children:[n(X,{variant:"default",class:"font-mono text-xs mb-1",children:e.event}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:new Date(e.timestamp).toLocaleTimeString()})]}),t&&n(Ye,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0"})]})}function WE({entry:e,expanded:t,onToggle:r}){const a=e.payload!=null&&Object.keys(e.payload).length>0,o=Bh(e.payload),l=`event-${e.id}`;return n("div",{class:"border-b border-[var(--color-border)] last:border-0",children:[n("button",{type:"button",class:"w-full flex items-center gap-2 py-2 px-3 text-left hover:bg-[var(--color-bg-hover)] transition-colors",onClick:r,disabled:!a,"aria-expanded":t,"aria-label":`${e.event} event, ${s(a?"debug.clickToExpand":"debug.noPayload")}`,children:[a?t?n(ze,{size:14,class:"text-[var(--color-text-muted)]"}):n(Ye,{size:14,class:"text-[var(--color-text-muted)]"}):n("span",{class:"w-[14px]"}),n("span",{class:"text-xs text-[var(--color-text-muted)] w-20 shrink-0",children:new Date(e.timestamp).toLocaleTimeString()}),n(X,{variant:"default",class:"font-mono text-xs",children:e.event})]}),t&&a&&n("div",{class:"px-3 pb-3",children:n(iu,{value:o,id:l})})]})}function KE(e){const t=vn.value.length>0,[r,a,o]=Gl("event",{ready:t});R(()=>{if(t&&r.value.size>0){const c=Array.from(r.value).filter(d=>vn.value.some(u=>u.id===d));if(c.length>0){const d=c.filter(u=>!nr.value.has(u));d.length>0&&(nr.value=new Set([...nr.value,...c]),setTimeout(()=>{const u=document.querySelectorAll(`[data-event-id="${d[0]}"]`);Array.from(u).find(f=>f.offsetParent!==null)?.scrollIntoView({behavior:"smooth",block:"center"})},100))}}},[r.value,t]),R(()=>{o.value&&a(nr.value)},[nr.value,o.value]),R(()=>zc(d=>{zE(d.event,d.payload)}),[]),R(()=>{const c=setInterval(()=>{Ox.value++},1e3);return()=>clearInterval(c)},[]);const l=P.value,i=Pe.value;return n(rn,{viewName:s("common.debug"),children:[n(jt,{title:s("common.debug"),subtitle:s("debug.subtitle"),actions:n(X,{variant:FE.value,children:[l?n(ac,{size:14,class:"mr-1"}):n(xb,{size:14,class:"mr-1"}),i]})}),n("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6",children:[n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(ac,{size:18,class:l?"text-[var(--color-success)]":"text-[var(--color-error)]"}),n("h2",{class:"font-medium",children:s("debug.connection")})]}),n("div",{class:"space-y-0",children:[n(qe,{icon:hr,label:s("debug.state"),value:i}),n(qe,{icon:Rn,label:s("common.url"),value:pt.value,copyable:!0,mono:!0}),n(qe,{icon:Jc,label:s("debug.sessionKey"),value:Ve.value,copyable:!0,mono:!0}),n(qe,{icon:Xe,label:s("debug.reconnectAttempts"),value:String(Yt.value)}),n(qe,{icon:ge,label:s("debug.connectedAt"),value:br.value?re(br.value):null})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(la,{size:18,class:"text-[var(--color-primary)]"}),n("h2",{class:"font-medium",children:s("debug.server")})]}),n("div",{class:"space-y-0",children:[n(qe,{icon:la,label:s("common.version"),value:Ot.value}),n(qe,{icon:qt,label:s("common.host"),value:So.value}),n(qe,{icon:en,label:s("common.commit"),value:ms.value?.slice(0,8),copyable:!0,mono:!0}),n(qe,{icon:ge,label:s("common.uptime"),value:NE.value}),n(qe,{icon:ge,label:s("debug.tickInterval"),value:jl.value?`${jl.value}ms`:null})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(nc,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:s("debug.paths")})]}),n("div",{class:"space-y-0",children:[n(qe,{icon:en,label:s("debug.configPath"),value:dl.value,copyable:!0,mono:!0}),n(qe,{icon:nc,label:s("debug.stateDir"),value:hl.value,copyable:!0,mono:!0})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(qt,{size:18,class:"text-[var(--color-info)]"}),n("h2",{class:"font-medium",children:s("debug.client")})]}),n("div",{class:"space-y-0",children:[n(qe,{icon:qt,label:s("debug.appVersion"),value:"2026.2.14"}),n(qe,{icon:qt,label:s("common.platform"),value:navigator.platform}),n(qe,{icon:qt,label:s("debug.userAgent"),value:navigator.userAgent.slice(0,60)+"..."}),n(qe,{icon:sr,label:s("debug.presenceCount"),value:String(vs.value.length)})]})]})]}),n("div",{class:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6",children:[n(EE,{}),n(DE,{})]}),n(G,{children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(hr,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:s("debug.eventLog")}),n(X,{variant:"default",children:vn.value.length})]}),n("div",{class:"flex items-center gap-2",children:[n(Ue,{checked:!Li.value,onChange:c=>{Li.value=!c},label:Li.value?s("common.paused"):s("debug.recording")}),n(N,{variant:"ghost",size:"sm",onClick:UE,disabled:vn.value.length===0,icon:n(At,{size:14}),children:n("span",{class:"hidden sm:inline",children:s("common.clear")})})]})]}),vn.value.length===0?n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:[n(hr,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:s("debug.noEvents")}),n("p",{class:"text-sm mt-1",children:s("debug.noEventsHint")})]}):n(j,{children:[n("div",{class:"md:hidden space-y-2 max-h-96 overflow-y-auto",children:vn.value.map(c=>n("div",{"data-event-id":c.id,children:n(HE,{entry:c})},c.id))}),n("div",{class:"hidden md:block max-h-96 overflow-y-auto border border-[var(--color-border)] rounded-lg",children:vn.value.map(c=>n("div",{"data-event-id":c.id,children:n(WE,{entry:c,expanded:nr.value.has(c.id),onToggle:()=>jE(c.id)})},c.id))})]})]}),n(We,{open:!!hn.value,onClose:()=>{hn.value=null},title:hn.value?.event||"",children:hn.value&&n("div",{class:"space-y-3",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:new Date(hn.value.timestamp).toLocaleString()}),hn.value.payload!=null&&Object.keys(hn.value.payload).length>0?n(iu,{value:Bh(hn.value.payload),maxHeight:"max-h-[60vh]",id:`mobile-event-${hn.value.id}`}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("debug.noPayload")})]})})]})}let Nx=0;function Fx(){Nx=0}function xc(e,t="",r=!0){const a={};for(const[o,l]of Object.entries(e)){if(r&&/^\d+$/.test(o))continue;const i=t?`${t}.${o}`:o;l!=null&&(Array.isArray(l)?a[i]=JSON.stringify(l):typeof l=="object"?Object.assign(a,xc(l,i,!1)):typeof l=="string"?a[i]=l:a[i]=JSON.stringify(l))}return a}function qE(e){const t=Object.keys(e).filter(o=>/^\d+$/.test(o)).map(Number).sort((o,l)=>o-l);if(t.length===0)return{message:null,fields:{}};let r=null;const a={};for(const o of t){const l=e[String(o)];if(typeof l=="string"){try{const i=JSON.parse(l);if(typeof i=="object"&&i!==null){Object.assign(a,xc(i,"",!1));continue}}catch{}r=l}else typeof l=="object"&&l!==null&&Object.assign(a,xc(l,"",!1))}return{message:r,fields:a}}const gv=["time","timestamp","ts","level","lvl","pid","hostname","v","msg","message"];function zx(e){if(!e.startsWith("{"))return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function bv(e){const t=++Nx;let r,a,o=e,l;if(e.startsWith("{"))try{const i=JSON.parse(e);r=i.time||i.timestamp||i.ts;const d=i._meta?.logLevelName?.toLowerCase()||(i.level||i.lvl||"")?.toLowerCase();["debug","info","warn","warning","error","err"].includes(d)&&(a=d==="warning"?"warn":d==="err"?"error":d);const u=Object.keys(i).some(h=>/^\d+$/.test(h));if(u){const h=qE(i);h.message&&(o=h.message),Object.keys(h.fields).length>0&&(l=h.fields)}if(o===e&&(i.msg||i.message?o=i.msg||i.message:i.error&&typeof i.error=="string"&&(o=i.error)),o===e&&!u){const h=[];for(const[f,p]of Object.entries(i))gv.includes(f)||(typeof p=="string"?h.push(`${f}=${p}`):p!=null&&h.push(`${f}=${JSON.stringify(p)}`));o=h.length>0?h.join(" "):e}if(!l){const h={};for(const[f,p]of Object.entries(i))!gv.includes(f)&&!/^\d+$/.test(f)&&f!=="_meta"&&(h[f]=p);Object.keys(h).length>0&&(l=xc(h))}}catch{}if(!r){const i=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z)\s+\[([^\]]+)\]\s*(.*)$/);if(i){r=i[1],o=`[${i[2]}] ${i[3]}`;const c=e.toLowerCase();c.includes("error")||c.includes("err ")||c.includes("✗")?a="error":c.includes("warn")||c.includes("warning")?a="warn":c.includes("debug")?a="debug":a="info"}}if(!r){const i=e.match(/^\[([^\]]+)\]\s*(DEBUG|INFO|WARN|ERROR):?\s*(.*)$/i);i&&(r=i[1],a=i[2].toLowerCase(),o=i[3])}if(!r){const i=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:]+Z)\s+(ERR|INF|WRN|DBG)\s+(.*)$/);if(i){r=i[1];const c=i[2];a=c==="ERR"?"error":c==="WRN"?"warn":c==="DBG"?"debug":"info",o=i[3]}}if(!a&&!r){const i=e.match(/^(DEBUG|INFO|WARN|ERROR):?\s+(.*)$/i);i&&(a=i[1].toLowerCase(),o=i[2])}if(!a){const i=e.toLowerCase();i.includes("error")||i.includes("failed")||i.includes("exception")||i.includes("✗")?a="error":i.includes("warn")||i.includes("deprecated")?a="warn":(i.includes("debug")||i.includes("trace"))&&(a="debug")}return{id:t,raw:e,timestamp:r,level:a,message:o,fields:l}}const Ux={debug:Ck,info:ks,warn:Cr,error:Vc},jx={debug:"text-[var(--color-text-muted)]",info:"text-[var(--color-info)]",warn:"text-[var(--color-warning)]",error:"text-[var(--color-error)]"};function Bx(e){return e?e.split("T")[1]?.slice(0,12)||e.slice(0,12):null}function GE({line:e,expanded:t,onToggle:r}){const a=e.level?Ux[e.level]:void 0,o=e.level?jx[e.level]:"text-[var(--color-text-muted)]",l=Bx(e.timestamp),i=e.fields&&Object.keys(e.fields).length>0;return n("div",{class:"border-b border-[var(--color-border)]/50 last:border-0",children:[n("button",{type:"button",onClick:r,disabled:!i,"aria-expanded":i?t:void 0,"aria-label":i?s("logs.expandLine",{message:e.message.slice(0,50)}):void 0,class:"w-full text-left py-2 px-3 hover:bg-[var(--color-bg-hover)] flex items-start gap-2 font-mono text-xs disabled:cursor-default",children:[i?n(Ye,{size:12,class:`mt-0.5 flex-shrink-0 text-[var(--color-text-muted)] transition-transform ${t?"rotate-90":""}`}):n("span",{class:"w-3 flex-shrink-0"}),a&&n(a,{size:14,class:`mt-0.5 flex-shrink-0 ${o}`}),l&&n("span",{class:"text-[var(--color-text-muted)] flex-shrink-0",children:l}),n("span",{class:"flex-1 text-[var(--color-text-primary)] truncate",title:e.message,children:e.message})]}),t&&i&&e.fields&&n("div",{class:"pb-3 px-3 ml-7 space-y-2",children:[e.message&&n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:"message"}),n("div",{class:"text-[var(--color-text-primary)] mt-1 whitespace-pre-wrap break-all",children:e.message})]}),n("div",{class:"space-y-1 pt-1 border-t border-[var(--color-border)]/30",children:Object.entries(e.fields).map(([c,d])=>n("div",{class:"flex gap-2 text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)] flex-shrink-0",children:c}),n("span",{class:"text-[var(--color-text-secondary)] break-all",children:d})]},c))}),n("details",{class:"pt-1 border-t border-[var(--color-border)]/30",children:[n("summary",{class:"text-xs text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text-secondary)]",children:s("logs.rawLine")}),n("pre",{class:"mt-2 text-xs font-mono text-[var(--color-text-secondary)] bg-[var(--color-bg-primary)] rounded p-2 overflow-x-auto whitespace-pre-wrap break-all",children:zx(e.raw)})]})]})]})}const Ge=m([]),ih=m(0),ch=m(""),Fr=m(!1),yc=m(null),Jn=m(!0),rl=m(""),gt=m(new Set),mt=m(new Set),Dr=m(null);async function Gu(e=!1){if(P.value){Fr.value=!0,yc.value=null;try{const t=await O("logs.tail",{cursor:e?void 0:ih.value||void 0,limit:500,maxBytes:25e4});if(t)if(ch.value=t.file,ih.value=t.cursor,t.reset||e)Fx(),Ge.value=t.lines.map(bv);else{const r=t.lines.map(bv);r.length>0&&(Ge.value=[...Ge.value,...r].slice(-2e3))}}catch(t){yc.value=t instanceof Error?t.message:s("logs.fetchError")}finally{Fr.value=!1}}}function xv(){Ge.value=[],ih.value=0,Fx()}function yv(){const e=Ge.value.map(o=>o.raw).join(`
|
|
419
|
-
`),t=new Blob([e],{type:"text/plain"}),r=URL.createObjectURL(t),a=document.createElement("a");a.href=r,a.download=`openclaw-logs-${new Date().toISOString().slice(0,10)}.log`,a.click(),URL.revokeObjectURL(r)}function li(e){const t=new Set(gt.value);t.has(e)?t.delete(e):t.add(e),gt.value=t}function VE(){gt.value=new Set}function JE(e){const t=new Set(mt.value);t.has(e)?t.delete(e):t.add(e),mt.value=t}const wv=q(()=>{let e=Ge.value;const t=gt.value;t.size>0&&(e=e.filter(a=>a.level&&t.has(a.level)));const r=rl.value.toLowerCase().trim();return r&&(e=e.filter(a=>a.raw.toLowerCase().includes(r))),e}),YE=q(()=>{const e={debug:0,info:0,warn:0,error:0};for(const t of Ge.value)t.level&&t.level in e&&e[t.level]++;return e}),XE={debug:{active:"bg-[var(--color-text-muted)]/30 text-[var(--color-text-primary)] ring-1 ring-[var(--color-text-muted)]",inactive:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"},info:{active:"bg-[var(--color-info)]/20 text-[var(--color-info)] ring-1 ring-[var(--color-info)]",inactive:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"},warn:{active:"bg-[var(--color-warning)]/20 text-[var(--color-warning)] ring-1 ring-[var(--color-warning)]",inactive:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"},error:{active:"bg-[var(--color-error)]/20 text-[var(--color-error)] ring-1 ring-[var(--color-error)]",inactive:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"}},kv={debug:"common.debug",info:"logs.info",warn:"logs.warnings",error:"common.error"};function si({level:e,count:t,selected:r,onClick:a}){const o=XE[e];return n("button",{type:"button",onClick:a,"aria-label":s("logs.filterByLevel",{level:s(kv[e])}),"aria-pressed":r,class:`px-3 py-1 text-sm rounded-full transition-colors ${r?o.active:o.inactive}`,children:[s(kv[e])," (",t,")"]})}function ZE({logId:e,lines:t,onClose:r}){const a=e!==null?t.find(o=>o.id===e):null;return n(We,{open:!!a,onClose:r,title:s("logs.logDetails"),children:a&&n("div",{class:"space-y-4",children:[n("div",{class:"flex items-center gap-2",children:[a.level&&n(X,{variant:a.level==="error"?"error":a.level==="warn"?"warning":"default",children:a.level}),a.timestamp&&n("span",{class:"text-sm text-[var(--color-text-muted)] font-mono",children:a.timestamp})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:s("logs.message")}),n("p",{class:"text-sm text-[var(--color-text-primary)] whitespace-pre-wrap break-words",children:a.message})]}),a.fields&&Object.keys(a.fields).length>0&&n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-2",children:s("logs.fields")}),n("div",{class:"space-y-2 bg-[var(--color-bg-tertiary)] rounded-lg p-3",children:Object.entries(a.fields).map(([o,l])=>n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:o}),n("span",{class:"text-[var(--color-text-muted)] mx-1",children:"="}),n("span",{class:"text-[var(--color-text-secondary)] break-all",children:l})]},o))})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:s("logs.rawLine")}),n("pre",{class:"text-xs font-mono text-[var(--color-text-secondary)] bg-[var(--color-bg-tertiary)] rounded-lg p-3 overflow-x-auto whitespace-pre-wrap break-all",children:zx(a.raw)})]})]})})}function QE({line:e,onSelect:t}){const r=e.level?Ux[e.level]:ks,a=e.level?jx[e.level]:"text-[var(--color-text-muted)]",o=e.fields&&Object.keys(e.fields).length>0,l=Bx(e.timestamp);return n("button",{type:"button",class:"w-full flex items-start gap-3 p-3 text-left bg-[var(--color-bg-secondary)] rounded-lg hover:bg-[var(--color-bg-hover)] transition-colors",onClick:()=>t(e.id),"aria-label":s("logs.viewLogDetails"),children:[n(r,{size:16,class:`mt-0.5 flex-shrink-0 ${a}`}),n("div",{class:"flex-1 min-w-0",children:[n("p",{class:"text-sm text-[var(--color-text-primary)] line-clamp-2",children:e.message}),n("div",{class:"flex items-center gap-2 mt-1",children:[l&&n("span",{class:"text-xs text-[var(--color-text-muted)] font-mono",children:l}),o&&n(X,{variant:"default",class:"text-xs",children:[Object.keys(e.fields).length," ",s("logs.fields")]})]})]}),n(Ye,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0 mt-0.5"})]})}function eT(e){const t=B(null),r=B(null),a=B(!0),o=B(!0),l=!Fr.value&&Ge.value.length>0,[i,c]=de("q"),[d,u]=Gl("level"),[h,f]=de("live"),[p,v,w]=Gl("log",{ready:l,parse:b=>parseInt(b,10)});Fe(i,rl,b=>b),R(()=>{d.value.size>0&&(gt.value=d.value),h.value==="0"&&(Jn.value=!1)},[]),va(rl,c),R(()=>{u(gt.value)},[gt.value]),R(()=>{f(Jn.value?null:"0")},[Jn.value]),R(()=>{if(l&&p.value.size>0){const b=Array.from(p.value).filter(x=>Ge.value.some(_=>_.id===x)),C=b.filter(x=>!mt.value.has(x));C.length>0&&(mt.value=new Set([...mt.value,...b]),window.matchMedia("(max-width: 767px)").matches&&Dr.value===null&&(Dr.value=C[0]),setTimeout(()=>{const _=document.querySelectorAll(`[data-log-id="${C[0]}"]`);Array.from(_).find($=>$.offsetParent!==null)?.scrollIntoView({behavior:"smooth",block:"center"})},100))}},[p.value,l]),R(()=>{w.value&&v(mt.value)},[mt.value,w.value]),R(()=>{P.value&&Gu(!0)},[P.value]),R(()=>{if(!Jn.value||!P.value)return;const b=setInterval(()=>Gu(),2e3);return()=>clearInterval(b)},[Jn.value,P.value]),R(()=>{a.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight),o.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[wv.value.length]);const k=()=>{if(!t.current)return;const{scrollTop:b,scrollHeight:C,clientHeight:x}=t.current;a.current=C-b-x<50},T=()=>{if(!r.current)return;const{scrollTop:b,scrollHeight:C,clientHeight:x}=r.current;o.current=C-b-x<50},y=wv.value,g=YE.value;return n(ru,{viewName:s("common.logs"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto w-full flex flex-col flex-1 min-h-0 space-y-4 sm:space-y-6",children:[n(jt,{title:s("common.logs"),subtitle:s("logs.description"),actions:n("div",{class:"flex items-center gap-2",children:[n(Ue,{checked:Jn.value,onChange:b=>Jn.value=b,label:Jn.value?s("logs.live"):s("common.paused")}),n(K,{icon:n(Xe,{size:16,class:Fr.value?"animate-spin":""}),onClick:()=>Gu(!0),disabled:Fr.value,label:s("actions.refresh")})]})}),n(Z,{type:"text",value:rl.value,onInput:b=>rl.value=b.target.value,placeholder:s("logs.searchPlaceholder"),"aria-label":s("logs.searchPlaceholder"),leftElement:n(lt,{class:"w-4 h-4"})}),n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[n("div",{class:"flex items-center gap-2 overflow-x-auto pb-1 sm:pb-0 -mx-4 px-4 sm:mx-0 sm:px-0",role:"group","aria-label":s("logs.filterByLevel",{level:""}),children:[n("button",{type:"button",onClick:VE,"aria-pressed":gt.value.size===0,class:`px-3 py-1 text-sm rounded-full transition-colors whitespace-nowrap ${gt.value.size===0?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"}`,children:[s("common.all")," (",Ge.value.length,")"]}),n(si,{level:"debug",count:g.debug,selected:gt.value.has("debug"),onClick:()=>li("debug")}),n(si,{level:"info",count:g.info,selected:gt.value.has("info"),onClick:()=>li("info")}),n(si,{level:"warn",count:g.warn,selected:gt.value.has("warn"),onClick:()=>li("warn")}),n(si,{level:"error",count:g.error,selected:gt.value.has("error"),onClick:()=>li("error")})]}),n("div",{class:"flex items-center gap-2",children:[ch.value&&n("span",{class:"hidden sm:flex text-xs text-[var(--color-text-muted)] items-center gap-1",children:[n(en,{size:12}),ch.value.split("/").pop()]}),n("div",{class:"hidden sm:flex items-center gap-2",children:[n(N,{variant:"ghost",size:"sm",onClick:yv,icon:n(Ft,{size:14}),children:s("common.download")}),n(N,{variant:"ghost",size:"sm",onClick:xv,disabled:Ge.value.length===0,icon:n(At,{size:14}),children:s("common.clear")})]}),n("div",{class:"flex sm:hidden items-center gap-1",children:[n(K,{icon:n(Ft,{size:16}),onClick:yv,label:s("common.download"),size:"sm"}),n(K,{icon:n(At,{size:16}),onClick:xv,disabled:Ge.value.length===0,label:s("common.clear"),size:"sm"})]})]})]}),yc.value&&n("div",{class:"p-4 rounded-lg bg-[var(--color-error)]/10 text-[var(--color-error)] text-sm",role:"alert",children:yc.value}),n("div",{class:"flex-1 min-h-0 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-tertiary)] overflow-hidden flex flex-col",children:[Fr.value&&Ge.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Fr.value&&Ge.value.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(en,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:s("logs.noLogs")}),n("p",{class:"text-sm mt-1",children:s("logs.noLogsHint")})]}),Ge.value.length>0&&y.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(lt,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:s("logs.noMatches")})]}),y.length>0&&n(j,{children:[n("div",{ref:r,class:"md:hidden flex-1 overflow-y-auto p-3 space-y-2",onScroll:T,role:"log","aria-live":"polite",children:y.map(b=>n("div",{"data-log-id":b.id,children:n(QE,{line:b,onSelect:C=>{Dr.value=C;const x=new Set(mt.value);x.add(C),mt.value=x,kr()}})},b.id))}),n("div",{ref:t,class:"hidden md:flex md:flex-col flex-1 overflow-y-auto",onScroll:k,role:"log","aria-live":"polite",children:y.map(b=>n("div",{"data-log-id":b.id,children:n(GE,{line:b,expanded:mt.value.has(b.id),onToggle:()=>{JE(b.id),mt.value.has(b.id)||kr()}})},b.id))})]})]}),n(ZE,{logId:Dr.value,lines:Ge.value,onClose:()=>{if(Dr.value!==null){const b=new Set(mt.value);b.delete(Dr.value),mt.value=b}Dr.value=null}})]})})})}function Pf(e){return e.role?e.role:e.roles&&e.roles.length>0?e.roles[0]:"unknown"}function Hx(e){return!!(e.role==="node"||e.roles?.includes("node"))}function Wx(e){return!!(e.role==="operator"||e.roles?.includes("operator"))}function Of(e){switch(e){case"operator":return"info";case"node":return"success";default:return"default"}}function Kx(e){switch(e?.toLowerCase()){case"ios":return"🍎";case"android":return"🤖";case"macos":case"darwin":return"💻";case"windows":case"win32":return"🪟";case"linux":return"🐧";case"web":return"🌐";default:return"📱"}}function bo(e){return e.length<=20?e:`${e.slice(0,10)}...${e.slice(-6)}`}function tT({device:e,onSelect:t}){const r=Pf(e),a=e.tokens?.length??0,o=e.platform?.includes("ios")||e.platform?.includes("android")?to:qt;return n(Mo,{icon:o,iconVariant:r==="operator"?"info":"success",title:e.displayName||bo(e.deviceId),subtitle:e.platform||void 0,badges:n(X,{variant:Of(r),children:r}),meta:[...a>0?[{icon:Jc,value:`${a}`}]:[],{icon:ge,value:re(e.approvedAtMs,{relative:!0})}],onClick:()=>t(e)})}function ii({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function nT({token:e,onRotate:t}){return n("div",{class:"flex items-center justify-between rounded-lg p-2 bg-[var(--color-bg-primary)]",children:[n("div",{children:[n("div",{class:"font-medium text-sm",children:e.role}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:e.revokedAtMs?s("devices.tokenRevoked"):s("devices.tokenActive")})]}),n("div",{class:"flex gap-1",children:n(K,{icon:n(Yc,{class:"w-4 h-4"}),label:s("devices.rotateToken"),onClick:t,size:"sm"})})]})}function qx({device:e,bare:t=!1,onOpenTokenModal:r}){const a=e.tokens??[];return n("div",{class:t?"":"px-4 py-3 bg-[var(--color-bg-tertiary)] border-t border-[var(--color-border)]",children:n("div",{class:"grid grid-cols-1 md:grid-cols-[1fr_auto] gap-4",children:[n("div",{class:"space-y-2 text-sm min-w-0",children:[n(ii,{label:s("devices.deviceId"),children:n("code",{class:"text-xs bg-[var(--color-bg-primary)] px-1 py-0.5 rounded break-all",children:e.deviceId})}),e.clientId&&n(ii,{label:s("devices.clientId"),children:e.clientId}),e.scopes&&e.scopes.length>0&&n(ii,{label:s("devices.scopes"),children:n("span",{class:"text-xs",children:e.scopes.join(", ")})}),n(ii,{label:s("common.approved"),children:re(e.approvedAtMs)})]}),n("div",{class:"space-y-2 w-full md:w-48 shrink-0",children:[n("h4",{class:"text-sm font-medium flex items-center gap-2",children:[n(Xc,{class:"w-4 h-4"}),s("devices.tokens")]}),a.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("devices.noTokens")}):n("div",{class:"space-y-2",children:a.map(l=>n(nT,{token:l,onRotate:()=>r?.(e)},l.role))})]})]})})}function rT({device:e,isExpanded:t,onToggleExpand:r,onOpenTokenModal:a}){const o=Pf(e),l=e.tokens?.length??0;return n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",class:"w-full flex items-center gap-4 px-4 py-3 hover:bg-[var(--color-bg-tertiary)] text-left",onClick:r,"aria-expanded":t,"aria-label":s("devices.toggleDetails",{name:e.displayName||bo(e.deviceId)}),children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(ze,{class:"w-4 h-4"}):n(Ye,{class:"w-4 h-4"})}),n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:Kx(e.platform)}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:n("span",{class:"font-medium truncate",children:e.displayName||bo(e.deviceId)})}),n("div",{class:"text-sm text-[var(--color-text-muted)] truncate",children:[e.platform,e.remoteIp&&` • ${e.remoteIp}`,e.clientMode&&` • ${e.clientMode}`]})]}),n(X,{variant:Of(o),children:o}),l>0&&n("div",{class:"flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(Jc,{class:"w-4 h-4"}),n("span",{children:l})]}),n("div",{class:"hidden md:flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(ge,{class:"w-4 h-4"}),n("span",{children:re(e.approvedAtMs)})]})]}),t&&n(qx,{device:e,onOpenTokenModal:a})]})}const Gr=m([]),Nf=m([]),zr=m(!1),bl=m(null),al=m(""),Mt=m("all"),rr=m(new Set),ea=m(null),Dn=m(null),uh=m(!1),aT=[{value:"all",label:()=>s("devices.filters.allRoles")},{value:"operator",label:()=>s("common.operators")},{value:"node",label:()=>s("common.nodes")}],oT=q(()=>{const e=Gr.value,t=e.filter(Wx).length,r=e.filter(Hx).length,a=Nf.value.length;return{total:e.length,operators:t,nodes:r,pending:a}}),lT=q(()=>{let e=Gr.value;Mt.value==="operator"?e=e.filter(Wx):Mt.value==="node"&&(e=e.filter(Hx));const t=al.value.toLowerCase().trim();return t&&(e=e.filter(r=>r.deviceId.toLowerCase().includes(t)||r.displayName?.toLowerCase().includes(t)||r.platform?.toLowerCase().includes(t)||r.remoteIp?.toLowerCase().includes(t))),e});async function xo(){zr.value=!0,bl.value=null;try{const e=await O("device.pair.list",{});Gr.value=e.paired,Nf.value=e.pending}catch(e){bl.value=ae(e)}finally{zr.value=!1}}async function sT(e){try{await O("device.pair.approve",{requestId:e}),J.success(s("devices.approveSuccess")),await xo()}catch(t){J.error(ae(t))}}async function iT(e){try{await O("device.pair.reject",{requestId:e}),J.success(s("devices.rejectSuccess")),await xo()}catch(t){J.error(ae(t))}}async function cT(e,t){uh.value=!0;try{const r=await O("device.token.rotate",{deviceId:e.deviceId,role:t});J.success(s("devices.tokenRotated")),await navigator.clipboard.writeText(r.token),J.success(s("devices.tokenCopied")),ea.value=null,await xo()}catch(r){J.error(ae(r))}finally{uh.value=!1}}async function uT(e,t){try{await O("device.token.revoke",{deviceId:e.deviceId,role:t}),J.success(s("devices.tokenRevoked")),ea.value=null,await xo()}catch(r){J.error(ae(r))}}function dT(e){const t=new Set(rr.value);t.has(e)?t.delete(e):(t.add(e),kr()),rr.value=t}function hT({request:e}){const t=Pf(e);return n(G,{class:"border-[var(--color-warning)] border-2",children:n("div",{class:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[n("div",{class:"flex items-center gap-3",children:[n("span",{class:"text-2xl",children:Kx(e.platform)}),n("div",{children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"font-medium",children:e.displayName||bo(e.deviceId)}),n(X,{variant:Of(t),children:t}),e.isRepair&&n(X,{variant:"warning",children:s("devices.repair")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:[e.platform,e.remoteIp&&` • ${e.remoteIp}`," • ",re(e.ts)]})]})]}),n("div",{class:"flex gap-2 self-end sm:self-start",children:[n(N,{variant:"primary",size:"sm",icon:nn,onClick:()=>sT(e.requestId),children:s("devices.approve")}),n(N,{variant:"danger",size:"sm",icon:pa,onClick:()=>iT(e.requestId),children:s("devices.reject")})]})]})})}function fT({token:e,device:t,disabled:r}){return n("div",{class:"flex items-center justify-between rounded-lg p-3 bg-[var(--color-bg-tertiary)]",children:[n("div",{children:[n("div",{class:"font-medium",children:e.role}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[s("devices.tokenCreated"),": ",re(e.createdAtMs),e.rotatedAtMs&&n(j,{children:[" ","• ",s("devices.tokenRotatedAt"),": ",re(e.rotatedAtMs)]})]})]}),n("div",{class:"flex gap-2",children:[n(N,{variant:"secondary",size:"sm",icon:Yc,onClick:()=>cT(t,e.role),disabled:r,children:s("devices.rotate")}),n(N,{variant:"danger",size:"sm",icon:At,onClick:()=>uT(t,e.role),children:s("devices.revoke")})]})]})}function pT(){const e=ea.value;if(!e)return null;const t=e.tokens??[];return n(We,{open:!0,onClose:()=>{ea.value=null},title:s("devices.tokenManagement"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("devices.tokenManagementDesc",{name:e.displayName||bo(e.deviceId)})}),t.length===0?n("p",{class:"text-sm",children:s("devices.noTokens")}):n("div",{class:"space-y-3",children:t.map(r=>n(fT,{token:r,device:e,disabled:uh.value},r.role))})]}),n("div",{class:"mt-6 flex justify-end",children:n(N,{variant:"secondary",onClick:()=>{ea.value=null},children:s("actions.close")})})]})}function mT(){return n("div",{class:"text-center py-12",children:[n(to,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:s("devices.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("devices.emptyDescription")})]})}function vT(e){const t=!zr.value&&Gr.value.length>0,[r,a]=de("q"),[o,l]=de("role"),[i,c,d]=Gl("device",{ready:t});Fe(r,al,p=>p),Fe(o,Mt,p=>p),va(al,a),En(Mt,l,"all"),R(()=>{if(t&&i.value.size>0){const p=Array.from(i.value).filter(v=>!rr.value.has(v));p.length>0&&(rr.value=new Set([...rr.value,...i.value]),setTimeout(()=>{const v=document.querySelectorAll(`[data-device-id="${p[0]}"]`),w=Array.from(v).find(k=>k.offsetParent!==null);w&&w.scrollIntoView({behavior:"smooth",block:"center"})},100))}},[i.value,t]),R(()=>{d.value&&c(rr.value)},[rr.value,d.value]),R(()=>{P.value&&xo()},[P.value]);const u=lT.value,h=oT.value,f=Nf.value;return n(rn,{viewName:s("common.devices"),children:[n(jt,{title:s("common.devices"),subtitle:s("devices.description"),actions:n(K,{icon:n(Xe,{class:zr.value?"animate-spin":""}),onClick:xo,disabled:zr.value,label:s("actions.refresh")})}),bl.value&&n(Hn,{variant:"error",children:bl.value}),zr.value&&Gr.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!zr.value&&!bl.value&&n(j,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(ve,{icon:to,label:s("common.total"),value:h.total,active:Mt.value==="all",onClick:()=>{Mt.value="all"}}),n(ve,{icon:tn,label:s("common.operators"),value:h.operators,active:Mt.value==="operator",onClick:()=>{Mt.value="operator"}}),n(ve,{icon:qt,label:s("common.nodes"),value:h.nodes,active:Mt.value==="node",onClick:()=>{Mt.value="node"}}),n(ve,{icon:ge,label:s("common.pending"),value:h.pending,highlight:h.pending>0})]}),f.length>0&&n("div",{class:"space-y-3","data-tour":"pending-requests",children:[n("h2",{class:"text-lg font-semibold",children:s("devices.pendingRequests")}),f.map(p=>n(hT,{request:p},p.requestId))]}),Gr.value.length>0&&n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(Z,{type:"text",placeholder:s("devices.searchPlaceholder"),value:al.value,onInput:p=>{al.value=p.target.value},leftElement:n(lt,{class:"w-4 h-4"}),class:"flex-1"}),n(Me,{value:Mt.value,onChange:p=>{Mt.value=p},options:aT.map(p=>({value:p.value,label:p.label()})),size:"sm",align:"right","aria-label":s("devices.filters.allRoles")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:u.length!==h.total?s("devices.filteredCount",{filtered:u.length,total:h.total}):s("devices.count",{count:h.total})})]}),Gr.value.length>0?u.length===0?n(G,{padding:"none",children:n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:s("devices.noResults")})}):n(j,{children:[n("div",{class:"md:hidden space-y-2",children:u.map(p=>n("div",{"data-device-id":p.deviceId,children:n(tT,{device:p,onSelect:v=>{Dn.value=v}})},p.deviceId))}),n(G,{padding:"none",class:"hidden md:block overflow-hidden",children:u.map(p=>n("div",{"data-device-id":p.deviceId,children:n(rT,{device:p,isExpanded:rr.value.has(p.deviceId),onToggleExpand:()=>dT(p.deviceId),onOpenTokenModal:v=>{ea.value=v}})},p.deviceId))})]}):n(mT,{})]}),n(We,{open:!!Dn.value,onClose:()=>{Dn.value=null},title:Dn.value?.displayName||(Dn.value?bo(Dn.value.deviceId):""),children:Dn.value&&n(qx,{device:Dn.value,bare:!0,onOpenTokenModal:p=>{Dn.value=null,ea.value=p}})}),n(pT,{})]})}function Gx({items:e,activeId:t,onChange:r}){return n("div",{class:"flex border-b border-[var(--color-border)] overflow-x-auto scrollbar-hide -mx-4 px-4 sm:mx-0 sm:px-0",role:"tablist",children:e.map(a=>{const o=a.id===t;return n("button",{type:"button",role:"tab","aria-selected":o,onClick:()=>r(a.id),class:`relative flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-3 text-sm font-medium transition-colors whitespace-nowrap flex-shrink-0 ${o?"text-[var(--color-accent)]":"text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]"}`,children:[a.icon,a.label,o&&n("span",{class:"absolute bottom-0 left-0 right-0 h-0.5 bg-[var(--color-accent)] rounded-full"})]},a.id)})})}function cu(e){return e.disabled?"disabled":e.blockedByAllowlist?"blocked":e.eligible?"eligible":"missing-reqs"}function gT(e){const{missing:t}=e;return t.bins.length>0||t.anyBins.length>0||t.env.length>0||t.config.length>0||t.os.length>0}function bT(e){const t=[],{missing:r}=e;return r.bins.length>0&&t.push(`bins: ${r.bins.join(", ")}`),r.anyBins.length>0&&t.push(`needs one of: ${r.anyBins.join(", ")}`),r.env.length>0&&t.push(`env: ${r.env.join(", ")}`),r.config.length>0&&t.push(`config: ${r.config.join(", ")}`),r.os.length>0&&t.push(`os: ${r.os.join(", ")}`),t}const Ff="https://clawhub.ai/api/v1";async function Vx(e){const t=new URLSearchParams;e?.limit&&t.set("limit",String(e.limit)),e?.cursor&&t.set("cursor",e.cursor),e?.sort&&t.set("sort",e.sort);const r=`${Ff}/skills${t.toString()?`?${t}`:""}`,a=await fetch(r);if(!a.ok)throw new Error(`ClawHub API error: ${a.status}`);return a.json()}async function xT(e,t){const r=new URLSearchParams({q:e});r.set("limit",String(t.limit));const a=`${Ff}/search?${r}`,o=await fetch(a);if(!o.ok)throw new Error(`ClawHub API error: ${o.status}`);return{items:((await o.json()).results||[]).map(c=>({slug:c.slug,displayName:c.displayName,summary:c.summary,tags:{latest:c.version},stats:{comments:0,downloads:0,stars:0,versions:0},createdAt:c.updatedAt,updatedAt:c.updatedAt,latestVersion:{version:c.version,createdAt:c.updatedAt,changelog:""}}))}}async function yT(e){const t=`${Ff}/skills/${encodeURIComponent(e)}`,r=await fetch(t);if(r.status===404)return null;if(!r.ok)throw new Error(`ClawHub API error: ${r.status}`);const a=await r.json();return{...a.skill,latestVersion:a.latestVersion,owner:a.owner}}const xt=m([]),zf=m([]),gn=m(!1),Pi=m(!1),xl=m(null),pn=m(""),Aa=m("downloads"),Ha=m(void 0),jn=m(null),yl=m(!1),wT=[{value:"downloads",label:()=>s("skills.clawhub.sortPopular")},{value:"trending",label:()=>s("skills.clawhub.sortTrending")},{value:"stars",label:()=>s("skills.clawhub.sortStars")},{value:"recent",label:()=>s("skills.clawhub.sortRecent")}];async function Jx(){if(!Pi.value){Pi.value=!0;try{const e=await Vx({limit:6,sort:"trending"});zf.value=e.items}catch{}finally{Pi.value=!1}}}async function Oi(e=!1){if(!gn.value){gn.value=!0,xl.value=null;try{const t=e?Ha.value:void 0;if(pn.value){const r=await xT(pn.value,{limit:20});xt.value=r.items,Ha.value=void 0;const a=await Promise.all(r.items.map(async o=>{try{return await yT(o.slug)||o}catch{return o}}));xt.value=a}else{const r=await Vx({limit:20,cursor:t,sort:Aa.value});e?xt.value=[...xt.value,...r.items]:xt.value=r.items,Ha.value=r.nextCursor}}catch(t){xl.value=ae(t)}finally{gn.value=!1}}}function kT(){Jx(),Oi()}async function ST(e){yl.value=!0;try{J.error(s("skills.clawhub.notYetSupported",{slug:e.slug})),jn.value=null}catch(t){J.error(ae(t))}finally{yl.value=!1}}function dh(e){jn.value=e,kr()}function _T(){const e=zf.value;return Pi.value&&e.length===0?n("div",{class:"flex items-center justify-center py-8",children:n(te,{size:"md"})}):e.length===0?null:n("section",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-2",children:[n(Mk,{class:"w-5 h-5 text-orange-500"}),n("h2",{class:"font-semibold",children:s("skills.clawhub.trending")})]}),n("div",{class:"flex gap-3 overflow-x-auto pb-2 scrollbar-hide -mx-4 px-4 sm:mx-0 sm:px-0",children:e.map(t=>n(CT,{skill:t},t.slug))})]})}function CT({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n("button",{type:"button",onClick:()=>dh(e),style:{outline:"none"},class:"flex-shrink-0 w-56 p-3 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-secondary)] hover:border-[var(--color-border-hover)] hover:bg-[var(--color-bg-hover)] transition-colors text-left group cursor-pointer",children:[n("div",{class:"flex items-center gap-2 mb-1",children:[n("span",{class:"font-medium truncate flex-1",children:e.displayName}),n(X,{variant:"default",class:"flex-shrink-0 text-xs",children:t})]}),n("p",{class:"text-xs text-[var(--color-text-muted)] line-clamp-2 mb-2 min-h-[2.5em]",children:e.summary||s("skills.clawhub.noDescription")}),n("div",{class:"flex items-center gap-3 text-xs text-[var(--color-text-muted)]",children:[n("span",{class:"flex items-center gap-1",children:[n(Ft,{class:"w-3 h-3"}),Uf(e.stats.downloads)]}),n("span",{class:"flex items-center gap-1",children:[n(hf,{class:"w-3 h-3"}),e.stats.stars]}),n(Ye,{class:"w-3 h-3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]})]})}function ET({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n(G,{class:"hover:border-[var(--color-border-hover)] transition-colors",children:n("div",{class:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[n("button",{type:"button",onClick:()=>dh(e),style:{outline:"none"},class:"flex-1 min-w-0 text-left cursor-pointer",children:[n("div",{class:"flex items-center gap-2 mb-1 flex-wrap",children:[n("h3",{class:"font-semibold truncate",children:e.displayName}),n(X,{variant:"default",children:t})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] line-clamp-2 mb-3",title:e.summary||void 0,children:e.summary||s("skills.clawhub.noDescription")}),n("div",{class:"flex items-center gap-3 sm:gap-4 text-xs text-[var(--color-text-muted)] flex-wrap",children:[n("span",{class:"flex items-center gap-1",children:[n(Ft,{class:"w-3 h-3"}),Uf(e.stats.downloads)]}),n("span",{class:"flex items-center gap-1",children:[n(hf,{class:"w-3 h-3"}),e.stats.stars]}),n("span",{class:"flex items-center gap-1",children:[n(Co,{class:"w-3 h-3"}),re(e.updatedAt)]})]})]}),n(N,{variant:"secondary",size:"sm",icon:n(Ft,{class:"w-4 h-4"}),onClick:()=>dh(e),class:"self-start sm:flex-shrink-0",children:s("skills.clawhub.install")})]})})}function TT(){const e=jn.value;if(!e)return null;const t=e.tags?.latest||e.latestVersion?.version||"?",r=e.latestVersion?.changelog,a=n("div",{class:"flex items-center justify-between gap-3",children:[n(N,{variant:"secondary",icon:n(ws,{class:"w-4 h-4"}),onClick:()=>window.open(`https://clawhub.ai/skills/${e.slug}`,"_blank"),children:"ClawHub"}),n("div",{class:"flex gap-3",children:[n(N,{variant:"secondary",onClick:()=>{jn.value=null},disabled:yl.value,children:s("actions.cancel")}),n(N,{variant:"primary",icon:n(Ft,{class:"w-4 h-4"}),onClick:()=>ST(e),disabled:yl.value,children:yl.value?s("skills.clawhub.installing"):s("skills.clawhub.install")})]})]});return n(We,{open:!0,onClose:()=>{jn.value=null},title:e.displayName,footer:a,size:"lg",children:n("div",{class:"space-y-5",children:[e.summary&&n("p",{class:"text-[var(--color-text-muted)]",children:e.summary}),n("div",{class:"flex items-center gap-4 flex-wrap text-sm",children:[n("span",{class:"flex items-center gap-1.5",children:[n(hf,{class:"w-4 h-4 text-yellow-500"}),n("span",{class:"font-medium",children:e.stats.stars})]}),n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(Ft,{class:"w-4 h-4"}),Uf(e.stats.downloads)]}),e.stats.installsCurrent!==void 0&&n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(Tk,{class:"w-4 h-4"}),e.stats.installsCurrent," ",s("skills.clawhub.installs")]}),e.stats.comments>0&&n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(fb,{class:"w-4 h-4"}),e.stats.comments]})]}),e.owner&&n("div",{class:"flex items-center gap-2",children:[n("span",{class:"text-sm text-[var(--color-text-muted)]",children:s("skills.clawhub.by")}),e.owner.image?n("img",{src:e.owner.image,alt:e.owner.displayName,class:"w-5 h-5 rounded-full"}):n(bb,{class:"w-5 h-5 text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:["@",e.owner.handle]})]}),n("div",{class:"flex items-center gap-4 flex-wrap text-sm text-[var(--color-text-muted)]",children:[n(X,{variant:"default",children:t}),n("span",{class:"flex items-center gap-1.5",children:[n(Co,{class:"w-4 h-4"}),s("skills.clawhub.updated")," ",re(e.updatedAt)]})]}),r&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-2",children:s("skills.clawhub.changelog")}),n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-xs max-h-32 overflow-y-auto whitespace-pre-wrap font-mono",children:r})]})]})})}function AT(){return n("div",{class:"text-center py-12",children:[n(tn,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:s("skills.clawhub.noResults")}),n("p",{class:"text-[var(--color-text-muted)]",children:s("skills.clawhub.tryDifferentSearch")})]})}function Uf(e){return e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(e)}function IT(){const[e,t]=de("hub_q"),[r,a]=de("hub_sort"),[o,l]=de("hub_skill");Fe(e,pn,u=>u),Fe(r,Aa,u=>u),va(pn,t),En(Aa,a,"downloads"),R(()=>{if(o.value&&xt.value.length>0){const u=xt.value.find(h=>h.slug===o.value);u&&!jn.value&&(jn.value=u)}},[o.value,xt.value]),R(()=>{l(jn.value?.slug??null)},[jn.value]),R(()=>{Jx()},[]),R(()=>{pn.value||(Ha.value=void 0,Oi())},[Aa.value]);const i=B(null);R(()=>(i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{Ha.value=void 0,Oi()},300),()=>{i.current&&clearTimeout(i.current)}),[pn.value]);const c=!!Ha.value,d=zf.value.length>0;return n("div",{class:"space-y-6",children:[d&&n(_T,{}),n("div",{class:"flex items-center justify-between gap-2 sm:gap-3",children:[n("div",{class:"min-w-0 w-full max-w-md",children:n(Z,{type:"text",placeholder:s("skills.clawhub.searchPlaceholder"),value:pn.value,onInput:u=>{pn.value=u.target.value},leftElement:gn.value?n(te,{size:"sm"}):n(lt,{class:"w-4 h-4"}),fullWidth:!0,rightElement:pn.value?n("button",{type:"button",onClick:()=>{pn.value=""},class:"p-1 hover:bg-[var(--color-bg-hover)] rounded-full transition-colors","aria-label":s("actions.clear"),children:n(pa,{class:"w-4 h-4"})}):void 0})}),n(Me,{value:Aa.value,onChange:u=>{Aa.value=u},options:wT.map(u=>({value:u.value,label:u.label()})),size:"sm",align:"right","aria-label":s("skills.clawhub.sortLabel")})]}),xl.value&&n(Hn,{variant:"error",children:xl.value}),gn.value&&xt.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),xt.value.length>0&&n("div",{class:"grid gap-3",children:xt.value.map(u=>n(ET,{skill:u},u.slug))}),!gn.value&&!xl.value&&xt.value.length===0&&n(AT,{}),c&&!gn.value&&n("div",{class:"flex justify-center",children:n(N,{variant:"secondary",onClick:()=>Oi(!0),children:s("actions.showMore")})}),gn.value&&xt.value.length>0&&n("div",{class:"flex justify-center py-4",children:n(te,{size:"md"})}),n(TT,{})]})}const ci=m(!1);function RT({skill:e,onClose:t,onSuccess:r}){if(!e)return null;const a=async o=>{ci.value=!0;try{const l=await O("skills.install",{name:e.name,installId:o,timeoutMs:6e4});l.ok?(J.success(s("skills.installSuccess",{name:e.name})),t(),r()):J.error(l.message||s("skills.installFailed"))}catch(l){J.error(ae(l))}finally{ci.value=!1}};return n(We,{open:!0,onClose:t,title:s("skills.installTitle",{name:e.name}),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("skills.installDescription")}),n("div",{class:"space-y-2",children:e.install.map(o=>n("button",{type:"button",class:"w-full flex items-center gap-3 p-3 rounded-lg border border-[var(--color-border)] hover:bg-[var(--color-bg-tertiary)] transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>a(o.id),disabled:ci.value,children:[n(Ft,{class:"w-5 h-5 text-[var(--color-accent)]"}),n("div",{class:"flex-1",children:[n("div",{class:"font-medium",children:o.label}),o.bins.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[s("skills.providesBins"),": ",o.bins.join(", ")]})]}),ci.value&&n(te,{size:"sm"})]},o.id))})]}),n("div",{class:"mt-6 flex justify-end",children:n(N,{variant:"secondary",onClick:t,children:s("actions.cancel")})})]})}function Sv({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function Yx({skill:e,onInstall:t,bare:r=!1}){const a=bT(e),o=e.install.length>0&&gT(e);return n("div",{class:r?"":"px-4 py-3 bg-[var(--color-bg-tertiary)] border-t border-[var(--color-border)]",children:[n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:e.description}),n("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[n("div",{class:"space-y-2",children:[n(Sv,{label:s("skills.skillKey"),children:n("code",{class:"text-xs bg-[var(--color-bg-primary)] px-1 py-0.5 rounded",children:e.skillKey})}),n(Sv,{label:s("skills.location"),children:n("span",{class:"text-xs break-all",children:e.filePath})}),e.homepage&&n("div",{children:n("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 text-[var(--color-accent)] hover:underline",children:[s("skills.homepage"),n(ws,{class:"w-3 h-3"})]})})]}),n("div",{class:"space-y-2",children:[a.length>0&&n("div",{children:[n("span",{class:"text-[var(--color-warning)] font-medium",children:[s("skills.missingRequirements"),":"]}),n("ul",{class:"list-disc list-inside text-xs mt-1 space-y-0.5",children:a.map(i=>n("li",{children:i},i))})]}),e.blockedByAllowlist&&n("div",{class:"flex items-center gap-2 text-[var(--color-error)]",children:[n(Kk,{class:"w-4 h-4"}),n("span",{children:s("skills.blockedByAllowlist")})]}),o&&n("div",{class:"pt-2",children:n(N,{variant:"secondary",size:"sm",icon:Ft,onClick:()=>t(e),children:s("skills.installDeps")})}),e.primaryEnv&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[s("skills.primaryEnv"),": ",n("code",{children:e.primaryEnv})]})]})]})]})}const MT={"openclaw-bundled":mb,"openclaw-managed":$k,"openclaw-workspace":nc,"openclaw-extra":nc},$T={"openclaw-bundled":"skills.source.bundled","openclaw-managed":"skills.source.managed","openclaw-workspace":"common.workspace","openclaw-extra":"skills.source.extra"};function Xx(e){const t={eligible:{variant:"success",key:"common.eligible"},disabled:{variant:"default",key:"common.disabled"},"missing-reqs":{variant:"warning",key:"common.missingReqs"},blocked:{variant:"error",key:"skills.status.blocked"}},{variant:r,key:a}=t[e];return{variant:r,label:s(a)}}function Zx(e){return MT[e]||sf}function Qx(e){const t=$T[e];return t?s(t):e}function LT({skill:e,onToggleExpand:t,onToggleEnabled:r}){const a=cu(e),o=Xx(a),l=Zx(e.source);return n(Mo,{icon:()=>n("span",{class:"text-lg",children:e.emoji||"🔧"}),iconVariant:a==="eligible"?"success":a==="missing-reqs"?"warning":"default",title:e.name,subtitle:e.description,badges:n(j,{children:[n(X,{variant:o.variant,size:"sm",children:o.label}),e.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:s("common.alwaysActive"),children:"⚡"})]}),meta:[{icon:l,value:Qx(e.source)}],actions:n("div",{onClick:i=>i.stopPropagation(),onKeyDown:i=>i.stopPropagation(),role:"presentation",children:n(Ue,{checked:!e.disabled,onChange:r,size:"sm","aria-label":e.disabled?s("common.enable"):s("common.disable")})}),onClick:t})}function DT({skill:e,isExpanded:t,onToggleExpand:r,onToggleEnabled:a,onInstall:o}){const l=cu(e),i=Xx(l),c=Zx(e.source);return n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",class:"w-full flex items-center gap-4 px-4 py-3 hover:bg-[var(--color-bg-tertiary)] text-left",onClick:r,"aria-expanded":t,children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(ze,{class:"w-4 h-4"}):n(Ye,{class:"w-4 h-4"})}),n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:e.emoji||"🔧"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium truncate",children:e.name}),e.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:s("common.alwaysActive"),children:"⚡"})]}),n("div",{class:"text-sm text-[var(--color-text-muted)] truncate",title:e.description,children:e.description})]}),n("div",{class:"hidden md:flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(c,{class:"w-4 h-4"}),n("span",{children:Qx(e.source)})]}),n("div",{class:"w-24 flex justify-end",children:n(X,{variant:i.variant,children:i.label})}),n("div",{onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),role:"presentation",children:n(Ue,{checked:!e.disabled,onChange:a,size:"sm","aria-label":e.disabled?s("common.enable"):s("common.disable")})})]}),t&&n(Yx,{skill:e,onInstall:o})]})}const PT=[{value:"all",label:()=>s("skills.filters.allSources")},{value:"openclaw-bundled",label:()=>s("skills.source.bundled")},{value:"openclaw-workspace",label:()=>s("common.workspace")},{value:"openclaw-managed",label:()=>s("skills.source.managed")},{value:"openclaw-extra",label:()=>s("skills.source.extra")}],Go=m("installed"),pr=m([]),hh=m(""),ey=m(""),Ur=m(!1),wl=m(null),jr=m(""),or=m("all"),ht=m("all"),$t=m(new Set),ui=m(null),un=m(null),OT=q(()=>{const e=pr.value;let t=0,r=0,a=0;for(const o of e){const l=cu(o);l==="eligible"?t++:l==="disabled"?r++:l==="missing-reqs"&&a++}return{total:e.length,eligible:t,disabled:r,missingReqs:a}}),NT=q(()=>{let e=pr.value;const t=jr.value.toLowerCase().trim();return t&&(e=e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.skillKey.toLowerCase().includes(t))),or.value!=="all"&&(e=e.filter(r=>r.source===or.value)),ht.value!=="all"&&(e=e.filter(r=>cu(r)===ht.value)),e});async function Vu(){Ur.value=!0,wl.value=null;try{const e=await O("skills.status",{});pr.value=e.skills,hh.value=e.workspaceDir,ey.value=e.managedSkillsDir}catch(e){wl.value=ae(e)}finally{Ur.value=!1}}async function _v(e){const t=e.disabled;try{await O("skills.update",{skillKey:e.skillKey,enabled:t}),pr.value=pr.value.map(r=>r.skillKey===e.skillKey?{...r,disabled:!t}:r),J.success(t?s("skills.enabledSuccess",{name:e.name}):s("skills.disabledSuccess",{name:e.name}))}catch(r){J.error(ae(r))}}function FT(e,t=!0){const r=new Set($t.value);r.has(e)?r.delete(e):(r.add(e),t&&kr()),$t.value=r}function zT(){jr.value="",or.value="all",ht.value="all"}const UT=[{id:"installed",label:"Installed",icon:n(mb,{class:"w-4 h-4"})},{id:"clawhub",label:"ClawHub",icon:n(tn,{class:"w-4 h-4"})}];function jT({hasFilters:e}){return n("div",{class:"text-center py-12",children:[n(lt,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:s(e?"skills.noResults":"skills.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s(e?"common.noResultsHint":"skills.emptyDescription")}),e&&n("button",{type:"button",onClick:zT,class:"text-[var(--color-accent)] hover:underline",children:s("common.clearFilters")})]})}function BT(e){const t=!Ur.value&&pr.value.length>0,[r,a]=de("tab"),[o,l]=de("q"),[i,c]=de("source"),[d,u]=de("status"),[h,f,p]=Gl("skill",{ready:t});R(()=>{P.value&&Go.value==="installed"&&Vu()},[P.value]),Fe(r,Go,y=>y),Fe(o,jr,y=>y),Fe(i,or,y=>y),Fe(d,ht,y=>y),En(Go,a,"installed"),va(jr,l),En(or,c,"all"),En(ht,u,"all"),R(()=>{if(t&&h.value.size>0){const y=Array.from(h.value).filter(g=>!$t.value.has(g));if(y.length>0){$t.value=new Set([...$t.value,...h.value]);const g=window.innerWidth<768;if(g){const b=pr.value.find(C=>C.skillKey===y[0]);b&&(un.value=b)}g||setTimeout(()=>{const b=document.querySelectorAll(`[data-skill-key="${y[0]}"]`);Array.from(b).find(x=>x.offsetParent!==null)?.scrollIntoView({behavior:"smooth",block:"center"})},100)}}},[h.value,t]),R(()=>{p.value&&f($t.value)},[$t.value,p.value]);const v=NT.value,w=OT.value,k=Go.value,T=!!jr.value||or.value!=="all"||ht.value!=="all";return n(rn,{viewName:s("common.skills"),children:[n(jt,{title:s("common.skills"),subtitle:s("skills.description"),actions:n(K,{icon:n(Xe,{class:(k==="installed"?Ur.value:gn.value)?"animate-spin":""}),onClick:k==="installed"?Vu:kT,disabled:k==="installed"?Ur.value:gn.value,label:s("actions.refresh")})}),n(Gx,{items:UT.map(y=>({...y,label:y.label})),activeId:k,onChange:y=>Go.value=y}),k==="clawhub"&&n(IT,{}),k==="installed"&&n(j,{children:[wl.value&&n(Hn,{variant:"error",children:wl.value}),Ur.value&&pr.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Ur.value&&!wl.value&&n(j,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(ve,{icon:sf,label:s("common.total"),value:w.total,active:ht.value==="all",onClick:()=>{ht.value="all"}}),n(ve,{icon:Eo,label:s("common.eligible"),value:w.eligible,active:ht.value==="eligible",onClick:()=>{ht.value="eligible"}}),n(ve,{icon:To,label:s("common.disabled"),value:w.disabled,active:ht.value==="disabled",onClick:()=>{ht.value="disabled"}}),n(ve,{icon:Cr,label:s("common.missingReqs"),value:w.missingReqs,active:ht.value==="missing-reqs",highlight:w.missingReqs>0,onClick:()=>{ht.value="missing-reqs"}})]}),n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(Z,{type:"text",placeholder:s("common.searchSkills"),value:jr.value,onInput:y=>{jr.value=y.target.value},leftElement:n(lt,{class:"w-4 h-4"}),class:"flex-1"}),n(Me,{value:or.value,onChange:y=>{or.value=y},options:PT.map(y=>({value:y.value,label:y.label()})),size:"sm",align:"right","aria-label":s("skills.filters.allSources")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:v.length!==w.total?s("skills.filteredCount",{filtered:v.length,total:w.total}):s("skills.count",{count:w.total})})]}),v.length===0?n(G,{padding:"none",children:n(jT,{hasFilters:T})}):n(j,{children:[n("div",{class:"md:hidden space-y-2",children:v.map(y=>n("div",{"data-skill-key":y.skillKey,children:n(LT,{skill:y,onToggleExpand:()=>{const g=new Set($t.value);g.add(y.skillKey),$t.value=g,kr(),un.value=y},onToggleEnabled:()=>_v(y)})},y.skillKey))}),n(G,{padding:"none",class:"hidden md:block overflow-hidden",children:v.map(y=>n("div",{"data-skill-key":y.skillKey,children:n(DT,{skill:y,isExpanded:$t.value.has(y.skillKey),onToggleExpand:()=>FT(y.skillKey),onToggleEnabled:()=>_v(y),onInstall:g=>{ui.value=g}})},y.skillKey))})]}),hh.value&&n("div",{class:"text-xs text-[var(--color-text-muted)] space-y-1",children:[n("div",{children:[s("common.workspace"),": ",n("code",{children:hh.value})]}),n("div",{children:[s("skills.managedDir"),": ",n("code",{children:ey.value})]})]})]})]}),n(We,{open:!!un.value,onClose:()=>{if(un.value){const y=new Set($t.value);y.delete(un.value.skillKey),$t.value=y}un.value=null},title:un.value?.name||"",children:un.value&&n(Yx,{skill:un.value,onInstall:y=>{un.value=null,ui.value=y},bare:!0})}),n(RT,{skill:ui.value,onClose:()=>{ui.value=null},onSuccess:Vu})]})}function HT(e){return e.identity?.name||e.name||e.id}function WT(e){const t=HT(e),r=e.identity?.emoji;return r?`${r} ${t}`:t}const ha=m([]),ty=m("main"),Te=m("main"),bn=m("overview"),uu=m([]),_n=m(""),$a=m(!1),wc=m(null),Nt=m(null),fh=m(!1),kc=m(!1),Is=m(!1),Pt=m({}),yo=m([]),Sc=m(!1),Wa=m(""),_c=m(!1),xa=m(!1),ny=m(null),Jt=m(null),du=m(!1),kl=m(!1),Ql=m(""),es=m(""),ts=m(""),ns=m(""),di=m(!1),Sl=m(!1),_l=m(""),Cl=m(""),rs=m(""),El=m(!1),Tl=m(!1),Al=m(""),Cc=m(!1),Il=m(!1),KT=q(()=>{const e=new Set;return ha.value.filter(t=>{const r=t.workspace||WT(t);return e.has(r)?!1:(e.add(r),!0)})}),$o=q(()=>ha.value.find(e=>e.id===Te.value)??null);function Cv(e){if(e)return typeof e=="string"?e:e.primary}function jf(e){const t=Nt.value;if(!t)return;const r=t.agents?.list?.find(o=>o.id===e),a=Cv(r?.model);return a||Cv(t.agents?.defaults?.model)}async function Rs(){try{const e=await O("agents.list",{});ha.value=e.agents,ty.value=e.defaultId,e.agents.find(t=>t.id===Te.value)||(Te.value=e.defaultId||e.agents[0]?.id||"main")}catch{ha.value=[{id:"main",name:"Main"}]}}async function Lo(){$a.value=!0,wc.value=null;try{const e=await O("agents.files.list",{agentId:Te.value});uu.value=e.files,_n.value=e.workspace}catch(e){wc.value=ae(e),J.error(s("agents.files.loadError"))}finally{$a.value=!1}}async function Zt(){fh.value=!0;try{const e=await O("config.get",{});Nt.value=e.config;const t=e.config.agents?.list?.find(a=>a.id===Te.value);Pt.value={profile:t?.tools?.profile??e.config.tools?.profile??"full",alsoAllow:t?.tools?.alsoAllow??[],deny:t?.tools?.deny??[]},Is.value=!1;const r=t?.skills??null;ny.value=r,Jt.value=r?[...r]:null,xa.value=!1}catch(e){J.error(ae(e))}finally{fh.value=!1}}async function Bf(){Sc.value=!0;try{const e=await O("skills.status",{});yo.value=e.skills}catch(e){J.error(ae(e))}finally{Sc.value=!1}}function Ev(e){const t=Pt.value,r=t.profile??"full",a=t.alsoAllow??[];return(t.deny??[]).includes(e)?!1:a.includes(e)||r==="full"?!0:r==="minimal"?["read","memory_search","memory_get"].includes(e):r==="coding"?["read","write","edit","exec","process","web_search","web_fetch"].includes(e):r==="messaging"?["read","message","sessions_list","sessions_send"].includes(e):!1}function qT(e){Pt.value={...Pt.value,profile:e},Is.value=!0}function GT(e,t){const r={...Pt.value},a=new Set(r.alsoAllow??[]),o=new Set(r.deny??[]);t?(o.delete(e),(r.profile??"full")!=="full"&&a.add(e)):(a.delete(e),o.add(e)),Pt.value={...r,alsoAllow:[...a],deny:[...o]},Is.value=!0}async function VT(){if(Nt.value){kc.value=!0;try{const e={...Nt.value},t=[...e.agents?.list??[]],r=t.findIndex(o=>o.id===Te.value),a={profile:Pt.value.profile,alsoAllow:Pt.value.alsoAllow?.length?Pt.value.alsoAllow:void 0,deny:Pt.value.deny?.length?Pt.value.deny:void 0};r>=0?t[r]={...t[r],tools:a}:t.push({id:Te.value,tools:a}),e.agents={...e.agents,list:t},await O("config.apply",{config:e}),Nt.value=e,Is.value=!1,J.success(s("actions.saved"))}catch(e){J.error(ae(e))}finally{kc.value=!1}}}function JT(e){const t=Jt.value;if(t===null){const r=yo.value.filter(a=>!a.disabled&&a.eligible).map(a=>a.name);Jt.value=r.filter(a=>a!==e)}else t.includes(e)?Jt.value=t.filter(r=>r!==e):Jt.value=[...t,e];xa.value=!0}function YT(){Jt.value=null,xa.value=!0}function XT(){Jt.value=[],xa.value=!0}function ZT(){const e=yo.value.filter(t=>!t.disabled&&t.eligible).map(t=>t.name);Jt.value=e,xa.value=!0}async function QT(){if(Nt.value){_c.value=!0;try{const e={...Nt.value},t=[...e.agents?.list??[]],r=t.findIndex(o=>o.id===Te.value),a=Jt.value;r>=0?(t[r]={...t[r],skills:a??void 0},a===null&&delete t[r].skills):a!==null&&t.push({id:Te.value,skills:a}),e.agents={...e.agents,list:t},await O("config.apply",{config:e}),Nt.value=e,ny.value=Jt.value,xa.value=!1,J.success(s("actions.saved"))}catch(e){J.error(ae(e))}finally{_c.value=!1}}}async function Tv(){const e=$o.value;e&&(Nt.value||await Zt(),Ql.value=e.identity?.name||e.name||"",es.value=e.identity?.avatar||"",ts.value=_n.value||"",ns.value=jf(e.id)||"",du.value=!0)}function eA(){du.value=!1,Ql.value="",es.value="",ts.value="",ns.value=""}async function tA(){const e=$o.value;if(e){kl.value=!0;try{const t={agentId:e.id},r=Ql.value.trim(),a=e.identity?.name||e.name||"";r&&r!==a&&(t.name=r);const o=es.value.trim(),l=e.identity?.avatar||"";o!==l&&(t.avatar=o);const i=ts.value.trim(),c=_n.value||"";i&&i!==c&&(t.workspace=i);const d=ns.value.trim(),u=jf(e.id)||"";d&&d!==u&&(t.model=d),(t.name||t.avatar!==void 0||t.workspace||t.model)&&(await O("agents.update",t),await Rs(),await Lo(),J.success(s("actions.saved"))),du.value=!1}catch(t){J.error(ae(t))}finally{kl.value=!1}}}function nA(){_l.value="",Cl.value="",rs.value="",Sl.value=!0}async function rA(){const e=_l.value.trim(),t=Cl.value.trim();if(!e||!t){J.error(s("agents.create.requiredFields"));return}El.value=!0;try{const r={name:e,workspace:t};rs.value.trim()&&(r.emoji=rs.value.trim());const a=await O("agents.create",r);a.ok&&(await Rs(),Te.value=a.agentId,await Lo(),await Zt(),J.success(s("agents.create.success")),Sl.value=!1)}catch(r){J.error(ae(r))}finally{El.value=!1}}function Av(){Al.value="",Cc.value=!1,Tl.value=!0}async function aA(){const e=$o.value;if(e){if(Al.value!==e.id){J.error(s("agents.delete.confirmMismatch"));return}Il.value=!0;try{await O("agents.delete",{agentId:e.id,deleteFiles:Cc.value}),await Rs();const t=ha.value;t.length>0?Te.value=t[0].id:Te.value="main",await Lo(),await Zt(),J.success(s("agents.delete.success")),Tl.value=!1}catch(t){J.error(ae(t))}finally{Il.value=!1}}}async function oA(){await Rs(),await Lo(),bn.value==="tools"?await Zt():bn.value==="skills"&&(await Zt(),await Bf())}function ry(e){Te.value=e,Lo(),(bn.value==="tools"||bn.value==="skills")&&Zt()}function lA(e){bn.value=e,e==="overview"&&!Nt.value||e==="tools"&&!Nt.value?Zt():e==="skills"&&(yo.value.length===0&&Bf(),Nt.value||Zt())}function Iv(e){Le(`/agents/edit/${encodeURIComponent(e)}?agent=${Te.value}`)}const Vo=m({}),sA={sm:"w-7 h-7 text-base",md:"w-8 h-8 text-lg",lg:"w-16 h-16 text-3xl"},iA={sm:"w-7 h-7",md:"w-8 h-8",lg:"w-16 h-16"};function cA(e){const t=pt.value;return t?`${t.replace(/^ws/,"http")}/avatar/${encodeURIComponent(e)}`:null}function ph({agentId:e,emoji:t="🤖",size:r="md",class:a=""}){const o=cA(e),l=Vo.value[e],i=sA[r],c=iA[r],d=()=>{Vo.value={...Vo.value,[e]:!0}},u=()=>{Vo.value={...Vo.value,[e]:!1}};return n("div",{class:`flex-shrink-0 relative ${a}`,children:[o&&n("img",{src:o,alt:"",class:`${c} rounded-xl object-cover border border-[var(--color-border)] ${l?"":"hidden"}`,onLoad:d,onError:u}),!l&&n("div",{class:`${i} rounded-xl bg-[var(--color-bg-tertiary)] flex items-center justify-center border border-[var(--color-border)]`,children:t})]})}function uA(){const e=$o.value,t=KT.value,r=di.value;if(!e)return null;const a=e.identity?.emoji||"🤖",o=e.identity?.name||e.name||e.id;return n("div",{class:"relative",children:[n("button",{type:"button",onClick:()=>di.value=!r,class:"flex items-center gap-2 sm:gap-3 px-2 sm:px-3 py-2 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-surface)] hover:bg-[var(--color-bg-hover)] transition-colors max-w-[180px] sm:max-w-none sm:min-w-[180px]","aria-expanded":r,"aria-haspopup":"listbox",children:[n(ph,{agentId:e.id,emoji:a,size:"md"}),n("span",{class:"flex-1 text-left font-medium truncate",children:o}),n(ze,{class:`w-4 h-4 text-[var(--color-text-muted)] transition-transform ${r?"rotate-180":""}`})]}),r&&n(j,{children:[n("button",{type:"button",class:"fixed inset-0 z-10 cursor-default",onClick:()=>di.value=!1,"aria-label":"Close menu"}),n("div",{class:"absolute top-full left-0 mt-1 w-full min-w-[220px] py-1 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-surface)] shadow-lg z-20",role:"listbox",children:t.map(l=>{const i=l.identity?.emoji||"🤖",c=l.identity?.name||l.name||l.id,d=l.id===Te.value;return n("button",{type:"button",role:"option","aria-selected":d,onClick:()=>{ry(l.id),di.value=!1},class:`w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-[var(--color-bg-hover)] transition-colors ${d?"bg-[var(--color-bg-tertiary)]":""}`,children:[n(ph,{agentId:l.id,emoji:i,size:"sm"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"font-medium truncate",children:c}),c!==l.id&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:l.id})]}),d&&n(nn,{class:"w-4 h-4 text-[var(--color-accent)] flex-shrink-0"})]},l.id)})})]})]})}function dA(){const e=$o.value;if(!e)return null;const t=e.id===ty.value,r=e.identity?.name||e.name||e.id,a=e.identity?.emoji||"🤖",o=du.value,l=jf(e.id);return n("div",{class:"space-y-4",children:n(G,{children:n("div",{class:"p-4",children:o?n("div",{class:"space-y-4",children:[n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n("div",{children:[n("label",{htmlFor:"edit-name",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("common.name")}),n(Z,{id:"edit-name",type:"text",value:Ql.value,onInput:i=>Ql.value=i.target.value,placeholder:s("agents.overview.namePlaceholder"),class:"mt-1",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"edit-avatar",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("agents.overview.avatar")}),n(Z,{id:"edit-avatar",type:"text",value:es.value,onInput:i=>es.value=i.target.value,placeholder:s("agents.overview.avatarPlaceholder"),class:"mt-1",fullWidth:!0})]})]}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n("div",{children:[n("label",{htmlFor:"edit-workspace",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("common.workspace")}),n(Z,{id:"edit-workspace",type:"text",value:ts.value,onInput:i=>ts.value=i.target.value,placeholder:s("agents.overview.workspacePlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"edit-model",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("common.model")}),n(Z,{id:"edit-model",type:"text",value:ns.value,onInput:i=>ns.value=i.target.value,placeholder:s("agents.overview.modelPlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:s("agents.overview.editHint")}),n("div",{class:"flex gap-2",children:[n("button",{type:"button",onClick:tA,disabled:kl.value,class:"px-3 py-1.5 text-sm font-medium bg-[var(--color-accent)] text-white rounded-lg hover:bg-[var(--color-accent-hover)] disabled:opacity-50",children:kl.value?s("common.saving"):s("actions.save")}),n("button",{type:"button",onClick:eA,disabled:kl.value,class:"px-3 py-1.5 text-sm font-medium text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] rounded-lg",children:s("actions.cancel")})]})]}):n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-4",children:[n("div",{class:"flex items-center gap-3 sm:gap-4",children:[n(ph,{agentId:e.id,emoji:a,size:"lg"}),n("div",{class:"flex-1 min-w-0 sm:hidden",children:n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"text-lg font-semibold truncate max-w-[150px]",children:r}),n("span",{class:"text-xl flex-shrink-0",title:s("agents.overview.identityEmoji"),children:a}),t&&n(X,{variant:"info",size:"sm",children:s("common.defaultAgent")})]})}),n("div",{class:"flex items-center gap-1 sm:hidden ml-auto",children:[n(K,{icon:n(eo,{class:"w-4 h-4"}),label:s("common.edit"),onClick:Tv,variant:"ghost"}),Te.value!=="main"&&n(K,{icon:n(At,{class:"w-4 h-4"}),label:s("actions.delete"),onClick:Av,variant:"ghost",class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})]}),n("div",{class:"hidden sm:block flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("h3",{class:"text-lg font-semibold truncate",children:r}),n("span",{class:"text-xl",title:s("agents.overview.identityEmoji"),children:a}),t&&n(X,{variant:"info",size:"sm",children:s("common.defaultAgent")})]}),n("div",{class:"flex items-center gap-3 mt-1 text-sm text-[var(--color-text-muted)]",children:[n("span",{class:"font-mono truncate",title:_n.value,children:_n.value||"—"}),l&&n(j,{children:[n("span",{children:"•"}),n("span",{class:"truncate",title:l,children:l})]})]})]}),n("div",{class:"sm:hidden text-sm text-[var(--color-text-muted)] space-y-1",children:[n("div",{class:"font-mono truncate",title:_n.value,children:_n.value||"—"}),l&&n("div",{class:"truncate",title:l,children:l})]}),n("div",{class:"hidden sm:flex items-center gap-1",children:[n(K,{icon:n(eo,{class:"w-4 h-4"}),label:s("common.edit"),onClick:Tv,variant:"ghost"}),Te.value!=="main"&&n(K,{icon:n(At,{class:"w-4 h-4"}),label:s("actions.delete"),onClick:Av,variant:"ghost",class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})]})})})})}const Ia={whitespace:/^\s+$/,cjk:/[\u4E00-\u9FFF\u3400-\u4DBF\u3000-\u303F\uFF00-\uFFEF\u30A0-\u30FF\u2E80-\u2EFF\u31C0-\u31EF\u3200-\u32FF\u3300-\u33FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]/,numeric:/^\d+(?:[.,]\d+)*$/,punctuation:/[.,!?;(){}[\]<>:/\\|@#$%^&*+=`~_-]/,alphanumeric:/^[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+$/},hA=new RegExp(`(\\s+|${Ia.punctuation.source}+)`),fA=6,pA=3,mA=[{pattern:/[äöüßẞ]/i,averageCharsPerToken:3},{pattern:/[éèêëàâîïôûùüÿçœæáíóúñ]/i,averageCharsPerToken:3},{pattern:/[ąćęłńóśźżěščřžýůúďťň]/i,averageCharsPerToken:3.5}];function ay(e,t={}){if(!e)return 0;const{defaultCharsPerToken:r=fA,languageConfigs:a=mA}=t,o=e.split(hA).filter(Boolean);let l=0;for(const i of o)l+=vA(i,a,r);return l}function vA(e,t,r){if(Ia.whitespace.test(e))return 0;if(Ia.cjk.test(e))return gA(e);if(Ia.numeric.test(e)||e.length<=pA)return 1;if(Ia.punctuation.test(e))return e.length>1?Math.ceil(e.length/2):1;if(Ia.alphanumeric.test(e)){const o=Rv(e,t)??r;return Math.ceil(e.length/o)}const a=Rv(e,t)??r;return Math.ceil(e.length/a)}function Rv(e,t){for(const r of t)if(r.pattern.test(e))return r.averageCharsPerToken}function gA(e){return Array.from(e).length}function Ec(e){return e.toLowerCase()==="memory.md"?"MEMORY.md":e}const oy={"AGENTS.md":{icon:"📋",description:"agents.files.meta.agents"},"SOUL.md":{icon:"🎭",description:"agents.files.meta.soul"},"TOOLS.md":{icon:"🛠️",description:"agents.files.meta.tools"},"IDENTITY.md":{icon:"🪪",description:"agents.files.meta.identity"},"USER.md":{icon:"👤",description:"agents.files.meta.user"},"HEARTBEAT.md":{icon:"💓",description:"agents.files.meta.heartbeat"},"BOOTSTRAP.md":{icon:"🚀",description:"agents.files.meta.bootstrap"},"MEMORY.md":{icon:"🧠",description:"agents.files.meta.memory"}},Mv=["AGENTS.md","SOUL.md","TOOLS.md","IDENTITY.md","USER.md","HEARTBEAT.md","MEMORY.md","BOOTSTRAP.md"],bA=["BOOTSTRAP.md"];function ly(e){return e.missing?0:e.content?ay(e.content):e.size!=null?Math.round(e.size/4):0}const $v=q(()=>uu.value.reduce((e,t)=>e+ly(t),0));function xA({file:e}){const t=Ec(e.name),r=oy[t]??{icon:"📄",description:"agents.files.meta.unknown"},a=bA.includes(t),o=e.missing&&!a,l=ly(e);return n(G,{padding:"md",class:"hover:bg-[var(--color-bg-hover)] transition-colors cursor-pointer",onClick:()=>Iv(e.name),children:n("div",{class:"flex items-center gap-4",children:[n("div",{class:"text-2xl flex-shrink-0","aria-hidden":"true",children:r.icon}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium",children:e.name}),o&&n(X,{variant:"warning",size:"sm",children:[n(Cr,{class:"w-3 h-3 mr-1"}),s("agents.files.missing")]})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] truncate",children:s(r.description)}),!e.missing&&(e.size!=null||e.updatedAtMs)&&n("div",{class:"sm:hidden text-xs text-[var(--color-text-muted)] mt-0.5",children:[e.size!=null&&xd(e.size),l>0&&` · ${Gi(l)} tokens`,e.updatedAtMs&&` · ${qi(e.updatedAtMs)}`]})]}),!e.missing&&n("div",{class:"hidden sm:flex items-center gap-4 text-sm text-[var(--color-text-muted)] tabular-nums",children:[n("span",{class:"w-16 text-right",children:e.size!=null&&xd(e.size)}),n("span",{class:"w-24 text-right",children:l>0&&`${Gi(l)} tokens`}),n("span",{class:"w-12 text-right",children:e.updatedAtMs&&qi(e.updatedAtMs)})]}),n(K,{icon:e.missing?n(wr,{class:"w-4 h-4"}):n(eo,{class:"w-4 h-4"}),label:e.missing?s("common.create"):s("common.edit"),onClick:i=>{i.stopPropagation(),Iv(e.name)},variant:"ghost"})]})})}function yA(){const e=[...uu.value].sort((t,r)=>{const a=Ec(t.name),o=Ec(r.name),l=Mv.indexOf(a),i=Mv.indexOf(o);return(l===-1?999:l)-(i===-1?999:i)});return n("div",{class:"space-y-4",children:[n("div",{class:"space-y-2",children:e.map(t=>n(xA,{file:t},t.name))}),$v.value>0&&n("div",{class:"flex justify-center",children:n(X,{variant:"default",size:"md",children:s("agents.files.totalTokens",{count:Gi($v.value)})})}),n(Hn,{title:s("agents.files.memoryHint.title"),children:n("ul",{class:"list-disc list-inside space-y-1 text-sm",children:[n("li",{children:s("agents.files.memoryHint.line1")}),n("li",{children:s("agents.files.memoryHint.line2")})]})})]})}const wA=[{value:"full",labelKey:"agents.tools.profiles.full"},{value:"coding",labelKey:"agents.tools.profiles.coding"},{value:"messaging",labelKey:"agents.tools.profiles.messaging"},{value:"minimal",labelKey:"agents.tools.profiles.minimal"}],Ju=[{id:"fs",labelKey:"common.files",tools:[{id:"read",label:"read",descriptionKey:"agents.tools.toolDescriptions.read"},{id:"write",label:"write",descriptionKey:"agents.tools.toolDescriptions.write"},{id:"edit",label:"edit",descriptionKey:"agents.tools.toolDescriptions.edit"}]},{id:"runtime",labelKey:"agents.tools.sections.runtime",tools:[{id:"exec",label:"exec",descriptionKey:"agents.tools.toolDescriptions.exec"},{id:"process",label:"process",descriptionKey:"agents.tools.toolDescriptions.process"}]},{id:"web",labelKey:"agents.tools.sections.web",tools:[{id:"web_search",label:"web_search",descriptionKey:"agents.tools.toolDescriptions.webSearch"},{id:"web_fetch",label:"web_fetch",descriptionKey:"agents.tools.toolDescriptions.webFetch"},{id:"browser",label:"browser",descriptionKey:"agents.tools.toolDescriptions.browser"}]},{id:"memory",labelKey:"agents.tools.sections.memory",tools:[{id:"memory_search",label:"memory_search",descriptionKey:"agents.tools.toolDescriptions.memorySearch"},{id:"memory_get",label:"memory_get",descriptionKey:"agents.tools.toolDescriptions.memoryGet"}]},{id:"sessions",labelKey:"common.sessions",tools:[{id:"sessions_list",label:"sessions_list",descriptionKey:"agents.tools.toolDescriptions.sessionsList"},{id:"sessions_send",label:"sessions_send",descriptionKey:"agents.tools.toolDescriptions.sessionsSend"},{id:"sessions_spawn",label:"sessions_spawn",descriptionKey:"agents.tools.toolDescriptions.sessionsSpawn"}]},{id:"automation",labelKey:"agents.tools.sections.automation",tools:[{id:"message",label:"message",descriptionKey:"agents.tools.toolDescriptions.message"},{id:"cron",label:"cron",descriptionKey:"agents.tools.toolDescriptions.cron"},{id:"gateway",label:"gateway",descriptionKey:"agents.tools.toolDescriptions.gateway"},{id:"nodes",label:"nodes",descriptionKey:"agents.tools.toolDescriptions.nodes"}]}];function kA(){if(fh.value)return n("div",{class:"flex justify-center py-12",children:n(te,{size:"lg"})});const e=Pt.value.profile??"full",t=Ju.flatMap(a=>a.tools).filter(a=>Ev(a.id)).length,r=Ju.flatMap(a=>a.tools).length;return n("div",{class:"space-y-4",children:[n(G,{children:[n("div",{class:"p-4 border-b border-[var(--color-border)] flex items-center justify-between",children:[n("div",{children:[n("h3",{class:"text-base font-semibold",children:s("common.tools")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("agents.tools.enabled",{count:`${t}/${r}`})})]}),Is.value&&n("button",{type:"button",onClick:VT,disabled:kc.value,class:"px-3 py-1.5 text-sm font-medium bg-[var(--color-accent)] text-white rounded-lg hover:bg-[var(--color-accent-hover)] disabled:opacity-50",children:kc.value?s("common.saving"):s("actions.save")})]}),n("div",{class:"p-4",children:[n("span",{class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("agents.tools.profile")}),n(Me,{value:e,options:wA.map(a=>({value:a.value,label:s(a.labelKey)})),onChange:qT,class:"mt-2 w-full","aria-label":s("agents.tools.profile")})]})]}),Ju.map(a=>n(G,{children:[n("div",{class:"p-4 border-b border-[var(--color-border)]",children:n("h4",{class:"text-sm font-semibold",children:s(a.labelKey)})}),n("div",{class:"divide-y divide-[var(--color-border)]",children:a.tools.map(o=>{const l=Ev(o.id);return n("div",{class:"p-4 flex items-center justify-between gap-4 hover:bg-[var(--color-bg-hover)]",children:[n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("code",{class:"text-sm font-medium",children:o.label}),l?n(Eo,{class:"w-4 h-4 text-[var(--color-success)]"}):n(To,{class:"w-4 h-4 text-[var(--color-text-muted)]"})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:s(o.descriptionKey)})]}),n(Ue,{checked:l,onChange:i=>GT(o.id,i)})]},o.id)})})]},a.id))]})}function SA(){const e=yo.value.filter(d=>!d.disabled&&d.eligible),t=Jt.value,r=t!==null,a=new Set(t??[]),o=Wa.value.toLowerCase().trim(),l=o?e.filter(d=>d.name.toLowerCase().includes(o)||d.description.toLowerCase().includes(o)||d.skillKey.toLowerCase().includes(o)):e,i=r?t.length:e.length;function c(d){return r?a.has(d):!0}return Sc.value&&yo.value.length===0?n("div",{class:"flex justify-center py-12",children:n(te,{size:"lg"})}):n("div",{class:"space-y-4",children:[n(G,{children:n("div",{class:"p-4",children:[n("div",{class:"flex items-center justify-between gap-4",children:[n("div",{children:[n("h3",{class:"text-base font-semibold",children:s("agents.skills.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:r?s("agents.skills.usingAllowlist",{allowed:i,total:e.length}):s("agents.skills.usingAll",{count:e.length})})]}),n("div",{class:"flex items-center gap-2",children:[xa.value&&n("button",{type:"button",onClick:QT,disabled:_c.value,class:"px-3 py-1.5 text-sm font-medium bg-[var(--color-accent)] text-white rounded-lg hover:bg-[var(--color-accent-hover)] disabled:opacity-50",children:_c.value?s("common.saving"):s("actions.save")}),n(K,{icon:n(Xe,{class:Sc.value?"animate-spin":""}),label:s("actions.refresh"),onClick:()=>{Bf(),Zt()},variant:"ghost"})]})]}),n("div",{class:"mt-4 flex flex-wrap gap-2",children:[n("button",{type:"button",onClick:YT,disabled:!r,class:`px-3 py-1.5 text-sm rounded-lg border transition-colors ${r?"border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]":"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]"}`,children:s("agents.skills.useAll")}),n("button",{type:"button",onClick:ZT,class:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:s("agents.skills.selectAll")}),n("button",{type:"button",onClick:XT,class:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:s("agents.skills.selectNone")})]}),n("div",{class:"mt-4 relative",children:[n(lt,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Z,{id:"skills-search",type:"text",value:Wa.value,onInput:d=>Wa.value=d.target.value,placeholder:s("common.searchSkills"),class:"pl-9",fullWidth:!0,"aria-label":s("common.searchSkills")})]})]})}),l.length===0?n(G,{children:n("div",{class:"p-8 text-center text-[var(--color-text-muted)]",children:s(o?"agents.skills.noSearchResults":"agents.skills.noSkills")})}):n(G,{padding:"none",children:l.map(d=>{const u=c(d.name);return n("div",{class:"flex items-center gap-3 px-4 py-3 border-b border-[var(--color-border)] last:border-b-0 hover:bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:d.emoji||"🔧"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium truncate",children:d.name}),d.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:s("common.alwaysActive"),children:"⚡"})]}),n("p",{class:"text-xs text-[var(--color-text-muted)] truncate",children:d.description})]}),n("a",{href:`/skills?skill=${encodeURIComponent(d.skillKey)}`,onClick:h=>{h.preventDefault(),Le(`/skills?skill=${encodeURIComponent(d.skillKey)}`)},class:"text-xs text-[var(--color-accent)] hover:underline flex-shrink-0",children:s("agents.skills.details")}),n(Ue,{checked:u,onChange:()=>JT(d.name)})]},d.skillKey)})}),n(Hn,{children:[n("strong",{children:s("agents.skills.useAll")})," ",s("agents.skills.useAllHint"),n("br",{}),n("strong",{children:s("agents.skills.selectSpecific")})," ",s("agents.skills.selectSpecificHint"),n("br",{}),s("agents.skills.globalHint")," ",n("a",{href:"/skills",class:"text-[var(--color-accent)] hover:underline",children:s("common.skills")})," ",s("agents.skills.page"),"."]})]})}function _A(){return n(We,{open:Sl.value,onClose:()=>Sl.value=!1,title:s("common.createAgent"),children:n("div",{class:"space-y-4",children:[n("div",{children:[n("label",{htmlFor:"create-name",class:"text-sm font-medium",children:s("common.name")}),n(Z,{id:"create-name",type:"text",value:_l.value,onInput:e=>_l.value=e.target.value,placeholder:s("agents.create.namePlaceholder"),class:"mt-1",fullWidth:!0}),n("p",{class:"mt-1 text-xs text-[var(--color-text-muted)]",children:s("agents.create.nameHint")})]}),n("div",{children:[n("label",{htmlFor:"create-workspace",class:"text-sm font-medium",children:s("common.workspace")}),n(Z,{id:"create-workspace",type:"text",value:Cl.value,onInput:e=>Cl.value=e.target.value,placeholder:s("agents.create.workspacePlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"create-emoji",class:"text-sm font-medium",children:s("agents.create.emoji")}),n(Z,{id:"create-emoji",type:"text",value:rs.value,onInput:e=>rs.value=e.target.value,placeholder:s("agents.create.emojiPlaceholder"),class:"mt-1",fullWidth:!0})]}),n("div",{class:"flex justify-end gap-2 pt-2",children:[n(N,{variant:"ghost",onClick:()=>Sl.value=!1,disabled:El.value,children:s("actions.cancel")}),n(N,{variant:"primary",onClick:rA,disabled:El.value||!_l.value.trim()||!Cl.value.trim(),children:El.value?s("actions.creating"):s("common.createAgent")})]})]})})}function CA(){const e=$o.value;return n(We,{open:Tl.value,onClose:()=>Tl.value=!1,title:s("common.deleteAgent"),children:n("div",{class:"space-y-4",children:[n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 border border-[var(--color-error)]/20",children:n("div",{class:"flex items-start gap-3",children:[n(Cr,{class:"w-6 h-6 text-[var(--color-error)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("h4",{class:"font-semibold text-[var(--color-error)]",children:s("agents.delete.warning")}),n("p",{class:"mt-1 text-sm text-[var(--color-text-secondary)]",children:s("agents.delete.warningDescription")})]})]})}),n("div",{class:"text-sm",children:[n("p",{class:"font-medium mb-2",children:s("agents.delete.willDelete")}),n("ul",{class:"list-disc list-inside space-y-1 text-[var(--color-text-secondary)]",children:[n("li",{children:s("agents.delete.willDeleteConfig")}),n("li",{children:s("agents.delete.willDeleteBindings")}),n("li",{children:s("agents.delete.willDeleteSessions")})]})]}),n("div",{class:"p-3 rounded-lg border border-[var(--color-border)]",children:n(Db,{checked:Cc.value,onChange:t=>Cc.value=t,label:s("agents.delete.includeFiles"),description:s("agents.delete.includeFilesDescription",{path:_n.value}),class:"text-[var(--color-error)]"})}),n("div",{children:[n("label",{htmlFor:"delete-confirm",class:"text-sm font-medium",children:s("agents.delete.confirmPrompt",{id:e?.id||"agent"})}),n(Z,{id:"delete-confirm",type:"text",value:Al.value,onInput:t=>Al.value=t.target.value,placeholder:e?.id||"agent",class:"mt-1 font-mono",fullWidth:!0})]}),n("div",{class:"flex justify-end gap-2 pt-2",children:[n(N,{variant:"ghost",onClick:()=>Tl.value=!1,disabled:Il.value,children:s("actions.cancel")}),n(N,{variant:"danger",onClick:aA,disabled:Il.value||Al.value!==e?.id,children:Il.value?s("actions.deleting"):s("common.deleteAgent")})]})]})})}const EA=[{id:"overview",label:"common.overview",icon:n(bb,{class:"w-4 h-4"})},{id:"files",label:"common.files",icon:n(en,{class:"w-4 h-4"})},{id:"tools",label:"common.tools",icon:n(yb,{class:"w-4 h-4"})},{id:"skills",label:"common.skills",icon:n(Zc,{class:"w-4 h-4"})}];function TA(e){const t=!$a.value&&ha.value.length>0,[r,a]=de("agent"),[o,l]=de("tab"),[i,c]=de("q");Fe(r,Te,u=>u),Fe(o,bn,u=>u),Fe(i,Wa,u=>u),En(Te,a,"main"),En(bn,l,"overview"),R(()=>{bn.value==="skills"?c(Wa.value||null):i.value&&c(null)},[Wa.value,bn.value]),R(()=>{if(t&&r.value){const u=ha.value.find(h=>h.id===r.value);u&&Te.value!==u.id&&ry(u.id)}},[r.value,t]),R(()=>{P.value&&Rs().then(()=>{Lo(),Zt()})},[P.value]);const d=bn.value;return n(rn,{viewName:s("common.agents"),children:[n(jt,{title:s("common.agents"),subtitle:s("agents.description"),actions:n("div",{class:"flex items-center gap-3",children:[n(uA,{}),n(K,{icon:n(wr,{class:"w-4 h-4"}),label:s("common.createAgent"),onClick:nA,disabled:!P.value,variant:"ghost"}),n(K,{icon:n(Xe,{class:`w-4 h-4 ${$a.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:oA,disabled:$a.value||!P.value,variant:"ghost"})]})}),n(Gx,{items:EA.map(u=>({...u,label:s(u.label)})),activeId:d,onChange:u=>lA(u)}),wc.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:wc.value}),$a.value&&uu.value.length===0?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg"})}):n(j,{children:[d==="overview"&&n(dA,{}),d==="files"&&n(yA,{}),d==="tools"&&n(kA,{}),d==="skills"&&n(SA,{})]}),_n.value&&n("p",{class:"text-xs text-[var(--color-text-muted)] text-center",children:_n.value}),n(_A,{}),n(CA,{})]})}const kt=m(null),sy=m("main"),hu=m(""),St=m(""),Nn=m("view"),mh=m(!1),Rl=m(!1),Tc=m(null),ol=q(()=>St.value!==hu.value),AA=q(()=>{const e=kt.value?.name??"",t=Ec(e);return oy[t]??{icon:"📄",description:"agents.files.meta.unknown"}});function IA(){return new URLSearchParams(window.location.search).get("agent")||"main"}async function RA(e,t){mh.value=!0,Tc.value=null,sy.value=t;try{const r=await O("agents.files.get",{agentId:t,name:e});kt.value=r.file;const a=r.file.content??"";hu.value=a,St.value=a,Nn.value=r.file.missing||!a?"edit":"view"}catch(r){Tc.value=r instanceof Error?r.message:s("agents.files.loadFileError"),J.error(s("agents.files.loadFileError"))}finally{mh.value=!1}}async function Lv(){if(kt.value){Rl.value=!0;try{await O("agents.files.set",{agentId:sy.value,name:kt.value.name,content:St.value}),hu.value=St.value,kt.value={...kt.value,missing:!1,content:St.value,size:new Blob([St.value]).size,updatedAtMs:Date.now()},J.success(s("agents.files.saved"))}catch{J.error(s("agents.files.saveError"))}finally{Rl.value=!1}}}function MA(){ol.value&&!window.confirm(s("agents.files.unsavedWarning"))||(kt.value=null,hu.value="",St.value="",Nn.value="view",Le("/agents"))}function Dv({active:e,onClick:t,icon:r,label:a,indicator:o}){return n("button",{type:"button",onClick:t,class:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${e?"bg-[var(--color-accent)]/10 text-[var(--color-accent)]":"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-hover)]"}`,children:[r,a,o&&n("span",{class:"w-1.5 h-1.5 rounded-full bg-[var(--color-warning)]"})]})}function $A({filename:e}){const t=e?decodeURIComponent(e):"";return R(()=>{if(P.value&&t){const r=IA();RA(t,r)}},[P.value,t]),R(()=>{function r(a){(a.metaKey||a.ctrlKey)&&a.key==="s"&&(a.preventDefault(),Nn.value==="edit"&&ol.value&&!Rl.value&&Lv())}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),n(ru,{viewName:t||s("common.agents"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden",children:[n("div",{class:"flex items-center justify-between gap-4 px-4 sm:px-6 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[n("div",{class:"flex items-center gap-3 min-w-0",children:[n(K,{icon:n(qc,{class:"w-4 h-4"}),label:s("agents.files.backToList"),onClick:MA,variant:"ghost"}),n("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{class:"text-xl","aria-hidden":"true",children:AA.value.icon}),n("h1",{class:"font-semibold truncate",children:e}),ol.value&&n(X,{variant:"warning",size:"sm",children:s("agents.files.unsaved")})]})]}),n("div",{class:"flex items-center gap-2",children:[kt.value&&!kt.value.missing&&n("span",{class:"hidden sm:block text-sm text-[var(--color-text-muted)]",children:[kt.value.size!=null&&xd(kt.value.size),St.value&&n(j,{children:[" • ",Gi(ay(St.value))," tokens"]}),kt.value.updatedAtMs&&n(j,{children:[" • ",qi(kt.value.updatedAtMs)]})]}),Nn.value==="edit"&&n(N,{variant:"primary",size:"sm",icon:n(cf,{class:"w-4 h-4"}),onClick:Lv,disabled:!ol.value||Rl.value,children:Rl.value?s("common.saving"):s("actions.save")})]})]}),n("div",{class:"flex gap-1 px-4 sm:px-6 py-2 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:[n(Dv,{active:Nn.value==="view",onClick:()=>Nn.value="view",icon:n(of,{class:"w-4 h-4"}),label:s("agents.files.view")}),n(Dv,{active:Nn.value==="edit",onClick:()=>Nn.value="edit",icon:n(eo,{class:"w-4 h-4"}),label:s("common.edit"),indicator:ol.value})]}),n("div",{class:"flex-1 overflow-y-auto",children:[Tc.value&&n("div",{class:"m-4 p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Tc.value}),mh.value?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg"})}):Nn.value==="view"?n("div",{class:"p-4 sm:p-6 max-w-4xl mx-auto",children:St.value?n(Es,{content:St.value}):n("p",{class:"text-[var(--color-text-muted)] italic",children:s("agents.files.emptyFile")})}):n("div",{class:"p-4 sm:p-6 h-full",children:n(ro,{value:St.value,onInput:r=>St.value=r.target.value,placeholder:s("agents.files.editPlaceholder"),class:"font-mono text-sm h-full min-h-[400px] resize-none",fullWidth:!0})})]})]})})}function LA(e){const t=Math.floor(e/1e3),r=Math.floor(t/60),a=Math.floor(r/60),o=Math.floor(a/24);if(o>0){const l=a%24;return`${o}d ${l}h`}if(a>0){const l=r%60;return`${a}h ${l}m`}return r>0?`${r}m`:`${t}s`}function at(e){return e==null||!Number.isFinite(e)?"0":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function as(e){return e==null||!Number.isFinite(e)?"$0.00":e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(4)}`:"$0.00"}function DA({healthData:e}){const t=Nh.value;return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-accent)]/10",children:n(la,{class:"w-5 h-5 text-[var(--color-accent)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:s("common.gateway")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:So.value||s("usage.gateway.unknown")})]}),Ot.value&&n(X,{variant:"default",size:"sm",class:"ml-auto",children:Ng(Ot.value)})]}),n("div",{class:"grid grid-cols-2 gap-4",children:[n("div",{class:"flex items-center gap-2",children:[n(ge,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("common.uptime")}),n("div",{class:"font-medium",children:t!=null?LA(t):"-"})]})]}),n("div",{class:"flex items-center gap-2",children:[n(hr,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("common.sessions")}),n("div",{class:"font-medium",children:e?.sessions?.count??"-"})]})]})]}),(dl.value||hl.value)&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)] space-y-2",children:[dl.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(en,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:dl.value})]}),hl.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(Lk,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:hl.value})]})]})]})}function PA({usage:e,isLoading:t}){if(!e)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Dd,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("h3",{class:"font-semibold",children:s("usage.summary.title")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s(t?"common.loading":"usage.summary.unavailable")})]});const r=e.totals;return n(G,{padding:"md",children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-3",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Dd,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:s("usage.summary.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.summary.period",{days:e.days})})]})]}),r.totalCost>0&&n("div",{class:"text-right",children:[n("div",{class:"text-2xl font-bold text-[var(--color-success)]",children:as(r.totalCost)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("common.totalCost")})]})]}),n("div",{class:"grid grid-cols-3 gap-4",children:[n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("common.input")}),n("div",{class:"font-medium",children:at(r.input)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("common.output")}),n("div",{class:"font-medium",children:at(r.output)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("common.total")}),n("div",{class:"font-medium",children:at(r.totalTokens)})]})]}),(r.cacheRead>0||r.cacheWrite>0)&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)]",children:[n("div",{class:"text-sm text-[var(--color-text-muted)] mb-2",children:s("usage.summary.cache")}),n("div",{class:"grid grid-cols-2 gap-4",children:[n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:at(r.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.cacheWrite")}),n("div",{class:"font-medium",children:at(r.cacheWrite)})]})]})]})]})}function OA({usage:e}){if(!e||e.daily.length===0)return null;const t=e.daily.slice(-14),r=Math.max(...t.map(a=>a.totalTokens),1);return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(Co,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("usage.daily.title")})]}),n("div",{class:"space-y-2",children:t.map(a=>{const o=a.totalTokens/r*100,i=new Date(a.date).toLocaleDateString(void 0,{month:"short",day:"numeric"});return n("div",{class:"flex items-center gap-3",children:[n("div",{class:"w-20 text-xs text-[var(--color-text-muted)] truncate",children:i}),n("div",{class:"flex-1 h-4 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:n("div",{class:"h-full bg-[var(--color-accent)] rounded-full transition-all",style:{width:`${Math.max(o,1)}%`}})}),n("div",{class:"w-16 text-xs text-right font-mono",children:at(a.totalTokens)})]},a.date)})})]})}function NA({healthData:e}){return!e?.agents||e.agents.length===0?null:n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-warning)]/10",children:n(tc,{class:"w-5 h-5 text-[var(--color-warning)]"})}),n("h3",{class:"font-semibold",children:s("common.agents")})]}),n("div",{class:"space-y-3",children:e.agents.map(t=>n("div",{class:"flex items-center justify-between py-2 px-3 bg-[var(--color-bg-secondary)] rounded-lg",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium",children:t.name||t.agentId}),t.isDefault&&n(X,{variant:"success",size:"sm",children:s("common.default")})]}),n("div",{class:"flex items-center gap-4 text-sm text-[var(--color-text-muted)]",children:[n("span",{children:[t.sessions.count," ",s("usage.agents.sessions")]}),t.heartbeat.enabled&&n("span",{class:"flex items-center gap-1",children:[n(Rn,{class:"w-3.5 h-3.5"}),t.heartbeat.every]})]})]},t.agentId))})]})}const Ni=m(null),Fi=m(null),ta=m(J0()),ir=m(null),Ml=m(!1),Ac=m(!1),zi=m(!1),Ic=m(null),ar=m(30),La=m("recent"),Jo=m(!0),It=m(0),Yn=5,vh=m("overview"),os=m(null),ls=m([]),$l=m(!1),Ll=m(!1);async function FA(){Ml.value=!0,Ic.value=null;try{const e=await O("health",{probe:!1});Ni.value=e}catch(e){Ic.value=ae(e),J.error(s("usage.loadError"))}finally{Ml.value=!1}}async function iy(e=30){Ac.value=!0,ar.value=e;try{const t=await O("usage.cost",{days:e});Fi.value=t}catch{}finally{Ac.value=!1}zA(e)}async function zA(e=30){if(!zi.value){zi.value=!0;try{const t=new Date,r=new Date;r.setDate(r.getDate()-e);const a=await O("sessions.usage",{startDate:r.toISOString().split("T")[0],endDate:t.toISOString().split("T")[0],limit:100,includeContextWeight:!0});ta.value=a,a&&Y0(a)}catch{ta.value||(ta.value=null)}finally{zi.value=!1}}}async function Pv(){await Promise.all([FA(),iy(ar.value)])}async function UA(e){if(!$l.value){$l.value=!0,os.value=null;try{const t=await O("sessions.usage.timeseries",{key:e});os.value=t}catch{}finally{$l.value=!1}}}async function jA(e){if(!Ll.value){Ll.value=!0,ls.value=[];try{const t=await O("sessions.usage.logs",{key:e,limit:100});ls.value=t?.logs??[]}catch{}finally{Ll.value=!1}}}function BA(){ir.value=null,vh.value="overview",os.value=null,ls.value=[]}function HA(){const e=ta.value,t=ir.value,r=zi.value;if(!e&&r)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(sr,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("common.sessions")}),n(te,{size:"sm"})]}),n("div",{class:"space-y-3",children:[1,2,3].map(u=>n("div",{class:"animate-pulse flex items-center gap-3 p-3 rounded-lg bg-[var(--color-bg-secondary)]",children:[n("div",{class:"w-8 h-8 rounded-lg bg-[var(--color-bg-tertiary)]"}),n("div",{class:"flex-1 space-y-2",children:[n("div",{class:"h-4 bg-[var(--color-bg-tertiary)] rounded w-1/3"}),n("div",{class:"h-3 bg-[var(--color-bg-tertiary)] rounded w-1/4"})]})]},u))})]});if(!e||e.sessions.length===0)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(sr,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("common.sessions")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.sessions.noData")})]});const a=[...e.sessions].sort((u,h)=>{const f=La.value,p=Jo.value;let v=0;return f==="cost"?v=(u.usage.totalCost||0)-(h.usage.totalCost||0):f==="tokens"?v=(u.usage.totalTokens||0)-(h.usage.totalTokens||0):f==="recent"&&(v=(u.updatedAt||0)-(h.updatedAt||0)),p?-v:v}),o=a.slice(It.value*Yn,(It.value+1)*Yn),l=u=>{La.value===u?Jo.value=!Jo.value:(La.value=u,Jo.value=!0),It.value=0},i=({col:u})=>La.value!==u?null:Jo.value?n(ze,{class:"w-3 h-3 inline ml-1"}):n(xs,{class:"w-3 h-3 inline ml-1"}),c=u=>{ir.value=t?.key===u.key?null:u},d=()=>a.length>Yn?n("div",{class:"mt-4 flex items-center justify-between",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.sessions.showing",{from:It.value*Yn+1,to:Math.min((It.value+1)*Yn,a.length),total:a.length})}),n("div",{class:"flex items-center gap-1",children:[n(K,{icon:n(ob,{class:"w-4 h-4"}),label:s("actions.previous"),onClick:()=>{It.value=Math.max(0,It.value-1)},disabled:It.value===0,variant:"ghost",size:"sm"}),n("span",{class:"px-2 text-sm text-[var(--color-text-muted)]",children:[It.value+1," / ",Math.ceil(a.length/Yn)]}),n(K,{icon:n(Ye,{class:"w-4 h-4"}),label:s("actions.next"),onClick:()=>{It.value=Math.min(Math.ceil(a.length/Yn)-1,It.value+1)},disabled:It.value>=Math.ceil(a.length/Yn)-1,variant:"ghost",size:"sm"})]})]}):null;return n(j,{children:[n("div",{class:"md:hidden space-y-2 min-w-0 overflow-hidden",children:[n("div",{class:"flex items-center gap-3 mb-3",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(sr,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("common.sessions")}),r&&n(te,{size:"sm"})]}),o.map(u=>n(Mo,{icon:An,iconVariant:t?.key===u.key?"info":"default",title:u.label||u.key,subtitle:u.model||void 0,meta:[{icon:Rn,value:at(u.usage.totalTokens)},{icon:Dd,value:as(u.usage.totalCost)},...u.updatedAt?[{icon:ge,value:re(new Date(u.updatedAt),{relative:!0})}]:[]],onClick:()=>c(u)},u.key)),n(d,{})]}),n(G,{padding:"md",class:"hidden md:block",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(sr,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("common.sessions")}),r&&n(te,{size:"sm"})]}),n("div",{class:"overflow-x-auto",children:n("table",{class:"w-full text-sm",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)]",children:[n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:s("common.session")}),n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:s("common.model")}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>l("tokens"),children:[s("common.tokens"),n(i,{col:"tokens"})]})}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>l("cost"),children:[s("usage.sessions.cost"),n(i,{col:"cost"})]})}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>l("recent"),children:[s("common.lastActive"),n(i,{col:"recent"})]})})]})}),n("tbody",{children:o.map(u=>{const h=t?.key===u.key;return n("tr",{class:`border-b border-[var(--color-border)] cursor-pointer transition-colors ${h?"bg-[var(--color-accent)]/10":"hover:bg-[var(--color-bg-hover)]"}`,onClick:()=>c(u),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),c(u))},tabIndex:0,"aria-label":s("usage.sessions.viewDetails",{name:u.label||u.key}),children:[n("td",{class:"py-2 px-2 truncate max-w-[200px]",title:u.key,children:u.label||u.key}),n("td",{class:"py-2 px-2 text-[var(--color-text-muted)] truncate max-w-[120px]",title:u.model||void 0,children:u.model||"-"}),n("td",{class:"py-2 px-2 text-right font-mono",children:at(u.usage.totalTokens)}),n("td",{class:"py-2 px-2 text-right font-mono",children:as(u.usage.totalCost)}),n("td",{class:"py-2 px-2 text-right text-[var(--color-text-muted)]",children:u.updatedAt?re(new Date(u.updatedAt),{relative:!0}):"-"})]},u.key)})})]})}),n(d,{})]})]})}function WA(){const e=ir.value,t=vh.value;R(()=>{e&&(t==="timeline"&&!os.value&&!$l.value?UA(e.key):t==="messages"&&ls.value.length===0&&!Ll.value&&jA(e.key))},[e,t]);const r=[{id:"overview",label:s("common.overview")},{id:"timeline",label:s("usage.detail.tabs.timeline")},{id:"messages",label:s("usage.detail.tabs.messages")}];return n(We,{open:!!e,onClose:BA,title:s("common.sessionDetails"),children:e&&n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)] truncate -mt-2",children:e.label||e.key}),n("div",{class:"flex gap-1 border-b border-[var(--color-border)]",role:"tablist",children:r.map(a=>n("button",{type:"button",role:"tab","aria-selected":t===a.id,onClick:()=>{vh.value=a.id},class:`px-3 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${t===a.id?"border-[var(--color-accent)] text-[var(--color-accent)]":"border-transparent text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]"}`,children:a.label},a.id))}),n("div",{role:"tabpanel",children:[t==="overview"&&n(KA,{session:e}),t==="timeline"&&n(qA,{}),t==="messages"&&n(GA,{})]})]})})}function KA({session:e}){const t=e.contextWeight;return n("div",{class:"space-y-4",children:[n("div",{class:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("common.input")}),n("div",{class:"font-medium",children:at(e.usage.input)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("common.output")}),n("div",{class:"font-medium",children:at(e.usage.output)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:at(e.usage.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("common.totalCost")}),n("div",{class:"font-medium text-[var(--color-success)]",children:as(e.usage.totalCost)})]})]}),t&&t.total>0&&n("div",{class:"pt-4 border-t border-[var(--color-border)]",children:[n("h4",{class:"text-sm font-medium mb-3",children:s("usage.detail.contextWeight")}),n("div",{class:"space-y-2",children:[t.systemPrompt!=null&&t.systemPrompt>0&&n(Yo,{label:s("usage.detail.system"),value:t.systemPrompt,total:t.total,color:"var(--color-accent)"}),t.skills!=null&&t.skills>0&&n(Yo,{label:s("common.skills"),value:t.skills,total:t.total,color:"var(--color-success)"}),t.tools!=null&&t.tools>0&&n(Yo,{label:s("common.tools"),value:t.tools,total:t.total,color:"var(--color-warning)"}),t.files!=null&&t.files>0&&n(Yo,{label:s("common.files"),value:t.files,total:t.total,color:"var(--color-info)"}),t.other!=null&&t.other>0&&n(Yo,{label:s("usage.detail.other"),value:t.other,total:t.total,color:"var(--color-text-muted)"})]})]})]})}function qA(){const e=os.value;if($l.value)return n("div",{class:"flex justify-center py-8",children:n(te,{size:"md"})});if(!e||e.points.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:s("usage.detail.noTimeline")});const r=e.points,a=Math.max(...r.map(w=>w.cumulativeTokens)),o=Math.max(...r.map(w=>w.cumulativeCost)),l=400,i=120,c={top:10,right:10,bottom:20,left:40},d=l-c.left-c.right,u=i-c.top-c.bottom,h=w=>c.left+w/(r.length-1)*d,f=w=>c.top+u-w/(a||1)*u,p=r.map((w,k)=>`${k===0?"M":"L"} ${h(k)} ${f(w.cumulativeTokens)}`).join(" "),v=`${p} L ${h(r.length-1)} ${c.top+u} L ${c.left} ${c.top+u} Z`;return n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center justify-between text-xs text-[var(--color-text-muted)]",children:[n("span",{children:s("usage.detail.cumulativeTokens")}),n("span",{children:[at(a)," max"]})]}),n("svg",{viewBox:`0 0 ${l} ${i}`,class:"w-full h-auto",children:[[0,.25,.5,.75,1].map(w=>n("line",{x1:c.left,y1:c.top+u*(1-w),x2:l-c.right,y2:c.top+u*(1-w),stroke:"var(--color-border)","stroke-dasharray":"2,2"},w)),n("path",{d:v,fill:"var(--color-accent)",opacity:"0.2"}),n("path",{d:p,fill:"none",stroke:"var(--color-accent)","stroke-width":"2"}),n("text",{x:c.left,y:i-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"start",children:re(new Date(r[0].timestamp),{relative:!1})}),n("text",{x:l-c.right,y:i-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"end",children:re(new Date(r[r.length-1].timestamp),{relative:!1})})]}),n("div",{class:"grid grid-cols-3 gap-4 pt-2 border-t border-[var(--color-border)]",children:[n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold",children:r.length}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.detail.requests")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold",children:at(a)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.detail.totalTokens")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold text-[var(--color-success)]",children:as(o)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("common.totalCost")})]})]})]})}function GA(){const e=ls.value;if(Ll.value)return n("div",{class:"flex justify-center py-8",children:n(te,{size:"md"})});if(e.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:s("usage.detail.noMessages")});const r={user:"info",assistant:"success",tool:"warning",toolResult:"default"},a={user:s("usage.detail.role.user"),assistant:s("common.assistant"),tool:s("usage.detail.role.tool"),toolResult:s("common.result")};return n("div",{class:"space-y-2 max-h-[300px] overflow-y-auto",children:e.map((o,l)=>n("div",{class:"p-2 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-center justify-between gap-2 mb-1",children:[n("div",{class:"flex items-center gap-2",children:[n(X,{variant:r[o.role],children:a[o.role]||o.role}),o.tokens!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.detail.tokenCount",{count:at(o.tokens)})})]}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:re(new Date(o.timestamp),{relative:!0})})]}),n("p",{class:"text-sm text-[var(--color-text-secondary)] line-clamp-2",children:o.content})]},l))})}function Yo({label:e,value:t,total:r,color:a}){const o=Math.round(t/r*100);return n("div",{class:"flex items-center gap-3",children:[n("div",{class:"w-24 text-xs text-[var(--color-text-muted)]",children:e}),n("div",{class:"flex-1 h-2 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:n("div",{class:"h-full rounded-full transition-all",style:{width:`${o}%`,backgroundColor:a}})}),n("div",{class:"w-16 text-xs text-right",children:[at(t)," (",o,"%)"]})]})}function VA(e){const t=ta.value!==null&&ta.value.sessions.length>0,[r,a,o]=de("session",{ready:t}),[l,i]=de("days"),[c,d]=de("sort");return R(()=>{if(l.value){const u=parseInt(l.value,10);[7,30,90].includes(u)&&ar.value!==u&&(ar.value=u)}},[l.value]),Fe(c,La,u=>u),R(()=>{i(ar.value===30?null:String(ar.value))},[ar.value]),En(La,d,"recent"),R(()=>{if(t&&r.value){const u=ta.value?.sessions.find(h=>h.key===r.value);u&&ir.value?.key!==u.key&&(ir.value=u)}},[r.value,t]),R(()=>{o.value&&a(ir.value?.key??null)},[ir.value,o.value]),R(()=>{P.value&&Pv()},[P.value]),n(rn,{viewName:s("common.usage"),children:[n(jt,{title:s("common.usage"),subtitle:s("usage.description"),actions:n(K,{icon:n(Xe,{class:`w-4 h-4 ${Ml.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:()=>Pv(),disabled:Ml.value||!P.value,variant:"ghost"})}),Ic.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Ic.value}),Ml.value&&!Ni.value||!P.value?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:P.value?void 0:s("status.connecting")})}):n("div",{class:"grid gap-6 md:grid-cols-2",children:[n(DA,{healthData:Ni.value}),n(PA,{usage:Fi.value,isLoading:Ac.value}),n("div",{class:"md:col-span-2",children:n(OA,{usage:Fi.value})}),n("div",{class:"md:col-span-2 min-w-0",children:n(HA,{})}),n("div",{class:"md:col-span-2",children:n(NA,{healthData:Ni.value})})]}),Fi.value&&n("div",{class:"flex justify-center gap-2",children:[7,14,30,90].map(u=>n(N,{variant:ar.value===u?"primary":"ghost",size:"sm",onClick:()=>iy(u),disabled:Ac.value,children:[u,"d"]},u))}),n(WA,{})]})}const Yu={title:"Discord",path:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z",hex:"5865F2"},Xu={title:"Google Chat",path:"M1.637 0C.733 0 0 .733 0 1.637v16.5c0 .904.733 1.636 1.637 1.636h3.955v3.323c0 .804.97 1.207 1.539.638l3.963-3.96h11.27c.903 0 1.636-.733 1.636-1.637V5.592L18.408 0Zm3.955 5.592h12.816v8.59H8.455l-2.863 2.863Z",hex:"34A853"},Zu={title:"Mastodon",path:"M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z",hex:"6364FF"},Qu={title:"Matrix",path:"M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.481.314.448.208.785.582 1.02 1.108.254-.374.6-.706 1.034-.992.434-.287.95-.43 1.546-.43.453 0 .872.056 1.26.167.388.11.716.286.993.53.276.245.489.559.646.951.152.392.23.863.23 1.417v5.728h-2.349V11.52c0-.286-.01-.559-.032-.812a1.755 1.755 0 0 0-.18-.66 1.106 1.106 0 0 0-.438-.448c-.194-.11-.457-.166-.785-.166-.332 0-.6.064-.803.189a1.38 1.38 0 0 0-.48.499 1.946 1.946 0 0 0-.231.696 5.56 5.56 0 0 0-.06.785v4.768h-2.35v-4.8c0-.254-.004-.503-.018-.752a2.074 2.074 0 0 0-.143-.688 1.052 1.052 0 0 0-.415-.503c-.194-.125-.476-.19-.854-.19-.111 0-.259.024-.439.074-.18.051-.36.143-.53.282-.171.138-.319.337-.439.595-.12.259-.18.6-.18 1.02v4.966H5.46V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z",hex:"000000"},ed={title:"Signal",path:"M12 0q-.934 0-1.83.139l.17 1.111a11 11 0 0 1 3.32 0l.172-1.111A12 12 0 0 0 12 0M9.152.34A12 12 0 0 0 5.77 1.742l.584.961a10.8 10.8 0 0 1 3.066-1.27zm5.696 0-.268 1.094a10.8 10.8 0 0 1 3.066 1.27l.584-.962A12 12 0 0 0 14.848.34M12 2.25a9.75 9.75 0 0 0-8.539 14.459c.074.134.1.292.064.441l-1.013 4.338 4.338-1.013a.62.62 0 0 1 .441.064A9.7 9.7 0 0 0 12 21.75c5.385 0 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25m-7.092.068a12 12 0 0 0-2.59 2.59l.909.664a11 11 0 0 1 2.345-2.345zm14.184 0-.664.909a11 11 0 0 1 2.345 2.345l.909-.664a12 12 0 0 0-2.59-2.59M1.742 5.77A12 12 0 0 0 .34 9.152l1.094.268a10.8 10.8 0 0 1 1.269-3.066zm20.516 0-.961.584a10.8 10.8 0 0 1 1.27 3.066l1.093-.268a12 12 0 0 0-1.402-3.383M.138 10.168A12 12 0 0 0 0 12q0 .934.139 1.83l1.111-.17A11 11 0 0 1 1.125 12q0-.848.125-1.66zm23.723.002-1.111.17q.125.812.125 1.66c0 .848-.042 1.12-.125 1.66l1.111.172a12.1 12.1 0 0 0 0-3.662M1.434 14.58l-1.094.268a12 12 0 0 0 .96 2.591l-.265 1.14 1.096.255.36-1.539-.188-.365a10.8 10.8 0 0 1-.87-2.35m21.133 0a10.8 10.8 0 0 1-1.27 3.067l.962.584a12 12 0 0 0 1.402-3.383zm-1.793 3.848a11 11 0 0 1-2.345 2.345l.664.909a12 12 0 0 0 2.59-2.59zm-19.959 1.1L.357 21.48a1.8 1.8 0 0 0 2.162 2.161l1.954-.455-.256-1.095-1.953.455a.675.675 0 0 1-.81-.81l.454-1.954zm16.832 1.769a10.8 10.8 0 0 1-3.066 1.27l.268 1.093a12 12 0 0 0 3.382-1.402zm-10.94.213-1.54.36.256 1.095 1.139-.266c.814.415 1.683.74 2.591.961l.268-1.094a10.8 10.8 0 0 1-2.35-.869zm3.634 1.24-.172 1.111a12.1 12.1 0 0 0 3.662 0l-.17-1.111q-.812.125-1.66.125a11 11 0 0 1-1.66-.125",hex:"3B45FD"},td={title:"Telegram",path:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z",hex:"26A5E4"},nd={title:"WhatsApp",path:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z",hex:"25D366"},JA="M12 2C6.477 2 2 5.813 2 10.5c0 2.34 1.06 4.463 2.777 6.003L3.5 21l5.025-2.512c1.078.327 2.24.512 3.475.512 5.523 0 10-3.813 10-8.5S17.523 2 12 2z",YA=[{path:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z",color:"#E01E5A"},{path:"M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z",color:"#36C5F0"},{path:"M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zm-1.27 0a2.528 2.528 0 0 1-2.522 2.521 2.528 2.528 0 0 1-2.521-2.521V2.522A2.528 2.528 0 0 1 15.164 0a2.528 2.528 0 0 1 2.522 2.522v6.312z",color:"#2EB67D"},{path:"M15.164 18.956a2.528 2.528 0 0 1 2.522 2.522A2.528 2.528 0 0 1 15.164 24a2.528 2.528 0 0 1-2.521-2.522v-2.522h2.521zm0-1.27a2.528 2.528 0 0 1-2.521-2.522 2.528 2.528 0 0 1 2.521-2.521h6.314A2.528 2.528 0 0 1 24 15.164a2.528 2.528 0 0 1-2.522 2.522h-6.314z",color:"#ECB22E"}],XA="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z",ZA="M12 2C6.48 2 2 6.48 2 12c0 2.08.64 4.01 1.73 5.6L2 22l4.4-1.73C8 21.36 9.92 22 12 22c5.52 0 10-4.48 10-10S17.52 2 12 2z",QA=[{cx:7.5,cy:12,r:1.5},{cx:12,cy:12,r:1.5},{cx:16.5,cy:12,r:1.5}],e6={telegram:{path:td.path,hex:td.hex,title:td.title},discord:{path:Yu.path,hex:Yu.hex,title:Yu.title},signal:{path:ed.path,hex:ed.hex,title:ed.title},whatsapp:{path:nd.path,hex:nd.hex,title:nd.title},googlechat:{path:Xu.path,hex:Xu.hex,title:Xu.title},matrix:{path:Qu.path,hex:Qu.hex,title:Qu.title},mastodon:{path:Zu.path,hex:Zu.hex,title:Zu.title},imessage:{path:JA,hex:"34C759",title:"iMessage"},nostr:{path:XA,hex:"8B5CF6",title:"Nostr"}};function t6({channelId:e,size:t=20,class:r,colored:a=!0}){const o=e.toLowerCase();if(o==="slack")return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:r,"aria-label":"Slack",children:[n("title",{children:"Slack"}),YA.map((c,d)=>n("path",{fill:a?c.color:"currentColor",d:c.path},d))]});if(o==="bluebubbles"){const c=a?"#2196F3":"currentColor";return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:r,"aria-label":"BlueBubbles",children:[n("title",{children:"BlueBubbles"}),n("path",{fill:"none",stroke:c,"stroke-width":"2",d:ZA}),QA.map((d,u)=>n("circle",{cx:d.cx,cy:d.cy,r:d.r,fill:c},u))]})}if(o==="webchat")return n(tn,{class:r,style:{width:t,height:t,color:a?"#6366f1":"currentColor"}});const l=e6[o];if(!l)return n(tn,{class:r,style:{width:t,height:t}});const i=a?`#${l.hex}`:"currentColor";return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:r,"aria-label":l.title,children:[n("title",{children:l.title}),n("path",{fill:i,d:l.path})]})}function n6(e){return e.length===0?"not-configured":e.some(l=>l.lastError)?"error":e.some(l=>l.connected)?"connected":e.some(l=>l.enabled!==!1)?e.some(l=>l.configured)?"configured":"not-configured":"disabled"}function r6(e){return e.channelOrder.map(t=>{const r=e.channelAccounts[t]||[];return{id:t,label:e.channelLabels[t]||t,detailLabel:e.channelDetailLabels[t]||e.channelLabels[t]||t,systemImage:e.channelSystemImages[t],summary:e.channels[t]||{},accounts:r,defaultAccountId:e.channelDefaultAccountId[t]||"default",status:n6(r)}})}function cy(e){return e.accounts.reduce((t,r)=>{const a=r.lastInboundAt??0,o=r.lastOutboundAt??0;return Math.max(t,a,o)},0)}const Br=m([]),mn=m(!1),Dl=m(!1),Pl=m(null),xn=m(null),Rc=m(!1);function a6(e){switch(e){case"connected":return{variant:"success",label:s("channels.status.connected")};case"configured":return{variant:"warning",label:s("common.configured")};case"not-configured":return{variant:"default",label:s("channels.status.notConfigured")};case"disabled":return{variant:"default",label:s("common.disabled")};case"error":return{variant:"error",label:s("common.error")}}}async function Ui(e=!1){e?Dl.value=!0:mn.value=!0,Pl.value=null;try{const t=await O("channels.status",{probe:e,timeoutMs:e?15e3:1e4});Br.value=r6(t)}catch(t){Pl.value=ae(t)}finally{mn.value=!1,Dl.value=!1}}async function o6(){if(xn.value){Rc.value=!0;try{await O("common.logout",{channel:xn.value.channel,accountId:xn.value.accountId}),J.success(s("channels.logoutSuccess",{channel:xn.value.label})),xn.value=null,Ui()}catch(e){J.error(ae(e))}finally{Rc.value=!1}}}const l6=q(()=>{const e=Br.value,t=Date.now()-1440*60*1e3;return{total:e.length,active:e.filter(r=>cy(r)>t).length,errors:e.filter(r=>r.status==="error").length}});function s6({account:e,channelId:t,channelLabel:r}){const a=e.connected===!0,o=!!e.lastError,l=e.bot?.username;return n("div",{class:"flex items-center justify-between py-2 px-3 bg-[var(--color-bg-secondary)] rounded-lg",children:[n("div",{class:"flex items-center gap-3 min-w-0",children:[n("div",{class:`w-2 h-2 rounded-full flex-shrink-0 ${o?"bg-[var(--color-error)]":a?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("div",{class:"min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium truncate",children:e.name||e.accountId}),l&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["@",l.replace(/^@/,"")]})]}),o&&n("div",{class:"text-xs text-[var(--color-error)] truncate",children:e.lastError})]})]}),n(K,{icon:n(Fk,{class:"w-3.5 h-3.5"}),label:s("common.logout"),onClick:()=>{xn.value={channel:t,accountId:e.accountId,label:`${r} (${e.name||e.accountId})`}},variant:"ghost",size:"sm"})]})}function i6({channel:e}){const t=a6(e.status),r=cy(e);return n(G,{padding:"md",children:[n("div",{class:"flex items-start gap-3 mb-4",children:[n(t6,{channelId:e.id,size:40}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"font-semibold text-lg",children:e.label}),n(X,{variant:t.variant,size:"sm",children:t.label})]}),n("div",{class:"flex items-center gap-3 mt-1 text-sm text-[var(--color-text-muted)]",children:[r>0&&n("span",{class:"flex items-center gap-1",children:[n(ge,{class:"w-3.5 h-3.5"}),re(r,{relative:!0})]}),n("button",{type:"button",onClick:()=>Le(`/config#channels.${e.id}`),class:"flex items-center gap-1 hover:text-[var(--color-accent)] transition-colors",children:[n(df,{class:"w-3.5 h-3.5"}),s("channels.configure")]}),n("a",{href:`https://docs.openclaw.ai/channels/${e.id}`,target:"_blank",rel:"noopener noreferrer",class:"flex items-center gap-1 hover:text-[var(--color-accent)] transition-colors",children:[s("common.docs"),n(ws,{class:"w-3 h-3"})]})]})]})]}),e.accounts.length>0&&n("div",{class:"space-y-2",children:e.accounts.map(a=>n(s6,{account:a,channelId:e.id,channelLabel:e.label},a.accountId))})]})}function c6(){return xn.value?n(We,{open:!0,onClose:()=>{xn.value=null},title:s("channels.logoutTitle"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-[var(--color-text-secondary)]",children:s("channels.logoutConfirm",{channel:xn.value.label})}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("channels.logoutWarning")})]}),n("div",{class:"flex justify-end gap-3 mt-6",children:[n(N,{variant:"ghost",onClick:()=>{xn.value=null},disabled:Rc.value,children:s("actions.cancel")}),n(N,{variant:"danger",onClick:o6,loading:Rc.value,children:s("common.logout")})]})]}):null}function u6(e){R(()=>{P.value&&Ui()},[P.value]);const t=l6.value;return n(rn,{viewName:s("common.channels"),children:[n(jt,{title:s("common.channels"),subtitle:s("channels.description"),actions:n(j,{children:[n(N,{variant:"secondary",size:"sm",onClick:()=>Ui(!0),disabled:Dl.value||mn.value||!P.value,icon:n(hr,{class:`w-4 h-4 ${Dl.value?"animate-pulse":""}`}),children:Dl.value?s("channels.probing"):s("channels.probe")}),n(K,{icon:n(Xe,{class:`w-4 h-4 ${mn.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:()=>Ui(),disabled:mn.value||!P.value,variant:"ghost"})]})}),P.value&&!mn.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-4",children:[n(ve,{icon:An,label:s("common.total"),value:t.total}),n(ve,{icon:Rn,label:s("channels.stats.active"),value:t.active}),n(ve,{icon:Vc,label:s("channels.stats.errors"),value:t.errors,highlight:t.errors>0})]}),Pl.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Pl.value}),(mn.value||!P.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:P.value?void 0:s("status.connecting")})}),P.value&&!mn.value&&Br.value.length>0&&n("div",{class:"grid gap-4 sm:grid-cols-2",children:Br.value.map(r=>n(i6,{channel:r},r.id))}),P.value&&!mn.value&&Br.value.length===0&&!Pl.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(An,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:s("channels.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("channels.emptyDescription")}),n("a",{href:"https://docs.openclaw.ai/channels",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-2 text-[var(--color-accent)] hover:underline",children:[s("channels.learnMore"),n(ws,{class:"w-4 h-4"})]})]})}),P.value&&!mn.value&&Br.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:s("channels.count",{count:Br.value.length})}),n(c6,{})]})}const fn=m([]),Fn=m(!1),Ol=m(null);function uy(e){const t=e.mode?.toLowerCase()??"",r=e.deviceFamily?.toLowerCase()??"";return t==="gateway"?la:r.includes("iphone")||r.includes("android")?to:r.includes("mac")||r.includes("windows")||r.includes("linux")?qt:tn}function d6(e){return e===void 0?"—":e<60?s("instances.idleSeconds",{count:e}):e<3600?s("instances.idleMinutes",{count:Math.floor(e/60)}):s("instances.idleHours",{count:Math.floor(e/3600)})}function dy(e){return e?e==="gateway"?"success":e==="webchat"||e==="chat"?"warning":"default":"default"}async function rd(){Fn.value=!0,Ol.value=null;try{const e=await O("system-presence",{});fn.value=e??[]}catch(e){Ol.value=ae(e)}finally{Fn.value=!1}}function h6({roles:e,scopes:t}){const r=[...e??[],...t??[]];return r.length===0?null:n("div",{class:"flex flex-wrap items-center gap-1 mt-1",children:r.map(a=>n(X,{variant:"default",size:"sm",children:a},a))})}function f6({presence:e}){const t=uy(e),r=e.mode==="gateway";return n(Mo,{icon:t,iconVariant:r?"success":"default",title:e.host||e.instanceId||"Unknown",subtitle:e.ip,badges:e.mode?n(X,{variant:dy(e.mode),size:"sm",children:e.mode}):null,meta:[{icon:ge,value:re(e.ts,{relative:!0})},...e.platform?[{value:e.platform}]:[]]})}function p6({presence:e}){const t=uy(e),r=e.mode==="gateway";return n("tr",{class:"hover:bg-[var(--color-bg-hover)] transition-colors",children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${r?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(t,{class:`w-4 h-4 ${r?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0",children:[n("div",{class:"font-medium truncate",children:e.host||e.instanceId||"Unknown"}),e.ip&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:e.ip}),n(h6,{roles:e.roles,scopes:e.scopes})]})]})}),n("td",{class:"py-3 px-4",children:e.mode?n(X,{variant:dy(e.mode),size:"sm",children:e.mode}):n("span",{class:"text-[var(--color-text-muted)]",children:"—"})}),n("td",{class:"py-3 px-4",children:[n("div",{class:"text-sm",children:e.platform||"—"}),e.version&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:["v",e.version]})]}),n("td",{class:"py-3 px-4 whitespace-nowrap",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(ge,{class:"w-3.5 h-3.5"}),n("span",{children:re(e.ts,{relative:!0})})]})}),n("td",{class:"py-3 px-4 whitespace-nowrap text-sm text-[var(--color-text-muted)] hidden lg:table-cell",children:d6(e.lastInputSeconds)})]})}function m6(e){R(()=>{P.value&&rd()},[P.value]);const t=fn.value.filter(a=>a.mode==="gateway").length,r=fn.value.filter(a=>a.mode!=="gateway").length;return n(rn,{viewName:s("common.instances"),children:[n(jt,{title:s("common.instances"),subtitle:s("instances.description"),actions:n(K,{icon:n(Xe,{class:`w-4 h-4 ${Fn.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:rd,disabled:Fn.value||!P.value,variant:"ghost"})}),P.value&&!Fn.value&&n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(ve,{icon:tn,label:s("common.total"),value:fn.value.length}),n(ve,{icon:la,label:s("instances.stats.gateways"),value:t}),n(ve,{icon:qt,label:s("instances.stats.clients"),value:r})]}),Ol.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Ol.value}),(Fn.value||!P.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:P.value?void 0:s("status.connecting")})}),P.value&&!Fn.value&&fn.value.length>0&&n(j,{children:[n("div",{class:"md:hidden space-y-2",children:fn.value.map((a,o)=>n(f6,{presence:a},a.instanceId||a.host||o))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:s("instances.columns.instance")}),n("th",{class:"py-3 px-4 font-medium w-24",children:s("instances.columns.mode")}),n("th",{class:"py-3 px-4 font-medium w-40",children:s("common.platform")}),n("th",{class:"py-3 px-4 font-medium w-28",children:s("instances.columns.lastSeen")}),n("th",{class:"py-3 px-4 font-medium w-20 hidden lg:table-cell",children:s("instances.columns.idle")})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:fn.value.map((a,o)=>n(p6,{presence:a},a.instanceId||a.host||o))})]})})]}),P.value&&!Fn.value&&fn.value.length===0&&!Ol.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(tn,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:s("instances.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("instances.emptyDescription")}),n(N,{variant:"secondary",onClick:rd,children:s("actions.refresh")})]})}),P.value&&!Fn.value&&fn.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:s("instances.count",{count:fn.value.length})})]})}const Ov={main:{icon:Zc,color:"success",badgeVariant:"success"},channel:{icon:rc,color:"info",badgeVariant:"info"},cron:{icon:Co,color:"warning",badgeVariant:"warning"},isolated:{icon:sr,color:"text-muted",badgeVariant:"default"}};function cr(e){return Ov[e]??Ov.isolated}function hy(e){return s(`sessions.admin.kinds.${e}`)}const Re=m([]),vt=m(!1),mr=m(null),Zn=m(""),et=m("all"),vr=m(null),Ka=m(!1),gh=m(!1),qa=m(null),Mc=m(""),ss=m(""),is=m("inherit"),cs=m("inherit"),us=m("inherit");function Hf(e){return(e.totalTokens??0).toLocaleString()}function fy(e){const t=e.totalTokens??0,r=e.contextTokens??2e5;return r===0?"0%":`${Math.round(t/r*100)}%`}function py(e){return e.displayName||e.label||e.key.split(":").pop()||e.key}const Pr=q(()=>{let e=Re.value;et.value!=="all"&&(e=e.filter(r=>Jr(r)===et.value));const t=Zn.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=(r.label||r.displayName||"").toLowerCase(),o=r.key.toLowerCase(),l=(r.model||"").toLowerCase(),i=(r.channel||"").toLowerCase();return a.includes(t)||o.includes(t)||l.includes(t)||i.includes(t)})),[...e].sort((r,a)=>{const o=Jr(r)==="main",l=Jr(a)==="main";return o&&!l?-1:l&&!o?1:(a.updatedAt??0)-(r.updatedAt??0)})}),v6=q(()=>{const e={total:0,main:0,channel:0,cron:0,isolated:0};for(const t of Re.value)e.total++,e[Jr(t)]++;return e});async function Nv(){vt.value=!0,mr.value=null;try{const e=await O("sessions.list",{limit:200});Re.value=e.sessions??[]}catch(e){mr.value=ae(e)}finally{vt.value=!1}}function Ga(e){vr.value=e,ss.value=e.label??"",is.value=e.thinking??"inherit",cs.value=e.verbose??"inherit",us.value=e.reasoning??"inherit"}function Nl(){vr.value=null,Ka.value=!1}async function g6(){const e=vr.value;if(e){gh.value=!0;try{const t={};ss.value!==(e.label??"")&&(t.label=ss.value||void 0),is.value!==(e.thinking??"inherit")&&(t.thinking=is.value),cs.value!==(e.verbose??"inherit")&&(t.verbose=cs.value),us.value!==(e.reasoning??"inherit")&&(t.reasoning=us.value),Object.keys(t).length>0&&(await O("sessions.patch",{key:e.key,...t}),Re.value=Re.value.map(r=>r.key===e.key?{...r,...t}:r)),Nl()}catch(t){mr.value=ae(t)}finally{gh.value=!1}}}async function b6(){const e=vr.value;if(e)try{await O("sessions.delete",{key:e.key}),Re.value=Re.value.filter(t=>t.key!==e.key),Nl()}catch(t){mr.value=ae(t)}}function my(e){Le(`/chat/${encodeURIComponent(e)}`)}function x6(e,t){t.stopPropagation(),qa.value=e.key,Mc.value=e.label??""}async function Fv(){const e=qa.value;if(!e)return;const t=Mc.value.trim(),r=Re.value.find(a=>a.key===e);if(!r||t===(r.label??"")){qa.value=null;return}try{await O("sessions.patch",{key:e,label:t||void 0}),Re.value=Re.value.map(a=>a.key===e?{...a,label:t||void 0}:a)}catch(a){mr.value=ae(a)}finally{qa.value=null}}function y6(){qa.value=null}const ad=[{value:"inherit",label:s("sessions.admin.levels.inherit")},{value:"off",label:s("common.off")},{value:"low",label:s("sessions.admin.levels.low")},{value:"medium",label:s("common.medium")},{value:"high",label:s("sessions.admin.levels.high")}];function w6({kind:e,size:t="sm"}){const r=cr(e),a=r.icon,o=t==="md"?"w-6 h-6":"w-4 h-4",l=r.color==="text-muted"?"text-[var(--color-text-muted)]":`text-[var(--color-${r.color})]`;return n(a,{class:`${o} ${l}`})}function vy({kind:e,size:t="sm"}){const r=cr(e),a=t==="md"?"p-3":"p-1.5",o=r.color==="text-muted"?"bg-[var(--color-bg-tertiary)]":`bg-[var(--color-${r.color})]/10`;return n("div",{class:`${a} rounded-lg flex-shrink-0 ${o}`,children:n(w6,{kind:e,size:t})})}function gy({session:e,onDelete:t}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[ps.value&&n(K,{icon:n(An,{class:"w-4 h-4"}),label:s("sessions.admin.openInChat"),size:"sm",variant:"ghost",onClick:r=>{r.stopPropagation(),my(e.key)}}),n(K,{icon:n(At,{class:"w-4 h-4"}),label:s("actions.delete"),size:"sm",variant:"ghost",onClick:t,class:"text-[var(--color-text-muted)] hover:text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})}function k6({session:e}){const t=Jr(e),r=cr(t),a=py(e);return n(Mo,{icon:r.icon,iconVariant:t==="main"?"success":t==="channel"?"info":t==="cron"?"warning":"default",title:a,subtitle:e.key,badges:n(X,{variant:r.badgeVariant,size:"sm",children:hy(t)}),meta:[{icon:ge,value:e.updatedAt?re(e.updatedAt,{relative:!0}):"—"},{icon:cb,value:Hf(e)}],actions:n(gy,{session:e,onDelete:o=>{o.stopPropagation(),Ga(e),Ka.value=!0}}),onClick:()=>Ga(e)})}function S6({session:e}){const t=Jr(e),r=py(e),a=qa.value===e.key;return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>!a&&Ga(e),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&!a&&(o.preventDefault(),Ga(e))},tabIndex:a?-1:0,children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n(vy,{kind:t}),n("div",{class:"min-w-0 flex-1",children:[a?n("div",{class:"flex items-center gap-2",onClick:o=>o.stopPropagation(),onKeyDown:o=>o.stopPropagation(),children:n(Z,{type:"text",value:Mc.value,onInput:o=>Mc.value=o.target.value,onKeyDown:o=>{o.key==="Enter"&&Fv(),o.key==="Escape"&&y6()},onBlur:Fv,placeholder:s("sessions.admin.labelPlaceholder"),class:"h-8 text-sm",autoFocus:!0})}):n("div",{class:"flex items-center gap-2 group/label",children:[n("div",{class:"font-medium truncate",title:r,children:r}),n(K,{icon:n(eo,{class:"w-3 h-3"}),label:s("sessions.admin.editLabel"),size:"sm",variant:"ghost",onClick:o=>x6(e,o),class:"opacity-0 group-hover/label:opacity-100 !p-1 flex-shrink-0"})]}),n("div",{class:"text-xs text-[var(--color-text-muted)] font-mono truncate",title:e.key,children:e.key})]})]})}),n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(tc,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate max-w-[120px]",title:e.model||"Default",children:e.model?e.model.split("/").pop():"Default"})]})}),n("td",{class:"py-3 px-4 whitespace-nowrap",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(ge,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:e.updatedAt?re(e.updatedAt):"—"})]})}),n("td",{class:"py-3 px-4 whitespace-nowrap hidden lg:table-cell",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(cb,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:Hf(e)}),n("span",{class:"text-xs opacity-60",children:["(",fy(e),")"]})]})}),n("td",{class:"py-3 px-4",children:n(gy,{session:e,onDelete:o=>{o.stopPropagation(),Ga(e),Ka.value=!0}})})]})}function _6(){const e=vr.value;if(!e)return null;const t=Jr(e),r=cr(t);return n(We,{open:!!e,onClose:Nl,title:e.label||e.displayName||s("common.sessionDetails"),size:"xl",footer:Ka.value?n(hx,{message:s("common.deleteThisSession"),onCancel:()=>Ka.value=!1,onDelete:b6}):n(fx,{isEdit:!0,onDeleteClick:()=>Ka.value=!0,onCancel:Nl,onSave:g6,isSaving:gh.value}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[n("div",{class:"flex items-start gap-3 p-3 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n(vy,{kind:t,size:"md"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex flex-wrap items-center gap-1.5 sm:gap-2 mb-1",children:[n(X,{variant:r.badgeVariant,size:"sm",children:hy(t)}),e.channel&&n(X,{variant:"default",size:"sm",children:e.channel})]}),n("code",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] break-all",children:e.key})]})]}),n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n("div",{class:"text-center p-2 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-lg sm:text-xl font-bold",children:Hf(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:s("common.tokens")})]}),n("div",{class:"text-center p-2 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-lg sm:text-xl font-bold",children:fy(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:s("sessions.admin.contextUsed")})]}),n("div",{class:"text-center p-2 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-lg sm:text-xl font-bold",children:e.updatedAt?re(e.updatedAt,{relative:!0}):"—"}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:s("common.lastActive")})]})]}),n("div",{class:"space-y-4 sm:space-y-5",children:[n(Oe,{label:s("sessions.admin.label"),hint:s("sessions.admin.labelHelp"),children:n(Z,{value:ss.value,onInput:a=>ss.value=a.target.value,placeholder:s("sessions.admin.labelPlaceholder"),fullWidth:!0})}),n(Oe,{label:s("sessions.admin.overrides"),children:n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(Oe,{label:s("common.thinking"),class:"space-y-1",children:n(Me,{value:is.value,onChange:a=>is.value=a,options:ad})}),n(Oe,{label:s("sessions.admin.verbose"),class:"space-y-1",children:n(Me,{value:cs.value,onChange:a=>cs.value=a,options:ad})}),n(Oe,{label:s("sessions.admin.reasoning"),class:"space-y-1",children:n(Me,{value:us.value,onChange:a=>us.value=a,options:ad})})]})})]}),ps.value&&n(N,{variant:"secondary",fullWidth:!0,icon:n(An,{class:"w-4 h-4"}),onClick:()=>{Nl(),my(e.key)},children:s("sessions.admin.openInChat")})]})})}function C6(e){const[t,r]=de("q"),[a,o]=de("kind"),l=!vt.value&&Re.value.length>0,[i,c,d]=de("session",{ready:l});Fe(t,Zn,h=>h),Fe(a,et,h=>h),va(Zn,r),En(et,o,"all"),R(()=>{if(l&&i.value){const h=Re.value.find(f=>f.key===i.value);h&&vr.value?.key!==h.key&&Ga(h)}},[i.value,l]),R(()=>{d.value&&c(vr.value?.key??null)},[vr.value,d.value]),R(()=>{P.value&&Nv()},[P.value]);const u=v6.value;return n(rn,{viewName:s("common.sessions"),children:[n(jt,{title:s("common.sessions"),subtitle:s("sessions.admin.description"),actions:n(j,{children:[P.value&&!vt.value&&Re.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(lt,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Z,{type:"text",value:Zn.value,onInput:h=>Zn.value=h.target.value,placeholder:s("sessions.admin.searchPlaceholder"),class:"pl-10 w-48 lg:w-64"})]}),n(K,{icon:n(Xe,{class:`w-4 h-4 ${vt.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:Nv,disabled:vt.value||!P.value,variant:"ghost"})]})}),P.value&&!vt.value&&Re.value.length>0&&n("div",{class:"relative md:hidden",children:[n(lt,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Z,{type:"text",value:Zn.value,onInput:h=>Zn.value=h.target.value,placeholder:s("sessions.admin.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),P.value&&!vt.value&&n("div",{class:"flex flex-wrap justify-center sm:grid sm:grid-cols-5 gap-2 sm:gap-3 [&>*]:w-[calc(33.333%-0.375rem)] sm:[&>*]:w-auto",children:[n(ve,{icon:An,label:s("common.total"),value:u.total,active:et.value==="all",onClick:()=>et.value="all"}),n(ve,{icon:cr("main").icon,label:s("common.main"),value:u.main,active:et.value==="main",onClick:()=>et.value="main"}),n(ve,{icon:cr("channel").icon,label:s("common.channel"),value:u.channel,active:et.value==="channel",onClick:()=>et.value="channel"}),n(ve,{icon:cr("cron").icon,label:s("sessions.admin.kinds.cron"),value:u.cron,active:et.value==="cron",onClick:()=>et.value="cron"}),n(ve,{icon:cr("isolated").icon,label:s("common.isolated"),value:u.isolated,active:et.value==="isolated",onClick:()=>et.value="isolated"})]}),mr.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:mr.value}),(vt.value||!P.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:P.value?void 0:s("status.connecting")})}),P.value&&!vt.value&&Pr.value.length>0&&n(j,{children:[n("div",{class:"md:hidden space-y-2",children:Pr.value.map(h=>n(k6,{session:h},h.key))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:s("common.session")}),n("th",{class:"py-3 px-4 font-medium w-32",children:s("common.model")}),n("th",{class:"py-3 px-4 font-medium w-36",children:s("common.lastActive")}),n("th",{class:"py-3 px-4 font-medium w-32 hidden lg:table-cell",children:s("common.tokens")}),n("th",{class:"py-3 px-4 font-medium w-12"})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:Pr.value.map(h=>n(S6,{session:h},h.key))})]})})]}),P.value&&!vt.value&&Re.value.length===0&&!mr.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(An,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:s("sessions.admin.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)]",children:s("sessions.admin.emptyDescription")})]})}),P.value&&!vt.value&&Re.value.length>0&&Pr.value.length===0&&n(G,{children:n("div",{class:"p-12 text-center",children:[n(lt,{class:"w-10 h-10 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:s("sessions.admin.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("common.noResultsHint")}),n(N,{variant:"secondary",size:"sm",onClick:()=>{Zn.value="",et.value="all"},children:s("common.clearFilters")})]})}),P.value&&!vt.value&&Pr.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:Pr.value.length===Re.value.length?s("sessions.admin.count",{count:Re.value.length}):s("sessions.admin.filteredCount",{filtered:Pr.value.length,total:Re.value.length})}),n(_6,{})]})}const bh=m(null),ll=m(null),xh=m(null),E6=m(null),by=typeof BroadcastChannel<"u"?new BroadcastChannel("cove:canvas"):null;by?.addEventListener("message",e=>{if(e.data.type==="canvas-content"){if(e.data.url)bh.value=e.data.url,ll.value=null,xh.value=null;else if(e.data.base64)try{ll.value&&URL.revokeObjectURL(ll.value);const t=Mf(e.data.base64,e.data.mimeType||"image/png");ll.value=t,xh.value=e.data.mimeType,bh.value=null}catch{}}});function zv(e){by?.postMessage({type:"canvas-standalone-status",open:e})}function T6({url:e,blobUrl:t,contentType:r,content:a,iframeRef:o,imgRef:l,largeEmptyState:i=!1}){return t?lE(r)||hv(e)?n("div",{class:"w-full h-full flex items-center justify-center bg-[var(--color-bg-tertiary)] p-4 overflow-auto",children:n("img",{ref:l,src:t,alt:s("canvas.imageAlt"),class:"max-w-full max-h-full object-contain rounded-lg shadow-lg",crossOrigin:"anonymous"})}):n("div",{class:"w-full h-full overflow-hidden",children:n("iframe",{ref:o,src:t,class:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:s("canvas.iframeTitle")})}):e?hv(e)?n("div",{class:"w-full h-full flex items-center justify-center bg-[var(--color-bg-tertiary)] p-4 overflow-auto",children:n("img",{ref:l,src:e,alt:s("canvas.imageAlt"),class:"max-w-full max-h-full object-contain rounded-lg shadow-lg",crossOrigin:"anonymous"})}):n("div",{class:"w-full h-full overflow-hidden",children:n("iframe",{ref:o,src:e,class:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:s("canvas.iframeTitle")})}):a?n("div",{class:"w-full h-full p-4 overflow-auto bg-[var(--color-bg-tertiary)]",dangerouslySetInnerHTML:{__html:a}}):i?n("div",{class:"flex flex-col items-center justify-center h-full gap-4 text-[var(--color-text-muted)] px-6 text-center bg-[var(--color-bg-primary)]",children:[n("div",{class:"text-6xl",children:"🖼️"}),n("p",{class:"text-lg",children:s("canvas.noContent")}),n("p",{class:"text-sm opacity-70",children:s("canvas.noContentHint")})]}):n("div",{class:"flex flex-col items-center justify-center h-full gap-3 text-[var(--color-text-muted)] px-6 text-center",children:[n("p",{class:"text-sm",children:s("canvas.noContent")}),n("p",{class:"text-xs opacity-70",children:s("canvas.noContentHint")})]})}function A6(){return R(()=>{zv(!0);const e=()=>zv(!1);return window.addEventListener("beforeunload",e),()=>{e(),window.removeEventListener("beforeunload",e)}},[]),n("div",{class:"w-screen h-screen overflow-hidden bg-[var(--color-bg-primary)]",children:n(T6,{url:bh.value,blobUrl:ll.value,contentType:xh.value,content:E6.value,largeEmptyState:!0})})}const I6={sm:"text-xs",md:"text-sm",lg:"text-base"};function Wf({children:e,size:t="sm",muted:r=!0,icon:a,iconRight:o,class:l,...i}){return n("button",{type:"button",class:`
|
|
420
|
-
inline-flex items-center gap-1
|
|
421
|
-
${I6[t]}
|
|
422
|
-
${r?"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]":"text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]"}
|
|
423
|
-
transition-colors
|
|
424
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
425
|
-
${l||""}
|
|
426
|
-
`,...i,children:[a&&n("span",{class:"flex-shrink-0",children:a}),e,o&&n("span",{class:"flex-shrink-0",children:o})]})}const R6={success:"bg-[var(--color-success)]/10 text-[var(--color-success)]",error:"bg-[var(--color-error)]/10 text-[var(--color-error)]",warning:"bg-[var(--color-warning)]/10 text-[var(--color-warning)]",info:"bg-[var(--color-accent)]/10 text-[var(--color-accent)]"},M6={sm:{container:"w-10 h-10",icon:"w-5 h-5"},md:{container:"w-12 h-12",icon:"w-6 h-6"},lg:{container:"w-16 h-16",icon:"w-8 h-8"}},$6={success:Eo,error:To,warning:Cr,info:ks};function Uv({variant:e,size:t="lg",class:r}){const{container:a,icon:o}=M6[t],l=$6[e];return n("div",{class:`
|
|
427
|
-
${a}
|
|
428
|
-
rounded-full
|
|
429
|
-
flex items-center justify-center
|
|
430
|
-
${R6[e]}
|
|
431
|
-
${r||""}
|
|
432
|
-
`,children:n(l,{class:o})})}function xy({onBack:e,onNext:t,nextLabel:r,backLabel:a,nextDisabled:o=!1,nextLoading:l=!1,class:i}){return n("div",{class:`flex gap-3 mt-6 ${i||""}`,children:[e&&n(N,{variant:"ghost",onClick:e,icon:n(qc,{class:"w-4 h-4"}),children:a||s("actions.back")}),n(N,{variant:"primary",onClick:t,disabled:o,loading:l,class:e?"flex-1":"w-full",iconRight:n(Gc,{class:"w-4 h-4"}),children:r||s("actions.continue")})]})}function L6({steps:e,current:t,class:r}){const a=e.indexOf(t);return n("div",{class:`flex justify-center gap-2 ${r||""}`,children:e.map((o,l)=>n("div",{class:`h-1.5 rounded-full transition-all duration-300 ${l<=a?"w-8 bg-[var(--color-accent)]":"w-4 bg-[var(--color-border)]"}`},o))})}function D6({onComplete:e,onSkip:t}){const r=ne("welcome"),a=ne(""),o=ne("token"),l=ne(""),i=ne(!0),c=ne(!1),d=ne(!1),u=ne(null),h=ne(!1),f=ne(!1),p=ne(!0),v=ne("single"),w=Pc(()=>{const E=a.value.trim();if(!E||!E.startsWith("ws://")&&!E.startsWith("wss://"))return!1;try{return new URL(E),!0}catch{return!1}}),k=B(!1);cg(()=>{k.current||(k.current=!0,Je.value=!0)},[]),md(()=>{const E=a.value;if(f.value=!1,h.value=!1,!w.value)return;const $=new AbortController,I=setTimeout(async()=>{if($.signal.aborted||a.peek()!==E)return;h.value=!0,u.value=null;const F=await Rp(E,$.signal);!$.signal.aborted&&a.peek()===E&&(h.value=!1,F.ok?(f.value=!0,u.value=null):F.error!=="Aborted"&&(f.value=!1,u.value=F.error||s("onboarding.probeError")))},600);return()=>{clearTimeout(I),$.abort()}});const T=()=>a.value.trim()?w.value?(u.value=null,!0):(u.value=s("onboarding.urlError"),!1):(u.value=s("errors.required"),!1),y=async()=>{c.value=!0,d.value=!1;try{await gs({url:a.value,token:o.value==="token"?l.value:void 0,password:o.value==="password"?l.value:void 0,autoReconnect:!0}),$h({url:a.value,authMode:o.value,rememberMe:i.value,credential:l.value}),Sp(),await Uc(),await Zh(),Qa("main"),await Xh("main"),ef(),tf(),d.value=!0}catch(E){A.auth.error("Connect failed:",E),d.value=!1}finally{c.value=!1}},g=()=>{Za(),d.value=!1,r.value="auth"},b=async()=>{if(!T())return;if(f.value){r.value="auth";return}if(h.value)return;h.value=!0,u.value=null;const E=await Rp(a.value);h.value=!1,E.ok?(f.value=!0,setTimeout(()=>{r.value="auth",f.value=!1},500)):u.value=E.error||s("onboarding.probeError")},C=()=>{r.value==="welcome"?r.value="url":r.value==="url"?b():r.value==="auth"&&(r.value="connect",y())},x=()=>{r.value==="url"?r.value="welcome":r.value==="auth"?r.value="url":r.value==="connect"&&!d.value&&(r.value="auth")},_=()=>{Sp(),t()};return n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-8",children:n("div",{class:"w-full max-w-md mx-auto min-h-full flex flex-col justify-center py-4 sm:py-0",children:[n(L6,{steps:["welcome","url","auth","connect"],current:r.value,class:"mb-4 sm:mb-8"}),r.value==="welcome"&&n(P6,{onNext:C,onSkip:_}),r.value==="url"&&n(O6,{url:a.value,onUrlChange:E=>{a.value=E,u.value=null,f.value=!1},error:u.value,canProceed:w.value,probing:h.value,probeSuccess:f.value,onNext:C,onBack:x,onSkip:_}),r.value==="auth"&&n(N6,{authMode:o.value,onAuthModeChange:E=>o.value=E,credential:l.value,onCredentialChange:E=>l.value=E,rememberMe:i.value,onRememberMeChange:E=>i.value=E,onNext:C,onBack:x}),r.value==="connect"&&n(F6,{connecting:c.value,connected:d.value,error:lr.value,showTour:p.value,onShowTourChange:E=>p.value=E,selectedMode:v.value,onModeChange:E=>{v.value=E,Tn.value=E},onRetry:g,onContinue:()=>{R0(p.value),Tn.value=v.value,e()}})]})})}function P6({onNext:e,onSkip:t}){return n("div",{class:"text-center",children:[n(eu,{size:"lg",class:"mx-auto mb-2 sm:mb-4 w-12 h-12 sm:w-16 sm:h-16"}),n("h1",{class:"text-xl sm:text-2xl font-bold mb-1 sm:mb-2",children:s("onboarding.welcome")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mb-4 sm:mb-8",children:s("onboarding.welcomeSubtitle")}),n("div",{class:"grid gap-2 sm:gap-4 mb-4 sm:mb-8 text-left",children:[n(od,{icon:n(Rn,{class:"w-5 h-5"}),title:s("onboarding.feature1Title"),description:s("onboarding.feature1Desc")}),n(od,{icon:n(Xc,{class:"w-5 h-5"}),title:s("onboarding.feature2Title"),description:s("onboarding.feature2Desc")}),n(od,{icon:n(tn,{class:"w-5 h-5"}),title:s("onboarding.feature3Title"),description:s("onboarding.feature3Desc")})]}),n("div",{class:"space-y-3",children:[n(N,{variant:"primary",onClick:e,fullWidth:!0,iconRight:n(Gc,{class:"w-4 h-4"}),children:s("onboarding.getStarted")}),n(Wf,{onClick:t,children:s("onboarding.skipToLogin")})]})]})}function od({icon:e,title:t,description:r}){return n("div",{class:"flex gap-2 sm:gap-3 p-2 sm:p-3 rounded-lg bg-[var(--color-bg-secondary)]",children:[n("div",{class:"flex-shrink-0 w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-[var(--color-accent)]/10 text-[var(--color-accent)] flex items-center justify-center",children:e}),n("div",{class:"min-w-0",children:[n("h3",{class:"font-medium text-xs sm:text-sm",children:t}),n("p",{class:"text-xs text-[var(--color-text-muted)] line-clamp-2",children:r})]})]})}function O6({url:e,onUrlChange:t,error:r,canProceed:a,probing:o,probeSuccess:l,onNext:i,onBack:c,onSkip:d}){const u=f=>{f.key==="Enter"&&l&&i()},h=()=>{if(o)return n(te,{size:"sm"});if(l)return n(nn,{class:"w-4 h-4 text-[var(--color-success)]"});if(r&&a)return n(Ao,{content:r,placement:"left",children:n("span",{class:"cursor-help",children:n(Vc,{class:"w-4 h-4 text-[var(--color-error)]"})})})};return n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:s("common.connectToGateway")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:s("onboarding.urlSubtitle")}),n(Oe,{label:s("common.gatewayUrl"),htmlFor:"gateway-url",children:n(Z,{id:"gateway-url",type:"url",value:e,onInput:f=>t(f.target.value),onKeyDown:u,placeholder:s("auth.gatewayUrlPlaceholder"),rightElement:h(),autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(Hn,{title:s("onboarding.troubleshootTitle"),items:[s("onboarding.troubleshoot1"),s("onboarding.troubleshoot2"),s("onboarding.troubleshoot3")],class:"mt-3 sm:mt-4 text-xs sm:text-sm"}),n(xy,{onBack:c,onNext:i,nextDisabled:!l}),n("div",{class:"text-center mt-4",children:n(Wf,{onClick:d,disabled:o,children:s("onboarding.skipToLogin")})})]})}function N6({authMode:e,onAuthModeChange:t,credential:r,onCredentialChange:a,rememberMe:o,onRememberMeChange:l,onNext:i,onBack:c}){const d=h=>{h.key==="Enter"&&i()},u=[{value:"token",label:s("common.token")},{value:"password",label:s("common.password")}];return n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:s("onboarding.authTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:s("onboarding.authSubtitle")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(Oe,{label:s("onboarding.authMethod"),children:n(Me,{value:e,onChange:h=>t(h),options:u,"aria-label":s("onboarding.authMethod"),class:"w-full"})}),n(Oe,{label:s(e==="token"?"common.token":"common.password"),htmlFor:"credential",children:n(Ef,{id:"credential",value:r,onInput:h=>a(h.target.value),onKeyDown:d,placeholder:s(e==="token"?"auth.tokenPlaceholder":"auth.passwordPlaceholder"),fullWidth:!0})}),n(Ue,{checked:o,onChange:l,label:s("auth.rememberMe"),description:s("onboarding.rememberMeDesc"),size:"sm"})]}),n(xy,{onBack:c,onNext:i,nextLabel:s("actions.connect")})]})}function F6({connecting:e,connected:t,error:r,showTour:a,onShowTourChange:o,selectedMode:l,onModeChange:i,onRetry:c,onContinue:d}){return n(G,{variant:"elevated",padding:"md",class:"text-center",children:[e&&n(j,{children:[n(te,{size:"md",class:"mx-auto mb-3 sm:mb-4"}),n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:s("common.connecting")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:s("onboarding.connectingDesc")})]}),!e&&t&&n(j,{children:[n(Uv,{variant:"success",size:"sm",class:"mx-auto mb-3 sm:mb-4"}),n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:s("onboarding.success")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-4 sm:mb-6",children:s("onboarding.successDesc")}),n("div",{class:"mb-4 sm:mb-6",children:[n("p",{class:"text-xs sm:text-sm font-medium text-[var(--color-text-primary)] mb-2 sm:mb-3",children:s("onboarding.modeTitle")}),n("div",{class:"grid grid-cols-2 gap-2 sm:gap-3",children:[n("button",{type:"button",onClick:()=>i("single"),class:`p-2 sm:p-4 rounded-lg border-2 text-left transition-colors ${l==="single"?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(An,{class:"w-4 h-4 sm:w-5 sm:h-5 mb-1 sm:mb-2 text-[var(--color-accent)]"}),n("div",{class:"text-xs sm:text-sm font-medium",children:s("onboarding.modeSingle")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:s("onboarding.modeSingleDesc")})]}),n("button",{type:"button",onClick:()=>i("multi"),class:`p-2 sm:p-4 rounded-lg border-2 text-left transition-colors ${l==="multi"?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(Ok,{class:"w-4 h-4 sm:w-5 sm:h-5 mb-1 sm:mb-2 text-[var(--color-accent)]"}),n("div",{class:"text-xs sm:text-sm font-medium",children:s("onboarding.modeMulti")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:s("onboarding.modeMultiDesc")})]})]})]}),n("div",{class:"mb-4 sm:mb-6",children:n("button",{type:"button",onClick:()=>{const u=!Je.value;Je.value=u,u?Lf():Df()},class:`w-full p-3 sm:p-4 rounded-lg border-2 text-left transition-colors flex items-start gap-3 ${Je.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(pb,{class:"w-5 h-5 flex-shrink-0 text-[var(--color-accent)]"}),n("div",{class:"flex-1",children:[n("div",{class:"text-xs sm:text-sm font-medium",children:s("common.enableCanvas")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1",children:s("onboarding.canvasDesc")})]}),n("div",{class:`w-4 h-4 rounded-full border-2 flex-shrink-0 flex items-center justify-center ${Je.value?"border-[var(--color-accent)] bg-[var(--color-accent)]":"border-[var(--color-border)]"}`,children:Je.value&&n(nn,{class:"w-3 h-3 text-white"})})]})}),n("div",{class:"mb-4 sm:mb-6",children:n(Ue,{checked:a,onChange:o,label:s("onboarding.showFeatureTour"),size:"sm"})}),n(N,{variant:"primary",onClick:d,fullWidth:!0,iconRight:n(Gc,{class:"w-4 h-4"}),children:s(a?"actions.continue":"onboarding.startChatting")})]}),!e&&!t&&r&&n(j,{children:[n(Uv,{variant:"error",size:"sm",class:"mx-auto mb-3 sm:mb-4"}),n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:s("onboarding.failed")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-error)] mb-3 sm:mb-4",children:r}),n(Hn,{title:s("onboarding.failedHints"),items:[s("onboarding.hint1"),s("onboarding.hint2"),s("onboarding.hint3"),s("onboarding.hint4")],class:"text-left mb-4 sm:mb-6 text-xs sm:text-sm"}),n(N,{variant:"primary",onClick:c,fullWidth:!0,icon:n(qc,{class:"w-4 h-4"}),children:s("common.tryAgain")})]})]})}const z6=150,U6=300,j6=50,Rt=16,hi=8,B6=8;function H6({steps:e,onComplete:t,spotlightPadding:r=B6}){const a=ne(0),o=ne(0),l=ne(null),i=B(null),c=ne(null),d=ne(!1),u=e[o.value],h=e[a.value],f=a.value===0,p=a.value===e.length-1,v=B(null),w=B(""),k=B(""),T=ee(async()=>{if(!h)return;v.current&&(v.current.style.zIndex=w.current,v.current.style.position=k.current,v.current=null),await new Promise(E=>setTimeout(E,z6)),o.value=a.peek(),h.beforeShow&&await h.beforeShow(),await new Promise(E=>setTimeout(E,j6));const x=document.querySelectorAll(h.target);let _=null;for(const E of x)if(E instanceof HTMLElement&&E.offsetParent!==null){_=E;break}if(_){_.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise($=>setTimeout($,U6)),w.current=_.style.zIndex,k.current=_.style.position,v.current=_,(!_.style.position||_.style.position==="static")&&(_.style.position="relative"),_.style.zIndex="10000";const E=_.getBoundingClientRect();l.value=E}else l.value=null;d.value=!1},[h]);md(()=>{a.value,d.value=!0,T()}),md(()=>{const x=l.value;if(!x||!i.current)return;const E=i.current.getBoundingClientRect(),$={width:window.innerWidth,height:window.innerHeight};let I=h?.placement||"bottom",F=0,L=0;const Y={bottom:{top:x.bottom+r+hi+Rt,left:x.left+x.width/2-E.width/2,fits:x.bottom+r+E.height+Rt<$.height},top:{top:x.top-r-E.height-hi-Rt,left:x.left+x.width/2-E.width/2,fits:x.top-r-E.height-Rt>0},right:{top:x.top+x.height/2-E.height/2,left:x.right+r+hi+Rt,fits:x.right+r+E.width+Rt<$.width},left:{top:x.top+x.height/2-E.height/2,left:x.left-r-E.width-hi-Rt,fits:x.left-r-E.width-Rt>0}},ct=I==="top"?["top","bottom","right","left"]:I==="left"?["left","right","bottom","top"]:I==="right"?["right","left","bottom","top"]:["bottom","top","right","left"];for(const Wn of ct)if(Y[Wn].fits){I=Wn;break}const pe=Y[I];F=pe.top,L=pe.left,L=Math.max(Rt,Math.min(L,$.width-E.width-Rt)),F=Math.max(Rt,Math.min(F,$.height-E.height-Rt));const Tr=I==="bottom"?"top":I==="top"?"bottom":I==="left"?"right":"left";c.value={top:F,left:L,arrowPosition:Tr}}),R(()=>{const x=()=>T();return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[T]),R(()=>()=>{v.current&&(v.current.style.zIndex=w.current,v.current.style.position=k.current)},[]),R(()=>{if(!h?.autoAdvanceWhen)return;const x=setInterval(()=>{h.autoAdvanceWhen?.()&&(p?t():a.value++)},500);return()=>clearInterval(x)},[h,p,t]),R(()=>{const x=_=>{_.key==="Escape"?t():_.key==="ArrowRight"||_.key==="Enter"?p?t():a.value++:_.key==="ArrowLeft"&&!f&&a.value--};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[f,p,t]);const y=()=>{p?t():a.value++},g=()=>{f||a.value--},b=l.value,C=c.value;return Qc(n("div",{class:"fixed inset-0 z-[9999] pointer-events-none",children:[n("svg",{class:"absolute inset-0 w-full h-full pointer-events-none",children:[n("defs",{children:n("mask",{id:"spotlight-mask",children:[n("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),b&&n("rect",{x:b.left-r,y:b.top-r,width:b.width+r*2,height:b.height+r*2,rx:"8",fill:"black"})]})}),n("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"rgba(0, 0, 0, 0.75)",mask:"url(#spotlight-mask)"})]}),b&&n("div",{class:"absolute border-2 border-[var(--color-accent)] rounded-lg pointer-events-none",style:{top:b.top-r,left:b.left-r,width:b.width+r*2,height:b.height+r*2}}),n("div",{ref:i,class:"absolute z-10 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-xl shadow-lg p-4 max-w-sm transition-opacity duration-150",style:{top:C?.top??-9999,left:C?.left??-9999,opacity:C&&!d.value?1:0,pointerEvents:C&&!d.value?"auto":"none"},children:[C&&n("div",{class:`absolute w-3 h-3 bg-[var(--color-bg-surface)] border-[var(--color-border)] transform rotate-45 ${C.arrowPosition==="top"?"-top-1.5 left-1/2 -translate-x-1/2 border-l border-t":C.arrowPosition==="bottom"?"-bottom-1.5 left-1/2 -translate-x-1/2 border-r border-b":C.arrowPosition==="left"?"-left-1.5 top-1/2 -translate-y-1/2 border-l border-b":"-right-1.5 top-1/2 -translate-y-1/2 border-r border-t"}`}),n("div",{class:"text-xs text-[var(--color-text-muted)] mb-2",children:[o.value+1," / ",e.length]}),n("h3",{class:"font-semibold text-[var(--color-text-primary)] mb-1",children:u?.title}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:u?.content}),n("div",{class:"flex items-center justify-between gap-2",children:[n(Wf,{onClick:t,icon:n(pa,{class:"w-3 h-3"}),children:s("tour.skipTour")}),n("div",{class:"flex gap-2",children:[!f&&n(N,{variant:"ghost",size:"sm",onClick:g,icon:n(qc,{class:"w-3 h-3"}),children:s("actions.back")}),n(N,{variant:"primary",size:"sm",onClick:y,iconRight:n(Gc,{class:"w-3 h-3"}),children:s(p?"actions.done":"actions.next")})]})]})]}),n("div",{class:"absolute inset-0",role:"presentation",onClick:x=>{if(b){const _=x.clientX,E=x.clientY;_>=b.left-r&&_<=b.right+r&&E>=b.top-r&&E<=b.bottom+r||(x.preventDefault(),x.stopPropagation())}},onKeyDown:()=>{},style:{pointerEvents:"auto"}})]}),document.body)}function W6(){return[{target:"[data-tour='sessions']",title:s("tour.steps.sessions.title"),content:s("tour.steps.sessions.content"),placement:"right"}]}function jv(){return[{target:"[data-tour='chat-input']",title:s("tour.steps.chatInput.title"),content:s("tour.steps.chatInput.content"),placement:"top"},{target:"[data-tour='model-picker']",title:s("tour.steps.modelPicker.title"),content:s("tour.steps.modelPicker.content"),placement:"top"},{target:"[data-tour='settings']",title:s("common.settings"),content:s("tour.steps.settings.content"),placement:"bottom"}]}function K6(){return{target:"[data-tour='pending-requests']",title:s("tour.steps.canvasPairing.title"),content:s("tour.steps.canvasPairing.content"),placement:"bottom",beforeShow:async()=>{Le("/devices"),await new Promise(e=>setTimeout(e,500))},autoAdvanceWhen:()=>go.value==="paired"}}function Bv(){return{target:"[data-tour='canvas']",title:s("common.canvas"),content:s("tour.steps.canvasButton.content"),placement:"bottom",beforeShow:async()=>{Le("/");for(let e=0;e<20;e++)if(await new Promise(t=>setTimeout(t,100)),document.querySelector("[data-tour='canvas']"))return}}}function q6(e){const t=e==="multi"?[...W6(),...jv()]:jv();return Je.value?go.value==="paired"&&ba.value?[...t,Bv()]:[...t,K6(),Bv()]:t}async function Hv(){try{return(await O("cron.list",{})).jobs||[]}catch{return[]}}const G6=[{id:"chat.abort",label:s("commandPalette.commands.chat.abort"),category:"chat",icon:"⏹",shortcut:"⌘.",action:()=>{const e=tt.value;e&&Zg(e)},keywords:["stop","cancel","halt"]},{id:"chat.clear",label:s("commandPalette.commands.chat.clear"),category:"chat",icon:"🗑",action:()=>{Wc()},keywords:["delete","reset","empty"]},{id:"chat.search",label:s("commandPalette.commands.chat.search"),category:"chat",icon:"🔍",shortcut:"⌘F",action:()=>{Be.value=!0,wn.value=""},keywords:["find","filter"]},{id:"chat.export",label:s("commandPalette.commands.chat.export"),category:"chat",icon:"📄",action:()=>{const e=Ne.value;if(e.length===0)return;const t=["# Chat Export","",`Exported: ${new Date().toLocaleString()}`,"","---",""];for(const i of e){const c=i.role==="user"?"**You**":"**Assistant**";t.push(c),t.push(""),t.push(i.content||""),t.push(""),t.push("---"),t.push("")}const r=t.join(`
|
|
433
|
-
`),a=new Blob([r],{type:"text/markdown"}),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=`chat-${new Date().toISOString().slice(0,10)}.md`,l.click(),URL.revokeObjectURL(o)},keywords:["download","save","markdown"]},{id:"chat.copy-last",label:s("commandPalette.commands.chat.copyLast"),category:"chat",icon:"📋",action:async()=>{const t=[...Ne.value].reverse().find(r=>r.role==="assistant");t?.content&&await navigator.clipboard.writeText(t.content)},keywords:["clipboard"]}],V6=[{id:"session.switch",label:s("commandPalette.commands.session.switch"),category:"session",icon:"🔄",hasSubmenu:!0,getSubmenuItems:()=>{const e=Cn.value;return Et.value.map(t=>({id:t.key,label:t.label||t.key,isActive:t.key===e,description:t.model,action:()=>{Qa(t.key),Le(`/chat/${encodeURIComponent(t.key)}`)}}))},isAvailable:()=>!Ul.value&&Et.value.length>1,keywords:["change","select"]},{id:"session.delete",label:s("commandPalette.commands.session.delete"),category:"session",icon:"🗑",action:async()=>{const e=tt.value;if(e&&confirm(s("common.deleteThisSession")))try{await O("sessions.delete",{sessionKey:e})}catch{}},isAvailable:()=>!Ul.value,keywords:["remove"]},{id:"session.copy-key",label:s("commandPalette.commands.session.copyKey"),category:"session",icon:"🔑",action:async()=>{const e=tt.value;e&&await navigator.clipboard.writeText(e)},keywords:["clipboard"]}],J6=[{id:"model.change",label:s("commandPalette.commands.model.change"),category:"model",icon:"🤖",hasSubmenu:!0,getSubmenuItems:()=>yr.value.map(e=>({id:e.id,label:e.name||e.id,description:e.provider,action:async()=>{const t=tt.value;if(t)try{await O("sessions.patch",{sessionKey:t,model:e.id})}catch{}}})),keywords:["switch","select","ai"]}],Y6=[{id:"cron.run",label:s("commandPalette.commands.cron.run"),category:"cron",icon:"▶️",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await Hv();return e.length===0?[{id:"none",label:s("common.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:t.name||t.id,description:t.enabled?s("common.enabled"):s("common.disabled"),action:async()=>{try{await O("cron.run",{jobId:t.id})}catch{}}}))},isAvailable:()=>P.value,keywords:["trigger","execute","schedule"]},{id:"cron.toggle",label:s("commandPalette.commands.cron.toggle"),category:"cron",icon:"⏯",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await Hv();return e.length===0?[{id:"none",label:s("common.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:`${t.name||t.id}: ${t.enabled?"ON":"OFF"}`,isActive:t.enabled,action:async()=>{try{await O("cron.update",{jobId:t.id,patch:{enabled:!t.enabled}})}catch{}}}))},isAvailable:()=>P.value,keywords:["enable","disable","schedule"]}],X6=[{id:"gateway.restart",label:s("commandPalette.commands.gateway.restart"),category:"gateway",icon:"🔄",action:async()=>{if(confirm(s("commandPalette.confirm.restartGateway")))try{await O("gateway.restart",{})}catch{}},isAvailable:()=>P.value,keywords:["reboot","reload","refresh"]}],Z6=[{id:"settings.theme",label:s("commandPalette.commands.settings.theme"),category:"settings",icon:"🎨",hasSubmenu:!0,getValue:()=>{const e=ft.value;return e.selected==="system"?s("commandPalette.commands.settings.systemTheme"):bd().find(a=>a.id===e.selected)?.name||e.selected},getSubmenuItems:()=>{const e=ft.value.selected,t=bd(),r=[{id:"system",label:s("commandPalette.commands.settings.systemTheme"),isActive:e==="system",action:()=>ul("system")}];for(const a of t)r.push({id:a.id,label:a.name,description:a.appearance==="dark"?s("common.dark"):s("common.light"),isActive:e===a.id,action:()=>ul(a.id)});return r},keywords:["dark","light","appearance","color","dracula","monokai","nord","catppuccin","gruvbox","solarized"]}],Q6=[...G6,...V6,...J6,...Y6,...X6,...Z6];function eI(){return Q6.filter(e=>e.isAvailable?e.isAvailable():!0)}function yh(e){return s(`commandPalette.categories.${e}`)}const tI=["chat","session","model","cron","gateway","settings"],zn=m(!1),yy="cove:command-palette:recent",nI=5;function wy(){try{const e=localStorage.getItem(yy);return e?JSON.parse(e):[]}catch{return[]}}function Wv(e){const t=wy().filter(r=>r!==e);t.unshift(e),localStorage.setItem(yy,JSON.stringify(t.slice(0,nI)))}function ld(e,t){const r=e.toLowerCase(),a=t.toLowerCase();if(a===r)return 100;if(a.startsWith(r))return 90;if(a.includes(r))return 70;let o=0,l=0;for(let i=0;i<a.length&&l<r.length;i++)a[i]===r[l]&&(o+=10,l++);return l===r.length?o:0}function rI(e,t){if(!t)return 0;let r=ld(t,e.label);if(e.keywords)for(const o of e.keywords){const l=ld(t,o);l>r&&(r=l)}const a=ld(t,yh(e.category));return a>r&&(r=a),r}function ky(e){return`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-left transition-colors ${e?"bg-[var(--color-bg-secondary)]":"hover:bg-[var(--color-bg-secondary)]/50"}`}function aI(){const[e,t]=U(""),[r,a]=U(0),[o,l]=U(null),[i,c]=U(!1),d=B(null),u=B(null),h=zn.value,f=eI(),p=wy(),v=we(()=>{if(e)return f.map(x=>({cmd:x,score:rI(x,e)})).filter(({score:x})=>x>0).sort((x,_)=>_.score-x.score).map(({cmd:x})=>x);{const x=p.map(E=>f.find($=>$.id===E)).filter(E=>E!==void 0),_=f.filter(E=>!p.includes(E.id));return[...x,..._]}},[f,p,e]),w=we(()=>e?null:oI(v,p),[v,p,e]),k=we(()=>{if(!o)return[];if(!e)return o.items;const x=e.toLowerCase();return o.items.filter(_=>_.label.toLowerCase().includes(x)||(_.description?.toLowerCase().includes(x)??!1))},[o,e]),T=o?k:v,y=we(()=>{if(o&&k[r])return`cmd-sub-${k[r].id}`;if(v[r])return`cmd-${v[r].id}`},[o,k,v,r]);R(()=>{a(0)},[e,o]),R(()=>{h&&(t(""),a(0),l(null),setTimeout(()=>d.current?.focus(),0))},[h]),R(()=>{const x=_=>{if(zn.value){if(_.key==="Escape"){_.preventDefault(),_.stopPropagation(),o?(l(null),t(""),a(0)):zn.value=!1;return}if(_.key==="ArrowDown"){_.preventDefault(),a(E=>Math.min(E+1,T.length-1));return}if(_.key==="ArrowUp"){_.preventDefault(),a(E=>Math.max(E-1,0));return}if(_.key==="Enter"){if(_.preventDefault(),o){const E=k[r];E&&b(E)}else{const E=v[r];E&&g(E)}return}_.key==="Backspace"&&e===""&&o&&(l(null),a(0))}};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[o,k,v,r,e,T.length]),R(()=>{const x=u.current;if(!x)return;const _=x.querySelector("[aria-selected='true']");_&&_.scrollIntoView({block:"nearest"})},[r]);const g=async x=>{if(x.hasSubmenu&&x.getSubmenuItems){c(!0);try{const _=await x.getSubmenuItems();l({command:x,items:_}),a(0),t("")}finally{c(!1)}}else x.action&&(Wv(x.id),zn.value=!1,await x.action())},b=async x=>{zn.value=!1,o&&Wv(o.command.id),await x.action()};return h?n("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-[12vh] sm:pt-[15vh] animate-fade-in",onClick:()=>{zn.value=!1},onKeyDown:x=>{x.key==="Escape"&&(zn.value=!1)},role:"dialog","aria-modal":"true","aria-label":s("commandPalette.placeholder"),children:[n("div",{class:"absolute inset-0 bg-black/40 backdrop-blur-md","aria-hidden":"true"}),n("div",{class:"relative w-full max-w-xl mx-4 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-xl shadow-soft-xl overflow-hidden animate-scale-in",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:[n("div",{class:"p-3 border-b border-[var(--color-border)]",children:n("div",{class:"flex items-center gap-3 px-4 py-2.5 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)] shadow-soft-sm transition-all duration-200",children:[n("span",{class:"text-[var(--color-text-muted)]","aria-hidden":"true",children:o?"→":"⌘"}),n("input",{ref:d,type:"text",value:e,onInput:x=>t(x.target.value),placeholder:o?`${o.command.label}...`:s("commandPalette.placeholder"),class:"flex-1 bg-transparent text-[var(--color-text-primary)] placeholder:text-[var(--color-text-muted)] selection:bg-[var(--color-accent)]/20 caret-[var(--color-accent)]",style:{border:"none",outline:"none",boxShadow:"none"},autoComplete:"off",autoCorrect:"off",spellcheck:!1,role:"combobox","aria-expanded":"true","aria-controls":"command-list","aria-activedescendant":y}),i&&n("span",{class:"text-[var(--color-text-muted)] text-sm",children:s("common.loading")})]})}),n("div",{ref:u,id:"command-list",class:"max-h-[60vh] overflow-y-auto p-2",role:"listbox","aria-label":o?o.command.label:s("commandPalette.placeholder"),children:o?n("div",{children:k.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:s(e?"commandPalette.noMatches":"common.noItems")}):k.map((x,_)=>n("button",{id:`cmd-sub-${x.id}`,role:"option","aria-selected":_===r,onClick:()=>b(x),class:ky(_===r),children:[n("span",{class:`flex-1 ${x.isActive?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}`,children:x.label}),x.description&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:x.description}),x.isActive&&n("span",{class:"text-[var(--color-accent)]","aria-hidden":"true",children:"✓"})]},x.id))}):e?n("div",{children:v.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:s("commandPalette.noCommands")}):v.map((x,_)=>n(Kv,{command:x,isSelected:_===r,onClick:()=>g(x)},x.id))}):n("div",{children:w&&w.map(x=>n("div",{class:"mb-2",children:[n("div",{class:"px-3 py-1 text-xs font-medium text-[var(--color-text-muted)] uppercase tracking-wider",children:x.label}),x.commands.map(_=>{const E=v.indexOf(_);return n(Kv,{command:_,isSelected:E===r,onClick:()=>g(_)},_.id)})]},x.category))})}),n("div",{class:"flex items-center gap-4 px-4 py-2 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] text-xs text-[var(--color-text-muted)]",children:[n("span",{children:s("commandPalette.hints.navigate")}),n("span",{children:s("commandPalette.hints.select")}),n("span",{children:s(o?"commandPalette.hints.back":"commandPalette.hints.close")})]})]})]}):null}function Kv({command:e,isSelected:t,onClick:r}){const a=e.getValue?.();return n("button",{id:`cmd-${e.id}`,role:"option","aria-selected":t,onClick:r,class:ky(t),children:[e.icon&&n("span",{class:"w-5 text-center","aria-hidden":"true",children:e.icon}),n("span",{class:"flex-1 text-[var(--color-text-primary)]",children:e.label}),a&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:a}),e.hasSubmenu&&n("span",{class:"text-[var(--color-text-muted)]","aria-hidden":"true",children:"→"}),e.shortcut&&!e.hasSubmenu&&n("span",{class:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded",children:e.shortcut})]})}function oI(e,t){const r=[],a=e.filter(l=>t.includes(l.id));a.length>0&&r.push({category:"recent",label:yh("recent"),commands:a});const o=e.filter(l=>!t.includes(l.id));for(const l of tI){const i=o.filter(c=>c.category===l);i.length>0&&r.push({category:l,label:yh(l),commands:i})}return r}function lI(){R(()=>{const e=t=>{t.key==="k"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),t.stopPropagation(),zn.value=!zn.value)};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[])}const qv=m(null);function sI(){R(()=>{Bi(()=>import("./CanvasPanel-DUKhqntE.js"),[]).then(t=>{qv.value=t.CanvasPanel})},[]);const e=qv.value;return e?n(e,{}):null}u1();const wh=Nc(),iI=m(!!(wh?.url&&wh.rememberMe)),Gv=m(!1),fi=m(!I0()&&!wh?.url),sd=m(!1),pi=m(null);function cI(){R(()=>{b1(),ow(),hI().finally(()=>{Gv.value=!0})},[]),lI();const e=()=>{fi.value=!1,M0()&&setTimeout(()=>{pi.value=q6(Tn.value),sd.value=!0},500)},t=()=>{fi.value=!1},r=()=>{sd.value=!1,pi.value=null},a=Pe.value==="reconnecting",o=!fi.value&&!a&&(Gv.value?!P.value:!iI.value);if(window.location.pathname==="/canvas")return n(hm,{children:n(gm,{onError:c=>J.error(`Error: ${c.message}`),children:n(A6,{})})});let i;return fi.value?i=n(D6,{onComplete:e,onSkip:t}):o?i=n(V5,{}):i=n(dI,{}),n(hm,{children:[n(gm,{onError:c=>{J.error(`Error: ${c.message}`)},children:n(R3,{children:i})}),n(O3,{position:"top-right"}),n(aI,{}),n(sI,{}),sd.value&&pi.value&&n(H6,{steps:pi.value,onComplete:r})]})}function uI(e){const t=e.url.split("?")[0];t==="/settings"&&!Bn.value.startsWith("/settings")&&(rb.value=Bn.value),Bn.value=t}function dI(){return n(Cg,{onChange:uI,children:[n(ei,{path:"/"}),n(ei,{path:"/chat"}),n(ei,{path:"/chat/:sessionKey"}),n(nC,{path:"/overview"}),n(VA,{path:"/usage"}),n(u6,{path:"/channels"}),n(m6,{path:"/instances"}),n(C6,{path:"/sessions"}),n(CC,{path:"/cron"}),n(BT,{path:"/skills"}),n(TA,{path:"/agents"}),n($A,{path:"/agents/edit/:filename"}),n(vT,{path:"/devices"}),n(bE,{path:"/settings"}),n(VC,{path:"/config"}),n(KE,{path:"/debug"}),n(eT,{path:"/logs"}),n(ei,{default:!0})]})}async function hI(){const e=Nc();if(!e?.url||!e.rememberMe)return;const t=Dh();if(t)try{await gs({url:e.url,token:e.authMode==="token"?t:void 0,password:e.authMode==="password"?t:void 0,autoReconnect:!0}),await Uc(),await nb(),await Zh(),Qa("main"),await Xh("main"),ef(),tf(),K3(),Bi(async()=>{const{canvasNodeEnabled:r}=await Promise.resolve().then(()=>nw);return{canvasNodeEnabled:r}},void 0).then(({canvasNodeEnabled:r})=>{r.value&&Bi(()=>Promise.resolve().then(()=>Lx),void 0).then(a=>a.startNodeConnection())})}catch{Lh("")}}hd(n(cI,{}),document.querySelector("#app"));export{B as A,fI as B,T6 as C,xI as D,ws as E,zk as F,j as G,A3 as H,K as I,eh as J,m as K,yI as L,mI as M,pa as X,Od as a,za as b,M as c,Ra as d,lc as e,vI as f,pI as g,kI as h,zb as i,gI as j,bI as k,U as l,Ta as m,Ii as n,Ri as o,Pd as p,ee as q,Kl as r,Yr as s,Xr as t,su as u,sE as v,n as w,s as x,R as y,wI as z};
|