@maudecode/cove 2026.2.6-3 → 2026.2.13
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/README.md +8 -5
- package/bin/cove.js +46 -0
- package/dist/assets/CanvasPanel-B6DhcK2j.js +12 -0
- package/dist/assets/index-B3H4uilc.js +426 -0
- package/dist/assets/index-CzHQWoDQ.css +1 -0
- package/dist/index.html +4 -3
- package/package.json +13 -5
- package/dist/assets/index-BhqyvNT-.css +0 -1
- package/dist/assets/index-DiGQZJ-4.js +0 -423
|
@@ -1,423 +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 s of l.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).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 Fo,q,Ep,Ap,Yn,th,Mp,Rp,Ip,wu,uc,dc,$p,vo={},Dp=[],zg=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Po=Array.isArray;function Vt(e,t){for(var r in t)e[r]=t[r];return e}function ku(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vn(e,t,r){var a,o,l,s={};for(l in t)l=="key"?a=t[l]:l=="ref"?o=t[l]:s[l]=t[l];if(arguments.length>2&&(s.children=arguments.length>3?Fo.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(l in e.defaultProps)s[l]===void 0&&(s[l]=e.defaultProps[l]);return Ba(e,s,a,o,null)}function Ba(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??++Ep,__i:-1,__u:0};return o==null&&q.vnode!=null&&q.vnode(l),l}function K(e){return e.children}function ht(e,t){this.props=e,this.context=t}function Br(e,t){if(t==null)return e.__?Br(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"?Br(e):null}function Lp(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 Lp(e)}}function hc(e){(!e.__d&&(e.__d=!0)&&Yn.push(e)&&!ls.__r++||th!=q.debounceRendering)&&((th=q.debounceRendering)||Mp)(ls)}function ls(){for(var e,t,r,a,o,l,s,c=1;Yn.length;)Yn.length>c&&Yn.sort(Rp),e=Yn.shift(),c=Yn.length,e.__d&&(r=void 0,a=void 0,o=(a=(t=e).__v).__e,l=[],s=[],t.__P&&((r=Vt({},a)).__v=a.__v+1,q.vnode&&q.vnode(r),_u(t.__P,r,a,t.__n,t.__P.namespaceURI,32&a.__u?[o]:null,l,o??Br(a),!!(32&a.__u),s),r.__v=a.__v,r.__.__k[r.__i]=r,Fp(l,r,s),a.__e=a.__=null,r.__e!=o&&Lp(r)));ls.__r=0}function Np(e,t,r,a,o,l,s,c,d,u,h){var f,p,g,k,_,T,C,m=a&&a.__k||Dp,b=t.length;for(d=Ug(r,t,m,d,b),f=0;f<b;f++)(g=r.__k[f])!=null&&(p=g.__i==-1?vo:m[g.__i]||vo,g.__i=f,T=_u(e,g,p,o,l,s,c,d,u,h),k=g.__e,g.ref&&p.ref!=g.ref&&(p.ref&&Su(p.ref,null,g),h.push(g.ref,g.__c||k,g)),_==null&&k!=null&&(_=k),(C=!!(4&g.__u))||p.__k===g.__k?d=Op(g,d,e,C):typeof g.type=="function"&&T!==void 0?d=T:k&&(d=k.nextSibling),g.__u&=-7);return r.__e=_,d}function Ug(e,t,r,a,o){var l,s,c,d,u,h=r.length,f=h,p=0;for(e.__k=new Array(o),l=0;l<o;l++)(s=t[l])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[l]=Ba(null,s,null,null,null):Po(s)?s=e.__k[l]=Ba(K,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[l]=Ba(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[l]=s,d=l+p,s.__=e,s.__b=e.__b+1,c=null,(u=s.__i=Hg(s,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 s.type!="function"&&(s.__u|=4)):u!=d&&(u==d-1?p--:u==d+1?p++:(u>d?p--:p++,s.__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=Br(c)),zp(c,c));return a}function Op(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=Op(o[l],t,r,a));return t}e.__e!=t&&(a&&(t&&e.type&&!t.parentNode&&(t=Br(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function or(e,t){return t=t||[],e==null||typeof e=="boolean"||(Po(e)?e.some(function(r){or(r,t)}):t.push(e)),t}function Hg(e,t,r,a){var o,l,s,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[s=o>=0?o--:l++])!=null&&(2&u.__u)==0&&c==u.key&&d==u.type)return s}return-1}function nh(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||zg.test(t)?r:r+"px"}function il(e,t,r,a,o){var l,s;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||nh(e.style,t,"");if(r)for(t in r)a&&r[t]==a[t]||nh(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")l=t!=(t=t.replace(Ip,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+l]=r,r?a?r.u=a.u:(r.u=wu,e.addEventListener(t,l?dc:uc,l)):e.removeEventListener(t,l?dc:uc,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 rh(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=wu++;else if(t.t<r.u)return;return r(q.event?q.event(t):t)}}}function _u(e,t,r,a,o,l,s,c,d,u){var h,f,p,g,k,_,T,C,m,b,S,w,x,E,L,A,H,$=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(d=!!(32&r.__u),l=[c=t.__e=r.__e]),(h=q.__b)&&h(t);e:if(typeof $=="function")try{if(C=t.props,m="prototype"in $&&$.prototype.render,b=(h=$.contextType)&&a[h.__c],S=h?b?b.props.value:h.__:a,r.__c?T=(f=t.__c=r.__c).__=f.__E:(m?t.__c=f=new $(C,S):(t.__c=f=new ht(C,S),f.constructor=$,f.render=jg),b&&b.sub(f),f.state||(f.state={}),f.__n=a,p=f.__d=!0,f.__h=[],f._sb=[]),m&&f.__s==null&&(f.__s=f.state),m&&$.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Vt({},f.__s)),Vt(f.__s,$.getDerivedStateFromProps(C,f.__s))),g=f.props,k=f.state,f.__v=t,p)m&&$.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),m&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(m&&$.getDerivedStateFromProps==null&&C!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(C,S),t.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(C,f.__s,S)===!1){for(t.__v!=r.__v&&(f.props=C,f.state=f.__s,f.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(Y){Y&&(Y.__=t)}),w=0;w<f._sb.length;w++)f.__h.push(f._sb[w]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(C,f.__s,S),m&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,k,_)})}if(f.context=S,f.props=C,f.__P=e,f.__e=!1,x=q.__r,E=0,m){for(f.state=f.__s,f.__d=!1,x&&x(t),h=f.render(f.props,f.state,f.context),L=0;L<f._sb.length;L++)f.__h.push(f._sb[L]);f._sb=[]}else do f.__d=!1,x&&x(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=Vt(Vt({},a),f.getChildContext())),m&&!p&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(g,k)),A=h,h!=null&&h.type===K&&h.key==null&&(A=Pp(h.props.children)),c=Np(e,Po(A)?A:[A],t,r,a,o,l,s,c,d,u),f.base=t.__e,t.__u&=-161,f.__h.length&&s.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(H=l.length;H--;)ku(l[H]);fc(t)}else t.__e=r.__e,t.__k=r.__k,Y.then||fc(t);q.__e(Y,t,r)}else l==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):c=t.__e=Bg(r.__e,t,r,a,o,l,s,d,u);return(h=q.diffed)&&h(t),128&t.__u?void 0:c}function fc(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(fc)}function Fp(e,t,r){for(var a=0;a<r.length;a++)Su(r[a],r[++a],r[++a]);q.__c&&q.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(l){l.call(o)})}catch(l){q.__e(l,o.__v)}})}function Pp(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Po(e)?e.map(Pp):Vt({},e)}function Bg(e,t,r,a,o,l,s,c,d){var u,h,f,p,g,k,_,T=r.props||vo,C=t.props,m=t.type;if(m=="svg"?o="http://www.w3.org/2000/svg":m=="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((g=l[u])&&"setAttribute"in g==!!m&&(m?g.localName==m:g.nodeType==3)){e=g,l[u]=null;break}}if(e==null){if(m==null)return document.createTextNode(C);e=document.createElementNS(o,m,C.is&&C),c&&(q.__m&&q.__m(t,l),c=!1),l=null}if(m==null)T===C||c&&e.data==C||(e.data=C);else{if(l=l&&Fo.call(e.childNodes),!c&&l!=null)for(T={},u=0;u<e.attributes.length;u++)T[(g=e.attributes[u]).name]=g.value;for(u in T)if(g=T[u],u!="children"){if(u=="dangerouslySetInnerHTML")f=g;else if(!(u in C)){if(u=="value"&&"defaultValue"in C||u=="checked"&&"defaultChecked"in C)continue;il(e,u,null,g,o)}}for(u in C)g=C[u],u=="children"?p=g:u=="dangerouslySetInnerHTML"?h=g:u=="value"?k=g:u=="checked"?_=g:c&&typeof g!="function"||T[u]===g||il(e,u,g,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=""),Np(t.type=="template"?e.content:e,Po(p)?p:[p],t,r,a,m=="foreignObject"?"http://www.w3.org/1999/xhtml":o,l,s,l?l[0]:r.__k&&Br(r,0),c,d),l!=null)for(u=l.length;u--;)ku(l[u]);c||(u="value",m=="progress"&&k==null?e.removeAttribute("value"):k!=null&&(k!==e[u]||m=="progress"&&!k||m=="option"&&k!=T[u])&&il(e,u,k,T[u],o),u="checked",_!=null&&_!=e[u]&&il(e,u,_,T[u],o))}return e}function Su(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){q.__e(o,r)}}function zp(e,t,r){var a,o;if(q.unmount&&q.unmount(e),(a=e.ref)&&(a.current&&a.current!=e.__e||Su(a,null,t)),(a=e.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(l){q.__e(l,t)}a.base=a.__P=null}if(a=e.__k)for(o=0;o<a.length;o++)a[o]&&zp(a[o],t,r||typeof e.type!="function");r||ku(e.__e),e.__c=e.__=e.__e=void 0}function jg(e,t,r){return this.constructor(e,r)}function pc(e,t,r){var a,o,l,s;t==document&&(t=document.documentElement),q.__&&q.__(e,t),o=(a=!1)?null:t.__k,l=[],s=[],_u(t,e=t.__k=vn(K,null,[e]),o||vo,vo,t.namespaceURI,o?null:t.firstChild?Fo.call(t.childNodes):null,l,o?o.__e:t.firstChild,a,s),Fp(l,e,s)}function Wg(e,t,r){var a,o,l,s,c=Vt({},e.props);for(l in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)l=="key"?a=t[l]:l=="ref"?o=t[l]:c[l]=t[l]===void 0&&s!=null?s[l]:t[l];return arguments.length>2&&(c.children=arguments.length>3?Fo.call(arguments,2):r),Ba(e.type,c,a||e.key,o||e.ref,null)}function Up(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(s){s.__e=!0,hc(s)})},this.sub=function(l){a.add(l);var s=l.componentWillUnmount;l.componentWillUnmount=function(){a&&a.delete(l),s&&s.call(l)}}),r.children}return t.__c="__cC"+$p++,t.__=e,t.Provider=t.__l=(t.Consumer=function(r,a){return r.children(a)}).contextType=t,t}Fo=Dp.slice,q={__e:function(e,t,r,a){for(var o,l,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((l=o.constructor)&&l.getDerivedStateFromError!=null&&(o.setState(l.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,a||{}),s=o.__d),s)return o.__E=o}catch(c){e=c}throw e}},Ep=0,Ap=function(e){return e!=null&&e.constructor===void 0},ht.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Vt({},this.state),typeof e=="function"&&(e=e(Vt({},r),this.props)),e&&Vt(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),hc(this))},ht.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),hc(this))},ht.prototype.render=K,Yn=[],Mp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rp=function(e,t){return e.__v.__b-t.__v.__b},ls.__r=0,Ip=/(PointerCapture)$|Capture$/i,wu=0,uc=rh(!1),dc=rh(!0),$p=0;var qg=0;function n(e,t,r,a,o,l){t||(t={});var s,c,d=t;if("ref"in d)for(c in d={},t)c=="ref"?s=t[c]:d[c]=t[c];var u={type:e,props:d,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--qg,__i:-1,__u:0,__source:o,__self:l};if(typeof e=="function"&&(s=e.defaultProps))for(c in s)d[c]===void 0&&(d[c]=s[c]);return q.vnode&&q.vnode(u),u}var lr,de,Ei,ah,go=0,Hp=[],ge=q,oh=ge.__b,lh=ge.__r,sh=ge.diffed,ih=ge.__c,ch=ge.unmount,uh=ge.__;function zo(e,t){ge.__h&&ge.__h(de,e,go||t),go=0;var r=de.__H||(de.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function B(e){return go=1,Kg(Bp,e)}function Kg(e,t,r){var a=zo(lr++,2);if(a.t=e,!a.__c&&(a.__=[r?r(t):Bp(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=de,!de.__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 g=p.__[0];p.__=p.__N,p.__N=void 0,g!==p.__[0]&&(f=!0)}}),l&&l.call(this,c,d,u)||f};de.__f=!0;var l=de.shouldComponentUpdate,s=de.componentWillUpdate;de.componentWillUpdate=function(c,d,u){if(this.__e){var h=l;l=void 0,o(c,d,u),l=h}s&&s.call(this,c,d,u)},de.shouldComponentUpdate=o}return a.__N||a.__}function O(e,t){var r=zo(lr++,3);!ge.__s&&Cu(r.__H,t)&&(r.__=e,r.u=t,de.__H.__h.push(r))}function Gg(e,t){var r=zo(lr++,4);!ge.__s&&Cu(r.__H,t)&&(r.__=e,r.u=t,de.__h.push(r))}function W(e){return go=5,wt(function(){return{current:e}},[])}function wt(e,t){var r=zo(lr++,7);return Cu(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Z(e,t){return go=8,wt(function(){return e},t)}function Vg(e){var t=de.context[e.__c],r=zo(lr++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(de)),t.props.value):e.__}function Yg(){for(var e;e=Hp.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Fl),e.__H.__h.forEach(mc),e.__H.__h=[]}catch(t){e.__H.__h=[],ge.__e(t,e.__v)}}ge.__b=function(e){de=null,oh&&oh(e)},ge.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),uh&&uh(e,t)},ge.__r=function(e){lh&&lh(e),lr=0;var t=(de=e.__c).__H;t&&(Ei===de?(t.__h=[],de.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Fl),t.__h.forEach(mc),t.__h=[],lr=0)),Ei=de},ge.diffed=function(e){sh&&sh(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Hp.push(t)!==1&&ah===ge.requestAnimationFrame||((ah=ge.requestAnimationFrame)||Jg)(Yg)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Ei=de=null},ge.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Fl),r.__h=r.__h.filter(function(a){return!a.__||mc(a)})}catch(a){t.some(function(o){o.__h&&(o.__h=[])}),t=[],ge.__e(a,r.__v)}}),ih&&ih(e,t)},ge.unmount=function(e){ch&&ch(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(a){try{Fl(a)}catch(o){t=o}}),r.__H=void 0,t&&ge.__e(t,r.__v))};var dh=typeof requestAnimationFrame=="function";function Jg(e){var t,r=function(){clearTimeout(a),dh&&cancelAnimationFrame(t),setTimeout(e)},a=setTimeout(r,35);dh&&(t=requestAnimationFrame(r))}function Fl(e){var t=de,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),de=t}function mc(e){var t=de;e.__c=e.__(),de=t}function Cu(e,t){return!e||e.length!==t.length||t.some(function(r,a){return r!==e[a]})}function Bp(e,t){return typeof t=="function"?t(e):t}var Xg=Symbol.for("preact-signals");function Ws(){if(Rn>1)Rn--;else{for(var e,t=!1;ja!==void 0;){var r=ja;for(ja=void 0,vc++;r!==void 0;){var a=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Kp(r))try{r.c()}catch(o){t||(e=o,t=!0)}r=a}}if(vc=0,Rn--,t)throw e}}function jp(e){if(Rn>0)return e();Rn++;try{return e()}finally{Ws()}}var ne=void 0;function Wp(e){var t=ne;ne=void 0;try{return e()}finally{ne=t}}var ja=void 0,Rn=0,vc=0,ss=0;function qp(e){if(ne!==void 0){var t=e.n;if(t===void 0||t.t!==ne)return t={i:0,S:e,p:ne.s,n:void 0,t:ne,e:void 0,x:void 0,r:t},ne.s!==void 0&&(ne.s.n=t),ne.s=t,e.n=t,32&ne.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=ne.s,t.n=void 0,ne.s.n=t,ne.s=t),t}}function De(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}De.prototype.brand=Xg;De.prototype.h=function(){return!0};De.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:Wp(function(){var a;(a=t.W)==null||a.call(t)}))};De.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&&Wp(function(){var o;(o=t.Z)==null||o.call(t)}))}};De.prototype.subscribe=function(e){var t=this;return $e(function(){var r=t.value,a=ne;ne=void 0;try{e(r)}finally{ne=a}},{name:"sub"})};De.prototype.valueOf=function(){return this.value};De.prototype.toString=function(){return this.value+""};De.prototype.toJSON=function(){return this.value};De.prototype.peek=function(){var e=ne;ne=void 0;try{return this.value}finally{ne=e}};Object.defineProperty(De.prototype,"value",{get:function(){var e=qp(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(vc>100)throw new Error("Cycle detected");this.v=e,this.i++,ss++,Rn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Ws()}}}});function v(e,t){return new De(e,t)}function Kp(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 Gp(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 Vp(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 mr(e,t){De.call(this,void 0),this.x=e,this.s=void 0,this.g=ss-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}mr.prototype=new De;mr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ss))return!0;if(this.g=ss,this.f|=1,this.i>0&&!Kp(this))return this.f&=-2,!0;var e=ne;try{Gp(this),ne=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 ne=e,Vp(this),this.f&=-2,!0};mr.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)}De.prototype.S.call(this,e)};mr.prototype.U=function(e){if(this.t!==void 0&&(De.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)}};mr.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(mr.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=qp(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function j(e,t){return new mr(e,t)}function Yp(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Rn++;var r=ne;ne=void 0;try{t()}catch(a){throw e.f&=-2,e.f|=8,Tu(e),a}finally{ne=r,Ws()}}}function Tu(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Yp(e)}function Zg(e){if(ne!==this)throw new Error("Out-of-order effect");Vp(this),ne=e,this.f&=-2,8&this.f&&Tu(this),Ws()}function da(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}da.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()}};da.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Yp(this),Gp(this),Rn++;var e=ne;return ne=this,Zg.bind(this,e)};da.prototype.N=function(){2&this.f||(this.f|=2,this.o=ja,ja=this)};da.prototype.d=function(){this.f|=8,1&this.f||Tu(this)};da.prototype.dispose=function(){this.d()};function $e(e,t){var r=new da(e,t);try{r.c()}catch(o){throw r.d(),o}var a=r.d.bind(r);return a[Symbol.dispose]=a,a}var Eu,qs,Ai,Qg=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Jp=[],Xp=[];$e(function(){Eu=this.N})();function ha(e,t){q[e]=t.bind(null,q[e]||function(){})}function is(e){Ai&&Ai(),Ai=e&&e.S()}function Zp(e){var t=this,r=e.data,a=Q(r);a.value=r;var o=wt(function(){for(var c=t,d=t.__v;d=d.__;)if(d.__c){d.__c.__$f|=4;break}var u=j(function(){var g=a.value.value;return g===0?0:g===!0?"":g||""}),h=j(function(){return!Array.isArray(u.value)&&!Ap(u.value)}),f=$e(function(){if(this.N=Qp,h.value){var g=u.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=g)}}),p=t.__$u.d;return t.__$u.d=function(){f(),p.call(this)},[h,u]},[]),l=o[0],s=o[1];return l.value?s.peek():s.value}Zp.displayName="ReactiveTextNode";Object.defineProperties(De.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Zp},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});ha("__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 De&&(r||(t.__np=r={}),r[o]=l,a[o]=l.peek())}}e(t)});ha("__r",function(e,t){if(t.type!==K){is();var r,a=t.__c;a&&(a.__$f&=-2,(r=a.__$u)===void 0&&(a.__$u=r=(function(o,l){var s;return $e(function(){s=this},{name:l}),s.c=o,s})(function(){var o;Qg&&((o=r.y)==null||o.call(r)),a.__$f|=1,a.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),qs=a,is(r)}e(t)});ha("__e",function(e,t,r,a){is(),qs=void 0,e(t,r,a)});ha("diffed",function(e,t){is(),qs=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 s in l){var c=l[s];c!==void 0&&!(s in a)&&(c.d(),l[s]=void 0)}else l={},r.U=l;for(var d in a){var u=l[d],h=a[d];u===void 0?(u=eb(r,d,h,o),l[d]=u):u.o(h,o)}}}e(t)});function eb(e,t,r,a){var o=t in e&&e.ownerSVGElement===void 0,l=v(r);return{o:function(s,c){l.value=s,a=c},d:$e(function(){this.N=Qp;var s=l.value.value;a[t]!==s&&(a[t]=s,o?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}ha("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 s=t.__c;if(s){var c=s.__$u;c&&(s.__$u=void 0,c.d())}}e(t)});ha("__h",function(e,t,r,a){(a<3||a===9)&&(t.__$f|=2),e(t,r,a)});ht.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 s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function Q(e,t){return wt(function(){return v(e,t)},[])}function Ks(e,t){var r=W(e);return r.current=e,qs.__$f|=4,wt(function(){return j(function(){return r.current()},t)},[])}var tb=typeof requestAnimationFrame>"u"?setTimeout:function(e){var t=function(){clearTimeout(r),cancelAnimationFrame(a),e()},r=setTimeout(t,35),a=requestAnimationFrame(t)},nb=function(e){queueMicrotask(function(){queueMicrotask(e)})};function rb(){jp(function(){for(var e;e=Jp.shift();)Eu.call(e)})}function ab(){Jp.push(this)===1&&(q.requestAnimationFrame||tb)(rb)}function ob(){jp(function(){for(var e;e=Xp.shift();)Eu.call(e)})}function Qp(){Xp.push(this)===1&&(q.requestAnimationFrame||nb)(ob)}function gc(e,t){var r=W(e);r.current=e,O(function(){return $e(function(){return this.N=ab,r.current()},t)},[])}var lb={};function cl(e,t){for(var r in t)e[r]=t[r];return e}function sb(e,t,r){var a,o=/(?:\?([^#]*))?(#.*)?$/,l=e.match(o),s={};if(l&&l[1])for(var c=l[1].split("&"),d=0;d<c.length;d++){var u=c[d].split("=");s[decodeURIComponent(u[0])]=decodeURIComponent(u.slice(1).join("="))}e=bc(e.replace(o,"")),t=bc(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,""),g=(t[f].match(/[+*?]+$/)||lb)[0]||"",k=~g.indexOf("+"),_=~g.indexOf("*"),T=e[f]||"";if(!T&&!_&&(g.indexOf("?")<0||k)){a=!1;break}if(s[p]=decodeURIComponent(T),k||_){s[p]=e.slice(f).map(decodeURIComponent).join("/");break}}else if(t[f]!==e[f]){a=!1;break}return(r.default===!0||a!==!1)&&s}function ib(e,t){return e.rank<t.rank?1:e.rank>t.rank?-1:e.index-t.index}function cb(e,t){return e.index=t,e.rank=(function(r){return r.props.default?0:bc(r.props.path).map(ub).join("")})(e),e.props}function bc(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function ub(e){return e.charAt(0)==":"?1+"*+?".indexOf(e.charAt(e.length-1))||4:5}var db={},er=[],hh=[],lt=null,em={url:Gs()},hb=Up(em);function Gs(){var e;return""+((e=lt&<.location?lt.location:lt&<.getCurrentLocation?lt.getCurrentLocation():typeof location<"u"?location:db).pathname||"")+(e.search||"")}function Ge(e,t){return t===void 0&&(t=!1),typeof e!="string"&&e.url&&(t=e.replace,e=e.url),(function(r){for(var a=er.length;a--;)if(er[a].canRoute(r))return!0;return!1})(e)&&(function(r,a){a===void 0&&(a="push"),lt&<[a]?lt[a](r):typeof history<"u"&&history[a+"State"]&&history[a+"State"](null,null,r)})(e,t?"replace":"push"),tm(e)}function tm(e){for(var t=!1,r=0;r<er.length;r++)er[r].routeTo(e)&&(t=!0);return t}function fb(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 Ge(t)}}function pb(e){return e.stopImmediatePropagation&&e.stopImmediatePropagation(),e.stopPropagation&&e.stopPropagation(),e.preventDefault(),!1}function mb(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(fb(t))return pb(e)}while(t=t.parentNode)}}var fh=!1;function nm(e){e.history&&(lt=e.history),this.state={url:e.url||Gs()}}cl(nm.prototype=new ht,{shouldComponentUpdate:function(e){return e.static!==!0||e.url!==this.props.url||e.onChange!==this.props.onChange},canRoute:function(e){var t=or(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;fh||(fh=!0,lt||addEventListener("popstate",function(){tm(Gs())}),addEventListener("click",mb)),er.push(this),lt&&(this.u=lt.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(),er.splice(er.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(e,t){e=e.filter(cb).sort(ib);for(var r=0;r<e.length;r++){var a=e[r],o=sb(t,a.props.path,a.props);if(o)return[a,o]}},render:function(e,t){var r,a,o=e.onChange,l=t.url,s=this.c,c=this.g(or(e.children),l);if(c&&(a=Wg(c[0],cl(cl({url:l,matches:r=c[1]},r),{key:void 0,ref:void 0}))),l!==(s&&s.url)){cl(em,s=this.c={url:l,previous:s&&s.url,current:a,path:a?a.props.path:null,matches:r}),s.router=this,s.active=a?[a]:[];for(var d=hh.length;d--;)hh[d]({});typeof o=="function"&&o(s)}return vn(hb.Provider,{value:s},a)}});const ph={selected:"system",lightTheme:"light",darkTheme:"dark"},vb={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"}},gb={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"}},bb={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"}},xb={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"}},yb={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"}},wb={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"}},kb={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"}},_b={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"}},Sb={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"}},Cb={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"}},Tb={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"}},Eb={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"}},Ab={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"}},Mb={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"}},Rb={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"}},Ib={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"}},$b={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"}},Db={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"}},Lb={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"}},Nb={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"}},rm=[vb,gb,bb,Tb,Nb,Eb,wb,xb,yb,Mb,Rb,Ib,kb,_b,Sb,Cb,$b,Db,Lb,Ab],Ob=new Map(rm.map(e=>[e.id,e]));function ul(e,t=[]){return Ob.get(e)??t.find(r=>r.id===e)}const Au="cove:",mh=1;function be(e){try{const t=localStorage.getItem(Au+e);return t===null?null:JSON.parse(t)}catch{return null}}function ke(e,t){try{localStorage.setItem(Au+e,JSON.stringify(t))}catch{}}function cs(e){localStorage.removeItem(Au+e)}const Mu="cove:session-auth";function Ru(){const e=be("auth");return e?(e.credential&&(Iu({...e,credential:void 0}),$u(e.credential)),e):null}function Iu(e){const t={url:e.url,authMode:e.authMode,rememberMe:e.rememberMe};ke("auth",t),e.credential&&(e.rememberMe?(ke("credential",e.credential),om()):($u(e.credential),cs("credential")))}function Fb(){cs("auth"),cs("credential"),om()}function $u(e){try{sessionStorage.setItem(Mu,JSON.stringify({credential:e}))}catch{}}function am(){try{const e=be("credential");if(e)return e;const t=sessionStorage.getItem(Mu);return t&&JSON.parse(t).credential||null}catch{return null}}function om(){try{sessionStorage.removeItem(Mu)}catch{}}function Pb(){return be("hasCompletedOnboarding")??!1}function vh(){ke("hasCompletedOnboarding",!0)}function zb(e){ke("pendingTour",e)}function Ub(){const e=be("pendingTour")??!1;return e&&cs("pendingTour"),e}const Vs={timeFormat:"relative",fontSize:"md",fontFamily:"geist",sidebarWidth:280};function Hb(){return be("time-format")??Vs.timeFormat}function Bb(e){ke("time-format",e)}function jb(){return be("font-size")??Vs.fontSize}function Wb(e){ke("font-size",e)}function qb(){return be("font-family")??Vs.fontFamily}function Kb(e){ke("font-family",e)}function Gb(){const e=be("locale");return e||((navigator.language||"en").startsWith("en"),"en")}function Vb(){return be("theme-preference")}function Yb(e){ke("theme-preference",e)}function Jb(){return be("sidebarWidth")??Vs.sidebarWidth}function Xb(e){ke("sidebarWidth",e)}function Zb(){const e=be("messages-session"),t=be("messages-cache");return e&&t?{sessionKey:e,messages:t}:null}function Qb(e,t){ke("messages-session",e),ke("messages-cache",t)}function ex(){return be("sessions-cache")}function tx(e){ke("sessions-cache",e)}function nx(){return be("usage-cache")}function rx(e){ke("usage-cache",e)}function ax(){return be("sessions-usage-cache")}function ox(e){ke("sessions-usage-cache",e)}function lx(){const e=be("model-favorites");return new Set(e??[])}function sx(e){ke("model-favorites",[...e])}function ix(){return be("custom-themes")??[]}function cx(e,t){ke("theme-cache",{id:e,css:t})}const ux={useDefaults:!0,defaultAgentId:"main"};function dx(){return be("new-chat-settings")??ux}function hx(e){ke("new-chat-settings",e)}function fx(){return be("app-mode")??"single"}function px(e){ke("app-mode",e)}function mx(){return be("heartbeat-seen-count")??0}function vx(e){ke("heartbeat-seen-count",e)}function gx(){(be("schemaVersion")??0)<mh&&ke("schemaVersion",mh)}const tt=v(xx()),lm=v(ix()),bx=j(()=>{const e=tt.value,t=lm.value;if(e.selected==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?e.darkTheme:e.lightTheme;return ul(a,t)??ul("dark",t)}return ul(e.selected,t)??ul("dark",t)});function xx(){const e=Vb();return e?{...ph,...e}:ph}function yx(e){const t=document.documentElement;for(const[r,a]of Object.entries(e))t.style.setProperty(r,a)}function wx(e){cx(e.id,JSON.stringify({id:e.id,appearance:e.appearance,colors:e.colors}))}function kx(e){yx(e.colors),wx(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 Wa(e){tt.value={...tt.value,selected:e}}function _x(e){tt.value={...tt.value,lightTheme:e}}function Sx(e){tt.value={...tt.value,darkTheme:e}}function xc(){return[...rm,...lm.value]}function Cx(){$e(()=>{const t=bx.value;kx(t)}),$e(()=>{Yb(tt.value)}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{tt.value.selected==="system"&&(tt.value={...tt.value})})}const Tx={name:"Cove",description:"OpenClaw WebUI",tagline:"A cozy home for your AI assistant"},Ex={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",skip:"I'll configure this later",skipToLogin:"Skip to manual login",urlTitle:"Connect to Gateway",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",verifying:"Verifying...",gatewayFound:"Gateway found!",probeError:"Could not connect to gateway",authTitle:"Authentication",authSubtitle:"Enter your credentials to connect",authMethod:"Auth Method",rememberMeDesc:"Save credentials for automatic reconnection",connecting:"Connecting...",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",tryAgain:"Try Again",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"},Ax={skipTour:"Skip tour",startChatting:"Start Chatting",themesTitle:"Personalize Your Experience",themesDesc:"Choose from multiple themes to match your style.",themesTip1:"6 built-in themes: Light, Dark, Nord, Dracula, and more",themesTip2:"System preference auto-switching supported",themesTip3:"Change anytime in Settings",shortcutsTitle:"Keyboard Shortcuts",shortcutsDesc:"Work faster with keyboard navigation.",shortcutsTip1:"⌘/Ctrl + K — Quick command palette",shortcutsTip2:"⌘/Ctrl + F — Search messages",shortcutsTip3:"Enter to send, Shift+Enter for newline",sessionsTitle:"Session Management",sessionsDesc:"Organize conversations your way.",sessionsTip1:"Multiple sessions with different contexts",sessionsTip2:"Rename, pin, and filter sessions",sessionsTip3:"Switch models per session",uploadsTitle:"File Uploads",uploadsDesc:"Share images and files with your assistant.",uploadsTip1:"Drag & drop files into the chat",uploadsTip2:"Paste images directly from clipboard",uploadsTip3:"Click the attachment button to browse"},Mx={send:"Send",queue:"Queue",stop:"Stop",rename:"Rename",cancel:"Cancel",close:"Close",save:"Save",create:"Create",new:"New",delete:"Delete",edit:"Edit",copy:"Copy",copied:"Copied!",retry:"Retry",refresh:"Refresh",expand:"Expand",collapse:"Collapse",newChat:"New Chat",connect:"Connect",disconnect:"Disconnect",logout:"Logout",login:"Login",submit:"Submit",confirm:"Confirm",back:"Back",continue:"Continue",next:"Next",done:"Done",search:"Search",filter:"Filter",clear:"Clear",selectAll:"Select All",deselectAll:"Deselect All",more:"More",less:"Less",viewAll:"View All",showMore:"Show More",showLess:"Show Less",remove:"Remove",download:"Download"},Rx={confirmDelete:"Are you sure?",deleting:"Deleting...",saving:"Saving...",loading:"Loading...",noData:"No data",noResults:"No results found",tryAgain:"Try again",dismiss:"Dismiss",enabled:"Enabled",disabled:"Disabled",dark:"Dark",light:"Light"},Ix={placeholder:"Type a command...",loading:"Loading...",noItems:"No items",noMatches:"No matches",noCommands:"No commands found",failedToLoad:"Failed to load",hints:{navigate:"↑↓ navigate",select:"↵ select",close:"esc close",back:"esc back"},categories:{recent:"Recent",chat:"Chat",session:"Session",model:"Model",cron:"Automation",gateway:"Gateway",settings:"Settings"},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:{deleteSession:"Delete this session?",restartGateway:"Restart the gateway? Connection will drop briefly."}},$x={title:"Connect to Gateway",gatewayUrl:"Gateway URL",gatewayUrlPlaceholder:"ws://localhost:8080",password:"Password",passwordPlaceholder:"Enter password",token:"Token",tokenPlaceholder:"Enter token",rememberMe:"Remember me",connecting:"Connecting...",authMode:{password:"Password",token:"Token"}},Dx={generic:"Something went wrong",connectionFailed:"Failed to connect to gateway",connectionLost:"Connection lost",unauthorized:"Invalid credentials",timeout:"Request timed out",notFound:"Not found",serverError:"Server error",networkError:"Network error",unknown:"An unknown error occurred",retry:"Please try again",required:"This field is required",invalid:"Invalid value",viewFailed:"Failed to load {view}"},Lx={approvalNeeded:"Exec Approval Needed",command:"Command",host:"Host",agent:"Agent",session:"Session",cwd:"Working Directory",resolved:"Resolved Path",security:"Security Mode",askMode:"Ask Mode",expiresIn:"Expires in {time}",expired:"Expired",approved:"Approved",denied:"Denied",pendingCount:"{count} pending",allowOnce:"Allow Once",allowAlways:"Always Allow",deny:"Deny"},Nx={connected:"Healthy",disconnected:"Disconnected",connecting:"Connecting",reconnecting:"Reconnecting",error:"Error",online:"Online",offline:"Offline",loading:"Loading...",saving:"Saving...",processing:"Processing..."},Ox={disconnected:"Connection lost. Messages will be sent when reconnected.",reconnecting:"Reconnecting to gateway...",reconnectingAttempt:"Reconnecting... (attempt {count})",messageFailed:"Failed to send. Tap to retry.",messageFailedStatus:"Failed",messageSending:"Sending",messageQueued:"Queued",messagesQueued:"{count} message queued",messagesQueued_plural:"{count} messages queued"},Fx={chat:"Chat",sessions:"Sessions",overview:"Overview",usage:"Usage",channels:"Channels",instances:"Instances",cron:"Cron Jobs",config:"Config",status:"Status",debug:"Debug",logs:"Logs",docs:"Docs",github:"GitHub",githubOpenClaw:"OpenClaw GitHub",discord:"Discord",settings:"Cove Settings",memory:"Memory",skills:"Skills",workspace:"Workspace",nodes:"Nodes",devices:"Devices",sections:{chat:"Chat",control:"Control",agent:"Agent",settings:"Settings",resources:"Resources"}},Px={title:"New Chat",agent:"Agent",agentDescription:"Choose which assistant to chat with",rememberChoice:"Remember this choice",rememberChoiceDescription:"Skip this dialog next time and use these defaults",create:"Create Chat"},zx={placeholder:"Message (Enter to send, Shift+Enter for new line)",placeholderMobile:"Message...",placeholderDisabled:"Connect to gateway to start chatting",sending:"Sending...",thinking:"Thinking...",queuedMessages:"Queued ({count})",queuedMessages_plural:"Queued ({count})",editQueuedMessage:"Edit Queued Message",images:"Images",addImage:"Add Image",noImages:"No images attached",imageCount:"{count} image",imageCount_plural:"{count} images",streaming:"Generating response...",copyCode:"Copy code",viewRaw:"View raw",viewRendered:"View rendered",scrollToBottom:"Scroll to bottom",search:"Search messages",searchPlaceholder:"Search in conversation...",match:"match",matches:"matches",dateRange:"Date",noMatches:"No matches found",newMessages:"{count} new message",newMessages_plural:"{count} new messages",emptyState:{title:"Start a conversation",titleWithName:"Chat with {name}",description:"Send a message to begin chatting with your assistant",assistant:"Assistant",hint:"Quick tips:",search:"Search",newSession:"New session"},toolCall:{running:"Running...",completed:"Completed",failed:"Failed",duration:"{duration}"},heartbeats:"{count} heartbeat",heartbeats_plural:"{count} heartbeats",heartbeatsTitle:"Heartbeats",noHeartbeats:"No heartbeats yet",compacting:"Compacting conversation...",conversationCompacted:"Conversation compacted",cronJobCompleted:"Cron job completed",dateFrom:"From",dateTo:"To",attachImage:"Attach image",dropFiles:"Drop files here",imageViewer:"Image viewer",copyMarkdown:"Copy markdown"},Ux={title:"Sessions",main:"Main",current:"Current",pinned:"Pinned",today:"Today",yesterday:"Yesterday",thisWeek:"This Week",older:"Older",noSessions:"No sessions yet",noResults:"No sessions match your search",newSession:"New Session",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.",switchTo:"Switch to {name}",count:"{count} session",count_plural:"{count} sessions",searchPlaceholder:"Search...",filterSessions:"Filter sessions",filterAll:"All",filterMain:"Main",filterIsolated:"Isolated",filterChannel:"Channel",showCron:"Show cron sessions",tokens:"{count} tokens",model:"Model: {model}",defaultModel:"Default",admin:{title:"Sessions",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",tokens:"Tokens",contextUsed:"Context Used",lastActive:"Last Active",thinking:"Thinking",verbose:"Verbose",reasoning:"Reasoning",sessionDetails:"Session Details",openInChat:"Open in Chat",configure:"Configure",confirmDelete:"Delete this session?",emptyTitle:"No Sessions",emptyDescription:"Sessions will appear here once you start chatting.",noResults:"No Matching Sessions",noResultsDescription:"Try adjusting your search or filters.",clearFilters:"Clear Filters",searchPlaceholder:"Search sessions...",count:"{count} session",count_plural:"{count} sessions",filteredCount:"Showing {filtered} of {total} sessions",stats:{total:"Total"},kinds:{main:"Main",channel:"Channel",cron:"Cron",isolated:"Isolated"},levels:{inherit:"Inherit",off:"Off",low:"Low",medium:"Medium",high:"High"},filters:{all:"All Types"},columns:{session:"Session",kind:"Type",model:"Model",lastActive:"Last Active",tokens:"Tokens"}}},Hx={addFavorite:"Add to favorites",removeFavorite:"Remove from favorites"},Bx={title:"Settings",description:"Customize your Cove experience",appearance:{title:"Appearance",theme:"Theme",themeDescription:"Choose your color scheme",themeSystem:"System",useSystemTheme:"Follow system appearance",useSystemThemeDescription:"Automatically switch between light and dark themes",lightTheme:"Light Theme",darkTheme:"Dark Theme",lightThemes:"Light",darkThemes:"Dark",fontSize:"Font Size",fontSizeDescription:"Adjust text size throughout the app",fontSizeSm:"Small",fontSizeMd:"Medium",fontSizeLg:"Large",fontFamily:"Font Family",fontFamilyDescription:"Choose your preferred typeface",fontSystem:"System",fontGeist:"Geist",fontInter:"Inter",fontMono:"JetBrains Mono",fontDyslexic:"OpenDyslexic"},language:{title:"Language & Region",locale:"Language",timeFormat:"Time Format",timeRelative:"Relative (2 hours ago)",timeAbsolute:"Absolute (3:45 PM)"},notifications:{title:"Notifications",desktop:"Desktop Notifications",sound:"Sound"},about:{title:"About",cove:"Cove",gateway:"Gateway",gatewayUrl:"Gateway URL"},links:{title:"Links",docs:"Documentation",github:"GitHub",discord:"Discord Community"},preferences:{title:"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:{title:"New Chat",useDefaults:"Always use defaults",useDefaultsDescription:"Skip the agent picker when creating new chats",defaultAgent:"Default Agent",defaultAgentDescription:"Which agent to use for new chats"},account:{title:"Account",logoutDescription:"Disconnect from the gateway"},data:{title:"Data",resetDefaults:"Reset to Defaults",resetDefaultsDescription:"Restore all settings to their defaults"},comingSoon:"Coming soon"},jx={title:"Cron Jobs",description:"Schedule and manage automated tasks.",createJob:"Create Job",editJob:"Edit Job",editJobNamed:"Edit {name}",deleteJob:"Delete Job",confirmDelete:"Delete this job?",runNow:"Run Now",enable:"Enable",disable:"Disable",enabled:"Enabled",disabled:"Disabled",announces:"Announces results",running:"Running",pending:"Pending",lastOk:"Last OK",lastFailed:"Last Failed",schedule:"Schedule",nextRun:"Next Run",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",noResultsDescription:"Try adjusting your search or filters.",clearFilters:"Clear Filters",count:"{count} job",count_plural:"{count} jobs",filteredCount:"Showing {filtered} of {total} jobs",stats:{total:"Total",enabled:"Enabled",disabled:"Disabled",nextWake:"Next Wake"},filters:{all:"All Jobs",enabled:"Enabled",disabled:"Disabled"},columns:{job:"Job",schedule:"Schedule",target:"Target",nextRun:"Next Run",status:"Status"},scheduleKind:{cron:"Cron Expression",every:"Interval",at:"One-time"},sessionTarget:{main:"Main Session",isolated:"Isolated Session"},wakeMode:{nextHeartbeat:"Next Heartbeat",now:"Immediate"},payloadKind:{systemEvent:"System Event",agentTurn:"Agent Turn"},form:{name:"Name",namePlaceholder:"My Job",description:"Description",descriptionPlaceholder:"What does this job do?",descriptionHint:"Optional description for this job.",enabled:"Enabled",schedule:"Schedule",timezonePlaceholder:"Timezone (e.g., America/New_York)",cronPlaceholder:"*/5 * * * *",intervalPlaceholder:"Interval in milliseconds",timestampPlaceholder:"Unix timestamp 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"}},Wx={subtitle:"Connection diagnostics and event logging.",connection:"Connection",server:"Server",client:"Client",paths:"Paths",eventLog:"Event Log",state:"State",url:"URL",sessionKey:"Session Key",reconnectAttempts:"Reconnect Attempts",connectedAt:"Connected At",version:"Version",host:"Host",commit:"Commit",uptime:"Uptime",tickInterval:"Tick Interval",configPath:"Config Path",stateDir:"State Directory",appVersion:"App Version",platform:"Platform",userAgent:"User Agent",presenceCount:"Connected Clients",clear:"Clear",paused:"Paused",recording:"Recording",noEvents:"No events recorded",noEventsHint:"Events will appear here as they occur.",snapshots:"Snapshots",snapshotsDesc:"Status, health, and heartbeat data.",status:"Status",health:"Health",lastHeartbeat:"Last Heartbeat",noData:"No data — click Refresh",recentSession:"Recent Session",heartbeatAgents:"Heartbeat Agents",showRawJson:"Show raw JSON",input:"Input",output:"Output",total:"Total",used:"Used",healthy:"Healthy",unhealthy:"Unhealthy",linked:"Linked",configured:"Configured",on:"On",off:"Off",ok:"OK",error:"Error",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",result:"Result"},qx={serverInfo:"Server Information",version:"Version",commit:"Commit",host:"Host",capabilities:"Capabilities",capabilitiesCount:"{count} methods"},Kx={title:"Logs",description:"Gateway log viewer with live tailing.",searchPlaceholder:"Search logs...",live:"Live",paused:"Paused",all:"All",debug:"Debug",info:"Info",warnings:"Warn",errors:"Error",download:"Download",clear:"Clear",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"},Gx={title:"Channels",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",count_plural:"{count} channels",accountSingular:"account",accountPlural:"accounts",docs:"Docs",configure:"Configure",probe:"Health Check",probing:"Checking...",probeOk:"Healthy",probeFailed:"Unhealthy",logout:"Logout",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}",viewDocs:"View documentation",stats:{total:"Total",active:"Active (24h)",errors:"Errors"},status:{connected:"Connected",configured:"Configured",notConfigured:"Not Configured",disabled:"Disabled",error:"Error"},account:{enabled:"enabled",disabled:"disabled",configured:"configured",linked:"linked",running:"running",connected:"connected",disconnected:"disconnected"},columns:{channel:"Channel",accounts:"Accounts",status:"Status",lastActivity:"Last Activity"}},Vx={title:"Instances",description:"Connected clients and services.",emptyTitle:"No Instances",emptyDescription:"No connected clients or services found.",count:"{count} instance",count_plural:"{count} instances",idle:"Idle",idleSeconds:"{count}s",idleMinutes:"{count}m",idleHours:"{count}h",stats:{total:"Total",gateways:"Gateways",clients:"Clients"},columns:{instance:"Instance",mode:"Mode",platform:"Platform",lastSeen:"Last Seen",idle:"Idle"}},Yx={title:"Skills",description:"Browse and manage assistant skills.",emptyTitle:"No Skills",emptyDescription:"No skills are available in this workspace.",noResults:"No Matching Skills",count:"{count} skill",count_plural:"{count} skills",noResultsDescription:"Try adjusting your search or filters.",clearFilters:"Clear Filters",filteredCount:"Showing {filtered} of {total} skills",searchPlaceholder:"Search skills...",enable:"Enable",disable:"Disable",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",alwaysActive:"Always active",missingRequirements:"Missing requirements",blockedByAllowlist:"Blocked by allowlist",primaryEnv:"Primary env var",workspaceDir:"Workspace",managedDir:"Managed skills",stats:{total:"Total",eligible:"Eligible",disabled:"Disabled",missingReqs:"Missing Reqs"},status:{eligible:"Eligible",disabled:"Disabled",missingReqs:"Missing Reqs",blocked:"Blocked"},source:{bundled:"Bundled",workspace:"Workspace",managed:"Installed",extra:"Extra"},filters:{allSources:"All Sources"},tabs:{installed:"Installed",clawhub:"ClawHub"},clawhub:{title:"Browse ClawHub",description:"Discover and install skills from the community registry.",searchPlaceholder:"Search ClawHub skills...",install:"Install",installing:"Installing...",installTitle:"Install {name}",installConfirm:"Install {name} v{version} from ClawHub?",installSuccess:"Installed {name} from ClawHub",installFailed:"Failed to install from ClawHub",noDescription:"No description available",changelog:"Changelog",downloads:"downloads",stars:"stars",viewOnClawhub:"View on ClawHub",noResults:"No Skills Found",tryDifferentSearch:"Try a different search term.",notYetSupported:"ClawHub installation coming soon! Install manually: openclaw skills install {slug}"}},Jx={title:"Workspace",description:"View and edit agent configuration files.",agent:"Agent",selectAgent:"Select agent",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",create:"Create",edit:"Edit",view:"View",unsaved:"Unsaved",unsavedWarning:"You have unsaved changes. Are you sure you want to leave?",backToList:"Back to Workspace",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."},files:{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"}},Xx={title:"Devices",description:"Manage paired devices and authentication tokens.",emptyTitle:"No Devices",emptyDescription:"No devices have been paired yet.",noResults:"No matching devices",count:"{count} device",count_plural:"{count} devices",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",approved:"Approved",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}",stats:{total:"Total",operators:"Operators",nodes:"Nodes",pending:"Pending"},filters:{allRoles:"All Roles",operators:"Operators",nodes:"Nodes"}},Zx={title:"Nodes",description:"Manage paired mobile devices and nodes.",emptyTitle:"No Nodes",emptyDescription:"Pair a mobile device or node to get started.",noResults:"No matching nodes",count:"{count} node",count_plural:"{count} nodes",filteredCount:"Showing {filtered} of {total}",searchPlaceholder:"Search nodes...",pendingRequests:"Pending Pairing Requests",requestedAt:"Requested",approve:"Approve",reject:"Reject",approveSuccess:"Pairing approved",rejectSuccess:"Pairing rejected",connected:"Connected",nodeId:"Node ID",version:"Version",ipAddress:"IP Address",commands:"Commands",actions:"Actions",actionsRequireConnection:"Actions require an active connection",notify:"Notify",notifyTitle:"Send Notification to {name}",notifyTitleLabel:"Title",notifyTitlePlaceholder:"Notification title",notifyBodyLabel:"Message",notifyBodyPlaceholder:"Notification message...",sendNotification:"Send",notifySuccess:"Notification sent to {name}",cameraFront:"Front Camera",cameraBack:"Back Camera",cameraRequested:"Requesting photo...",cameraSuccess:"Photo captured",location:"Location",locationSuccess:"Location retrieved",screenRecord:"Screen Record",screenRecordHint:"Record the device screen",stats:{total:"Total",connected:"Connected",paired:"Offline",pending:"Pending"},status:{connected:"Connected",paired:"Offline"}},Qx={title:"Usage",description:"Token usage and cost analytics",loadError:"Failed to load usage data",gateway:{title:"Gateway",unknown:"Unknown host",uptime:"Uptime",sessions:"Sessions"},summary:{title:"Token Usage",period:"Last {days} days",totalCost:"Total Cost",input:"Input",output:"Output",total:"Total",cache:"Cache Tokens",cacheRead:"Cache Read",cacheWrite:"Cache Write",unavailable:"Usage data not available"},daily:{title:"Daily Activity"},agents:{title:"Agents",default:"Default",sessions:"sessions"},sessions:{title:"Sessions",noData:"No session usage data available",name:"Session",model:"Model",tokens:"Tokens",cost:"Cost",lastActive:"Last Active",showing:"Showing {from}–{to} of {total}",viewDetails:"View details for {name}"},detail:{title:"Session Details",contextWeight:"Context Weight",skills:"Skills",tools:"Tools",files:"Files",system:"System Prompt",other:"Other",tabs:{overview:"Overview",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",totalCost:"Total Cost",role:{user:"User",assistant:"Assistant",tool:"Tool",toolResult:"Result"},tokenCount:"{count} tokens"}},e0={justNow:"just now",secondsAgo:"{count} second ago",secondsAgo_plural:"{count} seconds ago",minutesAgo:"{count} minute ago",minutesAgo_plural:"{count} minutes ago",hoursAgo:"{count} hour ago",hoursAgo_plural:"{count} hours ago",daysAgo:"{count} day ago",daysAgo_plural:"{count} days ago",weeksAgo:"{count} week ago",weeksAgo_plural:"{count} weeks ago",monthsAgo:"{count} month ago",monthsAgo_plural:"{count} months ago",yearsAgo:"{count} year ago",yearsAgo_plural:"{count} years ago",compact:{now:"now",minutes:"{count}m",hours:"{count}h",days:"{count}d",weeks:"{count}w",months:"{count}mo",years:"{count}y"}},t0={skipToContent:"Skip to content",menuOpen:"Open menu",menuClose:"Close menu",sidebarToggle:"Toggle sidebar",themeToggle:"Toggle theme",loading:"Loading",closeDialog:"Close dialog",expandSection:"Expand section",collapseSection:"Collapse section"},n0={title:"Configuration",description:"Manage OpenClaw settings",searchPlaceholder:"Search settings...",save:"Save Changes",saving:"Saving...",reset:"Reset",unsavedChanges:"You have unsaved changes",discardChanges:"Discard changes?",saveSuccess:"Configuration saved. Gateway will restart.",saveError:"Failed to save configuration",hashMismatch:"Configuration was modified externally. Reload and try again.",reload:"Reload",showAdvanced:"Show advanced settings",hideAdvanced:"Hide advanced settings",restartRequired:"Gateway will restart to apply changes",noFields:"No settings found",noResults:"No matching settings",selectSection:"Select a section to configure",subsections:"Subsections",general:"General",noSettingsAtLevel:"No settings available at this level.",schemaNotFound:"Schema not found for path: {path}",mobileNotReady:"Mobile editing coming soon",mobileNotReadyHint:"Use desktop for full configuration editing.",emptyConfig:"Configuration is empty",loadError:"Failed to load configuration",version:"OpenClaw {version}",configPath:"Config: {path}",expandAll:"Expand all",collapseAll:"Collapse all",sections:{gateway:"Gateway",agents:"Agents",channels:"Channels",tools:"Tools",models:"Models",auth:"Authentication",commands:"Commands",session:"Session",cron:"Cron",skills:"Skills",plugins:"Plugins",other:"Other"},validation:{required:"This field is required",invalidUrl:"Invalid URL format",invalidNumber:"Must be a number",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",noItems:"No items",editJson:"Edit as JSON",dragToReorder:"Drag to reorder",moveUp:"Move up",moveDown:"Move down",invalidJson:"Invalid JSON"}},r0={app:Tx,onboarding:Ex,tour:Ax,actions:Mx,common:Rx,commandPalette:Ix,auth:$x,errors:Dx,exec:Lx,status:Nx,connection:Ox,nav:Fx,newChatModal:Px,chat:zx,sessions:Ux,models:Hx,settings:Bx,cron:jx,debug:Wx,overview:qx,logs:Kx,channels:Gx,instances:Vx,skills:Yx,workspace:Jx,devices:Xx,nodes:Zx,usage:Qx,time:e0,accessibility:t0,config:n0},Ta={en:r0};function a0(e){if(Ta[e])return Ta[e];const t=e.split("-")[0];return Ta[t]?Ta[t]:Ta.en}const jr=v(Hb()),bo=v(jb()),xo=v(qb()),et=v(dx()),gn=v(fx()),Ys=j(()=>gn.value==="multi"),us=j(()=>gn.value==="single");$e(()=>Bb(jr.value));$e(()=>Wb(bo.value));$e(()=>Kb(xo.value));$e(()=>hx(et.value));$e(()=>px(gn.value));$e(()=>{document.documentElement.dataset.fontSize=bo.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[xo.value])});const o0=[{value:"sm",labelKey:"settings.appearance.fontSizeSm"},{value:"md",labelKey:"settings.appearance.fontSizeMd"},{value:"lg",labelKey:"settings.appearance.fontSizeLg"}],l0=[{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"}],s0=[{value:"relative",labelKey:"settings.preferences.timeRelative"},{value:"local",labelKey:"settings.preferences.timeAbsolute"}];function i0(){bo.value="md",xo.value="geist",jr.value="relative",et.value={useDefaults:!0,defaultAgentId:"main"},gn.value="single"}const gh={debug:0,info:1,warn:2,error:3,off:4};function c0(){return"off"}const u0=c0();function dl(e){return gh[e]>=gh[u0]}function hl(e,t){return`[${e}] ${t}`}function Wn(e){return{debug:(t,...r)=>{dl("debug")&&(console.debug(hl(e,t),...r),r.length,void 0)},info:(t,...r)=>{dl("info")&&(console.info(hl(e,t),...r),r.length,void 0)},warn:(t,...r)=>{dl("warn")&&(console.warn(hl(e,t),...r),r.length,void 0)},error:(t,...r)=>{dl("error")&&(console.error(hl(e,t),...r),r.length,void 0)}}}const M={gateway:Wn("gateway"),auth:Wn("auth"),chat:Wn("chat"),exec:Wn("exec"),i18n:Wn("i18n"),ui:Wn("ui"),usage:Wn("usage")},Dn=v(Gb()),bh=v(a0(Dn.value)),xh=j(()=>["ar","he","fa","ur"].includes(Dn.value.split("-")[0]));function d0(){document.documentElement.dir=xh.value?"rtl":"ltr",document.documentElement.lang=Dn.value,$e(()=>{document.documentElement.dir=xh.value?"rtl":"ltr",document.documentElement.lang=Dn.value})}function yh(e,t){return t.split(".").reduce((r,a)=>{if(r&&typeof r=="object"&&a in r)return r[a]},e)}function i(e,t){let r=yh(bh.value,e);if(t?.count!==void 0&&typeof t.count=="number"){const o=t.count===1?e:`${e}_plural`,l=yh(bh.value,o);l!==void 0&&(r=l)}return typeof r!="string"?(M.i18n.warn(`Missing translation: ${e}`),e):t?r.replace(/\{(\w+)\}/g,(a,o)=>t[o]?.toString()??`{${o}}`):r}function sm(e,t="short"){const r=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(Dn.value,{timeStyle:t}).format(r)}function wh(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),s=Math.round(l/60),c=Math.round(s/24),d=Math.round(c/7),u=Math.round(c/30),h=Math.round(c/365),f=new Intl.RelativeTimeFormat(Dn.value,{numeric:"auto"});return Math.abs(o)<60?f.format(o,"second"):Math.abs(l)<60?f.format(l,"minute"):Math.abs(s)<24?f.format(s,"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 oe(e,t){return t?.relative?wh(e):jr.value==="local"?sm(e,"short"):wh(e)}function h0(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),s=Math.round(l/60),c=Math.round(s/24),d=Math.round(c/7),u=Math.round(c/30),h=Math.round(c/365);return o<60?i("time.compact.now"):l<60?i("time.compact.minutes",{count:l}):s<24?i("time.compact.hours",{count:s}):c<7?i("time.compact.days",{count:c}):d<4?i("time.compact.weeks",{count:d}):u<12?i("time.compact.months",{count:u}):i("time.compact.years",{count:h})}function ds(e){if(jr.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()?sm(t,"short"):t.getFullYear()===r.getFullYear()?new Intl.DateTimeFormat(Dn.value,{month:"short",day:"numeric"}).format(t):new Intl.DateTimeFormat(Dn.value,{month:"short",year:"2-digit"}).format(t)}return h0(e)}function yc(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function hs(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}K`:`${Math.round(e/1e3)}K`}const kh=3,f0=1e3,p0=3e4,m0=1.5,v0=3e4,g0=3e4,Te=v("disconnected"),D=j(()=>Te.value==="connected"),b0=v(!0),Tn=v(null),kt=v(null),Xt=v(null),Du=v(null),Oe=v(null),Lu=v([]),$t=v(0),Uo=v(null),fa=v(null),yo=v(null),Ln=v(null),im=v(null),qa=v(null),Ka=v(null),Ho=v([]),Nu=j(()=>{const e=im.value,t=Ln.value;if(e==null||t==null)return null;const r=Date.now()-t;return e+r});let Ce=null,Ir=null,x0=0,Pl=null,$r=null;const Wr=new Map,wc=new Set,y0=5e3;function _h(e,t){return new Promise(r=>{if(t?.aborted){r({ok:!1,error:"Aborted"});return}let a=null,o=null,l=!1;const s=()=>{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,s(),r({ok:!1,error:u}))},d=u=>{l||(l=!0,s(),r({ok:!0,version:u}))};t?.addEventListener("abort",()=>{c("Aborted")}),o=setTimeout(()=>{c("Connection timed out")},y0);try{a=new WebSocket(e),a.onopen=()=>{M.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"?(M.gateway.debug("Probe: Received connect.challenge, gateway is valid"),d(h.payload?.version)):(M.gateway.debug("Probe: Received unexpected message:",h.type,h.event),d())}catch{c("Invalid response from server")}},a.onerror=u=>{M.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 Bo(e){const t=$t.value>0;return Ce&&(t?(Ce.onclose=null,Ce.close(),Ce=null):qr()),Ir=e,Te.value="connecting",b0.value=!1,Tn.value=null,t||($t.value=0),Xt.value=e.url,new Promise((r,a)=>{try{Ce=new WebSocket(e.url),Ce.onopen=()=>{Te.value="authenticating"},Ce.onmessage=o=>{try{const l=JSON.parse(o.data);if(Te.value==="authenticating"&&l.type==="event"&&l.event==="connect.challenge"){w0(e).then(s=>{Te.value="connected",Ln.value=Date.now(),kt.value=s.server?.version??null,Uo.value=s.server?.commit??null,fa.value=s.server?.host??null,Du.value=s.server?.connId??null,Lu.value=s.features?.methods??[],yo.value=s.policy?.tickIntervalMs??null,Ho.value=s.snapshot?.presence??[],im.value=s.snapshot?.uptimeMs??null,qa.value=s.snapshot?.configPath??null,Ka.value=s.snapshot?.stateDir??null;const c=s.snapshot?.sessionDefaults;c?.mainSessionKey&&(Oe.value=c.mainSessionKey,M.gateway.info("Main session key:",Oe.value)),T0(),r(s)}).catch(s=>{Tn.value=s.message,qr(),a(s)});return}_0(l)}catch(l){M.gateway.error(" Failed to parse message:",l)}},Ce.onerror=o=>{M.gateway.error("WebSocket error:",{url:e.url,readyState:Ce?.readyState,event:o.type}),Tn.value="WebSocket error - check console for details"},Ce.onclose=o=>{const s=Te.value==="connected",c=$t.value>0;Ou(),cm(new Error("Connection closed")),(s||c)&&Ir?.autoReconnect!==!1?E0():Te.value="disconnected"}}catch(o){Te.value="disconnected",Tn.value=o instanceof Error?o.message:"Failed to connect",a(o)}})}async function w0(e){const t={minProtocol:kh,maxProtocol:kh,client:{id:"webchat",displayName:"Cove",version:"2026.2.6-3",platform:k0(),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 F("connect",t)}function k0(){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 qr(){Ir=null,Ou(),A0(),cm(new Error("Disconnected")),Ce&&(Ce.onclose=null,Ce.close(),Ce=null),Te.value="disconnected",Ln.value=null,kt.value=null,Uo.value=null,fa.value=null,Xt.value=null,Du.value=null,Oe.value=null,Lu.value=[],yo.value=null,Ho.value=[]}function F(e,t,r){return new Promise((a,o)=>{if(!Ce||Ce.readyState!==WebSocket.OPEN){o(new Error("Not connected"));return}const l=`req_${++x0}`,s=r?.timeout??v0,c={type:"req",id:l,method:e,params:t},d=setTimeout(()=>{Wr.delete(l),o(new Error(`Request timeout: ${e}`))},s);Wr.set(l,{resolve:a,reject:o,timeout:d}),Ce.send(JSON.stringify(c))})}function _0(e){switch(e.type){case"res":S0(e);break;case"event":C0(e);break;default:M.gateway.warn(" Unknown message type:",e)}}function S0(e){const t=Wr.get(e.id);if(!t){M.gateway.warn(" Received response for unknown request:",e.id);return}Wr.delete(e.id),clearTimeout(t.timeout),e.ok?t.resolve(e.payload):t.reject(new Error(e.error?.message??"Request failed"))}function C0(e){M.gateway.debug("Event received:",e.event);for(const t of wc)try{t(e)}catch(r){M.gateway.error(" Event handler error:",r)}}function cm(e){for(const[t,r]of Wr)clearTimeout(r.timeout),r.reject(e);Wr.clear()}function Js(e){return wc.add(e),()=>wc.delete(e)}function kc(e,t){return Js(a=>{a.event===e&&t(a.payload)})}let Ea=0;const Sh=3;function T0(){Ou(),Ea=0,Pl=setInterval(()=>{Ce?.readyState===WebSocket.OPEN&&F("health").then(()=>{Ea=0}).catch(e=>{Ea++,M.gateway.warn(`Heartbeat failed (${Ea}/${Sh}):`,e instanceof Error?e.message:String(e)),Ea>=Sh&&M.gateway.error("Too many consecutive heartbeat failures, connection may be unhealthy")})},g0)}function Ou(){Pl&&(clearInterval(Pl),Pl=null)}function E0(){if(!Ir||$r)return;Te.value="reconnecting",$t.value++;const e=Math.min(f0*Math.pow(m0,$t.value-1),p0);M.gateway.info(`[gateway] Reconnecting in ${Math.round(e/1e3)}s (attempt ${$t.value})`),$r=setTimeout(async()=>{if($r=null,!!Ir)try{await Bo(Ir)}catch{}},e)}function A0(){$r&&(clearTimeout($r),$r=null),$t.value=0}const za={state:Te,isConnected:D,error:Tn,version:kt,commit:Uo,host:fa,url:Xt,connectionId:Du,mainSessionKey:Oe,capabilities:Lu,tickIntervalMs:yo,connectedAt:Ln,presence:Ho,reconnectAttempt:$t,connect:Bo,disconnect:qr,send:F,subscribe:Js,on:kc},M0=6e4,R0=200,I0=100,$0=5e3,D0=1e3,fl=`
|
|
2
|
-
|
|
3
|
-
`,L0=300,N0="2026.2.6-3",pl={docs:"https://docs.openclaw.ai",github:"https://github.com/MaudeCode/cove",githubOpenClaw:"https://github.com/openclaw/openclaw",discord:"https://discord.com/invite/clawd"},O0=[/read heartbeat\.md/i,/heartbeat poll/i,/if nothing needs attention.*reply.*heartbeat_ok/i],F0=/^\s*heartbeat_ok\s*$/i,um=/^\s*no_(?:reply|repl|rep|re|r|_?)?\s*$/i,P0=/^\s*\[cron\]/i;function z0(e){return e.role!=="user"?!1:O0.some(t=>t.test(e.content))}function Fu(e){return e.role!=="assistant"?!1:F0.test(e.content)}function U0(e){return e.role!=="assistant"?!1:um.test(e.content)}function dm(e){return um.test(e)}function H0(e){return e.role!=="assistant"?!1:P0.test(e.content)}function hm(e){return z0(e)||Fu(e)}const B0=[/^<summary>/i,/the conversation.*compacted/i,/pre-compaction memory flush/i,/context was summarized/i];function j0(e){return e.role!=="user"?!1:B0.some(t=>t.test(e.content))}function Ga(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Pu(e){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"):!1}function zu(e){return typeof e=="string"&&e.trim().length>0}function Uu(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function W0(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 fm(e){return/^\d/.test(e)?`v${e}`:e}const q0=[":discord:",":telegram:",":signal:",":slack:",":whatsapp:",":imessage:"];function sr(e){return e===Oe.value||e==="main"||e.endsWith(":main")}function K0(e){return vm(e.key)==="cron"}function pm(e){return/^agent:[^:]+:chat:[^:]+$/.test(e)}function G0(e){return vm(e.key)==="spawn"}function mm(e){const t=e.key.toLowerCase();return q0.some(r=>t.includes(r))?!0:e.kind==="group"}function V0(e){const t=e.split(":");return t.length>=2&&t[0]==="agent"?t[1]:null}function vm(e){const t=e.split(":");return t.length>=3&&t[0]==="agent"?t[2]:null}function gm(e){return e.split("-").map(Ga).join(" ")}function Ch(e){return e.includes("-")&&e.length>20}function Y0(e){if(sr(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 s=new Date(o);return s.setDate(s.getDate()-o.getDay()),a>=o?"today":a>=l?"yesterday":a>=s?"thisWeek":"older"}function J0(e){const t=new Map([["pinned",[]],["today",[]],["yesterday",[]],["thisWeek",[]],["older",[]]]);for(const r of e){const a=Y0(r);t.get(a).push(r)}return t}function X0(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 tr(e){return e.key.includes(":cron:")?"cron":mm(e)?"channel":sr(e.key)?"main":"isolated"}function ce(e){return e instanceof Error?e.message:String(e)}const ft=v(ex()??[]),Zt=v(null),wo=v(null),ko=v(""),bm=v("");let Mi=null;ko.subscribe(e=>{Mi&&clearTimeout(Mi),Mi=setTimeout(()=>{bm.value=e},300)});const _o=v(!1),Z0=v(!0),Th=v(!1),Hu=v(null),_c=v(null),Be=j(()=>{const e=Zt.value;return!e||e==="main"?Oe.value??"main":e}),Q0=j(()=>ft.value.find(e=>e.key===Be.value)??null);function jo(e){const t=Be.value;return!e||!t||e===t}function ey(e){return e.label?e.label:e.displayName?e.displayName:e.key}function ty(e){return mm(e)?"channel":sr(e.key)?"main":"isolated"}const Sc=j(()=>{let e=ft.value;wo.value&&(e=e.filter(r=>ty(r)===wo.value)),_o.value||(e=e.filter(r=>!K0(r))),Z0.value||(e=e.filter(r=>!G0(r)));const t=bm.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=ey(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=sr(r.key),l=sr(a.key);return o&&!l?-1:l&&!o?1:(a.updatedAt??0)-(r.updatedAt??0)})}),ny=j(()=>J0(Sc.value));async function Xs(e){Th.value=!0,_c.value=null;try{const t=await F("sessions.list",{limit:e?.limit??100,...e});ft.value=t.sessions??[],tx(ft.value)}catch(t){throw _c.value=t instanceof Error?t.message:String(t),t}finally{Th.value=!1}}function Kr(e){Zt.value=e}function ry(e){wo.value=e}function Eh(e){ko.value=e}function ay(){_o.value=!_o.value}function oy(){ft.value=[],Zt.value=null,_c.value=null}function Bu(e,t){ft.value=ft.value.map(r=>r.key===e?{...r,...t}:r)}function ly(e){ft.value=ft.value.filter(t=>t.key!==e),Zt.value===e&&(Zt.value=null),Hu.value=null}function sy(e){return new Promise(t=>{Hu.value=e,setTimeout(()=>{ly(e),t()},L0)})}let ju=null;function iy(){const e=Zb();return e?(ju=e.sessionKey,e.messages):[]}function cy(e,t){Qb(e,t),ju=e}function uy(){return ju}const Ie=v(iy()),Cc=v(!1),fs=v(null),dy=v("off"),Tc=v(!1),xm=j(()=>Ie.value.filter(hm)),hy=j(()=>xm.value.length),En=v(""),Zs=v("");let Ri=null;En.subscribe(e=>{Ri&&clearTimeout(Ri),Ri=setTimeout(()=>{Zs.value=e},300)});const je=v(!1),ml=v(null),Dr=v(null),Lr=v(null),ym=j(()=>Dr.value!==null||Lr.value!==null);function fy(){Dr.value=null,Lr.value=null}const wm=j(()=>{let e=Ie.value;const t=Dr.value,r=Lr.value;(t||r)&&(e=e.filter(o=>{const l=new Date(o.timestamp);if(t&&l<t)return!1;if(r){const s=new Date(r);if(s.setHours(23,59,59,999),l>s)return!1}return!0}));const a=Zs.value.trim().toLowerCase();return a&&(e=e.filter(o=>o.content.toLowerCase().includes(a))),e}),py=j(()=>!Zs.value.trim().toLowerCase()&&!ym.value?0:wm.value.length),pt=v([]),km=j(()=>pt.value.length>0),he=v(new Map),Wu=v(!1),Ah=v(""),Mh=v([]);function qu(e){for(const t of he.value.values())if(t.sessionKey===e&&(t.status==="pending"||t.status==="streaming"))return t;return null}function my(e){const t=qu(e);return t?{isStreaming:!0,content:t.content,toolCalls:t.toolCalls}:{isStreaming:!1,content:"",toolCalls:[]}}function Qs(){let e=!1;for(const t of he.value.values())if(t.status==="pending"||t.status==="streaming"){e=!0,Ah.value=t.content,Mh.value=t.toolCalls;break}e||(Ah.value="",Mh.value=[]),Wu.value=e}function ei(e,t){const r=he.value.get(e);if(!r)return;const a=new Map(he.value);a.set(e,{...r,...t}),he.value=a,Qs()}function Ku(e,t){setTimeout(()=>{const r=new Map(he.value);r.delete(e),he.value=r,Qs()},t)}function Gu(e,t,r){Ie.value=Ie.value.map(a=>a.id===e?{...a,status:t,error:r}:a)}function Vu(){Ie.value=[],fs.value=null}function vy(e){Ie.value=e}function ps(e){const t=Ie.value.findIndex(r=>r.id===e.id);if(t>=0){Ie.value=Ie.value.map((r,a)=>a===t?{...r,...e}:r);return}Ie.value=[...Ie.value,e]}function _m(e){Gu(e,"sending",void 0)}function gy(e){Gu(e,"sent",void 0)}function Rh(e,t){Gu(e,"failed",t)}function pa(e,t){const r=new Map(he.value);r.set(e,{runId:e,sessionKey:t,startedAt:Date.now(),status:"pending",content:"",toolCalls:[]}),he.value=r,Qs()}function Va(e,t,r=[],a){const o=he.value.get(e);o&&ei(e,{status:"streaming",content:t,toolCalls:r,lastBlockStart:a??o.lastBlockStart})}function ms(e,t){const r=he.value.get(e),a=t?.content??r?.content??"";ei(e,{status:"complete",message:t,content:a}),t&&jo(r?.sessionKey)&&(r?.sessionKey==="unknown"&&by(t)||ps(t)),Ku(e,I0)}function by(e){const t=Ie.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(s=>s.id));if(a.toolCalls.some(s=>o.has(s.id))){const s=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?`
|
|
4
|
-
|
|
5
|
-
`:"";c=a.content+d+e.content}return Ie.value=t.map(d=>d.id===a.id?{...d,content:c,toolCalls:s}:d),!0}}}}return!1}function Ec(e,t){ei(e,{status:"error",error:t}),Ku(e,$0)}function xy(e){ei(e,{status:"aborted"}),Ku(e,D0)}function yy(){he.value=new Map,Qs()}function Ih(e){pt.value=[...pt.value,e]}function Sm(e){pt.value=pt.value.filter(t=>t.id!==e)}function wy(e,t,r){pt.value=pt.value.map(a=>a.id===e?{...a,content:t,images:r}:a)}const Ac=v(new Map);function $h(e){return Ac.value.get(e)||""}function Cm(e,t){const r=new Map(Ac.value);t?r.set(e,t):r.delete(e),Ac.value=r}function ky(e){Cm(e,"")}function vs(e){if(typeof e=="string")return{text:e,toolCalls:[],images:[]};const t=[],r=[],a=[];let o=0;for(const l of e)switch(l.type){case"text":{t.push(l.text),o+=l.text.length;break}case"image":{if(l.source?.type==="base64"&&l.source.data)a.push({url:`data:${l.source.media_type};base64,${l.source.data}`,alt:"Image"});else if(l.data){const s=l.data.startsWith("data:")?l.data:`data:${l.mimeType||"image/png"};base64,${l.data}`;a.push({url:s,alt:"Image"})}break}case"tool_use":{r.push({id:l.id,name:l.name,args:l.input,status:"running",startedAt:Date.now(),insertedAtContentLength:o});break}case"toolCall":{r.push({id:l.id,name:l.name,args:l.arguments,status:"pending",insertedAtContentLength:o});break}case"tool_result":{const s=r.find(c=>c.id===l.id);s&&(s.result=l.content,s.status="complete",s.completedAt=Date.now());break}}return{text:t.join(`
|
|
6
|
-
`),toolCalls:r,images:a}}function _y(e,t){const r=vs(e.content),a=e.role==="toolResult"?"assistant":e.role;return{id:t,role:a,content:r.text,images:r.images.length>0?r.images:void 0,toolCalls:r.toolCalls.length>0?r.toolCalls:void 0,timestamp:e.timestamp??Date.now(),isStreaming:!1}}function Sy(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 Mc(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 Ii=new Map;function Cy(e){const t=new Map;for(const r of e)r.role==="toolResult"&&r.toolCallId&&t.set(r.toolCallId,{content:Mc(r.content),isError:r.isError??!1});return t}function Ty(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 Ey(e,t){return e.role==="assistant"&&t.role==="assistant"&&Math.abs(t.timestamp-e.timestamp)<M0}function Ay(e,t){const r=e.content.length,a=e.content&&t.content?`
|
|
7
|
-
|
|
8
|
-
`:"";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 Yu(e,t=R0){const r=Ii.get(e);if(r)return M.chat.debug("History load already in progress for session, waiting:",e),r;const a=My(e,t);Ii.set(e,a);try{await a}finally{Ii.delete(e)}}async function My(e,t){Cc.value=!0,fs.value=null;try{const r=await F("chat.history",{sessionKey:e,limit:t}),a=Cy(r.messages),o=[];for(let l=0;l<r.messages.length;l++){const s=r.messages[l];if(s.role==="toolResult")continue;const c=_y(s,`hist_${l}_${Date.now()}`);Ty(c,a);const d=o[o.length-1];if(d&&Ey(d,c)){Ay(d,c);continue}o.push(c)}vy(o),cy(e,o),r.thinkingLevel&&(dy.value=r.thinkingLevel)}catch(r){throw fs.value=r instanceof Error?r.message:String(r),r}finally{Cc.value=!1}}function Ry(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 Iy(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"].includes(t.stream)&&typeof t.seq=="number"&&typeof t.ts=="number"}function Tm(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 s=e.length+fl.length;return{content:e+fl+t,lastBlockStart:s}}return{content:o+t,lastBlockStart:r}}const a=e.length+fl.length;return{content:e+fl+t,lastBlockStart:a}}function $y(e,t){const r=e.trim().replace(/\s+/g," ");return r.length<=t?r:r.slice(0,t).trim()+"…"}async function Dy(e,t){if(!pm(e))return;const r=$y(t,50);if(!r){M.chat.debug("autoRenameSession: empty message, skipping");return}try{M.chat.debug("autoRenameSession: renaming",{sessionKey:e,title:r}),await F("sessions.patch",{key:e,label:r}),Bu(e,{label:r}),M.chat.info("autoRenameSession: renamed session",{sessionKey:e,title:r})}catch(a){M.chat.error("autoRenameSession: failed",{sessionKey:e,error:a})}}let Ly=0;function Ny(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 Oy(){return`cove_${Date.now()}_${++Ly}`}async function Em(e,t,r){const a=r?.messageId??Oy(),o=`user_${a}`,l=r?.messageId!=null,s={id:o,role:"user",content:t,images:Ny(r?.attachments),timestamp:Date.now(),isStreaming:!1,status:"sending",sessionKey:e};if(!D.value)return M.chat.info("Not connected, queuing message"),s.status="queued",Ih(s),a;if(Wu.value&&!l)return M.chat.info("Currently streaming, queuing message"),s.status="queued",Ih(s),a;l?_m(o):ps(s),pa(a,e);try{M.chat.debug("Sending message to session:",e);const c=await F("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 Ec(a,d),Rh(o,d),new Error(d)}if(gy(o),!l&&pm(e)){const d=ft.value.find(h=>h.key===e),u=i("newChatModal.title");d?.label===u&&Dy(e,t).catch(h=>{M.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 M.chat.error("chat.send failed:",c),Ec(a,d),Rh(o,d),c}}async function Ju(e){if(!e.sessionKey){M.chat.warn("Cannot resend message - missing sessionKey:",e.id);return}Sm(e.id),Ie.value.find(a=>a.id===e.id)?_m(e.id):ps({...e,status:"sending"});const r=e.id.replace(/^user_/,"");await Em(e.sessionKey,e.content,{messageId:r})}async function Rc(e){if(Wu.value){M.chat.debug("Still streaming, not processing queue");return}const t=pt.value.find(r=>r.sessionKey===e);if(!t){M.chat.debug("No queued messages for session");return}M.chat.info("Processing next queued message:",t.id);try{await Ju(t)}catch(r){M.chat.error("Failed to send queued message:",r)}}async function Fy(e){let t=pt.value.find(r=>r.id===e);if(t||(t=Ie.value.find(r=>r.id===e&&r.status==="failed")),!t){M.chat.warn("Cannot retry message - not found:",e);return}await Ju(t)}async function Py(){const e=[...pt.value];if(e.length!==0){M.chat.info(`Processing ${e.length} queued messages`);for(const t of e)try{await Ju(t)}catch(r){M.chat.error("Failed to send queued message:",r)}}}async function Am(e){await F("chat.abort",{sessionKey:e})}let Ya=null,Ja=null;function zy(){return Ya&&Ja||(M.chat.info("Subscribing to chat events"),Ya=kc("chat",e=>{if(!Ry(e)){M.chat.warn("Invalid chat event payload:",e);return}qy(e)}),Ja=kc("agent",e=>{if(!Iy(e)){M.chat.warn("Invalid agent event payload:",e);return}const t=e;t.stream==="tool"?Wy(t):t.stream==="lifecycle"?t.data?.phase==="start"?Uy(t):(t.data?.phase==="end"||t.data?.phase==="error")&&Hy(t):t.stream==="compaction"?By(t):t.stream==="assistant"&&jy(t)})),Ic}function Ic(){Ya&&(Ya(),Ya=null),Ja&&(Ja(),Ja=null)}function Uy(e){const{runId:t,sessionKey:r}=e;if(!jo(r))return;!he.value.get(t)&&r&&(M.chat.debug("Creating run on-the-fly for lifecycle start:",t,"session:",r),pa(t,r))}function Hy(e){const{runId:t,sessionKey:r}=e;if(!jo(r))return;const a=he.value.get(t);if(a&&(a.status==="pending"||a.status==="streaming")){M.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()};ms(t,l)}else ms(t);if(a.sessionKey&&(setTimeout(()=>Rc(a.sessionKey),100),o)){const l=a.sessionKey;setTimeout(()=>{Yu(l).catch(s=>{M.chat.warn("Failed to refresh history after heartbeat:",s)})},500)}}}function By(e){const t=e.data?.phase;M.chat.info("Compaction event:",t),t==="start"?Tc.value=!0:t==="end"&&(Tc.value=!1)}function jy(e){const{runId:t,sessionKey:r,data:a}=e,o=typeof a?.text=="string"?a.text:null;if(!o||!jo(r))return;let l=he.value.get(t);if(!l&&r&&(M.chat.debug("Creating run for assistant stream:",t,"session:",r),pa(t,r),l=he.value.get(t)),!l)return;const{content:s,lastBlockStart:c}=Tm(l.content,o,l.lastBlockStart);Va(t,s,l.toolCalls,c)}function Wy(e){const{runId:t,sessionKey:r,data:a}=e;if(!a||!jo(r))return;M.chat.debug("Tool event received",{runId:t,phase:a.phase,toolCallId:a.toolCallId,toolName:a.name});let o=he.value.get(t);if(!o&&(M.chat.debug("Creating run on-the-fly for tool event:",t,"session:",r),pa(t,r??"unknown"),o=he.value.get(t),!o))return;const l=a.toolCallId??`tool_${Date.now()}`,s=a.name??"unknown",c=[...o.toolCalls];M.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&&(M.chat.debug("Creating missing tool call:",l),c.push({id:l,name:s,status:"running",startedAt:Date.now(),insertedAtContentLength:o.content.length,contentSnapshotAtStart:o.content}),u=c.length-1),u};switch(a.phase){case"start":{if(c.some(u=>u.id===l)){M.chat.debug("Tool start skipped - duplicate",{toolCallId:l});return}setTimeout(()=>{const u=he.value.get(t);if(!u){M.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)){M.chat.debug("Tool start deferred skipped - duplicate",{toolCallId:l});return}const f={id:l,name:s,args:a.args,status:"running",startedAt:Date.now(),insertedAtContentLength:u.content.length,contentSnapshotAtStart:u.content};M.chat.debug("Tool start processed",{toolCallId:l,toolName:s,insertedAtContentLength:f.insertedAtContentLength,contentSnapshotLen:u.content.length}),h.push(f),Va(t,u.content,h)},0);break}case"update":{const u=d();c[u]={...c[u],result:Mc(a.partialResult)},Va(t,o.content,c);break}case"result":{const u=d();c[u]={...c[u],result:Mc(a.result),status:a.isError?"error":"complete",completedAt:Date.now()},Va(t,o.content,c);break}}}function qy(e){const{runId:t,state:r,errorMessage:a}=e;switch(M.chat.debug("Chat event:",r,t,"session:",e.sessionKey),r){case"delta":Ky(e);break;case"final":Gy(e);break;case"aborted":xy(t);break;case"error":Ec(t,a??"Unknown error");break}}function Ky(e){const{runId:t,sessionKey:r,message:a}=e;if(!a)return;const o=vs(a.content);let l=he.value.get(t);if(!l&&(M.chat.debug("Creating run on-the-fly for delta:",t,"session:",r),pa(t,r),l=he.value.get(t),!l)||o.toolCalls.length===0)return;M.chat.debug("Delta event - processing tool calls only",{runId:t,parsedToolCallsCount:o.toolCalls.length,existingToolCallsCount:l.toolCalls.length});const s=Sy(l.toolCalls,o.toolCalls);Va(t,l.content,s,l.lastBlockStart)}function Gy(e){const{runId:t,sessionKey:r,message:a}=e;let o=he.value.get(t);if(M.chat.debug("Final event received",{runId:t,hasExistingRun:!!o,existingContentLen:o?.content?.length,existingToolCallsCount:o?.toolCalls?.length,hasMessage:!!a}),o||(M.chat.debug("Creating run on-the-fly for final:",t,"session:",r),pa(t,r),o=he.value.get(t)),!o){M.chat.warn("Final event with no run and couldn't create one:",t);return}if(a?.content){const u=vs(a.content);if(u.text&&(dm(u.text)||Fu({role:"assistant",content:u.text}))){M.chat.debug("Heartbeat/no-reply detected, completing run without message:",t),ms(t),setTimeout(()=>Rc(r),100);return}}let l=o?.content??"",s=[];if(a?.content){const u=vs(a.content);M.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,s=u.toolCalls):u.text&&(M.chat.debug("Final merging partial text",{existingLen:l.length,parsedLen:u.text.length}),l=Tm(l,u.text,o?.lastBlockStart).content)}M.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=s.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()};ms(t,d),setTimeout(()=>{Rc(r)},100)}async function Xu(e){zy(),await Yu(e)}function Vy(){Ic(),Vu()}const Yy="Assistant",Jy="🤖",Xy="You",$c=v(Yy),Mm=v(Jy),Zy=v(null),Qy=v(Xy),e1=v(null),Dh=v(!1);async function Zu(e){Dh.value=!0;try{const r=await F("agent.identity.get",e?{sessionKey:e}:{});r&&(r.name&&($c.value=r.name),r.avatar&&(Mm.value=r.avatar),r.agentId&&(Zy.value=r.agentId),M.ui.info("Loaded assistant identity:",$c.value))}catch(t){M.ui.error("Failed to load assistant identity:",t)}finally{Dh.value=!1}}const t1=300*1e3,Rm=v(a1()),Lh=v(!1),Nh=v(null);let zl=null;const Qu=j(()=>{const e=Rm.value;return e?e.providers.find(t=>t.provider==="anthropic")??null:null}),n1=j(()=>{const e=Qu.value;return e!==null&&e.windows.length>0&&!e.error}),r1=j(()=>{const e=Qu.value;if(!e||e.windows.length===0)return null;const t=e.windows.find(r=>r.label==="Week");return t||e.windows[0]});function a1(){const e=nx();return e?(M.usage.debug("Loaded cached usage"),e):null}async function Oh(){if(!D.value){M.usage.debug("Skipping usage fetch - not connected");return}Lh.value=!0,Nh.value=null;try{const e=await za.send("usage.status");Rm.value=e,rx(e),M.usage.debug("Usage fetched:",e)}catch(e){const t=e instanceof Error?e.message:"Failed to fetch usage";Nh.value=t,M.usage.error("Usage fetch failed:",t)}finally{Lh.value=!1}}function ed(){Im(),Oh(),zl=setInterval(()=>{Oh()},t1),M.usage.debug("Usage polling started")}function Im(){zl&&(clearInterval(zl),zl=null,M.usage.debug("Usage polling stopped"))}let Fh=!1;D.subscribe(e=>{Fh&&!e&&Im(),Fh=e});const Nn=v([]),$m=v(null),Ph=v(!1),zh=v(null),o1=j(()=>{const e=new Map;for(const t of Nn.value){const r=t.provider;e.has(r)||e.set(r,[]),e.get(r).push(t)}return e});async function td(){Ph.value=!0,zh.value=null;try{const[e,t]=await Promise.all([F("models.list",{}),F("status",{}).catch(()=>null)]);Nn.value=e.models??[],M.ui.debug("Loaded models:",Nn.value.length);const r=t?.sessions?.defaults?.model;r&&($m.value=r,M.ui.debug("Default model:",r))}catch(e){zh.value=e instanceof Error?e.message:String(e),M.ui.error("Failed to load models:",e)}finally{Ph.value=!1}}function l1(e){return Nn.value.find(t=>t.id===e)}function s1(e){const t=l1(e);return t?t.name:e.replace(/^anthropic\//,"").replace(/^openai\//,"").replace(/^claude-/,"").replace(/^gpt-/,"")}const nr=v([]),So=v("main"),i1=v("main"),$i=v(!1),Uh=v(null),c1=e=>nr.value.find(t=>t.id===e);j(()=>c1(So.value)||nr.value[0]);j(()=>nr.value.length>0);const Dc=j(()=>nr.value.map(e=>({value:e.id,label:`${e.identity?.emoji||"🤖"} ${e.identity?.name||e.name||e.id}`})));async function Dm(){if($i.value){M.gateway.debug("loadAgents: already loading, skipping");return}$i.value=!0,Uh.value=null;try{M.gateway.debug("loadAgents: fetching from gateway");const e=await F("agents.list",{});if(e&&Array.isArray(e.agents))nr.value=e.agents,So.value=e.defaultId||"main",i1.value=e.mainKey||"main",M.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";M.gateway.error("loadAgents: error",{error:t}),Uh.value=t,nr.value.length===0&&(nr.value=[{id:"main",identity:{name:"Main",emoji:"🤖"}}],So.value="main")}finally{$i.value=!1}}const u1=200,d1=480,Xn=288,nd=1024,h1=typeof window<"u"&&window.innerWidth<nd,yt=v(!h1);function rd(){window.innerWidth<nd&&(yt.value=!1)}const Ul=v(Jb()),Di=v(!1);$e(()=>{Xb(Ul.value)});const Lm=v("/"),Li=v(!1),f1=20,p1=100,Hh=Xn*.3,m1=75,kn=v(null),xt=v(!1);function v1(){O(()=>{const e=()=>window.innerWidth<nd;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>=f1&&u.clientX<=p1;a=h,o=yt.value,(h||o)&&(kn.value=o?Xn:0)},s=d=>{if(!e()||!a&&!o)return;const u=d.touches[0],h=u.clientX-t;if(Math.abs(u.clientY-r)>m1&&!xt.value){kn.value=null,a=!1;return}if((Math.abs(h)>10||xt.value)&&(xt.value=!0,d.preventDefault()),!xt.value)return;let p;o?p=Xn+h:p=h,p=Math.max(0,Math.min(Xn,p)),kn.value=p},c=()=>{if(!xt.value){kn.value=null,a=!1,o=!1;return}const d=kn.value??0;o?yt.value=d>Xn-Hh:yt.value=d>Hh,kn.value=null,xt.value=!1,a=!1,o=!1};return document.addEventListener("touchstart",l,{passive:!0}),document.addEventListener("touchmove",s,{passive:!1}),document.addEventListener("touchend",c,{passive:!0}),document.addEventListener("touchcancel",c,{passive:!0}),()=>{document.removeEventListener("touchstart",l),document.removeEventListener("touchmove",s),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",c)}},[])}function g1({direction:e,onResizeStart:t,onResize:r,onResizeEnd:a,class:o=""}){const l=W(0),s=W(!1),c=W({move:null,up:null});O(()=>()=>{c.current.move&&document.removeEventListener("mousemove",c.current.move),c.current.up&&document.removeEventListener("mouseup",c.current.up),s.current&&(document.body.style.cursor="",document.body.style.userSelect="")},[]);const d=Z(h=>{h.preventDefault(),s.current=!0,l.current=e==="horizontal"?h.clientX:h.clientY,t?.();const f=g=>{if(!s.current)return;const k=e==="horizontal"?g.clientX:g.clientY,_=k-l.current;l.current=k,r(_)},p=()=>{s.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:`
|
|
9
|
-
${u?"w-1 cursor-col-resize hover:w-1.5":"h-1 cursor-row-resize hover:h-1.5"}
|
|
10
|
-
bg-transparent hover:bg-[var(--color-accent)]/30 active:bg-[var(--color-accent)]/50
|
|
11
|
-
transition-all duration-150 ease-out
|
|
12
|
-
flex-shrink-0
|
|
13
|
-
${o}
|
|
14
|
-
`,role:"separator","aria-orientation":u?"horizontal":"vertical","aria-label":"Resize handle"})}const b1=(...e)=>e.filter((t,r,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===r).join(" ").trim();const Bh=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const x1=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,a)=>a?a.toUpperCase():r.toLowerCase());const jh=e=>{const t=x1(e);return t.charAt(0).toUpperCase()+t.slice(1)};var y1={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 w1=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const k1=({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,children:o,iconNode:l,class:s="",...c})=>vn("svg",{...y1,width:String(t),height:t,stroke:e,"stroke-width":a?Number(r)*24/Number(t):r,class:["lucide",s].join(" "),...!o&&!w1(c)&&{"aria-hidden":"true"},...c},[...l.map(([d,u])=>vn(d,u)),...or(o)]);const R=(e,t)=>{const r=({class:a="",className:o="",children:l,...s})=>vn(k1,{...s,iconNode:t,class:b1(`lucide-${Bh(jh(e))}`,`lucide-${Bh(e)}`,a,o)},l);return r.displayName=jh(e),r};const In=R("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 _1=R("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const ti=R("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const ni=R("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const ad=R("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 S1=R("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 C1=R("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 Wh=R("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 T1=R("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 Wo=R("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 E1=R("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 bn=R("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const nt=R("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Nm=R("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const rt=R("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const od=R("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const ri=R("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 qo=R("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 Ko=R("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 A1=R("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const me=R("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const M1=R("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const ai=R("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 gs=R("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 R1=R("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 Dt=R("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 Om=R("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 Go=R("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 Fm=R("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 ld=R("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 Qt=R("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 I1=R("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 Pm=R("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 bs=R("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 $1=R("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 D1=R("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 en=R("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 zm=R("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 qh=R("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 Um=R("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 Hm=R("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 Nr=R("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 Vo=R("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 oi=R("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 Lc=R("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 L1=R("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 N1=R("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 Bm=R("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 jm=R("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Kh=R("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 O1=R("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 F1=R("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);const P1=R("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 tn=R("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 Mt=R("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 Gh=R("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 Ni=R("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 z1=R("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 U1=R("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 H1=R("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 li=R("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 B1=R("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 sd=R("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 ir=R("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const id=R("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 xs=R("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 j1=R("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 Fe=R("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 si=R("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 cd=R("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 Ke=R("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Wm=R("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 cr=R("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 ud=R("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 dd=R("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 W1=R("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 ii=R("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 q1=R("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 Gr=R("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const hd=R("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 K1=R("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const qm=R("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 Vh=R("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 G1=R("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);const Km=R("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 Lt=R("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 Nc=R("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);const zn=R("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 An=R("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 V1=R("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 Y1=R("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 J1=R("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 Gm=R("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 ys=R("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 X1=R("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 ma=R("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const rn=R("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 Vm(e,t){for(var r in t)e[r]=t[r];return e}function Yh(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 Jh(e,t){this.props=e,this.context=t}(Jh.prototype=new ht).isPureReactComponent=!0,Jh.prototype.shouldComponentUpdate=function(e,t){return Yh(this.props,e)||Yh(this.state,t)};var Xh=q.__b;q.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Xh&&Xh(e)};var Z1=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Yo(e){function t(r){var a=Vm({},r);return delete a.ref,e(a,r.ref||null)}return t.$$typeof=Z1,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Q1=q.__e;q.__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)}Q1(e,t,r,a)};var Zh=q.unmount;function Ym(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=Vm({},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 Ym(a,t,r)})),e}function Jm(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(a){return Jm(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 Oi(){this.__u=0,this.o=null,this.__b=null}function Xm(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function vl(){this.i=null,this.l=null}q.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Zh&&Zh(e)},(Oi.prototype=new ht).__c=function(e,t){var r=t.__c,a=this;a.o==null&&(a.o=[]),a.o.push(r);var o=Xm(a.__v),l=!1,s=function(){l||a.__z||(l=!0,r.__R=null,o?o(d):d())};r.__R=s;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]=Jm(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(s,s)},Oi.prototype.componentWillUnmount=function(){this.o=[]},Oi.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]=Ym(this.__b,r,a.__O=a.__P)}this.__b=null}var o=t.__a&&vn(K,null,e.fallback);return o&&(o.__u&=-33),[vn(K,null,t.__a?null:e.children),o]};var Qh=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 ew(e){return this.getChildContext=function(){return e.context},e.children}function tw(e){var t=this,r=e.h;if(t.componentWillUnmount=function(){pc(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)}}}pc(vn(ew,{context:t.context},e.__v),t.v)}function fd(e,t){var r=vn(tw,{__v:e,h:t});return r.containerInfo=t,r}(vl.prototype=new ht).__a=function(e){var t=this,r=Xm(t.__v),a=t.l.get(e);return a[0]++,function(o){var l=function(){t.props.revealOrder?(a.push(o),Qh(t,e,a)):o()};r?r(l):l()}},vl.prototype.render=function(e){this.i=null,this.l=new Map;var t=or(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},vl.prototype.componentDidUpdate=vl.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Qh(e,r,t)})};var nw=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,rw=/^(?: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]/,aw=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ow=/[A-Z0-9]/g,lw=typeof document<"u",sw=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};ht.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(ht.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ef=q.event;function iw(){}function cw(){return this.cancelBubble}function uw(){return this.defaultPrevented}q.event=function(e){return ef&&(e=ef(e)),e.persist=iw,e.isPropagationStopped=cw,e.isDefaultPrevented=uw,e.nativeEvent=e};var dw={enumerable:!1,configurable:!0,get:function(){return this.class}},tf=q.vnode;q.vnode=function(e){typeof e.type=="string"&&(function(t){var r=t.props,a=t.type,o={},l=a.indexOf("-")===-1;for(var s in r){var c=r[s];if(!(s==="value"&&"defaultValue"in r&&c==null||lw&&s==="children"&&a==="noscript"||s==="class"||s==="className")){var d=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&c===!0?c="":d==="translate"&&c==="no"?c=!1:d[0]==="o"&&d[1]==="n"?d==="ondoubleclick"?s="ondblclick":d!=="onchange"||a!=="input"&&a!=="textarea"||sw(r.type)?d==="onfocus"?s="onfocusin":d==="onblur"?s="onfocusout":aw.test(s)&&(s=d):d=s="oninput":l&&rw.test(s)?s=s.replace(ow,"-$&").toLowerCase():c===null&&(c=void 0),d==="oninput"&&o[s=d]&&(s="oninputCapture"),o[s]=c}}a=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=or(r.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),a=="select"&&o.defaultValue!=null&&(o.value=or(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",dw)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o})(e),e.$$typeof=nw,tf&&tf(e)};var nf=q.__r;q.__r=function(e){nf&&nf(e),e.__c};var rf=q.diffed;q.diffed=function(e){rf&&rf(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 hw={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 ee({size:e="md",label:t,class:r}){const a=hw[e];return n("span",{class:`cove-spinner ${a.container} ${r||""}`,style:{"--spinner-thickness":a.thickness},role:"status","aria-label":t||i("accessibility.loading"),children:n("span",{class:"sr-only",children:t||i("accessibility.loading")})})}const Zm=Up(null);function fw({children:e}){const[t,r]=B(null),[a,o]=B(!1),l=W(null),s=W(null);O(()=>()=>{l.current&&cancelAnimationFrame(l.current),s.current&&clearTimeout(s.current)},[]);const c=Z(h=>{s.current&&(clearTimeout(s.current),s.current=null),o(!0),l.current=requestAnimationFrame(()=>{r({...h,isVisible:!0}),l.current=null})},[]),d=Z(()=>{l.current&&(cancelAnimationFrame(l.current),l.current=null),r(h=>h?{...h,isVisible:!1}:null),s.current=window.setTimeout(()=>{o(!1),r(null),s.current=null},150)},[]),u=Z(h=>{r(f=>f?{...f,triggerRect:h}:null)},[]);return O(()=>{if(!a)return;const h=f=>{f.key==="Escape"&&d()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[a,d]),n(Zm.Provider,{value:{show:c,hide:d,update:u},children:[e,a&&fd(n(pw,{state:t}),document.body)]})}function pw({state:e}){const t=W(null),[r,a]=B("top"),[o,l]=B({top:0,left:0});if(O(()=>{if(!e?.triggerRect||!t.current)return;const u=t.current.getBoundingClientRect(),{adjustedPlacement:h,pos:f}=mw(e.triggerRect,u,e.placement);a(h),l(f)},[e?.triggerRect,e?.placement,e?.content]),!e?.triggerRect)return null;const{content:s,isVisible:c}=e;return n("div",{ref:t,role:"tooltip",class:`
|
|
15
|
-
fixed z-[9999] pointer-events-none
|
|
16
|
-
transition-opacity duration-150
|
|
17
|
-
${c?"opacity-100":"opacity-0"}
|
|
18
|
-
`,style:{top:`${o.top}px`,left:`${o.left}px`},children:[n("div",{class:`
|
|
19
|
-
px-2.5 py-1.5 text-xs font-medium
|
|
20
|
-
bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)]
|
|
21
|
-
rounded-lg shadow-lg
|
|
22
|
-
border border-[var(--color-border)]
|
|
23
|
-
whitespace-nowrap
|
|
24
|
-
`,children:s}),n("div",{class:`
|
|
25
|
-
absolute w-0 h-0 border-[6px]
|
|
26
|
-
${vw(r)}
|
|
27
|
-
`})]})}function mw(e,t,r){const l={width:window.innerWidth,height:window.innerHeight},s={top:e.top,bottom:l.height-e.bottom,left:e.left,right:l.width-e.right},c={top:s.top>=t.height+8+8,bottom:s.bottom>=t.height+8+8,left:s.left>=t.width+8+8,right:s.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 vw(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 gw=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0;function va({content:e,placement:t="top",delay:r=300,children:a,class:o,disabled:l=!1}){const s=Vg(Zm),c=W(null),d=W(null),u=l||gw(),h=Z(()=>{u||!s||(c.current=window.setTimeout(()=>{if(d.current){const p=d.current.getBoundingClientRect();s.show({content:e,placement:t,triggerRect:p})}},r))},[s,e,t,r,u]),f=Z(()=>{c.current&&(clearTimeout(c.current),c.current=null),s?.hide()},[s]);return O(()=>()=>{c.current&&clearTimeout(c.current)},[]),s?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 bw={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"}},xw={default:`
|
|
28
|
-
text-[var(--color-text-secondary)]
|
|
29
|
-
hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
|
|
30
|
-
focus-visible:ring-[var(--color-accent)]
|
|
31
|
-
`,ghost:`
|
|
32
|
-
text-[var(--color-text-muted)]
|
|
33
|
-
hover:bg-[var(--color-bg-primary)] hover:text-[var(--color-text-secondary)]
|
|
34
|
-
focus-visible:ring-[var(--color-accent)]
|
|
35
|
-
`,danger:`
|
|
36
|
-
text-[var(--color-text-secondary)]
|
|
37
|
-
hover:bg-[var(--color-error)]/10 hover:text-[var(--color-error)]
|
|
38
|
-
focus-visible:ring-[var(--color-error)]
|
|
39
|
-
`},G=Yo(({icon:e,label:t,size:r="md",variant:a="default",loading:o=!1,disabled:l,showTooltip:s=!0,tooltipPlacement:c="top",class:d,...u},h)=>{const f=l||o,p=bw[r],g=n("button",{ref:h,type:"button",disabled:f,"aria-label":t,class:`
|
|
40
|
-
inline-flex items-center justify-center cursor-pointer
|
|
41
|
-
rounded-md transition-all duration-200 ease-out
|
|
42
|
-
hover:scale-105 active:scale-95
|
|
43
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
|
|
44
|
-
disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:active:scale-100
|
|
45
|
-
${p.button}
|
|
46
|
-
${xw[a]}
|
|
47
|
-
${d||""}
|
|
48
|
-
`,...u,children:o?n(ee,{size:"sm"}):n("span",{class:`${p.icon} flex items-center justify-center [&>svg]:w-full [&>svg]:h-full`,"aria-hidden":"true",children:e})});return s&&t?n(va,{content:t,placement:c,delay:400,children:g}):g});G.displayName="IconButton";const yw={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)]"},ww={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)]"},kw={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:`
|
|
49
|
-
inline-flex items-center gap-1.5
|
|
50
|
-
font-medium rounded-full
|
|
51
|
-
${yw[e]}
|
|
52
|
-
${kw[t]}
|
|
53
|
-
${o||""}
|
|
54
|
-
`,children:[r&&n("span",{class:`w-1.5 h-1.5 rounded-full ${ww[e]}`,"aria-hidden":"true"}),a]})}function ga(e,t,r=!0){O(()=>{if(!r)return;const a=o=>{const l=Array.isArray(e)?e:[e],s=o.target;l.some(d=>d.current?.contains(s))||t()};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t,r])}function Qm(){const e=hy.value,[t,r]=B(!1),[a,o]=B(mx),l=W(null),s=W(null),c=Math.floor(e/2),d=Math.max(0,c-a),u=Z(()=>{o(c),vx(c),r(!1)},[c]);ga([s,l],u,t);const f=xm.value.filter(Fu).slice(-10).reverse();return n("div",{class:"relative inline-block",ref:s,children:[n(G,{icon:n(Hm,{class:"w-4 h-4"}),label:i("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:i("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:i("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:oe(p.timestamp)})]},p.id))})]})]})}const _w={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 ci({size:e="md",class:t="",animated:r=!1}){const a=_w[e];return n("img",{src:"/cove-icon.png",alt:"Cove",class:`${a} ${r?"group-hover:scale-110 transition-transform":""} ${t}`.trim()})}function ba({class:e}){return n(ma,{class:e||"w-5 h-5","aria-hidden":"true"})}function ev({class:e}){return n(ir,{class:e||"w-4 h-4","aria-hidden":"true"})}function Sw({class:e}){return n(F1,{class:e||"w-5 h-5","aria-hidden":"true"})}function Cw({class:e}){return n(dd,{class:e||"w-5 h-5","aria-hidden":"true"})}function xa({class:e,open:t}){return n(nt,{class:`${e||"w-4 h-4"} transition-transform ${t?"rotate-180":""}`,"aria-hidden":"true"})}function Tw({class:e}){return n(_1,{class:e||"w-5 h-5","aria-hidden":"true"})}function Ew({class:e}){return n(Go,{class:e||"w-3 h-3","aria-hidden":"true"})}function Aw({class:e}){return n(Wm,{class:e||"w-5 h-5","aria-hidden":"true"})}function Mw({class:e}){return n(K1,{class:e||"w-5 h-5",fill:"currentColor","aria-hidden":"true"})}function Rw({class:e}){return n(Om,{class:e||"w-5 h-5","aria-hidden":"true"})}function tv({class:e}){return n(li,{class:e||"w-5 h-5","aria-hidden":"true"})}function nv({class:e}){return n(Lt,{class:e||"w-5 h-5","aria-hidden":"true"})}function Iw({class:e}){return n($1,{class:e||"w-5 h-5","aria-hidden":"true"})}function $w({class:e}){return n(B1,{class:e||"w-5 h-5","aria-hidden":"true"})}function pd({class:e}){return n(Ke,{class:e||"w-5 h-5","aria-hidden":"true"})}function Dw({class:e}){return n(bn,{class:e||"w-5 h-5","aria-hidden":"true"})}function Lw({class:e}){return n(Nr,{class:e||"w-5 h-5","aria-hidden":"true"})}function rv(e){return e>=90?"critical":e>=80?"high":e>=50?"medium":"low"}function Nw(){const[e,t]=B(!1),r=W(null);if(!n1.value)return null;ga(r,()=>t(!1),e);const a=Qu.value,o=r1.value;if(!a||!o)return null;const l=rv(o.usedPercent),s=`${a.displayName} Usage`;return n("div",{ref:r,class:"relative",children:[n(va,{content:s,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 ${av(l)}`,style:{width:`${Math.min(100,o.usedPercent)}%`}})}),n("span",{class:`text-xs font-medium ${ov(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(Ow,{window:c},c.label))})]})]})}function Ow({window:e}){const t=rv(e.usedPercent),r=e.resetAt?Fw(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 ${ov(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 ${av(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 av(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 ov(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 Fw(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 Pw(){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(G,{icon:yt.value?n(ba,{}):n(Sw,{}),label:i("accessibility.sidebarToggle"),onClick:()=>yt.value=!yt.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(ci,{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:i("app.name")})]})]}),n("div",{class:"flex items-center gap-4",children:[(()=>{const e=zw(Te.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:[i(e.label),D.value&&kt.value&&kt.value!=="dev"&&n("span",{class:"text-[var(--color-text-muted)]",children:[" v",kt.value]})]})]})})(),n("div",{class:"sm:hidden flex items-center gap-2",children:[n(Qm,{}),n(G,{icon:n(pd,{}),label:i("chat.search"),onClick:()=>je.value=!0,variant:"ghost",size:"md"})]}),n(Nw,{}),n("div",{"data-tour":"settings",children:n(G,{icon:n(Cw,{}),label:i("nav.settings"),onClick:()=>{const e=Gs()==="/settings";Ge(e?Lm.value:"/settings")},variant:"ghost",size:"md"})})]})]})})}const af={connected:{dot:"bg-[var(--color-success)]",text:"text-[var(--color-success)]",label:"status.connected"},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:"status.error"},disconnected:{dot:"bg-[var(--color-text-muted)]",text:"text-[var(--color-text-muted)]",label:"status.disconnected"}};function zw(e){return af[e]??af.disconnected}const Uw={primary:`
|
|
55
|
-
bg-[var(--color-accent)] text-white
|
|
56
|
-
hover:opacity-90
|
|
57
|
-
focus-visible:ring-[var(--color-accent)]
|
|
58
|
-
`,secondary:`
|
|
59
|
-
bg-[var(--color-bg-surface)] text-[var(--color-text-primary)]
|
|
60
|
-
border border-[var(--color-border)]
|
|
61
|
-
hover:bg-[var(--color-bg-secondary)]
|
|
62
|
-
focus-visible:ring-[var(--color-accent)]
|
|
63
|
-
`,ghost:`
|
|
64
|
-
bg-transparent text-[var(--color-text-secondary)]
|
|
65
|
-
hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
|
|
66
|
-
focus-visible:ring-[var(--color-accent)]
|
|
67
|
-
`,danger:`
|
|
68
|
-
bg-[var(--color-error)] text-white
|
|
69
|
-
hover:opacity-90
|
|
70
|
-
focus-visible:ring-[var(--color-error)]
|
|
71
|
-
`},Hw={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=Yo(({type:e="button",variant:t="primary",size:r="md",loading:a=!1,icon:o,iconRight:l,fullWidth:s=!1,disabled:c,children:d,class:u,...h},f)=>n("button",{ref:f,type:e,disabled:c||a,class:`
|
|
72
|
-
inline-flex items-center justify-center
|
|
73
|
-
font-medium rounded-xl
|
|
74
|
-
transition-all duration-200 ease-out
|
|
75
|
-
shadow-soft-sm hover:shadow-soft
|
|
76
|
-
active:scale-[0.97] active:shadow-none
|
|
77
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
|
|
78
|
-
disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none disabled:active:scale-100 disabled:grayscale disabled:hover:opacity-40
|
|
79
|
-
${Uw[t]}
|
|
80
|
-
${Hw[r]}
|
|
81
|
-
${s?"w-full":""}
|
|
82
|
-
${u||""}
|
|
83
|
-
`,...h,children:[a?n(ee,{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 Fi=['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 Bw(e,t={}){const{enabled:r=!0,autoFocus:a=!0,returnFocusTo:o}=t,l=W(null);O(()=>{if(!r||!e.current)return;if(l.current=document.activeElement,a){const u=e.current.querySelectorAll(Fi)[0];u&&requestAnimationFrame(()=>{u.focus()})}function s(d){if(d.key!=="Tab"||!e.current)return;const u=e.current.querySelectorAll(Fi);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(Fi);h.length>0&&h[0].focus()}}return document.addEventListener("keydown",s),document.addEventListener("focusin",c),()=>{document.removeEventListener("keydown",s),document.removeEventListener("focusin",c);const d=o?.current??l.current;d&&typeof d.focus=="function"&&d.focus()}},[r,a,e,o])}const Pi=250,jw=80,Ww={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 Xe({open:e,onClose:t,title:r,size:a="md",hideCloseButton:o=!1,closeOnBackdrop:l=!0,closeOnEscape:s=!0,children:c,footer:d}){const u=W(null),h=W(null),[f,p]=B(e),g=W(!1),k=W(null),_=Z(()=>{if(g.current)return;g.current=!0;const w=u.current,x=h.current;w&&(w.style.transition=`transform ${Pi}ms ease-out`,w.style.transform="translateY(100%)"),x&&(x.style.transition=`opacity ${Pi}ms ease-out`,x.style.opacity="0"),setTimeout(()=>{p(!1),g.current=!1,t()},Pi)},[t]);O(()=>{e?(p(!0),g.current=!1):f&&!g.current&&_()},[e,f,_]),O(()=>{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]),Bw(u,{enabled:e&&!g.current,autoFocus:!1});const T=Z(w=>{w.key==="Escape"&&s&&!g.current&&_()},[s,_]),C=Z(w=>{k.current=w.touches[0].clientY,u.current&&(u.current.style.transition="none")},[]),m=Z(w=>{if(k.current===null)return;const E=w.touches[0].clientY-k.current;if(E>0&&(u.current&&(u.current.style.transform=`translateY(${E}px)`),h.current)){const L=Math.max(0,1-E/300);h.current.style.opacity=String(L)}},[]),b=Z(()=>{if(k.current===null)return;const w=u.current;if(w){const E=w.style.transform.match(/translateY\((\d+)px\)/);(E?parseInt(E[1],10):0)>jw?_():(w.style.transition="transform 150ms ease-out",w.style.transform="translateY(0)",h.current&&(h.current.style.transition="opacity 150ms ease-out",h.current.style.opacity="1"))}k.current=null},[_]);return O(()=>{if(f)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[f]),O(()=>{if(f)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f,T]),f?fd(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&&!g.current&&_()},"aria-hidden":"true"}),n("div",{ref:u,tabIndex:-1,class:`
|
|
84
|
-
relative w-full ${Ww[a]}
|
|
85
|
-
bg-[var(--color-bg-surface)]
|
|
86
|
-
border border-[var(--color-border)]
|
|
87
|
-
max-h-[85vh] sm:max-h-[90vh] flex flex-col
|
|
88
|
-
focus:outline-none shadow-soft-xl
|
|
89
|
-
rounded-t-xl border-b-0 sm:rounded-xl sm:border-b
|
|
90
|
-
animate-slide-up-full sm:animate-scale-in
|
|
91
|
-
`,children:[n("div",{class:"sm:hidden flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing",onTouchStart:C,onTouchMove:m,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(G,{icon:n(ba,{}),label:i("actions.close"),variant:"ghost",size:"sm",onClick:_,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 qw={sm:"px-2.5 py-1.5 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"},re=Yo(({size:e="md",error:t,leftElement:r,rightElement:a,fullWidth:o=!1,disabled:l,class:s,...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:`
|
|
92
|
-
block rounded-xl
|
|
93
|
-
bg-[var(--color-bg-primary)]
|
|
94
|
-
border transition-all duration-200 ease-out
|
|
95
|
-
shadow-soft-sm focus:shadow-soft
|
|
96
|
-
placeholder:text-[var(--color-text-muted)]
|
|
97
|
-
focus:outline-none focus:ring-2 focus:ring-offset-0
|
|
98
|
-
disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
|
|
99
|
-
${u?"border-[var(--color-error)] focus:ring-[var(--color-error)]":"border-[var(--color-border)] focus:ring-[var(--color-accent)] focus:border-transparent"}
|
|
100
|
-
${qw[e]}
|
|
101
|
-
${r?"pl-10":""}
|
|
102
|
-
${a?"pr-10":""}
|
|
103
|
-
${o?"w-full":""}
|
|
104
|
-
${s||""}
|
|
105
|
-
`,"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})]})});re.displayName="Input";function Ee({label:e,htmlFor:t,error:r,hint:a,required:o,children:l,class:s}){return n("div",{class:s,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 ws(e){if(e.label)return e.label;if(e.displayName)return e.displayName;const t=e.key.split(":");if(t.length>=3&&t[0]==="agent"){const r=t[2];return r==="main"?gm(t[1]):Ga(r)}if(t.length>=2){const r=t[t.length-1];if(Ch(r)){const a=t[t.length-2];if(a&&!Ch(a))return Ga(a)}return Ga(r)}return e.key}function Kw(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 Gw(e){const t=e.channel??e.lastChannel;return!t||t==="webchat"?null:Ga(t)}function of({session:e,isActive:t=!1,isMain:r=!1,onClick:a,onRename:o,onDelete:l}){const[s,c]=B(!1),[d,u]=B(!1),h=W(null),f=W(null);ga(h,()=>c(!1),s);const p=()=>{if(!s&&f.current){const x=f.current.getBoundingClientRect();let E=f.current.parentElement;for(;E&&getComputedStyle(E).overflowY!=="auto";)E=E.parentElement;const A=(E?E.getBoundingClientRect().bottom:window.innerHeight)-x.bottom;u(A<100)}c(!s)},g=Kw(e),k=Gw(e),_=X0(e.totalTokens??e.contextTokens),T=e.updatedAt||e.lastActiveAt,C=V0(e.key),m=C?gm(C):null,b=Hu.value===e.key,w=!!qu(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:`
|
|
106
|
-
w-full text-left px-3 py-2.5 rounded-xl text-sm
|
|
107
|
-
flex items-start gap-2.5 transition-all duration-200 ease-out
|
|
108
|
-
${w?"ai-glow":""}
|
|
109
|
-
${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)]"}
|
|
110
|
-
`,children:[w?n(ee,{size:"xs",class:"flex-shrink-0 mt-0.5 text-[var(--color-accent)]"}):r?n($w,{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:ws(e)}),g&&n("span",{class:`text-[10px] font-medium ${g.color}`,children:g.label})]}),n("span",{class:"flex items-center gap-1.5 text-xs text-[var(--color-text-muted)] mt-0.5 overflow-hidden",children:[m&&n("span",{class:"truncate flex-shrink",children:m}),k&&n(K,{children:[m&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"truncate flex-shrink text-[var(--color-accent)]/70",children:k})]}),_&&n(K,{children:[(m||k)&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"flex-shrink-0",title:`${e.totalTokens??e.contextTokens} tokens`,children:_})]}),n("span",{class:"flex-1 min-w-0"}),T&&n("span",{class:"whitespace-nowrap flex-shrink-0",children:ds(new Date(T))})]})]})]}),(o||l)&&n("div",{ref:h,class:"absolute right-2 top-2",children:[n("button",{ref:f,type:"button",onClick:x=>{x.stopPropagation(),p()},class:`p-1 rounded-lg transition-all duration-150
|
|
111
|
-
${s?"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":s,children:n(Rw,{class:"w-4 h-4"})}),s&&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:x=>{x.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(tv,{class:"w-4 h-4"}),i("actions.rename")]}),l&&n("button",{type:"button",role:"menuitem",onClick:x=>{x.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(nv,{class:"w-4 h-4"}),i("actions.delete")]})]})]})]})}function Vw({session:e,onClose:t,onRename:r}){const[a,o]=B(""),[l,s]=B(!1),c=W(null);O(()=>{e&&(o(ws(e)),setTimeout(()=>c.current?.select(),100))},[e]);const d=async f=>{if(f.preventDefault(),!(!e||!a.trim())){s(!0);try{await r(e,a.trim()),t()}finally{s(!1)}}};if(!e)return null;const u=ws(e),h=a.trim()!==u;return n(Xe,{open:!!e,onClose:t,title:i("sessions.rename"),children:n("form",{onSubmit:d,children:[n(Ee,{label:i("sessions.label"),htmlFor:"session-label",children:n(re,{ref:c,id:"session-label",type:"text",value:a,onInput:f=>o(f.target.value),placeholder:i("sessions.labelPlaceholder"),fullWidth:!0})}),n("div",{class:"flex justify-end gap-2 mt-4",children:[n(N,{variant:"ghost",onClick:t,disabled:l,children:i("actions.cancel")}),n(N,{type:"submit",variant:"primary",loading:l,disabled:!a.trim()||!h,children:i("actions.save")})]})]})})}function Yw({session:e,onClose:t,onDelete:r}){const[a,o]=B(!1),l=async()=>{if(e){o(!0);try{t(),await new Promise(s=>setTimeout(s,100)),await r(e)}catch{}finally{o(!1)}}};return e?n(Xe,{open:!!e,onClose:t,title:i("sessions.delete"),children:[n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:i("sessions.deleteConfirm",{name:ws(e)})}),n("p",{class:"text-xs text-[var(--color-text-muted)] mb-4",children:i("sessions.deleteWarning")}),n("div",{class:"flex justify-end gap-2",children:[n(N,{variant:"ghost",onClick:t,disabled:a,children:i("actions.cancel")}),n(N,{variant:"danger",onClick:l,loading:a,children:i("actions.delete")})]})]}):null}const Jw={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 Ae({value:e,options:t,onChange:r,size:a="md",placeholder:o="Select...","aria-label":l,class:s,className:c,disabled:d=!1,align:u="left",width:h}){const f=s||c,[p,g]=B(!1),[k,_]=B(-1),[T,C]=B(void 0),m=W(null),b=W(null),S=W(null),w=Jw[a],E=t.find($=>$.value===e)?.label??o;Gg(()=>{!h&&S.current&&C(S.current.offsetWidth)},[t,h]);const L=Z(()=>{g(!1),_(-1)},[]),A=Z($=>{r($),L(),m.current?.focus()},[r,L]);ga([m,b],L,p);const H=Z($=>{if(!p){($.key==="Enter"||$.key===" "||$.key==="ArrowDown")&&($.preventDefault(),g(!0),_(0));return}switch($.key){case"Escape":$.preventDefault(),L(),m.current?.focus();break;case"ArrowDown":$.preventDefault(),_(Y=>Math.min(Y+1,t.length-1));break;case"ArrowUp":$.preventDefault(),_(Y=>Math.max(Y-1,0));break;case"Enter":case" ":$.preventDefault(),k>=0&&!t[k]?.disabled&&A(t[k].value);break;case"Tab":L();break}},[p,t,k,L,A]);return n("div",{class:`relative ${f??"inline-block"}`,children:[n("div",{ref:S,"aria-hidden":"true",class:`
|
|
112
|
-
invisible absolute flex items-center gap-2
|
|
113
|
-
${w.trigger}
|
|
114
|
-
`,children:[n("span",{children:t.reduce(($,Y)=>Y.label.length>$.length?Y.label:$,o)}),n(nt,{class:"w-4 h-4 flex-shrink-0"})]}),n("button",{ref:m,type:"button",onClick:()=>!d&&g(!p),onKeyDown:H,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:`
|
|
115
|
-
flex items-center justify-between gap-2 rounded-md cursor-pointer
|
|
116
|
-
bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]
|
|
117
|
-
border border-[var(--color-border)] transition-all duration-200 ease-out
|
|
118
|
-
shadow-soft-sm hover:shadow-soft focus:shadow-soft
|
|
119
|
-
focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-0 focus:border-transparent
|
|
120
|
-
disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
|
|
121
|
-
${f?.includes("w-full")?"w-full":""}
|
|
122
|
-
${w.trigger}
|
|
123
|
-
`,children:[n("span",{class:"truncate",children:E}),n(nt,{class:`w-4 h-4 flex-shrink-0 text-[var(--color-text-muted)] transition-transform ${p?"rotate-180":""}`})]}),p&&m.current&&n("div",{ref:b,role:"listbox","aria-label":l,style:{position:"fixed",top:`${m.current.getBoundingClientRect().bottom+4}px`,minWidth:`${m.current.offsetWidth}px`,...u==="right"?{right:`${window.innerWidth-m.current.getBoundingClientRect().right}px`}:{left:`${m.current.getBoundingClientRect().left}px`}},class:`
|
|
124
|
-
z-[100] inline-flex flex-col
|
|
125
|
-
rounded-lg border border-[var(--color-border)]
|
|
126
|
-
bg-[var(--color-bg-primary)] shadow-lg
|
|
127
|
-
overflow-hidden
|
|
128
|
-
${w.menu}
|
|
129
|
-
`,children:t.map(($,Y)=>n("button",{type:"button",role:"option","aria-selected":$.value===e,disabled:$.disabled,onClick:()=>!$.disabled&&A($.value),onMouseEnter:()=>_(Y),class:`
|
|
130
|
-
text-left whitespace-nowrap transition-colors
|
|
131
|
-
${w.option}
|
|
132
|
-
${$.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}
|
|
133
|
-
${$.value===e?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}
|
|
134
|
-
${k===Y&&!$.disabled?"bg-[var(--color-bg-tertiary)]":""}
|
|
135
|
-
${$.disabled?"":"hover:bg-[var(--color-bg-tertiary)]"}
|
|
136
|
-
`,children:$.label},$.value))})]})}function Xw({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:s=>t(s.target.checked),disabled:o,class:"sr-only peer"}),n("div",{class:`
|
|
137
|
-
flex-shrink-0 w-5 h-5 rounded border-2 transition-colors
|
|
138
|
-
flex items-center justify-center
|
|
139
|
-
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)]
|
|
140
|
-
${e?"bg-[var(--color-accent)] border-[var(--color-accent)]":"bg-[var(--color-bg-primary)] border-[var(--color-border)] hover:border-[var(--color-accent)]"}
|
|
141
|
-
`,"aria-hidden":"true",children:e&&n(Dw,{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 Zw({open:e,onClose:t,onCreate:r}){const[a,o]=B(et.value.defaultAgentId||So.value),[l,s]=B(!1),c=()=>{l&&(et.value={...et.value,defaultAgentId:a,useDefaults:!0}),r(a),t()},d=()=>{o(et.value.defaultAgentId||So.value),s(!1),t()};return Dc.value.length===0?null:n(Xe,{open:e,onClose:d,title:i("newChatModal.title"),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:i("newChatModal.agent")}),n(Ae,{value:a,onChange:o,options:Dc.value,class:"w-full"}),n("p",{class:"mt-1.5 text-xs text-[var(--color-text-muted)]",children:i("newChatModal.agentDescription")})]}),n(Xw,{checked:l,onChange:s,label:i("newChatModal.rememberChoice"),description:i("newChatModal.rememberChoiceDescription")}),n("div",{class:"flex justify-end gap-3 pt-2",children:[n(N,{variant:"secondary",onClick:d,children:i("actions.cancel")}),n(N,{variant:"primary",onClick:c,children:i("newChatModal.create")})]})]})})}const Qw={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"}},Ve=Yo(({checked:e,onChange:t,size:r="md",label:a,description:o,disabled:l,class:s,id:c,...d},u)=>{const h=Qw[r],f=c?`${c}-label`:void 0,p=c?`${c}-desc`:void 0;return n("div",{class:`flex items-start justify-between gap-3 ${s||""}`,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:`
|
|
142
|
-
relative inline-flex flex-shrink-0 items-center
|
|
143
|
-
rounded-full transition-colors
|
|
144
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-2
|
|
145
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
146
|
-
${h.track}
|
|
147
|
-
${e?"bg-[var(--color-accent)]":"bg-[var(--color-border)]"}
|
|
148
|
-
`,...d,children:n("span",{"aria-hidden":"true",class:`
|
|
149
|
-
inline-block rounded-full bg-white shadow-sm
|
|
150
|
-
transform transition-transform
|
|
151
|
-
${h.thumb}
|
|
152
|
-
${e?h.translate:"translate-x-0.5"}
|
|
153
|
-
`})})]})});Ve.displayName="Toggle";const e2={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 t2({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:`
|
|
154
|
-
inline-flex items-center justify-center
|
|
155
|
-
font-medium rounded-md transition-colors
|
|
156
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-1
|
|
157
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
158
|
-
${e2[t]}
|
|
159
|
-
${e?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-primary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-secondary)]"}
|
|
160
|
-
${l||""}
|
|
161
|
-
`,children:o})}function n2(){const[e,t]=B(!1),r=W(null),a=ko.value.trim()!=="",o=wo.value!==null,l=a||o||_o.value;O(()=>{l&&t(!0)},[l]),O(()=>{e&&r.current&&r.current.focus()},[e]);const s=[{value:null,label:i("sessions.filterAll")},{value:"main",label:i("sessions.filterMain")},{value:"isolated",label:i("sessions.filterIsolated")},{value:"channel",label:i("sessions.filterChannel")}];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:i("nav.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":i("sessions.filterSessions"),children:n(Iw,{class:"w-3.5 h-3.5"})})]}),e&&n("div",{class:"mt-2 space-y-2",children:[n("div",{class:"relative",children:[n(pd,{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:ko.value,onInput:c=>Eh(c.target.value),onKeyDown:c=>{c.key==="Escape"&&!l&&t(!1)},placeholder:i("sessions.searchPlaceholder"),class:`w-full pl-7 pr-7 py-1.5 text-xs rounded-md
|
|
162
|
-
bg-[var(--color-bg-primary)] border border-[var(--color-border)]
|
|
163
|
-
text-[var(--color-text-primary)] placeholder-[var(--color-text-muted)]
|
|
164
|
-
focus:outline-none focus:border-[var(--color-accent)]/50`}),a&&n("button",{type:"button",onClick:()=>Eh(""),class:`absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded
|
|
165
|
-
text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]`,children:n(ba,{class:"w-3 h-3"})})]}),n("div",{class:"flex flex-wrap gap-1",children:s.map(c=>n(t2,{size:"xs",selected:wo.value===c.value,onClick:()=>ry(c.value),children:c.label},c.value??"all"))}),n(Ve,{size:"sm",checked:_o.value,onChange:ay,label:i("sessions.showCron")})]})]})}function lf(e){Ge(`/chat/${encodeURIComponent(e)}`),rd()}const r2={pinned:"sessions.pinned",today:"sessions.today",yesterday:"sessions.yesterday",thisWeek:"sessions.thisWeek",older:"sessions.older"},a2=["pinned","today","yesterday","thisWeek","older"];function o2({onRename:e,onDelete:t}){const r=ny.value,a=Sc.value.length>0,o=zu(ko.value);return a?o?n("ul",{class:"space-y-0.5",children:Sc.value.map(l=>n("li",{children:n(of,{session:l,isActive:Be.value===l.key&&mn.value.startsWith("/chat"),isMain:sr(l.key),onClick:()=>lf(l.key),onRename:e,onDelete:t})},l.key))}):n("div",{class:"space-y-3",children:a2.map(l=>{const s=r.get(l);return!s||s.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:i(r2[l])}),n("ul",{class:"space-y-0.5",children:s.map(d=>n("li",{children:n(of,{session:d,isActive:Be.value===d.key&&mn.value.startsWith("/chat"),isMain:sr(d.key),onClick:()=>lf(d.key),onRename:e,onDelete:t})},d.key))})]},l)})}):n("p",{class:"text-sm text-[var(--color-text-muted)] px-2 py-4",children:i(o?"sessions.noResults":"sessions.noSessions")})}const Pe="w-5 h-5",l2=()=>n(N1,{class:Pe,"aria-hidden":"true"}),s2=()=>n(E1,{class:Pe,"aria-hidden":"true"}),i2=()=>n(Bm,{class:Pe,"aria-hidden":"true"}),c2=()=>n(ys,{class:Pe,"aria-hidden":"true"}),u2=()=>n(Lc,{class:Pe,"aria-hidden":"true"}),d2=()=>n(me,{class:Pe,"aria-hidden":"true"}),h2=()=>n(rn,{class:Pe,"aria-hidden":"true"}),f2=()=>n(Pm,{class:Pe,"aria-hidden":"true"}),p2=()=>n(Gr,{class:Pe,"aria-hidden":"true"}),m2=()=>n(dd,{class:Pe,"aria-hidden":"true"}),v2=()=>n(q1,{class:Pe,"aria-hidden":"true"}),g2=()=>n(Qt,{class:Pe,"aria-hidden":"true"}),b2=()=>n(S1,{class:Pe,"aria-hidden":"true"}),sf=()=>n(D1,{class:Pe,"aria-hidden":"true"}),x2=()=>n(P1,{class:Pe,"aria-hidden":"true"}),y2=()=>n(U1,{class:Pe,"aria-hidden":"true"}),w2=[{titleKey:"nav.sections.control",items:[{id:"overview",labelKey:"nav.overview",icon:l2,requiresConnection:!0},{id:"usage",labelKey:"nav.usage",icon:s2,requiresConnection:!0},{id:"channels",labelKey:"nav.channels",icon:i2,requiresConnection:!0},{id:"instances",labelKey:"nav.instances",icon:c2,requiresConnection:!0},{id:"sessions",labelKey:"nav.sessions",icon:u2,requiresConnection:!0},{id:"cron",labelKey:"nav.cron",icon:d2,requiresConnection:!0}]},{titleKey:"nav.sections.agent",items:[{id:"skills",labelKey:"nav.skills",icon:h2,requiresConnection:!0},{id:"workspace",labelKey:"nav.workspace",icon:f2,requiresConnection:!0},{id:"devices",labelKey:"nav.devices",icon:p2,requiresConnection:!0}]},{titleKey:"nav.sections.settings",items:[{id:"settings",labelKey:"nav.settings",icon:y2},{id:"config",labelKey:"nav.config",icon:m2,requiresConnection:!0},{id:"debug",labelKey:"nav.debug",icon:v2,requiresConnection:!0},{id:"logs",labelKey:"nav.logs",icon:g2,requiresConnection:!0}]},{titleKey:"nav.sections.resources",items:[{id:"docs",labelKey:"nav.docs",icon:b2,external:pl.docs},{id:"github",labelKey:"nav.github",icon:sf,external:pl.github},{id:"github-openclaw",labelKey:"nav.githubOpenClaw",icon:sf,external:pl.githubOpenClaw},{id:"discord",labelKey:"nav.discord",icon:x2,external:pl.discord}]}],lv="cove:nav-sections";function sv(e){try{const t=`${lv}-${e}`,r=localStorage.getItem(t);return r?JSON.parse(r):{}}catch{return{}}}function k2(e,t,r){try{const a=`${lv}-${e}`,o=sv(e);o[t]=r,localStorage.setItem(a,JSON.stringify(o))}catch{}}function _2({item:e}){const t=`/${e.id}`,r=Ks(()=>!e.external&&(mn.value===t||e.id==="chat"&&mn.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,{})}),i(e.labelKey),n(Ew,{class:"w-3 h-3 ml-auto text-[var(--color-text-muted)]"})]}):n("button",{type:"button",onClick:()=>{Ge(t),rd()},class:`
|
|
166
|
-
w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm
|
|
167
|
-
transition-all duration-200 ease-out
|
|
168
|
-
${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)]"}
|
|
169
|
-
`,children:[n("span",{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true",children:n(a,{})}),i(e.labelKey)]})}function S2({section:e,mode:t,defaultOpen:r=!1}){const o=sv(t)[e.titleKey]??r,l=Q(o),s=e.items;return s.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,k2(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:i(e.titleKey)}),n(xa,{open:l.value})]}),l.value&&n("ul",{id:`nav-section-${e.titleKey}`,class:"px-3 pb-2 space-y-0.5",role:"list",children:s.map(d=>n("li",{children:n(_2,{item:d})},d.id))})]})}function iv({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:w2.map(r=>n(S2,{section:r,mode:t,defaultOpen:e},`${t}-${r.titleKey}`))})}const mn=v(window.location.pathname);function C2({isStreaming:e}){const t=mn.value==="/"||mn.value.startsWith("/chat");return n("button",{type:"button",onClick:()=>{Ge("/chat"),rd()},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(ee,{size:"xs",class:"flex-shrink-0 text-[var(--color-accent)]"}):n("span",{class:"w-5 h-5 flex-shrink-0",children:"💬"}),i("nav.chat")]})}function T2(){const[e,t]=B(null),[r,a]=B(null),o=async(d,u)=>{try{await F("sessions.patch",{key:d.key,label:u}),Bu(d.key,{label:u})}catch(h){throw M.ui.error("Failed to rename session:",h),h}},l=async d=>{try{await F("sessions.delete",{key:d.key}),await sy(d.key),Zt.value===d.key&&Ge("/chat")}catch(u){throw M.ui.error("Failed to delete session:",u),u}},s=()=>{et.value.useDefaults?c(et.value.defaultAgentId):Li.value=!0},c=async d=>{const u=crypto.randomUUID(),h=`agent:${d}:chat:${u}`;try{await F("sessions.patch",{key:h,label:i("newChatModal.title")}),await Xs(),Ge(`/chat/${encodeURIComponent(h)}`)}catch(f){M.ui.error("Failed to create new chat:",f)}};return n("div",{class:"h-full flex flex-col",children:[Ys.value?n(K,{children:[n("div",{class:"p-3",children:n(N,{variant:"primary",disabled:!D.value,onClick:s,fullWidth:!0,icon:n(ev,{}),children:i("actions.newChat")})}),n("div",{class:"flex-1 overflow-y-auto px-3 pb-3","data-tour":"sessions",children:[n(n2,{}),n(o2,{onRename:t,onDelete:a})]}),n(iv,{})]}):n(E2,{}),n(Vw,{session:e,onClose:()=>t(null),onRename:o}),n(Yw,{session:r,onClose:()=>a(null),onDelete:l}),n(Zw,{open:Li.value,onClose:()=>Li.value=!1,onCreate:c})]})}function E2(){he.value;const e=Oe.value,t=e?!!qu(e):!1;return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"px-3 py-2",children:n(C2,{isStreaming:t})}),n(iv,{expanded:!0})]})}function A2({children:e}){v1();const t=r=>{const a=Math.max(u1,Math.min(d1,Ul.value+r));Ul.value=a};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(Pw,{}),n("div",{class:"flex-1 flex overflow-hidden",children:[(yt.value||xt.value)&&n("div",{class:"fixed inset-0 bg-black z-40 lg:hidden",style:{opacity:xt.value?(kn.value??0)/Xn*.5:.5,transition:xt.value?"none":"opacity 200ms ease-out"},onClick:()=>yt.value=!1,"aria-hidden":"true"}),n("aside",{style:{"--sidebar-width":`${Ul.value}px`,transform:xt.value?`translateX(${(kn.value??0)-Xn}px)`:void 0},class:`
|
|
170
|
-
fixed inset-y-0 left-0 z-50 w-72 p-2 pr-0 pt-16
|
|
171
|
-
lg:bg-[var(--color-bg-secondary)]
|
|
172
|
-
${xt.value?"":"transition-transform duration-200 ease-out"}
|
|
173
|
-
${!xt.value&&(yt.value?"translate-x-0":"-translate-x-full")}
|
|
174
|
-
lg:relative lg:inset-auto lg:z-auto lg:pt-2 lg:translate-x-0
|
|
175
|
-
lg:w-[var(--sidebar-width)]
|
|
176
|
-
${!yt.value&&"lg:w-0 lg:p-0"}
|
|
177
|
-
${Di.value?"lg:transition-none":""}
|
|
178
|
-
`,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(T2,{})})}),yt.value&&n("div",{class:"hidden lg:flex items-center py-2",children:n(g1,{direction:"horizontal",onResizeStart:()=>Di.value=!0,onResize:t,onResizeEnd:()=>Di.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 Vr=v([]);let M2=0;function gl(e,t="info",r=5e3){const a=`toast-${++M2}`;return Vr.value=[...Vr.value,{id:a,type:t,message:e,duration:r}].slice(-5),a}function R2(e){Vr.value=Vr.value.filter(t=>t.id!==e)}const ie={success:(e,t)=>gl(e,"success",t),error:(e,t)=>gl(e,"error",t),warning:(e,t)=>gl(e,"warning",t),info:(e,t)=>gl(e,"info",t)},I2={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 $2({id:e,type:t,message:r,duration:a=5e3,onDismiss:o}){const l=I2[t];return O(()=>{if(a<=0)return;const s=setTimeout(()=>{o(e)},a);return()=>clearTimeout(s)},[e,a,o]),n("div",{role:"alert","aria-live":"polite",class:`
|
|
179
|
-
flex items-start gap-3 p-4
|
|
180
|
-
rounded-xl border shadow-soft-lg
|
|
181
|
-
backdrop-blur-sm
|
|
182
|
-
${l.bg} ${l.border}
|
|
183
|
-
animate-slide-in
|
|
184
|
-
`,children:[n("span",{class:`flex-shrink-0 ${l.icon}`,"aria-hidden":"true",children:n(N2,{type:t})}),n("p",{class:"flex-1 text-sm text-[var(--color-text-primary)]",children:r}),n(G,{icon:n(ba,{class:"w-4 h-4"}),label:i("actions.close"),variant:"ghost",size:"sm",onClick:()=>o(e)})]})}const D2={"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 L2({position:e="top-right"}){return Vr.value.length===0?null:n("div",{class:`fixed z-50 flex flex-col gap-2 w-full max-w-sm ${D2[e]}`,"aria-label":"Notifications",children:Vr.value.map(t=>n($2,{...t,onDismiss:R2},t.id))})}function N2({type:e}){const t="w-5 h-5";switch(e){case"success":return n(bn,{class:t,"aria-hidden":"true"});case"error":return n(ma,{class:t,"aria-hidden":"true"});case"warning":return n(zn,{class:t,"aria-hidden":"true"});default:return n(Vo,{class:t,"aria-hidden":"true"})}}class O2 extends ht{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),M.ui.error("ErrorBoundary caught error:",t),M.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(F2,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.handleRetry}):this.props.children}}function F2({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:i("errors.generic")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:e?.message||i("errors.unknown")}),n(N,{onClick:r,variant:"primary",children:i("actions.retry")}),!1]})})}const Yt=v([]),Co=v(new Map),P2=300*1e3,Oc=new Map;function z2(){const e=Date.now(),t=[];for(const[r,a]of Oc)e-a>P2&&t.push(r);if(t.length>0){const r=new Map(Co.value);for(const a of t)r.delete(a),Oc.delete(a);Co.value=r,M.exec.debug(`Pruned ${t.length} old resolved approval(s)`)}}const ks=v(!1),_s=v(null);function U2(e){const t={request:e,expiresAtMs:e.expiresAtMs,receivedAt:Date.now()};Yt.value=[...Yt.value,t],M.exec.info(`Exec approval queued: ${e.command} (${Yt.value.length} pending)`)}function H2(e){Yt.value=Yt.value.filter(t=>t.request.requestId!==e)}function B2(){const e=Date.now(),t=Yt.value.length;Yt.value=Yt.value.filter(a=>a.expiresAtMs>e);const r=t-Yt.value.length;r>0&&M.exec.info(`Pruned ${r} expired exec approval(s)`)}async function j2(e,t){ks.value=!0,_s.value=null;try{await F("exec.approval.resolve",{id:e,decision:t}),H2(e);const r=new Map(Co.value);r.set(e,t),Co.value=r,Oc.set(e,Date.now()),z2(),M.exec.info(`Exec ${t} (direct): id=${e}`)}catch(r){const a=r instanceof Error?r.message:"Failed to send decision";throw _s.value=a,M.exec.error(`Exec approval error: ${a}`),r}finally{ks.value=!1}}let Hl=null,Bl=null;function W2(){cv(),Hl=Js(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()?U2(r):M.exec.debug("Ignoring already-expired approval request")}}),Bl=setInterval(B2,1e3),M.exec.info("Exec approval system initialized")}function cv(){Hl&&(Hl(),Hl=null),Bl&&(clearInterval(Bl),Bl=null),Yt.value=[],ks.value=!1,_s.value=null}let cf=!1;D.subscribe(e=>{cf&&!e&&cv(),cf=e});function md(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var vr=md();function uv(e){vr=e}var Xa={exec:()=>null};function te(e,t=""){let r=typeof e=="string"?e:e.source,a={replace:(o,l)=>{let s=typeof l=="string"?l:l.source;return s=s.replace(qe.caret,"$1"),r=r.replace(o,s),a},getRegex:()=>new RegExp(r,t)};return a}var q2=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),qe={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")},K2=/^(?:[ \t]*(?:\n|$))+/,G2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,V2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Jo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Y2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vd=/(?:[*+-]|\d{1,9}[.)])/,dv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hv=te(dv).replace(/bull/g,vd).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(),J2=te(dv).replace(/bull/g,vd).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(),gd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,X2=/^[^\n]+/,bd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Z2=te(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",bd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Q2=te(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,vd).getRegex(),ui="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",xd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ek=te("^ {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",xd).replace("tag",ui).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fv=te(gd).replace("hr",Jo).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",ui).getRegex(),tk=te(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fv).getRegex(),yd={blockquote:tk,code:G2,def:Z2,fences:V2,heading:Y2,hr:Jo,html:ek,lheading:hv,list:Q2,newline:K2,paragraph:fv,table:Xa,text:X2},uf=te("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Jo).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",ui).getRegex(),nk={...yd,lheading:J2,table:uf,paragraph:te(gd).replace("hr",Jo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",uf).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",ui).getRegex()},rk={...yd,html:te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xd).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:Xa,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:te(gd).replace("hr",Jo).replace("heading",` *#{1,6} *[^
|
|
185
|
-
]`).replace("lheading",hv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ak=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ok=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pv=/^( {2,}|\\)\n(?!\s*$)/,lk=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,di=/[\p{P}\p{S}]/u,wd=/[\s\p{P}\p{S}]/u,mv=/[^\s\p{P}\p{S}]/u,sk=te(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,wd).getRegex(),vv=/(?!~)[\p{P}\p{S}]/u,ik=/(?!~)[\s\p{P}\p{S}]/u,ck=/(?:[^\s\p{P}\p{S}]|~)/u,uk=te(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",q2?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),gv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,dk=te(gv,"u").replace(/punct/g,di).getRegex(),hk=te(gv,"u").replace(/punct/g,vv).getRegex(),bv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fk=te(bv,"gu").replace(/notPunctSpace/g,mv).replace(/punctSpace/g,wd).replace(/punct/g,di).getRegex(),pk=te(bv,"gu").replace(/notPunctSpace/g,ck).replace(/punctSpace/g,ik).replace(/punct/g,vv).getRegex(),mk=te("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,mv).replace(/punctSpace/g,wd).replace(/punct/g,di).getRegex(),vk=te(/\\(punct)/,"gu").replace(/punct/g,di).getRegex(),gk=te(/^<(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(),bk=te(xd).replace("(?:-->|$)","-->").getRegex(),xk=te("^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",bk).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ss=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,yk=te(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ss).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xv=te(/^!?\[(label)\]\[(ref)\]/).replace("label",Ss).replace("ref",bd).getRegex(),yv=te(/^!?\[(ref)\](?:\[\])?/).replace("ref",bd).getRegex(),wk=te("reflink|nolink(?!\\()","g").replace("reflink",xv).replace("nolink",yv).getRegex(),df=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,kd={_backpedal:Xa,anyPunctuation:vk,autolink:gk,blockSkip:uk,br:pv,code:ok,del:Xa,emStrongLDelim:dk,emStrongRDelimAst:fk,emStrongRDelimUnd:mk,escape:ak,link:yk,nolink:yv,punctuation:sk,reflink:xv,reflinkSearch:wk,tag:xk,text:lk,url:Xa},kk={...kd,link:te(/^!?\[(label)\]\((.*?)\)/).replace("label",Ss).getRegex(),reflink:te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ss).getRegex()},Fc={...kd,emStrongRDelimAst:pk,emStrongLDelim:hk,url:te(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",df).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:te(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",df).getRegex()},_k={...Fc,br:te(pv).replace("{2,}","*").getRegex(),text:te(Fc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},bl={normal:yd,gfm:nk,pedantic:rk},Aa={normal:kd,gfm:Fc,breaks:_k,pedantic:kk},Sk={"&":"&","<":"<",">":">",'"':""","'":"'"},hf=e=>Sk[e];function cn(e,t){if(t){if(qe.escapeTest.test(e))return e.replace(qe.escapeReplace,hf)}else if(qe.escapeTestNoEncode.test(e))return e.replace(qe.escapeReplaceNoEncode,hf);return e}function ff(e){try{e=encodeURI(e).replace(qe.percentDecode,"%")}catch{return null}return e}function pf(e,t){let r=e.replace(qe.findPipe,(l,s,c)=>{let d=!1,u=s;for(;--u>=0&&c[u]==="\\";)d=!d;return d?"|":" |"}),a=r.split(qe.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(qe.slashPipe,"|");return a}function Ma(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 Ck(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 mf(e,t,r,a,o){let l=t.href,s=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:s,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}function Tk(e,t,r){let a=e.match(r.other.indentCodeCompensation);if(a===null)return t;let o=a[1];return t.split(`
|
|
186
|
-
`).map(l=>{let s=l.match(r.other.beginningSpace);if(s===null)return l;let[c]=s;return c.length>=o.length?l.slice(o.length):l}).join(`
|
|
187
|
-
`)}var Cs=class{options;rules;lexer;constructor(e){this.options=e||vr}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:Ma(r,`
|
|
188
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],a=Tk(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=Ma(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:Ma(t[0],`
|
|
189
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Ma(t[0],`
|
|
190
|
-
`).split(`
|
|
191
|
-
`),a="",o="",l=[];for(;r.length>0;){let s=!1,c=[],d;for(d=0;d<r.length;d++)if(this.rules.other.blockquoteStart.test(r[d]))c.push(r[d]),s=!0;else if(!s)c.push(r[d]);else break;r=r.slice(d);let u=c.join(`
|
|
192
|
-
`),h=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
193
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
194
|
-
${u}`:u,o=o?`${o}
|
|
195
|
-
${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 g=p,k=g.raw+`
|
|
196
|
-
`+r.join(`
|
|
197
|
-
`),_=this.blockquote(k);l[l.length-1]=_,a=a.substring(0,a.length-g.raw.length)+_.raw,o=o.substring(0,o.length-g.text.length)+_.text;break}else if(p?.type==="list"){let g=p,k=g.raw+`
|
|
198
|
-
`+r.join(`
|
|
199
|
-
`),_=this.list(k);l[l.length-1]=_,a=a.substring(0,a.length-p.raw.length)+_.raw,o=o.substring(0,o.length-g.raw.length)+_.raw,r=k.substring(l.at(-1).raw.length).split(`
|
|
200
|
-
`);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),s=!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(`
|
|
201
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,_=>" ".repeat(3*_.length)),p=e.split(`
|
|
202
|
-
`,1)[0],g=!f.trim(),k=0;if(this.options.pedantic?(k=2,h=f.trimStart()):g?k=t[1].length+1:(k=t[2].search(this.rules.other.nonSpaceChar),k=k>4?1:k,h=f.slice(k),k+=t[1].length),g&&this.rules.other.blankLine.test(p)&&(u+=p+`
|
|
203
|
-
`,e=e.substring(p.length+1),d=!0),!d){let _=this.rules.other.nextBulletRegex(k),T=this.rules.other.hrRegex(k),C=this.rules.other.fencesBeginRegex(k),m=this.rules.other.headingBeginRegex(k),b=this.rules.other.htmlBeginRegex(k);for(;e;){let S=e.split(`
|
|
204
|
-
`,1)[0],w;if(p=S,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),w=p):w=p.replace(this.rules.other.tabCharGlobal," "),C.test(p)||m.test(p)||b.test(p)||_.test(p)||T.test(p))break;if(w.search(this.rules.other.nonSpaceChar)>=k||!p.trim())h+=`
|
|
205
|
-
`+w.slice(k);else{if(g||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(f)||m.test(f)||T.test(f))break;h+=`
|
|
206
|
-
`+p}!g&&!p.trim()&&(g=!0),u+=S+`
|
|
207
|
-
`,e=e.substring(S.length+1),f=w.slice(k)}}o.loose||(s?o.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(s=!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=pf(t[1]),a=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
208
|
-
`):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===a.length){for(let s of a)this.rules.other.tableAlignRight.test(s)?l.align.push("right"):this.rules.other.tableAlignCenter.test(s)?l.align.push("center"):this.rules.other.tableAlignLeft.test(s)?l.align.push("left"):l.align.push(null);for(let s=0;s<r.length;s++)l.header.push({text:r[s],tokens:this.lexer.inline(r[s]),header:!0,align:l.align[s]});for(let s of o)l.rows.push(pf(s,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)===`
|
|
209
|
-
`?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=Ma(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{let l=Ck(t[2],"()");if(l===-2)return;if(l>-1){let s=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,s).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)),mf(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 mf(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,s,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(s=[...l].length,a[3]||a[4]){c+=s;continue}else if((a[5]||a[6])&&o%3&&!((o+s)%3)){d+=s;continue}if(c-=s,c>0)continue;s=Math.min(s,s+c+d);let h=[...a[0]][0].length,f=e.slice(0,o+a.index+h+s);if(Math.min(o,s)%2){let g=f.slice(1,-1);return{type:"em",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}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}}}},Et=class Pc{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||vr,this.options.tokenizer=this.options.tokenizer||new Cs,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:qe,block:bl.normal,inline:Aa.normal};this.options.pedantic?(r.block=bl.pedantic,r.inline=Aa.pedantic):this.options.gfm&&(r.block=bl.gfm,this.options.breaks?r.inline=Aa.breaks:r.inline=Aa.gfm),this.tokenizer.rules=r}static get rules(){return{block:bl,inline:Aa}}static lex(t,r){return new Pc(r).lex(t)}static lexInline(t,r){return new Pc(r).inlineTokens(t)}lex(t){t=t.replace(qe.carriageReturn,`
|
|
210
|
-
`),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(qe.tabCharGlobal," ").replace(qe.spaceLine,""));t;){let o;if(this.options.extensions?.block?.some(s=>(o=s.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 s=r.at(-1);o.raw.length===1&&s!==void 0?s.raw+=`
|
|
211
|
-
`:r.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
212
|
-
`)?"":`
|
|
213
|
-
`)+o.raw,s.text+=`
|
|
214
|
-
`+o.text,this.inlineQueue.at(-1).src=s.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 s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
215
|
-
`)?"":`
|
|
216
|
-
`)+o.raw,s.text+=`
|
|
217
|
-
`+o.raw,this.inlineQueue.at(-1).src=s.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 s=1/0,c=t.slice(1),d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},c),typeof d=="number"&&d>=0&&(s=Math.min(s,d))}),s<1/0&&s>=0&&(l=t.substring(0,s+1))}if(this.state.top&&(o=this.tokenizer.paragraph(l))){let s=r.at(-1);a&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`
|
|
218
|
-
`)?"":`
|
|
219
|
-
`)+o.raw,s.text+=`
|
|
220
|
-
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.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 s=r.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
221
|
-
`)?"":`
|
|
222
|
-
`)+o.raw,s.text+=`
|
|
223
|
-
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(o);continue}if(t){let s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}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 s=!1,c="";for(;t;){s||(c=""),s=!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(g=>{p=g.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)),s=!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}},Ts=class{options;parser;constructor(e){this.options=e||vr}space(e){return""}code({text:e,lang:t,escaped:r}){let a=(t||"").match(qe.notSpaceStart)?.[0],o=e.replace(qe.endingNewline,"")+`
|
|
224
|
-
`;return a?'<pre><code class="language-'+cn(a)+'">'+(r?o:cn(o,!0))+`</code></pre>
|
|
225
|
-
`:"<pre><code>"+(r?o:cn(o,!0))+`</code></pre>
|
|
226
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
227
|
-
${this.parser.parse(e)}</blockquote>
|
|
228
|
-
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
229
|
-
`}hr(e){return`<hr>
|
|
230
|
-
`}list(e){let t=e.ordered,r=e.start,a="";for(let s=0;s<e.items.length;s++){let c=e.items[s];a+=this.listitem(c)}let o=t?"ol":"ul",l=t&&r!==1?' start="'+r+'"':"";return"<"+o+l+`>
|
|
231
|
-
`+a+"</"+o+`>
|
|
232
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
233
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
234
|
-
`}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 s=0;s<l.length;s++)r+=this.tablecell(l[s]);a+=this.tablerow({text:r})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
235
|
-
<thead>
|
|
236
|
-
`+t+`</thead>
|
|
237
|
-
`+a+`</table>
|
|
238
|
-
`}tablerow({text:e}){return`<tr>
|
|
239
|
-
${e}</tr>
|
|
240
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
|
|
241
|
-
`}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>${cn(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=ff(e);if(o===null)return a;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+cn(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=ff(e);if(o===null)return cn(r);e=o;let l=`<img src="${e}" alt="${r}"`;return t&&(l+=` title="${cn(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:cn(e.text)}},_d=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}},At=class zc{options;renderer;textRenderer;constructor(t){this.options=t||vr,this.options.renderer=this.options.renderer||new Ts,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _d}static parse(t,r){return new zc(r).parse(t)}static parseInline(t,r){return new zc(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 s=o,c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.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 s='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}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 s=l;switch(s.type){case"escape":{a+=r.text(s);break}case"html":{a+=r.html(s);break}case"link":{a+=r.link(s);break}case"image":{a+=r.image(s);break}case"checkbox":{a+=r.checkbox(s);break}case"strong":{a+=r.strong(s);break}case"em":{a+=r.em(s);break}case"codespan":{a+=r.codespan(s);break}case"br":{a+=r.br(s);break}case"del":{a+=r.del(s);break}case"text":{a+=r.text(s);break}default:{let c='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return a}},Ua=class{options;block;constructor(e){this.options=e||vr}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?Et.lex:Et.lexInline}provideParser(){return this.block?At.parse:At.parseInline}},wv=class{defaults=md();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=At;Renderer=Ts;TextRenderer=_d;Lexer=Et;Tokenizer=Cs;Hooks=Ua;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 s of l)r=r.concat(this.walkTokens(s.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 s=o[l].flat(1/0);r=r.concat(this.walkTokens(s,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(...s){let c=o.renderer.apply(this,s);return c===!1&&(c=l.apply(this,s)),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 Ts(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 s=l,c=r.renderer[s],d=o[s];o[s]=(...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 Cs(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 s=l,c=r.tokenizer[s],d=o[s];o[s]=(...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 Ua;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 s=l,c=r.hooks[s],d=o[s];Ua.passThroughHooks.has(l)?o[s]=u=>{if(this.defaults.async&&Ua.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[s]=(...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(s){let c=[];return c.push(l.call(this,s)),o&&(c=c.concat(o.call(this,s))),c}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Et.lex(e,t??this.defaults)}parser(e,t){return At.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 s=o.hooks?await o.hooks.preprocess(t):t,c=await(o.hooks?await o.hooks.provideLexer():e?Et.lex:Et.lexInline)(s,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?At.parse:At.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(u):u})().catch(l);try{o.hooks&&(t=o.hooks.preprocess(t));let s=(o.hooks?o.hooks.provideLexer():e?Et.lex:Et.lexInline)(t,o);o.hooks&&(s=o.hooks.processAllTokens(s)),o.walkTokens&&this.walkTokens(s,o.walkTokens);let c=(o.hooks?o.hooks.provideParser():e?At.parse:At.parseInline)(s,o);return o.hooks&&(c=o.hooks.postprocess(c)),c}catch(s){return l(s)}}}onError(e,t){return r=>{if(r.message+=`
|
|
242
|
-
Please report this to https://github.com/markedjs/marked.`,e){let a="<p>An error occurred:</p><pre>"+cn(r.message+"",!0)+"</pre>";return t?Promise.resolve(a):a}if(t)return Promise.reject(r);throw r}}},ur=new wv;function ae(e,t){return ur.parse(e,t)}ae.options=ae.setOptions=function(e){return ur.setOptions(e),ae.defaults=ur.defaults,uv(ae.defaults),ae};ae.getDefaults=md;ae.defaults=vr;ae.use=function(...e){return ur.use(...e),ae.defaults=ur.defaults,uv(ae.defaults),ae};ae.walkTokens=function(e,t){return ur.walkTokens(e,t)};ae.parseInline=ur.parseInline;ae.Parser=At;ae.parser=At.parse;ae.Renderer=Ts;ae.TextRenderer=_d;ae.Lexer=Et;ae.lexer=Et.lex;ae.Tokenizer=Cs;ae.Hooks=Ua;ae.parse=ae;ae.options;ae.setOptions;ae.use;ae.walkTokens;ae.parseInline;At.parse;Et.lex;var vf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ek(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zi={exports:{}},gf;function Ak(){return gf||(gf=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,s={},c={manual:a.Prism&&a.Prism.manual,disableWorkerMessageHandler:a.Prism&&a.Prism.disableWorkerMessageHandler,util:{encode:function m(b){return b instanceof d?new d(b.type,m(b.content),b.alias):Array.isArray(b)?b.map(m):b.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++l}),m.__id},clone:function m(b,S){S=S||{};var w,x;switch(c.util.type(b)){case"Object":if(x=c.util.objId(b),S[x])return S[x];w={},S[x]=w;for(var E in b)b.hasOwnProperty(E)&&(w[E]=m(b[E],S));return w;case"Array":return x=c.util.objId(b),S[x]?S[x]:(w=[],S[x]=w,b.forEach(function(L,A){w[A]=m(L,S)}),w);default:return b}},getLanguage:function(m){for(;m;){var b=o.exec(m.className);if(b)return b[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,b){m.className=m.className.replace(RegExp(o,"gi"),""),m.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(w){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(w.stack)||[])[1];if(m){var b=document.getElementsByTagName("script");for(var S in b)if(b[S].src==m)return b[S]}return null}},isActive:function(m,b,S){for(var w="no-"+b;m;){var x=m.classList;if(x.contains(b))return!0;if(x.contains(w))return!1;m=m.parentElement}return!!S}},languages:{plain:s,plaintext:s,text:s,txt:s,extend:function(m,b){var S=c.util.clone(c.languages[m]);for(var w in b)S[w]=b[w];return S},insertBefore:function(m,b,S,w){w=w||c.languages;var x=w[m],E={};for(var L in x)if(x.hasOwnProperty(L)){if(L==b)for(var A in S)S.hasOwnProperty(A)&&(E[A]=S[A]);S.hasOwnProperty(L)||(E[L]=x[L])}var H=w[m];return w[m]=E,c.languages.DFS(c.languages,function($,Y){Y===H&&$!=m&&(this[$]=E)}),E},DFS:function m(b,S,w,x){x=x||{};var E=c.util.objId;for(var L in b)if(b.hasOwnProperty(L)){S.call(b,L,b[L],w||L);var A=b[L],H=c.util.type(A);H==="Object"&&!x[E(A)]?(x[E(A)]=!0,m(A,S,null,x)):H==="Array"&&!x[E(A)]&&(x[E(A)]=!0,m(A,S,L,x))}}},plugins:{},highlightAll:function(m,b){c.highlightAllUnder(document,m,b)},highlightAllUnder:function(m,b,S){var w={callback:S,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",w),w.elements=Array.prototype.slice.apply(w.container.querySelectorAll(w.selector)),c.hooks.run("before-all-elements-highlight",w);for(var x=0,E;E=w.elements[x++];)c.highlightElement(E,b===!0,w.callback)},highlightElement:function(m,b,S){var w=c.util.getLanguage(m),x=c.languages[w];c.util.setLanguage(m,w);var E=m.parentElement;E&&E.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(E,w);var L=m.textContent,A={element:m,language:w,grammar:x,code:L};function H(Y){A.highlightedCode=Y,c.hooks.run("before-insert",A),A.element.innerHTML=A.highlightedCode,c.hooks.run("after-highlight",A),c.hooks.run("complete",A),S&&S.call(A.element)}if(c.hooks.run("before-sanity-check",A),E=A.element.parentElement,E&&E.nodeName.toLowerCase()==="pre"&&!E.hasAttribute("tabindex")&&E.setAttribute("tabindex","0"),!A.code){c.hooks.run("complete",A),S&&S.call(A.element);return}if(c.hooks.run("before-highlight",A),!A.grammar){H(c.util.encode(A.code));return}if(b&&a.Worker){var $=new Worker(c.filename);$.onmessage=function(Y){H(Y.data)},$.postMessage(JSON.stringify({language:A.language,code:A.code,immediateClose:!0}))}else H(c.highlight(A.code,A.grammar,A.language))},highlight:function(m,b,S){var w={code:m,grammar:b,language:S};if(c.hooks.run("before-tokenize",w),!w.grammar)throw new Error('The language "'+w.language+'" has no grammar.');return w.tokens=c.tokenize(w.code,w.grammar),c.hooks.run("after-tokenize",w),d.stringify(c.util.encode(w.tokens),w.language)},tokenize:function(m,b){var S=b.rest;if(S){for(var w in S)b[w]=S[w];delete b.rest}var x=new f;return p(x,x.head,m),h(m,x,b,x.head,0),k(x)},hooks:{all:{},add:function(m,b){var S=c.hooks.all;S[m]=S[m]||[],S[m].push(b)},run:function(m,b){var S=c.hooks.all[m];if(!(!S||!S.length))for(var w=0,x;x=S[w++];)x(b)}},Token:d};a.Prism=c;function d(m,b,S,w){this.type=m,this.content=b,this.alias=S,this.length=(w||"").length|0}d.stringify=function m(b,S){if(typeof b=="string")return b;if(Array.isArray(b)){var w="";return b.forEach(function(H){w+=m(H,S)}),w}var x={type:b.type,content:m(b.content,S),tag:"span",classes:["token",b.type],attributes:{},language:S},E=b.alias;E&&(Array.isArray(E)?Array.prototype.push.apply(x.classes,E):x.classes.push(E)),c.hooks.run("wrap",x);var L="";for(var A in x.attributes)L+=" "+A+'="'+(x.attributes[A]||"").replace(/"/g,""")+'"';return"<"+x.tag+' class="'+x.classes.join(" ")+'"'+L+">"+x.content+"</"+x.tag+">"};function u(m,b,S,w){m.lastIndex=b;var x=m.exec(S);if(x&&w&&x[1]){var E=x[1].length;x.index+=E,x[0]=x[0].slice(E)}return x}function h(m,b,S,w,x,E){for(var L in S)if(!(!S.hasOwnProperty(L)||!S[L])){var A=S[L];A=Array.isArray(A)?A:[A];for(var H=0;H<A.length;++H){if(E&&E.cause==L+","+H)return;var $=A[H],Y=$.inside,ze=!!$.lookbehind,xe=!!$.greedy,wa=$.alias;if(xe&&!$.pattern.global){var ka=$.pattern.toString().match(/[imsuy]*$/)[0];$.pattern=RegExp($.pattern.source,ka+"g")}for(var xn=$.pattern||$,ve=w.next,U=x;ve!==b.tail&&!(E&&U>=E.reach);U+=ve.value.length,ve=ve.next){var le=ve.value;if(b.length>m.length)return;if(!(le instanceof d)){var fe=1,Ze;if(xe){if(Ze=u(xn,U,m,ze),!Ze||Ze.index>=m.length)break;var Nt=Ze.index,_e=Ze.index+Ze[0].length,Ct=U;for(Ct+=ve.value.length;Nt>=Ct;)ve=ve.next,Ct+=ve.value.length;if(Ct-=ve.value.length,U=Ct,ve.value instanceof d)continue;for(var se=ve;se!==b.tail&&(Ct<_e||typeof se.value=="string");se=se.next)fe++,Ct+=se.value.length;fe--,le=m.slice(U,Ct),Ze.index-=U}else if(Ze=u(xn,0,le,ze),!Ze)continue;var Nt=Ze.index,yn=Ze[0],Ot=le.slice(0,Nt),_a=le.slice(Nt+yn.length),Un=U+le.length;E&&Un>E.reach&&(E.reach=Un);var Hn=ve.prev;Ot&&(Hn=p(b,Hn,Ot),U+=Ot.length),g(b,Hn,fe);var el=new d(L,Y?c.tokenize(yn,Y):yn,wa,yn);if(ve=p(b,Hn,el),_a&&p(b,ve,_a),fe>1){var Ft={cause:L+","+H,reach:Un};h(m,b,S,ve.prev,U,Ft),E&&Ft.reach>E.reach&&(E.reach=Ft.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},b={value:null,prev:m,next:null};m.next=b,this.head=m,this.tail=b,this.length=0}function p(m,b,S){var w=b.next,x={value:S,prev:b,next:w};return b.next=x,w.prev=x,m.length++,x}function g(m,b,S){for(var w=b.next,x=0;x<S&&w!==m.tail;x++)w=w.next;b.next=w,w.prev=b,m.length-=x}function k(m){for(var b=[],S=m.head.next;S!==m.tail;)b.push(S.value),S=S.next;return b}if(!a.document)return a.addEventListener&&(c.disableWorkerMessageHandler||a.addEventListener("message",function(m){var b=JSON.parse(m.data),S=b.language,w=b.code,x=b.immediateClose;a.postMessage(c.highlight(w,c.languages[S],S)),x&&a.close()},!1)),c;var _=c.util.currentScript();_&&(c.filename=_.src,_.hasAttribute("data-manual")&&(c.manual=!0));function T(){c.manual||c.highlightAll()}if(!c.manual){var C=document.readyState;C==="loading"||C==="interactive"&&_&&_.defer?document.addEventListener("DOMContentLoaded",T):window.requestAnimationFrame?window.requestAnimationFrame(T):window.setTimeout(T,16)}return c})(t);e.exports&&(e.exports=r),typeof vf<"u"&&(vf.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 s={};s["language-"+l]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[l]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};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(_,T){return"✖ Error "+_+" while fetching file: "+T},l="✖ Error: File does not exist or is empty",s={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(_,T,C){var m=new XMLHttpRequest;m.open("GET",_,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?T(m.responseText):m.status>=400?C(o(m.status,m.statusText)):C(l))},m.send(null)}function g(_){var T=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(_||"");if(T){var C=Number(T[1]),m=T[2],b=T[3];return m?b?[C,Number(b)]:[C,void 0]:[C,C]}}r.hooks.add("before-highlightall",function(_){_.selector+=", "+f}),r.hooks.add("before-sanity-check",function(_){var T=_.element;if(T.matches(f)){_.code="",T.setAttribute(c,d);var C=T.appendChild(document.createElement("CODE"));C.textContent=a;var m=T.getAttribute("data-src"),b=_.language;if(b==="none"){var S=(/\.(\w+)$/.exec(m)||[,"none"])[1];b=s[S]||S}r.util.setLanguage(C,b),r.util.setLanguage(T,b);var w=r.plugins.autoloader;w&&w.loadLanguages(b),p(m,function(x){T.setAttribute(c,u);var E=g(T.getAttribute("data-range"));if(E){var L=x.split(/\r\n?|\n/g),A=E[0],H=E[1]==null?L.length:E[1];A<0&&(A+=L.length),A=Math.max(0,Math.min(A-1,L.length)),H<0&&(H+=L.length),H=Math.max(0,Math.min(H,L.length)),x=L.slice(A,H).join(`
|
|
243
|
-
`),T.hasAttribute("data-start")||T.setAttribute("data-start",String(A+1))}C.textContent=x,r.highlightElement(C)},function(x){T.setAttribute(c,h),C.textContent=x})}}),r.plugins.fileHighlight={highlight:function(T){for(var C=(T||document).querySelectorAll(f),m=0,b;b=C[m++];)r.highlightElement(b)}};var k=!1;r.fileHighlight=function(){k||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),k=!0),r.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(zi)),zi.exports}var Mk=Ak();const Za=Ek(Mk);var bf={},xf;function Rk(){return xf||(xf=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)),bf}Rk();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 s=function(d){return d?typeof d=="string"?d:typeof d.content=="string"?d.content:d.content.map(s).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===s(f.content[0].content[1])&&u.pop():f.content[f.content.length-1].content==="/>"||u.push({tagName:s(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 g=s(f);h<d.length-1&&(typeof d[h+1]=="string"||d[h+1].type==="plain-text")&&(g+=s(d[h+1]),d.splice(h+1,1)),h>0&&(typeof d[h-1]=="string"||d[h-1].type==="plain-text")&&(g=s(d[h-1])+g,d.splice(h-1,1),h--),d[h]=new e.Token("plain-text",g,null,g)}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,s=0;s<o.length;s++)l[o[s]]=e.languages.bash[o[s]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);var yf={},wf;function Ik(){return wf||(wf=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),yf}Ik();var kf={},_f;function $k(){return _f||(_f=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)),kf}$k();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 s(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:s(/\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:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(l),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?: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 g=0,k=p.length;g<k;g++){var _=p[g];if(_.type!=="code"){f(_.content);continue}var T=_.content[1],C=_.content[3];if(T&&C&&T.type==="code-language"&&C.type==="code-block"&&typeof T.content=="string"){var m=T.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");m=(/[a-z][\w-]*/i.exec(m)||[""])[0].toLowerCase();var b="language-"+m;C.alias?typeof C.alias=="string"?C.alias=[C.alias,b]:C.alias.push(b):C.alias=[b]}}}f(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var f="",p=0,g=h.classes.length;p<g;p++){var k=h.classes[p],_=/language-(.+)/.exec(k);if(_){f=_[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 C="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=C,e.plugins.autoloader.loadLanguages(f,function(){var m=document.getElementById(C);m&&(m.innerHTML=e.highlight(m.textContent,e.languages[f],f))})}}});var s=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(s,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,g){if(g=g.toLowerCase(),g[0]==="#"){var k;return g[1]==="x"?k=parseInt(g.slice(2),16):k=Number(g.slice(1)),d(k)}else{var _=c[g];return _||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
|
|
244
|
-
?|
|
|
245
|
-
|(?![\\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 Dk={js:"javascript",ts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",dockerfile:"docker","":"plaintext"};function kv(e){const t=e.toLowerCase().trim();return Dk[t]||t}function jl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Lk(e,t){const r=kv(t);if(Za.languages[r])try{return Za.highlight(e,Za.languages[r],r)}catch{}return jl(e)}function Nk(){const e=new wv({gfm:!0,breaks:!0});return e.use({renderer:{code(t){const r=t.lang||"",a=t.text,o=Lk(a,r);return`<pre class="code-block${r?` language-${kv(r)}`:""}"><code>${o}</code></pre>`},link(t){const r=t.href,a=t.title?` title="${jl(t.title)}"`:"",o=t.text;return r.startsWith("http://")||r.startsWith("https://")?`<a href="${jl(r)}"${a} target="_blank" rel="noopener noreferrer">${o}</a>`:`<a href="${jl(r)}"${a}>${o}</a>`}}}),e}const Ok=Nk();function Fk(e){return Ok.parse(e)}const{entries:_v,setPrototypeOf:Sf,isFrozen:Pk,getPrototypeOf:zk,getOwnPropertyDescriptor:Uk}=Object;let{freeze:Ye,seal:_t,create:Uc}=Object,{apply:Hc,construct:Bc}=typeof Reflect<"u"&&Reflect;Ye||(Ye=function(t){return t});_t||(_t=function(t){return t});Hc||(Hc=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)});Bc||(Bc=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 xl=Je(Array.prototype.forEach),Hk=Je(Array.prototype.lastIndexOf),Cf=Je(Array.prototype.pop),Ra=Je(Array.prototype.push),Bk=Je(Array.prototype.splice),Wl=Je(String.prototype.toLowerCase),Ui=Je(String.prototype.toString),Hi=Je(String.prototype.match),Ia=Je(String.prototype.replace),jk=Je(String.prototype.indexOf),Wk=Je(String.prototype.trim),Tt=Je(Object.prototype.hasOwnProperty),Ue=Je(RegExp.prototype.test),$a=qk(TypeError);function Je(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 Hc(e,t,a)}}function qk(e){return function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return Bc(e,r)}}function J(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wl;Sf&&Sf(e,null);let a=t.length;for(;a--;){let o=t[a];if(typeof o=="string"){const l=r(o);l!==o&&(Pk(t)||(t[a]=l),o=l)}e[o]=!0}return e}function Kk(e){for(let t=0;t<e.length;t++)Tt(e,t)||(e[t]=null);return e}function Ut(e){const t=Uc(null);for(const[r,a]of _v(e))Tt(e,r)&&(Array.isArray(a)?t[r]=Kk(a):a&&typeof a=="object"&&a.constructor===Object?t[r]=Ut(a):t[r]=a);return t}function Da(e,t){for(;e!==null;){const a=Uk(e,t);if(a){if(a.get)return Je(a.get);if(typeof a.value=="function")return Je(a.value)}e=zk(e)}function r(){return null}return r}const Tf=Ye(["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"]),Bi=Ye(["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"]),ji=Ye(["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"]),Gk=Ye(["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"]),Wi=Ye(["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"]),Vk=Ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ef=Ye(["#text"]),Af=Ye(["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"]),qi=Ye(["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"]),Mf=Ye(["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"]),yl=Ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yk=_t(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Jk=_t(/<%[\w\W]*|[\w\W]*%>/gm),Xk=_t(/\$\{[\w\W]*/gm),Zk=_t(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qk=_t(/^aria-[\-\w]+$/),Sv=_t(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),e4=_t(/^(?:\w+script|data):/i),t4=_t(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cv=_t(/^html$/i),n4=_t(/^[a-z][.\w]*(-[.\w]+)+$/i);var Rf=Object.freeze({__proto__:null,ARIA_ATTR:Qk,ATTR_WHITESPACE:t4,CUSTOM_ELEMENT:n4,DATA_ATTR:Zk,DOCTYPE_NAME:Cv,ERB_EXPR:Jk,IS_ALLOWED_URI:Sv,IS_SCRIPT_OR_DATA:e4,MUSTACHE_EXPR:Yk,TMPLIT_EXPR:Xk});const La={element:1,text:3,progressingInstruction:7,comment:8,document:9},r4=function(){return typeof window>"u"?null:window},a4=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(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},If=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Tv(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r4();const t=z=>Tv(z);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==La.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const a=r,o=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:s,Node:c,Element:d,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:g}=e,k=d.prototype,_=Da(k,"cloneNode"),T=Da(k,"remove"),C=Da(k,"nextSibling"),m=Da(k,"childNodes"),b=Da(k,"parentNode");if(typeof s=="function"){const z=r.createElement("template");z.content&&z.content.ownerDocument&&(r=z.content.ownerDocument)}let S,w="";const{implementation:x,createNodeIterator:E,createDocumentFragment:L,getElementsByTagName:A}=r,{importNode:H}=a;let $=If();t.isSupported=typeof _v=="function"&&typeof b=="function"&&x&&x.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:ze,TMPLIT_EXPR:xe,DATA_ATTR:wa,ARIA_ATTR:ka,IS_SCRIPT_OR_DATA:xn,ATTR_WHITESPACE:ve,CUSTOM_ELEMENT:U}=Rf;let{IS_ALLOWED_URI:le}=Rf,fe=null;const Ze=J({},[...Tf,...Bi,...ji,...Wi,...Ef]);let _e=null;const Ct=J({},[...Af,...qi,...Mf,...yl]);let se=Object.seal(Uc(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}})),Nt=null,yn=null;const Ot=Object.seal(Uc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let _a=!0,Un=!0,Hn=!1,el=!0,Ft=!1,tl=!0,Bn=!1,gi=!1,bi=!1,gr=!1,nl=!1,rl=!1,Pd=!0,zd=!1;const Ig="user-content-";let xi=!0,Sa=!1,br={},Pt=null;const yi=J({},["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 Ud=null;const Hd=J({},["audio","video","img","source","image","track"]);let wi=null;const Bd=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),al="http://www.w3.org/1998/Math/MathML",ol="http://www.w3.org/2000/svg",an="http://www.w3.org/1999/xhtml";let xr=an,ki=!1,_i=null;const $g=J({},[al,ol,an],Ui);let ll=J({},["mi","mo","mn","ms","mtext"]),sl=J({},["annotation-xml"]);const Dg=J({},["title","style","font","a","script"]);let Ca=null;const Lg=["application/xhtml+xml","text/html"],Ng="text/html";let Se=null,yr=null;const Og=r.createElement("form"),jd=function(y){return y instanceof RegExp||y instanceof Function},Si=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(yr&&yr===y)){if((!y||typeof y!="object")&&(y={}),y=Ut(y),Ca=Lg.indexOf(y.PARSER_MEDIA_TYPE)===-1?Ng:y.PARSER_MEDIA_TYPE,Se=Ca==="application/xhtml+xml"?Ui:Wl,fe=Tt(y,"ALLOWED_TAGS")?J({},y.ALLOWED_TAGS,Se):Ze,_e=Tt(y,"ALLOWED_ATTR")?J({},y.ALLOWED_ATTR,Se):Ct,_i=Tt(y,"ALLOWED_NAMESPACES")?J({},y.ALLOWED_NAMESPACES,Ui):$g,wi=Tt(y,"ADD_URI_SAFE_ATTR")?J(Ut(Bd),y.ADD_URI_SAFE_ATTR,Se):Bd,Ud=Tt(y,"ADD_DATA_URI_TAGS")?J(Ut(Hd),y.ADD_DATA_URI_TAGS,Se):Hd,Pt=Tt(y,"FORBID_CONTENTS")?J({},y.FORBID_CONTENTS,Se):yi,Nt=Tt(y,"FORBID_TAGS")?J({},y.FORBID_TAGS,Se):Ut({}),yn=Tt(y,"FORBID_ATTR")?J({},y.FORBID_ATTR,Se):Ut({}),br=Tt(y,"USE_PROFILES")?y.USE_PROFILES:!1,_a=y.ALLOW_ARIA_ATTR!==!1,Un=y.ALLOW_DATA_ATTR!==!1,Hn=y.ALLOW_UNKNOWN_PROTOCOLS||!1,el=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ft=y.SAFE_FOR_TEMPLATES||!1,tl=y.SAFE_FOR_XML!==!1,Bn=y.WHOLE_DOCUMENT||!1,gr=y.RETURN_DOM||!1,nl=y.RETURN_DOM_FRAGMENT||!1,rl=y.RETURN_TRUSTED_TYPE||!1,bi=y.FORCE_BODY||!1,Pd=y.SANITIZE_DOM!==!1,zd=y.SANITIZE_NAMED_PROPS||!1,xi=y.KEEP_CONTENT!==!1,Sa=y.IN_PLACE||!1,le=y.ALLOWED_URI_REGEXP||Sv,xr=y.NAMESPACE||an,ll=y.MATHML_TEXT_INTEGRATION_POINTS||ll,sl=y.HTML_INTEGRATION_POINTS||sl,se=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&jd(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(se.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&jd(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(se.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ft&&(Un=!1),nl&&(gr=!0),br&&(fe=J({},Ef),_e=[],br.html===!0&&(J(fe,Tf),J(_e,Af)),br.svg===!0&&(J(fe,Bi),J(_e,qi),J(_e,yl)),br.svgFilters===!0&&(J(fe,ji),J(_e,qi),J(_e,yl)),br.mathMl===!0&&(J(fe,Wi),J(_e,Mf),J(_e,yl))),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?Ot.tagCheck=y.ADD_TAGS:(fe===Ze&&(fe=Ut(fe)),J(fe,y.ADD_TAGS,Se))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?Ot.attributeCheck=y.ADD_ATTR:(_e===Ct&&(_e=Ut(_e)),J(_e,y.ADD_ATTR,Se))),y.ADD_URI_SAFE_ATTR&&J(wi,y.ADD_URI_SAFE_ATTR,Se),y.FORBID_CONTENTS&&(Pt===yi&&(Pt=Ut(Pt)),J(Pt,y.FORBID_CONTENTS,Se)),y.ADD_FORBID_CONTENTS&&(Pt===yi&&(Pt=Ut(Pt)),J(Pt,y.ADD_FORBID_CONTENTS,Se)),xi&&(fe["#text"]=!0),Bn&&J(fe,["html","head","body"]),fe.table&&(J(fe,["tbody"]),delete Nt.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw $a('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $a('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=y.TRUSTED_TYPES_POLICY,w=S.createHTML("")}else S===void 0&&(S=a4(g,o)),S!==null&&typeof w=="string"&&(w=S.createHTML(""));Ye&&Ye(y),yr=y}},Wd=J({},[...Bi,...ji,...Gk]),qd=J({},[...Wi,...Vk]),Fg=function(y){let I=b(y);(!I||!I.tagName)&&(I={namespaceURI:xr,tagName:"template"});const P=Wl(y.tagName),ue=Wl(I.tagName);return _i[y.namespaceURI]?y.namespaceURI===ol?I.namespaceURI===an?P==="svg":I.namespaceURI===al?P==="svg"&&(ue==="annotation-xml"||ll[ue]):!!Wd[P]:y.namespaceURI===al?I.namespaceURI===an?P==="math":I.namespaceURI===ol?P==="math"&&sl[ue]:!!qd[P]:y.namespaceURI===an?I.namespaceURI===ol&&!sl[ue]||I.namespaceURI===al&&!ll[ue]?!1:!qd[P]&&(Dg[P]||!Wd[P]):!!(Ca==="application/xhtml+xml"&&_i[y.namespaceURI]):!1},zt=function(y){Ra(t.removed,{element:y});try{b(y).removeChild(y)}catch{T(y)}},jn=function(y,I){try{Ra(t.removed,{attribute:I.getAttributeNode(y),from:I})}catch{Ra(t.removed,{attribute:null,from:I})}if(I.removeAttribute(y),y==="is")if(gr||nl)try{zt(I)}catch{}else try{I.setAttribute(y,"")}catch{}},Kd=function(y){let I=null,P=null;if(bi)y="<remove></remove>"+y;else{const ye=Hi(y,/^[\r\n\t ]+/);P=ye&&ye[0]}Ca==="application/xhtml+xml"&&xr===an&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const ue=S?S.createHTML(y):y;if(xr===an)try{I=new p().parseFromString(ue,Ca)}catch{}if(!I||!I.documentElement){I=x.createDocument(xr,"template",null);try{I.documentElement.innerHTML=ki?w:ue}catch{}}const Le=I.body||I.documentElement;return y&&P&&Le.insertBefore(r.createTextNode(P),Le.childNodes[0]||null),xr===an?A.call(I,Bn?"html":"body")[0]:Bn?I.documentElement:Le},Gd=function(y){return E.call(y.ownerDocument||y,y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Ci=function(y){return y instanceof f&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof h)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},Vd=function(y){return typeof c=="function"&&y instanceof c};function on(z,y,I){xl(z,P=>{P.call(t,y,I,yr)})}const Yd=function(y){let I=null;if(on($.beforeSanitizeElements,y,null),Ci(y))return zt(y),!0;const P=Se(y.nodeName);if(on($.uponSanitizeElement,y,{tagName:P,allowedTags:fe}),tl&&y.hasChildNodes()&&!Vd(y.firstElementChild)&&Ue(/<[/\w!]/g,y.innerHTML)&&Ue(/<[/\w!]/g,y.textContent)||y.nodeType===La.progressingInstruction||tl&&y.nodeType===La.comment&&Ue(/<[/\w]/g,y.data))return zt(y),!0;if(!(Ot.tagCheck instanceof Function&&Ot.tagCheck(P))&&(!fe[P]||Nt[P])){if(!Nt[P]&&Xd(P)&&(se.tagNameCheck instanceof RegExp&&Ue(se.tagNameCheck,P)||se.tagNameCheck instanceof Function&&se.tagNameCheck(P)))return!1;if(xi&&!Pt[P]){const ue=b(y)||y.parentNode,Le=m(y)||y.childNodes;if(Le&&ue){const ye=Le.length;for(let Qe=ye-1;Qe>=0;--Qe){const ln=_(Le[Qe],!0);ln.__removalCount=(y.__removalCount||0)+1,ue.insertBefore(ln,C(y))}}}return zt(y),!0}return y instanceof d&&!Fg(y)||(P==="noscript"||P==="noembed"||P==="noframes")&&Ue(/<\/no(script|embed|frames)/i,y.innerHTML)?(zt(y),!0):(Ft&&y.nodeType===La.text&&(I=y.textContent,xl([Y,ze,xe],ue=>{I=Ia(I,ue," ")}),y.textContent!==I&&(Ra(t.removed,{element:y.cloneNode()}),y.textContent=I)),on($.afterSanitizeElements,y,null),!1)},Jd=function(y,I,P){if(Pd&&(I==="id"||I==="name")&&(P in r||P in Og))return!1;if(!(Un&&!yn[I]&&Ue(wa,I))){if(!(_a&&Ue(ka,I))){if(!(Ot.attributeCheck instanceof Function&&Ot.attributeCheck(I,y))){if(!_e[I]||yn[I]){if(!(Xd(y)&&(se.tagNameCheck instanceof RegExp&&Ue(se.tagNameCheck,y)||se.tagNameCheck instanceof Function&&se.tagNameCheck(y))&&(se.attributeNameCheck instanceof RegExp&&Ue(se.attributeNameCheck,I)||se.attributeNameCheck instanceof Function&&se.attributeNameCheck(I,y))||I==="is"&&se.allowCustomizedBuiltInElements&&(se.tagNameCheck instanceof RegExp&&Ue(se.tagNameCheck,P)||se.tagNameCheck instanceof Function&&se.tagNameCheck(P))))return!1}else if(!wi[I]){if(!Ue(le,Ia(P,ve,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&y!=="script"&&jk(P,"data:")===0&&Ud[y])){if(!(Hn&&!Ue(xn,Ia(P,ve,"")))){if(P)return!1}}}}}}}return!0},Xd=function(y){return y!=="annotation-xml"&&Hi(y,U)},Zd=function(y){on($.beforeSanitizeAttributes,y,null);const{attributes:I}=y;if(!I||Ci(y))return;const P={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_e,forceKeepAttr:void 0};let ue=I.length;for(;ue--;){const Le=I[ue],{name:ye,namespaceURI:Qe,value:ln}=Le,wr=Se(ye),Ti=ln;let Me=ye==="value"?Ti:Wk(Ti);if(P.attrName=wr,P.attrValue=Me,P.keepAttr=!0,P.forceKeepAttr=void 0,on($.uponSanitizeAttribute,y,P),Me=P.attrValue,zd&&(wr==="id"||wr==="name")&&(jn(ye,y),Me=Ig+Me),tl&&Ue(/((--!?|])>)|<\/(style|title|textarea)/i,Me)){jn(ye,y);continue}if(wr==="attributename"&&Hi(Me,"href")){jn(ye,y);continue}if(P.forceKeepAttr)continue;if(!P.keepAttr){jn(ye,y);continue}if(!el&&Ue(/\/>/i,Me)){jn(ye,y);continue}Ft&&xl([Y,ze,xe],eh=>{Me=Ia(Me,eh," ")});const Qd=Se(y.nodeName);if(!Jd(Qd,wr,Me)){jn(ye,y);continue}if(S&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Qe)switch(g.getAttributeType(Qd,wr)){case"TrustedHTML":{Me=S.createHTML(Me);break}case"TrustedScriptURL":{Me=S.createScriptURL(Me);break}}if(Me!==Ti)try{Qe?y.setAttributeNS(Qe,ye,Me):y.setAttribute(ye,Me),Ci(y)?zt(y):Cf(t.removed)}catch{jn(ye,y)}}on($.afterSanitizeAttributes,y,null)},Pg=function z(y){let I=null;const P=Gd(y);for(on($.beforeSanitizeShadowDOM,y,null);I=P.nextNode();)on($.uponSanitizeShadowNode,I,null),Yd(I),Zd(I),I.content instanceof l&&z(I.content);on($.afterSanitizeShadowDOM,y,null)};return t.sanitize=function(z){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,P=null,ue=null,Le=null;if(ki=!z,ki&&(z="<!-->"),typeof z!="string"&&!Vd(z))if(typeof z.toString=="function"){if(z=z.toString(),typeof z!="string")throw $a("dirty is not a string, aborting")}else throw $a("toString is not a function");if(!t.isSupported)return z;if(gi||Si(y),t.removed=[],typeof z=="string"&&(Sa=!1),Sa){if(z.nodeName){const ln=Se(z.nodeName);if(!fe[ln]||Nt[ln])throw $a("root node is forbidden and cannot be sanitized in-place")}}else if(z instanceof c)I=Kd("<!---->"),P=I.ownerDocument.importNode(z,!0),P.nodeType===La.element&&P.nodeName==="BODY"||P.nodeName==="HTML"?I=P:I.appendChild(P);else{if(!gr&&!Ft&&!Bn&&z.indexOf("<")===-1)return S&&rl?S.createHTML(z):z;if(I=Kd(z),!I)return gr?null:rl?w:""}I&&bi&&zt(I.firstChild);const ye=Gd(Sa?z:I);for(;ue=ye.nextNode();)Yd(ue),Zd(ue),ue.content instanceof l&&Pg(ue.content);if(Sa)return z;if(gr){if(nl)for(Le=L.call(I.ownerDocument);I.firstChild;)Le.appendChild(I.firstChild);else Le=I;return(_e.shadowroot||_e.shadowrootmode)&&(Le=H.call(a,Le,!0)),Le}let Qe=Bn?I.outerHTML:I.innerHTML;return Bn&&fe["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&Ue(Cv,I.ownerDocument.doctype.name)&&(Qe="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
|
|
246
|
-
`+Qe),Ft&&xl([Y,ze,xe],ln=>{Qe=Ia(Qe,ln," ")}),S&&rl?S.createHTML(Qe):Qe},t.setConfig=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Si(z),gi=!0},t.clearConfig=function(){yr=null,gi=!1},t.isValidAttribute=function(z,y,I){yr||Si({});const P=Se(z),ue=Se(y);return Jd(P,ue,I)},t.addHook=function(z,y){typeof y=="function"&&Ra($[z],y)},t.removeHook=function(z,y){if(y!==void 0){const I=Hk($[z],y);return I===-1?void 0:Bk($[z],I,1)[0]}return Cf($[z])},t.removeHooks=function(z){$[z]=[]},t.removeAllHooks=function(){$=If()},t}var Ev=Tv();const o4={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,ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|data):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i};function l4(e){return Ev.sanitize(e,{...o4,RETURN_TRUSTED_TYPE:!1})}function $f(e){return Ev.sanitize(e,{ALLOWED_TAGS:["span","code","pre","br"],ALLOWED_ATTR:["class"],FORBID_TAGS:["script","style"],FORBID_ATTR:["onerror","onload","onclick"],RETURN_TRUSTED_TYPE:!1})}function Es({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 s4="bg-[var(--color-warning-muted)] rounded px-0.5";function i4(e,t){if(!t)return;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:s=>{const c=s.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 s of a){const c=s.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 g=0;for(const k of u){k.start>g&&p.appendChild(document.createTextNode(c.slice(g,k.start)));const _=document.createElement("mark");_.className=s4,_.textContent=c.slice(k.start,k.end),p.appendChild(_),g=k.end}g<c.length&&p.appendChild(document.createTextNode(c.slice(g))),s.replaceWith(p)}}function hi({content:e,isStreaming:t=!1}){const r=W(null),a=wt(()=>{if(!e)return"";const l=Fk(e);return l4(l)},[e]),o=Zs.value.trim();return O(()=>{if(!r.current)return;const l=r.current.querySelectorAll("pre.code-block");for(const s of l){if(s.querySelector(".copy-button"))return;const c=document.createElement("button");c.className="copy-button",c.textContent=i("actions.copy"),c.setAttribute("type","button"),c.onclick=async()=>{const d=s.querySelector("code")?.textContent||"";try{await navigator.clipboard.writeText(d),c.textContent=i("actions.copied"),setTimeout(()=>{c.textContent=i("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=i("actions.copied"),setTimeout(()=>{c.textContent=i("actions.copy")},2e3)}},s.classList.add("relative"),s.insertBefore(c,s.firstChild)}},[a]),O(()=>{!r.current||!o||(r.current.innerHTML=a,i4(r.current,o))},[a,o]),!e&&t?n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[i("chat.thinking"),n(Es,{})]}):n("div",{ref:r,class:"message-content prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:a}})}const wl=`
|
|
247
|
-
p-2 rounded-full cursor-pointer
|
|
248
|
-
bg-white/10 text-white hover:bg-white/20
|
|
249
|
-
transition-colors
|
|
250
|
-
`;async function c4(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 u4(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 Av({images:e}){const[t,r]=B(null),a=W(null);if(O(()=>{t!==null&&a.current?.focus()},[t]),e.length===0)return null;const o=(l,s,c)=>{l.stopPropagation(),c4(s,u4(s,c))};return n(K,{children:[n("div",{class:"flex flex-wrap gap-2 mt-2",children:e.map((l,s)=>n("div",{class:"relative group",children:[n("button",{type:"button",onClick:()=>r(s),class:`
|
|
251
|
-
relative rounded-lg overflow-hidden cursor-pointer
|
|
252
|
-
border border-[var(--color-border)]
|
|
253
|
-
hover:border-[var(--color-accent)] hover:shadow-md
|
|
254
|
-
transition-all
|
|
255
|
-
`,children:n("img",{src:l.url,alt:l.alt||`Image ${s+1}`,class:"max-w-[200px] max-h-[200px] object-cover",loading:"lazy"})}),n("button",{type:"button",onClick:c=>o(c,l.url,s),"aria-label":i("actions.download"),class:`
|
|
256
|
-
absolute bottom-2 right-2 p-1.5 rounded-lg cursor-pointer
|
|
257
|
-
bg-black/60 text-white
|
|
258
|
-
opacity-0 group-hover:opacity-100
|
|
259
|
-
hover:bg-black/80
|
|
260
|
-
transition-all
|
|
261
|
-
`,children:n(Dt,{class:"w-4 h-4"})})]},s))}),t!==null&&n("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":i("chat.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":i("actions.download"),class:wl,children:n(Dt,{class:"w-6 h-6"})}),n("button",{type:"button",onClick:()=>r(null),"aria-label":i("actions.close"),class:wl,children:n(ma,{class:"w-6 h-6"})})]}),e.length>1&&n(K,{children:[n("button",{type:"button",onClick:l=>{l.stopPropagation(),r((t-1+e.length)%e.length)},"aria-label":i("actions.back"),class:`${wl} absolute left-4 p-3 text-2xl`,children:"‹"}),n("button",{type:"button",onClick:l=>{l.stopPropagation(),r((t+1)%e.length)},"aria-label":i("actions.next"),class:`${wl} 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 d4=2e3;function Df({icon:e,label:t,onClick:r}){return n("button",{role:"menuitem",onClick:r,class:`
|
|
262
|
-
w-full px-3 py-2 text-left text-sm
|
|
263
|
-
flex items-center gap-2
|
|
264
|
-
text-[var(--color-text-primary)]
|
|
265
|
-
hover:bg-[var(--color-bg-hover)]
|
|
266
|
-
transition-colors cursor-pointer
|
|
267
|
-
`,children:[e,t]})}function Mv({content:e,visible:t=!1}){const[r,a]=B(!1),[o,l]=B(null),s=W(null),c=W(null);O(()=>{if(!r)return;const f=p=>{const g=p.target;s.current&&!s.current.contains(g)&&c.current&&!c.current.contains(g)&&a(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),O(()=>{if(!o)return;const f=setTimeout(()=>l(null),d4);return()=>clearTimeout(f)},[o]);const d=Z(async f=>{const p=f==="formatted"?W0(e):e;await navigator.clipboard.writeText(p),l(f),a(!1)},[e]),u=(f,p)=>o===f?n(bn,{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?i("actions.copied"):p;return n("div",{class:"relative",children:[n("button",{ref:c,onClick:()=>a(!r),"aria-label":i("actions.more"),"aria-expanded":r,"aria-haspopup":"menu",class:`
|
|
268
|
-
p-1 rounded
|
|
269
|
-
text-[var(--color-text-muted)]
|
|
270
|
-
hover:text-[var(--color-text-secondary)]
|
|
271
|
-
hover:bg-[var(--color-bg-hover)]
|
|
272
|
-
transition-all cursor-pointer
|
|
273
|
-
${r||t?"opacity-100":"opacity-0"}
|
|
274
|
-
${r?"bg-[var(--color-bg-hover)]":""}
|
|
275
|
-
`,children:n(Om,{class:"w-4 h-4"})}),r&&n("div",{ref:s,role:"menu",class:`
|
|
276
|
-
absolute right-0 top-full mt-1 z-50
|
|
277
|
-
min-w-[160px] py-1
|
|
278
|
-
bg-[var(--color-bg-surface)]
|
|
279
|
-
border border-[var(--color-border)]
|
|
280
|
-
rounded-lg shadow-lg
|
|
281
|
-
`,children:[n(Df,{icon:u("formatted",ai),label:h("formatted",i("actions.copy")),onClick:()=>d("formatted")}),n(Df,{icon:u("raw",Qt),label:h("raw",i("chat.copyMarkdown")),onClick:()=>d("raw")})]})]})}function h4({message:e,userName:t="You",userAvatar:r}){const a=Q(!1),o=e.status==="queued",l=e.status==="sending",s=e.status==="failed",c=o||l,d=()=>{e.id&&Fy(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:[Pu(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(me,{class:"w-3 h-3","aria-hidden":"true"}),i("connection.messageQueued")]}):l?n("span",{class:"flex items-center gap-1",children:[n(Es,{size:"sm",colorClass:"bg-current"}),i("connection.messageSending")]}):s?n("span",{class:"flex items-center gap-1 text-[var(--color-error)]",children:[n(ri,{class:"w-3 h-3","aria-hidden":"true"}),i("connection.messageFailedStatus")]}):oe(e.timestamp)}),n("div",{class:"flex-1"}),!c&&e.content&&n(Mv,{content:e.content,visible:a.value})]}),n("div",{class:`
|
|
282
|
-
rounded-xl px-4 py-3
|
|
283
|
-
${s?"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"}
|
|
284
|
-
`,children:[e.images&&e.images.length>0&&n(Av,{images:e.images}),e.content&&n("div",{class:`text-[var(--color-text-primary)] ${e.images?.length?"mt-2":""}`,children:n(hi,{content:e.content})}),s&&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
|
|
285
|
-
bg-[var(--color-error)]/10 text-[var(--color-error)]
|
|
286
|
-
hover:bg-[var(--color-error)]/20
|
|
287
|
-
active:scale-95 transition-all duration-150
|
|
288
|
-
flex items-center gap-1.5`,children:[n(Fe,{class:"w-3 h-3","aria-hidden":"true"}),i("actions.retry")]})})]})]})}const ql=v(null);let f4=0;function p4(){return`json-block-${++f4}`}async function m4(e,t){try{await navigator.clipboard.writeText(e),ql.value=t,setTimeout(()=>{ql.value===t&&(ql.value=null)},2e3)}catch{}}function v4(e){try{const t=Za.highlight(e,Za.languages.json,"json");return $f(t)}catch{return $f(e)}}function Xo({value:e,maxHeight:t="max-h-48",id:r}){const a=r??p4(),o=ql.value===a,l=v4(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(G,{icon:o?n(bn,{size:14}):n(ai,{size:14}),size:"sm",variant:"ghost",label:i("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:()=>m4(e,a)})]})}function g4(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 b4({toolCall:e}){const t=g4(e.result),[r,a]=B(t);O(()=>{t&&a(!0)},[t]);const o=e.completedAt&&e.startedAt?e.completedAt-e.startedAt:null,l=y4(e.status,t);return n("div",{class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("button",{type:"button",onClick:()=>a(!r),class:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--color-bg-secondary)] transition-colors","aria-expanded":r,children:[n("span",{class:`text-sm flex-shrink-0 ${l.color}`,children:l.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:w4(e)}),o!==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:S4(o)}),n(xa,{class:"w-4 h-4 text-[var(--color-text-muted)] flex-shrink-0",open:r})]}),r&&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(Lf,{label:"Input",children:n(Nf,{content:e.args})}),t&&n(x4,{approvalId:e.result.details.approvalId,expiresAtMs:e.result.details.expiresAtMs}),e.result!==void 0&&!t&&n(Lf,{label:"Output",children:n(Nf,{content:e.result,maxLines:20,error:e.status==="error"})}),e.status==="error"&&!e.result&&n("div",{class:"text-xs text-[var(--color-error)]",children:"Tool execution failed"})]})]})}function x4({approvalId:e,expiresAtMs:t}){const r=ks.value,a=_s.value,o=Co.value.get(e),[l,s]=B(Math.max(0,t-Date.now())),[c,d]=B(null),u=o??c;O(()=>{const p=()=>{const k=Math.max(0,t-Date.now());s(k)};p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[t]);const h=async p=>{try{await j2(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:i(p?"exec.denied":"exec.approved")})}return l<=0?n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:i("exec.expired")}):n("div",{class:"space-y-2",role:"region","aria-label":i("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:i("exec.approvalNeeded")}),n("span",{class:"text-[10px] text-[var(--color-text-muted)]","aria-label":i("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:i("exec.allowOnce")}),n(N,{variant:"secondary",size:"sm",onClick:()=>h("allow-always"),disabled:r,children:i("exec.allowAlways")}),n(N,{variant:"ghost",size:"sm",onClick:()=>h("deny"),disabled:r,children:i("exec.deny")})]})]})}function Lf({label:e,children:t}){return n("div",{children:[n("div",{class:"text-[10px] font-medium text-[var(--color-text-muted)] uppercase tracking-wide mb-1",children:e}),t]})}function Nf({content:e,maxLines:t=30,error:r=!1}){if(typeof e=="object"&&e!==null){const c=JSON.stringify(e,null,2),d=c.split(`
|
|
289
|
-
`),h=d.length>t?d.slice(0,t).join(`
|
|
290
|
-
`)+`
|
|
291
|
-
...`:c;return r?n("pre",{class:"text-xs p-2 rounded-md overflow-x-auto font-mono leading-relaxed bg-[var(--color-error)]/10 text-[var(--color-error)] max-h-[300px]",children:h}):n(Xo,{value:h,maxHeight:"max-h-[300px]"})}const a=String(e),o=a.split(`
|
|
292
|
-
`),s=o.length>t?o.slice(0,t).join(`
|
|
293
|
-
`)+`
|
|
294
|
-
...`:a;return n("pre",{class:`text-xs p-2 rounded-md overflow-x-auto font-mono leading-relaxed max-h-[300px] whitespace-pre-wrap ${r?"bg-[var(--color-error)]/10 text-[var(--color-error)]":"bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]"}`,children:s})}function y4(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(ee,{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 w4(e){const t=e.args||{};if(t.path||t.file_path)return k4(String(t.path||t.file_path));if(t.command)return Kl(String(t.command),60);if(t.query)return Kl(String(t.query),60);if(t.url)return _4(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 Kl(a,50);return""}function Kl(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function k4(e){const t=e.split("/").filter(Boolean);return t.length<=2?e:"…/"+t.slice(-2).join("/")}function _4(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 Kl(e,50)}}function S4(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 C4(e){return/^https?:\/\//i.test(e)}function T4(e){return/^data:/i.test(e)}function E4(e){return e.trim().replace(/^[`"'[{(]+/,"").replace(/[`"'\\})\],]+$/,"")}function A4(e){const t=[],r=[],a=e.split(`
|
|
295
|
-
`),o=[];for(const l of a){const s=l.trim();if(!s.startsWith("MEDIA:")){o.push(l);continue}const c=s.slice(6).trim(),d=E4(c);if(!d){o.push(l);continue}C4(d)||T4(d)?t.push(d):r.push(d)}return{text:o.join(`
|
|
296
|
-
`).trim(),mediaUrls:t,localPaths:r}}function M4(e){return e.map((t,r)=>({url:t,alt:`Image ${r+1}`}))}function R4(e,t){if(!t||t.length===0)return e?[{type:"text",content:e}]:[];M.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,s)=>{const c=l.insertedAtContentLength??1/0,d=s.insertedAtContentLength??1/0;return c-d}),a=[];let o=0;for(const l of r){const s=l.insertedAtContentLength;if(!(s===void 0||s===1/0)){if(s>o){const c=e.slice(o,s);c.trim()&&(a.push({type:"text",content:c}),M.chat.debug("buildContentBlocks: added text block",{from:o,to:s,textLen:c.length}))}a.push({type:"tool",toolCall:l}),o=s}}if(o<e.length){const l=e.slice(o);M.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}),M.chat.debug("buildContentBlocks: added remaining text block"))}for(const l of r)l.insertedAtContentLength===void 0&&a.push({type:"tool",toolCall:l});return M.chat.debug("buildContentBlocks result",{totalBlocks:a.length,blockTypes:a.map(l=>l.type)}),a}function I4({message:e,assistantName:t="Assistant",assistantAvatar:r,isStreaming:a=!1}){const o=Q(!1),l=A4(e.content),s=M4(l.mediaUrls),c=[...e.images??[],...s],d=R4(l.text,e.toolCalls??[]),u=d.length>0||a||c.length>0;return M.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:[Pu(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:oe(e.timestamp)}),n("div",{class:"flex-1"}),!a&&e.content&&n(Mv,{content:e.content,visible:o.value})]}),n("div",{class:"space-y-3",children:[d.map((h,f)=>(M.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(hi,{content:h.content,isStreaming:!1})},`text-${f}`):n("div",{children:n(b4,{toolCall:h.toolCall})},h.toolCall.id))),c.length>0&&n(Av,{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(Es,{})}),!u&&a&&n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[i("chat.thinking"),n(Es,{})]})]})]})}function $4({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(Vo,{class:"w-full h-full","aria-hidden":"true"})}),n("div",{class:"flex-1 text-sm text-[var(--color-text-muted)] italic",children:n(hi,{content:e.content})})]})}function Of({message:e,isStreaming:t=!1,assistantName:r,assistantAvatar:a,userName:o,userAvatar:l}){switch(e.role){case"user":return n(h4,{message:e,userName:o,userAvatar:l});case"assistant":return n(I4,{message:e,isStreaming:t,assistantName:r,assistantAvatar:a});case"system":return n($4,{message:e});default:return null}}const D4={compaction:{icon:"📦",labelKey:"chat.conversationCompacted",bgClass:"bg-[var(--color-warning)]/5 border-[var(--color-warning)]/20"},cron:{icon:"⏰",labelKey:"chat.cronJobCompleted",bgClass:"bg-[var(--color-text-muted)]/5 border-[var(--color-border)]"}};function Ff({messages:e,type:t}){const[r,a]=B(!1),o=D4[t];if(e.length===0)return null;const l=e[0]?.content??"",s=t==="cron"?l.replace(/^\s*\[cron\]\s*/i,""):l;return n("div",{class:`rounded-lg border overflow-hidden ${o.bgClass}`,children:[n("button",{type:"button",onClick:()=>a(!r),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",children:[n("span",{children:o.icon}),n("span",{class:"flex-1 text-left",children:i(o.labelKey)}),n(xa,{open:r,class:"w-4 h-4"})]}),r&&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:s})})]})}const L4=["Su","Mo","Tu","We","Th","Fr","Sa"],N4=["January","February","March","April","May","June","July","August","September","October","November","December"];function O4(e,t){return new Date(e,t+1,0).getDate()}function F4(e,t){return new Date(e,t,1).getDay()}function P4(e){return e?e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function Pf({value:e,onChange:t,placeholder:r="Select date",class:a="",minDate:o,maxDate:l}){const[s,c]=B(!1),[d,u]=B(()=>e??new Date),[h,f]=B(!1),p=W(null);ga(p,()=>c(!1),s);const g=()=>{if(p.current){const A=p.current.getBoundingClientRect();f(A.left+280>window.innerWidth)}c(!s)},k=d.getFullYear(),_=d.getMonth(),T=O4(k,_),C=F4(k,_),m=()=>{u(new Date(k,_-1,1))},b=()=>{u(new Date(k,_+1,1))},S=A=>{t(new Date(k,_,A)),c(!1)},w=A=>e?e.getFullYear()===k&&e.getMonth()===_&&e.getDate()===A:!1,x=A=>{const H=new Date;return H.getFullYear()===k&&H.getMonth()===_&&H.getDate()===A},E=A=>{const H=new Date(k,_,A);if(o){const $=new Date(o.getFullYear(),o.getMonth(),o.getDate());if(H<$)return!0}if(l){const $=new Date(l.getFullYear(),l.getMonth(),l.getDate());if(H>$)return!0}return!1},L=[];for(let A=0;A<C;A++)L.push(null);for(let A=1;A<=T;A++)L.push(A);return n("div",{ref:p,class:`relative ${a}`,children:[n("button",{type:"button",onClick:g,class:`
|
|
297
|
-
flex items-center justify-between gap-2 w-full
|
|
298
|
-
px-2.5 py-1.5 text-sm rounded-lg
|
|
299
|
-
bg-[var(--color-bg-primary)]
|
|
300
|
-
border border-[var(--color-border)]
|
|
301
|
-
${s?"border-[var(--color-accent)]/50":""}
|
|
302
|
-
hover:border-[var(--color-border-hover)]
|
|
303
|
-
transition-colors text-left
|
|
304
|
-
`,children:[n("span",{class:e?"text-[var(--color-text-primary)]":"text-[var(--color-text-muted)]",children:e?P4(e):r}),n(xa,{open:s,class:"w-3.5 h-3.5 text-[var(--color-text-muted)]"})]}),s&&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:m,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:[N4[_]," ",k]}),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:L4.map(A=>n("div",{class:"text-[10px] font-medium text-[var(--color-text-muted)] text-center py-1",children:A},A))}),n("div",{class:"grid grid-cols-7 gap-1",children:L.map((A,H)=>{const $=A!==null&&E(A);return n("div",{class:"aspect-square",children:A!==null&&n("button",{type:"button",onClick:()=>!$&&S(A),disabled:$,class:`
|
|
305
|
-
w-full h-full flex items-center justify-center
|
|
306
|
-
text-sm rounded-md transition-colors
|
|
307
|
-
${$?"text-[var(--color-text-muted)]/40 cursor-not-allowed":w(A)?"bg-[var(--color-accent)] text-[var(--color-accent-text)] font-medium":x(A)?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}
|
|
308
|
-
`,children:A})},H)})}),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 z4(){const e=W(null),t=je.value,r=Z(()=>{je.value=!1,En.value="",fy()},[]);O(()=>{je.value&&e.current&&e.current.focus()},[je.value]),O(()=>{const s=c=>{(c.metaKey||c.ctrlKey)&&c.key==="f"&&(c.preventDefault(),je.value=!0),c.key==="Escape"&&je.value&&r()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r]);const a=py.value,l=zu(En.value)||ym.value;return n(K,{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(G,{icon:n(pd,{}),label:i("chat.search"),onClick:()=>je.value=!0,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),n(Qm,{})]}),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(G,{icon:n(ba,{}),label:i("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:En.value,onInput:s=>En.value=s.target.value,placeholder:i("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," ",i(a===1?"chat.match":"chat.matches")]})]}),n("div",{class:"hidden sm:flex items-center gap-1.5 flex-shrink-0",children:[n(Pf,{value:Dr.value,onChange:s=>Dr.value=s,placeholder:i("chat.dateFrom"),class:"w-[130px]",maxDate:Lr.value}),n("span",{class:"text-[var(--color-text-muted)] text-sm",children:"–"}),n(Pf,{value:Lr.value,onChange:s=>Lr.value=s,placeholder:i("chat.dateTo"),class:"w-[130px]",minDate:Dr.value})]})]})]})}function U4(e){const t=[];for(const r of e)U0(r)||hm(r)||(j0(r)?t.push({type:"compaction",messages:[r]}):H0(r)?t.push({type:"cron",message:r}):t.push({type:"message",message:r}));return t}const zf=["bg-[var(--color-bg-hover)]","rounded-lg","transition-colors"],H4="cursor-pointer hover:bg-[var(--color-bg-hover)] rounded-lg transition-colors";function B4({messages:e,isLoading:t=!1,error:r=null,streamingContent:a="",streamingToolCalls:o=[],isStreaming:l=!1,assistantName:s,assistantAvatar:c,userName:d,userAvatar:u,queuedCount:h=0}){M.chat.debug("MessageList render",{messagesCount:e.length,streamingContentLen:a.length,streamingToolCallsCount:o.length,isStreaming:l,queuedCount:h});const f=W(null),p=W(null),g=Q(!1),k=W(!0),_=Z((x=!0)=>{requestAnimationFrame(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:x?"smooth":"auto"})})},[]),T=Z(()=>{if(!f.current)return;const{scrollTop:x,scrollHeight:E,clientHeight:L}=f.current,A=E-x-L;g.value=A>100,k.current=A<50},[]),C=o.filter(x=>x.status==="complete"||x.status==="error").length,m=W(null);O(()=>{const x=e[e.length-1],E=x?.role==="user"&&x.id!==m.current;(E||h>0||k.current)&&(E&&(k.current=!0),_(!1)),m.current=x?.id??null},[e.length,a.length,o.length,C,h,_]),O(()=>{_(!1)},[_]),O(()=>{if(!f.current)return;const x=()=>{k.current&&_(!1)},E=f.current;return E.addEventListener("load",x,!0),()=>E.removeEventListener("load",x,!0)},[_]),O(()=>{const x=ml.value;if(!x||!f.current)return;const E=f.current.querySelector(`[data-message-id="${x}"]`);E&&(E.scrollIntoView({behavior:"smooth",block:"center"}),E.classList.add(...zf),setTimeout(()=>{E.classList.remove(...zf)},2e3)),ml.value=null},[ml.value]);const b=l&&dm(a),S=l&&!b?{id:"streaming",role:"assistant",content:a,toolCalls:o.length>0?o:void 0,timestamp:Date.now(),isStreaming:!0}:null,w=wt(()=>U4(e),[e]);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(z4,{})}),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(ee,{size:"md",label:i("status.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:[Pu(c)?n("img",{src:c,alt:s||i("chat.emptyState.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":s||i("chat.emptyState.assistant"),children:c}):n(ci,{size:"lg",class:"mx-auto mb-4 opacity-80"}),n("h3",{class:"text-xl font-medium mb-2",children:s?i("chat.emptyState.titleWithName",{name:s}):i("chat.emptyState.title")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:i("chat.emptyState.description")}),n("div",{class:"text-sm text-[var(--color-text-muted)]",children:[n("p",{class:"mb-2",children:i("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:i("chat.emptyState.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:i("chat.emptyState.newSession")})]})]})]})]})}),n("div",{class:"space-y-6",children:[w.map((x,E)=>{if(x.type==="compaction")return n(Ff,{messages:x.messages,type:"compaction"},`compaction-${E}`);if(x.type==="cron")return n(Ff,{messages:[x.message],type:"cron"},`cron-${E}`);const L=x.message,A=je.value?()=>{ml.value=L.id,En.value="",je.value=!1}:void 0;return n("div",{"data-message-id":L.id,onClick:A,onKeyDown:A?H=>{H.key==="Enter"&&A()}:void 0,role:je.value?"button":void 0,tabIndex:je.value?0:void 0,class:`-mx-2 px-2 py-1 rounded-lg ${je.value?H4:""}`,children:n(Of,{message:L,assistantName:s,assistantAvatar:c,userName:d,userAvatar:u})},L.id)}),S&&n(Of,{message:S,isStreaming:!0,assistantName:s,assistantAvatar:c})]}),n("div",{ref:p,class:"h-1"})]})}),g.value&&n("div",{class:"absolute bottom-4 right-4",children:n(G,{icon:n(Tw,{}),label:i("chat.scrollToBottom"),onClick:()=>{k.current=!0,_(!0)},variant:"default",size:"md",class:"shadow-lg bg-[var(--color-bg-surface)] border border-[var(--color-border)]"})})]})}const j4=["image/png","image/jpeg","image/gif","image/webp"],Uf=10*1024*1024,jc=400*1024,kl=2048;function Sd(e){return j4.includes(e)}let W4=0;function Hf(){return`attachment_${Date.now()}_${++W4}`}async function Rv(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:s,height:c}=a;if(s>kl||c>kl){const k=Math.min(kl/s,kl/c);s=Math.round(s*k),c=Math.round(c*k)}o.width=s,o.height=c,l.drawImage(a,0,0,s,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>jc&&u>.1;)u-=.1,h=o.toDataURL(d,u);let f=1;for(;h.length>jc&&f>.2;)f-=.1,o.width=Math.round(s*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]||"",g=Math.round(p.length*3/4);URL.revokeObjectURL(a.src),t({content:h,size:g})},a.onerror=()=>{URL.revokeObjectURL(a.src),r(new Error("Failed to load image"))},a.src=URL.createObjectURL(e)})}async function Bf(e){if(Sd(e.type)){const{content:r,size:a}=await Rv(e);return{id:Hf(),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:Hf(),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 q4(){const e=Q([]),t=Q(!1),r=Q(null);O(()=>()=>{for(const u of e.value)u.previewUrl&&URL.revokeObjectURL(u.previewUrl)},[]);const a=Z(async u=>{const h=Array.from(u);r.value=null,t.value=!0;try{for(const f of h){if(f.size>Uf){r.value=`File "${f.name}" is too large (max 10MB)`;continue}if(!Sd(f.type)&&f.size>jc){r.value=`File "${f.name}" is too large (max 400KB for non-images)`;continue}try{const p=await Bf(f);e.value=[...e.value,p]}catch{r.value=`Failed to read "${f.name}"`}}}finally{t.value=!1}},[]),o=Z(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=Z(()=>{for(const u of e.value)u.previewUrl&&URL.revokeObjectURL(u.previewUrl);e.value=[]},[]),s=Z(()=>e.value.map(u=>({type:u.type,mimeType:u.mimeType,fileName:u.fileName,content:u.content})),[]),c=Z(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 g=p.getAsFile();if(g){if(g.size>Uf){r.value="Pasted image is too large (max 10MB)";continue}try{const k=await Bf(g);e.value=[...e.value,k]}catch{r.value="Failed to read pasted image"}}}}finally{t.value=!1}return!0},[]),d=Z(()=>{r.value=null},[]);return{attachments:e.value,addFiles:a,removeAttachment:o,clearAttachments:l,getPayloads:s,handlePaste:c,isProcessing:t.value,error:r.value,clearError:d}}function K4(e){if(!e)return null;const t=e.indexOf("/");return t===-1?null:e.substring(0,t)}function G4(e){if(!e)return null;const t=K4(e);return t||(Nn.value.find(a=>a.id===e)?.provider??null)}function V4({sessionKey:e,currentModel:t,onModelChange:r}){const[a,o]=B(!1),[l,s]=B(!1),[c,d]=B(()=>lx()),u=W(null);if(ga(u,()=>o(!1),a),Nn.value.length===0)return null;const h=t??$m.value??Nn.value[0]?.id,f=G4(h),p=f?o1.value.get(f)??[]:[],g=wt(()=>[...p.filter((m,b,S)=>S.findIndex(w=>w.id===m.id)===b)].sort((m,b)=>{if(m.id===h)return-1;if(b.id===h)return 1;const S=c.has(m.id),w=c.has(b.id);return S&&!w?-1:!S&&w?1:m.name.localeCompare(b.name)}),[p,h,c]);if(g.length===0)return null;const k=t?s1(t):i("sessions.defaultModel"),_=(C,m)=>{m.preventDefault(),m.stopPropagation();const b=new Set(c);b.has(C)?b.delete(C):b.add(C),d(b),sx(b)},T=async C=>{if(C===t){o(!1);return}s(!0);try{await F("sessions.patch",{key:e,model:C}),r?.(C),M.ui.debug("Model changed to:",C)}catch(m){M.ui.error("Failed to change model:",m)}finally{s(!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
|
|
309
|
-
text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]
|
|
310
|
-
hover:bg-[var(--color-bg-secondary)] transition-colors
|
|
311
|
-
disabled:opacity-50`,children:[n("span",{class:"max-w-[120px] truncate",children:k}),n(xa,{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:g.map(C=>{const m=c.has(C.id),b=(t??h)===C.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:S=>_(C.id,S),class:`p-1 -m-1 text-xs transition-colors rounded hover:bg-[var(--color-bg-tertiary)] ${m?"text-[var(--color-warning)]":"text-[var(--color-text-muted)] hover:text-[var(--color-warning)]/70"}`,title:i(m?"models.removeFavorite":"models.addFavorite"),"aria-label":i(m?"models.removeFavorite":"models.addFavorite"),children:m?"★":"☆"}),n("button",{type:"button",onClick:()=>T(C.id),class:"flex-1 text-left text-sm flex items-center gap-2 min-w-0",children:[n("span",{class:"truncate",children:C.name}),C.reasoning&&n("span",{class:"text-[10px] text-[var(--color-warning)] flex-shrink-0",children:"🧠"})]})]},C.id)})})]})}function Y4({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||i("actions.cancel")}),n(N,{onClick:t,disabled:a,fullWidth:!0,class:"sm:w-auto",children:r||i("actions.confirm")})]})}function Iv({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:i("actions.cancel")}),n(N,{variant:"danger",icon:n(Lt,{class:"w-4 h-4"}),onClick:r,disabled:a,fullWidth:!0,class:"sm:w-auto",children:a?n(ee,{size:"sm"}):i("actions.delete")})]})]})}function $v({onCancel:e,onSave:t,isSaving:r,saveDisabled:a,saveLabel:o,isEdit:l,onDeleteClick:s,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&&s&&n(N,{size:"sm",variant:"ghost",icon:n(Lt,{class:"w-4 h-4"}),onClick:s,class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10",children:i("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:i("actions.cancel")}),n(N,{onClick:t,disabled:r||a,fullWidth:!0,class:"sm:w-auto",children:r?n(ee,{size:"sm"}):o||i("actions.save")})]})]})]})}const J4=100,jf=120;function X4(){const e=pt.value,[t,r]=B(new Set),[a,o]=B(null),[l,s]=B(""),[c,d]=B([]),u=W(null);if(e.length===0)return null;const h=C=>{r(m=>{const b=new Set(m);return b.has(C)?b.delete(C):b.add(C),b})},f=C=>{o(C),s(C.content),d(C.images??[])},p=()=>{if(!a)return!1;const C=a.content,m=a.images??[];if(l.trim()!==C||c.length!==m.length)return!0;for(let b=0;b<c.length;b++)if(c[b].url!==m[b].url)return!0;return!1},g=()=>{a&&(l.trim()||c.length>0)&&p()&&(wy(a.id,l.trim(),c.length>0?c:void 0),o(null),s(""),d([]))},k=()=>{o(null),s(""),d([])},_=C=>{d(m=>m.filter((b,S)=>S!==C))},T=async C=>{if(!C||C.length===0)return;const m=[];for(const b of Array.from(C))if(Sd(b.type))try{const{content:S}=await Rv(b);m.push({url:S,alt:b.name})}catch{}m.length>0&&d(b=>[...b,...m]),u.current&&(u.current.value="")};return n(K,{children:[n("div",{class:"mb-2 space-y-2",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] font-medium",children:i("chat.queuedMessages",{count:e.length})}),n("div",{class:"space-y-1",children:e.map(C=>{const m=C.content.length>J4,b=t.has(C.id),S=C.images&&C.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 ${m&&!b?"line-clamp-1":"whitespace-pre-wrap"}`,children:C.content}),S&&n("div",{class:"mt-1 flex items-center gap-1 text-xs text-[var(--color-text-muted)]",children:[n(Lw,{class:"w-3 h-3"}),n("span",{children:i("chat.imageCount",{count:C.images.length})})]})]}),n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n("button",{type:"button",onClick:()=>f(C),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-accent)] transition-colors",title:i("actions.edit"),"aria-label":i("actions.edit"),children:n(tv,{class:"w-4 h-4"})}),n("button",{type:"button",onClick:()=>Sm(C.id),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-error)] transition-colors",title:i("actions.remove"),"aria-label":i("actions.remove"),children:n(nv,{class:"w-4 h-4"})})]})]}),m&&n("button",{type:"button",onClick:()=>h(C.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(xa,{class:"w-3 h-3",open:b}),i(b?"actions.showLess":"actions.showMore")]})]},C.id)})})]}),n(Xe,{open:!!a,onClose:k,title:i("chat.editQueuedMessage"),size:"lg",footer:n(Y4,{onCancel:k,onConfirm:g,confirmLabel:i("actions.save"),confirmDisabled:!l.trim()&&c.length===0||!p()}),children:n("div",{class:"space-y-4",children:[n("textarea",{value:l,onInput:C=>s(C.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:i("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:i("chat.images")}),n(N,{variant:"ghost",size:"sm",icon:n(ev,{class:"w-4 h-4"}),onClick:()=>u.current?.click(),children:i("chat.addImage")}),n("input",{ref:u,type:"file",accept:"image/*",multiple:!0,class:"hidden",onChange:C=>T(C.target.files)})]}),c.length>0?n("div",{class:"flex flex-wrap gap-2",children:c.map((C,m)=>n("div",{class:"relative group",children:[n("img",{src:C.url,alt:C.alt||`Image ${m+1}`,class:"rounded-lg object-cover border border-[var(--color-border)]",style:{width:jf,height:jf}}),n("button",{type:"button",onClick:()=>_(m),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:i("actions.remove"),"aria-label":i("actions.remove"),children:n(ba,{class:"w-3 h-3"})})]},m))}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("chat.noImages")})]})]})})]})}function Z4({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(Q4,{attachment:a,onRemove:()=>t(a.id)},a.id)),r&&n("div",{class:`
|
|
312
|
-
w-16 h-16 rounded-lg
|
|
313
|
-
border border-[var(--color-border)]
|
|
314
|
-
bg-[var(--color-bg-secondary)]
|
|
315
|
-
flex items-center justify-center
|
|
316
|
-
`,children:n(ee,{size:"sm"})})]})}function Q4({attachment:e,onRemove:t}){const r=e.type==="image",a=e3(e.size);return n("div",{class:"relative group",children:[n(va,{content:`${e.fileName} (${a})`,placement:"top",children:n("div",{class:`
|
|
317
|
-
relative w-16 h-16 rounded-lg overflow-hidden
|
|
318
|
-
border border-[var(--color-border)]
|
|
319
|
-
bg-[var(--color-bg-secondary)]
|
|
320
|
-
flex items-center justify-center
|
|
321
|
-
`,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(Nr,{class:"w-6 h-6"}):n(Qt,{class:"w-6 h-6"}),n("span",{class:"text-[8px] truncate max-w-[56px] px-1",children:t3(e.fileName)})]})})}),n("button",{type:"button",onClick:t,"aria-label":i("actions.remove"),class:`
|
|
322
|
-
absolute -top-1.5 -right-1.5
|
|
323
|
-
w-5 h-5 rounded-full
|
|
324
|
-
bg-[var(--color-bg-surface)] border border-[var(--color-border)]
|
|
325
|
-
flex items-center justify-center
|
|
326
|
-
opacity-0 group-hover:opacity-100
|
|
327
|
-
hover:bg-[var(--color-error)] hover:border-[var(--color-error)] hover:text-white
|
|
328
|
-
transition-all cursor-pointer
|
|
329
|
-
`,children:n(ma,{class:"w-3 h-3"})})]})}function e3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function t3(e){return e.split(".").pop()?.toUpperCase()||"FILE"}const Wf=160;function n3({onSend:e,onAbort:t,disabled:r=!1,isStreaming:a=!1,placeholder:o,sessionKey:l,currentModel:s,onModelChange:c}){const d=W(null),u=W(null),h=W(null),f=Q(l?$h(l):""),p=Q(!1),{attachments:g,addFiles:k,removeAttachment:_,clearAttachments:T,getPayloads:C,handlePaste:m,isProcessing:b,error:S,clearError:w}=q4(),x=Z(()=>{const U=d.current;if(!U)return;U.style.height="auto";const le=Math.min(U.scrollHeight,Wf);U.style.height=`${le}px`},[]),E=Z(U=>{const le=U.target.value;f.value=le,l&&Cm(l,le),x()},[x,l]),L=Z(()=>{const U=f.value.trim(),le=C();!U&&le.length===0||r||(e(U,le.length>0?le:void 0),f.value="",l&&ky(l),T(),d.current&&(d.current.style.height="auto"))},[e,r,C,T,l]),A=Z(U=>{if((U.metaKey||U.ctrlKey)&&U.key==="Enter"){U.preventDefault(),L();return}U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),L())},[L]),H=Z(async U=>{await m(U)},[m]),$=Z(U=>{const le=U.target;le.files&&le.files.length>0&&(k(le.files),le.value="")},[k]),Y=Z(U=>{U.preventDefault(),U.stopPropagation(),p.value=!0},[]),ze=Z(U=>{U.preventDefault(),U.stopPropagation(),!(U.relatedTarget&&h.current?.contains(U.relatedTarget))&&(p.value=!1)},[]),xe=Z(U=>{U.preventDefault(),U.stopPropagation()},[]),wa=Z(async U=>{U.preventDefault(),U.stopPropagation(),p.value=!1;const le=U.dataTransfer?.files;le&&le.length>0&&await k(le)},[k]);O(()=>{if(d.current?.focus(),l){const U=$h(l);f.value=U,U&&requestAnimationFrame(x)}},[l,x]),O(()=>{if(S){const U=setTimeout(w,5e3);return()=>clearTimeout(U)}},[S,w]);const ka=zu(f.value),xn=g.length>0,ve=(ka||xn)&&!r;return n("div",{class:"pb-3 pt-2",children:n("div",{class:"max-w-5xl mx-auto px-6",children:[n(X4,{}),S&&n("div",{class:"mb-2 px-3 py-2 text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 rounded-lg",children:S}),n("div",{ref:h,"data-tour":"chat-input",onDragEnter:Y,onDragLeave:ze,onDragOver:xe,onDrop:wa,class:`
|
|
330
|
-
relative flex flex-col bg-[var(--color-bg-surface)] border rounded-xl
|
|
331
|
-
transition-all duration-200
|
|
332
|
-
${p.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/5":"border-[var(--color-border)] focus-within:border-[var(--color-accent)]"}
|
|
333
|
-
`,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:i("chat.dropFiles")})}),(xn||b)&&n("div",{class:"pt-3 px-4",children:n(Z4,{attachments:g,onRemove:_,isProcessing:b})}),n("textarea",{ref:d,value:f.value,onInput:E,onKeyDown:A,onPaste:H,disabled:r,placeholder:o||(window.innerWidth<640?i("chat.placeholderMobile"):i("chat.placeholder")),rows:1,class:`
|
|
334
|
-
w-full px-4 pb-1 text-base sm:text-sm rounded-t-xl resize-none
|
|
335
|
-
bg-transparent border-none
|
|
336
|
-
placeholder:text-[var(--color-text-muted)]
|
|
337
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
338
|
-
${xn?"pt-2":"pt-3"}
|
|
339
|
-
`,style:{minHeight:"44px",maxHeight:`${Wf}px`,outline:"none"}}),n("input",{ref:u,type:"file",multiple:!0,accept:"image/*",onChange:$,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(V4,{sessionKey:l,currentModel:s,onModelChange:c})}),n(va,{content:i("chat.attachImage"),placement:"top",children:n("button",{type:"button",onClick:()=>u.current?.click(),disabled:r,"aria-label":i("chat.attachImage"),class:`
|
|
340
|
-
p-1.5 rounded-lg cursor-pointer
|
|
341
|
-
text-[var(--color-text-muted)]
|
|
342
|
-
hover:text-[var(--color-text-secondary)]
|
|
343
|
-
hover:bg-[var(--color-bg-hover)]
|
|
344
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
345
|
-
transition-colors
|
|
346
|
-
`,children:n(Nr,{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":i("actions.stop"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5 cursor-pointer
|
|
347
|
-
bg-[var(--color-error)]/10 text-[var(--color-error)]
|
|
348
|
-
hover:bg-[var(--color-error)]/20
|
|
349
|
-
active:scale-95 transition-all duration-150`,children:[n(Mw,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:i("actions.stop")})]}),n("button",{type:"button",onClick:L,disabled:!ve,"aria-label":i(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
|
|
350
|
-
transition-all duration-150 active:scale-95
|
|
351
|
-
${ve?"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(Aw,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:i(a?"actions.queue":"actions.send")})]})]})]})]})]})})}function r3(){const e=Te.value;if(e==="connected"||e==="connecting"||e==="authenticating")return null;const t=e==="reconnecting",r=pt.value.length;return n("div",{class:`
|
|
352
|
-
px-4 py-2 text-sm flex items-center justify-center gap-2
|
|
353
|
-
animate-[fade-in_150ms_ease-out_100ms_forwards] opacity-0
|
|
354
|
-
${t?"bg-[var(--color-warning)]/10 text-[var(--color-warning)]":"bg-[var(--color-error)]/10 text-[var(--color-error)]"}
|
|
355
|
-
`,role:"alert",children:[n("span",{class:"flex-shrink-0",children:t?n(jm,{class:"w-4 h-4 animate-spin","aria-hidden":"true"}):n(zn,{class:"w-4 h-4","aria-hidden":"true"})}),n("span",{children:t?$t.value>1?i("connection.reconnectingAttempt",{count:$t.value}):i("connection.reconnecting"):i("connection.disconnected")}),km.value&&n("span",{class:"text-xs opacity-75",children:["• ",i("connection.messagesQueued",{count:r})]})]})}function a3(){return Tc.value?n("div",{class:"absolute top-2 left-1/2 -translate-x-1/2 z-20 px-4 py-2 text-sm flex items-center gap-2 bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] rounded-full shadow-lg border border-[var(--color-border)]",role:"status",children:[n(jm,{class:"w-4 h-4 animate-spin","aria-hidden":"true"}),n("span",{children:i("chat.compacting")})]}):null}function _l({sessionKey:e}){const t=W(null),r=W(!1);O(()=>{const s=e?decodeURIComponent(e):null;if(us.value&&Oe.value){Zt.value!==Oe.value&&Kr(Oe.value),s&&s!==Oe.value&&Ge(`/chat/${encodeURIComponent(Oe.value)}`,!0);return}if(!s&&Oe.value){Ge(`/chat/${encodeURIComponent(Oe.value)}`,!0);return}const c=s||"main";c!==Zt.value&&Kr(c)},[e,Oe.value,us.value]),O(()=>{const s=Be.value;if(!s||s===t.current)return;t.current=s,uy()!==s&&(Vu(),En.value="",je.value=!1),Yu(s).catch(()=>{})},[Zt.value]),O(()=>{const s=D.value,c=r.current;r.current=s,!(!s||c)&&(yy(),km.value&&Py())},[Te.value]);const a=async(s,c)=>{const d=Be.value;if(d)try{await Em(d,s,{attachments:c})}catch{}},o=()=>{const s=Be.value;s&&Am(s)},l=Ks(()=>my(Be.value));return n("div",{class:"flex-1 flex flex-col overflow-hidden relative",children:[n(r3,{}),n(a3,{}),n(B4,{messages:wm.value,isLoading:Cc.value,error:fs.value,streamingContent:l.value.content,streamingToolCalls:l.value.toolCalls,isStreaming:l.value.isStreaming,assistantName:$c.value,assistantAvatar:Mm.value??void 0,userName:Qy.value,userAvatar:e1.value??void 0,queuedCount:pt.value.length}),n(n3,{onSend:a,onAbort:o,disabled:!1,isStreaming:l.value.isStreaming,sessionKey:Be.value,currentModel:Q0.value?.model,onModelChange:s=>{Be.value&&Bu(Be.value,{model:s})}})]})}const Cd=Yo(({size:e="md",error:t,fullWidth:r,class:a,...o},l)=>{const[s,c]=B(!1);return n(re,{ref:l,type:s?"text":"password",size:e,error:t,fullWidth:r,rightElement:n("button",{type:"button",onClick:()=>c(!s),class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-label":s?"Hide password":"Show password",tabIndex:-1,children:s?n(Fm,{class:"w-4 h-4"}):n(ld,{class:"w-4 h-4"})}),class:a,...o})});Cd.displayName="PasswordInput";const o3={default:`
|
|
356
|
-
bg-[var(--color-bg-surface)]
|
|
357
|
-
border border-[var(--color-border)]
|
|
358
|
-
shadow-soft-sm
|
|
359
|
-
transition-shadow duration-200 ease-out
|
|
360
|
-
hover:shadow-soft
|
|
361
|
-
`,elevated:`
|
|
362
|
-
bg-[var(--color-bg-surface)]
|
|
363
|
-
border border-[var(--color-border)]
|
|
364
|
-
shadow-soft-lg
|
|
365
|
-
transition-shadow duration-200 ease-out
|
|
366
|
-
hover:shadow-soft-xl
|
|
367
|
-
`,outlined:`
|
|
368
|
-
bg-transparent
|
|
369
|
-
border border-[var(--color-border)]
|
|
370
|
-
transition-colors duration-200 ease-out
|
|
371
|
-
`},Ki={none:"",sm:"p-3",md:"p-4",lg:"p-6"};function V({variant:e="default",padding:t="md",title:r,subtitle:a,headerActions:o,footer:l,children:s,class:c,...d}){const u=r||a||o;return n("div",{class:`rounded-xl ${o3[e]} ${c||""}`,...d,children:[u&&n("div",{class:`
|
|
372
|
-
flex items-start justify-between gap-4
|
|
373
|
-
${t!=="none"?Ki[t]:"p-4"}
|
|
374
|
-
${s||l?"border-b border-[var(--color-border)]":""}
|
|
375
|
-
`,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})]}),s&&n("div",{class:Ki[t],children:s}),l&&n("div",{class:`
|
|
376
|
-
${Ki[t]}
|
|
377
|
-
border-t border-[var(--color-border)]
|
|
378
|
-
bg-[var(--color-bg-secondary)]/50
|
|
379
|
-
rounded-b-2xl
|
|
380
|
-
`,children:l})]})}function l3(){const e=Q(""),t=Q(""),r=Q("token"),a=Q(!1),o=Q(!0),l=Q(null),s=h=>{if(!h.trim())return i("errors.required");if(!h.startsWith("ws://")&&!h.startsWith("wss://"))return"URL must start with ws:// or wss://";try{new URL(h)}catch{return i("errors.invalid")}return null},c=async()=>{const h=s(e.value);if(h){l.value=h;return}l.value=null,a.value=!0;try{await Bo({url:e.value,token:r.value==="token"?t.value:void 0,password:r.value==="password"?t.value:void 0,autoReconnect:!0}),Iu({url:e.value,authMode:r.value,rememberMe:o.value,credential:t.value}),await Xs(),await Dm(),await Zu(),Kr("main"),await Xu("main"),ed(),td()}catch(f){M.auth.error("Connect failed:",f)}finally{a.value=!1}},d=h=>{h.key==="Enter"&&(h.preventDefault(),c())};if(!e.value){const h=Ru();if(h){e.value=h.url,r.value=h.authMode,o.value=h.rememberMe;const f=am();f&&(t.value=f)}}const u=[{value:"token",label:i("auth.authMode.token")},{value:"password",label:i("auth.authMode.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(ci,{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:i("app.name")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mt-1",children:i("app.tagline")})]}),n(V,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:i("auth.title")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(Ee,{label:i("auth.gatewayUrl"),htmlFor:"gateway-url",error:l.value||void 0,children:n(re,{id:"gateway-url",type:"url",value:e.value,onInput:h=>{e.value=h.target.value,l.value=null},onKeyDown:d,placeholder:i("auth.gatewayUrlPlaceholder"),error:l.value||void 0,autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(Ee,{label:"Auth Mode",children:n(Ae,{value:r.value,onChange:h=>r.value=h,options:u,"aria-label":"Auth Mode",class:"w-full"})}),n(Ee,{label:r.value==="token"?i("auth.token"):i("auth.password"),htmlFor:"auth-credential",children:n(Cd,{id:"auth-credential",value:t.value,onInput:h=>t.value=h.target.value,onKeyDown:d,placeholder:r.value==="token"?i("auth.tokenPlaceholder"):i("auth.passwordPlaceholder"),fullWidth:!0})}),n(Ve,{checked:o.value,onChange:h=>o.value=h,label:i("auth.rememberMe"),size:"sm"}),n(N,{variant:"primary",onClick:c,disabled:a.value||!e.value.trim(),loading:a.value,fullWidth:!0,children:a.value?i("auth.connecting"):i("actions.connect")}),Tn.value&&n("p",{class:"text-sm text-[var(--color-error)] text-center",children:Tn.value})]})]})]})})}class at extends ht{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){const{viewName:a}=this.props;M.ui.error(`ViewErrorBoundary caught error in ${a||"unknown view"}:`,t),M.ui.error("Component stack:",r.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null}),this.props.onRetry?.()};render(){if(this.state.hasError){const{viewName:t}=this.props,{error:r}=this.state;return n("div",{class:"flex-1 flex flex-col items-center justify-center p-8",role:"alert",children:n("div",{class:"max-w-md w-full text-center space-y-4",children:[n(zn,{class:"w-12 h-12 mx-auto text-[var(--color-warning)]","aria-hidden":"true"}),n("h2",{class:"text-lg font-semibold text-[var(--color-text-primary)]",children:t?i("errors.viewFailed",{view:t}):i("errors.generic")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:r?.message||i("errors.unknown")}),n(N,{onClick:this.handleRetry,variant:"secondary",class:"inline-flex items-center gap-2",children:[n(Fe,{class:"w-4 h-4","aria-hidden":"true"}),i("actions.retry")]})]})})}return this.props.children}}const Zn=v(null),Or=v([]),s3=v(null),Er=v(null),qf=v(!1);async function i3(){if(D.value){qf.value=!0;try{try{const e=await F("cron.status");Zn.value={enabled:e.enabled??!1,jobCount:e.jobs??0,nextWakeMs:e.nextWakeAtMs??null}}catch{Zn.value=null}try{const e=await F("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})}Or.value=t}catch{Or.value=[]}try{const t=(await F("skills.status")).skills??[];Er.value={total:t.length,eligible:t.filter(r=>r.eligible).length}}catch{Er.value=null}s3.value=null}finally{qf.value=!1}}}const c3=j(()=>{const e=Nu.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`}),u3=j(()=>window.location.protocol==="https:"||window.location.hostname==="localhost"),d3=j(()=>Xt.value?.startsWith("wss://")??!1),Kf=j(()=>Or.value.filter(e=>e.connected).length),h3=j(()=>{const e=Zn.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 kr({icon:e,label:t,value:r,subtext:a,href:o}){const l=n(K,{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 Gf({value:e,label:t}){const[r,a]=B(!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(bn,{class:"w-4 h-4 text-[var(--color-success)]"}):n(ai,{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 Sl({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 f3(e){const t=D.value,r=Te.value;return O(()=>{t&&i3()},[t]),n(at,{viewName:i("nav.overview"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[!u3.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(zn,{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&&Xt.value&&!d3.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(ii,{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(V,{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(ys,{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(Gm,{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:i(r==="connected"?"status.connected":r==="connecting"||r==="authenticating"?"status.connecting":r==="reconnecting"?"status.reconnecting":"status.disconnected")})]})]}),t&&n(N,{variant:"secondary",size:"sm",onClick:()=>qr(),children:"Disconnect"})]}),t&&Xt.value&&n("div",{class:"border-t border-[var(--color-border)] pt-4 mt-4 space-y-1",children:[n(Gf,{label:"URL",value:Xt.value}),za.connectionId.value&&n(Gf,{label:"Connection ID",value:za.connectionId.value})]})]}),t&&n("div",{class:"grid grid-cols-2 md:grid-cols-3 gap-2 sm:gap-4",children:[n(kr,{icon:me,label:"Uptime",value:c3.value??"—",subtext:Ln.value?`Since ${oe(Ln.value)}`:void 0,href:"/stats"}),n(kr,{icon:An,label:"Instances",value:Ho.value.length,subtext:"Connected clients",href:"/instances"}),n(kr,{icon:tn,label:"Sessions",value:ft.value.length,subtext:"Active sessions",href:"/sessions"}),n(kr,{icon:rn,label:"Cron",value:Zn.value?.enabled?"Enabled":"Disabled",subtext:Zn.value?.nextWakeMs?`Next wake: ${h3.value}`:Zn.value?.jobCount?`${Zn.value.jobCount} jobs`:void 0,href:"/cron"}),n(kr,{icon:xs,label:"Channels",value:Or.value.length>0?Kf.value:"—",subtext:Or.value.length>0?`${Kf.value}/${Or.value.length} connected`:"No channels configured",href:"/channels"}),n(kr,{icon:hd,label:"Skills",value:Er.value?.eligible??"—",subtext:Er.value?`${Er.value.eligible}/${Er.value.total} active`:void 0,href:"/skills"})]}),t&&n(V,{title:i("overview.serverInfo"),padding:"md",children:n("div",{class:"divide-y divide-[var(--color-border)]",children:[n(Sl,{label:i("overview.version"),value:kt.value}),n(Sl,{label:i("overview.commit"),value:Uo.value?.substring(0,8)}),n(Sl,{label:i("overview.host"),value:fa.value}),n(Sl,{label:i("overview.capabilities"),value:za.capabilities.value.length>0?i("overview.capabilitiesCount",{count:za.capabilities.value.length}):null})]})})]})})})}function pe({icon:e,label:t,value:r,active:a,highlight:o,onClick:l,class:s}){const c=!!l,d=n(K,{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=`
|
|
381
|
-
flex items-center gap-1.5 sm:gap-3 p-2 sm:p-4 rounded-xl text-left transition-all
|
|
382
|
-
${a?"bg-[var(--color-accent)]/10 border-2 border-[var(--color-accent)]":"bg-[var(--color-bg-secondary)] border-2 border-transparent"}
|
|
383
|
-
${c?"hover:bg-[var(--color-bg-tertiary)] cursor-pointer":""}
|
|
384
|
-
${s||""}
|
|
385
|
-
`;return c?n("button",{type:"button",onClick:l,class:u,children:d}):n("div",{class:u,children:d})}function St({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:`flex items-start justify-between gap-4 ${a??""}`,children:[n("div",{class:"flex-1 min-w-0",children:[n("h1",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:e}),o]}),r&&n("div",{class:"flex items-center gap-2 flex-shrink-0",children:r})]})}const p3={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 ya({icon:e,iconVariant:t="default",title:r,subtitle:a,badges:o,meta:l,actions:s,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 ${p3[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}`))})]}),s&&n("div",{class:"flex-shrink-0",children:s})]});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 m3(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 v3(e){return new Date(e).getTime()}function As(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 ${oe(e.atMs)}`}}function Td(e){return e.enabled?e.state.runningAtMs?i("cron.running"):e.state.nextRunAtMs?oe(e.state.nextRunAtMs,{relative:!0}):"—":"—"}function g3(e){return e.state.lastRunAtMs?oe(e.state.lastRunAtMs,{relative:!0}):"—"}function Ed(e){return e.enabled?e.state.runningAtMs?{variant:"warning",label:i("cron.running")}:e.state.lastStatus==="error"?{variant:"error",label:i("cron.lastFailed")}:e.state.lastStatus==="ok"?{variant:"success",label:i("cron.lastOk")}:{variant:"default",label:i("cron.pending")}:{variant:"default",label:i("cron.disabled")}}function b3(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 x3=[{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"}],y3=[{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 w3({job:e,onRun:t,onToggleEnabled:r,isRunning:a}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n(G,{icon:n(sd,{class:"w-4 h-4"}),label:i("cron.runNow"),size:"sm",variant:"ghost",disabled:a,onClick:o=>{o.stopPropagation(),t(e)}}),n(G,{icon:e.enabled?n(Ko,{class:"w-4 h-4"}):n(qo,{class:"w-4 h-4"}),label:e.enabled?i("cron.disable"):i("cron.enable"),size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),r(e)},class:e.enabled?"text-[var(--color-text-muted)]":"text-[var(--color-success)]"})]})}function k3({job:e,onEdit:t}){const r=Ed(e),a=e.delivery?.mode==="announce";return n(ya,{icon:me,iconVariant:e.enabled?r.variant==="error"?"error":"success":"default",title:e.name,badges:n(K,{children:[a&&n(ad,{class:"w-3.5 h-3.5 text-[var(--color-info)]","aria-label":i("cron.announces")}),n(X,{variant:r.variant,size:"sm",children:r.label})]}),meta:[{icon:Wo,value:As(e.schedule)},{icon:Km,value:Td(e)}],onClick:()=>t(e)})}function _3({job:e,onEdit:t,onRun:r,onToggleEnabled:a,isRunning:o}){const l=Ed(e),s=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":i("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(me,{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,s&&n(ad,{class:"w-3.5 h-3.5 text-[var(--color-info)] flex-shrink-0","aria-label":i("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(Wo,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate",title:As(e.schedule),children:As(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(Km,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:Td(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(w3,{job:e,onRun:r,onToggleEnabled:a,isRunning:o})})]})}function Yr({class:e="",fullWidth:t=!1,rows:r=3,error:a=!1,...o}){return n("textarea",{rows:r,class:`
|
|
386
|
-
px-3 py-2 text-sm rounded-lg resize-y
|
|
387
|
-
bg-[var(--color-bg-primary)]
|
|
388
|
-
text-[var(--color-text-primary)]
|
|
389
|
-
placeholder:text-[var(--color-text-muted)]
|
|
390
|
-
border transition-colors
|
|
391
|
-
focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)]/30 focus:border-[var(--color-accent)]
|
|
392
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
393
|
-
${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)]"}
|
|
394
|
-
${t?"w-full":""}
|
|
395
|
-
${e}
|
|
396
|
-
`,...o})}function S3({label:e,selected:t,onClick:r,title:a,size:o="md"}){return n("button",{type:"button",onClick:r,title:a,class:`
|
|
397
|
-
${o==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm"} rounded-lg border transition-colors
|
|
398
|
-
${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)]"}
|
|
399
|
-
`,children:e})}function Vf({options:e,value:t,onChange:r,size:a="md"}){return n("div",{class:"flex flex-wrap gap-2",children:e.map(o=>n(S3,{label:o.label,selected:t===o.value,onClick:()=>r(o.value),title:String(o.value),size:a},o.value))})}const C3=[{value:"cron",label:i("cron.scheduleKind.cron")},{value:"every",label:i("cron.scheduleKind.every")},{value:"at",label:i("cron.scheduleKind.at")}],T3=[{value:"main",label:i("cron.sessionTarget.main")},{value:"isolated",label:i("cron.sessionTarget.isolated")}],E3=[{value:"next-heartbeat",label:i("cron.wakeMode.nextHeartbeat")},{value:"now",label:i("cron.wakeMode.now")}];function A3({editName:e,editDescription:t,editScheduleKind:r,editScheduleExpr:a,editScheduleTz:o,editScheduleEveryMs:l,editScheduleAtMs:s,editSessionTarget:c,editWakeMode:d,editDeliveryAnnounce:u,editPayloadText:h,editPayloadMessage:f,editPayloadModel:p,formErrors:g}){const k=g.value;return n("div",{class:"space-y-4 sm:space-y-5",children:[n(Ee,{label:i("cron.form.name"),error:k.name,children:n(re,{value:e.value,onInput:_=>e.value=_.target.value,placeholder:i("cron.form.namePlaceholder"),error:!!k.name,fullWidth:!0})}),n(Ee,{label:i("cron.form.description"),hint:i("cron.form.descriptionHint"),children:n(re,{value:t.value,onInput:_=>t.value=_.target.value,placeholder:i("cron.form.descriptionPlaceholder"),fullWidth:!0})}),n(Ee,{label:i("cron.form.schedule"),error:k.schedule,children:n("div",{class:"space-y-3",children:[n(Ae,{value:r.value,onChange:_=>r.value=_,options:C3}),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(re,{value:a.value,onInput:_=>a.value=_.target.value,placeholder:i("cron.form.cronPlaceholder"),fullWidth:!0}),n(re,{value:o.value,onInput:_=>o.value=_.target.value,placeholder:i("cron.form.timezonePlaceholder"),fullWidth:!0})]}),n(Vf,{options:y3.map(({expr:_,label:T})=>({value:_,label:T})),value:a.value,onChange:_=>a.value=_,size:"sm"})]}),r.value==="every"&&n("div",{class:"space-y-2",children:[n(Vf,{options:x3.map(({ms:_,label:T})=>({value:String(_),label:T})),value:l.value,onChange:_=>l.value=_}),n(re,{type:"number",value:l.value,onInput:_=>l.value=_.target.value,placeholder:i("cron.form.intervalPlaceholder"),fullWidth:!0})]}),r.value==="at"&&n(re,{type:"datetime-local",value:m3(Number(s.value)||Date.now()),onInput:_=>{const T=_.target.value;s.value=String(v3(T))},fullWidth:!0})]})}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[n(Ee,{label:i("cron.form.sessionTarget"),hint:i("cron.form.sessionTargetHint"),children:n(Ae,{value:c.value,onChange:_=>{c.value=_},options:T3})}),n(Ee,{label:i("cron.form.wakeMode"),hint:i("cron.form.wakeModeHint"),children:n(Ae,{value:d.value,onChange:_=>d.value=_,options:E3})})]}),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:i("cron.form.announceResults")}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("cron.form.announceResultsHint")})]}),n(Ve,{checked:u.value,onChange:_=>u.value=_,label:i("cron.form.announceResults")})]}),n(Ee,{label:i("cron.form.payload"),error:k.payload,hint:c.value==="main"?i("cron.form.payloadHintMain"):i("cron.form.payloadHintIsolated"),children:c.value==="main"?n(Yr,{value:h.value,onInput:_=>h.value=_.target.value,placeholder:i("cron.form.systemEventPlaceholder"),error:!!k.payload,rows:3,fullWidth:!0}):n("div",{class:"space-y-3",children:[n(Yr,{value:f.value,onInput:_=>f.value=_.target.value,placeholder:i("cron.form.agentMessagePlaceholder"),error:!!k.payload,rows:3,fullWidth:!0}),n(re,{value:p.value,onInput:_=>p.value=_.target.value,placeholder:i("cron.form.modelPlaceholder"),fullWidth:!0})]})})]})}function Gi({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 M3({mode:e,job:t,runs:r,isLoadingRuns:a,isDeleting:o,isSaving:l,isRunning:s,hasChanges:c,onClose:d,onSave:u,onDelete:h,onRun:f,onSetDeleting:p,editName:g,editDescription:k,editEnabled:_,editScheduleKind:T,editScheduleExpr:C,editScheduleTz:m,editScheduleEveryMs:b,editScheduleAtMs:S,editSessionTarget:w,editWakeMode:x,editDeliveryAnnounce:E,editPayloadText:L,editPayloadMessage:A,editPayloadModel:H,formErrors:$}){if(!e)return null;const Y=e==="edit",ze=t?Ed(t):null;return n(Xe,{open:!!e,onClose:d,title:Y&&t?t.name:i("cron.createJob"),size:"xl",footer:o?n(Iv,{message:i("cron.confirmDelete"),onCancel:()=>p(!1),onDelete:h}):n($v,{isEdit:Y&&!!t,onDeleteClick:()=>p(!0),onCancel:d,onSave:u,isSaving:l,saveDisabled:!c,saveLabel:i(Y?"actions.save":"actions.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:_.value?i("cron.enabled"):i("cron.disabled")}),n(Ve,{checked:_.value,onChange:xe=>_.value=xe})]})}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[Y&&t&&ze&&n(K,{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(me,{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:ze.variant,size:"sm",children:ze.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:As(t.schedule)})]})]}),n(N,{size:"sm",variant:"secondary",icon:n(sd,{class:"w-4 h-4"}),onClick:()=>f(t),disabled:s,fullWidth:!0,class:"sm:w-auto",children:i("cron.runNow")})]}),n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(Gi,{value:Td(t),label:i("cron.nextRun")}),n(Gi,{value:g3(t),label:i("cron.lastRun")}),n(Gi,{value:t.state.lastDurationMs?`${Math.round(t.state.lastDurationMs/1e3)}s`:"—",label:i("cron.lastDuration")})]})]}),n(A3,{editName:g,editDescription:k,editScheduleKind:T,editScheduleExpr:C,editScheduleTz:m,editScheduleEveryMs:b,editScheduleAtMs:S,editSessionTarget:w,editWakeMode:x,editDeliveryAnnounce:E,editPayloadText:L,editPayloadMessage:A,editPayloadModel:H,formErrors:$}),Y&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-3",children:i("cron.recentRuns")}),a?n("div",{class:"flex justify-center py-4",children:n(ee,{size:"sm"})}):r.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-4",children:i("cron.noRuns")}):n("div",{class:"space-y-2 max-h-48 overflow-y-auto",children:r.map(xe=>n("div",{class:"flex items-center gap-3 p-2 rounded-lg bg-[var(--color-bg-secondary)] text-sm",children:[xe.status==="ok"?n(qo,{class:"w-4 h-4 text-[var(--color-success)]"}):xe.status==="error"?n(Ko,{class:"w-4 h-4 text-[var(--color-error)]"}):n(me,{class:"w-4 h-4 text-[var(--color-warning)]"}),n("span",{class:"flex-1",children:oe(xe.runAtMs)}),xe.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:[Math.round(xe.durationMs/1e3),"s"]}),xe.error&&n("span",{class:"text-[var(--color-error)] truncate max-w-[200px]",title:xe.error,children:xe.error})]},xe.runAtMs))})]})]})})}const On=v([]),Dv=v(null),Wc=v(!1),dr=v(null),Lv=v(""),qc=v("all"),fi=v(null),Fn=v(null),To=v([]),Kc=v(!1),Nv=v(!1),Gc=v(!1),Vc=v(!1),hr=v(""),Jr=v(""),Xr=v(!0),Rt=v("cron"),fr=v(""),Zr=v(""),Qr=v(""),ea=v(""),ta=v("next-heartbeat"),Jt=v("main"),na=v(!1),ra=v(""),aa=v(""),oa=v(""),pi=v({}),R3=j(()=>{let e=On.value;qc.value==="enabled"?e=e.filter(r=>r.enabled):qc.value==="disabled"&&(e=e.filter(r=>!r.enabled));const t=Lv.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})}),I3=j(()=>{const e={total:0,enabled:0,disabled:0};for(const t of On.value)e.total++,t.enabled?e.enabled++:e.disabled++;return e});async function Ms(){Wc.value=!0,dr.value=null;const[e,t]=await Promise.allSettled([F("cron.status",{}),F("cron.list",{includeDisabled:!0})]);e.status==="fulfilled"&&(Dv.value=e.value),t.status==="fulfilled"&&(On.value=t.value.jobs??[]);const r=[];e.status==="rejected"&&r.push(`Status: ${ce(e.reason)}`),t.status==="rejected"&&r.push(`Jobs: ${ce(t.reason)}`),r.length>0&&(dr.value=r.join("; ")),Wc.value=!1}async function $3(e){Kc.value=!0;try{const t=await F("cron.runs",{jobId:e,limit:20});To.value=t.entries??[]}catch{To.value=[]}finally{Kc.value=!1}}function D3(e){hr.value=e.name,Jr.value=e.description??"",Xr.value=e.enabled,Rt.value=e.schedule.kind,e.schedule.kind==="cron"?(fr.value=e.schedule.expr,Zr.value=e.schedule.tz??""):e.schedule.kind==="every"?Qr.value=String(e.schedule.everyMs):e.schedule.kind==="at"&&(ea.value=String(e.schedule.atMs)),ta.value=e.wakeMode,Jt.value=e.sessionTarget,na.value=e.delivery?.mode==="announce",e.payload.kind==="systemEvent"?ra.value=e.payload.text:(aa.value=e.payload.message,oa.value=e.payload.model??""),pi.value={}}function L3(){hr.value="",Jr.value="",Xr.value=!0,Rt.value="cron",fr.value="",Zr.value="",Qr.value="",ea.value="",ta.value="next-heartbeat",Jt.value="main",na.value=!1,ra.value="",aa.value="",oa.value="",pi.value={}}function N3(e,t){e==="edit"&&t?(Fn.value=t,D3(t),$3(t.id)):(Fn.value=null,L3(),To.value=[]),fi.value=e}function Ad(){fi.value=null,Fn.value=null,To.value=[],Nv.value=!1}function O3(){const e={};if(hr.value.trim()||(e.name=i("cron.validation.nameRequired")),Rt.value==="cron")fr.value.trim()?b3(fr.value)||(e.schedule=i("cron.validation.cronInvalid")):e.schedule=i("cron.validation.cronRequired");else if(Rt.value==="every"){const t=parseInt(Qr.value,10);(!t||t<1e3)&&(e.schedule=i("cron.validation.intervalMin"))}else if(Rt.value==="at"){const t=parseInt(ea.value,10);(!t||t<Date.now())&&(e.schedule=i("cron.validation.atFuture"))}return Jt.value==="main"?ra.value.trim()||(e.payload=i("cron.validation.payloadRequired")):aa.value.trim()||(e.payload=i("cron.validation.payloadRequired")),pi.value=e,Object.keys(e).length===0}function Yf(){switch(Rt.value){case"cron":return{kind:"cron",expr:fr.value,...Zr.value?{tz:Zr.value}:{}};case"every":return{kind:"every",everyMs:parseInt(Qr.value,10)||6e4};case"at":return{kind:"at",atMs:parseInt(ea.value,10)||Date.now()}}}function Jf(){return Jt.value==="main"?{kind:"systemEvent",text:ra.value}:{kind:"agentTurn",message:aa.value,...oa.value?{model:oa.value}:{}}}async function F3(){if(O3()){Gc.value=!0;try{if(fi.value==="edit"&&Fn.value){const e={name:hr.value,description:Jr.value||void 0,enabled:Xr.value,schedule:Yf(),sessionTarget:Jt.value,wakeMode:ta.value,payload:Jf(),delivery:{mode:na.value?"announce":"none"}};await F("cron.update",{jobId:Fn.value.id,patch:e})}else{const e={name:hr.value,description:Jr.value||void 0,enabled:Xr.value,schedule:Yf(),sessionTarget:Jt.value,wakeMode:ta.value,payload:Jf(),delivery:{mode:na.value?"announce":"none"}};await F("cron.add",{job:e})}await Ms(),Ad()}catch(e){dr.value=ce(e)}finally{Gc.value=!1}}}async function P3(){const e=Fn.value;if(e)try{await F("cron.remove",{jobId:e.id}),On.value=On.value.filter(t=>t.id!==e.id),Ad()}catch(t){dr.value=ce(t)}}async function z3(e){Vc.value=!0;try{await F("cron.run",{jobId:e.id,mode:"force"}),await Ms()}catch(t){dr.value=ce(t)}finally{Vc.value=!1}}async function U3(e){try{await F("cron.update",{jobId:e.id,patch:{enabled:!e.enabled}}),On.value=On.value.map(t=>t.id===e.id?{...t,enabled:!t.enabled}:t)}catch(t){dr.value=ce(t)}}function H3(){O(()=>{D.value&&Ms()},[D.value]);const e=Ks(()=>{const t=Fn.value;if(!t||hr.value!==t.name||Jr.value!==(t.description??"")||Xr.value!==t.enabled||Rt.value!==t.schedule.kind||ta.value!==t.wakeMode||Jt.value!==t.sessionTarget||na.value!==(t.delivery?.mode==="announce"))return!0;if(t.schedule.kind==="cron"&&Rt.value==="cron"){if(fr.value!==t.schedule.expr||Zr.value!==(t.schedule.tz??""))return!0}else if(t.schedule.kind==="every"&&Rt.value==="every"){if(Qr.value!==String(t.schedule.everyMs))return!0}else if(t.schedule.kind==="at"&&Rt.value==="at"&&ea.value!==String(t.schedule.atMs))return!0;if(t.payload.kind==="systemEvent"&&Jt.value==="main"){if(ra.value!==t.payload.text)return!0}else if(t.payload.kind==="agentTurn"&&Jt.value==="isolated"&&(aa.value!==t.payload.message||oa.value!==(t.payload.model??"")))return!0;return!1});return{state:{cronJobs:On,cronStatus:Dv,isLoading:Wc,error:dr,searchQuery:Lv,statusFilter:qc},modal:{modalMode:fi,selectedJob:Fn,selectedJobRuns:To,isLoadingRuns:Kc,isDeleting:Nv,isSaving:Gc,isRunning:Vc},form:{editName:hr,editDescription:Jr,editEnabled:Xr,editScheduleKind:Rt,editScheduleExpr:fr,editScheduleTz:Zr,editScheduleEveryMs:Qr,editScheduleAtMs:ea,editWakeMode:ta,editSessionTarget:Jt,editDeliveryAnnounce:na,editPayloadText:ra,editPayloadMessage:aa,editPayloadModel:oa,formErrors:pi},computed:{filteredJobs:R3,jobCounts:I3,hasFormChanges:e},actions:{loadCronJobs:Ms,openJobModal:N3,closeModal:Ad,saveOrCreateJob:F3,deleteJob:P3,runJobNow:z3,toggleJobEnabled:U3}}}function B3(e){const{state:t,modal:r,form:a,computed:o,actions:l}=H3(),s=o.jobCounts.value;return n(at,{viewName:i("nav.cron"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:[n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(St,{title:i("cron.title"),subtitle:i("cron.description"),actions:n(K,{children:[D.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(re,{type:"text",value:t.searchQuery.value,onInput:c=>t.searchQuery.value=c.target.value,placeholder:i("cron.searchPlaceholder"),"aria-label":i("cron.searchPlaceholder"),class:"pl-10 w-64"})]}),n(N,{icon:n(ir,{class:"w-4 h-4"}),onClick:()=>l.openJobModal("create"),disabled:!D.value,children:[n("span",{class:"hidden sm:inline",children:i("cron.createJob")}),n("span",{class:"sm:hidden",children:i("actions.new")})]}),n(G,{icon:n(Fe,{class:`w-4 h-4 ${t.isLoading.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:l.loadCronJobs,disabled:t.isLoading.value||!D.value,variant:"ghost"})]})}),D.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative sm:hidden",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(re,{type:"text",value:t.searchQuery.value,onInput:c=>t.searchQuery.value=c.target.value,placeholder:i("cron.searchPlaceholder"),"aria-label":i("cron.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),D.value&&!t.isLoading.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-4",children:[n(pe,{icon:me,label:i("cron.stats.total"),value:s.total,active:t.statusFilter.value==="all",onClick:()=>t.statusFilter.value="all"}),n(pe,{icon:qo,label:i("cron.stats.enabled"),value:s.enabled,active:t.statusFilter.value==="enabled",onClick:()=>t.statusFilter.value="enabled"}),n(pe,{icon:Ko,label:i("cron.stats.disabled"),value:s.disabled,active:t.statusFilter.value==="disabled",onClick:()=>t.statusFilter.value="disabled"}),n(pe,{icon:rn,label:i("cron.stats.nextWake"),value:t.cronStatus.value?.nextWakeAtMs?oe(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||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(ee,{size:"lg",label:D.value?void 0:i("status.connecting")})}),D.value&&!t.isLoading.value&&o.filteredJobs.value.length>0&&n(K,{children:[n("div",{class:"md:hidden space-y-2",children:o.filteredJobs.value.map(c=>n(k3,{job:c,onEdit:l.openJobModal.bind(null,"edit")},c.id))}),n(V,{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:i("cron.columns.job")}),n("th",{class:"py-3 px-4 font-medium w-40",children:i("cron.columns.schedule")}),n("th",{class:"py-3 px-4 font-medium w-24",children:i("cron.columns.target")}),n("th",{class:"py-3 px-4 font-medium w-32",children:i("cron.columns.nextRun")}),n("th",{class:"py-3 px-4 font-medium w-24",children:i("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(c=>n(_3,{job:c,onEdit:l.openJobModal.bind(null,"edit"),onRun:l.runJobNow,onToggleEnabled:l.toggleJobEnabled,isRunning:r.isRunning.value},c.id))})]})})]}),D.value&&!t.isLoading.value&&t.cronJobs.value.length===0&&!t.error.value&&n(V,{children:n("div",{class:"p-16 text-center",children:[n(me,{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:i("cron.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("cron.emptyDescription")}),n(N,{icon:n(ir,{class:"w-4 h-4"}),onClick:()=>l.openJobModal("create"),children:i("cron.createJob")})]})}),D.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&o.filteredJobs.value.length===0&&n(V,{children:n("div",{class:"p-12 text-center",children:[n(Ke,{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:i("cron.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("cron.noResultsDescription")}),n(N,{variant:"secondary",size:"sm",onClick:()=>{t.searchQuery.value="",t.statusFilter.value="all"},children:i("cron.clearFilters")})]})}),D.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?i("cron.count",{count:t.cronJobs.value.length}):i("cron.filteredCount",{filtered:o.filteredJobs.value.length,total:t.cronJobs.value.length})})]}),n(M3,{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:l.closeModal,onSave:l.saveOrCreateJob,onDelete:l.deleteJob,onRun:l.runJobNow,onSetDeleting:c=>r.isDeleting.value=c,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 j3={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 Pn({title:e,children:t,items:r,variant:a="info",class:o}){return n("div",{class:`
|
|
400
|
-
p-3 rounded-lg text-xs
|
|
401
|
-
${j3[a]}
|
|
402
|
-
${o||""}
|
|
403
|
-
`,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,s)=>n("li",{children:l},s))}):t]})}function Ov(e){return e.join(".")}function W3(e,t,r){if(t.length===0)return e;const a={...e};let o=a;for(let s=0;s<t.length-1;s++){const c=t[s],d=o[c];d==null||typeof d!="object"?o[c]=typeof t[s+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 Fv(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 q3(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 Zo(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 Zo(r[0])}return null}function K3(e){if(e.default!==void 0)return e.default;if(e.const!==void 0)return e.const;switch(Zo(e)){case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";case"array":return[];case"object":return{};default:return}}function G3(e,t){const r=Ov(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 V3=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 pr(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 V3.has(r)?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}).join(" ")}function Gl(e,t){const r=Zo(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 i("config.validation.mustBeString");if(t.minLength&&e.length<t.minLength)return i("config.validation.minLength",{min:t.minLength});if(t.maxLength&&e.length>t.maxLength)return i("config.validation.maxLength",{max:t.maxLength});if(t.pattern&&!new RegExp(t.pattern).test(e))return i("config.validation.invalidFormat");break;case"number":case"integer":if(typeof e!="number")return i("config.validation.mustBeNumber");if(t.minimum!==void 0&&e<t.minimum)return i("config.validation.minimum",{min:t.minimum});if(t.maximum!==void 0&&e>t.maximum)return i("config.validation.maximum",{max:t.maximum});if(r==="integer"&&!Number.isInteger(e))return i("config.validation.mustBeInteger");break;case"boolean":if(typeof e!="boolean")return i("config.validation.mustBeBoolean");break;case"array":if(!Array.isArray(e))return i("config.validation.mustBeArray");if(t.minItems&&e.length<t.minItems)return i("config.validation.minItems",{min:t.minItems});if(t.maxItems&&e.length>t.maxItems)return i("config.validation.maxItems",{max:t.maxItems});break;case"object":if(typeof e!="object"||Array.isArray(e))return i("config.validation.mustBeObject");break}return t.enum&&!t.enum.includes(e)?i("config.validation.invalidOption"):null}const _n=v(!1),st=v(null),Eo=v(!1),un=v(null),Sr=v({}),Ao=v({}),It=v({}),Vl=v(null),Pv=v(null),zv=v(!1),Y3=v(!0),J3=v(null),Vi=v(""),la=v({}),Yl=j(()=>JSON.stringify(Ao.value)!==JSON.stringify(It.value)),Yc=j(()=>Yl.value&&!Eo.value&&Object.keys(la.value).length===0);async function Xf(){_n.value=!0,st.value=null;try{const[e,t]=await Promise.all([F("config.get",{}),F("config.schema",{})]);un.value=t.schema,Sr.value=t.uiHints,J3.value=t.version,Ao.value=e.config,It.value=structuredClone(e.config),Vl.value=e.hash??null,Pv.value=e.path??null,zv.value=e.exists,Y3.value=e.valid,la.value={}}catch(e){st.value=ce(e)}finally{_n.value=!1}}function dt(e,t){It.value=W3(It.value,e,t)}function X3(){It.value=structuredClone(Ao.value),la.value={}}function Jl(e,t){const r={...la.value};t?r[e]=t:delete r[e],la.value=r}async function Z3(){if(!Yc.value)return!1;if(!Vl.value&&zv.value)return st.value="Missing base hash. Reload and try again.",!1;Eo.value=!0,st.value=null;try{const e=Uv(Ao.value,It.value),t=await F("config.patch",{raw:JSON.stringify(e),baseHash:Vl.value});if(t.ok){Ao.value=t.config,It.value=structuredClone(t.config),Pv.value=t.path;const r=await F("config.get",{});return Vl.value=r.hash??null,!0}else return st.value="Failed to save configuration",!1}catch(e){const t=ce(e);return t.includes("hash")||t.includes("changed")?st.value="Configuration was modified externally. Please reload.":st.value=t,!1}finally{Eo.value=!1}}function Uv(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]=Uv(o,l):r[a]=l)}for(const a of Object.keys(e))a in t||(r[a]=null);return r}function Q3(e){return e.properties?Object.values(e.properties).some(t=>!Md(t)):!1}function Md(e){return e.type==="array"&&e.items?.properties?!0:e.type==="object"&&e.properties?Object.keys(e.properties).length>=2:!1}function Jc(e,t,r,a=[],o=0){if(!e.properties)return[];const l=[];for(const[s,c]of Object.entries(e.properties)){const d=[...a,s],h=(r[s]??r[d.join(".")]??{}).label??c.title??pr(s);if(o>0&&!Md(c))continue;const f={key:s,label:h,path:d,schema:c};if(c.type==="object"&&c.properties){const p=t[s]??{};f.children=Jc(c,p,r,d,o+1),f.children.length===0&&delete f.children}if(c.type==="array"&&c.items?.properties){const p=t[s]??[];f.children=p.map((g,k)=>{const _=g,T=_.identity,C=_.id??_.name??_.label??`#${k+1}`,m=T?.emoji??"";return{key:String(k),label:m?`${m} ${C}`:String(C),path:[...d,k],schema:c.items}})}l.push(f)}return l.sort((s,c)=>{const d=r[s.key]?.order??100,u=r[c.key]?.order??100;return d-u}),l}const Rd={gateway:en,agents:C1,channels:xs,tools:X1,commands:G1,session:An,cron:me,skills:hd,plugins:id,logging:Qt,auth:Kh,models:Wh,wizard:Y1,update:Dt,diagnostics:In,nodeHost:cr,audio:V1,messages:tn,bindings:Bm,ui:H1,browser:Mt,hooks:J1,web:en,canvas:Nr,canvasHost:Nr,approvals:ii,notifications:ad,meta:Qt,env:qh,nodes:cr,broadcast:xs,media:Nr,network:Ni,secrets:oi,memory:gs,memorySearch:gs,storage:qh,tls:Kh,remote:Ni,reload:Fe,tailscale:Ni,sandbox:Wh,context:Lc,contextPruning:Lc,compaction:rn,heartbeat:In,defaults:ud},Hv=A1;function Bv({item:e,depth:t=0,selectedPath:r,expandedNav:a}){const o=e.path.join("."),l=a.value.has(o),s=r.value.join(".")===o||r.value.join(".").startsWith(o+"."),c=e.children&&e.children.length>0,d=t===0?Rd[e.key]??Hv:void 0,u=()=>{r.value=e.path},h=p=>{p.stopPropagation();const g=new Set(a.value);l?g.delete(o):g.add(o),a.value=g},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":s?"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":i(l?"accessibility.collapseSection":"accessibility.expandSection"),children:l?n(nt,{class:"w-3.5 h-3.5"}):n(rt,{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(Bv,{item:p,depth:t+1,selectedPath:r,expandedNav:a},p.key))]})]})}function pn({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 e_({value:e,placeholder:t,onChange:r,wide:a}){const[o,l]=B(!1);return n("div",{class:"relative",children:[n(re,{type:o?"text":"password",value:e,placeholder:t,onInput:s=>r(s.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":i(o?"config.field.hidePassword":"config.field.showPassword"),children:o?n(Fm,{class:"w-4 h-4"}):n(ld,{class:"w-4 h-4"})})]})}function jv({value:e,onChange:t}){const[r,a]=B(()=>JSON.stringify(e,null,2)??""),[o,l]=B(null);return n("div",{class:"space-y-1",children:[n(Yr,{value:r,onInput:c=>a(c.target.value),onBlur:()=>{try{const c=JSON.parse(r);t(c),l(null)}catch{l(i("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 t_({schema:e,value:t,path:r,hints:a,level:o,label:l,help:s,isDetailView:c=!1,skipNavWorthy:d=!1}){const[u,h]=B(o<2||c),f=e.properties??{},p=Object.keys(f).filter(k=>{if(!d)return!0;const _=f[k];return!Md(_)}),g=t??{};return c&&o===0?p.length===0?n("div",{class:"text-sm text-[var(--color-text-muted)] py-4",children:i("config.noSettingsAtLevel")}):n("div",{class:"space-y-2",children:[s&&n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:s}),p.map(k=>n(Fr,{schema:f[k],value:g[k],path:[...r,k],hints:a,level:o+1,skipNavWorthy:d},k))]}):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}),s&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:s})]}),n("div",{class:"px-4 py-2",children:p.map(k=>n(Fr,{schema:f[k],value:g[k],path:[...r,k],hints:a,level:o+1,skipNavWorthy:d},k))})]})}),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(nt,{class:"w-4 h-4"}):n(rt,{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:[s&&n("p",{class:"text-xs text-[var(--color-text-muted)] pb-2 leading-relaxed",children:s}),p.map(k=>n(Fr,{schema:f[k],value:g[k],path:[...r,k],hints:a,level:o+1,skipNavWorthy:d},k))]})]})]})}function n_({schema:e,value:t,path:r,hints:a,level:o,label:l,help:s}){const[c,d]=B(o<2),u=t??[],h=e.items??{},f=Zo(h),p=()=>{const _=K3(h);dt(r,[...u,_])},g=_=>{const T=u.filter((C,m)=>m!==_);dt(r,T)},k=(_,T)=>{const C=[...u],[m]=C.splice(_,1);C.splice(T,0,m),dt(r,C)};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}),s&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:s})]}),n(N,{variant:"secondary",size:"sm",icon:ir,onClick:p,fullWidth:!0,class:"sm:w-auto",children:i("config.field.addItem")})]}),n("div",{class:"space-y-2 w-full",children:[u.map((_,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&&k(T,T-1),disabled:T===0,"aria-label":i("config.field.moveUp"),children:n(od,{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&&k(T,T+1),disabled:T===u.length-1,"aria-label":i("config.field.moveDown"),children:n(nt,{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:i("config.field.dragToReorder"),children:n(zm,{class:"w-4 h-4"})}),n(re,{type:f==="number"?"number":"text",value:String(_??""),onInput:C=>{const m=C.target.value,b=[...u];b[T]=f==="number"?Number(m):m,dt(r,b)},fullWidth:!0}),n(G,{icon:n(Lt,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:i("config.field.removeItem"),onClick:()=>g(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:i("config.field.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(nt,{class:"w-4 h-4"}):n(rt,{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:ir,onClick:p,fullWidth:!0,class:"sm:w-auto",children:i("config.field.addItem")})]}),s&&n("p",{class:"text-xs text-[var(--color-text-muted)] mb-3 leading-relaxed",children:s}),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:i("config.field.noItems")}):u.map((_,T)=>n(r_,{schema:h,value:_,path:[...r,T],parentPath:r,hints:a,level:o+1,index:T,totalItems:u.length,onRemove:()=>g(T),onReorder:k},T))})]})}function r_({schema:e,value:t,path:r,parentPath:a,hints:o,level:l,index:s,totalItems:c,onRemove:d,onReorder:u}){const[h,f]=B(!1),[p,g]=B(!1),[k,_]=B(!1),T=t??{},C=T.id??T.name??T.label??T.displayName??`#${s+1}`,b=T.identity?.emoji??"",S=A=>{g(!0),A.dataTransfer.effectAllowed="move",A.dataTransfer.setData("text/plain",JSON.stringify({path:a.join("."),index:s}))},w=()=>{g(!1)},x=A=>{A.preventDefault(),A.dataTransfer.dropEffect="move",_(!0)},E=()=>{_(!1)},L=A=>{A.preventDefault(),_(!1);try{const H=JSON.parse(A.dataTransfer.getData("text/plain"));H.path===a.join(".")&&H.index!==s&&u(H.index,s)}catch{}};return n(V,{padding:"none",class:`overflow-hidden transition-all ${p?"opacity-50":""} ${k?"ring-2 ring-[var(--color-accent)]":""}`,draggable:c>1,onDragStart:S,onDragEnd:w,onDragOver:x,onDragLeave:E,onDrop:L,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:()=>s>0&&u(s,s-1),disabled:s===0,"aria-label":i("config.field.moveUp"),children:n(od,{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:()=>s<c-1&&u(s,s+1),disabled:s===c-1,"aria-label":i("config.field.moveDown"),children:n(nt,{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:i("config.field.dragToReorder"),children:n(zm,{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(nt,{class:"w-4 h-4"}):n(rt,{class:"w-4 h-4"})}),b&&n("span",{children:b}),n("span",{class:"text-sm font-medium",children:String(C)})]}),n(G,{icon:n(Lt,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:i("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(Fr,{schema:e,value:t,path:r,hints:o,level:l,showLabel:!1,isDetailView:!0})})]})}function a_({schema:e,value:t,path:r,hints:a,level:o,label:l,help:s,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(Fr,{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,g)=>({value:String(h[g]),label:p.title??pr(String(h[g]))}));return n(pn,{label:c!==!1?l:void 0,description:s,inline:c!==!1,children:n(Ae,{value:String(t??""),options:f,onChange:p=>dt(r,p),size:"sm",class:"w-full sm:w-auto sm:inline-block"})})}return n(pn,{label:c!==!1?l:void 0,description:s,children:n(jv,{value:t,onChange:f=>dt(r,f)})})}function Fr({schema:e,value:t,path:r,hints:a,level:o=0,showLabel:l=!0,isDetailView:s=!1,skipNavWorthy:c=!1}){const d=Zo(e),u=G3(r,a)??{},h=Ov(r),f=u.label??e.title??pr(r[r.length-1]??""),p=u.help??e.description,g=la.value[h];if(e.anyOf||e.oneOf)return n(a_,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:p,showLabel:l});switch(d){case"object":return n(t_,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:p,isDetailView:s,skipNavWorthy:c});case"array":return n(n_,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:p});case"boolean":return n(pn,{error:g,children:n(Ve,{checked:!!(t??e.default),onChange:k=>{dt(r,k)},label:l?f:void 0,description:p})});case"number":case"integer":return n(pn,{label:l?f:void 0,description:p,error:g,inline:!0,children:n(re,{type:"number",value:t==null?"":String(t),placeholder:u.placeholder,onInput:k=>{const _=k.target.value,T=_===""?void 0:Number(_);dt(r,T),Jl(h,Gl(T,e))},min:e.minimum,max:e.maximum,class:"w-full sm:w-24 text-right"})});case"string":return o_({schema:e,value:t,path:r,hint:u,key:h,label:f,help:p,errorMsg:g,showLabel:l});default:return n(pn,{label:l?f:void 0,description:p,error:g,children:n(jv,{value:t,onChange:k=>dt(r,k)})})}}function o_({schema:e,value:t,path:r,hint:a,key:o,label:l,help:s,errorMsg:c,showLabel:d}){if(e.enum)return n(pn,{label:d?l:void 0,description:s,error:c,inline:!0,children:n(Ae,{value:String(t??""),options:e.enum.map(p=>({value:String(p),label:pr(String(p))})),onChange:p=>dt(r,p),size:"sm",class:"w-full sm:w-auto sm:inline-block"})});if(a.sensitive)return n(pn,{label:d?l:void 0,description:s,error:c,inline:!0,children:n(e_,{value:String(t??""),placeholder:a.placeholder,onChange:p=>{dt(r,p),Jl(o,Gl(p,e))},wide:!0})});if((e.maxLength??0)>200)return n(pn,{label:d?l:void 0,description:s,error:c,children:n(Yr,{value:String(t??""),placeholder:a.placeholder,onInput:p=>{const g=p.target.value;dt(r,g),Jl(o,Gl(g,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(pn,{label:d?l:void 0,description:s,error:c,inline:!0,children:n(re,{type:u?"url":"text",value:String(t??""),placeholder:a.placeholder,onInput:p=>{const g=p.target.value;dt(r,g),Jl(o,Gl(g,e))},class:f})})}function Zf({selectedPath:e,schema:t,draftConfig:r,uiHints:a,skipNavWorthy:o=!1}){const l=e.value,s=t.value,c=r.value,d=a.value;if(!s||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(ud,{class:"w-12 h-12 mx-auto mb-4 opacity-50"}),n("p",{children:i("config.selectSection")})]})});const u=Fv(s,l),h=q3(c,l);if(!u)return n("div",{class:"flex-1 p-6 text-[var(--color-text-muted)]",children:n("p",{children:i("config.schemaNotFound",{path:l.join(" › ")})})});const f=l.map((b,S)=>{const w=l.slice(0,S+1);return d[w.join(".")]?.label??pr(b)}),p=f[f.length-1],g=f.slice(0,-1),k=l.join("."),T=d[k]?.help??u.description,C=String(l[0]),m=Rd[C];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:[g.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] mb-1.5",children:g.join(" › ")}),n("div",{class:"flex items-center gap-3",children:[m&&l.length===1&&n(m,{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(Fr,{schema:u,value:h,path:l,hints:d,level:0,showLabel:!1,isDetailView:!0,skipNavWorthy:o})})]})}function l_({selectedPath:e,uiHints:t,isDirty:r,canSave:a,isSaving:o,onSave:l,onReset:s,onBack:c,showBack:d}){const u=e.value,h=t.value,f=d??u.length>0,p=()=>{if(u.length===0)return i("config.title");const C=u[u.length-1],m=u.join("."),b=h[m];return b?.label?b.label:pr(C)},g=()=>u.length<=1?null:u.slice(0,-1).map((m,b)=>{const S=u.slice(0,b+1);return h[S.join(".")]?.label??pr(m)}).join(" › "),k=()=>{c?c():u.length>0&&(e.value=u.slice(0,-1))},_=p(),T=g();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(G,{icon:n(Nm,{size:20}),onClick:k,label:i("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:_})]}),n("div",{class:"flex items-center gap-1",children:r&&n(K,{children:[n(G,{icon:n(si,{size:18}),onClick:s,label:i("config.reset"),size:"sm",variant:"ghost"}),n(G,{icon:n(cd,{size:18}),onClick:l,disabled:!a,label:i(o?"config.saving":"config.save"),size:"sm",variant:"ghost",class:a?"text-[var(--color-accent)]":""})]})})]})}function s_({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?Rd[o.key]??Hv: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(rt,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]},o.key)})})}const Wv="cove:config:expandedNav";function Id(){const e=window.location.hash.slice(1);return e?e.split(".").map(t=>{const r=Number(t);return Number.isInteger(r)&&r>=0?r:t}):[]}function i_(e){return e.length===0?"":e.join(".")}function c_(){try{const e=localStorage.getItem(Wv);if(e)return new Set(JSON.parse(e))}catch{}return new Set(["gateway","agents","channels"])}const we=v(Id()),Rs=v(c_()),Vn=v(!1);we.subscribe(()=>{Vn.value=!1});let Xc=!1;we.subscribe(e=>{const t=i_(e),r=window.location.hash.slice(1);if(t!==r&&(Xc=!0,t?window.location.hash=t:history.replaceState(null,"",window.location.pathname+window.location.search),Xc=!1),e.length>1){const a=new Set(Rs.value);for(let o=1;o<e.length;o++)a.add(e.slice(0,o).join("."));Rs.value=a}});typeof window<"u"&&window.addEventListener("hashchange",()=>{Xc||(we.value=Id())});Rs.subscribe(e=>{try{localStorage.setItem(Wv,JSON.stringify([...e]))}catch{}});function qv(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?qv(o.children,a):null:null}function u_(e,t){if(t.length===0)return{items:e,isTopLevel:!0};const r=qv(e,t);return r?.children&&r.children.length>0?{items:r.children,isTopLevel:!1}:null}function d_(e){O(()=>{const g=Id();g.length>0&&(we.value=g)},[]),O(()=>{D.value&&!un.value&&Xf()},[D.value]),O(()=>{if(!un.value)return;const g=we.value,k=window.matchMedia("(max-width: 767px)").matches,T=Jc(un.value,It.value,Sr.value)[0]?.path;if(g.length===0){T&&!k&&(we.value=T);return}const C=String(g[0]);un.value.properties?.[C]||(k?we.value=[]:T&&(we.value=T))},[un.value]);const t=async()=>{await Z3()?ie.success(i("config.saveSuccess")):st.value&&ie.error(st.value)},r=()=>{X3(),ie.success(i("config.reset"))},a=un.value,o=It.value,l=Sr.value,s=a?Jc(a,o,l):[],c=Vi.value.toLowerCase().trim(),d=c?s.filter(g=>{const k=g.label.toLowerCase().includes(c),_=g.children?.some(T=>T.label.toLowerCase().includes(c));return k||_}):s,u=u_(s,we.value),h=u!==null&&!Vn.value,f=Fv(a,we.value),p=we.value.length>0&&u!==null&&u.items.length>0&&f!==null&&Q3(f);return n(at,{viewName:i("config.title"),children:[n("div",{class:"md:hidden flex-1 flex flex-col overflow-hidden",children:[n(l_,{selectedPath:we,uiHints:Sr,isDirty:Yl.value,canSave:Yc.value,isSaving:Eo.value,onSave:t,onReset:r,showBack:we.value.length>0||Vn.value,onBack:()=>{Vn.value?Vn.value=!1:we.value.length>0&&(we.value=we.value.slice(0,-1))}}),st.value&&n("div",{class:"px-4 pt-4",children:n(Pn,{variant:"error",children:st.value})}),_n.value&&!a&&n("div",{class:"flex-1 flex items-center justify-center",children:n(ee,{size:"lg"})}),!_n.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:()=>{Vn.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(ud,{size:18,class:"text-[var(--color-text-muted)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)]",children:i("config.general")}),n(rt,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]}),n(s_,{items:u.items,selectedPath:we,isTopLevel:u.isTopLevel})]}):n(Zf,{selectedPath:we,schema:un,draftConfig:It,uiHints:Sr,skipNavWorthy:Vn.value})})]}),n("div",{class:"hidden md:flex md:flex-1 md:overflow-y-auto p-6",children:n("div",{class:"max-w-6xl mx-auto w-full space-y-6",children:[n(St,{title:i("config.title"),subtitle:i("config.description"),actions:n(K,{children:[Yl.value&&n("span",{class:"text-sm text-[var(--color-warning)]",children:i("config.unsavedChanges")}),n(N,{variant:"secondary",size:"sm",icon:si,onClick:r,disabled:!Yl.value,children:i("config.reset")}),n(N,{variant:"primary",size:"sm",icon:cd,onClick:t,disabled:!Yc.value,children:Eo.value?i("config.saving"):i("config.save")}),n(G,{icon:n(Fe,{class:_n.value?"animate-spin":""}),onClick:Xf,disabled:_n.value,label:i("actions.refresh")})]})}),st.value&&n(Pn,{variant:"error",children:st.value}),_n.value&&!a&&n("div",{class:"flex items-center justify-center py-12",children:n(ee,{size:"lg"})}),!_n.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(re,{type:"text",placeholder:i("config.searchPlaceholder"),value:Vi.value,onInput:g=>{Vi.value=g.target.value},leftElement:n(Ke,{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:i(c?"config.noResults":"config.noFields")}):d.map(g=>n(Bv,{item:g,selectedPath:we,expandedNav:Rs},g.key))})]}),n("div",{class:"flex-1 bg-[var(--color-bg-surface)]",children:n(Zf,{selectedPath:we,schema:un,draftConfig:It,uiHints:Sr})})]})]})})]})}function Cl({theme:e,isSelected:t,onClick:r,size:a="md"}){const o=e.colors["--color-bg-primary"],l=e.colors["--color-accent"],s=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(va,{content:e.name,placement:"top",delay:200,children:n("button",{type:"button",onClick:r,class:`
|
|
404
|
-
relative ${s} rounded-xl border-2 transition-all
|
|
405
|
-
hover:scale-105
|
|
406
|
-
focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-2
|
|
407
|
-
${t?"border-[var(--color-accent)] ring-2 ring-[var(--color-accent)]":"border-[var(--color-border)] hover:border-[var(--color-text-muted)]"}
|
|
408
|
-
`,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(bn,{class:`${d} text-[var(--color-accent)]`,strokeWidth:3})})]})})}function Tl({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:i(t)}),r&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:["— ",r]})]})}function h_(){const e=xc(),t=tt.value,r=t.selected==="system",a=e.filter(h=>h.appearance==="light"),o=e.filter(h=>h.appearance==="dark"),l=t.lightTheme,s=t.darkTheme,c=t.selected!=="system"?t.selected:null,d=h=>{if(h)Wa("system");else{const f=window.matchMedia("(prefers-color-scheme: dark)").matches;Wa(f?s:l)}},u=(h,f)=>{r?f==="light"?_x(h):Sx(h):Wa(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(Mt,{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:i("settings.appearance.useSystemTheme")}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:i("settings.appearance.useSystemThemeDescription")})]})]}),n(Ve,{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(Tl,{icon:n(Vh,{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(Cl,{theme:h,isSelected:l===h.id,onClick:()=>u(h.id,"light")},h.id))})]}),n("div",{children:[n(Tl,{icon:n(Gh,{class:"w-4 h-4"}),titleKey:"settings.appearance.darkTheme",selectedThemeName:o.find(h=>h.id===s)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(Cl,{theme:h,isSelected:s===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(Tl,{icon:n(Vh,{class:"w-4 h-4"}),titleKey:"settings.appearance.lightThemes",selectedThemeName:a.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:a.map(h=>n(Cl,{theme:h,isSelected:c===h.id,onClick:()=>u(h.id,"light")},h.id))})]}),n("div",{children:[n(Tl,{icon:n(Gh,{class:"w-4 h-4"}),titleKey:"settings.appearance.darkThemes",selectedThemeName:o.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(Cl,{theme:h,isSelected:c===h.id,onClick:()=>u(h.id,"dark")},h.id))})]})]})]})}function f_(){Fb()}function p_(e=!0){Vy(),oy(),qr(),e&&f_(),Ge("/")}function qn({titleKey:e,children:t}){return n(V,{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:i(e)})}),n("div",{class:"p-3 sm:p-4",children:t})]})}function _r({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:i(e)}),n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:i(t)})]}),n("div",{class:"flex-shrink-0",children:a})]})}function Yi({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 m_(e){return n(at,{viewName:i("nav.settings"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(St,{title:i("nav.settings"),subtitle:i("settings.description")}),n(qn,{titleKey:"settings.appearance.title",children:n("div",{class:"space-y-6",children:[n(h_,{}),n(_r,{labelKey:"settings.appearance.fontSize",descriptionKey:"settings.appearance.fontSizeDescription",children:n(Ae,{value:bo.value,onChange:t=>{bo.value=t},options:o0.map(t=>({value:t.value,label:i(t.labelKey)})),size:"sm",width:"180px"})}),n(_r,{labelKey:"settings.appearance.fontFamily",descriptionKey:"settings.appearance.fontFamilyDescription",children:n(Ae,{value:xo.value,onChange:t=>{xo.value=t},options:l0.map(t=>({value:t.value,label:i(t.labelKey)})),size:"sm",width:"180px"})})]})}),n(qn,{titleKey:"settings.preferences.title",children:n("div",{class:"space-y-6",children:n(_r,{labelKey:"settings.preferences.timeFormat",descriptionKey:"settings.preferences.timeFormatDescription",children:n(Ae,{value:jr.value,onChange:t=>{jr.value=t},options:s0.map(t=>({value:t.value,label:i(t.labelKey)})),size:"sm",width:"180px"})})})}),n(qn,{titleKey:"settings.appMode.title",children:n(_r,{labelKey:"settings.appMode.multiChat",descriptionKey:"settings.appMode.multiChatDescription",children:n(Ve,{checked:gn.value==="multi",onChange:t=>{gn.value=t?"multi":"single"}})})}),Ys.value&&n(qn,{titleKey:"settings.newChat.title",children:n("div",{class:"space-y-6",children:[n(_r,{labelKey:"settings.newChat.useDefaults",descriptionKey:"settings.newChat.useDefaultsDescription",children:n(Ve,{checked:et.value.useDefaults,onChange:t=>{et.value={...et.value,useDefaults:t}}})}),n(_r,{labelKey:"settings.newChat.defaultAgent",descriptionKey:"settings.newChat.defaultAgentDescription",children:n(Ae,{value:et.value.defaultAgentId,onChange:t=>{et.value={...et.value,defaultAgentId:t}},options:Dc.value,size:"sm",width:"180px"})})]})}),n(qn,{titleKey:"settings.about.title",children:n("div",{class:"space-y-3",children:[n(Yi,{label:i("settings.about.cove"),value:`v${N0}`}),kt.value&&n(Yi,{label:i("settings.about.gateway"),value:fm(kt.value)}),Xt.value&&n(Yi,{label:i("settings.about.gatewayUrl"),value:Xt.value,truncate:!0})]})}),n(qn,{titleKey:"settings.data.title",children:n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("settings.data.resetDefaultsDescription")}),n(N,{variant:"secondary",onClick:()=>i0(),class:"flex-shrink-0",children:i("settings.data.resetDefaults")})]})}),D.value&&n(qn,{titleKey:"settings.account.title",children:n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[n("p",{class:"text-sm text-[var(--color-text-primary)]",children:i("settings.account.logoutDescription")}),n(N,{variant:"secondary",onClick:()=>p_(),class:"flex-shrink-0",children:i("actions.logout")})]})})]})})})}const Zc=v(null),Qc=v(null),eu=v(!1),Na=v(!1);function El(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function v_(e){return e==null?"—":`${Math.round(e)}%`}function g_(e){return e==null?"—":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}async function Qf(){if(D.value){eu.value=!0;try{const[e,t]=await Promise.all([F("status").catch(()=>null),F("health").catch(()=>null)]);Zc.value=e,Qc.value=t}catch{}finally{eu.value=!1}}}function Al({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 b_({name:e,label:t,data:r}){const a=r.linked?"success":r.configured?"warning":"default",o=r.linked?i("debug.linked"):r.configured?i("debug.configured"):i("debug.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 x_(){const e=D.value,t=Zc.value,r=Qc.value,a=t?.sessions?.recent?.[0];return O(()=>{e&&!Zc.value&&!Qc.value&&Qf()},[e]),n(V,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(R1,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:i("debug.snapshots")})]}),n(N,{variant:"ghost",size:"sm",onClick:Qf,disabled:!e,loading:eu.value,icon:n(Fe,{size:14}),children:i("actions.refresh")})]}),!t&&!r?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-6",children:i("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(In,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:i("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(Al,{label:i("debug.input"),value:El(a.inputTokens)}),n(Al,{label:i("debug.output"),value:El(a.outputTokens)}),n(Al,{label:i("debug.total"),value:El(a.totalTokens)}),n(Al,{label:i("debug.used"),value:v_(a.percentUsed),sub:`of ${El(a.contextTokens)}`})]})]}),r&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(Hm,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:i("debug.health")}),n(X,{variant:r.ok?"success":"error",size:"sm",children:r.ok?i("debug.healthy"):i("debug.unhealthy")}),r.durationMs!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",g_(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(b_,{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:i("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?i("debug.on"):i("debug.off")})]})]},o.agentId))})]}),n("button",{type:"button",onClick:()=>{Na.value=!Na.value},"aria-expanded":Na.value,class:"flex items-center gap-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[Na.value?n(nt,{size:12}):n(rt,{size:12}),i("debug.showRawJson")]}),Na.value&&n(Xo,{value:JSON.stringify({status:t,health:r},null,2),id:"snapshots-raw-json"})]})]})}const Xl=v("system-presence"),Mo=v("{}"),Qn=v(null),tu=v(!1),Is=v(null),rr=v(!0),nn=v([]);let Kv=0;const Gv=j(()=>{const e={};for(const t of nn.value)t.key.trim()&&(e[t.key.trim()]=t.value);return e});function y_(){if(rr.value){const t=Gv.value;return Object.keys(t).length>0?t:void 0}const e=Mo.value.trim();if(!(!e||e==="{}"))return JSON.parse(e)}function w_(){nn.value=[...nn.value,{id:`field_${++Kv}`,key:"",value:""}]}function k_(e){nn.value=nn.value.filter(t=>t.id!==e)}function ep(e,t){nn.value=nn.value.map(r=>r.id===e?{...r,...t}:r)}function __(){const e=Gv.value;Mo.value=Object.keys(e).length>0?JSON.stringify(e,null,2):"{}"}function S_(){try{const e=JSON.parse(Mo.value||"{}");typeof e=="object"&&e!==null&&!Array.isArray(e)&&(nn.value=Object.entries(e).map(([t,r])=>({id:`field_${++Kv}`,key:t,value:typeof r=="string"?r:JSON.stringify(r)})))}catch{}}function C_(){rr.value?__():S_(),rr.value=!rr.value}async function T_(){if(D.value){tu.value=!0,Is.value=null,Qn.value=null;try{const e=y_(),t=await F(Xl.value,e);Qn.value={ok:!0,data:t}}catch(e){Is.value=e instanceof Error?e.message:"RPC call failed",Qn.value={ok:!1,data:null}}finally{tu.value=!1}}}function E_(){const e=D.value;return n(V,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(Wm,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:i("debug.manualRpc")})]}),n(N,{variant:"ghost",size:"sm",onClick:C_,icon:rr.value?n(M1,{size:14}):n(j1,{size:14}),children:rr.value?i("debug.jsonMode"):i("debug.formMode")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:i("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:i("debug.method")}),n(re,{id:"rpc-method",value:Xl.value,onInput:t=>{Xl.value=t.target.value},placeholder:"e.g., system-presence, status, health",class:"font-mono",fullWidth:!0})]}),rr.value?n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:i("debug.params")}),n(N,{variant:"ghost",size:"sm",onClick:w_,icon:n(ir,{size:14}),children:i("debug.addParam")})]}),nn.value.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] py-3 text-center",children:i("debug.noParams")}):n("div",{class:"space-y-2",children:nn.value.map(t=>n("div",{class:"flex items-center gap-2",children:[n(re,{value:t.key,onInput:r=>ep(t.id,{key:r.target.value}),placeholder:"key",class:"font-mono flex-1"}),n(re,{value:t.value,onInput:r=>ep(t.id,{value:r.target.value}),placeholder:"value",class:"font-mono flex-1"}),n(G,{icon:n(Lt,{size:14}),size:"sm",variant:"ghost",label:i("actions.delete"),onClick:()=>k_(t.id)})]},t.id))})]}):n("div",{children:[n("label",{htmlFor:"rpc-params",class:"block text-sm font-medium mb-1",children:i("debug.paramsJson")}),n(Yr,{id:"rpc-params",value:Mo.value,onInput:t=>{Mo.value=t.target.value},placeholder:"{}",rows:4,class:"font-mono text-sm",fullWidth:!0})]}),n(N,{variant:"secondary",onClick:T_,disabled:!e||!Xl.value.trim(),loading:tu.value,icon:n(sd,{size:14}),children:i("debug.call")}),Is.value&&n("div",{class:"text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 p-3 rounded-lg",children:Is.value}),Qn.value&&n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:i("debug.result")}),n(X,{variant:Qn.value.ok?"success":"error",children:Qn.value.ok?i("debug.ok"):i("debug.error")})]}),n(Xo,{value:Uu(Qn.value.data),maxHeight:"max-h-64",id:"rpc-result"})]})]})]})}const Sn=v([]),A_=v(100),Zl=v(!1);let M_=0;const Ql=v(null),nu=v(new Set),Ht=v(null),Vv=v(0),R_=j(()=>{Vv.value;const e=Nu.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`}),I_=j(()=>{switch(Te.value){case"connected":return"success";case"connecting":case"authenticating":case"reconnecting":return"warning";default:return"error"}});function $_(e,t){if(Zl.value)return;const r={id:++M_,timestamp:Date.now(),event:e,payload:t};Sn.value=[r,...Sn.value].slice(0,A_.value)}function D_(){Sn.value=[]}function L_(e){const t=new Set(nu.value);t.has(e)?t.delete(e):t.add(e),nu.value=t}async function N_(e,t){try{await navigator.clipboard.writeText(e),Ql.value=t,setTimeout(()=>{Ql.value===t&&(Ql.value=null)},2e3)}catch{}}function Ne({icon:e,label:t,value:r,copyable:a,mono:o}){const l=r??"—",s=`${t}-${l}`,c=Ql.value===s;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(G,{icon:c?n(bn,{size:14}):n(ai,{size:14}),size:"sm",variant:"ghost",label:i("actions.copy"),onClick:()=>N_(r,s),class:"flex-shrink-0"})]})]})}function O_({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:()=>{Ht.value=e},"aria-label":i("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(rt,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0"})]})}function F_({entry:e,expanded:t,onToggle:r}){const a=e.payload!=null&&Object.keys(e.payload).length>0,o=Uu(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, ${i(a?"debug.clickToExpand":"debug.noPayload")}`,children:[a?t?n(nt,{size:14,class:"text-[var(--color-text-muted)]"}):n(rt,{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(Xo,{value:o,id:l})})]})}function P_(e){O(()=>Js(o=>{$_(o.event,o.payload)}),[]),O(()=>{const a=setInterval(()=>{Vv.value++},1e3);return()=>clearInterval(a)},[]);const t=D.value,r=Te.value;return n(at,{viewName:i("nav.debug"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(St,{title:i("nav.debug"),subtitle:i("debug.subtitle"),actions:n(X,{variant:I_.value,children:[t?n(ys,{size:14,class:"mr-1"}):n(Gm,{size:14,class:"mr-1"}),r]})}),n("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6",children:[n(V,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(ys,{size:18,class:t?"text-[var(--color-success)]":"text-[var(--color-error)]"}),n("h2",{class:"font-medium",children:i("debug.connection")})]}),n("div",{class:"space-y-0",children:[n(Ne,{icon:In,label:i("debug.state"),value:r}),n(Ne,{icon:rn,label:i("debug.url"),value:Xt.value,copyable:!0,mono:!0}),n(Ne,{icon:oi,label:i("debug.sessionKey"),value:Oe.value,copyable:!0,mono:!0}),n(Ne,{icon:Fe,label:i("debug.reconnectAttempts"),value:String($t.value)}),n(Ne,{icon:me,label:i("debug.connectedAt"),value:Ln.value?oe(Ln.value):null})]})]}),n(V,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(cr,{size:18,class:"text-[var(--color-primary)]"}),n("h2",{class:"font-medium",children:i("debug.server")})]}),n("div",{class:"space-y-0",children:[n(Ne,{icon:cr,label:i("debug.version"),value:kt.value}),n(Ne,{icon:Mt,label:i("debug.host"),value:fa.value}),n(Ne,{icon:Qt,label:i("debug.commit"),value:Uo.value?.slice(0,8),copyable:!0,mono:!0}),n(Ne,{icon:me,label:i("debug.uptime"),value:R_.value}),n(Ne,{icon:me,label:i("debug.tickInterval"),value:yo.value?`${yo.value}ms`:null})]})]}),n(V,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(bs,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:i("debug.paths")})]}),n("div",{class:"space-y-0",children:[n(Ne,{icon:Qt,label:i("debug.configPath"),value:qa.value,copyable:!0,mono:!0}),n(Ne,{icon:bs,label:i("debug.stateDir"),value:Ka.value,copyable:!0,mono:!0})]})]}),n(V,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(Mt,{size:18,class:"text-[var(--color-info)]"}),n("h2",{class:"font-medium",children:i("debug.client")})]}),n("div",{class:"space-y-0",children:[n(Ne,{icon:Mt,label:i("debug.appVersion"),value:"2026.2.6-3"}),n(Ne,{icon:Mt,label:i("debug.platform"),value:navigator.platform}),n(Ne,{icon:Mt,label:i("debug.userAgent"),value:navigator.userAgent.slice(0,60)+"..."}),n(Ne,{icon:An,label:i("debug.presenceCount"),value:String(Ho.value.length)})]})]})]}),n("div",{class:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6",children:[n(x_,{}),n(E_,{})]}),n(V,{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(In,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:i("debug.eventLog")}),n(X,{variant:"default",children:Sn.value.length})]}),n("div",{class:"flex items-center gap-2",children:[n(Ve,{checked:!Zl.value,onChange:a=>{Zl.value=!a},label:Zl.value?i("debug.paused"):i("debug.recording")}),n(N,{variant:"ghost",size:"sm",onClick:D_,disabled:Sn.value.length===0,icon:n(Lt,{size:14}),children:n("span",{class:"hidden sm:inline",children:i("debug.clear")})})]})]}),Sn.value.length===0?n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:[n(In,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:i("debug.noEvents")}),n("p",{class:"text-sm mt-1",children:i("debug.noEventsHint")})]}):n(K,{children:[n("div",{class:"md:hidden space-y-2 max-h-96 overflow-y-auto",children:Sn.value.map(a=>n(O_,{entry:a},a.id))}),n("div",{class:"hidden md:block max-h-96 overflow-y-auto border border-[var(--color-border)] rounded-lg",children:Sn.value.map(a=>n(F_,{entry:a,expanded:nu.value.has(a.id),onToggle:()=>L_(a.id)},a.id))})]})]}),n(Xe,{open:!!Ht.value,onClose:()=>{Ht.value=null},title:Ht.value?.event||"",children:Ht.value&&n("div",{class:"space-y-3",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:new Date(Ht.value.timestamp).toLocaleString()}),Ht.value.payload!=null&&Object.keys(Ht.value.payload).length>0?n(Xo,{value:Uu(Ht.value.payload),maxHeight:"max-h-[60vh]",id:`mobile-event-${Ht.value.id}`}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("debug.noPayload")})]})})]})})})}const Yv={debug:T1,info:Vo,warn:zn,error:ri},Jv={debug:"text-[var(--color-text-muted)]",info:"text-[var(--color-info)]",warn:"text-[var(--color-warning)]",error:"text-[var(--color-error)]"};function Xv(e){return e?e.split("T")[1]?.slice(0,12)||e.slice(0,12):null}function z_({line:e,expanded:t,onToggle:r}){const a=e.level?Yv[e.level]:void 0,o=e.level?Jv[e.level]:"text-[var(--color-text-muted)]",l=Xv(e.timestamp),s=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:!s,"aria-expanded":s?t:void 0,"aria-label":s?i("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:[s?n(rt,{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&&s&&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))})]})]})}let Zv=0;function Qv(){Zv=0}function eg(e,t=""){const r={};for(const[a,o]of Object.entries(e)){if(/^\d+$/.test(a))continue;const l=t?`${t}.${a}`:a;o!=null&&(Array.isArray(o)?r[l]=JSON.stringify(o):typeof o=="object"?Object.assign(r,eg(o,l)):typeof o=="string"?r[l]=o:r[l]=JSON.stringify(o))}return r}const tp=["time","timestamp","ts","level","lvl","pid","hostname","v","msg","message"];function np(e){const t=++Zv;let r,a,o=e,l;if(e.startsWith("{"))try{const s=JSON.parse(e);r=s.time||s.timestamp||s.ts;const c=(s.level||s.lvl||"")?.toLowerCase();["debug","info","warn","warning","error","err"].includes(c)&&(a=c==="warning"?"warn":c==="err"?"error":c);const d=Object.keys(s).find(h=>/^\d+$/.test(h));if(s.msg||s.message)o=s.msg||s.message;else if(s.error&&typeof s.error=="string")o=s.error;else if(d&&typeof s[d]=="string")o=s[d];else{const h=[];for(const[f,p]of Object.entries(s))tp.includes(f)||(typeof p=="string"?h.push(`${f}=${p}`):p!=null&&h.push(`${f}=${JSON.stringify(p)}`));o=h.length>0?h.join(" "):e}const u={};for(const[h,f]of Object.entries(s))!tp.includes(h)&&!/^\d+$/.test(h)&&(u[h]=f);Object.keys(u).length>0&&(l=eg(u))}catch{}if(!r){const s=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z)\s+\[([^\]]+)\]\s*(.*)$/);if(s){r=s[1],o=`[${s[2]}] ${s[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 s=e.match(/^\[([^\]]+)\]\s*(DEBUG|INFO|WARN|ERROR):?\s*(.*)$/i);s&&(r=s[1],a=s[2].toLowerCase(),o=s[3])}if(!r){const s=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:]+Z)\s+(ERR|INF|WRN|DBG)\s+(.*)$/);if(s){r=s[1];const c=s[2];a=c==="ERR"?"error":c==="WRN"?"warn":c==="DBG"?"debug":"info",o=s[3]}}if(!a&&!r){const s=e.match(/^(DEBUG|INFO|WARN|ERROR):?\s+(.*)$/i);s&&(a=s[1].toLowerCase(),o=s[2])}if(!a){const s=e.toLowerCase();s.includes("error")||s.includes("failed")||s.includes("exception")||s.includes("✗")?a="error":s.includes("warn")||s.includes("deprecated")?a="warn":(s.includes("debug")||s.includes("trace"))&&(a="debug")}return{id:t,raw:e,timestamp:r,level:a,message:o,fields:l}}const it=v([]),ru=v(0),au=v(""),Ar=v(!1),$s=v(null),Oa=v(!0),ou=v(""),Kt=v(new Set),lu=v(new Set),He=v(null);async function Ji(e=!1){if(D.value){Ar.value=!0,$s.value=null;try{const t=await F("logs.tail",{cursor:e?void 0:ru.value||void 0,limit:500,maxBytes:25e4});if(t)if(au.value=t.file,ru.value=t.cursor,t.reset||e)Qv(),it.value=t.lines.map(np);else{const r=t.lines.map(np);r.length>0&&(it.value=[...it.value,...r].slice(-2e3))}}catch(t){$s.value=t instanceof Error?t.message:i("logs.fetchError")}finally{Ar.value=!1}}}function rp(){it.value=[],ru.value=0,Qv()}function ap(){const e=it.value.map(o=>o.raw).join(`
|
|
409
|
-
`),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 Ml(e){const t=new Set(Kt.value);t.has(e)?t.delete(e):t.add(e),Kt.value=t}function U_(){Kt.value=new Set}function H_(e){const t=new Set(lu.value);t.has(e)?t.delete(e):t.add(e),lu.value=t}const op=j(()=>{let e=it.value;const t=Kt.value;t.size>0&&(e=e.filter(a=>a.level&&t.has(a.level)));const r=ou.value.toLowerCase().trim();return r&&(e=e.filter(a=>a.raw.toLowerCase().includes(r))),e}),B_=j(()=>{const e={debug:0,info:0,warn:0,error:0};for(const t of it.value)t.level&&t.level in e&&e[t.level]++;return e}),j_={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)]"}},lp={debug:"logs.debug",info:"logs.info",warn:"logs.warnings",error:"logs.errors"};function Rl({level:e,count:t,selected:r,onClick:a}){const o=j_[e];return n("button",{type:"button",onClick:a,"aria-label":i("logs.filterByLevel",{level:i(lp[e])}),"aria-pressed":r,class:`px-3 py-1 text-sm rounded-full transition-colors ${r?o.active:o.inactive}`,children:[i(lp[e])," (",t,")"]})}function W_({line:e}){const t=e.level?Yv[e.level]:Vo,r=e.level?Jv[e.level]:"text-[var(--color-text-muted)]",a=e.fields&&Object.keys(e.fields).length>0,o=Xv(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:()=>{He.value=e},"aria-label":i("logs.viewLogDetails"),children:[n(t,{size:16,class:`mt-0.5 flex-shrink-0 ${r}`}),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:[o&&n("span",{class:"text-xs text-[var(--color-text-muted)] font-mono",children:o}),a&&n(X,{variant:"default",class:"text-xs",children:[Object.keys(e.fields).length," ",i("logs.fields")]})]})]}),n(rt,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0 mt-0.5"})]})}function q_(e){const t=W(null),r=W(null),a=W(!0),o=W(!0);O(()=>{D.value&&Ji(!0)},[D.value]),O(()=>{if(!Oa.value||!D.value)return;const u=setInterval(()=>Ji(),2e3);return()=>clearInterval(u)},[Oa.value,D.value]),O(()=>{a.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight),o.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[op.value.length]);const l=()=>{if(!t.current)return;const{scrollTop:u,scrollHeight:h,clientHeight:f}=t.current;a.current=h-u-f<50},s=()=>{if(!r.current)return;const{scrollTop:u,scrollHeight:h,clientHeight:f}=r.current;o.current=h-u-f<50},c=op.value,d=B_.value;return n(at,{viewName:i("nav.logs"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden p-4 sm:p-6",children:n("div",{class:"max-w-6xl mx-auto w-full flex flex-col flex-1 min-h-0 space-y-4 sm:space-y-6",children:[n(St,{title:i("logs.title"),subtitle:i("logs.description"),actions:n("div",{class:"flex items-center gap-2",children:[n(Ve,{checked:Oa.value,onChange:u=>Oa.value=u,label:Oa.value?i("logs.live"):i("logs.paused")}),n(G,{icon:n(Fe,{size:16,class:Ar.value?"animate-spin":""}),onClick:()=>Ji(!0),disabled:Ar.value,label:i("actions.refresh")})]})}),n(re,{type:"text",value:ou.value,onInput:u=>ou.value=u.target.value,placeholder:i("logs.searchPlaceholder"),"aria-label":i("logs.searchPlaceholder"),leftElement:n(Ke,{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":i("logs.filterByLevel",{level:""}),children:[n("button",{type:"button",onClick:U_,"aria-pressed":Kt.value.size===0,class:`px-3 py-1 text-sm rounded-full transition-colors whitespace-nowrap ${Kt.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:[i("logs.all")," (",it.value.length,")"]}),n(Rl,{level:"debug",count:d.debug,selected:Kt.value.has("debug"),onClick:()=>Ml("debug")}),n(Rl,{level:"info",count:d.info,selected:Kt.value.has("info"),onClick:()=>Ml("info")}),n(Rl,{level:"warn",count:d.warn,selected:Kt.value.has("warn"),onClick:()=>Ml("warn")}),n(Rl,{level:"error",count:d.error,selected:Kt.value.has("error"),onClick:()=>Ml("error")})]}),n("div",{class:"flex items-center gap-2",children:[au.value&&n("span",{class:"hidden sm:flex text-xs text-[var(--color-text-muted)] items-center gap-1",children:[n(Qt,{size:12}),au.value.split("/").pop()]}),n("div",{class:"hidden sm:flex items-center gap-2",children:[n(N,{variant:"ghost",size:"sm",onClick:ap,icon:n(Dt,{size:14}),children:i("logs.download")}),n(N,{variant:"ghost",size:"sm",onClick:rp,disabled:it.value.length===0,icon:n(Lt,{size:14}),children:i("logs.clear")})]}),n("div",{class:"flex sm:hidden items-center gap-1",children:[n(G,{icon:n(Dt,{size:16}),onClick:ap,label:i("logs.download"),size:"sm"}),n(G,{icon:n(Lt,{size:16}),onClick:rp,disabled:it.value.length===0,label:i("logs.clear"),size:"sm"})]})]})]}),$s.value&&n("div",{class:"p-4 rounded-lg bg-[var(--color-error)]/10 text-[var(--color-error)] text-sm",role:"alert",children:$s.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:[Ar.value&&it.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(ee,{size:"lg"})}),!Ar.value&&it.value.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(Qt,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:i("logs.noLogs")}),n("p",{class:"text-sm mt-1",children:i("logs.noLogsHint")})]}),it.value.length>0&&c.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(Ke,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:i("logs.noMatches")})]}),c.length>0&&n(K,{children:[n("div",{ref:r,class:"md:hidden flex-1 overflow-y-auto p-3 space-y-2",onScroll:s,role:"log","aria-live":"polite",children:c.map(u=>n(W_,{line:u},u.id))}),n("div",{ref:t,class:"hidden md:flex md:flex-col flex-1 overflow-y-auto",onScroll:l,role:"log","aria-live":"polite",children:c.map(u=>n(z_,{line:u,expanded:lu.value.has(u.id),onToggle:()=>H_(u.id)},u.id))})]})]}),n(Xe,{open:!!He.value,onClose:()=>{He.value=null},title:i("logs.logDetails"),children:He.value&&n("div",{class:"space-y-4",children:[n("div",{class:"flex items-center gap-2",children:[He.value.level&&n(X,{variant:He.value.level==="error"?"error":He.value.level==="warn"?"warning":"default",children:He.value.level}),He.value.timestamp&&n("span",{class:"text-sm text-[var(--color-text-muted)] font-mono",children:He.value.timestamp})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:i("logs.message")}),n("p",{class:"text-sm text-[var(--color-text-primary)] whitespace-pre-wrap break-words",children:He.value.message})]}),He.value.fields&&Object.keys(He.value.fields).length>0&&n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-2",children:i("logs.fields")}),n("div",{class:"space-y-2 bg-[var(--color-bg-tertiary)] rounded-lg p-3",children:Object.entries(He.value.fields).map(([u,h])=>n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:u}),n("span",{class:"text-[var(--color-text-muted)] mx-1",children:"="}),n("span",{class:"text-[var(--color-text-secondary)] break-all",children:h})]},u))})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:i("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:He.value.raw})]})]})})]})})})}function $d(e){return e.role?e.role:e.roles&&e.roles.length>0?e.roles[0]:"unknown"}function tg(e){return!!(e.role==="node"||e.roles?.includes("node"))}function ng(e){return!!(e.role==="operator"||e.roles?.includes("operator"))}function Dd(e){switch(e){case"operator":return"info";case"node":return"success";default:return"default"}}function rg(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 sa(e){return e.length<=20?e:`${e.slice(0,10)}...${e.slice(-6)}`}function K_({device:e,onSelect:t}){const r=$d(e),a=e.tokens?.length??0,o=e.platform?.includes("ios")||e.platform?.includes("android")?Gr:Mt;return n(ya,{icon:o,iconVariant:r==="operator"?"info":"success",title:e.displayName||sa(e.deviceId),subtitle:e.platform||void 0,badges:n(X,{variant:Dd(r),children:r}),meta:[...a>0?[{icon:oi,value:`${a}`}]:[],{icon:me,value:oe(e.approvedAtMs,{relative:!0})}],onClick:()=>t(e)})}function Il({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function G_({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?i("devices.tokenRevoked"):i("devices.tokenActive")})]}),n("div",{class:"flex gap-1",children:n(G,{icon:n(si,{class:"w-4 h-4"}),label:i("devices.rotateToken"),onClick:t,size:"sm"})})]})}function ag({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(Il,{label:i("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(Il,{label:i("devices.clientId"),children:e.clientId}),e.scopes&&e.scopes.length>0&&n(Il,{label:i("devices.scopes"),children:n("span",{class:"text-xs",children:e.scopes.join(", ")})}),n(Il,{label:i("devices.approved"),children:oe(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(ii,{class:"w-4 h-4"}),i("devices.tokens")]}),a.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("devices.noTokens")}):n("div",{class:"space-y-2",children:a.map(l=>n(G_,{token:l,onRotate:()=>r?.(e)},l.role))})]})]})})}function V_({device:e,isExpanded:t,onToggleExpand:r,onOpenTokenModal:a}){const o=$d(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":i("devices.toggleDetails",{name:e.displayName||sa(e.deviceId)}),children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(nt,{class:"w-4 h-4"}):n(rt,{class:"w-4 h-4"})}),n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:rg(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||sa(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:Dd(o),children:o}),l>0&&n("div",{class:"flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(oi,{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(me,{class:"w-4 h-4"}),n("span",{children:oe(e.approvedAtMs)})]})]}),t&&n(ag,{device:e,onOpenTokenModal:a})]})}const Pr=v([]),Ld=v([]),Mr=v(!1),Qa=v(null),su=v(""),jt=v("all"),iu=v(new Set),ar=v(null),sn=v(null),cu=v(!1),Y_=[{value:"all",label:()=>i("devices.filters.allRoles")},{value:"operator",label:()=>i("devices.filters.operators")},{value:"node",label:()=>i("devices.filters.nodes")}],J_=j(()=>{const e=Pr.value,t=e.filter(ng).length,r=e.filter(tg).length,a=Ld.value.length;return{total:e.length,operators:t,nodes:r,pending:a}}),X_=j(()=>{let e=Pr.value;jt.value==="operator"?e=e.filter(ng):jt.value==="node"&&(e=e.filter(tg));const t=su.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 ia(){Mr.value=!0,Qa.value=null;try{const e=await F("device.pair.list",{});Pr.value=e.paired,Ld.value=e.pending}catch(e){Qa.value=ce(e)}finally{Mr.value=!1}}async function Z_(e){try{await F("device.pair.approve",{requestId:e}),ie.success(i("devices.approveSuccess")),await ia()}catch(t){ie.error(ce(t))}}async function Q_(e){try{await F("device.pair.reject",{requestId:e}),ie.success(i("devices.rejectSuccess")),await ia()}catch(t){ie.error(ce(t))}}async function e5(e,t){cu.value=!0;try{const r=await F("device.token.rotate",{deviceId:e.deviceId,role:t});ie.success(i("devices.tokenRotated")),await navigator.clipboard.writeText(r.token),ie.success(i("devices.tokenCopied")),ar.value=null,await ia()}catch(r){ie.error(ce(r))}finally{cu.value=!1}}async function t5(e,t){try{await F("device.token.revoke",{deviceId:e.deviceId,role:t}),ie.success(i("devices.tokenRevoked")),ar.value=null,await ia()}catch(r){ie.error(ce(r))}}function n5(e){const t=new Set(iu.value);t.has(e)?t.delete(e):t.add(e),iu.value=t}function r5({request:e}){const t=$d(e);return n(V,{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:rg(e.platform)}),n("div",{children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"font-medium",children:e.displayName||sa(e.deviceId)}),n(X,{variant:Dd(t),children:t}),e.isRepair&&n(X,{variant:"warning",children:i("devices.repair")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:[e.platform,e.remoteIp&&` • ${e.remoteIp}`," • ",oe(e.ts)]})]})]}),n("div",{class:"flex gap-2 self-end sm:self-start",children:[n(N,{variant:"primary",size:"sm",icon:bn,onClick:()=>Z_(e.requestId),children:i("devices.approve")}),n(N,{variant:"danger",size:"sm",icon:ma,onClick:()=>Q_(e.requestId),children:i("devices.reject")})]})]})})}function a5({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:[i("devices.tokenCreated"),": ",oe(e.createdAtMs),e.rotatedAtMs&&n(K,{children:[" ","• ",i("devices.tokenRotatedAt"),": ",oe(e.rotatedAtMs)]})]})]}),n("div",{class:"flex gap-2",children:[n(N,{variant:"secondary",size:"sm",icon:si,onClick:()=>e5(t,e.role),disabled:r,children:i("devices.rotate")}),n(N,{variant:"danger",size:"sm",icon:Lt,onClick:()=>t5(t,e.role),children:i("devices.revoke")})]})]})}function o5(){const e=ar.value;if(!e)return null;const t=e.tokens??[];return n(Xe,{open:!0,onClose:()=>{ar.value=null},title:i("devices.tokenManagement"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("devices.tokenManagementDesc",{name:e.displayName||sa(e.deviceId)})}),t.length===0?n("p",{class:"text-sm",children:i("devices.noTokens")}):n("div",{class:"space-y-3",children:t.map(r=>n(a5,{token:r,device:e,disabled:cu.value},r.role))})]}),n("div",{class:"mt-6 flex justify-end",children:n(N,{variant:"secondary",onClick:()=>{ar.value=null},children:i("actions.close")})})]})}function l5(){return n("div",{class:"text-center py-12",children:[n(Gr,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:i("devices.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("devices.emptyDescription")})]})}function s5(e){O(()=>{D.value&&ia()},[D.value]);const t=X_.value,r=J_.value,a=Ld.value;return n(at,{viewName:i("nav.devices"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(St,{title:i("devices.title"),subtitle:i("devices.description"),actions:n(G,{icon:n(Fe,{class:Mr.value?"animate-spin":""}),onClick:ia,disabled:Mr.value,label:i("actions.refresh")})}),Qa.value&&n(Pn,{variant:"error",children:Qa.value}),Mr.value&&Pr.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(ee,{size:"lg"})}),!Mr.value&&!Qa.value&&n(K,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(pe,{icon:Gr,label:i("devices.stats.total"),value:r.total,active:jt.value==="all",onClick:()=>{jt.value="all"}}),n(pe,{icon:en,label:i("devices.stats.operators"),value:r.operators,active:jt.value==="operator",onClick:()=>{jt.value="operator"}}),n(pe,{icon:Mt,label:i("devices.stats.nodes"),value:r.nodes,active:jt.value==="node",onClick:()=>{jt.value="node"}}),n(pe,{icon:me,label:i("devices.stats.pending"),value:r.pending,highlight:r.pending>0})]}),a.length>0&&n("div",{class:"space-y-3",children:[n("h2",{class:"text-lg font-semibold",children:i("devices.pendingRequests")}),a.map(o=>n(r5,{request:o},o.requestId))]}),Pr.value.length>0&&n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(re,{type:"text",placeholder:i("devices.searchPlaceholder"),value:su.value,onInput:o=>{su.value=o.target.value},leftElement:n(Ke,{class:"w-4 h-4"}),class:"flex-1"}),n(Ae,{value:jt.value,onChange:o=>{jt.value=o},options:Y_.map(o=>({value:o.value,label:o.label()})),size:"sm",align:"right","aria-label":i("devices.filters.allRoles")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:t.length!==r.total?i("devices.filteredCount",{filtered:t.length,total:r.total}):i("devices.count",{count:r.total})})]}),Pr.value.length>0?t.length===0?n(V,{padding:"none",children:n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:i("devices.noResults")})}):n(K,{children:[n("div",{class:"md:hidden space-y-2",children:t.map(o=>n(K_,{device:o,onSelect:l=>{sn.value=l}},o.deviceId))}),n(V,{padding:"none",class:"hidden md:block overflow-hidden",children:t.map(o=>n(V_,{device:o,isExpanded:iu.value.has(o.deviceId),onToggleExpand:()=>n5(o.deviceId),onOpenTokenModal:l=>{ar.value=l}},o.deviceId))})]}):n(l5,{})]}),n(Xe,{open:!!sn.value,onClose:()=>{sn.value=null},title:sn.value?.displayName||(sn.value?sa(sn.value.deviceId):""),children:sn.value&&n(ag,{device:sn.value,bare:!0,onOpenTokenModal:o=>{sn.value=null,ar.value=o}})}),n(o5,{})]})})})}function mi(e){return e.disabled?"disabled":e.blockedByAllowlist?"blocked":e.eligible?"eligible":"missing-reqs"}function i5(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 c5(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 og="https://clawhub.ai/api/v1";async function u5(e){const t=new URLSearchParams;t.set("limit",String(e.limit)),e?.cursor&&t.set("cursor",e.cursor);const r=`${og}/skills${t.toString()?`?${t}`:""}`,a=await fetch(r);if(!a.ok)throw new Error(`ClawHub API error: ${a.status}`);return a.json()}async function d5(e,t){const r=new URLSearchParams({q:e});r.set("limit",String(t.limit));const a=`${og}/search?${r}`,o=await fetch(a);if(!o.ok)throw new Error(`ClawHub API error: ${o.status}`);return o.json()}const Cn=v([]),qt=v(!1),eo=v(null),Ds=v(""),Ls=v(void 0),to=v(null),no=v(!1);async function es(e=!1){if(!qt.value){qt.value=!0,eo.value=null;try{const t=e?Ls.value:void 0,r=Ds.value?await d5(Ds.value,{limit:20}):await u5({limit:20,cursor:t});e?Cn.value=[...Cn.value,...r.items]:Cn.value=r.items,Ls.value=r.nextCursor}catch(t){eo.value=ce(t)}finally{qt.value=!1}}}async function sp(){Ls.value=void 0,await es()}async function h5(e){no.value=!0;try{ie.error(i("skills.clawhub.notYetSupported",{slug:e.slug})),to.value=null}catch(t){ie.error(ce(t))}finally{no.value=!1}}function f5({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n(V,{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("div",{class:"flex-1 min-w-0",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||i("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(Dt,{class:"w-3 h-3"}),e.stats.downloads]}),n("span",{class:"flex items-center gap-1",children:[n(qm,{class:"w-3 h-3"}),e.stats.stars]}),n("span",{class:"flex items-center gap-1",children:[n(Wo,{class:"w-3 h-3"}),oe(e.updatedAt)]})]})]}),n(N,{variant:"secondary",size:"sm",icon:Dt,onClick:()=>{to.value=e},class:"self-start sm:flex-shrink-0",children:i("skills.clawhub.install")})]})})}function p5(){const e=to.value;if(!e)return null;const t=e.tags?.latest||e.latestVersion?.version||"?",r=e.latestVersion?.changelog;return n(Xe,{open:!0,onClose:()=>{to.value=null},title:i("skills.clawhub.installTitle",{name:e.displayName}),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("skills.clawhub.installConfirm",{name:e.displayName,version:t})}),e.summary&&n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-sm",children:e.summary}),r&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-2",children:i("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",children:r})]}),n("div",{class:"flex items-center gap-4 text-sm text-[var(--color-text-muted)]",children:[n("span",{class:"flex items-center gap-1",children:[n(Dt,{class:"w-4 h-4"}),e.stats.downloads," ",i("skills.clawhub.downloads")]}),n("span",{class:"flex items-center gap-1",children:[n(qm,{class:"w-4 h-4"}),e.stats.stars," ",i("skills.clawhub.stars")]})]}),n("a",{href:`https://clawhub.ai/skills/${e.slug}`,target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 text-sm text-[var(--color-accent)] hover:underline",children:[i("skills.clawhub.viewOnClawhub"),n(Go,{class:"w-3 h-3"})]})]}),n("div",{class:"mt-6 flex justify-end gap-3",children:[n(N,{variant:"secondary",onClick:()=>{to.value=null},disabled:no.value,children:i("actions.cancel")}),n(N,{variant:"primary",icon:Dt,onClick:()=>h5(e),disabled:no.value,children:no.value?i("skills.clawhub.installing"):i("skills.clawhub.install")})]})]})}function m5(){return n("div",{class:"text-center py-12",children:[n(en,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:i("skills.clawhub.noResults")}),n("p",{class:"text-[var(--color-text-muted)]",children:i("skills.clawhub.tryDifferentSearch")})]})}function v5(){O(()=>{es()},[]);const e=!!Ls.value;return n("div",{class:"space-y-6",children:[n("div",{class:"flex items-center gap-2 sm:gap-4",children:[n("div",{class:"flex-1 min-w-0",children:n(re,{type:"text",placeholder:i("skills.clawhub.searchPlaceholder"),value:Ds.value,onInput:t=>{Ds.value=t.target.value},onKeyDown:t=>{t.key==="Enter"&&sp()},leftElement:n(Ke,{class:"w-4 h-4"})})}),n(N,{variant:"secondary",onClick:sp,disabled:qt.value,class:"flex-shrink-0",children:[n("span",{class:"hidden sm:inline",children:i("actions.search")}),n(Ke,{class:"w-4 h-4 sm:hidden"})]}),n(G,{icon:n(Fe,{class:qt.value?"animate-spin":""}),label:i("actions.refresh"),onClick:()=>es(),disabled:qt.value})]}),eo.value&&n(Pn,{variant:"error",children:eo.value}),qt.value&&Cn.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(ee,{size:"lg"})}),Cn.value.length>0&&n("div",{class:"grid gap-4",children:Cn.value.map(t=>n(f5,{skill:t},t.slug))}),!qt.value&&!eo.value&&Cn.value.length===0&&n(m5,{}),e&&!qt.value&&n("div",{class:"flex justify-center",children:n(N,{variant:"secondary",onClick:()=>es(!0),children:i("actions.showMore")})}),qt.value&&Cn.value.length>0&&n("div",{class:"flex justify-center py-4",children:n(ee,{size:"md"})}),n(p5,{})]})}const $l=v(!1);function g5({skill:e,onClose:t,onSuccess:r}){if(!e)return null;const a=async o=>{$l.value=!0;try{const l=await F("skills.install",{name:e.name,installId:o,timeoutMs:6e4});l.ok?(ie.success(i("skills.installSuccess",{name:e.name})),t(),r()):ie.error(l.message||i("skills.installFailed"))}catch(l){ie.error(ce(l))}finally{$l.value=!1}};return n(Xe,{open:!0,onClose:t,title:i("skills.installTitle",{name:e.name}),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("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:$l.value,children:[n(Dt,{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:[i("skills.providesBins"),": ",o.bins.join(", ")]})]}),$l.value&&n(ee,{size:"sm"})]},o.id))})]}),n("div",{class:"mt-6 flex justify-end",children:n(N,{variant:"secondary",onClick:t,children:i("actions.cancel")})})]})}function ip({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function lg({skill:e,onInstall:t,bare:r=!1}){const a=c5(e),o=e.install.length>0&&i5(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(ip,{label:i("skills.skillKey"),children:n("code",{class:"text-xs bg-[var(--color-bg-primary)] px-1 py-0.5 rounded",children:e.skillKey})}),n(ip,{label:i("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:[i("skills.homepage"),n(Go,{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:[i("skills.missingRequirements"),":"]}),n("ul",{class:"list-disc list-inside text-xs mt-1 space-y-0.5",children:a.map(s=>n("li",{children:s},s))})]}),e.blockedByAllowlist&&n("div",{class:"flex items-center gap-2 text-[var(--color-error)]",children:[n(W1,{class:"w-4 h-4"}),n("span",{children:i("skills.blockedByAllowlist")})]}),o&&n("div",{class:"pt-2",children:n(N,{variant:"secondary",size:"sm",icon:Dt,onClick:()=>t(e),children:i("skills.installDeps")})}),e.primaryEnv&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[i("skills.primaryEnv"),": ",n("code",{children:e.primaryEnv})]})]})]})]})}const b5={"openclaw-bundled":z1,"openclaw-managed":I1,"openclaw-workspace":bs,"openclaw-extra":bs},x5={"openclaw-bundled":"skills.source.bundled","openclaw-managed":"skills.source.managed","openclaw-workspace":"skills.source.workspace","openclaw-extra":"skills.source.extra"};function sg(e){const t={eligible:{variant:"success",key:"skills.status.eligible"},disabled:{variant:"default",key:"skills.status.disabled"},"missing-reqs":{variant:"warning",key:"skills.status.missingReqs"},blocked:{variant:"error",key:"skills.status.blocked"}},{variant:r,key:a}=t[e];return{variant:r,label:i(a)}}function ig(e){return b5[e]||id}function cg(e){const t=x5[e];return t?i(t):e}function y5({skill:e,onToggleExpand:t,onToggleEnabled:r}){const a=mi(e),o=sg(a),l=ig(e.source);return n(ya,{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(K,{children:[n(X,{variant:o.variant,size:"sm",children:o.label}),e.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:i("skills.alwaysActive"),children:"⚡"})]}),meta:[{icon:l,value:cg(e.source)}],actions:n("div",{onClick:s=>s.stopPropagation(),onKeyDown:s=>s.stopPropagation(),role:"presentation",children:n(Ve,{checked:!e.disabled,onChange:r,size:"sm","aria-label":e.disabled?i("skills.enable"):i("skills.disable")})}),onClick:t})}function w5({skill:e,isExpanded:t,onToggleExpand:r,onToggleEnabled:a,onInstall:o}){const l=mi(e),s=sg(l),c=ig(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(nt,{class:"w-4 h-4"}):n(rt,{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:i("skills.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:cg(e.source)})]}),n("div",{class:"w-24 flex justify-end",children:n(X,{variant:s.variant,children:s.label})}),n("div",{onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),role:"presentation",children:n(Ve,{checked:!e.disabled,onChange:a,size:"sm","aria-label":e.disabled?i("skills.enable"):i("skills.disable")})})]}),t&&n(lg,{skill:e,onInstall:o})]})}const k5=[{value:"all",label:()=>i("skills.filters.allSources")},{value:"openclaw-bundled",label:()=>i("skills.source.bundled")},{value:"openclaw-workspace",label:()=>i("skills.source.workspace")},{value:"openclaw-managed",label:()=>i("skills.source.managed")},{value:"openclaw-extra",label:()=>i("skills.source.extra")}],uu=v("installed"),ca=v([]),du=v(""),ug=v(""),Rr=v(!1),ro=v(null),ao=v(""),zr=v("all"),bt=v("all"),hu=v(new Set),Dl=v(null),Kn=v(null),_5=j(()=>{const e=ca.value;let t=0,r=0,a=0;for(const o of e){const l=mi(o);l==="eligible"?t++:l==="disabled"?r++:l==="missing-reqs"&&a++}return{total:e.length,eligible:t,disabled:r,missingReqs:a}}),S5=j(()=>{let e=ca.value;const t=ao.value.toLowerCase().trim();return t&&(e=e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.skillKey.toLowerCase().includes(t))),zr.value!=="all"&&(e=e.filter(r=>r.source===zr.value)),bt.value!=="all"&&(e=e.filter(r=>mi(r)===bt.value)),e});async function Xi(){Rr.value=!0,ro.value=null;try{const e=await F("skills.status",{});ca.value=e.skills,du.value=e.workspaceDir,ug.value=e.managedSkillsDir}catch(e){ro.value=ce(e)}finally{Rr.value=!1}}async function cp(e){const t=e.disabled;try{await F("skills.update",{skillKey:e.skillKey,enabled:t}),ca.value=ca.value.map(r=>r.skillKey===e.skillKey?{...r,disabled:!t}:r),ie.success(t?i("skills.enabledSuccess",{name:e.name}):i("skills.disabledSuccess",{name:e.name}))}catch(r){ie.error(ce(r))}}function C5(e){const t=new Set(hu.value);t.has(e)?t.delete(e):t.add(e),hu.value=t}function T5(){ao.value="",zr.value="all",bt.value="all"}function up({tab:e,label:t,active:r}){return n("button",{type:"button",role:"tab","aria-selected":r,onClick:()=>{uu.value=e},class:`px-4 py-2 text-sm font-medium rounded-lg transition-colors ${r?"bg-[var(--color-accent)] text-white":"text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-tertiary)]"}`,children:t})}function E5({hasFilters:e}){return n("div",{class:"text-center py-12",children:[n(Ke,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:i(e?"skills.noResults":"skills.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i(e?"skills.noResultsDescription":"skills.emptyDescription")}),e&&n("button",{type:"button",onClick:T5,class:"text-[var(--color-accent)] hover:underline",children:i("skills.clearFilters")})]})}function A5(e){O(()=>{D.value&&uu.value==="installed"&&Xi()},[D.value]);const t=S5.value,r=_5.value,a=uu.value,o=!!ao.value||zr.value!=="all"||bt.value!=="all";return n(at,{viewName:i("nav.skills"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(St,{title:i("skills.title"),subtitle:i("skills.description"),actions:a==="installed"?n(G,{icon:n(Fe,{class:Rr.value?"animate-spin":""}),onClick:Xi,disabled:Rr.value,label:i("actions.refresh")}):void 0}),n("div",{class:"flex gap-2",role:"tablist",children:[n(up,{tab:"installed",label:i("skills.tabs.installed"),active:a==="installed"}),n(up,{tab:"clawhub",label:i("skills.tabs.clawhub"),active:a==="clawhub"})]}),a==="clawhub"&&n(v5,{}),a==="installed"&&n(K,{children:[ro.value&&n(Pn,{variant:"error",children:ro.value}),Rr.value&&ca.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(ee,{size:"lg"})}),!Rr.value&&!ro.value&&n(K,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(pe,{icon:id,label:i("skills.stats.total"),value:r.total,active:bt.value==="all",onClick:()=>{bt.value="all"}}),n(pe,{icon:qo,label:i("skills.stats.eligible"),value:r.eligible,active:bt.value==="eligible",onClick:()=>{bt.value="eligible"}}),n(pe,{icon:Ko,label:i("skills.stats.disabled"),value:r.disabled,active:bt.value==="disabled",onClick:()=>{bt.value="disabled"}}),n(pe,{icon:zn,label:i("skills.stats.missingReqs"),value:r.missingReqs,active:bt.value==="missing-reqs",highlight:r.missingReqs>0,onClick:()=>{bt.value="missing-reqs"}})]}),n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(re,{type:"text",placeholder:i("skills.searchPlaceholder"),value:ao.value,onInput:l=>{ao.value=l.target.value},leftElement:n(Ke,{class:"w-4 h-4"}),class:"flex-1"}),n(Ae,{value:zr.value,onChange:l=>{zr.value=l},options:k5.map(l=>({value:l.value,label:l.label()})),size:"sm",align:"right","aria-label":i("skills.filters.allSources")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:t.length!==r.total?i("skills.filteredCount",{filtered:t.length,total:r.total}):i("skills.count",{count:r.total})})]}),t.length===0?n(V,{padding:"none",children:n(E5,{hasFilters:o})}):n(K,{children:[n("div",{class:"md:hidden space-y-2",children:t.map(l=>n(y5,{skill:l,onToggleExpand:()=>{Kn.value=l},onToggleEnabled:()=>cp(l)},l.skillKey))}),n(V,{padding:"none",class:"hidden md:block overflow-hidden",children:t.map(l=>n(w5,{skill:l,isExpanded:hu.value.has(l.skillKey),onToggleExpand:()=>C5(l.skillKey),onToggleEnabled:()=>cp(l),onInstall:s=>{Dl.value=s}},l.skillKey))})]}),du.value&&n("div",{class:"text-xs text-[var(--color-text-muted)] space-y-1",children:[n("div",{children:[i("skills.workspaceDir"),": ",n("code",{children:du.value})]}),n("div",{children:[i("skills.managedDir"),": ",n("code",{children:ug.value})]})]})]})]}),n(Xe,{open:!!Kn.value,onClose:()=>{Kn.value=null},title:Kn.value?.name||"",children:Kn.value&&n(lg,{skill:Kn.value,onInstall:l=>{Kn.value=null,Dl.value=l},bare:!0})}),n(g5,{skill:Dl.value,onClose:()=>{Dl.value=null},onSuccess:Xi})]})})})}const Cr={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]+$/},M5=new RegExp(`(\\s+|${Cr.punctuation.source}+)`),R5=6,I5=3,$5=[{pattern:/[äöüßẞ]/i,averageCharsPerToken:3},{pattern:/[éèêëàâîïôûùüÿçœæáíóúñ]/i,averageCharsPerToken:3},{pattern:/[ąćęłńóśźżěščřžýůúďťň]/i,averageCharsPerToken:3.5}];function dg(e,t={}){if(!e)return 0;const{defaultCharsPerToken:r=R5,languageConfigs:a=$5}=t,o=e.split(M5).filter(Boolean);let l=0;for(const s of o)l+=D5(s,a,r);return l}function D5(e,t,r){if(Cr.whitespace.test(e))return 0;if(Cr.cjk.test(e))return L5(e);if(Cr.numeric.test(e)||e.length<=I5)return 1;if(Cr.punctuation.test(e))return e.length>1?Math.ceil(e.length/2):1;if(Cr.alphanumeric.test(e)){const o=dp(e,t)??r;return Math.ceil(e.length/o)}const a=dp(e,t)??r;return Math.ceil(e.length/a)}function dp(e,t){for(const r of t)if(r.pattern.test(e))return r.averageCharsPerToken}function L5(e){return Array.from(e).length}function Ns(e){return e.toLowerCase()==="memory.md"?"MEMORY.md":e}const hg={"AGENTS.md":{icon:"📋",description:"workspace.files.agents"},"SOUL.md":{icon:"🎭",description:"workspace.files.soul"},"TOOLS.md":{icon:"🛠️",description:"workspace.files.tools"},"IDENTITY.md":{icon:"🪪",description:"workspace.files.identity"},"USER.md":{icon:"👤",description:"workspace.files.user"},"HEARTBEAT.md":{icon:"💓",description:"workspace.files.heartbeat"},"BOOTSTRAP.md":{icon:"🚀",description:"workspace.files.bootstrap"},"MEMORY.md":{icon:"🧠",description:"workspace.files.memory"}},hp=["AGENTS.md","SOUL.md","TOOLS.md","IDENTITY.md","USER.md","HEARTBEAT.md","MEMORY.md","BOOTSTRAP.md"],N5=["BOOTSTRAP.md"],fu=v([]),ua=v("main"),Os=v([]),pu=v(""),oo=v(!1),Fs=v(null);function fg(e){const t=e.identity?.name||e.id;return e.identity?.emoji?`${e.identity.emoji} ${t}`:t}function pg(e){return e.missing?0:e.content?dg(e.content):e.size!=null?Math.round(e.size/4):0}const fp=j(()=>{const e=new Set;return fu.value.filter(t=>{const r=t.workspace||fg(t);return e.has(r)?!1:(e.add(r),!0)})}),pp=j(()=>Os.value.reduce((e,t)=>e+pg(t),0));async function O5(){try{const e=await F("agents.list",{});fu.value=e.agents,e.agents.find(t=>t.id===ua.value)||(ua.value=e.defaultId||e.agents[0]?.id||"main")}catch{fu.value=[{id:"main",name:"Main"}]}}async function mu(){oo.value=!0,Fs.value=null;try{const e=await F("agents.files.list",{agentId:ua.value});Os.value=e.files,pu.value=e.workspace}catch(e){Fs.value=e instanceof Error?e.message:i("workspace.loadError"),ie.error(i("workspace.loadError"))}finally{oo.value=!1}}function F5(e){ua.value=e,mu()}function mp(e){Ge(`/workspace/${encodeURIComponent(e)}?agent=${ua.value}`)}function P5({file:e}){const t=Ns(e.name),r=hg[t]??{icon:"📄",description:"workspace.files.unknown"},a=N5.includes(t),o=e.missing&&!a,l=pg(e);return n(V,{padding:"md",class:"hover:bg-[var(--color-bg-hover)] transition-colors cursor-pointer",onClick:()=>mp(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(zn,{class:"w-3 h-3 mr-1"}),i("workspace.missing")]})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] truncate",children:i(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&&yc(e.size),l>0&&` · ${hs(l)} tokens`,e.updatedAtMs&&` · ${ds(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&&yc(e.size)}),n("span",{class:"w-24 text-right",children:l>0&&`${hs(l)} tokens`}),n("span",{class:"w-12 text-right",children:e.updatedAtMs&&ds(e.updatedAtMs)})]}),n(G,{icon:e.missing?n(ir,{class:"w-4 h-4"}):n(li,{class:"w-4 h-4"}),label:e.missing?i("workspace.create"):i("workspace.edit"),onClick:s=>{s.stopPropagation(),mp(e.name)},variant:"ghost"})]})})}function z5(e){O(()=>{D.value&&O5().then(()=>mu())},[D.value]);const t=[...Os.value].sort((o,l)=>{const s=Ns(o.name),c=Ns(l.name),d=hp.indexOf(s),u=hp.indexOf(c);return(d===-1?999:d)-(u===-1?999:u)}),r=fp.value.map(o=>({value:o.id,label:fg(o)})),a=fp.value.length>1;return n(at,{viewName:i("nav.workspace"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-4xl mx-auto space-y-6",children:[n(St,{title:i("workspace.title"),subtitle:i("workspace.description"),actions:n("div",{class:"flex items-center gap-2",children:[a&&n(Ae,{value:ua.value,options:r,onChange:F5,size:"sm","aria-label":i("workspace.selectAgent")}),n(G,{icon:n(Fe,{class:`w-4 h-4 ${oo.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:()=>mu(),disabled:oo.value||!D.value,variant:"ghost"})]})}),Fs.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Fs.value}),oo.value&&Os.value.length===0?n("div",{class:"flex justify-center py-16",children:n(ee,{size:"lg"})}):n(K,{children:[n("div",{class:"space-y-2",children:t.map(o=>n(P5,{file:o},o.name))}),pp.value>0&&n("div",{class:"flex justify-center",children:n(X,{variant:"default",size:"md",children:i("workspace.totalTokens",{count:hs(pp.value)})})}),n(Pn,{title:i("workspace.memoryHint.title"),children:n("ul",{class:"list-disc list-inside space-y-1 text-sm",children:[n("li",{children:i("workspace.memoryHint.line1")}),n("li",{children:i("workspace.memoryHint.line2")})]})}),pu.value&&n("p",{class:"text-xs text-[var(--color-text-muted)] text-center",children:pu.value})]})]})})})}const ct=v(null),mg=v("main"),vi=v(""),ut=v(""),dn=v("view"),vu=v(!1),lo=v(!1),Ps=v(null),Ha=j(()=>ut.value!==vi.value),U5=j(()=>{const e=ct.value?.name??"",t=Ns(e);return hg[t]??{icon:"📄",description:"workspace.files.unknown"}});function H5(){return new URLSearchParams(window.location.search).get("agent")||"main"}async function B5(e,t){vu.value=!0,Ps.value=null,mg.value=t;try{const r=await F("agents.files.get",{agentId:t,name:e});ct.value=r.file;const a=r.file.content??"";vi.value=a,ut.value=a,dn.value=r.file.missing||!a?"edit":"view"}catch(r){Ps.value=r instanceof Error?r.message:i("workspace.loadFileError"),ie.error(i("workspace.loadFileError"))}finally{vu.value=!1}}async function vp(){if(ct.value){lo.value=!0;try{await F("agents.files.set",{agentId:mg.value,name:ct.value.name,content:ut.value}),vi.value=ut.value,ct.value={...ct.value,missing:!1,content:ut.value,size:new Blob([ut.value]).size,updatedAtMs:Date.now()},ie.success(i("workspace.saved"))}catch{ie.error(i("workspace.saveError"))}finally{lo.value=!1}}}function j5(){Ha.value&&!window.confirm(i("workspace.unsavedWarning"))||(ct.value=null,vi.value="",ut.value="",dn.value="view",Ge("/workspace"))}function gp({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 W5({filename:e}){const t=e?decodeURIComponent(e):"";return O(()=>{if(D.value&&t){const r=H5();B5(t,r)}},[D.value,t]),O(()=>{function r(a){(a.metaKey||a.ctrlKey)&&a.key==="s"&&(a.preventDefault(),dn.value==="edit"&&Ha.value&&!lo.value&&vp())}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),n(at,{viewName:t||i("nav.workspace"),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(G,{icon:n(ti,{class:"w-4 h-4"}),label:i("workspace.backToList"),onClick:j5,variant:"ghost"}),n("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{class:"text-xl","aria-hidden":"true",children:U5.value.icon}),n("h1",{class:"font-semibold truncate",children:e}),Ha.value&&n(X,{variant:"warning",size:"sm",children:i("workspace.unsaved")})]})]}),n("div",{class:"flex items-center gap-2",children:[ct.value&&!ct.value.missing&&n("span",{class:"hidden sm:block text-sm text-[var(--color-text-muted)]",children:[ct.value.size!=null&&yc(ct.value.size),ut.value&&n(K,{children:[" • ",hs(dg(ut.value))," tokens"]}),ct.value.updatedAtMs&&n(K,{children:[" • ",ds(ct.value.updatedAtMs)]})]}),dn.value==="edit"&&n(N,{variant:"primary",size:"sm",icon:n(cd,{class:"w-4 h-4"}),onClick:vp,disabled:!Ha.value||lo.value,children:lo.value?i("actions.saving"):i("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(gp,{active:dn.value==="view",onClick:()=>dn.value="view",icon:n(ld,{class:"w-4 h-4"}),label:i("workspace.view")}),n(gp,{active:dn.value==="edit",onClick:()=>dn.value="edit",icon:n(li,{class:"w-4 h-4"}),label:i("workspace.edit"),indicator:Ha.value})]}),n("div",{class:"flex-1 overflow-y-auto",children:[Ps.value&&n("div",{class:"m-4 p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Ps.value}),vu.value?n("div",{class:"flex justify-center py-16",children:n(ee,{size:"lg"})}):dn.value==="view"?n("div",{class:"p-4 sm:p-6 max-w-4xl mx-auto",children:ut.value?n(hi,{content:ut.value}):n("p",{class:"text-[var(--color-text-muted)] italic",children:i("workspace.emptyFile")})}):n("div",{class:"p-4 sm:p-6 h-full",children:n(Yr,{value:ut.value,onInput:r=>ut.value=r.target.value,placeholder:i("workspace.editPlaceholder"),class:"font-mono text-sm h-full min-h-[400px] resize-none",fullWidth:!0})})]})]})})}function q5(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 We(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 Ro(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 K5({healthData:e}){const t=Nu.value;return n(V,{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(cr,{class:"w-5 h-5 text-[var(--color-accent)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:i("usage.gateway.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:fa.value||i("usage.gateway.unknown")})]}),kt.value&&n(X,{variant:"default",size:"sm",class:"ml-auto",children:fm(kt.value)})]}),n("div",{class:"grid grid-cols-2 gap-4",children:[n("div",{class:"flex items-center gap-2",children:[n(me,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("usage.gateway.uptime")}),n("div",{class:"font-medium",children:t!=null?q5(t):"-"})]})]}),n("div",{class:"flex items-center gap-2",children:[n(In,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("usage.gateway.sessions")}),n("div",{class:"font-medium",children:e?.sessions?.count??"-"})]})]})]}),(qa.value||Ka.value)&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)] space-y-2",children:[qa.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(Qt,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:qa.value})]}),Ka.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(Pm,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:Ka.value})]})]})]})}function G5({usage:e,isLoading:t}){if(!e)return n(V,{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(Nc,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("h3",{class:"font-semibold",children:i("usage.summary.title")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i(t?"status.loading":"usage.summary.unavailable")})]});const r=e.totals;return n(V,{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(Nc,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:i("usage.summary.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("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:Ro(r.totalCost)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("usage.summary.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:i("usage.summary.input")}),n("div",{class:"font-medium",children:We(r.input)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("usage.summary.output")}),n("div",{class:"font-medium",children:We(r.output)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("usage.summary.total")}),n("div",{class:"font-medium",children:We(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:i("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:i("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:We(r.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("usage.summary.cacheWrite")}),n("div",{class:"font-medium",children:We(r.cacheWrite)})]})]})]})]})}function V5({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(V,{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(Wo,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:i("usage.daily.title")})]}),n("div",{class:"space-y-2",children:t.map(a=>{const o=a.totalTokens/r*100,s=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:s}),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:We(a.totalTokens)})]},a.date)})})]})}function Y5({healthData:e}){return!e?.agents||e.agents.length===0?null:n(V,{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(gs,{class:"w-5 h-5 text-[var(--color-warning)]"})}),n("h3",{class:"font-semibold",children:i("usage.agents.title")})]}),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:i("usage.agents.default")})]}),n("div",{class:"flex items-center gap-4 text-sm text-[var(--color-text-muted)]",children:[n("span",{children:[t.sessions.count," ",i("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 ts=v(null),ns=v(null),rs=v(ax()),zs=v(null),so=v(!1),Us=v(!1),as=v(!1),Hs=v(null),Nd=v(30),Ll=v("recent"),Fa=v(!0),mt=v(0),wn=5,gu=v("overview"),Io=v(null),$o=v([]),io=v(!1),co=v(!1);async function J5(){so.value=!0,Hs.value=null;try{const e=await F("health",{probe:!1});ts.value=e}catch(e){Hs.value=ce(e),ie.error(i("usage.loadError"))}finally{so.value=!1}}async function vg(e=30){Us.value=!0,Nd.value=e;try{const t=await F("usage.cost",{days:e});ns.value=t}catch{}finally{Us.value=!1}X5(e)}async function X5(e=30){if(!as.value){as.value=!0;try{const t=new Date,r=new Date;r.setDate(r.getDate()-e);const a=await F("sessions.usage",{startDate:r.toISOString().split("T")[0],endDate:t.toISOString().split("T")[0],limit:100,includeContextWeight:!0});rs.value=a,a&&ox(a)}catch{rs.value||(rs.value=null)}finally{as.value=!1}}}async function bp(){await Promise.all([J5(),vg(Nd.value)])}async function Z5(e){if(!io.value){io.value=!0,Io.value=null;try{const t=await F("sessions.usage.timeseries",{key:e});Io.value=t}catch{}finally{io.value=!1}}}async function Q5(e){if(!co.value){co.value=!0,$o.value=[];try{const t=await F("sessions.usage.logs",{key:e,limit:100});$o.value=t?.logs??[]}catch{}finally{co.value=!1}}}function eS(){zs.value=null,gu.value="overview",Io.value=null,$o.value=[]}function tS(){const e=rs.value,t=zs.value,r=as.value;if(!e&&r)return n(V,{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(An,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:i("usage.sessions.title")}),n(ee,{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(V,{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(An,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:i("usage.sessions.title")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("usage.sessions.noData")})]});const a=[...e.sessions].sort((u,h)=>{const f=Ll.value,p=Fa.value;let g=0;return f==="cost"?g=(u.usage.totalCost||0)-(h.usage.totalCost||0):f==="tokens"?g=(u.usage.totalTokens||0)-(h.usage.totalTokens||0):f==="recent"&&(g=(u.updatedAt||0)-(h.updatedAt||0)),p?-g:g}),o=a.slice(mt.value*wn,(mt.value+1)*wn),l=u=>{Ll.value===u?Fa.value=!Fa.value:(Ll.value=u,Fa.value=!0),mt.value=0},s=({col:u})=>Ll.value!==u?null:Fa.value?n(nt,{class:"w-3 h-3 inline ml-1"}):n(od,{class:"w-3 h-3 inline ml-1"}),c=u=>{zs.value=t?.key===u.key?null:u},d=()=>a.length>wn?n("div",{class:"mt-4 flex items-center justify-between",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("usage.sessions.showing",{from:mt.value*wn+1,to:Math.min((mt.value+1)*wn,a.length),total:a.length})}),n("div",{class:"flex items-center gap-1",children:[n(G,{icon:n(Nm,{class:"w-4 h-4"}),label:i("actions.previous"),onClick:()=>{mt.value=Math.max(0,mt.value-1)},disabled:mt.value===0,variant:"ghost",size:"sm"}),n("span",{class:"px-2 text-sm text-[var(--color-text-muted)]",children:[mt.value+1," / ",Math.ceil(a.length/wn)]}),n(G,{icon:n(rt,{class:"w-4 h-4"}),label:i("actions.next"),onClick:()=>{mt.value=Math.min(Math.ceil(a.length/wn)-1,mt.value+1)},disabled:mt.value>=Math.ceil(a.length/wn)-1,variant:"ghost",size:"sm"})]})]}):null;return n(K,{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(An,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:i("usage.sessions.title")}),r&&n(ee,{size:"sm"})]}),o.map(u=>n(ya,{icon:tn,iconVariant:t?.key===u.key?"info":"default",title:u.label||u.key,subtitle:u.model||void 0,meta:[{icon:rn,value:We(u.usage.totalTokens)},{icon:Nc,value:Ro(u.usage.totalCost)},...u.updatedAt?[{icon:me,value:oe(new Date(u.updatedAt),{relative:!0})}]:[]],onClick:()=>c(u)},u.key)),n(d,{})]}),n(V,{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(An,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:i("usage.sessions.title")}),r&&n(ee,{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:i("usage.sessions.name")}),n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:i("usage.sessions.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:[i("usage.sessions.tokens"),n(s,{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:[i("usage.sessions.cost"),n(s,{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:[i("usage.sessions.lastActive"),n(s,{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":i("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:We(u.usage.totalTokens)}),n("td",{class:"py-2 px-2 text-right font-mono",children:Ro(u.usage.totalCost)}),n("td",{class:"py-2 px-2 text-right text-[var(--color-text-muted)]",children:u.updatedAt?oe(new Date(u.updatedAt),{relative:!0}):"-"})]},u.key)})})]})}),n(d,{})]})]})}function nS(){const e=zs.value,t=gu.value;O(()=>{e&&(t==="timeline"&&!Io.value&&!io.value?Z5(e.key):t==="messages"&&$o.value.length===0&&!co.value&&Q5(e.key))},[e,t]);const r=[{id:"overview",label:i("usage.detail.tabs.overview")},{id:"timeline",label:i("usage.detail.tabs.timeline")},{id:"messages",label:i("usage.detail.tabs.messages")}];return n(Xe,{open:!!e,onClose:eS,title:i("usage.detail.title"),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:()=>{gu.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(rS,{session:e}),t==="timeline"&&n(aS,{}),t==="messages"&&n(oS,{})]})]})})}function rS({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:i("usage.summary.input")}),n("div",{class:"font-medium",children:We(e.usage.input)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("usage.summary.output")}),n("div",{class:"font-medium",children:We(e.usage.output)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:We(e.usage.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("usage.summary.totalCost")}),n("div",{class:"font-medium text-[var(--color-success)]",children:Ro(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:i("usage.detail.contextWeight")}),n("div",{class:"space-y-2",children:[t.systemPrompt!=null&&t.systemPrompt>0&&n(Pa,{label:i("usage.detail.system"),value:t.systemPrompt,total:t.total,color:"var(--color-accent)"}),t.skills!=null&&t.skills>0&&n(Pa,{label:i("usage.detail.skills"),value:t.skills,total:t.total,color:"var(--color-success)"}),t.tools!=null&&t.tools>0&&n(Pa,{label:i("usage.detail.tools"),value:t.tools,total:t.total,color:"var(--color-warning)"}),t.files!=null&&t.files>0&&n(Pa,{label:i("usage.detail.files"),value:t.files,total:t.total,color:"var(--color-info)"}),t.other!=null&&t.other>0&&n(Pa,{label:i("usage.detail.other"),value:t.other,total:t.total,color:"var(--color-text-muted)"})]})]})]})}function aS(){const e=Io.value;if(io.value)return n("div",{class:"flex justify-center py-8",children:n(ee,{size:"md"})});if(!e||e.points.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:i("usage.detail.noTimeline")});const r=e.points,a=Math.max(...r.map(k=>k.cumulativeTokens)),o=Math.max(...r.map(k=>k.cumulativeCost)),l=400,s=120,c={top:10,right:10,bottom:20,left:40},d=l-c.left-c.right,u=s-c.top-c.bottom,h=k=>c.left+k/(r.length-1)*d,f=k=>c.top+u-k/(a||1)*u,p=r.map((k,_)=>`${_===0?"M":"L"} ${h(_)} ${f(k.cumulativeTokens)}`).join(" "),g=`${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:i("usage.detail.cumulativeTokens")}),n("span",{children:[We(a)," max"]})]}),n("svg",{viewBox:`0 0 ${l} ${s}`,class:"w-full h-auto",children:[[0,.25,.5,.75,1].map(k=>n("line",{x1:c.left,y1:c.top+u*(1-k),x2:l-c.right,y2:c.top+u*(1-k),stroke:"var(--color-border)","stroke-dasharray":"2,2"},k)),n("path",{d:g,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:s-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"start",children:oe(new Date(r[0].timestamp),{relative:!1})}),n("text",{x:l-c.right,y:s-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"end",children:oe(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:i("usage.detail.requests")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold",children:We(a)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("usage.detail.totalTokens")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold text-[var(--color-success)]",children:Ro(o)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("usage.detail.totalCost")})]})]})]})}function oS(){const e=$o.value;if(co.value)return n("div",{class:"flex justify-center py-8",children:n(ee,{size:"md"})});if(e.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:i("usage.detail.noMessages")});const r={user:"info",assistant:"success",tool:"warning",toolResult:"default"},a={user:i("usage.detail.role.user"),assistant:i("usage.detail.role.assistant"),tool:i("usage.detail.role.tool"),toolResult:i("usage.detail.role.toolResult")};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:i("usage.detail.tokenCount",{count:We(o.tokens)})})]}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:oe(new Date(o.timestamp),{relative:!0})})]}),n("p",{class:"text-sm text-[var(--color-text-secondary)] line-clamp-2",children:o.content})]},l))})}function Pa({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:[We(t)," (",o,"%)"]})]})}function lS(e){return O(()=>{D.value&&bp()},[D.value]),n(at,{viewName:i("nav.usage"),children:[n("div",{class:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6",children:n("div",{class:"max-w-4xl mx-auto space-y-6 min-w-0",children:[n(St,{title:i("usage.title"),subtitle:i("usage.description"),actions:n(G,{icon:n(Fe,{class:`w-4 h-4 ${so.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:()=>bp(),disabled:so.value||!D.value,variant:"ghost"})}),Hs.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Hs.value}),so.value&&!ts.value||!D.value?n("div",{class:"flex justify-center py-16",children:n(ee,{size:"lg",label:D.value?void 0:i("status.connecting")})}):n("div",{class:"grid gap-6 md:grid-cols-2",children:[n(K5,{healthData:ts.value}),n(G5,{usage:ns.value,isLoading:Us.value}),n("div",{class:"md:col-span-2",children:n(V5,{usage:ns.value})}),n("div",{class:"md:col-span-2 min-w-0",children:n(tS,{})}),n("div",{class:"md:col-span-2",children:n(Y5,{healthData:ts.value})})]}),ns.value&&n("div",{class:"flex justify-center gap-2",children:[7,14,30,90].map(t=>n(N,{variant:Nd.value===t?"primary":"ghost",size:"sm",onClick:()=>vg(t),disabled:Us.value,children:[t,"d"]},t))})]})}),n(nS,{})]})}const Zi={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"},Qi={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"},ec={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"},tc={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"},nc={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"},rc={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"},ac={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"},sS="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",iS=[{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"}],cS="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",uS="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",dS=[{cx:7.5,cy:12,r:1.5},{cx:12,cy:12,r:1.5},{cx:16.5,cy:12,r:1.5}],hS={telegram:{path:rc.path,hex:rc.hex,title:rc.title},discord:{path:Zi.path,hex:Zi.hex,title:Zi.title},signal:{path:nc.path,hex:nc.hex,title:nc.title},whatsapp:{path:ac.path,hex:ac.hex,title:ac.title},googlechat:{path:Qi.path,hex:Qi.hex,title:Qi.title},matrix:{path:tc.path,hex:tc.hex,title:tc.title},mastodon:{path:ec.path,hex:ec.hex,title:ec.title},imessage:{path:sS,hex:"34C759",title:"iMessage"},nostr:{path:cS,hex:"8B5CF6",title:"Nostr"}};function fS({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"}),iS.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:uS}),dS.map((d,u)=>n("circle",{cx:d.cx,cy:d.cy,r:d.r,fill:c},u))]})}if(o==="webchat")return n(en,{class:r,style:{width:t,height:t,color:a?"#6366f1":"currentColor"}});const l=hS[o];if(!l)return n(en,{class:r,style:{width:t,height:t}});const s=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:s,d:l.path})]})}function pS(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 mS(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:pS(r)}})}function gg(e){return e.accounts.reduce((t,r)=>{const a=r.lastInboundAt??0,o=r.lastOutboundAt??0;return Math.max(t,a,o)},0)}const Jn=v([]),Wt=v(!1),uo=v(!1),ho=v(null),Gt=v(null),Bs=v(!1);function vS(e){switch(e){case"connected":return{variant:"success",label:i("channels.status.connected")};case"configured":return{variant:"warning",label:i("channels.status.configured")};case"not-configured":return{variant:"default",label:i("channels.status.notConfigured")};case"disabled":return{variant:"default",label:i("channels.status.disabled")};case"error":return{variant:"error",label:i("channels.status.error")}}}async function os(e=!1){e?uo.value=!0:Wt.value=!0,ho.value=null;try{const t=await F("channels.status",{probe:e,timeoutMs:e?15e3:1e4});Jn.value=mS(t)}catch(t){ho.value=ce(t)}finally{Wt.value=!1,uo.value=!1}}async function gS(){if(Gt.value){Bs.value=!0;try{await F("channels.logout",{channel:Gt.value.channel,accountId:Gt.value.accountId}),ie.success(i("channels.logoutSuccess",{channel:Gt.value.label})),Gt.value=null,os()}catch(e){ie.error(ce(e))}finally{Bs.value=!1}}}const bS=j(()=>{const e=Jn.value,t=Date.now()-1440*60*1e3;return{total:e.length,active:e.filter(r=>gg(r)>t).length,errors:e.filter(r=>r.status==="error").length}});function xS({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(G,{icon:n(O1,{class:"w-3.5 h-3.5"}),label:i("channels.logout"),onClick:()=>{Gt.value={channel:t,accountId:e.accountId,label:`${r} (${e.name||e.accountId})`}},variant:"ghost",size:"sm"})]})}function yS({channel:e}){const t=vS(e.status),r=gg(e);return n(V,{padding:"md",children:[n("div",{class:"flex items-start gap-3 mb-4",children:[n(fS,{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(me,{class:"w-3.5 h-3.5"}),oe(r,{relative:!0})]}),n("button",{type:"button",onClick:()=>Ge(`/config#channels.${e.id}`),class:"flex items-center gap-1 hover:text-[var(--color-accent)] transition-colors",children:[n(dd,{class:"w-3.5 h-3.5"}),i("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:[i("channels.docs"),n(Go,{class:"w-3 h-3"})]})]})]})]}),e.accounts.length>0&&n("div",{class:"space-y-2",children:e.accounts.map(a=>n(xS,{account:a,channelId:e.id,channelLabel:e.label},a.accountId))})]})}function wS(){return Gt.value?n(Xe,{open:!0,onClose:()=>{Gt.value=null},title:i("channels.logoutTitle"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-[var(--color-text-secondary)]",children:i("channels.logoutConfirm",{channel:Gt.value.label})}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("channels.logoutWarning")})]}),n("div",{class:"flex justify-end gap-3 mt-6",children:[n(N,{variant:"ghost",onClick:()=>{Gt.value=null},disabled:Bs.value,children:i("actions.cancel")}),n(N,{variant:"danger",onClick:gS,loading:Bs.value,children:i("channels.logout")})]})]}):null}function kS(e){O(()=>{D.value&&os()},[D.value]);const t=bS.value;return n(at,{viewName:i("nav.channels"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:[n("div",{class:"max-w-4xl mx-auto space-y-4 sm:space-y-6",children:[n(St,{title:i("channels.title"),subtitle:i("channels.description"),actions:n(K,{children:[n(N,{variant:"secondary",size:"sm",onClick:()=>os(!0),disabled:uo.value||Wt.value||!D.value,icon:n(In,{class:`w-4 h-4 ${uo.value?"animate-pulse":""}`}),children:uo.value?i("channels.probing"):i("channels.probe")}),n(G,{icon:n(Fe,{class:`w-4 h-4 ${Wt.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:()=>os(),disabled:Wt.value||!D.value,variant:"ghost"})]})}),D.value&&!Wt.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-4",children:[n(pe,{icon:tn,label:i("channels.stats.total"),value:t.total}),n(pe,{icon:rn,label:i("channels.stats.active"),value:t.active}),n(pe,{icon:ri,label:i("channels.stats.errors"),value:t.errors,highlight:t.errors>0})]}),ho.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:ho.value}),(Wt.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(ee,{size:"lg",label:D.value?void 0:i("status.connecting")})}),D.value&&!Wt.value&&Jn.value.length>0&&n("div",{class:"grid gap-4 sm:grid-cols-2",children:Jn.value.map(r=>n(yS,{channel:r},r.id))}),D.value&&!Wt.value&&Jn.value.length===0&&!ho.value&&n(V,{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:i("channels.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("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:[i("channels.learnMore"),n(Go,{class:"w-4 h-4"})]})]})}),D.value&&!Wt.value&&Jn.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:i("channels.count",{count:Jn.value.length})})]}),n(wS,{})]})})}const Bt=v([]),hn=v(!1),fo=v(null);function bg(e){const t=e.mode?.toLowerCase()??"",r=e.deviceFamily?.toLowerCase()??"";return t==="gateway"?cr:r.includes("iphone")||r.includes("android")?Gr:r.includes("mac")||r.includes("windows")||r.includes("linux")?Mt:en}function _S(e){return e===void 0?"—":e<60?i("instances.idleSeconds",{count:e}):e<3600?i("instances.idleMinutes",{count:Math.floor(e/60)}):i("instances.idleHours",{count:Math.floor(e/3600)})}function xg(e){return e?e==="gateway"?"success":e==="webchat"||e==="chat"?"warning":"default":"default"}async function oc(){hn.value=!0,fo.value=null;try{const e=await F("system-presence",{});Bt.value=e??[]}catch(e){fo.value=ce(e)}finally{hn.value=!1}}function SS({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 CS({presence:e}){const t=bg(e),r=e.mode==="gateway";return n(ya,{icon:t,iconVariant:r?"success":"default",title:e.host||e.instanceId||"Unknown",subtitle:e.ip,badges:e.mode?n(X,{variant:xg(e.mode),size:"sm",children:e.mode}):null,meta:[{icon:me,value:oe(e.ts,{relative:!0})},...e.platform?[{value:e.platform}]:[]]})}function TS({presence:e}){const t=bg(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(SS,{roles:e.roles,scopes:e.scopes})]})]})}),n("td",{class:"py-3 px-4",children:e.mode?n(X,{variant:xg(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(me,{class:"w-3.5 h-3.5"}),n("span",{children:oe(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:_S(e.lastInputSeconds)})]})}function ES(e){O(()=>{D.value&&oc()},[D.value]);const t=Bt.value.filter(a=>a.mode==="gateway").length,r=Bt.value.filter(a=>a.mode!=="gateway").length;return n(at,{viewName:i("nav.instances"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(St,{title:i("instances.title"),subtitle:i("instances.description"),actions:n(G,{icon:n(Fe,{class:`w-4 h-4 ${hn.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:oc,disabled:hn.value||!D.value,variant:"ghost"})}),D.value&&!hn.value&&n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(pe,{icon:en,label:i("instances.stats.total"),value:Bt.value.length}),n(pe,{icon:cr,label:i("instances.stats.gateways"),value:t}),n(pe,{icon:Mt,label:i("instances.stats.clients"),value:r})]}),fo.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:fo.value}),(hn.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(ee,{size:"lg",label:D.value?void 0:i("status.connecting")})}),D.value&&!hn.value&&Bt.value.length>0&&n(K,{children:[n("div",{class:"md:hidden space-y-2",children:Bt.value.map((a,o)=>n(CS,{presence:a},a.instanceId||a.host||o))}),n(V,{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:i("instances.columns.instance")}),n("th",{class:"py-3 px-4 font-medium w-24",children:i("instances.columns.mode")}),n("th",{class:"py-3 px-4 font-medium w-40",children:i("instances.columns.platform")}),n("th",{class:"py-3 px-4 font-medium w-28",children:i("instances.columns.lastSeen")}),n("th",{class:"py-3 px-4 font-medium w-20 hidden lg:table-cell",children:i("instances.columns.idle")})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:Bt.value.map((a,o)=>n(TS,{presence:a},a.instanceId||a.host||o))})]})})]}),D.value&&!hn.value&&Bt.value.length===0&&!fo.value&&n(V,{children:n("div",{class:"p-16 text-center",children:[n(en,{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:i("instances.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("instances.emptyDescription")}),n(N,{variant:"secondary",onClick:oc,children:i("actions.refresh")})]})}),D.value&&!hn.value&&Bt.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:i("instances.count",{count:Bt.value.length})})]})})})}const xp={main:{icon:hd,color:"success",badgeVariant:"success"},channel:{icon:xs,color:"info",badgeVariant:"info"},cron:{icon:Wo,color:"warning",badgeVariant:"warning"},isolated:{icon:An,color:"text-muted",badgeVariant:"default"}};function Mn(e){return xp[e]??xp.isolated}function yg(e){return i(`sessions.admin.kinds.${e}`)}const Re=v([]),gt=v(!1),$n=v(null),Tr=v(""),ot=v("all"),Qo=v(null),Ur=v(!1),bu=v(!1),Hr=v(null),js=v(""),Do=v(""),Lo=v("inherit"),No=v("inherit"),Oo=v("inherit");function Od(e){return(e.totalTokens??0).toLocaleString()}function wg(e){const t=e.totalTokens??0,r=e.contextTokens??2e5;return r===0?"0%":`${Math.round(t/r*100)}%`}function kg(e){return e.label||e.displayName||e.key.split(":").pop()||e.key}const Gn=j(()=>{let e=Re.value;ot.value!=="all"&&(e=e.filter(r=>tr(r)===ot.value));const t=Tr.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=(r.label||r.displayName||"").toLowerCase(),o=r.key.toLowerCase(),l=(r.model||"").toLowerCase(),s=(r.channel||"").toLowerCase();return a.includes(t)||o.includes(t)||l.includes(t)||s.includes(t)})),[...e].sort((r,a)=>{const o=tr(r)==="main",l=tr(a)==="main";return o&&!l?-1:l&&!o?1:(a.updatedAt??0)-(r.updatedAt??0)})}),AS=j(()=>{const e={total:0,main:0,channel:0,cron:0,isolated:0};for(const t of Re.value)e.total++,e[tr(t)]++;return e});async function yp(){gt.value=!0,$n.value=null;try{const e=await F("sessions.list",{limit:200});Re.value=e.sessions??[]}catch(e){$n.value=ce(e)}finally{gt.value=!1}}function po(e){Qo.value=e,Do.value=e.label??"",Lo.value=e.thinking??"inherit",No.value=e.verbose??"inherit",Oo.value=e.reasoning??"inherit"}function mo(){Qo.value=null,Ur.value=!1}async function MS(){const e=Qo.value;if(e){bu.value=!0;try{const t={};Do.value!==(e.label??"")&&(t.label=Do.value||void 0),Lo.value!==(e.thinking??"inherit")&&(t.thinking=Lo.value),No.value!==(e.verbose??"inherit")&&(t.verbose=No.value),Oo.value!==(e.reasoning??"inherit")&&(t.reasoning=Oo.value),Object.keys(t).length>0&&(await F("sessions.patch",{key:e.key,...t}),Re.value=Re.value.map(r=>r.key===e.key?{...r,...t}:r)),mo()}catch(t){$n.value=ce(t)}finally{bu.value=!1}}}async function RS(){const e=Qo.value;if(e)try{await F("sessions.delete",{key:e.key}),Re.value=Re.value.filter(t=>t.key!==e.key),mo()}catch(t){$n.value=ce(t)}}function _g(e){Ge(`/chat/${encodeURIComponent(e)}`)}function IS(e,t){t.stopPropagation(),Hr.value=e.key,js.value=e.label??""}async function wp(){const e=Hr.value;if(!e)return;const t=js.value.trim(),r=Re.value.find(a=>a.key===e);if(!r||t===(r.label??"")){Hr.value=null;return}try{await F("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){$n.value=ce(a)}finally{Hr.value=null}}function $S(){Hr.value=null}const lc=[{value:"inherit",label:i("sessions.admin.levels.inherit")},{value:"off",label:i("sessions.admin.levels.off")},{value:"low",label:i("sessions.admin.levels.low")},{value:"medium",label:i("sessions.admin.levels.medium")},{value:"high",label:i("sessions.admin.levels.high")}];function DS({kind:e,size:t="sm"}){const r=Mn(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 Sg({kind:e,size:t="sm"}){const r=Mn(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(DS,{kind:e,size:t})})}function Cg({session:e,onDelete:t}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[Ys.value&&n(G,{icon:n(tn,{class:"w-4 h-4"}),label:i("sessions.admin.openInChat"),size:"sm",variant:"ghost",onClick:r=>{r.stopPropagation(),_g(e.key)}}),n(G,{icon:n(Lt,{class:"w-4 h-4"}),label:i("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 LS({session:e}){const t=tr(e),r=Mn(t),a=kg(e);return n(ya,{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:yg(t)}),meta:[{icon:me,value:e.updatedAt?oe(e.updatedAt,{relative:!0}):"—"},{icon:Um,value:Od(e)}],actions:n(Cg,{session:e,onDelete:o=>{o.stopPropagation(),po(e),Ur.value=!0}}),onClick:()=>po(e)})}function NS({session:e}){const t=tr(e),r=kg(e),a=Hr.value===e.key;return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>!a&&po(e),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&!a&&(o.preventDefault(),po(e))},tabIndex:a?-1:0,children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n(Sg,{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(re,{type:"text",value:js.value,onInput:o=>js.value=o.target.value,onKeyDown:o=>{o.key==="Enter"&&wp(),o.key==="Escape"&&$S()},onBlur:wp,placeholder:i("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(G,{icon:n(li,{class:"w-3 h-3"}),label:i("sessions.admin.editLabel"),size:"sm",variant:"ghost",onClick:o=>IS(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(gs,{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(me,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:e.updatedAt?oe(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(Um,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:Od(e)}),n("span",{class:"text-xs opacity-60",children:["(",wg(e),")"]})]})}),n("td",{class:"py-3 px-4",children:n(Cg,{session:e,onDelete:o=>{o.stopPropagation(),po(e),Ur.value=!0}})})]})}function OS(){const e=Qo.value;if(!e)return null;const t=tr(e),r=Mn(t);return n(Xe,{open:!!e,onClose:mo,title:e.label||e.displayName||i("sessions.admin.sessionDetails"),size:"xl",footer:Ur.value?n(Iv,{message:i("sessions.admin.confirmDelete"),onCancel:()=>Ur.value=!1,onDelete:RS}):n($v,{isEdit:!0,onDeleteClick:()=>Ur.value=!0,onCancel:mo,onSave:MS,isSaving:bu.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(Sg,{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:yg(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:Od(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:i("sessions.admin.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:wg(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:i("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?oe(e.updatedAt,{relative:!0}):"—"}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:i("sessions.admin.lastActive")})]})]}),n("div",{class:"space-y-4 sm:space-y-5",children:[n(Ee,{label:i("sessions.admin.label"),hint:i("sessions.admin.labelHelp"),children:n(re,{value:Do.value,onInput:a=>Do.value=a.target.value,placeholder:i("sessions.admin.labelPlaceholder"),fullWidth:!0})}),n(Ee,{label:i("sessions.admin.overrides"),children:n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(Ee,{label:i("sessions.admin.thinking"),class:"space-y-1",children:n(Ae,{value:Lo.value,onChange:a=>Lo.value=a,options:lc})}),n(Ee,{label:i("sessions.admin.verbose"),class:"space-y-1",children:n(Ae,{value:No.value,onChange:a=>No.value=a,options:lc})}),n(Ee,{label:i("sessions.admin.reasoning"),class:"space-y-1",children:n(Ae,{value:Oo.value,onChange:a=>Oo.value=a,options:lc})})]})})]}),Ys.value&&n(N,{variant:"secondary",fullWidth:!0,icon:n(tn,{class:"w-4 h-4"}),onClick:()=>{mo(),_g(e.key)},children:i("sessions.admin.openInChat")})]})})}function FS(e){O(()=>{D.value&&yp()},[D.value]);const t=AS.value;return n(at,{viewName:i("nav.sessions"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:[n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(St,{title:i("sessions.admin.title"),subtitle:i("sessions.admin.description"),actions:n(K,{children:[D.value&&!gt.value&&Re.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(re,{type:"text",value:Tr.value,onInput:r=>Tr.value=r.target.value,placeholder:i("sessions.admin.searchPlaceholder"),class:"pl-10 w-48 lg:w-64"})]}),n(G,{icon:n(Fe,{class:`w-4 h-4 ${gt.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:yp,disabled:gt.value||!D.value,variant:"ghost"})]})}),D.value&&!gt.value&&Re.value.length>0&&n("div",{class:"relative md:hidden",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(re,{type:"text",value:Tr.value,onInput:r=>Tr.value=r.target.value,placeholder:i("sessions.admin.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),D.value&&!gt.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(pe,{icon:tn,label:i("sessions.admin.stats.total"),value:t.total,active:ot.value==="all",onClick:()=>ot.value="all"}),n(pe,{icon:Mn("main").icon,label:i("sessions.admin.kinds.main"),value:t.main,active:ot.value==="main",onClick:()=>ot.value="main"}),n(pe,{icon:Mn("channel").icon,label:i("sessions.admin.kinds.channel"),value:t.channel,active:ot.value==="channel",onClick:()=>ot.value="channel"}),n(pe,{icon:Mn("cron").icon,label:i("sessions.admin.kinds.cron"),value:t.cron,active:ot.value==="cron",onClick:()=>ot.value="cron"}),n(pe,{icon:Mn("isolated").icon,label:i("sessions.admin.kinds.isolated"),value:t.isolated,active:ot.value==="isolated",onClick:()=>ot.value="isolated"})]}),$n.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:$n.value}),(gt.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(ee,{size:"lg",label:D.value?void 0:i("status.connecting")})}),D.value&&!gt.value&&Gn.value.length>0&&n(K,{children:[n("div",{class:"md:hidden space-y-2",children:Gn.value.map(r=>n(LS,{session:r},r.key))}),n(V,{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:i("sessions.admin.columns.session")}),n("th",{class:"py-3 px-4 font-medium w-32",children:i("sessions.admin.columns.model")}),n("th",{class:"py-3 px-4 font-medium w-36",children:i("sessions.admin.columns.lastActive")}),n("th",{class:"py-3 px-4 font-medium w-32 hidden lg:table-cell",children:i("sessions.admin.columns.tokens")}),n("th",{class:"py-3 px-4 font-medium w-12"})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:Gn.value.map(r=>n(NS,{session:r},r.key))})]})})]}),D.value&&!gt.value&&Re.value.length===0&&!$n.value&&n(V,{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:i("sessions.admin.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)]",children:i("sessions.admin.emptyDescription")})]})}),D.value&&!gt.value&&Re.value.length>0&&Gn.value.length===0&&n(V,{children:n("div",{class:"p-12 text-center",children:[n(Ke,{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:i("sessions.admin.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("sessions.admin.noResultsDescription")}),n(N,{variant:"secondary",size:"sm",onClick:()=>{Tr.value="",ot.value="all"},children:i("sessions.admin.clearFilters")})]})}),D.value&&!gt.value&&Gn.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:Gn.value.length===Re.value.length?i("sessions.admin.count",{count:Re.value.length}):i("sessions.admin.filteredCount",{filtered:Gn.value.length,total:Re.value.length})})]}),n(OS,{})]})})}const PS={sm:"text-xs",md:"text-sm",lg:"text-base"};function Fd({children:e,size:t="sm",muted:r=!0,icon:a,iconRight:o,class:l,...s}){return n("button",{type:"button",class:`
|
|
410
|
-
inline-flex items-center gap-1
|
|
411
|
-
${PS[t]}
|
|
412
|
-
${r?"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]":"text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]"}
|
|
413
|
-
transition-colors
|
|
414
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
415
|
-
${l||""}
|
|
416
|
-
`,...s,children:[a&&n("span",{class:"flex-shrink-0",children:a}),e,o&&n("span",{class:"flex-shrink-0",children:o})]})}const zS={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)]"},US={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"}},HS={success:qo,error:Ko,warning:zn,info:Vo};function kp({variant:e,size:t="lg",class:r}){const{container:a,icon:o}=US[t],l=HS[e];return n("div",{class:`
|
|
417
|
-
${a}
|
|
418
|
-
rounded-full
|
|
419
|
-
flex items-center justify-center
|
|
420
|
-
${zS[e]}
|
|
421
|
-
${r||""}
|
|
422
|
-
`,children:n(l,{class:o})})}function Tg({onBack:e,onNext:t,nextLabel:r,backLabel:a,nextDisabled:o=!1,nextLoading:l=!1,class:s}){return n("div",{class:`flex gap-3 mt-6 ${s||""}`,children:[e&&n(N,{variant:"ghost",onClick:e,icon:n(ti,{class:"w-4 h-4"}),children:a||i("actions.back")}),n(N,{variant:"primary",onClick:t,disabled:o,loading:l,class:e?"flex-1":"w-full",iconRight:n(ni,{class:"w-4 h-4"}),children:r||i("actions.continue")})]})}function BS({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 jS({onComplete:e,onSkip:t}){const r=Q("welcome"),a=Q(""),o=Q("token"),l=Q(""),s=Q(!0),c=Q(!1),d=Q(!1),u=Q(null),h=Q(!1),f=Q(!1),p=Q(!0),g=Q("single"),k=Ks(()=>{const x=a.value.trim();if(!x||!x.startsWith("ws://")&&!x.startsWith("wss://"))return!1;try{return new URL(x),!0}catch{return!1}});gc(()=>{const x=a.value;if(f.value=!1,h.value=!1,!k.value)return;const E=new AbortController,L=setTimeout(async()=>{if(E.signal.aborted||a.peek()!==x)return;h.value=!0,u.value=null;const A=await _h(x,E.signal);!E.signal.aborted&&a.peek()===x&&(h.value=!1,A.ok?(f.value=!0,u.value=null):A.error!=="Aborted"&&(f.value=!1,u.value=A.error||i("onboarding.probeError")))},600);return()=>{clearTimeout(L),E.abort()}});const _=()=>a.value.trim()?k.value?(u.value=null,!0):(u.value=i("onboarding.urlError"),!1):(u.value=i("errors.required"),!1),T=async()=>{c.value=!0,d.value=!1;try{await Bo({url:a.value,token:o.value==="token"?l.value:void 0,password:o.value==="password"?l.value:void 0,autoReconnect:!0}),Iu({url:a.value,authMode:o.value,rememberMe:s.value,credential:l.value}),vh(),await Xs(),await Zu(),Kr("main"),await Xu("main"),ed(),td(),d.value=!0}catch(x){M.auth.error("Connect failed:",x),d.value=!1}finally{c.value=!1}},C=()=>{qr(),d.value=!1,r.value="auth"},m=async()=>{if(!_())return;if(f.value){r.value="auth";return}if(h.value)return;h.value=!0,u.value=null;const x=await _h(a.value);h.value=!1,x.ok?(f.value=!0,setTimeout(()=>{r.value="auth",f.value=!1},500)):u.value=x.error||i("onboarding.probeError")},b=()=>{r.value==="welcome"?r.value="url":r.value==="url"?m():r.value==="auth"&&(r.value="connect",T())},S=()=>{r.value==="url"?r.value="welcome":r.value==="auth"?r.value="url":r.value==="connect"&&!d.value&&(r.value="auth")},w=()=>{vh(),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(BS,{steps:["welcome","url","auth","connect"],current:r.value,class:"mb-4 sm:mb-8"}),r.value==="welcome"&&n(WS,{onNext:b,onSkip:w}),r.value==="url"&&n(qS,{url:a.value,onUrlChange:x=>{a.value=x,u.value=null,f.value=!1},error:u.value,canProceed:k.value,probing:h.value,probeSuccess:f.value,onNext:b,onBack:S,onSkip:w}),r.value==="auth"&&n(KS,{authMode:o.value,onAuthModeChange:x=>o.value=x,credential:l.value,onCredentialChange:x=>l.value=x,rememberMe:s.value,onRememberMeChange:x=>s.value=x,onNext:b,onBack:S}),r.value==="connect"&&n(GS,{connecting:c.value,connected:d.value,error:Tn.value,showTour:p.value,onShowTourChange:x=>p.value=x,selectedMode:g.value,onModeChange:x=>{g.value=x,gn.value=x},onRetry:C,onContinue:()=>{zb(p.value),gn.value=g.value,e()}})]})})}function WS({onNext:e,onSkip:t}){return n("div",{class:"text-center",children:[n(ci,{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:i("onboarding.welcome")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mb-4 sm:mb-8",children:i("onboarding.welcomeSubtitle")}),n("div",{class:"grid gap-2 sm:gap-4 mb-4 sm:mb-8 text-left",children:[n(sc,{icon:n(rn,{class:"w-5 h-5"}),title:i("onboarding.feature1Title"),description:i("onboarding.feature1Desc")}),n(sc,{icon:n(ii,{class:"w-5 h-5"}),title:i("onboarding.feature2Title"),description:i("onboarding.feature2Desc")}),n(sc,{icon:n(en,{class:"w-5 h-5"}),title:i("onboarding.feature3Title"),description:i("onboarding.feature3Desc")})]}),n("div",{class:"space-y-3",children:[n(N,{variant:"primary",onClick:e,fullWidth:!0,iconRight:n(ni,{class:"w-4 h-4"}),children:i("onboarding.getStarted")}),n(Fd,{onClick:t,children:i("onboarding.skipToLogin")})]})]})}function sc({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 qS({url:e,onUrlChange:t,error:r,canProceed:a,probing:o,probeSuccess:l,onNext:s,onBack:c,onSkip:d}){const u=f=>{f.key==="Enter"&&l&&s()},h=()=>{if(o)return n(ee,{size:"sm"});if(l)return n(bn,{class:"w-4 h-4 text-[var(--color-success)]"});if(r&&a)return n(va,{content:r,placement:"left",children:n("span",{class:"cursor-help",children:n(ri,{class:"w-4 h-4 text-[var(--color-error)]"})})})};return n(V,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:i("onboarding.urlTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:i("onboarding.urlSubtitle")}),n(Ee,{label:i("auth.gatewayUrl"),htmlFor:"gateway-url",children:n(re,{id:"gateway-url",type:"url",value:e,onInput:f=>t(f.target.value),onKeyDown:u,placeholder:i("auth.gatewayUrlPlaceholder"),rightElement:h(),autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(Pn,{title:i("onboarding.troubleshootTitle"),items:[i("onboarding.troubleshoot1"),i("onboarding.troubleshoot2"),i("onboarding.troubleshoot3")],class:"mt-3 sm:mt-4 text-xs sm:text-sm"}),n(Tg,{onBack:c,onNext:s,nextDisabled:!l}),n("div",{class:"text-center mt-4",children:n(Fd,{onClick:d,disabled:o,children:i("onboarding.skipToLogin")})})]})}function KS({authMode:e,onAuthModeChange:t,credential:r,onCredentialChange:a,rememberMe:o,onRememberMeChange:l,onNext:s,onBack:c}){const d=h=>{h.key==="Enter"&&s()},u=[{value:"token",label:i("auth.authMode.token")},{value:"password",label:i("auth.authMode.password")}];return n(V,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:i("onboarding.authTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:i("onboarding.authSubtitle")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(Ee,{label:i("onboarding.authMethod"),children:n(Ae,{value:e,onChange:h=>t(h),options:u,"aria-label":i("onboarding.authMethod"),class:"w-full"})}),n(Ee,{label:i(e==="token"?"auth.token":"auth.password"),htmlFor:"credential",children:n(Cd,{id:"credential",value:r,onInput:h=>a(h.target.value),onKeyDown:d,placeholder:i(e==="token"?"auth.tokenPlaceholder":"auth.passwordPlaceholder"),fullWidth:!0})}),n(Ve,{checked:o,onChange:l,label:i("auth.rememberMe"),description:i("onboarding.rememberMeDesc"),size:"sm"})]}),n(Tg,{onBack:c,onNext:s,nextLabel:i("actions.connect")})]})}function GS({connecting:e,connected:t,error:r,showTour:a,onShowTourChange:o,selectedMode:l,onModeChange:s,onRetry:c,onContinue:d}){return n(V,{variant:"elevated",padding:"md",class:"text-center",children:[e&&n(K,{children:[n(ee,{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:i("onboarding.connecting")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:i("onboarding.connectingDesc")})]}),!e&&t&&n(K,{children:[n(kp,{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:i("onboarding.success")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-4 sm:mb-6",children:i("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:i("onboarding.modeTitle")}),n("div",{class:"grid grid-cols-2 gap-2 sm:gap-3",children:[n("button",{type:"button",onClick:()=>s("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(tn,{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:i("onboarding.modeSingle")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:i("onboarding.modeSingleDesc")})]}),n("button",{type:"button",onClick:()=>s("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(L1,{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:i("onboarding.modeMulti")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:i("onboarding.modeMultiDesc")})]})]})]}),n("div",{class:"mb-4 sm:mb-6",children:n(Ve,{checked:a,onChange:o,label:i("onboarding.showFeatureTour"),size:"sm"})}),n(N,{variant:"primary",onClick:d,fullWidth:!0,iconRight:n(ni,{class:"w-4 h-4"}),children:i(a?"actions.continue":"onboarding.startChatting")})]}),!e&&!t&&r&&n(K,{children:[n(kp,{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:i("onboarding.failed")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-error)] mb-3 sm:mb-4",children:r}),n(Pn,{title:i("onboarding.failedHints"),items:[i("onboarding.hint1"),i("onboarding.hint2"),i("onboarding.hint3"),i("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(ti,{class:"w-4 h-4"}),children:i("onboarding.tryAgain")})]})]})}const VS=150,YS=300,JS=50,vt=16,Nl=8,XS=8;function ZS({steps:e,onComplete:t,spotlightPadding:r=XS}){const a=Q(0),o=Q(0),l=Q(null),s=W(null),c=Q(null),d=Q(!1),u=e[o.value],h=e[a.value],f=a.value===0,p=a.value===e.length-1,g=Z(async()=>{if(!h)return;await new Promise(b=>setTimeout(b,VS)),o.value=a.peek(),h.beforeShow&&await h.beforeShow(),await new Promise(b=>setTimeout(b,JS));const m=document.querySelector(h.target);if(m){m.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(S=>setTimeout(S,YS));const b=m.getBoundingClientRect();l.value=b}else l.value=null;d.value=!1},[h]);gc(()=>{a.value,d.value=!0,g()}),gc(()=>{const m=l.value;if(!m||!s.current)return;const S=s.current.getBoundingClientRect(),w={width:window.innerWidth,height:window.innerHeight};let x=h?.placement||"bottom",E=0,L=0;const A={bottom:{top:m.bottom+r+Nl+vt,left:m.left+m.width/2-S.width/2,fits:m.bottom+r+S.height+vt<w.height},top:{top:m.top-r-S.height-Nl-vt,left:m.left+m.width/2-S.width/2,fits:m.top-r-S.height-vt>0},right:{top:m.top+m.height/2-S.height/2,left:m.right+r+Nl+vt,fits:m.right+r+S.width+vt<w.width},left:{top:m.top+m.height/2-S.height/2,left:m.left-r-S.width-Nl-vt,fits:m.left-r-S.width-vt>0}},H=x==="top"?["top","bottom","right","left"]:x==="left"?["left","right","bottom","top"]:x==="right"?["right","left","bottom","top"]:["bottom","top","right","left"];for(const ze of H)if(A[ze].fits){x=ze;break}const $=A[x];E=$.top,L=$.left,L=Math.max(vt,Math.min(L,w.width-S.width-vt)),E=Math.max(vt,Math.min(E,w.height-S.height-vt));const Y=x==="bottom"?"top":x==="top"?"bottom":x==="left"?"right":"left";c.value={top:E,left:L,arrowPosition:Y}}),O(()=>{const m=()=>g();return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[g]),O(()=>{const m=b=>{b.key==="Escape"?t():b.key==="ArrowRight"||b.key==="Enter"?p?t():a.value++:b.key==="ArrowLeft"&&!f&&a.value--};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[f,p,t]);const k=()=>{p?t():a.value++},_=()=>{f||a.value--},T=l.value,C=c.value;return fd(n("div",{class:"fixed inset-0 z-[9999]",children:[n("svg",{class:"absolute inset-0 w-full h-full",children:[n("defs",{children:n("mask",{id:"spotlight-mask",children:[n("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),T&&n("rect",{x:T.left-r,y:T.top-r,width:T.width+r*2,height:T.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)"})]}),T&&n("div",{class:"absolute border-2 border-[var(--color-accent)] rounded-lg pointer-events-none",style:{top:T.top-r,left:T.left-r,width:T.width+r*2,height:T.height+r*2}}),n("div",{ref:s,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(Fd,{onClick:t,icon:n(ma,{class:"w-3 h-3"}),children:i("tour.skipTour")}),n("div",{class:"flex gap-2",children:[!f&&n(N,{variant:"ghost",size:"sm",onClick:_,icon:n(ti,{class:"w-3 h-3"}),children:i("actions.back")}),n(N,{variant:"primary",size:"sm",onClick:k,iconRight:n(ni,{class:"w-3 h-3"}),children:i(p?"actions.done":"actions.next")})]})]})]}),n("div",{class:"absolute inset-0",role:"presentation",onClick:m=>{if(T){const b=m.clientX,S=m.clientY;b>=T.left-r&&b<=T.right+r&&S>=T.top-r&&S<=T.bottom+r||(m.preventDefault(),m.stopPropagation())}},onKeyDown:()=>{},style:{pointerEvents:"auto"}})]}),document.body)}const QS=[{target:"[data-tour='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.",placement:"right"}],Eg=[{target:"[data-tour='chat-input']",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.",placement:"top"},{target:"[data-tour='model-picker']",title:"Model Selection",content:"Switch between different AI models per session. Each model has different capabilities and response styles.",placement:"top"},{target:"[data-tour='settings']",title:"Settings",content:"Customize your experience with 12+ themes, font sizes, time formats, and more. Preferences are saved automatically.",placement:"bottom"}],eC=[...QS,...Eg],tC=[...Eg];function nC(e){return e==="multi"?eC:tC}async function _p(){try{return(await F("cron.list",{})).jobs||[]}catch{return[]}}const rC=[{id:"chat.abort",label:i("commandPalette.commands.chat.abort"),category:"chat",icon:"⏹",shortcut:"⌘.",action:()=>{const e=Be.value;e&&Am(e)},keywords:["stop","cancel","halt"]},{id:"chat.clear",label:i("commandPalette.commands.chat.clear"),category:"chat",icon:"🗑",action:()=>{Vu()},keywords:["delete","reset","empty"]},{id:"chat.search",label:i("commandPalette.commands.chat.search"),category:"chat",icon:"🔍",shortcut:"⌘F",action:()=>{je.value=!0,En.value=""},keywords:["find","filter"]},{id:"chat.export",label:i("commandPalette.commands.chat.export"),category:"chat",icon:"📄",action:()=>{const e=Ie.value;if(e.length===0)return;const t=["# Chat Export","",`Exported: ${new Date().toLocaleString()}`,"","---",""];for(const s of e){const c=s.role==="user"?"**You**":"**Assistant**";t.push(c),t.push(""),t.push(s.content||""),t.push(""),t.push("---"),t.push("")}const r=t.join(`
|
|
423
|
-
`),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:i("commandPalette.commands.chat.copyLast"),category:"chat",icon:"📋",action:async()=>{const t=[...Ie.value].reverse().find(r=>r.role==="assistant");t?.content&&await navigator.clipboard.writeText(t.content)},keywords:["clipboard"]}],aC=[{id:"session.switch",label:i("commandPalette.commands.session.switch"),category:"session",icon:"🔄",hasSubmenu:!0,getSubmenuItems:()=>{const e=Zt.value;return ft.value.map(t=>({id:t.key,label:t.label||t.key,isActive:t.key===e,description:t.model,action:()=>{Kr(t.key),Ge(`/chat/${encodeURIComponent(t.key)}`)}}))},isAvailable:()=>!us.value&&ft.value.length>1,keywords:["change","select"]},{id:"session.delete",label:i("commandPalette.commands.session.delete"),category:"session",icon:"🗑",action:async()=>{const e=Be.value;if(e&&confirm(i("commandPalette.confirm.deleteSession")))try{await F("sessions.delete",{sessionKey:e})}catch{}},isAvailable:()=>!us.value,keywords:["remove"]},{id:"session.copy-key",label:i("commandPalette.commands.session.copyKey"),category:"session",icon:"🔑",action:async()=>{const e=Be.value;e&&await navigator.clipboard.writeText(e)},keywords:["clipboard"]}],oC=[{id:"model.change",label:i("commandPalette.commands.model.change"),category:"model",icon:"🤖",hasSubmenu:!0,getSubmenuItems:()=>Nn.value.map(e=>({id:e.id,label:e.name||e.id,description:e.provider,action:async()=>{const t=Be.value;if(t)try{await F("sessions.patch",{sessionKey:t,model:e.id})}catch{}}})),keywords:["switch","select","ai"]}],lC=[{id:"cron.run",label:i("commandPalette.commands.cron.run"),category:"cron",icon:"▶️",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await _p();return e.length===0?[{id:"none",label:i("commandPalette.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:t.name||t.id,description:t.enabled?i("common.enabled"):i("common.disabled"),action:async()=>{try{await F("cron.run",{jobId:t.id})}catch{}}}))},isAvailable:()=>D.value,keywords:["trigger","execute","schedule"]},{id:"cron.toggle",label:i("commandPalette.commands.cron.toggle"),category:"cron",icon:"⏯",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await _p();return e.length===0?[{id:"none",label:i("commandPalette.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:`${t.name||t.id}: ${t.enabled?"ON":"OFF"}`,isActive:t.enabled,action:async()=>{try{await F("cron.update",{jobId:t.id,patch:{enabled:!t.enabled}})}catch{}}}))},isAvailable:()=>D.value,keywords:["enable","disable","schedule"]}],sC=[{id:"gateway.restart",label:i("commandPalette.commands.gateway.restart"),category:"gateway",icon:"🔄",action:async()=>{if(confirm(i("commandPalette.confirm.restartGateway")))try{await F("gateway.restart",{})}catch{}},isAvailable:()=>D.value,keywords:["reboot","reload","refresh"]}],iC=[{id:"settings.theme",label:i("commandPalette.commands.settings.theme"),category:"settings",icon:"🎨",hasSubmenu:!0,getValue:()=>{const e=tt.value;return e.selected==="system"?i("commandPalette.commands.settings.systemTheme"):xc().find(a=>a.id===e.selected)?.name||e.selected},getSubmenuItems:()=>{const e=tt.value.selected,t=xc(),r=[{id:"system",label:i("commandPalette.commands.settings.systemTheme"),isActive:e==="system",action:()=>Wa("system")}];for(const a of t)r.push({id:a.id,label:a.name,description:a.appearance==="dark"?i("common.dark"):i("common.light"),isActive:e===a.id,action:()=>Wa(a.id)});return r},keywords:["dark","light","appearance","color","dracula","monokai","nord","catppuccin","gruvbox","solarized"]}],cC=[...rC,...aC,...oC,...lC,...sC,...iC];function uC(){return cC.filter(e=>e.isAvailable?e.isAvailable():!0)}function xu(e){return i(`commandPalette.categories.${e}`)}const dC=["chat","session","model","cron","gateway","settings"],fn=v(!1),Ag="cove:command-palette:recent",hC=5;function Mg(){try{const e=localStorage.getItem(Ag);return e?JSON.parse(e):[]}catch{return[]}}function Sp(e){const t=Mg().filter(r=>r!==e);t.unshift(e),localStorage.setItem(Ag,JSON.stringify(t.slice(0,hC)))}function ic(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 s=0;s<a.length&&l<r.length;s++)a[s]===r[l]&&(o+=10,l++);return l===r.length?o:0}function fC(e,t){if(!t)return 0;let r=ic(t,e.label);if(e.keywords)for(const o of e.keywords){const l=ic(t,o);l>r&&(r=l)}const a=ic(t,xu(e.category));return a>r&&(r=a),r}function Rg(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 pC(){const[e,t]=B(""),[r,a]=B(0),[o,l]=B(null),[s,c]=B(!1),d=W(null),u=W(null),h=fn.value,f=uC(),p=Mg(),g=wt(()=>{if(e)return f.map(w=>({cmd:w,score:fC(w,e)})).filter(({score:w})=>w>0).sort((w,x)=>x.score-w.score).map(({cmd:w})=>w);{const w=p.map(E=>f.find(L=>L.id===E)).filter(E=>E!==void 0),x=f.filter(E=>!p.includes(E.id));return[...w,...x]}},[f,p,e]),k=wt(()=>e?null:mC(g,p),[g,p,e]),_=wt(()=>{if(!o)return[];if(!e)return o.items;const w=e.toLowerCase();return o.items.filter(x=>x.label.toLowerCase().includes(w)||(x.description?.toLowerCase().includes(w)??!1))},[o,e]),T=o?_:g,C=wt(()=>{if(o&&_[r])return`cmd-sub-${_[r].id}`;if(g[r])return`cmd-${g[r].id}`},[o,_,g,r]);O(()=>{a(0)},[e,o]),O(()=>{h&&(t(""),a(0),l(null),setTimeout(()=>d.current?.focus(),0))},[h]),O(()=>{const w=x=>{if(fn.value){if(x.key==="Escape"){x.preventDefault(),x.stopPropagation(),o?(l(null),t(""),a(0)):fn.value=!1;return}if(x.key==="ArrowDown"){x.preventDefault(),a(E=>Math.min(E+1,T.length-1));return}if(x.key==="ArrowUp"){x.preventDefault(),a(E=>Math.max(E-1,0));return}if(x.key==="Enter"){if(x.preventDefault(),o){const E=_[r];E&&b(E)}else{const E=g[r];E&&m(E)}return}x.key==="Backspace"&&e===""&&o&&(l(null),a(0))}};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[o,_,g,r,e,T.length]),O(()=>{const w=u.current;if(!w)return;const x=w.querySelector("[aria-selected='true']");x&&x.scrollIntoView({block:"nearest"})},[r]);const m=async w=>{if(w.hasSubmenu&&w.getSubmenuItems){c(!0);try{const x=await w.getSubmenuItems();l({command:w,items:x}),a(0),t("")}finally{c(!1)}}else w.action&&(Sp(w.id),fn.value=!1,await w.action())},b=async w=>{fn.value=!1,o&&Sp(o.command.id),await w.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:()=>{fn.value=!1},onKeyDown:w=>{w.key==="Escape"&&(fn.value=!1)},role:"dialog","aria-modal":"true","aria-label":i("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:w=>w.stopPropagation(),onKeyDown:w=>w.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:w=>t(w.target.value),placeholder:o?`${o.command.label}...`:i("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":C}),s&&n("span",{class:"text-[var(--color-text-muted)] text-sm",children:i("commandPalette.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:i("commandPalette.placeholder"),children:o?n("div",{children:_.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:i(e?"commandPalette.noMatches":"commandPalette.noItems")}):_.map((w,x)=>n("button",{id:`cmd-sub-${w.id}`,role:"option","aria-selected":x===r,onClick:()=>b(w),class:Rg(x===r),children:[n("span",{class:`flex-1 ${w.isActive?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}`,children:w.label}),w.description&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:w.description}),w.isActive&&n("span",{class:"text-[var(--color-accent)]","aria-hidden":"true",children:"✓"})]},w.id))}):e?n("div",{children:g.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:i("commandPalette.noCommands")}):g.map((w,x)=>n(Cp,{command:w,isSelected:x===r,onClick:()=>m(w)},w.id))}):n("div",{children:k&&k.map(w=>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:w.label}),w.commands.map(x=>{const E=g.indexOf(x);return n(Cp,{command:x,isSelected:E===r,onClick:()=>m(x)},x.id)})]},w.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:i("commandPalette.hints.navigate")}),n("span",{children:i("commandPalette.hints.select")}),n("span",{children:i(o?"commandPalette.hints.back":"commandPalette.hints.close")})]})]})]}):null}function Cp({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:Rg(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 mC(e,t){const r=[],a=e.filter(l=>t.includes(l.id));a.length>0&&r.push({category:"recent",label:xu("recent"),commands:a});const o=e.filter(l=>!t.includes(l.id));for(const l of dC){const s=o.filter(c=>c.category===l);s.length>0&&r.push({category:l,label:xu(l),commands:s})}return r}function vC(){O(()=>{const e=t=>{t.key==="k"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),t.stopPropagation(),fn.value=!fn.value)};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[])}gx();const yu=Ru(),gC=v(!!(yu?.url&&yu.rememberMe)),Tp=v(!1),Ol=v(!Pb()&&!yu?.url),cc=v(!1);function bC(){O(()=>{Cx(),d0(),wC().finally(()=>{Tp.value=!0})},[]),vC();const e=()=>{Ol.value=!1,Ub()&&setTimeout(()=>{cc.value=!0},500)},t=()=>{Ol.value=!1},r=()=>{cc.value=!1},a=Te.value==="reconnecting",o=!Ol.value&&!a&&(Tp.value?!D.value:!gC.value);let l;return Ol.value?l=n(jS,{onComplete:e,onSkip:t}):o?l=n(l3,{}):l=n(yC,{}),n(fw,{children:[n(O2,{onError:s=>{ie.error(`Error: ${s.message}`)},children:n(A2,{children:l})}),n(L2,{position:"top-right"}),n(pC,{}),cc.value&&n(ZS,{steps:nC(gn.value),onComplete:r})]})}function xC(e){e.url==="/settings"&&mn.value!=="/settings"&&(Lm.value=mn.value),mn.value=e.url}function yC(){return n(nm,{onChange:xC,children:[n(_l,{path:"/"}),n(_l,{path:"/chat"}),n(_l,{path:"/chat/:sessionKey"}),n(f3,{path:"/overview"}),n(lS,{path:"/usage"}),n(kS,{path:"/channels"}),n(ES,{path:"/instances"}),n(FS,{path:"/sessions"}),n(B3,{path:"/cron"}),n(A5,{path:"/skills"}),n(z5,{path:"/workspace"}),n(W5,{path:"/workspace/:filename"}),n(s5,{path:"/devices"}),n(m_,{path:"/settings"}),n(d_,{path:"/config"}),n(P_,{path:"/debug"}),n(q_,{path:"/logs"}),n(_l,{default:!0})]})}async function wC(){const e=Ru();if(!e?.url||!e.rememberMe)return;const t=am();if(t)try{await Bo({url:e.url,token:e.authMode==="token"?t:void 0,password:e.authMode==="password"?t:void 0,autoReconnect:!0}),await Xs(),await Dm(),await Zu(),Kr("main"),await Xu("main"),ed(),td(),W2()}catch{$u("")}}pc(n(bC,{}),document.querySelector("#app"));
|